26 Aug, 2017

1 commit

  • The current CEC pin value (0 or 1) was part of the cec_pin struct,
    but that assumes that CEC pin monitoring can only be used with
    a driver that uses the low-level CEC pin framework.

    But hardware that has both a high-level API and can monitor the
    CEC pin at low-level at the same time does not need to depend on
    the cec pin framework.

    To support such devices remove the cur_value field from struct cec_pin
    and add a cec_pin_is_high field to cec_adapter. This also makes it
    possible to drop the '#ifdef CONFIG_CEC_PIN' in cec-api.c.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

20 Aug, 2017

3 commits

  • The 'Press and Hold' operation was not correctly implemented, in
    particular the requirement that the repeat doesn't start until
    the second identical keypress arrives. The REP_DELAY value also
    had to be adjusted (see the comment in the code) to achieve the
    desired behavior.

    The 'enabled_protocols' field was also never set, fix that too. Since
    CEC is a fixed protocol the driver has to set this field.

    Signed-off-by: Hans Verkuil
    Acked-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • When an ir-spi is registered, you get this message.

    rc rc0: Unspecified device as /devices/platform/soc/3f215080.spi/spi_master/spi32766/spi32766.128/rc/rc0

    "Unspecified device" refers to input_name, which makes no sense for IR
    TX only devices. So, rename to device_name.

    Also make driver_name const char* so that no casts are needed anywhere.

    Now ir-spi reports:

    rc rc0: IR SPI as /devices/platform/soc/3f215080.spi/spi_master/spi32766/spi32766.128/rc/rc0

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The CEC_EVENT_PIN_LOW/HIGH defines and the cec_queue_pin_event() function
    did not specify that these were about CEC pin events.

    Since in the future there will also be HPD pin events it is wise to rename
    the event defines and function to CEC_EVENT_PIN_CEC_LOW/HIGH and
    cec_queue_pin_cec_event() now before these become part of the ABI.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

09 Aug, 2017

1 commit

  • The CEC_CAP_LOG_ADDRS, CEC_CAP_TRANSMIT, CEC_CAP_PASSTHROUGH and
    CEC_CAP_RC capabilities are normally always present.

    Add a CEC_CAP_DEFAULTS define that ORs these four caps to simplify
    drivers.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

19 Jul, 2017

1 commit

  • The cec_register_cec_notifier function was in media/cec.h, but it
    has to be in cec-notifier.h.

    While we are at it, also document it and add a stub function for when
    the notifier is disabled or the CEC core code is unreachable.

    Based on an earlier patch from Jose Abreu .

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

18 Jul, 2017

6 commits

  • Add support for CEC hardware that relies on low-level pin polling or
    GPIO interrupts.

    One example is the Allwinner SoC. But any GPIO-based CEC implementation can
    use this as well.

    A GPIO implementation is very suitable as well for debugging: it can use
    interrupts to detect state changes and report it. Userspace can then verify
    if the bus traffic is correct. This also makes error injection possible.

    The disadvantage is that it is hard to get the timings right since linux
    isn't a hard realtime system.

    In general on an idle system it works quite well, but under load the timer
    will miss its mark every so often.

    The debugfs file /sys/kernel/debug/cec/cecX/status gives some statistics
    with respect to the timer overruns.

    When the adapter is unconfigured and the low-level driver supports
    interrupts, then the interrupt will be used to detect changes. This should
    be quite accurate. But when the adapter is configured a hrtimer has to be
    used.

    The hrtimer implements a state machine where for each state the code will
    read the bus or drive the bus and go on to the next state. It will re-arm
    the timer with a delay based on the next state.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Maxime Ripard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Add support for the new MONITOR_PIN mode.

    Add the cec_pin_event function that the CEC pin code will call to queue pin
    change events.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Maxime Ripard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Event handling was always fairly simplistic since there were only
    two events. With the addition of pin events this needed to be redesigned.

    The state_change and lost_msgs events are now core events with the
    guarantee that the last state is always available. The new pin events
    are a queue of events (up to 64 for each event) and the oldest event
    will be dropped if the application cannot keep up. Lost events are
    marked with a new event flag.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Maxime Ripard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • This is needed for CEC adapters that allocate resources that have
    to be freed before the cec_adapter is deleted.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Maxime Ripard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Currently the transmit_(attempt_)done and received_msg functions set
    the timestamp themselves. For the upcoming low-level pin API we need
    to pass this as an argument instead. So make _ts variants that allow
    the caller to specify the timestamp.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Maxime Ripard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Kernel logging messes up the upcoming low-level CEC monitoring support
    which is very time-sensitive. So change the debug level of this message
    but keep a counter that is shown in the debugfs status log.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Maxime Ripard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

20 Jun, 2017

