public inbox for linux-usb@vger.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 2/8] usb: typec: ucsi: add recipient arg to update_altmodes() callback
Date: Tue, 24 Jun 2025 12:07:28 +0300	[thread overview]
Message-ID: <aFpq0GutBucmKWLw@kuha.fi.intel.com> (raw)
In-Reply-To: <20250621-c630-ucsi-v1-2-a86de5e11361@oss.qualcomm.com>

On Sat, Jun 21, 2025 at 09:12:57PM +0300, Dmitry Baryshkov wrote:
> The update_altmodes() is executed only for connetor's AltModes, because
> that's what required on the CCG platforms. Other platforms (like Lenovo
> Yoga C630) requires similar fix for partner's AltModes. Extend
> update_altmodes() callback to accept the recipient as an argument and
> move corresponding check to the CCG UCSI driver.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

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

> ---
>  drivers/usb/typec/ucsi/ucsi.c     | 5 ++---
>  drivers/usb/typec/ucsi/ucsi.h     | 3 ++-
>  drivers/usb/typec/ucsi/ucsi_ccg.c | 4 ++++
>  3 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 01ce858a1a2b3466155db340e213c767d1e79479..e913d099f934c7728cb678fc8e21e75ab0a00cce 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -531,13 +531,12 @@ ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient)
>  	 * Update the original altmode table as some ppms may report
>  	 * multiple DP altmodes.
>  	 */
> -	if (recipient == UCSI_RECIPIENT_CON)
> -		multi_dp = ucsi->ops->update_altmodes(ucsi, orig, updated);
> +	multi_dp = ucsi->ops->update_altmodes(ucsi, recipient, orig, updated);
>  
>  	/* now register altmodes */
>  	for (i = 0; i < max_altmodes; i++) {
>  		memset(&desc, 0, sizeof(desc));
> -		if (multi_dp && recipient == UCSI_RECIPIENT_CON) {
> +		if (multi_dp) {
>  			desc.svid = updated[i].svid;
>  			desc.vdo = updated[i].mid;
>  		} else {
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 5a8f947fcece29f98c0458f9eb05c0c5ede2d244..d02f6a3e2f50a4044eb3f22276931017cc624532 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -82,7 +82,8 @@ struct ucsi_operations {
>  	int (*sync_control)(struct ucsi *ucsi, u64 command, u32 *cci,
>  			    void *data, size_t size);
>  	int (*async_control)(struct ucsi *ucsi, u64 command);
> -	bool (*update_altmodes)(struct ucsi *ucsi, struct ucsi_altmode *orig,
> +	bool (*update_altmodes)(struct ucsi *ucsi, u8 recipient,
> +				struct ucsi_altmode *orig,
>  				struct ucsi_altmode *updated);
>  	void (*update_connector)(struct ucsi_connector *con);
>  	void (*connector_status)(struct ucsi_connector *con);
> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> index e9a9df1431af3a52c00cc456f5c920b9077a1ade..d83a0051c737336af2543fc2f6d53a131ffe9583 100644
> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> @@ -394,6 +394,7 @@ static void ucsi_ccg_update_get_current_cam_cmd(struct ucsi_ccg *uc, u8 *data)
>  }
>  
>  static bool ucsi_ccg_update_altmodes(struct ucsi *ucsi,
> +				     u8 recipient,
>  				     struct ucsi_altmode *orig,
>  				     struct ucsi_altmode *updated)
>  {
> @@ -402,6 +403,9 @@ static bool ucsi_ccg_update_altmodes(struct ucsi *ucsi,
>  	int i, j, k = 0;
>  	bool found = false;
>  
> +	if (recipient != UCSI_RECIPIENT_CON)
> +		return false;
> +
>  	alt = uc->orig;
>  	new_alt = uc->updated;
>  	memset(uc->updated, 0, sizeof(uc->updated));
> 
> -- 
> 2.39.5

-- 
heikki

  reply	other threads:[~2025-06-24  9:07 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 [this message]
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

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=aFpq0GutBucmKWLw@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox