Message ID | 20190814104520.6001-8-darekm@google.com |
---|---|
State | Accepted |
Headers | show |
Series | drm: cec: convert DRM drivers to the new notifier API | expand |
On 8/14/19 12:45 PM, Dariusz Marcinkiewicz wrote: > Use the new cec_notifier_conn_(un)register() functions to > (un)register the notifier for the HDMI connector, and fill in > the cec_connector_info. > > Changes since v4: > - only create a CEC notifier for HDMI connectors > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> > Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Regards, Hans > --- > drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c > index bdcaa4c7168cf..34373734ff689 100644 > --- a/drivers/gpu/drm/tegra/output.c > +++ b/drivers/gpu/drm/tegra/output.c > @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) > > void tegra_output_connector_destroy(struct drm_connector *connector) > { > + struct tegra_output *output = connector_to_output(connector); > + > + if (output->cec) > + cec_notifier_conn_unregister(output->cec); > + > drm_connector_unregister(connector); > drm_connector_cleanup(connector); > } > @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) > disable_irq(output->hpd_irq); > } > > - output->cec = cec_notifier_get(output->dev); > - if (!output->cec) > - return -ENOMEM; > - > return 0; > } > > void tegra_output_remove(struct tegra_output *output) > { > - if (output->cec) > - cec_notifier_put(output->cec); > - > if (output->hpd_gpio) > free_irq(output->hpd_irq, output); > > @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) > > int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > { > + int connector_type; > int err; > > if (output->panel) { > @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > if (output->hpd_gpio) > enable_irq(output->hpd_irq); > > + connector_type = output->connector.connector_type; > + /* > + * Create a CEC notifier for HDMI connector. > + */ > + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || > + connector_type == DRM_MODE_CONNECTOR_HDMIB) { > + struct cec_connector_info conn_info; > + > + cec_fill_conn_info_from_drm(&conn_info, &output->connector); > + output->cec = cec_notifier_conn_register(output->dev, NULL, > + &conn_info); > + if (!output->cec) > + return -ENOMEM; > + } > + > return 0; > } > >
Thierry, Can you review this patch? Thanks! Hans On 8/14/19 12:45 PM, Dariusz Marcinkiewicz wrote: > Use the new cec_notifier_conn_(un)register() functions to > (un)register the notifier for the HDMI connector, and fill in > the cec_connector_info. > > Changes since v4: > - only create a CEC notifier for HDMI connectors > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> > Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > --- > drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c > index bdcaa4c7168cf..34373734ff689 100644 > --- a/drivers/gpu/drm/tegra/output.c > +++ b/drivers/gpu/drm/tegra/output.c > @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) > > void tegra_output_connector_destroy(struct drm_connector *connector) > { > + struct tegra_output *output = connector_to_output(connector); > + > + if (output->cec) > + cec_notifier_conn_unregister(output->cec); > + > drm_connector_unregister(connector); > drm_connector_cleanup(connector); > } > @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) > disable_irq(output->hpd_irq); > } > > - output->cec = cec_notifier_get(output->dev); > - if (!output->cec) > - return -ENOMEM; > - > return 0; > } > > void tegra_output_remove(struct tegra_output *output) > { > - if (output->cec) > - cec_notifier_put(output->cec); > - > if (output->hpd_gpio) > free_irq(output->hpd_irq, output); > > @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) > > int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > { > + int connector_type; > int err; > > if (output->panel) { > @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > if (output->hpd_gpio) > enable_irq(output->hpd_irq); > > + connector_type = output->connector.connector_type; > + /* > + * Create a CEC notifier for HDMI connector. > + */ > + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || > + connector_type == DRM_MODE_CONNECTOR_HDMIB) { > + struct cec_connector_info conn_info; > + > + cec_fill_conn_info_from_drm(&conn_info, &output->connector); > + output->cec = cec_notifier_conn_register(output->dev, NULL, > + &conn_info); > + if (!output->cec) > + return -ENOMEM; > + } > + > return 0; > } > >
On Wed, Aug 14, 2019 at 12:45:05PM +0200, Dariusz Marcinkiewicz wrote: > Use the new cec_notifier_conn_(un)register() functions to > (un)register the notifier for the HDMI connector, and fill in > the cec_connector_info. > > Changes since v4: > - only create a CEC notifier for HDMI connectors > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> > Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > --- > drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c > index bdcaa4c7168cf..34373734ff689 100644 > --- a/drivers/gpu/drm/tegra/output.c > +++ b/drivers/gpu/drm/tegra/output.c > @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) > > void tegra_output_connector_destroy(struct drm_connector *connector) > { > + struct tegra_output *output = connector_to_output(connector); > + > + if (output->cec) > + cec_notifier_conn_unregister(output->cec); > + > drm_connector_unregister(connector); > drm_connector_cleanup(connector); > } > @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) > disable_irq(output->hpd_irq); > } > > - output->cec = cec_notifier_get(output->dev); > - if (!output->cec) > - return -ENOMEM; > - > return 0; > } > > void tegra_output_remove(struct tegra_output *output) > { > - if (output->cec) > - cec_notifier_put(output->cec); > - > if (output->hpd_gpio) > free_irq(output->hpd_irq, output); > > @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) > > int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > { > + int connector_type; > int err; > > if (output->panel) { > @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > if (output->hpd_gpio) > enable_irq(output->hpd_irq); > > + connector_type = output->connector.connector_type; > + /* > + * Create a CEC notifier for HDMI connector. > + */ > + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || > + connector_type == DRM_MODE_CONNECTOR_HDMIB) { > + struct cec_connector_info conn_info; > + > + cec_fill_conn_info_from_drm(&conn_info, &output->connector); > + output->cec = cec_notifier_conn_register(output->dev, NULL, > + &conn_info); > + if (!output->cec) > + return -ENOMEM; > + } > + > return 0; > } > It might be slightly cleaner to move this into the HDMI drivers themselves, although that'd mean a bit of duplication. That could be mitigated by moving the code into a separate helper that could be called by the HDMI drivers. Then again, I don't feel strongly about it, and that could always be done as part of some later refactoring, so I think this is fine. Thierry
On Wed, Aug 28, 2019 at 10:09:30AM +0200, Hans Verkuil wrote: > Thierry, > > Can you review this patch? > > Thanks! > > Hans Did you want me to pick this up into the drm/tegra tree? Or do you want to pick it up into your tree? We're just past the DRM subsystem deadline, so it'll have to wait until the next cycle if we go that way. If you're in a hurry you may want to pick it up yourself, in which case: Acked-by: Thierry Reding <treding@nvidia.com> > On 8/14/19 12:45 PM, Dariusz Marcinkiewicz wrote: > > Use the new cec_notifier_conn_(un)register() functions to > > (un)register the notifier for the HDMI connector, and fill in > > the cec_connector_info. > > > > Changes since v4: > > - only create a CEC notifier for HDMI connectors > > > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> > > Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > > --- > > drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- > > 1 file changed, 21 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c > > index bdcaa4c7168cf..34373734ff689 100644 > > --- a/drivers/gpu/drm/tegra/output.c > > +++ b/drivers/gpu/drm/tegra/output.c > > @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) > > > > void tegra_output_connector_destroy(struct drm_connector *connector) > > { > > + struct tegra_output *output = connector_to_output(connector); > > + > > + if (output->cec) > > + cec_notifier_conn_unregister(output->cec); > > + > > drm_connector_unregister(connector); > > drm_connector_cleanup(connector); > > } > > @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) > > disable_irq(output->hpd_irq); > > } > > > > - output->cec = cec_notifier_get(output->dev); > > - if (!output->cec) > > - return -ENOMEM; > > - > > return 0; > > } > > > > void tegra_output_remove(struct tegra_output *output) > > { > > - if (output->cec) > > - cec_notifier_put(output->cec); > > - > > if (output->hpd_gpio) > > free_irq(output->hpd_irq, output); > > > > @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) > > > > int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > > { > > + int connector_type; > > int err; > > > > if (output->panel) { > > @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) > > if (output->hpd_gpio) > > enable_irq(output->hpd_irq); > > > > + connector_type = output->connector.connector_type; > > + /* > > + * Create a CEC notifier for HDMI connector. > > + */ > > + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || > > + connector_type == DRM_MODE_CONNECTOR_HDMIB) { > > + struct cec_connector_info conn_info; > > + > > + cec_fill_conn_info_from_drm(&conn_info, &output->connector); > > + output->cec = cec_notifier_conn_register(output->dev, NULL, > > + &conn_info); > > + if (!output->cec) > > + return -ENOMEM; > > + } > > + > > return 0; > > } > > > > >
On 8/28/19 11:38 AM, Thierry Reding wrote: > On Wed, Aug 28, 2019 at 10:09:30AM +0200, Hans Verkuil wrote: >> Thierry, >> >> Can you review this patch? >> >> Thanks! >> >> Hans > > Did you want me to pick this up into the drm/tegra tree? Or do you want > to pick it up into your tree? Can you pick it up for the next cycle? As you mentioned, we missed the deadline for 5.4, so this feature won't be enabled in the public CEC API until 5.5. Thanks! Hans > > We're just past the DRM subsystem deadline, so it'll have to wait until > the next cycle if we go that way. If you're in a hurry you may want to > pick it up yourself, in which case: > > Acked-by: Thierry Reding <treding@nvidia.com> > >> On 8/14/19 12:45 PM, Dariusz Marcinkiewicz wrote: >>> Use the new cec_notifier_conn_(un)register() functions to >>> (un)register the notifier for the HDMI connector, and fill in >>> the cec_connector_info. >>> >>> Changes since v4: >>> - only create a CEC notifier for HDMI connectors >>> >>> Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> >>> Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> >>> --- >>> drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- >>> 1 file changed, 21 insertions(+), 7 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c >>> index bdcaa4c7168cf..34373734ff689 100644 >>> --- a/drivers/gpu/drm/tegra/output.c >>> +++ b/drivers/gpu/drm/tegra/output.c >>> @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) >>> >>> void tegra_output_connector_destroy(struct drm_connector *connector) >>> { >>> + struct tegra_output *output = connector_to_output(connector); >>> + >>> + if (output->cec) >>> + cec_notifier_conn_unregister(output->cec); >>> + >>> drm_connector_unregister(connector); >>> drm_connector_cleanup(connector); >>> } >>> @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) >>> disable_irq(output->hpd_irq); >>> } >>> >>> - output->cec = cec_notifier_get(output->dev); >>> - if (!output->cec) >>> - return -ENOMEM; >>> - >>> return 0; >>> } >>> >>> void tegra_output_remove(struct tegra_output *output) >>> { >>> - if (output->cec) >>> - cec_notifier_put(output->cec); >>> - >>> if (output->hpd_gpio) >>> free_irq(output->hpd_irq, output); >>> >>> @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) >>> >>> int tegra_output_init(struct drm_device *drm, struct tegra_output *output) >>> { >>> + int connector_type; >>> int err; >>> >>> if (output->panel) { >>> @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) >>> if (output->hpd_gpio) >>> enable_irq(output->hpd_irq); >>> >>> + connector_type = output->connector.connector_type; >>> + /* >>> + * Create a CEC notifier for HDMI connector. >>> + */ >>> + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || >>> + connector_type == DRM_MODE_CONNECTOR_HDMIB) { >>> + struct cec_connector_info conn_info; >>> + >>> + cec_fill_conn_info_from_drm(&conn_info, &output->connector); >>> + output->cec = cec_notifier_conn_register(output->dev, NULL, >>> + &conn_info); >>> + if (!output->cec) >>> + return -ENOMEM; >>> + } >>> + >>> return 0; >>> } >>> >>> >>
On Wed, Aug 28, 2019 at 12:06:34PM +0200, Hans Verkuil wrote: > On 8/28/19 11:38 AM, Thierry Reding wrote: > > On Wed, Aug 28, 2019 at 10:09:30AM +0200, Hans Verkuil wrote: > >> Thierry, > >> > >> Can you review this patch? > >> > >> Thanks! > >> > >> Hans > > > > Did you want me to pick this up into the drm/tegra tree? Or do you want > > to pick it up into your tree? > > Can you pick it up for the next cycle? As you mentioned, we missed the > deadline for 5.4, so this feature won't be enabled in the public CEC API > until 5.5. > > Thanks! Sure, will do. Thierry
Hi Thierry, Just a reminder: this patch hasn't been merged yet for v5.5. Thanks! Hans On 8/28/19 1:54 PM, Thierry Reding wrote: > On Wed, Aug 28, 2019 at 12:06:34PM +0200, Hans Verkuil wrote: >> On 8/28/19 11:38 AM, Thierry Reding wrote: >>> On Wed, Aug 28, 2019 at 10:09:30AM +0200, Hans Verkuil wrote: >>>> Thierry, >>>> >>>> Can you review this patch? >>>> >>>> Thanks! >>>> >>>> Hans >>> >>> Did you want me to pick this up into the drm/tegra tree? Or do you want >>> to pick it up into your tree? >> >> Can you pick it up for the next cycle? As you mentioned, we missed the >> deadline for 5.4, so this feature won't be enabled in the public CEC API >> until 5.5. >> >> Thanks! > > Sure, will do. > > Thierry >
Thierry, Another reminder :-) If you want me to do this, then just let me know! Regards, Hans On 10/4/19 10:48 AM, Hans Verkuil wrote: > Hi Thierry, > > Just a reminder: this patch hasn't been merged yet for v5.5. > > Thanks! > > Hans > > On 8/28/19 1:54 PM, Thierry Reding wrote: >> On Wed, Aug 28, 2019 at 12:06:34PM +0200, Hans Verkuil wrote: >>> On 8/28/19 11:38 AM, Thierry Reding wrote: >>>> On Wed, Aug 28, 2019 at 10:09:30AM +0200, Hans Verkuil wrote: >>>>> Thierry, >>>>> >>>>> Can you review this patch? >>>>> >>>>> Thanks! >>>>> >>>>> Hans >>>> >>>> Did you want me to pick this up into the drm/tegra tree? Or do you want >>>> to pick it up into your tree? >>> >>> Can you pick it up for the next cycle? As you mentioned, we missed the >>> deadline for 5.4, so this feature won't be enabled in the public CEC API >>> until 5.5. >>> >>> Thanks! >> >> Sure, will do. >> >> Thierry >> >
On Wed, Aug 14, 2019 at 12:45:05PM +0200, Dariusz Marcinkiewicz wrote: > Use the new cec_notifier_conn_(un)register() functions to > (un)register the notifier for the HDMI connector, and fill in > the cec_connector_info. > > Changes since v4: > - only create a CEC notifier for HDMI connectors > > Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com> > Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > --- > drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) Applied, thanks. Thierry
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index bdcaa4c7168cf..34373734ff689 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) void tegra_output_connector_destroy(struct drm_connector *connector) { + struct tegra_output *output = connector_to_output(connector); + + if (output->cec) + cec_notifier_conn_unregister(output->cec); + drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) disable_irq(output->hpd_irq); } - output->cec = cec_notifier_get(output->dev); - if (!output->cec) - return -ENOMEM; - return 0; } void tegra_output_remove(struct tegra_output *output) { - if (output->cec) - cec_notifier_put(output->cec); - if (output->hpd_gpio) free_irq(output->hpd_irq, output); @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) int tegra_output_init(struct drm_device *drm, struct tegra_output *output) { + int connector_type; int err; if (output->panel) { @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) if (output->hpd_gpio) enable_irq(output->hpd_irq); + connector_type = output->connector.connector_type; + /* + * Create a CEC notifier for HDMI connector. + */ + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || + connector_type == DRM_MODE_CONNECTOR_HDMIB) { + struct cec_connector_info conn_info; + + cec_fill_conn_info_from_drm(&conn_info, &output->connector); + output->cec = cec_notifier_conn_register(output->dev, NULL, + &conn_info); + if (!output->cec) + return -ENOMEM; + } + return 0; }