mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Cc: linux-usb@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Sven Peter" <sven@svenpeter.dev>,
	"Guido Günther" <agx@sigxcpu.org>,
	"Angus Ainslie" <angus@akkea.ca>,
	"Hector Martin" <marcan@marcan.st>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	linux-kernel@vger.kernel.org, kernel@puri.sm
Subject: Re: [PATCH 2/7] usb: typec: tipd: set the data role on tps IRQ
Date: Mon, 4 Apr 2022 16:29:51 +0300	[thread overview]
Message-ID: <Ykryz2go6WJXkJ/5@kuha.fi.intel.com> (raw)
In-Reply-To: <20220317154518.4082046-3-sebastian.krzyszkowiak@puri.sm>

On Thu, Mar 17, 2022 at 04:45:13PM +0100, Sebastian Krzyszkowiak wrote:
> From: Angus Ainslie <angus@akkea.ca>
> 
> Don't immediately set the data role, only set it in response to the
> negotiated value notification from the tps6589x. Otherwise data role
> switch fails for DRP.
> 
> We only use values cached from the IRQ instead of poking I2C all
> the time.
> 
> The update is moved in a function that will become more useful in later
> commits.
> 
> Fixes: 18a6c866bb19 ("usb: typec: tps6598x: Add USB role switching logic")
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>

Fixes tag but but no Cc: stable... tag?

Is there some reason why you don't have the stable tag, i.e. why
shouldn't this be added to the stable kernels?

> ---
>  drivers/usb/typec/tipd/core.c | 23 +++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index dfbba5ae9487..f387786ff95e 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -94,6 +94,7 @@ struct tps6598x {
>  	struct power_supply_desc psy_desc;
>  	enum power_supply_usb_type usb_type;
>  
> +	u32 data_status;
>  	u16 pwr_status;
>  };
>  
> @@ -271,6 +272,15 @@ static int tps6598x_connect(struct tps6598x *tps, u32 status)
>  	return 0;
>  }
>  
> +static int
> +tps6598x_update_data_status(struct tps6598x *tps, u32 status)
> +{
> +	tps6598x_set_data_role(tps, TPS_STATUS_TO_TYPEC_DATAROLE(status),
> +			       !!(tps->data_status & TPS_DATA_STATUS_DATA_CONNECTION));
> +	trace_tps6598x_data_status(tps->data_status);
> +	return 0;
> +}
> +
>  static void tps6598x_disconnect(struct tps6598x *tps, u32 status)
>  {
>  	if (!IS_ERR(tps->partner))
> @@ -370,8 +380,6 @@ static int tps6598x_dr_set(struct typec_port *port, enum typec_data_role role)
>  		goto out_unlock;
>  	}
>  
> -	tps6598x_set_data_role(tps, role, true);
> -
>  out_unlock:
>  	mutex_unlock(&tps->lock);
>  
> @@ -437,6 +445,7 @@ static bool tps6598x_read_data_status(struct tps6598x *tps)
>  		dev_err(tps->dev, "failed to read data status: %d\n", ret);
>  		return false;
>  	}
> +	tps->data_status = data_status;
>  	trace_tps6598x_data_status(data_status);
>  
>  	return true;
> @@ -497,10 +506,13 @@ static irqreturn_t cd321x_interrupt(int irq, void *data)
>  		if (!tps6598x_read_power_status(tps))
>  			goto err_clear_ints;
>  
> -	if (event & APPLE_CD_REG_INT_DATA_STATUS_UPDATE)
> +	if (event & APPLE_CD_REG_INT_DATA_STATUS_UPDATE) {
>  		if (!tps6598x_read_data_status(tps))
>  			goto err_clear_ints;
>  
> +		tps6598x_update_data_status(tps, status);
> +	}
> +
>  	/* Handle plug insert or removal */
>  	if (event & APPLE_CD_REG_INT_PLUG_EVENT)
>  		tps6598x_handle_plug_event(tps, status);
> @@ -544,10 +556,13 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
>  		if (!tps6598x_read_power_status(tps))
>  			goto err_clear_ints;
>  
> -	if ((event1 | event2) & TPS_REG_INT_DATA_STATUS_UPDATE)
> +	if ((event1 | event2) & TPS_REG_INT_DATA_STATUS_UPDATE) {
>  		if (!tps6598x_read_data_status(tps))
>  			goto err_clear_ints;
>  
> +		tps6598x_update_data_status(tps, status);
> +	}
> +
>  	/* Handle plug insert or removal */
>  	if ((event1 | event2) & TPS_REG_INT_PLUG_EVENT)
>  		tps6598x_handle_plug_event(tps, status);
> -- 
> 2.35.1

-- 
heikki

  reply	other threads:[~2022-04-04 13:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 15:45 [PATCH 0/7] TPS6598x PD tracing and other improvements Sebastian Krzyszkowiak
2022-03-17 15:45 ` [PATCH 1/7] usb: typec: tipd: Only update power status on IRQ Sebastian Krzyszkowiak
2022-04-04 13:22   ` Heikki Krogerus
2022-03-17 15:45 ` [PATCH 2/7] usb: typec: tipd: set the data role on tps IRQ Sebastian Krzyszkowiak
2022-04-04 13:29   ` Heikki Krogerus [this message]
2022-03-17 15:45 ` [PATCH 3/7] usb: typec: tipd: Add trace event for SINK PD contract Sebastian Krzyszkowiak
2022-04-04 13:42   ` Heikki Krogerus
2022-03-17 15:45 ` [PATCH 4/7] usb: typec: tipd: Provide POWER_SUPPLY_PROP_{CURRENT,VOLTAGE}_MAX Sebastian Krzyszkowiak
2022-04-04 13:57   ` Heikki Krogerus
2022-03-17 15:45 ` [PATCH 5/7] usb: typec: tipd: Provide POWER_SUPPLY_PROP_PRESENT Sebastian Krzyszkowiak
2022-04-04 13:59   ` Heikki Krogerus
2022-03-17 15:45 ` [PATCH 6/7] usb: typec: tipd: Add debugfs entries for customer use word Sebastian Krzyszkowiak
2022-04-04 14:03   ` Heikki Krogerus
2022-03-17 15:45 ` [PATCH 7/7] usb: typec: tipd: Fail probe when the controller is in BOOT mode Sebastian Krzyszkowiak
2022-04-04 14:04   ` Heikki Krogerus
2022-04-01 13:49 ` [PATCH 0/7] TPS6598x PD tracing and other improvements 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=Ykryz2go6WJXkJ/5@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=agx@sigxcpu.org \
    --cc=angus@akkea.ca \
    --cc=bryan.odonoghue@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@puri.sm \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=sebastian.krzyszkowiak@puri.sm \
    --cc=sven@svenpeter.dev \
    /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

all inboxes | Powered by JetHome®