mbox series

[PATCHv9,00/13] cec: improve notifier support, add connector info

Message ID 20190625144510.122214-1-hverkuil-cisco@xs4all.nl (mailing list archive)
Headers show
Series cec: improve notifier support, add connector info | expand

Message

Hans Verkuil June 25, 2019, 2:44 p.m. UTC
This is a rework of Dariusz' v7 series:

https://www.spinics.net/lists/linux-media/msg151117.html

Rather than changing the existing CEC kAPI to allocate and
register CEC adapters I left it as-is. Instead new notifiers
functions are added to (un)register HDMI connector and CEC adapter
notifiers. These replace the current cec_notifier_get_conn and _put
functions.

For drivers that don't use notifiers the cec_s_conn_info function
was created so the connector info can be set directly as well.

This split in separate connector and CEC adapter functions is needed
since the notifier information is different between the two and this
makes it future proof since we will need to eventually support more
than one CEC adapter per HDMI connector.

By carefully designing these functions it is possible to convert
drivers to these new functions one-by-one, rather than as a painful
big-bang patch.

The plan is to merge the first three patches for kernel 5.3: these
patches provide the infrastructure needed by drm and cec drivers
to do the conversion during the 5.4 cycle, without requiring
patches that touch on multiple subsystems.

Once the conversion is done the new connector API can be exposed.

Various drivers have been converted as well as an example. These
are based on Dariusz' original series, but using the new notifier
functions.

Regards,

	Hans

Changes since v8:

- Complete the documentation patch (now documents the new capability
  and the new field in the state changed event)
- Take a lock in cec_adap_g_connector_info
- cec-notifier: dropped 'called_cec_notifier_register', use 'callback'
  instead.
- cec_notifier_cec_adap_unregister: don't memset adap->conn_info, it's
  not necessary.
- seco-cec: include cec-notifier instead of relying on cec.h to include
  it, since that's no longer the case.
- Move cec_notifier_register, cec_notifier_unregister and
  cec_register_cec_notifier to cec.h. This avoids sparse/smatch warnings.
- Improve cec_(drm_)connector_info docbook comments.
- CEC_CAP_CONNECTOR_INFO is now defined as (1 << 8) instead of 0, but is
  removed from the cap set in cec_adapter_allocate while this API remains
  internal.

Dariusz Marcinkiewicz (9):
  cec: add struct cec_connector_info support
  cec: expose the new connector info API
  drm_dp_cec: add connector info support.
  drm/i915/intel_hdmi: use cec_notifier_conn_(un)register
  dw-hdmi-cec: use cec_notifier_cec_adap_(un)register
  dw-hdmi: use cec_notifier_conn_(un)register
  tda9950: use cec_notifier_cec_adap_(un)register
  tda998x: use cec_notifier_conn_(un)register
  drm/vc4/vc4_hdmi: fill in connector info

Hans Verkuil (4):
  cec-notifier: rename variables, check kstrdup and n->conn_name
  cec-notifier: add new notifier functions
  cec: document CEC_ADAP_G_CONNECTOR_INFO and capability
  meson/ao-cec: use cec_notifier_cec_adap_(un)register

 Documentation/media/uapi/cec/cec-funcs.rst    |   1 +
 .../media/uapi/cec/cec-ioc-adap-g-caps.rst    |   6 +-
 .../uapi/cec/cec-ioc-adap-g-conn-info.rst     | 102 ++++++++++++++++
 .../media/uapi/cec/cec-ioc-dqevent.rst        |   8 ++
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   |   2 +-
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c |   9 +-
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c     | 104 +++++++++-------
 drivers/gpu/drm/drm_dp_cec.c                  |  25 ++--
 drivers/gpu/drm/i2c/tda9950.c                 |  11 +-
 drivers/gpu/drm/i2c/tda998x_drv.c             |  56 ++++-----
 drivers/gpu/drm/i915/intel_dp.c               |   4 +-
 drivers/gpu/drm/i915/intel_hdmi.c             |  13 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c   |   3 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c                |  13 +-
 drivers/media/cec/cec-adap.c                  |  31 +++++
 drivers/media/cec/cec-api.c                   |  20 ++++
 drivers/media/cec/cec-notifier.c              | 112 ++++++++++++++++--
 drivers/media/platform/meson/ao-cec.c         |  37 +++---
 drivers/media/platform/seco-cec/seco-cec.c    |   2 +-
 include/drm/drm_dp_helper.h                   |  14 +--
 include/media/cec-notifier.h                  | 105 ++++++++++------
 include/media/cec.h                           |  67 ++++++++++-
 include/uapi/linux/cec.h                      |  40 +++++++
 23 files changed, 606 insertions(+), 179 deletions(-)
 create mode 100644 Documentation/media/uapi/cec/cec-ioc-adap-g-conn-info.rst