All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Hugues Husson <phh@phh.me>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	linux-fbdev@vger.kernel.org,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFCv2 PATCH 3/5] drm/bridge: dw_hdmi: add HDMI notifier support
Date: Wed, 16 Nov 2016 00:21:28 +0100	[thread overview]
Message-ID: <CAJ-oXjSzet5R9d=zJEVxg5EjjUfc1=PM5R2fjc9FgMtJFnx6Uw@mail.gmail.com> (raw)
In-Reply-To: <1479136968-24477-4-git-send-email-hverkuil@xs4all.nl>

Hi Hans,

2016-11-14 16:22 GMT+01:00 Hans Verkuil <hverkuil@xs4all.nl>:
> From: Russell King <rmk+kernel@arm.linux.org.uk>
>
> Add HDMI notifiers to the HDMI bridge driver.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
>  drivers/gpu/drm/bridge/Kconfig   |  1 +
>  drivers/gpu/drm/bridge/dw-hdmi.c | 25 ++++++++++++++++++++++++-
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 10e12e7..5f4ebe9 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -27,6 +27,7 @@ config DRM_DUMB_VGA_DAC
>  config DRM_DW_HDMI
>         tristate
>         select DRM_KMS_HELPER
> +       select HDMI_NOTIFIERS
>
>  config DRM_DW_HDMI_AHB_AUDIO
>         tristate "Synopsis Designware AHB Audio interface"
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
> index ab7023e..bd02da5 100644
> --- a/drivers/gpu/drm/bridge/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw-hdmi.c
> @@ -16,6 +16,7 @@
>  #include <linux/err.h>
>  #include <linux/clk.h>
>  #include <linux/hdmi.h>
> +#include <linux/hdmi-notifier.h>
>  #include <linux/mutex.h>
>  #include <linux/of_device.h>
>  #include <linux/spinlock.h>
> @@ -114,6 +115,7 @@ struct dw_hdmi {
>
>         struct hdmi_data_info hdmi_data;
>         const struct dw_hdmi_plat_data *plat_data;
> +       struct hdmi_notifier *n;
>
>         int vic;
>
> @@ -1448,9 +1450,11 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
>                 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
>                 hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
>                 drm_mode_connector_update_edid_property(connector, edid);
> +               hdmi_event_new_edid(hdmi->n, edid, 0);
>                 ret = drm_add_edid_modes(connector, edid);
>                 /* Store the ELD */
>                 drm_edid_to_eld(connector, edid);
> +               hdmi_event_new_eld(hdmi->n, connector->eld);
>                 kfree(edid);
>         } else {
>                 dev_dbg(hdmi->dev, "failed to get edid\n");
> @@ -1579,6 +1583,12 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
>                         dw_hdmi_update_phy_mask(hdmi);
>                 }
>                 mutex_unlock(&hdmi->mutex);
> +
> +               if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0)
> +                       hdmi_event_disconnect(hdmi->n);
> +               else if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) ==
> +                        (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_PHY_HPD))
> +                       hdmi_event_connect(hdmi->n);
>         }
>
>         if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
> @@ -1732,11 +1742,17 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>
>         initialize_hdmi_ih_mutes(hdmi);
>
> +       hdmi->n = hdmi_notifier_get(dev);
> +       if (!hdmi->n) {
> +               ret = -ENOMEM;
> +               goto err_iahb;
> +       }
> +
>         ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq,
>                                         dw_hdmi_irq, IRQF_SHARED,
>                                         dev_name(dev), hdmi);
>         if (ret)
> -               goto err_iahb;
> +               goto err_hdmi_not;
>
>         /*
>          * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
> @@ -1788,6 +1804,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>
>         return 0;
>
> +err_hdmi_not:
> +       hdmi_notifier_put(hdmi->n);
>  err_iahb:
>         clk_disable_unprepare(hdmi->iahb_clk);
>  err_isfr:
> @@ -1804,6 +1822,11 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
>         if (hdmi->audio && !IS_ERR(hdmi->audio))
>                 platform_device_unregister(hdmi->audio);
>
> +       hdmi_notifier_put(hdmi->n);
> +
> +       if (!IS_ERR(hdmi->cec))
> +               platform_device_unregister(hdmi->cec);
Those two lines should be in your 4/5
> +
>         /* Disable all interrupts */
>         hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0);

WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Hugues Husson <phh@phh.me>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	linux-fbdev@vger.kernel.org,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFCv2 PATCH 3/5] drm/bridge: dw_hdmi: add HDMI notifier support
Date: Tue, 15 Nov 2016 23:21:28 +0000	[thread overview]
Message-ID: <CAJ-oXjSzet5R9d=zJEVxg5EjjUfc1=PM5R2fjc9FgMtJFnx6Uw@mail.gmail.com> (raw)
In-Reply-To: <1479136968-24477-4-git-send-email-hverkuil@xs4all.nl>

Hi Hans,

2016-11-14 16:22 GMT+01:00 Hans Verkuil <hverkuil@xs4all.nl>:
> From: Russell King <rmk+kernel@arm.linux.org.uk>
>
> Add HDMI notifiers to the HDMI bridge driver.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
>  drivers/gpu/drm/bridge/Kconfig   |  1 +
>  drivers/gpu/drm/bridge/dw-hdmi.c | 25 ++++++++++++++++++++++++-
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 10e12e7..5f4ebe9 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -27,6 +27,7 @@ config DRM_DUMB_VGA_DAC
>  config DRM_DW_HDMI
>         tristate
>         select DRM_KMS_HELPER
> +       select HDMI_NOTIFIERS
>
>  config DRM_DW_HDMI_AHB_AUDIO
>         tristate "Synopsis Designware AHB Audio interface"
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
> index ab7023e..bd02da5 100644
> --- a/drivers/gpu/drm/bridge/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw-hdmi.c
> @@ -16,6 +16,7 @@
>  #include <linux/err.h>
>  #include <linux/clk.h>
>  #include <linux/hdmi.h>
> +#include <linux/hdmi-notifier.h>
>  #include <linux/mutex.h>
>  #include <linux/of_device.h>
>  #include <linux/spinlock.h>
> @@ -114,6 +115,7 @@ struct dw_hdmi {
>
>         struct hdmi_data_info hdmi_data;
>         const struct dw_hdmi_plat_data *plat_data;
> +       struct hdmi_notifier *n;
>
>         int vic;
>
> @@ -1448,9 +1450,11 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
>                 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
>                 hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
>                 drm_mode_connector_update_edid_property(connector, edid);
> +               hdmi_event_new_edid(hdmi->n, edid, 0);
>                 ret = drm_add_edid_modes(connector, edid);
>                 /* Store the ELD */
>                 drm_edid_to_eld(connector, edid);
> +               hdmi_event_new_eld(hdmi->n, connector->eld);
>                 kfree(edid);
>         } else {
>                 dev_dbg(hdmi->dev, "failed to get edid\n");
> @@ -1579,6 +1583,12 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
>                         dw_hdmi_update_phy_mask(hdmi);
>                 }
>                 mutex_unlock(&hdmi->mutex);
> +
> +               if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) = 0)
> +                       hdmi_event_disconnect(hdmi->n);
> +               else if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) =
> +                        (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_PHY_HPD))
> +                       hdmi_event_connect(hdmi->n);
>         }
>
>         if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
> @@ -1732,11 +1742,17 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>
>         initialize_hdmi_ih_mutes(hdmi);
>
> +       hdmi->n = hdmi_notifier_get(dev);
> +       if (!hdmi->n) {
> +               ret = -ENOMEM;
> +               goto err_iahb;
> +       }
> +
>         ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq,
>                                         dw_hdmi_irq, IRQF_SHARED,
>                                         dev_name(dev), hdmi);
>         if (ret)
> -               goto err_iahb;
> +               goto err_hdmi_not;
>
>         /*
>          * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
> @@ -1788,6 +1804,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>
>         return 0;
>
> +err_hdmi_not:
> +       hdmi_notifier_put(hdmi->n);
>  err_iahb:
>         clk_disable_unprepare(hdmi->iahb_clk);
>  err_isfr:
> @@ -1804,6 +1822,11 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
>         if (hdmi->audio && !IS_ERR(hdmi->audio))
>                 platform_device_unregister(hdmi->audio);
>
> +       hdmi_notifier_put(hdmi->n);
> +
> +       if (!IS_ERR(hdmi->cec))
> +               platform_device_unregister(hdmi->cec);
Those two lines should be in your 4/5
> +
>         /* Disable all interrupts */
>         hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0);

