All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0
@ 2024-05-24 10:58 Diogo Ivo
  2024-05-24 10:58 ` [PATCH 1/2] usb: typec: ucsi: Add new capability bits Diogo Ivo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Diogo Ivo @ 2024-05-24 10:58 UTC (permalink / raw)
  To: heikki.krogerus, gregkh, dmitry.baryshkov, jthies, bleung,
	abhishekpandit, saranya.gopal, lk, linux-usb, linux-kernel,
	pmalani
  Cc: Diogo Ivo

Hello,

These two patches enable checking and enabling the new optional
notification types defined in UCSI v2.0 and greater. For that, patch 1
defines the new optional capability bits and patch 2 adds the logic for
checking/enabling these new notification types.

Diogo Ivo (2):
  usb: typec: ucsi: Add new capability bits
  usb: typec: ucsi: Enable UCSI v2.0 notifications

 drivers/usb/typec/ucsi/ucsi.c | 19 ++++++++++++++++++-
 drivers/usb/typec/ucsi/ucsi.h |  8 +++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

-- 
2.45.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] usb: typec: ucsi: Add new capability bits
  2024-05-24 10:58 [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Diogo Ivo
@ 2024-05-24 10:58 ` Diogo Ivo
  2024-06-03 10:09   ` Heikki Krogerus
  2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
  2024-05-24 20:30 ` [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Dmitry Baryshkov
  2 siblings, 1 reply; 9+ messages in thread
From: Diogo Ivo @ 2024-05-24 10:58 UTC (permalink / raw)
  To: heikki.krogerus, gregkh, dmitry.baryshkov, jthies, bleung,
	abhishekpandit, saranya.gopal, lk, linux-usb, linux-kernel,
	pmalani
  Cc: Diogo Ivo

Newer UCSI versions defined additional optional capability bits. Add
their definitions.

Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
 drivers/usb/typec/ucsi/ucsi.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index e70cf5b15562..ca4a879d9606 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -225,7 +225,13 @@ struct ucsi_capability {
 #define UCSI_CAP_CABLE_DETAILS			BIT(5)
 #define UCSI_CAP_EXT_SUPPLY_NOTIFICATIONS	BIT(6)
 #define UCSI_CAP_PD_RESET			BIT(7)
-#define UCSI_CAP_GET_PD_MESSAGE		BIT(8)
+#define UCSI_CAP_GET_PD_MESSAGE			BIT(8)
+#define UCSI_CAP_GET_ATTENTION_VDO		BIT(9)
+#define UCSI_CAP_FW_UPDATE_REQUEST		BIT(10)
+#define UCSI_CAP_NEGOTIATED_PWR_LEVEL_CHANGE	BIT(11)
+#define UCSI_CAP_SECURITY_REQUEST		BIT(12)
+#define UCSI_CAP_SET_RETIMER_MODE		BIT(13)
+#define UCSI_CAP_CHUNKING_SUPPORT		BIT(14)
 	u8 reserved_1;
 	u8 num_alt_modes;
 	u8 reserved_2;
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
  2024-05-24 10:58 [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Diogo Ivo
  2024-05-24 10:58 ` [PATCH 1/2] usb: typec: ucsi: Add new capability bits Diogo Ivo
@ 2024-05-24 10:58 ` Diogo Ivo
  2024-05-24 15:28   ` kernel test robot
                     ` (3 more replies)
  2024-05-24 20:30 ` [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Dmitry Baryshkov
  2 siblings, 4 replies; 9+ messages in thread
From: Diogo Ivo @ 2024-05-24 10:58 UTC (permalink / raw)
  To: heikki.krogerus, gregkh, dmitry.baryshkov, jthies, bleung,
	abhishekpandit, saranya.gopal, lk, linux-usb, linux-kernel,
	pmalani
  Cc: Diogo Ivo

UCSI version 2.0 and above define new PPM notifications. Update the
logic to determine which notifications to enable taking into account
these changes.

Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
 drivers/usb/typec/ucsi/ucsi.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index cb52e7b0a2c5..0cc1c49da4a0 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1664,7 +1664,7 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
 
 static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
 {
-	u8 features = ucsi->cap.features;
+	u16 features = ucsi->cap.features;
 	u64 ntfy = UCSI_ENABLE_NTFY_ALL;
 
 	if (!(features & UCSI_CAP_ALT_MODE_DETAILS))
@@ -1680,6 +1680,23 @@ static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
 	if (!(features & UCSI_CAP_PD_RESET))
 		ntfy &= ~UCSI_ENABLE_NTFY_PD_RESET_COMPLETE;
 
+	if (ucsi->version <= UCSI_VERSION_1_2)
+		return ntfy;
+
+	ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
+
+	if (features & UCSI_CAP_GET_ATTENTION_VDO)
+		ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
+
+	if (features & UCSI_CAP_FW_UPDATE_REQUEST)
+		ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
+
+	if (features & UCSI_CAP_SECURITY_REQUEST)
+		ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
+
+	if (features & UCSI_CAP_SET_RETIMER_MODE)
+		ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
+
 	return ntfy;
 }
 
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
  2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
@ 2024-05-24 15:28   ` kernel test robot
  2024-05-24 15:38   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-05-24 15:28 UTC (permalink / raw)
  To: Diogo Ivo, heikki.krogerus, gregkh, dmitry.baryshkov, jthies,
	bleung, abhishekpandit, saranya.gopal, lk, linux-usb,
	linux-kernel, pmalani
  Cc: llvm, oe-kbuild-all, Diogo Ivo

Hi Diogo,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master next-20240523]
[cannot apply to v6.9]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Diogo-Ivo/usb-typec-ucsi-Add-new-capability-bits/20240524-190924
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20240524105837.15342-3-diogo.ivo%40tecnico.ulisboa.pt
patch subject: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240524/202405242305.UrCRaTK0-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240524/202405242305.UrCRaTK0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405242305.UrCRaTK0-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/usb/typec/ucsi/ucsi.c:1686:10: error: use of undeclared identifier 'UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE'
           ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
                   ^
>> drivers/usb/typec/ucsi/ucsi.c:1689:11: error: use of undeclared identifier 'UCSI_ENABLE_NTFY_ATTENTION'
                   ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
                           ^
>> drivers/usb/typec/ucsi/ucsi.c:1692:11: error: use of undeclared identifier 'UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ'
                   ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
                           ^
>> drivers/usb/typec/ucsi/ucsi.c:1695:11: error: use of undeclared identifier 'UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER'
                   ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
                           ^
>> drivers/usb/typec/ucsi/ucsi.c:1698:11: error: use of undeclared identifier 'UCSI_ENABLE_NTFY_SET_RETIMER_MODE'
                   ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
                           ^
   5 errors generated.


vim +/UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE +1686 drivers/usb/typec/ucsi/ucsi.c

  1664	
  1665	static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
  1666	{
  1667		u16 features = ucsi->cap.features;
  1668		u64 ntfy = UCSI_ENABLE_NTFY_ALL;
  1669	
  1670		if (!(features & UCSI_CAP_ALT_MODE_DETAILS))
  1671			ntfy &= ~UCSI_ENABLE_NTFY_CAM_CHANGE;
  1672	
  1673		if (!(features & UCSI_CAP_PDO_DETAILS))
  1674			ntfy &= ~(UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE |
  1675				  UCSI_ENABLE_NTFY_CAP_CHANGE);
  1676	
  1677		if (!(features & UCSI_CAP_EXT_SUPPLY_NOTIFICATIONS))
  1678			ntfy &= ~UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE;
  1679	
  1680		if (!(features & UCSI_CAP_PD_RESET))
  1681			ntfy &= ~UCSI_ENABLE_NTFY_PD_RESET_COMPLETE;
  1682	
  1683		if (ucsi->version <= UCSI_VERSION_1_2)
  1684			return ntfy;
  1685	
> 1686		ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
  1687	
  1688		if (features & UCSI_CAP_GET_ATTENTION_VDO)
> 1689			ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
  1690	
  1691		if (features & UCSI_CAP_FW_UPDATE_REQUEST)
> 1692			ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
  1693	
  1694		if (features & UCSI_CAP_SECURITY_REQUEST)
> 1695			ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
  1696	
  1697		if (features & UCSI_CAP_SET_RETIMER_MODE)
> 1698			ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
  1699	
  1700		return ntfy;
  1701	}
  1702	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
  2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
  2024-05-24 15:28   ` kernel test robot
@ 2024-05-24 15:38   ` kernel test robot
  2024-05-24 20:31   ` Dmitry Baryshkov
  2024-06-03 10:10   ` Heikki Krogerus
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-05-24 15:38 UTC (permalink / raw)
  To: Diogo Ivo, heikki.krogerus, gregkh, dmitry.baryshkov, jthies,
	bleung, abhishekpandit, saranya.gopal, lk, linux-usb,
	linux-kernel, pmalani
  Cc: oe-kbuild-all, Diogo Ivo

Hi Diogo,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master next-20240523]
[cannot apply to v6.9]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Diogo-Ivo/usb-typec-ucsi-Add-new-capability-bits/20240524-190924
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20240524105837.15342-3-diogo.ivo%40tecnico.ulisboa.pt
patch subject: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240524/202405242300.OetIYSh1-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240524/202405242300.OetIYSh1-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405242300.OetIYSh1-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/usb/typec/ucsi/ucsi.c: In function 'ucsi_get_supported_notifications':
>> drivers/usb/typec/ucsi/ucsi.c:1686:17: error: 'UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE' undeclared (first use in this function); did you mean 'UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE'?
    1686 |         ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                 UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE
   drivers/usb/typec/ucsi/ucsi.c:1686:17: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/usb/typec/ucsi/ucsi.c:1689:25: error: 'UCSI_ENABLE_NTFY_ATTENTION' undeclared (first use in this function); did you mean 'UCSI_ENABLE_NTFY_ERROR'?
    1689 |                 ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         UCSI_ENABLE_NTFY_ERROR
>> drivers/usb/typec/ucsi/ucsi.c:1692:25: error: 'UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ' undeclared (first use in this function)
    1692 |                 ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/typec/ucsi/ucsi.c:1695:25: error: 'UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER' undeclared (first use in this function)
    1695 |                 ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/typec/ucsi/ucsi.c:1698:25: error: 'UCSI_ENABLE_NTFY_SET_RETIMER_MODE' undeclared (first use in this function); did you mean 'UCSI_CAP_SET_RETIMER_MODE'?
    1698 |                 ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         UCSI_CAP_SET_RETIMER_MODE


vim +1686 drivers/usb/typec/ucsi/ucsi.c

  1664	
  1665	static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
  1666	{
  1667		u16 features = ucsi->cap.features;
  1668		u64 ntfy = UCSI_ENABLE_NTFY_ALL;
  1669	
  1670		if (!(features & UCSI_CAP_ALT_MODE_DETAILS))
  1671			ntfy &= ~UCSI_ENABLE_NTFY_CAM_CHANGE;
  1672	
  1673		if (!(features & UCSI_CAP_PDO_DETAILS))
  1674			ntfy &= ~(UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE |
  1675				  UCSI_ENABLE_NTFY_CAP_CHANGE);
  1676	
  1677		if (!(features & UCSI_CAP_EXT_SUPPLY_NOTIFICATIONS))
  1678			ntfy &= ~UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE;
  1679	
  1680		if (!(features & UCSI_CAP_PD_RESET))
  1681			ntfy &= ~UCSI_ENABLE_NTFY_PD_RESET_COMPLETE;
  1682	
  1683		if (ucsi->version <= UCSI_VERSION_1_2)
  1684			return ntfy;
  1685	
> 1686		ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
  1687	
  1688		if (features & UCSI_CAP_GET_ATTENTION_VDO)
> 1689			ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
  1690	
  1691		if (features & UCSI_CAP_FW_UPDATE_REQUEST)
> 1692			ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
  1693	
  1694		if (features & UCSI_CAP_SECURITY_REQUEST)
> 1695			ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
  1696	
  1697		if (features & UCSI_CAP_SET_RETIMER_MODE)
> 1698			ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
  1699	
  1700		return ntfy;
  1701	}
  1702	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0
  2024-05-24 10:58 [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Diogo Ivo
  2024-05-24 10:58 ` [PATCH 1/2] usb: typec: ucsi: Add new capability bits Diogo Ivo
  2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
@ 2024-05-24 20:30 ` Dmitry Baryshkov
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-05-24 20:30 UTC (permalink / raw)
  To: Diogo Ivo
  Cc: heikki.krogerus, gregkh, jthies, bleung, abhishekpandit,
	saranya.gopal, lk, linux-usb, linux-kernel, pmalani

On Fri, May 24, 2024 at 11:58:19AM +0100, Diogo Ivo wrote:
> Hello,
> 
> These two patches enable checking and enabling the new optional
> notification types defined in UCSI v2.0 and greater. For that, patch 1
> defines the new optional capability bits and patch 2 adds the logic for
> checking/enabling these new notification types.
> 
> Diogo Ivo (2):
>   usb: typec: ucsi: Add new capability bits
>   usb: typec: ucsi: Enable UCSI v2.0 notifications
> 
>  drivers/usb/typec/ucsi/ucsi.c | 19 ++++++++++++++++++-
>  drivers/usb/typec/ucsi/ucsi.h |  8 +++++++-
>  2 files changed, 25 insertions(+), 2 deletions(-)

You didn't declare dependency on [1], you didn't use --base when
formatting patches, so LKP has no way to know that there is a
dependency. In future please consider sending definitions together with
the patches actually using those defs.

[1] https://lore.kernel.org/all/3filrg6mbh6m3galir7ew5juakd25uvksimr7mqd7uc5td3xza@fdvxcewozqeh


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
  2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
  2024-05-24 15:28   ` kernel test robot
  2024-05-24 15:38   ` kernel test robot
@ 2024-05-24 20:31   ` Dmitry Baryshkov
  2024-06-03 10:10   ` Heikki Krogerus
  3 siblings, 0 replies; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-05-24 20:31 UTC (permalink / raw)
  To: Diogo Ivo
  Cc: heikki.krogerus, gregkh, jthies, bleung, abhishekpandit,
	saranya.gopal, lk, linux-usb, linux-kernel, pmalani

On Fri, May 24, 2024 at 11:58:21AM +0100, Diogo Ivo wrote:
> UCSI version 2.0 and above define new PPM notifications. Update the
> logic to determine which notifications to enable taking into account
> these changes.
> 
> Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
> ---
>  drivers/usb/typec/ucsi/ucsi.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 


Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] usb: typec: ucsi: Add new capability bits
  2024-05-24 10:58 ` [PATCH 1/2] usb: typec: ucsi: Add new capability bits Diogo Ivo
@ 2024-06-03 10:09   ` Heikki Krogerus
  0 siblings, 0 replies; 9+ messages in thread
From: Heikki Krogerus @ 2024-06-03 10:09 UTC (permalink / raw)
  To: Diogo Ivo
  Cc: gregkh, dmitry.baryshkov, jthies, bleung, abhishekpandit,
	saranya.gopal, lk, linux-usb, linux-kernel, pmalani

On Fri, May 24, 2024 at 11:58:20AM +0100, Diogo Ivo wrote:
> Newer UCSI versions defined additional optional capability bits. Add
> their definitions.
> 
> Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>

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

> ---
>  drivers/usb/typec/ucsi/ucsi.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index e70cf5b15562..ca4a879d9606 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -225,7 +225,13 @@ struct ucsi_capability {
>  #define UCSI_CAP_CABLE_DETAILS			BIT(5)
>  #define UCSI_CAP_EXT_SUPPLY_NOTIFICATIONS	BIT(6)
>  #define UCSI_CAP_PD_RESET			BIT(7)
> -#define UCSI_CAP_GET_PD_MESSAGE		BIT(8)
> +#define UCSI_CAP_GET_PD_MESSAGE			BIT(8)
> +#define UCSI_CAP_GET_ATTENTION_VDO		BIT(9)
> +#define UCSI_CAP_FW_UPDATE_REQUEST		BIT(10)
> +#define UCSI_CAP_NEGOTIATED_PWR_LEVEL_CHANGE	BIT(11)
> +#define UCSI_CAP_SECURITY_REQUEST		BIT(12)
> +#define UCSI_CAP_SET_RETIMER_MODE		BIT(13)
> +#define UCSI_CAP_CHUNKING_SUPPORT		BIT(14)
>  	u8 reserved_1;
>  	u8 num_alt_modes;
>  	u8 reserved_2;
> -- 
> 2.45.1

-- 
heikki

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications
  2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
                     ` (2 preceding siblings ...)
  2024-05-24 20:31   ` Dmitry Baryshkov
@ 2024-06-03 10:10   ` Heikki Krogerus
  3 siblings, 0 replies; 9+ messages in thread
From: Heikki Krogerus @ 2024-06-03 10:10 UTC (permalink / raw)
  To: Diogo Ivo
  Cc: gregkh, dmitry.baryshkov, jthies, bleung, abhishekpandit,
	saranya.gopal, lk, linux-usb, linux-kernel, pmalani

On Fri, May 24, 2024 at 11:58:21AM +0100, Diogo Ivo wrote:
> UCSI version 2.0 and above define new PPM notifications. Update the
> logic to determine which notifications to enable taking into account
> these changes.
> 
> Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>

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

> ---
>  drivers/usb/typec/ucsi/ucsi.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index cb52e7b0a2c5..0cc1c49da4a0 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1664,7 +1664,7 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
>  
>  static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
>  {
> -	u8 features = ucsi->cap.features;
> +	u16 features = ucsi->cap.features;
>  	u64 ntfy = UCSI_ENABLE_NTFY_ALL;
>  
>  	if (!(features & UCSI_CAP_ALT_MODE_DETAILS))
> @@ -1680,6 +1680,23 @@ static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
>  	if (!(features & UCSI_CAP_PD_RESET))
>  		ntfy &= ~UCSI_ENABLE_NTFY_PD_RESET_COMPLETE;
>  
> +	if (ucsi->version <= UCSI_VERSION_1_2)
> +		return ntfy;
> +
> +	ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
> +
> +	if (features & UCSI_CAP_GET_ATTENTION_VDO)
> +		ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
> +
> +	if (features & UCSI_CAP_FW_UPDATE_REQUEST)
> +		ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
> +
> +	if (features & UCSI_CAP_SECURITY_REQUEST)
> +		ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
> +
> +	if (features & UCSI_CAP_SET_RETIMER_MODE)
> +		ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
> +
>  	return ntfy;
>  }
>  
> -- 
> 2.45.1

-- 
heikki

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-06-03 10:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-24 10:58 [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Diogo Ivo
2024-05-24 10:58 ` [PATCH 1/2] usb: typec: ucsi: Add new capability bits Diogo Ivo
2024-06-03 10:09   ` Heikki Krogerus
2024-05-24 10:58 ` [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Diogo Ivo
2024-05-24 15:28   ` kernel test robot
2024-05-24 15:38   ` kernel test robot
2024-05-24 20:31   ` Dmitry Baryshkov
2024-06-03 10:10   ` Heikki Krogerus
2024-05-24 20:30 ` [PATCH 0/2] usb: typec: ucsi: Update optional notifications for UCSI v2.0 Dmitry Baryshkov

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.