From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Alvin Šipraga" <alvin@pqrs.dk>
Cc: "Andrzej Hajda" <andrzej.hajda@intel.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Robert Foss" <rfoss@kernel.org>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Alvin Šipraga" <alsi@bang-olufsen.dk>
Subject: Re: [PATCH v3 1/2] drm/bridge: adv7511: rearrange hotplug work code
Date: Tue, 5 Mar 2024 17:17:09 +0200 [thread overview]
Message-ID: <20240305151709.GF12482@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240219-adv7511-cec-edid-v3-1-445aed2f1cd7@bang-olufsen.dk>
Hi Alvin,
Thank you for the patch.
On Mon, Feb 19, 2024 at 09:12:58PM +0100, Alvin Šipraga wrote:
> From: Alvin Šipraga <alsi@bang-olufsen.dk>
>
> In preparation for calling EDID helpers from the hotplug work, move the
> hotplug work below the EDID helper section. No functional change.
>
> Reviewed-by: Robert Foss <rfoss@kernel.org>
> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 120 ++++++++++++++-------------
> 1 file changed, 62 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> index 8be235144f6d..5ffc5904bd59 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -406,64 +406,6 @@ static void adv7511_power_off(struct adv7511 *adv7511)
> * Interrupt and hotplug detection
> */
>
> -static bool adv7511_hpd(struct adv7511 *adv7511)
> -{
> - unsigned int irq0;
> - int ret;
> -
> - ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0);
> - if (ret < 0)
> - return false;
> -
> - if (irq0 & ADV7511_INT0_HPD) {
> - regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
> - ADV7511_INT0_HPD);
> - return true;
> - }
> -
> - return false;
> -}
> -
> -static void adv7511_hpd_work(struct work_struct *work)
> -{
> - struct adv7511 *adv7511 = container_of(work, struct adv7511, hpd_work);
> - enum drm_connector_status status;
> - unsigned int val;
> - int ret;
> -
> - ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
> - if (ret < 0)
> - status = connector_status_disconnected;
> - else if (val & ADV7511_STATUS_HPD)
> - status = connector_status_connected;
> - else
> - status = connector_status_disconnected;
> -
> - /*
> - * The bridge resets its registers on unplug. So when we get a plug
> - * event and we're already supposed to be powered, cycle the bridge to
> - * restore its state.
> - */
> - if (status == connector_status_connected &&
> - adv7511->connector.status == connector_status_disconnected &&
> - adv7511->powered) {
> - regcache_mark_dirty(adv7511->regmap);
> - adv7511_power_on(adv7511);
> - }
> -
> - if (adv7511->connector.status != status) {
> - adv7511->connector.status = status;
> -
> - if (adv7511->connector.dev) {
> - if (status == connector_status_disconnected)
> - cec_phys_addr_invalidate(adv7511->cec_adap);
> - drm_kms_helper_hotplug_event(adv7511->connector.dev);
> - } else {
> - drm_bridge_hpd_notify(&adv7511->bridge, status);
> - }
> - }
> -}
> -
> static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)
> {
> unsigned int irq0, irq1;
> @@ -600,6 +542,68 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
> return 0;
> }
>
> +/* -----------------------------------------------------------------------------
> + * Hotplug handling
> + */
> +
> +static bool adv7511_hpd(struct adv7511 *adv7511)
> +{
> + unsigned int irq0;
> + int ret;
> +
> + ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0);
> + if (ret < 0)
> + return false;
> +
> + if (irq0 & ADV7511_INT0_HPD) {
> + regmap_write(adv7511->regmap, ADV7511_REG_INT(0),
> + ADV7511_INT0_HPD);
> + return true;
> + }
> +
> + return false;
> +}
> +
> +static void adv7511_hpd_work(struct work_struct *work)
> +{
> + struct adv7511 *adv7511 = container_of(work, struct adv7511, hpd_work);
> + enum drm_connector_status status;
> + unsigned int val;
> + int ret;
> +
> + ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
> + if (ret < 0)
> + status = connector_status_disconnected;
> + else if (val & ADV7511_STATUS_HPD)
> + status = connector_status_connected;
> + else
> + status = connector_status_disconnected;
> +
> + /*
> + * The bridge resets its registers on unplug. So when we get a plug
> + * event and we're already supposed to be powered, cycle the bridge to
> + * restore its state.
> + */
> + if (status == connector_status_connected &&
> + adv7511->connector.status == connector_status_disconnected &&
> + adv7511->powered) {
> + regcache_mark_dirty(adv7511->regmap);
> + adv7511_power_on(adv7511);
> + }
> +
> + if (adv7511->connector.status != status) {
> + adv7511->connector.status = status;
> +
> + if (adv7511->connector.dev) {
> + if (status == connector_status_disconnected)
> + cec_phys_addr_invalidate(adv7511->cec_adap);
> + drm_kms_helper_hotplug_event(adv7511->connector.dev);
> + } else {
> + drm_bridge_hpd_notify(&adv7511->bridge, status);
> + }
> + }
> +}
> +
> /* -----------------------------------------------------------------------------
> * ADV75xx helpers
> */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-03-05 15:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 20:12 [PATCH v3 0/2] drm/bridge: adv7511: get edid in hpd_work to update CEC phys address Alvin Šipraga
2024-02-19 20:12 ` [PATCH v3 1/2] drm/bridge: adv7511: rearrange hotplug work code Alvin Šipraga
2024-03-05 15:17 ` Laurent Pinchart [this message]
2024-02-19 20:12 ` [PATCH v3 2/2] drm/bridge: adv7511: get edid in hpd_work to update CEC phys address Alvin Šipraga
2024-03-05 15:05 ` Robert Foss
2024-03-05 16:10 ` Jani Nikula
2024-03-05 15:22 ` Laurent Pinchart
2024-03-05 16:18 ` Jani Nikula
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=20240305151709.GF12482@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=alvin@pqrs.dk \
--cc=andrzej.hajda@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
/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
Powered by JetHome