All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: gregkh@linuxfoundation.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] usb: typec: tipd: add read_power_status callback to tipd_data
Date: Fri, 3 Jul 2026 18:14:35 +0300	[thread overview]
Message-ID: <akfR2w7zX-gBCLU1@kuha> (raw)
In-Reply-To: <20260702190527.1820671-3-radhey.shyam.pandey@amd.com>

On Fri, Jul 03, 2026 at 12:35:26AM +0530, Radhey Shyam Pandey wrote:
> Convert direct tps6598x_read_power_status() calls to use an indirect
> read_power_status callback through tipd_data. This allows variants
> (e.g. TPS66993) to provide their own power status reading logic while
> keeping existing behavior unchanged for TPS6598x, CD321x, and TPS25750.
> 
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>

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

> ---
> Changes for v2:
> - New patch to add TPS66993 driver support.
> ---
>  drivers/usb/typec/tipd/core.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index d5ee0af9058b..a6cb233a055d 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -159,6 +159,7 @@ struct tipd_data {
>  	int (*init)(struct tps6598x *tps);
>  	int (*switch_power_state)(struct tps6598x *tps, u8 target_state);
>  	bool (*read_data_status)(struct tps6598x *tps);
> +	bool (*read_power_status)(struct tps6598x *tps);
>  	int (*reset)(struct tps6598x *tps);
>  	int (*connect)(struct tps6598x *tps, u32 status);
>  };
> @@ -897,7 +898,7 @@ static irqreturn_t cd321x_interrupt(int irq, void *data)
>  		goto err_unlock;
>  
>  	if (event & APPLE_CD_REG_INT_POWER_STATUS_UPDATE) {
> -		if (!tps6598x_read_power_status(tps))
> +		if (!tps->data->read_power_status(tps))
>  			goto err_unlock;
>  		if (TPS_POWER_STATUS_PWROPMODE(tps->pwr_status) == TYPEC_PWR_MODE_PD) {
>  			if (tps6598x_read_partner_identity(tps)) {
> @@ -952,7 +953,7 @@ static irqreturn_t tps25750_interrupt(int irq, void *data)
>  		goto err_clear_ints;
>  
>  	if (event[0] & TPS_REG_INT_POWER_STATUS_UPDATE)
> -		if (!tps6598x_read_power_status(tps))
> +		if (!tps->data->read_power_status(tps))
>  			goto err_clear_ints;
>  
>  	if (event[0] & TPS_REG_INT_DATA_STATUS_UPDATE)
> @@ -1026,7 +1027,7 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
>  		goto err_unlock;
>  
>  	if ((event1[0] | event2[0]) & TPS_REG_INT_POWER_STATUS_UPDATE)
> -		if (!tps6598x_read_power_status(tps))
> +		if (!tps->data->read_power_status(tps))
>  			goto err_unlock;
>  
>  	if ((event1[0] | event2[0]) & TPS_REG_INT_DATA_STATUS_UPDATE)
> @@ -1836,7 +1837,7 @@ static int tps6598x_probe(struct i2c_client *client)
>  
>  	if (status & TPS_STATUS_PLUG_PRESENT) {
>  		ret = -EINVAL;
> -		if (!tps6598x_read_power_status(tps))
> +		if (!tps->data->read_power_status(tps))
>  			goto err_unregister_port;
>  		if (!tps->data->read_data_status(tps))
>  			goto err_unregister_port;
> @@ -1978,6 +1979,7 @@ static const struct tipd_data cd321x_data = {
>  	.trace_status = trace_tps6598x_status,
>  	.init = cd321x_init,
>  	.read_data_status = cd321x_read_data_status,
> +	.read_power_status = tps6598x_read_power_status,
>  	.reset = cd321x_reset,
>  	.switch_power_state = cd321x_switch_power_state,
>  	.connect = cd321x_connect,
> @@ -1997,6 +1999,7 @@ static const struct tipd_data tps6598x_data = {
>  	.apply_patch = tps6598x_apply_patch,
>  	.init = tps6598x_init,
>  	.read_data_status = tps6598x_read_data_status,
> +	.read_power_status = tps6598x_read_power_status,
>  	.reset = tps6598x_reset,
>  	.connect = tps6598x_connect,
>  };
> @@ -2015,6 +2018,7 @@ static const struct tipd_data tps25750_data = {
>  	.apply_patch = tps25750_apply_patch,
>  	.init = tps25750_init,
>  	.read_data_status = tps6598x_read_data_status,
> +	.read_power_status = tps6598x_read_power_status,
>  	.reset = tps25750_reset,
>  	.connect = tps6598x_connect,
>  };
> -- 
> 2.43.0

-- 
heikki

  reply	other threads:[~2026-07-03 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 19:05 [PATCH v2 0/3] usb: typec: tipd: add TPS66993 support Radhey Shyam Pandey
2026-07-02 19:05 ` [PATCH v2 1/3] dt-bindings: usb: ti,tps6598x: add TPS66993 compatible Radhey Shyam Pandey
2026-07-03  7:12   ` Krzysztof Kozlowski
2026-07-02 19:05 ` [PATCH v2 2/3] usb: typec: tipd: add read_power_status callback to tipd_data Radhey Shyam Pandey
2026-07-03 15:14   ` Heikki Krogerus [this message]
2026-07-02 19:05 ` [PATCH v2 3/3] usb: typec: tipd: add TPS66993 support Radhey Shyam Pandey
2026-07-02 19:21   ` sashiko-bot
2026-07-03 15:17   ` Heikki Krogerus
2026-07-08 17:34     ` Pandey, Radhey Shyam

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=akfR2w7zX-gBCLU1@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=robh@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.