5 commits

  • Linux 4.12-rc6

    * tag 'v4.12-rc6': (813 commits)
    Linux 4.12-rc6
    mm: larger stack guard gap, between vmas
    virtio_balloon: disable VIOMMU support
    mm: correct the comment when reclaimed pages exceed the scanned pages
    userfaultfd: shmem: handle coredumping in handle_userfault()
    mm: numa: avoid waiting on freed migrated pages
    swap: cond_resched in swap_cgroup_prepare()
    mm/memory-failure.c: use compound_head() flags for huge pages
    perf unwind: Report module before querying isactivation in dwfl unwind
    fs: pass on flags in compat_writev
    objtool: Add fortify_panic as __noreturn function
    powerpc/debug: Add missing warn flag to WARN_ON's non-builtin path
    USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks
    drm: mxsfb_crtc: Reset the eLCDIF controller
    drm/mgag200: Fix to always set HiPri for G200e4 V2
    i2c: ismt: fix wrong device address when unmap the data buffer
    i2c: rcar: use correct length when unmapping DMA
    powerpc/xive: Fix offset for store EOI MMIOs
    drm/tegra: Correct idr_alloc() minimum id
    drm/tegra: Fix lockup on a use of staging API
    ...

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Add a new capability CEC_CAP_NEEDS_HPD. If this capability is set
    then the hardware can only use CEC if the HDMI Hotplug Detect pin
    is high. Such hardware cannot handle the corner case in the CEC specification
    where it is possible to transmit messages even if no hotplug signal is
    present (needed for some displays that turn off the HPD when in standby,
    but still have CEC enabled).

    Typically hardware that needs this capability have the HPD wired to the CEC
    block, often to a 'power' or 'active' pin.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • A simpler variant of cec_transmit_done to be used where the HW does
    just a single attempt at a transmit. So if the status indicates an
    error, then the corresponding error count will always be 1 and this
    function figures that out based on the status argument.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Simplifies setting the physical address to CEC_PHYS_ADDR_INVALID.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • This function simplifies the integration of CEC in DRM drivers.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

09 Jun, 2017

1 commit

  • Fix messages like this:

    adv7842.c:(.text+0x2edadd): undefined reference to `cec_unregister_adapter'

    when CEC_CORE=m but the driver including media/cec.h is built-in. In that case
    the static inlines provided in media/cec.h should be used by that driver.

    Reported-by: Randy Dunlap
    Reported-by: kbuild test robot
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

05 Jun, 2017

1 commit


19 Apr, 2017

2 commits

  • Drop the separate cec-edid.h header and merge it into cec.h.

    There was really no need to have a separate header for this.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • The Kconfig options for the CEC subsystem were a bit messy. In
    addition there were two cec sources (cec-edid.c and cec-notifier.c)
    that were outside of the media/cec directory, which was weird.

    Move those sources to media/cec as well.

    The cec-edid and cec-notifier functionality is now part of the cec
    module and these are no longer separate modules.

    Also remove the MEDIA_CEC_EDID config option and include it with the
    main CEC config option (which defined CEC_EDID anyway).

    Added static inlines to cec-edid.h for dummy functions when CEC_CORE
    isn't defined.

    CEC drivers should now depend on CEC_CORE.

    CEC drivers that need the cec-notifier functionality must explicitly
    select CEC_NOTIFIER.

    The s5p-cec and stih-cec drivers depended on VIDEO_DEV instead of
    CEC_CORE, fix that as well.

    Signed-off-by: Hans Verkuil
    Acked-by: Benjamin Gaignard
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

10 Apr, 2017

1 commit


06 Apr, 2017

1 commit

  • Add a helper function to get driver private data from CEC
    adapter. This helps the readability a little bit and allows
    to change the 'priv' field name to something else without
    needing to touch all drivers.

    Signed-off-by: Jose Abreu
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jose Abreu
     

29 Nov, 2016

1 commit

  • The cec_allocate_adapter function doesn't need the parent device, only the
    cec_register_adapter function needs it.

    Drop the cec_devnode parent field, since devnode.dev.parent can be used
    instead.

    This change makes the framework consistent with other frameworks where the
    parent device is not used until the device is registered.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

17 Nov, 2016

1 commit


23 Aug, 2016

1 commit


20 Jul, 2016

1 commit

  • The size of the transmit queue was unlimited, which meant that
    in non-blocking mode you could flood the CEC adapter with messages
    to be transmitted.

    Limit this to 18 messages.

    Also print the number of pending transmits and the timeout value
    in the status debugfs file.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

28 Jun, 2016

1 commit

  • The added HDMI CEC framework provides a generic kernel interface for
    HDMI CEC devices.

    Note that the CEC framework is added to staging/media and that the
    cec.h and cec-funcs.h headers are not exported yet. While the kABI
    is mature, I would prefer to allow the uABI some more time before
    it is mainlined in case it needs more tweaks.

    This adds the cec-core.c, media/cec.h and cec-priv.h sources.

    Signed-off-by: Hans Verkuil
    [k.debski@samsung.com: Merged CEC Updates commit by Hans Verkuil]
    [k.debski@samsung.com: Merged Update author commit by Hans Verkuil]
    [k.debski@samsung.com: code cleanup and fixes]
    [k.debski@samsung.com: add missing CEC commands to match spec]
    [k.debski@samsung.com: add RC framework support]
    [k.debski@samsung.com: move and edit documentation]
    [k.debski@samsung.com: add vendor id reporting]
    [k.debski@samsung.com: reorder of API structs and add reserved fields]
    [k.debski@samsung.com: fix handling of events and fix 32/64bit timespec problem]
    [k.debski@samsung.com: add sequence number handling]
    [k.debski@samsung.com: add passthrough mode]
    [k.debski@samsung.com: fix CEC defines, add missing CEC 2.0 commands]
    Signed-off-by: Kamil Debski

    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil