All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Rob Herring <robh+dt@kernel.org>,
	Adam Thomson <Adam.Thomson.Opensource@diasemi.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, Kyle Tso <kyletso@google.com>
Subject: Re: [PATCH v1 2/6] usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply
Date: Tue, 6 Apr 2021 16:14:42 +0200	[thread overview]
Message-ID: <YGxs0uSQe46c7/mD@kroah.com> (raw)
In-Reply-To: <20210406013643.3280369-3-badhri@google.com>

On Mon, Apr 05, 2021 at 06:36:39PM -0700, Badhri Jagan Sridharan wrote:
> tcpm_pd_select_pps_apdo overwrites port->pps_data.min_volt,
> port->pps_data.max_volt, port->pps_data.max_curr even before
> port partner accepts the requests. This leaves incorrect values
> in current_limit and supply_voltage that get exported by
> "tcpm-source-psy-". Solving this problem by caching the request
> values in req_min_volt, req_max_volt, req_max_curr, req_out_volt,
> req_op_curr. min_volt, max_volt, max_curr gets updated once the
> partner accepts the request. current_limit, supply_voltage gets updated
> once local port's tcpm enters SNK_TRANSITION_SINK when the accepted
> current_limit and supply_voltage is enforced.
> 
> Fixes: f2a8aa053c176 ("typec: tcpm: Represent source supply through power_supply")
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 84 ++++++++++++++++++++---------------
>  1 file changed, 49 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 03eca5061132..d43774cc2ccf 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -269,11 +269,22 @@ struct pd_mode_data {
>  };
>  
>  struct pd_pps_data {
> +	/* Actual min voltage at the local port */
>  	u32 min_volt;
> +	/* Requested min voltage to the port partner */
> +	u32 req_min_volt;
> +	/* Actual max voltage at the local port */
>  	u32 max_volt;
> +	/* Requested max voltage to the port partner */
> +	u32 req_max_volt;
> +	/* Actual max current at the local port */
>  	u32 max_curr;
> -	u32 out_volt;
> -	u32 op_curr;
> +	/* Requested max current of the port partner */
> +	u32 req_max_curr;
> +	/* Requested output voltage to the port partner */
> +	u32 req_out_volt;
> +	/* Requested operating current to the port partner */
> +	u32 req_op_curr;

Shouldn't you just document this all properly in a kerneldoc header
right above the structure?

thanks,

greg k-h

  reply	other threads:[~2021-04-06 14:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  1:36 [PATCH v1 0/6] Fixes for tcpm-source-psy- and pSnkStby Badhri Jagan Sridharan
2021-04-06  1:36 ` [PATCH v1 1/6] usb: typec: tcpm: Address incorrect values of tcpm psy for fixed supply Badhri Jagan Sridharan
2021-04-06  1:56   ` Guenter Roeck
2021-04-07 16:04   ` Adam Thomson
2021-04-07 20:13     ` Badhri Jagan Sridharan
2021-04-06  1:36 ` [PATCH v1 2/6] usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply Badhri Jagan Sridharan
2021-04-06 14:14   ` Greg Kroah-Hartman [this message]
2021-04-07 16:07   ` Adam Thomson
2021-04-07 20:12     ` Badhri Jagan Sridharan
2021-04-06  1:36 ` [PATCH v1 3/6] usb: typec: tcpm: update power supply once partner accepts Badhri Jagan Sridharan
2021-04-06  1:57   ` Guenter Roeck
2021-04-07 16:08   ` Adam Thomson
2021-04-07 20:11     ` Badhri Jagan Sridharan
2021-04-06  1:36 ` [PATCH v1 4/6] usb: typec: tcpm: Honour pSnkStdby requirement during negotiation Badhri Jagan Sridharan
2021-04-06  1:36 ` [PATCH v1 5/6] usb: typec: tcpm: Allow slow charging loops to comply to pSnkStby Badhri Jagan Sridharan
2021-04-06  1:36 ` [PATCH v1 6/6] Documentation: connector: Add slow-charger-loop definition Badhri Jagan Sridharan

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=YGxs0uSQe46c7/mD@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=badhri@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@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.