lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240305151709.GF12482@pendragon.ideasonboard.com>
Date: Tue, 5 Mar 2024 17:17:09 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Alvin Šipraga <alvin@...s.dk>
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
	Neil Armstrong <neil.armstrong@...aro.org>,
	Robert Foss <rfoss@...nel.org>, Jonas Karlman <jonas@...boo.se>,
	Jernej Skrabec <jernej.skrabec@...il.com>,
	David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
	Hans Verkuil <hverkuil-cisco@...all.nl>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	Alvin Šipraga <alsi@...g-olufsen.dk>
Subject: Re: [PATCH v3 1/2] drm/bridge: adv7511: rearrange hotplug work code

Hi Alvin,

Thank you for the patch.

On Mon, Feb 19, 2024 at 09:12:58PM +0100, Alvin Šipraga wrote:
> From: Alvin Šipraga <alsi@...g-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@...nel.org>
> Signed-off-by: Alvin Šipraga <alsi@...g-olufsen.dk>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