All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 8/8] usb: typec: ucsi: yoga-c630: register DRM HPD bridge
Date: Tue, 24 Jun 2025 12:21:50 +0300	[thread overview]
Message-ID: <aFpuLuzBXgazxecA@kuha.fi.intel.com> (raw)
In-Reply-To: <20250621-c630-ucsi-v1-8-a86de5e11361@oss.qualcomm.com>

On Sat, Jun 21, 2025 at 09:13:03PM +0300, Dmitry Baryshkov wrote:
> On Qualcomm platforms DisplayPort driver expects to have a drm bridge in
> the final device on the USB-C chain. Register the DRM HPD bridge in
> order to fulfill this requirement and to send HPD events to the DRM
> driver.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

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

> ---
>  drivers/usb/typec/ucsi/Kconfig          |  1 +
>  drivers/usb/typec/ucsi/ucsi_yoga_c630.c | 39 +++++++++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+)
> 
> diff --git a/drivers/usb/typec/ucsi/Kconfig b/drivers/usb/typec/ucsi/Kconfig
> index 8bf8fefb4f07bccc4be90a4b7f771d91294386b0..52b53bb6dfed28c4272f8ccc5e31601aede29911 100644
> --- a/drivers/usb/typec/ucsi/Kconfig
> +++ b/drivers/usb/typec/ucsi/Kconfig
> @@ -85,6 +85,7 @@ config CROS_EC_UCSI
>  config UCSI_LENOVO_YOGA_C630
>  	tristate "UCSI Interface Driver for Lenovo Yoga C630"
>  	depends on EC_LENOVO_YOGA_C630
> +	select DRM_AUX_HPD_BRIDGE if DRM_BRIDGE && OF
>  	help
>  	  This driver enables UCSI support on the Lenovo Yoga C630 laptop.
>  
> diff --git a/drivers/usb/typec/ucsi/ucsi_yoga_c630.c b/drivers/usb/typec/ucsi/ucsi_yoga_c630.c
> index f85170417d19cdc5ae39a15e2f97010259ef12f6..0187c1c4b21abc7b5429526ebb4538c28b2e2e77 100644
> --- a/drivers/usb/typec/ucsi/ucsi_yoga_c630.c
> +++ b/drivers/usb/typec/ucsi/ucsi_yoga_c630.c
> @@ -12,10 +12,14 @@
>  #include <linux/container_of.h>
>  #include <linux/module.h>
>  #include <linux/notifier.h>
> +#include <linux/of.h>
> +#include <linux/property.h>
>  #include <linux/string.h>
>  #include <linux/platform_data/lenovo-yoga-c630.h>
>  #include <linux/usb/typec_dp.h>
>  
> +#include <drm/bridge/aux-bridge.h>
> +
>  #include "ucsi.h"
>  
>  #define LENOVO_EC_USB_MUX	0x08
> @@ -29,6 +33,7 @@
>  struct yoga_c630_ucsi {
>  	struct yoga_c630_ec *ec;
>  	struct ucsi *ucsi;
> +	struct auxiliary_device *bridge;
>  	struct notifier_block nb;
>  	u16 version;
>  };
> @@ -193,6 +198,13 @@ static void yoga_c630_ucsi_read_port0_status(struct yoga_c630_ucsi *uec)
>  				      ccst == 1 ?
>  				      TYPEC_ORIENTATION_REVERSE :
>  				      TYPEC_ORIENTATION_NORMAL);
> +
> +	if (uec->bridge)
> +		drm_aux_hpd_bridge_notify(&uec->bridge->dev,
> +					  dppn != 0 ?
> +					  connector_status_connected :
> +					  connector_status_disconnected);
> +
>  }
>  
>  static int yoga_c630_ucsi_notify(struct notifier_block *nb,
> @@ -237,6 +249,24 @@ static int yoga_c630_ucsi_probe(struct auxiliary_device *adev,
>  	uec->ec = ec;
>  	uec->nb.notifier_call = yoga_c630_ucsi_notify;
>  
> +	device_for_each_child_node_scoped(&adev->dev, fwnode) {
> +		u32 port;
> +
> +		ret = fwnode_property_read_u32(fwnode, "reg", &port);
> +		if (ret < 0) {
> +			dev_err(&adev->dev, "missing reg property of %pfwP\n", fwnode);
> +			return ret;
> +		}
> +
> +		/* DP is only on port0 */
> +		if (port != 0)
> +			continue;
> +
> +		uec->bridge = devm_drm_dp_hpd_bridge_alloc(&adev->dev, to_of_node(fwnode));
> +		if (IS_ERR(uec->bridge))
> +			return PTR_ERR(uec->bridge);
> +	}
> +
>  	uec->ucsi = ucsi_create(&adev->dev, &yoga_c630_ucsi_ops);
>  	if (IS_ERR(uec->ucsi))
>  		return PTR_ERR(uec->ucsi);
> @@ -255,8 +285,17 @@ static int yoga_c630_ucsi_probe(struct auxiliary_device *adev,
>  	if (ret)
>  		goto err_unregister;
>  
> +	if (uec->bridge) {
> +		ret = devm_drm_dp_hpd_bridge_add(&adev->dev, uec->bridge);
> +		if (ret)
> +			goto err_ucsi_unregister;
> +	}
> +
>  	return 0;
>  
> +err_ucsi_unregister:
> +	ucsi_unregister(uec->ucsi);
> +
>  err_unregister:
>  	yoga_c630_ec_unregister_notify(uec->ec, &uec->nb);
>  
> 
> -- 
> 2.39.5

-- 
heikki

      reply	other threads:[~2025-06-24  9:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-21 18:12 [PATCH 0/8] usb: typec: ucsi: yoga-c630: enable DisplayPort support Dmitry Baryshkov
2025-06-21 18:12 ` [PATCH 1/8] usb: typec: ucsi: yoga-c630: fix error and remove paths Dmitry Baryshkov
2025-06-24  9:05   ` Heikki Krogerus
2025-06-21 18:12 ` [PATCH 2/8] usb: typec: ucsi: add recipient arg to update_altmodes() callback Dmitry Baryshkov
2025-06-24  9:07   ` Heikki Krogerus
2025-06-21 18:12 ` [PATCH 3/8] usb: typec: ucsi: yoga-c630: remove duplicate AltModes Dmitry Baryshkov
2025-06-24  9:08   ` Heikki Krogerus
2025-06-21 18:12 ` [PATCH 4/8] usb: typec: ucsi: yoga-c630: remove extra AltModes for port 1 Dmitry Baryshkov
2025-06-24  9:12   ` Heikki Krogerus
2025-06-21 18:13 ` [PATCH 5/8] usb: typec: ucsi: yoga-c630: fake AltModes for port 0 Dmitry Baryshkov
2025-06-24  9:13   ` Heikki Krogerus
2025-06-21 18:13 ` [PATCH 6/8] usb: typec: ucsi: yoga-c630: correct response for GET_CURRENT_CAM Dmitry Baryshkov
2025-06-24  9:16   ` Heikki Krogerus
2025-06-21 18:13 ` [PATCH 7/8] usb: typec: ucsi: yoga-c630: handle USB / HPD messages to set port orientation Dmitry Baryshkov
2025-06-24  9:20   ` Heikki Krogerus
2025-06-21 18:13 ` [PATCH 8/8] usb: typec: ucsi: yoga-c630: register DRM HPD bridge Dmitry Baryshkov
2025-06-24  9:21   ` 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=aFpuLuzBXgazxecA@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.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 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.