diff mbox series

[6/6] platform/chrome: cros_ec_typec: Set opmode to PD on SOP connected

Message ID 20210129061406.2680146-7-bleung@chromium.org
State New
Headers show
Series usb: typec: and platform/chrome: Add PD revision numbers | expand

Commit Message

Benson Leung Jan. 29, 2021, 6:14 a.m. UTC
When SOP Discovery is done, set the opmode to PD if status indicates
SOP is connected.

SOP connected indicates a PD contract is in place, and is a solid
indication we have transitioned to PD power negotiation, either as
source or sink.

Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/platform/chrome/cros_ec_typec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Heikki Krogerus Feb. 1, 2021, 12:55 p.m. UTC | #1
On Thu, Jan 28, 2021 at 10:14:06PM -0800, Benson Leung wrote:
> When SOP Discovery is done, set the opmode to PD if status indicates

> SOP is connected.

> 

> SOP connected indicates a PD contract is in place, and is a solid

> indication we have transitioned to PD power negotiation, either as

> source or sink.

> 

> Signed-off-by: Benson Leung <bleung@chromium.org>


FWIW:

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


> ---

>  drivers/platform/chrome/cros_ec_typec.c | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c

> index 6bc6fafd54a4..a7778258d0a0 100644

> --- a/drivers/platform/chrome/cros_ec_typec.c

> +++ b/drivers/platform/chrome/cros_ec_typec.c

> @@ -900,6 +900,9 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num

>  			dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num);

>  		else

>  			typec->ports[port_num]->sop_disc_done = true;

> +

> +		if (resp.sop_connected)

> +			typec_set_pwr_opmode(typec->ports[port_num]->port, TYPEC_PWR_MODE_PD);

>  	}

>  

>  	if (resp.events & PD_STATUS_EVENT_SOP_PRIME_DISC_DONE &&

> -- 

> 2.30.0.365.g02bc693789-goog


thanks,

-- 
heikki
Enric Balletbo i Serra Feb. 1, 2021, 2:33 p.m. UTC | #2
Hi Benson,

On 29/1/21 7:14, Benson Leung wrote:
> When SOP Discovery is done, set the opmode to PD if status indicates

> SOP is connected.

> 

> SOP connected indicates a PD contract is in place, and is a solid

> indication we have transitioned to PD power negotiation, either as

> source or sink.

> 

> Signed-off-by: Benson Leung <bleung@chromium.org>


Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>


> ---

>  drivers/platform/chrome/cros_ec_typec.c | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c

> index 6bc6fafd54a4..a7778258d0a0 100644

> --- a/drivers/platform/chrome/cros_ec_typec.c

> +++ b/drivers/platform/chrome/cros_ec_typec.c

> @@ -900,6 +900,9 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num

>  			dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num);

>  		else

>  			typec->ports[port_num]->sop_disc_done = true;

> +

> +		if (resp.sop_connected)

> +			typec_set_pwr_opmode(typec->ports[port_num]->port, TYPEC_PWR_MODE_PD);

>  	}

>  

>  	if (resp.events & PD_STATUS_EVENT_SOP_PRIME_DISC_DONE &&

>
Prashant Malani Feb. 1, 2021, 6:15 p.m. UTC | #3
On Thu, Jan 28, 2021 at 10:14 PM Benson Leung <bleung@chromium.org> wrote:
>

> When SOP Discovery is done, set the opmode to PD if status indicates

> SOP is connected.

>

> SOP connected indicates a PD contract is in place, and is a solid

> indication we have transitioned to PD power negotiation, either as

> source or sink.

>

> Signed-off-by: Benson Leung <bleung@chromium.org>

Reviewed-by: Prashant Malani <pmalani@chromium.org>


> ---

>  drivers/platform/chrome/cros_ec_typec.c | 3 +++

>  1 file changed, 3 insertions(+)

>

> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c

> index 6bc6fafd54a4..a7778258d0a0 100644

> --- a/drivers/platform/chrome/cros_ec_typec.c

> +++ b/drivers/platform/chrome/cros_ec_typec.c

> @@ -900,6 +900,9 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num

>                         dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num);

>                 else

>                         typec->ports[port_num]->sop_disc_done = true;

> +

> +               if (resp.sop_connected)

> +                       typec_set_pwr_opmode(typec->ports[port_num]->port, TYPEC_PWR_MODE_PD);

>         }

>

>         if (resp.events & PD_STATUS_EVENT_SOP_PRIME_DISC_DONE &&

> --

> 2.30.0.365.g02bc693789-goog

>
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 6bc6fafd54a4..a7778258d0a0 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -900,6 +900,9 @@  static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num
 			dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num);
 		else
 			typec->ports[port_num]->sop_disc_done = true;
+
+		if (resp.sop_connected)
+			typec_set_pwr_opmode(typec->ports[port_num]->port, TYPEC_PWR_MODE_PD);
 	}
 
 	if (resp.events & PD_STATUS_EVENT_SOP_PRIME_DISC_DONE &&