From: Andrzej Hajda <a.hajda@samsung.com>
To: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>,
dri-devel@lists.freedesktop.org,
Marek Szyprowski <m.szyprowski@samsung.com>,
Javier Martinez Canillas <javier@osg.samsung.com>,
Benjamin Gaignard <benjamin.gaignard@linaro.org>,
linux-samsung-soc@vger.kernel.org,
Krzysztof Kozlowski <krzk@kernel.org>,
Inki Dae <inki.dae@samsung.com>,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCHv2 2/4] exynos_hdmi: add HPD notifier support
Date: Tue, 03 Jan 2017 08:55:43 +0100 [thread overview]
Message-ID: <e128714d-6e24-7fc5-17be-fa19606cb3b2@samsung.com> (raw)
In-Reply-To: <1483366747-34288-3-git-send-email-hverkuil@xs4all.nl>
On 02.01.2017 15:19, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> Implement the HPD notifier support to allow CEC drivers to
> be informed when there is a new EDID and when a connect or
> disconnect happens.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/gpu/drm/exynos/Kconfig | 1 +
> drivers/gpu/drm/exynos/exynos_hdmi.c | 24 +++++++++++++++++++++---
> 2 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
> index d706ca4..80bfd1d 100644
> --- a/drivers/gpu/drm/exynos/Kconfig
> +++ b/drivers/gpu/drm/exynos/Kconfig
> @@ -77,6 +77,7 @@ config DRM_EXYNOS_DP
> config DRM_EXYNOS_HDMI
> bool "HDMI"
> depends on DRM_EXYNOS_MIXER || DRM_EXYNOS5433_DECON
> + select HPD_NOTIFIERS
> help
> Choose this option if you want to use Exynos HDMI for DRM.
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 5ed8b1e..28bf609 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -31,6 +31,7 @@
> #include <linux/pm_runtime.h>
> #include <linux/clk.h>
> #include <linux/gpio/consumer.h>
> +#include <linux/hpd-notifier.h>
> #include <linux/regulator/consumer.h>
> #include <linux/io.h>
> #include <linux/of_address.h>
> @@ -118,6 +119,7 @@ struct hdmi_context {
> bool dvi_mode;
> struct delayed_work hotplug_work;
> struct drm_display_mode current_mode;
> + struct hpd_notifier *notifier;
> const struct hdmi_driver_data *drv_data;
>
> void __iomem *regs;
> @@ -807,9 +809,12 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector,
> {
> struct hdmi_context *hdata = connector_to_hdmi(connector);
>
> - if (gpiod_get_value(hdata->hpd_gpio))
> + if (gpiod_get_value(hdata->hpd_gpio)) {
> + hpd_event_connect(hdata->notifier);
> return connector_status_connected;
> + }
>
> + hpd_event_disconnect(hdata->notifier);
> return connector_status_disconnected;
> }
>
> @@ -848,6 +853,9 @@ static int hdmi_get_modes(struct drm_connector *connector)
> edid->width_cm, edid->height_cm);
>
> drm_mode_connector_update_edid_property(connector, edid);
> + hpd_event_connect(hdata->notifier);
Is there a reason to call hpd_event_connect here? It was called already
from hdmi_detect.
Regards
Andrzej
> + hpd_event_new_edid(hdata->notifier, edid,
> + EDID_LENGTH * (1 + edid->extensions));
>
> ret = drm_add_edid_modes(connector, edid);
>
> @@ -1483,6 +1491,7 @@ static void hdmi_disable(struct drm_encoder *encoder)
> if (funcs && funcs->disable)
> (*funcs->disable)(crtc);
>
> + hpd_event_disconnect(hdata->notifier);
> cancel_delayed_work(&hdata->hotplug_work);
>
> hdmiphy_disable(hdata);
> @@ -1832,15 +1841,22 @@ static int hdmi_probe(struct platform_device *pdev)
> }
> }
>
> + hdata->notifier = hpd_notifier_get(&pdev->dev);
> + if (hdata->notifier == NULL) {
> + ret = -ENOMEM;
> + goto err_hdmiphy;
> + }
> +
> pm_runtime_enable(dev);
>
> ret = component_add(&pdev->dev, &hdmi_component_ops);
> if (ret)
> - goto err_disable_pm_runtime;
> + goto err_notifier_put;
>
> return ret;
>
> -err_disable_pm_runtime:
> +err_notifier_put:
> + hpd_notifier_put(hdata->notifier);
> pm_runtime_disable(dev);
>
> err_hdmiphy:
> @@ -1859,9 +1875,11 @@ static int hdmi_remove(struct platform_device *pdev)
> struct hdmi_context *hdata = platform_get_drvdata(pdev);
>
> cancel_delayed_work_sync(&hdata->hotplug_work);
> + hpd_event_disconnect(hdata->notifier);
>
> component_del(&pdev->dev, &hdmi_component_ops);
>
> + hpd_notifier_put(hdata->notifier);
> pm_runtime_disable(&pdev->dev);
>
> if (!IS_ERR(hdata->reg_hdmi_en))
next prev parent reply other threads:[~2017-01-03 7:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 14:19 [PATCHv2 0/4] video/exynos/cec: add HPD state notifier & use in s5p-cec Hans Verkuil
2017-01-02 14:19 ` [PATCHv2 1/4] video: add hotplug detect notifier support Hans Verkuil
2017-01-03 7:50 ` Andrzej Hajda
2017-01-03 7:54 ` Hans Verkuil
2017-03-20 14:26 ` Russell King - ARM Linux
2017-03-20 14:27 ` Russell King - ARM Linux
2017-03-20 14:41 ` Hans Verkuil
2017-01-02 14:19 ` [PATCHv2 2/4] exynos_hdmi: add HPD " Hans Verkuil
2017-01-03 7:55 ` Andrzej Hajda [this message]
2017-01-03 8:25 ` Hans Verkuil
2017-01-02 14:19 ` [PATCHv2 3/4] cec: integrate " Hans Verkuil
2017-01-02 14:19 ` [PATCHv2 4/4] s5p-cec: add hpd-notifier support, move out of staging Hans Verkuil
2017-01-02 17:50 ` Krzysztof Kozlowski
2017-01-03 8:00 ` Andrzej Hajda
2017-01-03 8:11 ` Hans Verkuil
2017-01-04 8:44 ` Andrzej Hajda
2017-01-23 10:14 ` 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=e128714d-6e24-7fc5-17be-fa19606cb3b2@samsung.com \
--to=a.hajda@samsung.com \
--cc=benjamin.gaignard@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=inki.dae@samsung.com \
--cc=javier@osg.samsung.com \
--cc=krzk@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).