Dariusz Marcinkiewicz
2019-Aug-14 10:44 UTC
[Nouveau] [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API
This series updates DRM drivers to use new CEC notifier API. Changes since v6: Made CEC notifiers' registration and de-registration symmetric in tda998x and dw-hdmi drivers. Also, accidentally dropped one patch in v6 (change to drm_dp_cec), brought it back now. Changes since v5: Fixed a warning about a missing comment for a new member of drm_dp_aux_cec struct. Sending to a wider audience, including maintainers of respective drivers. Changes since v4: Addressing review comments. Changes since v3: Updated adapter flags in dw-hdmi-cec. Changes since v2: Include all DRM patches from "cec: improve notifier support, add connector info connector info" series. Changes since v1: Those patches delay creation of notifiers until respective connectors are constructed. It seems that those patches, for a couple of drivers, by adding the delay, introduce a race between notifiers' creation and the IRQs handling threads - at least I don't see anything obvious in there that would explicitly forbid such races to occur. v2 adds a write barrier to make sure IRQ threads see the notifier once it is created (replacing the WRITE_ONCE I put in v1). The best thing to do here, I believe, would be not to have any synchronization and make sure that an IRQ only gets enabled after the notifier is created. Dariusz Marcinkiewicz (9): 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 tda9950: use cec_notifier_cec_adap_(un)register drm: tda998x: use cec_notifier_conn_(un)register drm: sti: use cec_notifier_conn_(un)register drm: tegra: use cec_notifier_conn_(un)register drm: dw-hdmi: use cec_notifier_conn_(un)register drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 13 +++--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 46 +++++++++++++------ drivers/gpu/drm/drm_dp_cec.c | 25 ++++++---- drivers/gpu/drm/exynos/exynos_hdmi.c | 31 +++++++------ drivers/gpu/drm/i2c/tda9950.c | 12 ++--- drivers/gpu/drm/i2c/tda998x_drv.c | 36 ++++++++++----- drivers/gpu/drm/i915/display/intel_dp.c | 4 +- drivers/gpu/drm/i915/display/intel_hdmi.c | 13 ++++-- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +- drivers/gpu/drm/sti/sti_hdmi.c | 19 +++++--- drivers/gpu/drm/tegra/output.c | 28 ++++++++--- include/drm/drm_dp_helper.h | 17 ++++--- 13 files changed, 155 insertions(+), 94 deletions(-) -- 2.23.0.rc1.153.gdeed80330f-goog
Dariusz Marcinkiewicz
2019-Aug-14 10:44 UTC
[Nouveau] [PATCH v7 1/9] drm_dp_cec: add connector info support.
Pass the connector info to the CEC adapter. This makes it possible to associate the CEC adapter with the corresponding drm connector. Signed-off-by: Dariusz Marcinkiewicz <darekm at google.com> Signed-off-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> Tested-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> --- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- drivers/gpu/drm/drm_dp_cec.c | 25 ++++++++++++------- drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +-- include/drm/drm_dp_helper.h | 17 ++++++------- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 16218a202b591..5ec14efd4d8cb 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -416,7 +416,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, drm_dp_aux_register(&aconnector->dm_dp_aux.aux); drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux, - aconnector->base.name, dm->adev->dev); + &aconnector->base); aconnector->mst_mgr.cbs = &dm_mst_cbs; drm_dp_mst_topology_mgr_init( &aconnector->mst_mgr, diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c index b15cee85b702b..b457c16c3a8bb 100644 --- a/drivers/gpu/drm/drm_dp_cec.c +++ b/drivers/gpu/drm/drm_dp_cec.c @@ -8,7 +8,9 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> +#include <drm/drm_connector.h> #include <drm/drm_dp_helper.h> +#include <drm/drmP.h> #include <media/cec.h> /* @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct work_struct *work) */ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) { - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD; + struct drm_connector *connector = aux->cec.connector; + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD | + CEC_CAP_CONNECTOR_INFO; + struct cec_connector_info conn_info; unsigned int num_las = 1; u8 cap; @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) /* Create a new adapter */ aux->cec.adap = cec_allocate_adapter(&drm_dp_cec_adap_ops, - aux, aux->cec.name, cec_caps, + aux, connector->name, cec_caps, num_las); if (IS_ERR(aux->cec.adap)) { aux->cec.adap = NULL; goto unlock; } - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) { + + cec_fill_conn_info_from_drm(&conn_info, connector); + cec_s_conn_info(aux->cec.adap, &conn_info); + + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { cec_delete_adapter(aux->cec.adap); aux->cec.adap = NULL; } else { @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid); /** * drm_dp_cec_register_connector() - register a new connector * @aux: DisplayPort AUX channel - * @name: name of the CEC device - * @parent: parent device + * @connector: drm connector * * A new connector was registered with associated CEC adapter name and * CEC adapter parent device. After registering the name and parent * drm_dp_cec_set_edid() is called to check if the connector supports * CEC and to register a CEC adapter if that is the case. */ -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, - struct device *parent) +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, + struct drm_connector *connector) { WARN_ON(aux->cec.adap); if (WARN_ON(!aux->transfer)) return; - aux->cec.name = name; - aux->cec.parent = parent; + aux->cec.connector = connector; INIT_DELAYED_WORK(&aux->cec.unregister_work, drm_dp_cec_unregister_work); } diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 1092499115760..de2486fe7bf2d 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5497,7 +5497,6 @@ static int intel_dp_connector_register(struct drm_connector *connector) { struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_device *dev = connector->dev; int ret; ret = intel_connector_register(connector); @@ -5512,8 +5511,7 @@ intel_dp_connector_register(struct drm_connector *connector) intel_dp->aux.dev = connector->kdev; ret = drm_dp_aux_register(&intel_dp->aux); if (!ret) - drm_dp_cec_register_connector(&intel_dp->aux, - connector->name, dev->dev); + drm_dp_cec_register_connector(&intel_dp->aux, connector); return ret; } diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 330d7d29a6e34..8aa703347eb54 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1416,8 +1416,7 @@ nouveau_connector_create(struct drm_device *dev, switch (type) { case DRM_MODE_CONNECTOR_DisplayPort: case DRM_MODE_CONNECTOR_eDP: - drm_dp_cec_register_connector(&nv_connector->aux, - connector->name, dev->dev); + drm_dp_cec_register_connector(&nv_connector->aux, connector); break; } diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 8364502f92cfe..7972b925a952b 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1230,20 +1230,19 @@ struct drm_dp_aux_msg { struct cec_adapter; struct edid; +struct drm_connector; /** * struct drm_dp_aux_cec - DisplayPort CEC-Tunneling-over-AUX * @lock: mutex protecting this struct * @adap: the CEC adapter for CEC-Tunneling-over-AUX support. - * @name: name of the CEC adapter - * @parent: parent device of the CEC adapter + * @connector: the connector this CEC adapter is associated with * @unregister_work: unregister the CEC adapter */ struct drm_dp_aux_cec { struct mutex lock; struct cec_adapter *adap; - const char *name; - struct device *parent; + struct drm_connector *connector; struct delayed_work unregister_work; }; @@ -1451,8 +1450,8 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk) #ifdef CONFIG_DRM_DP_CEC void drm_dp_cec_irq(struct drm_dp_aux *aux); -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, - struct device *parent); +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, + struct drm_connector *connector); void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux); void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid); void drm_dp_cec_unset_edid(struct drm_dp_aux *aux); @@ -1461,9 +1460,9 @@ static inline void drm_dp_cec_irq(struct drm_dp_aux *aux) { } -static inline void drm_dp_cec_register_connector(struct drm_dp_aux *aux, - const char *name, - struct device *parent) +static inline void +drm_dp_cec_register_connector(struct drm_dp_aux *aux, + struct drm_connector *connector) { } -- 2.23.0.rc1.153.gdeed80330f-goog
Lyude Paul
2019-Aug-15 18:10 UTC
[Nouveau] [PATCH v7 1/9] drm_dp_cec: add connector info support.
Reviewed-by: Lyude Paul <lyude at redhat.com> On Wed, 2019-08-14 at 12:44 +0200, Dariusz Marcinkiewicz wrote:> Pass the connector info to the CEC adapter. This makes it possible > to associate the CEC adapter with the corresponding drm connector. > > Signed-off-by: Dariusz Marcinkiewicz <darekm at google.com> > Signed-off-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> > Tested-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> > --- > .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- > drivers/gpu/drm/drm_dp_cec.c | 25 ++++++++++++------- > drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- > drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +-- > include/drm/drm_dp_helper.h | 17 ++++++------- > 5 files changed, 27 insertions(+), 24 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > index 16218a202b591..5ec14efd4d8cb 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > @@ -416,7 +416,7 @@ void amdgpu_dm_initialize_dp_connector(struct > amdgpu_display_manager *dm, > > drm_dp_aux_register(&aconnector->dm_dp_aux.aux); > drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux, > - aconnector->base.name, dm->adev->dev); > + &aconnector->base); > aconnector->mst_mgr.cbs = &dm_mst_cbs; > drm_dp_mst_topology_mgr_init( > &aconnector->mst_mgr, > diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c > index b15cee85b702b..b457c16c3a8bb 100644 > --- a/drivers/gpu/drm/drm_dp_cec.c > +++ b/drivers/gpu/drm/drm_dp_cec.c > @@ -8,7 +8,9 @@ > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/slab.h> > +#include <drm/drm_connector.h> > #include <drm/drm_dp_helper.h> > +#include <drm/drmP.h> > #include <media/cec.h> > > /* > @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct work_struct > *work) > */ > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) > { > - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD; > + struct drm_connector *connector = aux->cec.connector; > + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD | > + CEC_CAP_CONNECTOR_INFO; > + struct cec_connector_info conn_info; > unsigned int num_las = 1; > u8 cap; > > @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const > struct edid *edid) > > /* Create a new adapter */ > aux->cec.adap = cec_allocate_adapter(&drm_dp_cec_adap_ops, > - aux, aux->cec.name, cec_caps, > + aux, connector->name, cec_caps, > num_las); > if (IS_ERR(aux->cec.adap)) { > aux->cec.adap = NULL; > goto unlock; > } > - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) { > + > + cec_fill_conn_info_from_drm(&conn_info, connector); > + cec_s_conn_info(aux->cec.adap, &conn_info); > + > + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { > cec_delete_adapter(aux->cec.adap); > aux->cec.adap = NULL; > } else { > @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid); > /** > * drm_dp_cec_register_connector() - register a new connector > * @aux: DisplayPort AUX channel > - * @name: name of the CEC device > - * @parent: parent device > + * @connector: drm connector > * > * A new connector was registered with associated CEC adapter name and > * CEC adapter parent device. After registering the name and parent > * drm_dp_cec_set_edid() is called to check if the connector supports > * CEC and to register a CEC adapter if that is the case. > */ > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, > - struct device *parent) > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector) > { > WARN_ON(aux->cec.adap); > if (WARN_ON(!aux->transfer)) > return; > - aux->cec.name = name; > - aux->cec.parent = parent; > + aux->cec.connector = connector; > INIT_DELAYED_WORK(&aux->cec.unregister_work, > drm_dp_cec_unregister_work); > } > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c > b/drivers/gpu/drm/i915/display/intel_dp.c > index 1092499115760..de2486fe7bf2d 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -5497,7 +5497,6 @@ static int > intel_dp_connector_register(struct drm_connector *connector) > { > struct intel_dp *intel_dp = intel_attached_dp(connector); > - struct drm_device *dev = connector->dev; > int ret; > > ret = intel_connector_register(connector); > @@ -5512,8 +5511,7 @@ intel_dp_connector_register(struct drm_connector > *connector) > intel_dp->aux.dev = connector->kdev; > ret = drm_dp_aux_register(&intel_dp->aux); > if (!ret) > - drm_dp_cec_register_connector(&intel_dp->aux, > - connector->name, dev->dev); > + drm_dp_cec_register_connector(&intel_dp->aux, connector); > return ret; > } > > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c > b/drivers/gpu/drm/nouveau/nouveau_connector.c > index 330d7d29a6e34..8aa703347eb54 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.c > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c > @@ -1416,8 +1416,7 @@ nouveau_connector_create(struct drm_device *dev, > switch (type) { > case DRM_MODE_CONNECTOR_DisplayPort: > case DRM_MODE_CONNECTOR_eDP: > - drm_dp_cec_register_connector(&nv_connector->aux, > - connector->name, dev->dev); > + drm_dp_cec_register_connector(&nv_connector->aux, connector); > break; > } > > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h > index 8364502f92cfe..7972b925a952b 100644 > --- a/include/drm/drm_dp_helper.h > +++ b/include/drm/drm_dp_helper.h > @@ -1230,20 +1230,19 @@ struct drm_dp_aux_msg { > > struct cec_adapter; > struct edid; > +struct drm_connector; > > /** > * struct drm_dp_aux_cec - DisplayPort CEC-Tunneling-over-AUX > * @lock: mutex protecting this struct > * @adap: the CEC adapter for CEC-Tunneling-over-AUX support. > - * @name: name of the CEC adapter > - * @parent: parent device of the CEC adapter > + * @connector: the connector this CEC adapter is associated with > * @unregister_work: unregister the CEC adapter > */ > struct drm_dp_aux_cec { > struct mutex lock; > struct cec_adapter *adap; > - const char *name; > - struct device *parent; > + struct drm_connector *connector; > struct delayed_work unregister_work; > }; > > @@ -1451,8 +1450,8 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum > drm_dp_quirk quirk) > > #ifdef CONFIG_DRM_DP_CEC > void drm_dp_cec_irq(struct drm_dp_aux *aux); > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, > - struct device *parent); > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector); > void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux); > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid); > void drm_dp_cec_unset_edid(struct drm_dp_aux *aux); > @@ -1461,9 +1460,9 @@ static inline void drm_dp_cec_irq(struct drm_dp_aux > *aux) > { > } > > -static inline void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > - const char *name, > - struct device *parent) > +static inline void > +drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector) > { > } >
Hans Verkuil
2019-Aug-19 09:38 UTC
[Nouveau] [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API
Hi all, The patches in this series can be applied independently from each other. If you maintain one of these drivers and you want to merge it for v5.4 yourself, then please do so and let me know. If you prefer I commit it to drm-misc, then please review and (hopefully) Ack the patch. I would really like to get this in for v5.4 so I can get the userspace bits in for v5.4 as well through the media subsystem. Dariusz, can you post a v7.1 for patch 5/9 fixing the typo? Thanks! Hans On 8/14/19 12:44 PM, Dariusz Marcinkiewicz wrote:> This series updates DRM drivers to use new CEC notifier API. > > Changes since v6: > Made CEC notifiers' registration and de-registration symmetric > in tda998x and dw-hdmi drivers. Also, accidentally dropped one > patch in v6 (change to drm_dp_cec), brought it back now. > Changes since v5: > Fixed a warning about a missing comment for a new member of > drm_dp_aux_cec struct. Sending to a wider audience, > including maintainers of respective drivers. > Changes since v4: > Addressing review comments. > Changes since v3: > Updated adapter flags in dw-hdmi-cec. > Changes since v2: > Include all DRM patches from "cec: improve notifier support, > add connector info connector info" series. > Changes since v1: > Those patches delay creation of notifiers until respective > connectors are constructed. It seems that those patches, for a > couple of drivers, by adding the delay, introduce a race between > notifiers' creation and the IRQs handling threads - at least I > don't see anything obvious in there that would explicitly forbid > such races to occur. v2 adds a write barrier to make sure IRQ > threads see the notifier once it is created (replacing the > WRITE_ONCE I put in v1). The best thing to do here, I believe, > would be not to have any synchronization and make sure that an IRQ > only gets enabled after the notifier is created. > Dariusz Marcinkiewicz (9): > 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 > tda9950: use cec_notifier_cec_adap_(un)register > drm: tda998x: use cec_notifier_conn_(un)register > drm: sti: use cec_notifier_conn_(un)register > drm: tegra: use cec_notifier_conn_(un)register > drm: dw-hdmi: use cec_notifier_conn_(un)register > drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register > > .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- > drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 13 +++--- > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 46 +++++++++++++------ > drivers/gpu/drm/drm_dp_cec.c | 25 ++++++---- > drivers/gpu/drm/exynos/exynos_hdmi.c | 31 +++++++------ > drivers/gpu/drm/i2c/tda9950.c | 12 ++--- > drivers/gpu/drm/i2c/tda998x_drv.c | 36 ++++++++++----- > drivers/gpu/drm/i915/display/intel_dp.c | 4 +- > drivers/gpu/drm/i915/display/intel_hdmi.c | 13 ++++-- > drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +- > drivers/gpu/drm/sti/sti_hdmi.c | 19 +++++--- > drivers/gpu/drm/tegra/output.c | 28 ++++++++--- > include/drm/drm_dp_helper.h | 17 ++++--- > 13 files changed, 155 insertions(+), 94 deletions(-) >
Dariusz Marcinkiewicz
2019-Aug-19 11:28 UTC
[Nouveau] [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API
On Mon, Aug 19, 2019 at 11:38 AM Hans Verkuil <hverkuil-cisco at xs4all.nl> wrote:> > Hi all, >Hi Hans.> The patches in this series can be applied independently from each other. > > If you maintain one of these drivers and you want to merge it for v5.4 > yourself, then please do so and let me know. If you prefer I commit it > to drm-misc, then please review and (hopefully) Ack the patch. > > I would really like to get this in for v5.4 so I can get the userspace > bits in for v5.4 as well through the media subsystem. > > Dariusz, can you post a v7.1 for patch 5/9 fixing the typo? >Done. I think it would be good to test v7 changes to dw-hdmi and tda998x on a real hardware. Hans, do you think you would be able to test those? Thank you.
Neil Armstrong
2019-Aug-19 14:48 UTC
[Nouveau] [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API
Hi Dariusz, Hans, I can apply the dw-hdmi patches if necessary. Neil On 19/08/2019 11:38, Hans Verkuil wrote:> Hi all, > > The patches in this series can be applied independently from each other. > > If you maintain one of these drivers and you want to merge it for v5.4 > yourself, then please do so and let me know. If you prefer I commit it > to drm-misc, then please review and (hopefully) Ack the patch. > > I would really like to get this in for v5.4 so I can get the userspace > bits in for v5.4 as well through the media subsystem. > > Dariusz, can you post a v7.1 for patch 5/9 fixing the typo? > > Thanks! > > Hans > > On 8/14/19 12:44 PM, Dariusz Marcinkiewicz wrote: >> This series updates DRM drivers to use new CEC notifier API. >> >> Changes since v6: >> Made CEC notifiers' registration and de-registration symmetric >> in tda998x and dw-hdmi drivers. Also, accidentally dropped one >> patch in v6 (change to drm_dp_cec), brought it back now. >> Changes since v5: >> Fixed a warning about a missing comment for a new member of >> drm_dp_aux_cec struct. Sending to a wider audience, >> including maintainers of respective drivers. >> Changes since v4: >> Addressing review comments. >> Changes since v3: >> Updated adapter flags in dw-hdmi-cec. >> Changes since v2: >> Include all DRM patches from "cec: improve notifier support, >> add connector info connector info" series. >> Changes since v1: >> Those patches delay creation of notifiers until respective >> connectors are constructed. It seems that those patches, for a >> couple of drivers, by adding the delay, introduce a race between >> notifiers' creation and the IRQs handling threads - at least I >> don't see anything obvious in there that would explicitly forbid >> such races to occur. v2 adds a write barrier to make sure IRQ >> threads see the notifier once it is created (replacing the >> WRITE_ONCE I put in v1). The best thing to do here, I believe, >> would be not to have any synchronization and make sure that an IRQ >> only gets enabled after the notifier is created. >> Dariusz Marcinkiewicz (9): >> 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 >> tda9950: use cec_notifier_cec_adap_(un)register >> drm: tda998x: use cec_notifier_conn_(un)register >> drm: sti: use cec_notifier_conn_(un)register >> drm: tegra: use cec_notifier_conn_(un)register >> drm: dw-hdmi: use cec_notifier_conn_(un)register >> drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register >> >> .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- >> drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 13 +++--- >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 46 +++++++++++++------ >> drivers/gpu/drm/drm_dp_cec.c | 25 ++++++---- >> drivers/gpu/drm/exynos/exynos_hdmi.c | 31 +++++++------ >> drivers/gpu/drm/i2c/tda9950.c | 12 ++--- >> drivers/gpu/drm/i2c/tda998x_drv.c | 36 ++++++++++----- >> drivers/gpu/drm/i915/display/intel_dp.c | 4 +- >> drivers/gpu/drm/i915/display/intel_hdmi.c | 13 ++++-- >> drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +- >> drivers/gpu/drm/sti/sti_hdmi.c | 19 +++++--- >> drivers/gpu/drm/tegra/output.c | 28 ++++++++--- >> include/drm/drm_dp_helper.h | 17 ++++--- >> 13 files changed, 155 insertions(+), 94 deletions(-) >> >
Hans Verkuil
2019-Aug-22 08:08 UTC
[Nouveau] [PATCH v7 1/9] drm_dp_cec: add connector info support.
Alex, Ville/Rodrigo, Ben, Can you (hopefully) Ack this patch so that I can merge it? Thank you! Hans On 8/14/19 12:44 PM, Dariusz Marcinkiewicz wrote:> Pass the connector info to the CEC adapter. This makes it possible > to associate the CEC adapter with the corresponding drm connector. > > Signed-off-by: Dariusz Marcinkiewicz <darekm at google.com> > Signed-off-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> > Tested-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> > --- > .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- > drivers/gpu/drm/drm_dp_cec.c | 25 ++++++++++++------- > drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- > drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +-- > include/drm/drm_dp_helper.h | 17 ++++++------- > 5 files changed, 27 insertions(+), 24 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > index 16218a202b591..5ec14efd4d8cb 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > @@ -416,7 +416,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, > > drm_dp_aux_register(&aconnector->dm_dp_aux.aux); > drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux, > - aconnector->base.name, dm->adev->dev); > + &aconnector->base); > aconnector->mst_mgr.cbs = &dm_mst_cbs; > drm_dp_mst_topology_mgr_init( > &aconnector->mst_mgr, > diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c > index b15cee85b702b..b457c16c3a8bb 100644 > --- a/drivers/gpu/drm/drm_dp_cec.c > +++ b/drivers/gpu/drm/drm_dp_cec.c > @@ -8,7 +8,9 @@ > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/slab.h> > +#include <drm/drm_connector.h> > #include <drm/drm_dp_helper.h> > +#include <drm/drmP.h> > #include <media/cec.h> > > /* > @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct work_struct *work) > */ > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) > { > - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD; > + struct drm_connector *connector = aux->cec.connector; > + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD | > + CEC_CAP_CONNECTOR_INFO; > + struct cec_connector_info conn_info; > unsigned int num_las = 1; > u8 cap; > > @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) > > /* Create a new adapter */ > aux->cec.adap = cec_allocate_adapter(&drm_dp_cec_adap_ops, > - aux, aux->cec.name, cec_caps, > + aux, connector->name, cec_caps, > num_las); > if (IS_ERR(aux->cec.adap)) { > aux->cec.adap = NULL; > goto unlock; > } > - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) { > + > + cec_fill_conn_info_from_drm(&conn_info, connector); > + cec_s_conn_info(aux->cec.adap, &conn_info); > + > + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { > cec_delete_adapter(aux->cec.adap); > aux->cec.adap = NULL; > } else { > @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid); > /** > * drm_dp_cec_register_connector() - register a new connector > * @aux: DisplayPort AUX channel > - * @name: name of the CEC device > - * @parent: parent device > + * @connector: drm connector > * > * A new connector was registered with associated CEC adapter name and > * CEC adapter parent device. After registering the name and parent > * drm_dp_cec_set_edid() is called to check if the connector supports > * CEC and to register a CEC adapter if that is the case. > */ > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, > - struct device *parent) > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector) > { > WARN_ON(aux->cec.adap); > if (WARN_ON(!aux->transfer)) > return; > - aux->cec.name = name; > - aux->cec.parent = parent; > + aux->cec.connector = connector; > INIT_DELAYED_WORK(&aux->cec.unregister_work, > drm_dp_cec_unregister_work); > } > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c > index 1092499115760..de2486fe7bf2d 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -5497,7 +5497,6 @@ static int > intel_dp_connector_register(struct drm_connector *connector) > { > struct intel_dp *intel_dp = intel_attached_dp(connector); > - struct drm_device *dev = connector->dev; > int ret; > > ret = intel_connector_register(connector); > @@ -5512,8 +5511,7 @@ intel_dp_connector_register(struct drm_connector *connector) > intel_dp->aux.dev = connector->kdev; > ret = drm_dp_aux_register(&intel_dp->aux); > if (!ret) > - drm_dp_cec_register_connector(&intel_dp->aux, > - connector->name, dev->dev); > + drm_dp_cec_register_connector(&intel_dp->aux, connector); > return ret; > } > > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c > index 330d7d29a6e34..8aa703347eb54 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.c > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c > @@ -1416,8 +1416,7 @@ nouveau_connector_create(struct drm_device *dev, > switch (type) { > case DRM_MODE_CONNECTOR_DisplayPort: > case DRM_MODE_CONNECTOR_eDP: > - drm_dp_cec_register_connector(&nv_connector->aux, > - connector->name, dev->dev); > + drm_dp_cec_register_connector(&nv_connector->aux, connector); > break; > } > > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h > index 8364502f92cfe..7972b925a952b 100644 > --- a/include/drm/drm_dp_helper.h > +++ b/include/drm/drm_dp_helper.h > @@ -1230,20 +1230,19 @@ struct drm_dp_aux_msg { > > struct cec_adapter; > struct edid; > +struct drm_connector; > > /** > * struct drm_dp_aux_cec - DisplayPort CEC-Tunneling-over-AUX > * @lock: mutex protecting this struct > * @adap: the CEC adapter for CEC-Tunneling-over-AUX support. > - * @name: name of the CEC adapter > - * @parent: parent device of the CEC adapter > + * @connector: the connector this CEC adapter is associated with > * @unregister_work: unregister the CEC adapter > */ > struct drm_dp_aux_cec { > struct mutex lock; > struct cec_adapter *adap; > - const char *name; > - struct device *parent; > + struct drm_connector *connector; > struct delayed_work unregister_work; > }; > > @@ -1451,8 +1450,8 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk) > > #ifdef CONFIG_DRM_DP_CEC > void drm_dp_cec_irq(struct drm_dp_aux *aux); > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, > - struct device *parent); > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector); > void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux); > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid); > void drm_dp_cec_unset_edid(struct drm_dp_aux *aux); > @@ -1461,9 +1460,9 @@ static inline void drm_dp_cec_irq(struct drm_dp_aux *aux) > { > } > > -static inline void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > - const char *name, > - struct device *parent) > +static inline void > +drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector) > { > } > >
Ville Syrjälä
2019-Aug-28 15:05 UTC
[Nouveau] [PATCH v7 1/9] drm_dp_cec: add connector info support.
On Wed, Aug 14, 2019 at 12:44:59PM +0200, Dariusz Marcinkiewicz wrote:> Pass the connector info to the CEC adapter. This makes it possible > to associate the CEC adapter with the corresponding drm connector. > > Signed-off-by: Dariusz Marcinkiewicz <darekm at google.com> > Signed-off-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> > Tested-by: Hans Verkuil <hverkuil-cisco at xs4all.nl> > --- > .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- > drivers/gpu/drm/drm_dp_cec.c | 25 ++++++++++++------- > drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- > drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +-- > include/drm/drm_dp_helper.h | 17 ++++++------- > 5 files changed, 27 insertions(+), 24 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > index 16218a202b591..5ec14efd4d8cb 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > @@ -416,7 +416,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, > > drm_dp_aux_register(&aconnector->dm_dp_aux.aux); > drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux, > - aconnector->base.name, dm->adev->dev); > + &aconnector->base); > aconnector->mst_mgr.cbs = &dm_mst_cbs; > drm_dp_mst_topology_mgr_init( > &aconnector->mst_mgr, > diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c > index b15cee85b702b..b457c16c3a8bb 100644 > --- a/drivers/gpu/drm/drm_dp_cec.c > +++ b/drivers/gpu/drm/drm_dp_cec.c > @@ -8,7 +8,9 @@ > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/slab.h> > +#include <drm/drm_connector.h> > #include <drm/drm_dp_helper.h> > +#include <drm/drmP.h> > #include <media/cec.h> > > /* > @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct work_struct *work) > */ > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) > { > - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD; > + struct drm_connector *connector = aux->cec.connector; > + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD | > + CEC_CAP_CONNECTOR_INFO; > + struct cec_connector_info conn_info; > unsigned int num_las = 1; > u8 cap; > > @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) > > /* Create a new adapter */ > aux->cec.adap = cec_allocate_adapter(&drm_dp_cec_adap_ops, > - aux, aux->cec.name, cec_caps, > + aux, connector->name, cec_caps, > num_las); > if (IS_ERR(aux->cec.adap)) { > aux->cec.adap = NULL; > goto unlock; > } > - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) { > + > + cec_fill_conn_info_from_drm(&conn_info, connector); > + cec_s_conn_info(aux->cec.adap, &conn_info); > + > + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { > cec_delete_adapter(aux->cec.adap); > aux->cec.adap = NULL; > } else { > @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid); > /** > * drm_dp_cec_register_connector() - register a new connector > * @aux: DisplayPort AUX channel > - * @name: name of the CEC device > - * @parent: parent device > + * @connector: drm connector > * > * A new connector was registered with associated CEC adapter name and > * CEC adapter parent device. After registering the name and parent > * drm_dp_cec_set_edid() is called to check if the connector supports > * CEC and to register a CEC adapter if that is the case. > */ > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, > - struct device *parent) > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector) > { > WARN_ON(aux->cec.adap); > if (WARN_ON(!aux->transfer)) > return; > - aux->cec.name = name; > - aux->cec.parent = parent; > + aux->cec.connector = connector; > INIT_DELAYED_WORK(&aux->cec.unregister_work, > drm_dp_cec_unregister_work); > } > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c > index 1092499115760..de2486fe7bf2d 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -5497,7 +5497,6 @@ static int > intel_dp_connector_register(struct drm_connector *connector) > { > struct intel_dp *intel_dp = intel_attached_dp(connector); > - struct drm_device *dev = connector->dev; > int ret; > > ret = intel_connector_register(connector); > @@ -5512,8 +5511,7 @@ intel_dp_connector_register(struct drm_connector *connector) > intel_dp->aux.dev = connector->kdev; > ret = drm_dp_aux_register(&intel_dp->aux); > if (!ret) > - drm_dp_cec_register_connector(&intel_dp->aux, > - connector->name, dev->dev); > + drm_dp_cec_register_connector(&intel_dp->aux, connector); > return ret; > } > > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c > index 330d7d29a6e34..8aa703347eb54 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.c > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c > @@ -1416,8 +1416,7 @@ nouveau_connector_create(struct drm_device *dev, > switch (type) { > case DRM_MODE_CONNECTOR_DisplayPort: > case DRM_MODE_CONNECTOR_eDP: > - drm_dp_cec_register_connector(&nv_connector->aux, > - connector->name, dev->dev); > + drm_dp_cec_register_connector(&nv_connector->aux, connector); > break; > } > > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h > index 8364502f92cfe..7972b925a952b 100644 > --- a/include/drm/drm_dp_helper.h > +++ b/include/drm/drm_dp_helper.h > @@ -1230,20 +1230,19 @@ struct drm_dp_aux_msg { > > struct cec_adapter; > struct edid; > +struct drm_connector; > > /** > * struct drm_dp_aux_cec - DisplayPort CEC-Tunneling-over-AUX > * @lock: mutex protecting this struct > * @adap: the CEC adapter for CEC-Tunneling-over-AUX support. > - * @name: name of the CEC adapter > - * @parent: parent device of the CEC adapter > + * @connector: the connector this CEC adapter is associated with > * @unregister_work: unregister the CEC adapter > */ > struct drm_dp_aux_cec { > struct mutex lock; > struct cec_adapter *adap; > - const char *name; > - struct device *parent; > + struct drm_connector *connector;I think all current users could just pass the connector to cec_set_edid(). So could save a pointer here. Anyways Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>> struct delayed_work unregister_work; > }; > > @@ -1451,8 +1450,8 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk) > > #ifdef CONFIG_DRM_DP_CEC > void drm_dp_cec_irq(struct drm_dp_aux *aux); > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, > - struct device *parent); > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector); > void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux); > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid); > void drm_dp_cec_unset_edid(struct drm_dp_aux *aux); > @@ -1461,9 +1460,9 @@ static inline void drm_dp_cec_irq(struct drm_dp_aux *aux) > { > } > > -static inline void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > - const char *name, > - struct device *parent) > +static inline void > +drm_dp_cec_register_connector(struct drm_dp_aux *aux, > + struct drm_connector *connector) > { > } > > -- > 2.23.0.rc1.153.gdeed80330f-goog-- Ville Syrjälä Intel
Maybe Matching Threads
- [PATCH v7 1/9] drm_dp_cec: add connector info support.
- [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API
- [PATCH 4/5] drm_dp_cec: add plumbing in preparation for MST support
- [PATCH (repost) 0/5] drm/nouveau+amdgpu: add DP CEC-Tunneling-over-AUX (repost)
- [PATCH 0/5] drm/nouveau+amdgpu: add DP CEC-Tunneling-over-AUX