1. 16 Jun, 2016 7 commits
  2. 15 Jun, 2016 3 commits
  3. 14 Jun, 2016 1 commit
  4. 13 Jun, 2016 1 commit
  5. 10 Jun, 2016 16 commits
  6. 09 Jun, 2016 4 commits
  7. 08 Jun, 2016 5 commits
  8. 07 Jun, 2016 3 commits
    • Bryan O'Donoghue's avatar
      greybus: timesync: Add debugfs entry to display frame-ping in ktime · 423042f4
      Bryan O'Donoghue authored
      This patch makes a debugfs entry in
      /sys/kernel/debug/greybus/X-svc/frame-ktime that generates a TimeSync ping
      event to the system and then subsequently presents that data to user-space
      as a ktime/timespec clock-monotonic value rather than as a raw frame-time,
      to aid humans in debugging and understanding frame-time and to provide an
      example of the converting a frame-time to timespec/ktime to other
      developers.
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Acked-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      423042f4
    • Bryan O'Donoghue's avatar
      greybus: timesync: Add gb_timesync_frame_time_to_timespec() · 00fdbae1
      Bryan O'Donoghue authored
      This patch adds gb_timesync_to_timespec_by_svc() and
      gb_timesync_to_timespec_by_interface() respectively. These routines will
      convert from a given FrameTime to a ktime/timespec within an envelope of
      about 17 seconds. The purpose of this routine is to enable reporting of a
      FrameTime from a Module such as a Camera Module and to allow the AP to
      then convert this timestamp into a Linux-native timestamp such as ktime.
      This is useful and required in the v4l layer.
      
      At 19.2MHz the accuracy of this conversion is about .3 femtoseconds per
      count, which means at a 1 second offset from the reference the cumulative
      error is about 1.59 nanoseconds. 1.59 nanoseconds is still less than 1
      clock's worth of error @ 19.2MHz where each clock is 52.0833~ nanoseconds.
      
      We're aiming for a maximum error rate of 30 nanoseconds which means at the
      clock rate we are running at, the conversion from a FrameTime to a Linux
      ktime/timespec can be plus-or-minus about 17 seconds from the reference
      FrameTime/ktime pair before the routine will refuse to convert.
      
      A realistic use-case for this routine is envisaged to be
      
      - Greybus message received
      - Some processing takes place - taking milliseconds
      - Call into this routine is made
      - Actual time between event in Module and conversion in AP < 1 second
      - Error rate in conversion at 1.59 nanoseconds is less than 1 clock
        @ 19.2MHz
      
      This routine is not designed to allow for conversions for events with
      large gaps between the event time and the current reference time for
      conversion. Since FrameTime can be a very large integer we cannot convert
      an arbitrarily large FrameTime to ktime, the feeling and objective here is
      to make an over-provisioned envelope that in practical terms can never be
      exceeded by expected use-cases. To convert longer gaps more work would have
      to be done but ultimately some limit needs to be imposed and right now 0.3
      femotseconds per clock on MSM8994 is both accurate and generous.
      
      Adds:
      - timesync.c::gb_timesync_frame_time_to_timespec_by_svc(
      						 struct gb_svc *,
      						 u64 frame_time,
                                                       struct timespec *ts)
        - gb_svc is a pointer to a standard greybus SVC data structure
        - frame_time is a system FrameTime.
        - ts is an output parameter which represents the converted FrameTime
          as a CLOCK_MONOTONIC timespec value.
        - Returns 0 on success or a negative number indicating the type of
          error on failure.
      
      - timesync.c::gb_timesync_frame_time_to_timespec_by_interface(
      						 struct gb_interface *,
      						 u64 frame_time,
                                                       struct timespec *ts)
        - gb_svc is a pointer to a standard greybus Interface data structure
        - frame_time is a system FrameTime.
        - ts is an output parameter which represents the converted FrameTime
          as a CLOCK_MONOTONIC timespec value.
        - Returns 0 on success or a negative number indicating the type of
          error on failure.
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Acked-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      00fdbae1
    • Bryan O'Donoghue's avatar
      greybus: tracepoints: Add standard Linux tracepoint for TimeSync event · 6da7c889
      Bryan O'Donoghue authored
      This patch adds a tracepoint to the TimeSync ISR, the purpose of which is
      to indicate a TimeSync event has happened. This tracepoint can be enabled
      by issuing the following command:
      
      echo 1 > /sys/kernel/debug/tracing/events/greybus/gb_timesync_irq/enable
      
      Synchronization looks like this:
      
       TIMESTAMP  FUNCTION
          |         |
      147.865788: gb_timesync_irq: strobe 1/4 frame-time 2910076529
      147.866781: gb_timesync_irq: strobe 2/4 frame-time 2910095689
      147.867777: gb_timesync_irq: strobe 3/4 frame-time 2910114820
      147.868791: gb_timesync_irq: strobe 4/4 frame-time 2910134038
      
      A ping can be triggered like this:
      
      cat /sys/kernel/debug/greybus/frame-time
      
      And that ping looks like this:
      
       TIMESTAMP  FUNCTION
          |         |
      147.934678: gb_timesync_irq: ping 4/4 frame-time 2911380356
      169.280551: gb_timesync_irq: ping 4/4 frame-time 3321221069
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Reviewed-by: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
      Acked-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      6da7c889