Phone-Devel Archive mirror.
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Luca Weiss <luca.weiss@fairphone.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ptn36502: switch to DRM_AUX_BRIDGE
Date: Mon, 18 Mar 2024 13:12:36 +0200	[thread overview]
Message-ID: <ZfghpN81iR6vL+pu@kuha.fi.intel.com> (raw)
In-Reply-To: <20240315-ptn36502-aux-v1-1-c9d3c828ff2e@fairphone.com>

On Fri, Mar 15, 2024 at 05:04:22PM +0100, Luca Weiss wrote:
> Switch to using the new DRM_AUX_BRIDGE helper to create the transparent
> DRM bridge device instead of handcoding corresponding functionality.
> 
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Very similar to this patch:
> c5d296bad640 ("usb: typec: nb7vpq904m: switch to DRM_AUX_BRIDGE")
> ---
>  drivers/usb/typec/mux/Kconfig    |  2 +-
>  drivers/usb/typec/mux/ptn36502.c | 44 ++--------------------------------------
>  2 files changed, 3 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig
> index 399c7b0983df..4827e86fed6d 100644
> --- a/drivers/usb/typec/mux/Kconfig
> +++ b/drivers/usb/typec/mux/Kconfig
> @@ -60,7 +60,7 @@ config TYPEC_MUX_PTN36502
>  	tristate "NXP PTN36502 Type-C redriver driver"
>  	depends on I2C
>  	depends on DRM || DRM=n
> -	select DRM_PANEL_BRIDGE if DRM
> +	select DRM_AUX_BRIDGE if DRM_BRIDGE
>  	select REGMAP_I2C
>  	help
>  	  Say Y or M if your system has a NXP PTN36502 Type-C redriver chip
> diff --git a/drivers/usb/typec/mux/ptn36502.c b/drivers/usb/typec/mux/ptn36502.c
> index 72ae38a1b2be..0ec86ef32a87 100644
> --- a/drivers/usb/typec/mux/ptn36502.c
> +++ b/drivers/usb/typec/mux/ptn36502.c
> @@ -8,7 +8,7 @@
>   * Copyright (C) 2023 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>   */
>  
> -#include <drm/drm_bridge.h>
> +#include <drm/bridge/aux-bridge.h>
>  #include <linux/bitfield.h>
>  #include <linux/i2c.h>
>  #include <linux/kernel.h>
> @@ -68,8 +68,6 @@ struct ptn36502 {
>  
>  	struct typec_switch *typec_switch;
>  
> -	struct drm_bridge bridge;
> -
>  	struct mutex lock; /* protect non-concurrent retimer & switch */
>  
>  	enum typec_orientation orientation;
> @@ -283,44 +281,6 @@ static int ptn36502_detect(struct ptn36502 *ptn)
>  	return 0;
>  }
>  
> -#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
> -static int ptn36502_bridge_attach(struct drm_bridge *bridge,
> -				  enum drm_bridge_attach_flags flags)
> -{
> -	struct ptn36502 *ptn = container_of(bridge, struct ptn36502, bridge);
> -	struct drm_bridge *next_bridge;
> -
> -	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> -		return -EINVAL;
> -
> -	next_bridge = devm_drm_of_get_bridge(&ptn->client->dev, ptn->client->dev.of_node, 0, 0);
> -	if (IS_ERR(next_bridge)) {
> -		dev_err(&ptn->client->dev, "failed to acquire drm_bridge: %pe\n", next_bridge);
> -		return PTR_ERR(next_bridge);
> -	}
> -
> -	return drm_bridge_attach(bridge->encoder, next_bridge, bridge,
> -				 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> -}
> -
> -static const struct drm_bridge_funcs ptn36502_bridge_funcs = {
> -	.attach	= ptn36502_bridge_attach,
> -};
> -
> -static int ptn36502_register_bridge(struct ptn36502 *ptn)
> -{
> -	ptn->bridge.funcs = &ptn36502_bridge_funcs;
> -	ptn->bridge.of_node = ptn->client->dev.of_node;
> -
> -	return devm_drm_bridge_add(&ptn->client->dev, &ptn->bridge);
> -}
> -#else
> -static int ptn36502_register_bridge(struct ptn36502 *ptn)
> -{
> -	return 0;
> -}
> -#endif
> -
>  static const struct regmap_config ptn36502_regmap = {
>  	.max_register = 0x0d,
>  	.reg_bits = 8,
> @@ -369,7 +329,7 @@ static int ptn36502_probe(struct i2c_client *client)
>  	if (ret)
>  		goto err_disable_regulator;
>  
> -	ret = ptn36502_register_bridge(ptn);
> +	ret = drm_aux_bridge_register(dev);
>  	if (ret)
>  		goto err_disable_regulator;
>  
> 
> ---
> base-commit: 9bb9b28d0568991b1d63e66fe75afa5f97ad1156
> change-id: 20240315-ptn36502-aux-15dd6f289aff
> 
> Best regards,
> -- 
> Luca Weiss <luca.weiss@fairphone.com>

-- 
heikki

      parent reply	other threads:[~2024-03-18 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 16:04 [PATCH] usb: typec: ptn36502: switch to DRM_AUX_BRIDGE Luca Weiss
2024-03-15 17:00 ` Dmitry Baryshkov
2024-03-18 11:12 ` Heikki Krogerus [this message]

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=ZfghpN81iR6vL+pu@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).