[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24f52936-c07e-8e57-6c30-259dd3f36e61@roeck-us.net>
Date: Sun, 6 Aug 2017 07:18:29 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Hans de Goede <hdegoede@...hat.com>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Wolfram Sang <wsa@...-dreams.de>,
Sebastian Reichel <sre@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org, Liam Breck <liam@...workimprov.net>,
Tony Lindgren <tony@...mide.com>, linux-pm@...r.kernel.org,
devel@...verdev.osuosl.org
Subject: Re: [PATCH 01/18] staging: typec: tcpm: Add get_usb2_current_limit
tcpc_dev callback
On 08/06/2017 05:35 AM, Hans de Goede wrote:
> A Rp signalling the default current limit indicates that we're possibly
> connected to an USB2 power-source. In some cases the type-c
> port-controller may provide the capability to detect the current-limit
> for USB2 power-sources (through e.g. BC1.2 detection).
>
> This commit adds an optional get_usb2_current_limit tcpc_dev callback
> which allows the port-controller to return the detected current-limit
> if the CC pin is pulled up with Rp.
>
> Signed-off-by: Hans de Goede <hdegoede@...hat.com>
> ---
> drivers/staging/typec/tcpm.c | 5 ++++-
> drivers/staging/typec/tcpm.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
> index 20eb4ebcf8c3..9f5adace4309 100644
> --- a/drivers/staging/typec/tcpm.c
> +++ b/drivers/staging/typec/tcpm.c
> @@ -660,7 +660,10 @@ static u32 tcpm_get_current_limit(struct tcpm_port *port)
> break;
> case TYPEC_CC_RP_DEF:
> default:
> - limit = 0;
> + if (port->tcpc->get_usb2_current_limit)
I think this callback should just be get_current_limit.
> + limit = port->tcpc->get_usb2_current_limit(port->tcpc);
> + else
> + limit = 0;
> break;
> }
>
> diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h
> index 19c307d31a5a..01b7d89379a3 100644
> --- a/drivers/staging/typec/tcpm.h
> +++ b/drivers/staging/typec/tcpm.h
> @@ -108,6 +108,7 @@ struct tcpc_dev {
>
> int (*init)(struct tcpc_dev *dev);
> int (*get_vbus)(struct tcpc_dev *dev);
> + int (*get_usb2_current_limit)(struct tcpc_dev *dev); /* Optional */
> int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
> int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
> enum typec_cc_status *cc2);
>
Powered by blists - more mailing lists