This is a short series to link a registered USB PD object to its associated
partner device. This is helpful for userspace services (the ChromeOS Type-C
daemon, for example), to identify which Type-C peripheral a PD object belongs to,
when a uevent for the PD object arrives.
The first patch adds a wrapper to the Type-C class code to register a PD object
with a Type-C partner as its parent. The second patch uses that wrapper to
register the Type-C partner USB PD object in the port driver code.
There was an earlier patch[1] to solve this issue, but it's been jettisoned (on advice from
GregKH) in favor of the current approach.
[1] https://lore.kernel.org/linux-usb/[email protected]/T/#m7521020f64d878313d7dd79903ec0e9421aa8737
Series submission suggestions (if the approach is OK):
- Patch 1 goes throug the USB tree and Patch 2 goes in the next release cycle
through the chrome-platform tree.
- Patch 1 and 2 both go through the USB tree.
v1: https://lore.kernel.org/linux-usb/[email protected]/
Changes since v1:
- Drop Patch 1 from v1, and instead introduce a new Patch 1 which uses the wrapper
function suggested by Heikki Krogerus.
- Update Patch 2 to use the new wrapper.
Prashant Malani (2):
usb: typec: Add partner PD object wrapper
platform/chrome: cros_ec_typec: Set parent of partner PD object
drivers/platform/chrome/cros_ec_typec.c | 2 +-
drivers/usb/typec/class.c | 19 +++++++++++++++++++
include/linux/usb/typec.h | 4 ++++
3 files changed, 24 insertions(+), 1 deletion(-)
--
2.38.1.584.g0f3c55d4c2-goog
In order to tell what Type-C device a PD object belongs to, its parent
needs to be set. Use the Type-C partner USB PD registration wrapper
to set the parent appropriately for PD objects which are created for
connected Type-C partners.
Cc: Benson Leung <[email protected]>
Cc: Heikki Krogerus <[email protected]>
Signed-off-by: Prashant Malani <[email protected]>
---
Changes since v1:
- Use wrapper function introduced in Patch1 (v2).
- Update commit message to reflect that we are using the wrapper.
drivers/platform/chrome/cros_ec_typec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 2a7ff14dc37e..d5bc4021aca2 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -968,7 +968,7 @@ static void cros_typec_register_partner_pdos(struct cros_typec_data *typec,
if (!resp->source_cap_count && !resp->sink_cap_count)
return;
- port->partner_pd = usb_power_delivery_register(NULL, &desc);
+ port->partner_pd = typec_partner_usb_power_delivery_register(port->partner, &desc);
if (IS_ERR(port->partner_pd)) {
dev_warn(typec->dev, "Failed to register partner PD device, port: %d\n", port_num);
return;
--
2.38.1.584.g0f3c55d4c2-goog
On Tue, Nov 22, 2022 at 10:05:37PM +0000, Prashant Malani wrote:
> In order to tell what Type-C device a PD object belongs to, its parent
> needs to be set. Use the Type-C partner USB PD registration wrapper
> to set the parent appropriately for PD objects which are created for
> connected Type-C partners.
>
> Cc: Benson Leung <[email protected]>
> Cc: Heikki Krogerus <[email protected]>
> Signed-off-by: Prashant Malani <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
> ---
>
> Changes since v1:
> - Use wrapper function introduced in Patch1 (v2).
> - Update commit message to reflect that we are using the wrapper.
>
> drivers/platform/chrome/cros_ec_typec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 2a7ff14dc37e..d5bc4021aca2 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -968,7 +968,7 @@ static void cros_typec_register_partner_pdos(struct cros_typec_data *typec,
> if (!resp->source_cap_count && !resp->sink_cap_count)
> return;
>
> - port->partner_pd = usb_power_delivery_register(NULL, &desc);
> + port->partner_pd = typec_partner_usb_power_delivery_register(port->partner, &desc);
> if (IS_ERR(port->partner_pd)) {
> dev_warn(typec->dev, "Failed to register partner PD device, port: %d\n", port_num);
> return;
thanks,
--
heikki
Hello:
This series was applied to chrome-platform/linux.git (for-kernelci)
by Greg Kroah-Hartman <[email protected]>:
On Tue, 22 Nov 2022 22:05:35 +0000 you wrote:
> This is a short series to link a registered USB PD object to its associated
> partner device. This is helpful for userspace services (the ChromeOS Type-C
> daemon, for example), to identify which Type-C peripheral a PD object belongs to,
> when a uevent for the PD object arrives.
>
> The first patch adds a wrapper to the Type-C class code to register a PD object
> with a Type-C partner as its parent. The second patch uses that wrapper to
> register the Type-C partner USB PD object in the port driver code.
>
> [...]
Here is the summary with links:
- [v2,1/2] usb: typec: Add partner PD object wrapper
https://git.kernel.org/chrome-platform/c/032399819dd5
- [v2,2/2] platform/chrome: cros_ec_typec: Set parent of partner PD object
https://git.kernel.org/chrome-platform/c/ab3593eeef60
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Hello:
This series was applied to chrome-platform/linux.git (for-next)
by Greg Kroah-Hartman <[email protected]>:
On Tue, 22 Nov 2022 22:05:35 +0000 you wrote:
> This is a short series to link a registered USB PD object to its associated
> partner device. This is helpful for userspace services (the ChromeOS Type-C
> daemon, for example), to identify which Type-C peripheral a PD object belongs to,
> when a uevent for the PD object arrives.
>
> The first patch adds a wrapper to the Type-C class code to register a PD object
> with a Type-C partner as its parent. The second patch uses that wrapper to
> register the Type-C partner USB PD object in the port driver code.
>
> [...]
Here is the summary with links:
- [v2,1/2] usb: typec: Add partner PD object wrapper
https://git.kernel.org/chrome-platform/c/032399819dd5
- [v2,2/2] platform/chrome: cros_ec_typec: Set parent of partner PD object
https://git.kernel.org/chrome-platform/c/ab3593eeef60
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html