WARNING: multiple messages have this Message-ID (diff)
From: phh@phh.me (Pierre-Hugues Husson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFCv2 PATCH 3/5] drm/bridge: dw_hdmi: add HDMI notifier support
Date: Wed, 16 Nov 2016 00:21:28 +0100	[thread overview]
Message-ID: <CAJ-oXjSzet5R9d=zJEVxg5EjjUfc1=PM5R2fjc9FgMtJFnx6Uw@mail.gmail.com> (raw)
In-Reply-To: <1479136968-24477-4-git-send-email-hverkuil@xs4all.nl>

Hi Hans,

2016-11-14 16:22 GMT+01:00 Hans Verkuil <hverkuil@xs4all.nl>:
> From: Russell King <rmk+kernel@arm.linux.org.uk>
>
> Add HDMI notifiers to the HDMI bridge driver.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
>  drivers/gpu/drm/bridge/Kconfig   |  1 +
>  drivers/gpu/drm/bridge/dw-hdmi.c | 25 ++++++++++++++++++++++++-
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 10e12e7..5f4ebe9 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -27,6 +27,7 @@ config DRM_DUMB_VGA_DAC
>  config DRM_DW_HDMI
>         tristate
>         select DRM_KMS_HELPER
> +       select HDMI_NOTIFIERS
>
>  config DRM_DW_HDMI_AHB_AUDIO
>         tristate "Synopsis Designware AHB Audio interface"
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
> index ab7023e..bd02da5 100644
> --- a/drivers/gpu/drm/bridge/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw-hdmi.c
> @@ -16,6 +16,7 @@
>  #include <linux/err.h>
>  #include <linux/clk.h>
>  #include <linux/hdmi.h>
> +#include <linux/hdmi-notifier.h>
>  #include <linux/mutex.h>
>  #include <linux/of_device.h>
>  #include <linux/spinlock.h>
> @@ -114,6 +115,7 @@ struct dw_hdmi {
>
>         struct hdmi_data_info hdmi_data;
>         const struct dw_hdmi_plat_data *plat_data;
> +       struct hdmi_notifier *n;
>
>         int vic;
>
> @@ -1448,9 +1450,11 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
>                 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
>                 hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
>                 drm_mode_connector_update_edid_property(connector, edid);
> +               hdmi_event_new_edid(hdmi->n, edid, 0);
>                 ret = drm_add_edid_modes(connector, edid);
>                 /* Store the ELD */
>                 drm_edid_to_eld(connector, edid);
> +               hdmi_event_new_eld(hdmi->n, connector->eld);
>                 kfree(edid);
>         } else {
>                 dev_dbg(hdmi->dev, "failed to get edid\n");
> @@ -1579,6 +1583,12 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
>                         dw_hdmi_update_phy_mask(hdmi);
>                 }
>                 mutex_unlock(&hdmi->mutex);
> +
> +               if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0)
> +                       hdmi_event_disconnect(hdmi->n);
> +               else if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) ==
> +                        (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_PHY_HPD))
> +                       hdmi_event_connect(hdmi->n);
>         }
>
>         if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
> @@ -1732,11 +1742,17 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>
>         initialize_hdmi_ih_mutes(hdmi);
>
> +       hdmi->n = hdmi_notifier_get(dev);
> +       if (!hdmi->n) {
> +               ret = -ENOMEM;
> +               goto err_iahb;
> +       }
> +
>         ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq,
>                                         dw_hdmi_irq, IRQF_SHARED,
>                                         dev_name(dev), hdmi);
>         if (ret)
> -               goto err_iahb;
> +               goto err_hdmi_not;
>
>         /*
>          * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
> @@ -1788,6 +1804,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>
>         return 0;
>
> +err_hdmi_not:
> +       hdmi_notifier_put(hdmi->n);
>  err_iahb:
>         clk_disable_unprepare(hdmi->iahb_clk);
>  err_isfr:
> @@ -1804,6 +1822,11 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
>         if (hdmi->audio && !IS_ERR(hdmi->audio))
>                 platform_device_unregister(hdmi->audio);
>
> +       hdmi_notifier_put(hdmi->n);
> +
> +       if (!IS_ERR(hdmi->cec))
> +               platform_device_unregister(hdmi->cec);
Those two lines should be in your 4/5
> +
>         /* Disable all interrupts */
>         hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0);

  reply	other threads:[~2016-11-15 23:21 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 15:22 [RFCv2 PATCH 0/5] CEC drivers for iMX6 and TDA9950 Hans Verkuil
2016-11-14 15:22 ` Hans Verkuil
2016-11-14 15:22 ` Hans Verkuil
2016-11-14 15:22 ` [RFCv2 PATCH 1/5] video: add HDMI state notifier support Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-15 18:24   ` Philipp Zabel
2016-11-15 18:24     ` Philipp Zabel
2016-11-15 18:24     ` Philipp Zabel
2016-11-15 20:41     ` Hans Verkuil
2016-11-15 20:41       ` Hans Verkuil
2016-11-15 20:41       ` Hans Verkuil
2016-11-15 20:41       ` Hans Verkuil
2016-11-16  9:43       ` Hans Verkuil
2016-11-16  9:43         ` Hans Verkuil
2016-11-16  9:43         ` Hans Verkuil
2016-12-01 10:09   ` Hans Verkuil
2016-12-01 10:09     ` Hans Verkuil
2016-12-01 10:09     ` Hans Verkuil
2016-12-01 10:09     ` Hans Verkuil
2016-11-14 15:22 ` [RFCv2 PATCH 2/5] drm/bridge: dw_hdmi: remove CEC engine register definitions Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-14 15:39   ` Russell King - ARM Linux
2016-11-14 15:39     ` Russell King - ARM Linux
2016-11-14 15:42     ` Hans Verkuil
2016-11-14 15:42       ` Hans Verkuil
2016-11-14 15:42       ` Hans Verkuil
2016-11-14 15:42       ` Hans Verkuil
2016-11-15 23:23   ` Pierre-Hugues Husson
2016-11-15 23:23     ` Pierre-Hugues Husson
2016-11-15 23:23     ` Pierre-Hugues Husson
2016-11-15 23:27     ` Russell King - ARM Linux
2016-11-15 23:27       ` Russell King - ARM Linux
2016-11-15 23:35       ` Pierre-Hugues Husson
2016-11-15 23:35         ` Pierre-Hugues Husson
2016-11-15 23:35         ` Pierre-Hugues Husson
2016-11-14 15:22 ` [RFCv2 PATCH 3/5] drm/bridge: dw_hdmi: add HDMI notifier support Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-15 23:21   ` Pierre-Hugues Husson [this message]
2016-11-15 23:21     ` Pierre-Hugues Husson
2016-11-15 23:21     ` Pierre-Hugues Husson
2017-02-05  0:22   ` Pierre-Hugues Husson
2017-02-05  0:22     ` Pierre-Hugues Husson
2017-02-05  0:22     ` Pierre-Hugues Husson
2016-11-14 15:22 ` [RFCv2 PATCH 4/5] drm/bridge: add dw-hdmi cec driver using Hans Verkuil's CEC code Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2017-02-05  0:17   ` Pierre-Hugues Husson
2017-02-05  0:17     ` Pierre-Hugues Husson
2017-02-05  0:17     ` Pierre-Hugues Husson
2016-11-14 15:22 ` [RFCv2 PATCH 5/5] drm/i2c: add tda998x/tda9950 CEC driver Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil
2016-11-14 15:22   ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ-oXjSzet5R9d=zJEVxg5EjjUfc1=PM5R2fjc9FgMtJFnx6Uw@mail.gmail.com' \
    --to=phh@phh.me \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=rmk+kernel@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.