diff mbox series

[v2,2/3] usb: typec: ucsi: Import interface for UCSI transport

Message ID 20240325-public-ucsi-h-v2-2-a6d716968bb1@chromium.org (mailing list archive)
State Superseded
Headers show
Series usb: typec: Implement UCSI driver for ChromeOS | expand

Commit Message

Pavan Holla March 25, 2024, 11:42 p.m. UTC
Import include/linux/usb/ucsi.h and remove any duplicate declarations.

Signed-off-by: Pavan Holla <pholla@chromium.org>
---
 drivers/usb/typec/ucsi/ucsi.h | 54 +------------------------------------------
 1 file changed, 1 insertion(+), 53 deletions(-)

Comments

Heikki Krogerus March 27, 2024, 11:22 a.m. UTC | #1
On Mon, Mar 25, 2024 at 11:42:26PM +0000, Pavan Holla wrote:
> Import include/linux/usb/ucsi.h and remove any duplicate declarations.
> 
> Signed-off-by: Pavan Holla <pholla@chromium.org>
> ---
>  drivers/usb/typec/ucsi/ucsi.h | 54 +------------------------------------------
>  1 file changed, 1 insertion(+), 53 deletions(-)

I'm pretty sure somebody already told you to merge this into 1/3, so
why haven't you done that?


> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 32daf5f58650..167951538030 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -10,22 +10,13 @@
>  #include <linux/usb/typec.h>
>  #include <linux/usb/pd.h>
>  #include <linux/usb/role.h>
> +#include <linux/usb/ucsi.h>
>  #include <asm/unaligned.h>
>  
>  /* -------------------------------------------------------------------------- */
>  
> -struct ucsi;
> -struct ucsi_altmode;
>  struct dentry;
>  
> -/* UCSI offsets (Bytes) */
> -#define UCSI_VERSION			0
> -#define UCSI_CCI			4
> -#define UCSI_CONTROL			8
> -#define UCSI_MESSAGE_IN			16
> -#define UCSI_MESSAGE_OUT		32
> -#define UCSIv2_MESSAGE_OUT		272
> -
>  /* UCSI versions */
>  #define UCSI_VERSION_1_2	0x0120
>  #define UCSI_VERSION_2_0	0x0200
> @@ -42,48 +33,6 @@ struct dentry;
>   */
>  #define UCSI_SPEC_REVISION_TO_BCD(_v_)  (((_v_) + 1) << 8)
>  
> -/* Command Status and Connector Change Indication (CCI) bits */
> -#define UCSI_CCI_CONNECTOR(_c_)		(((_c_) & GENMASK(7, 1)) >> 1)
> -#define UCSI_CCI_LENGTH(_c_)		(((_c_) & GENMASK(15, 8)) >> 8)
> -#define UCSI_CCI_NOT_SUPPORTED		BIT(25)
> -#define UCSI_CCI_CANCEL_COMPLETE	BIT(26)
> -#define UCSI_CCI_RESET_COMPLETE		BIT(27)
> -#define UCSI_CCI_BUSY			BIT(28)
> -#define UCSI_CCI_ACK_COMPLETE		BIT(29)
> -#define UCSI_CCI_ERROR			BIT(30)
> -#define UCSI_CCI_COMMAND_COMPLETE	BIT(31)
> -
> -/**
> - * struct ucsi_operations - UCSI I/O operations
> - * @read: Read operation
> - * @sync_write: Blocking write operation
> - * @async_write: Non-blocking write operation
> - * @update_altmodes: Squashes duplicate DP altmodes
> - *
> - * Read and write routines for UCSI interface. @sync_write must wait for the
> - * Command Completion Event from the PPM before returning, and @async_write must
> - * return immediately after sending the data to the PPM.
> - */
> -struct ucsi_operations {
> -	int (*read)(struct ucsi *ucsi, unsigned int offset,
> -		    void *val, size_t val_len);
> -	int (*sync_write)(struct ucsi *ucsi, unsigned int offset,
> -			  const void *val, size_t val_len);
> -	int (*async_write)(struct ucsi *ucsi, unsigned int offset,
> -			   const void *val, size_t val_len);
> -	bool (*update_altmodes)(struct ucsi *ucsi, struct ucsi_altmode *orig,
> -				struct ucsi_altmode *updated);
> -};
> -
> -struct ucsi *ucsi_create(struct device *dev, const struct ucsi_operations *ops);
> -void ucsi_destroy(struct ucsi *ucsi);
> -int ucsi_register(struct ucsi *ucsi);
> -void ucsi_unregister(struct ucsi *ucsi);
> -void *ucsi_get_drvdata(struct ucsi *ucsi);
> -void ucsi_set_drvdata(struct ucsi *ucsi, void *data);
> -
> -void ucsi_connector_change(struct ucsi *ucsi, u8 num);
> -
>  /* -------------------------------------------------------------------------- */
>  
>  /* Commands */
> @@ -465,7 +414,6 @@ int ucsi_send_command(struct ucsi *ucsi, u64 command,
>  		      void *retval, size_t size);
>  
>  void ucsi_altmode_update_active(struct ucsi_connector *con);
> -int ucsi_resume(struct ucsi *ucsi);
>  
>  #if IS_ENABLED(CONFIG_POWER_SUPPLY)
>  int ucsi_register_port_psy(struct ucsi_connector *con);
> 
> -- 
> 2.44.0.396.g6e790dbe36-goog
Pavan Holla March 27, 2024, 10:40 p.m. UTC | #2
On Wed, Mar 27, 2024 at 4:22 AM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
> I'm pretty sure somebody already told you to merge this into 1/3, so
> why haven't you done that?

v2 was uploaded a few minutes after v1, and only added a few
maintainers of drivers/platform/chrome to the email chain. I was asked
to merge commits after uploading the last version (v2). In hindsight,
I could have waited for a review on v1, or added new email recipients
in a reply to v1.

I am working on some comments from an internal review for commit 3/3,
after which I will upload v3.

Thanks,
Pavan
diff mbox series

Patch

diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 32daf5f58650..167951538030 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -10,22 +10,13 @@ 
 #include <linux/usb/typec.h>
 #include <linux/usb/pd.h>
 #include <linux/usb/role.h>
+#include <linux/usb/ucsi.h>
 #include <asm/unaligned.h>
 
 /* -------------------------------------------------------------------------- */
 
-struct ucsi;
-struct ucsi_altmode;
 struct dentry;
 
-/* UCSI offsets (Bytes) */
-#define UCSI_VERSION			0
-#define UCSI_CCI			4
-#define UCSI_CONTROL			8
-#define UCSI_MESSAGE_IN			16
-#define UCSI_MESSAGE_OUT		32
-#define UCSIv2_MESSAGE_OUT		272
-
 /* UCSI versions */
 #define UCSI_VERSION_1_2	0x0120
 #define UCSI_VERSION_2_0	0x0200
@@ -42,48 +33,6 @@  struct dentry;
  */
 #define UCSI_SPEC_REVISION_TO_BCD(_v_)  (((_v_) + 1) << 8)
 
-/* Command Status and Connector Change Indication (CCI) bits */
-#define UCSI_CCI_CONNECTOR(_c_)		(((_c_) & GENMASK(7, 1)) >> 1)
-#define UCSI_CCI_LENGTH(_c_)		(((_c_) & GENMASK(15, 8)) >> 8)
-#define UCSI_CCI_NOT_SUPPORTED		BIT(25)
-#define UCSI_CCI_CANCEL_COMPLETE	BIT(26)
-#define UCSI_CCI_RESET_COMPLETE		BIT(27)
-#define UCSI_CCI_BUSY			BIT(28)
-#define UCSI_CCI_ACK_COMPLETE		BIT(29)
-#define UCSI_CCI_ERROR			BIT(30)
-#define UCSI_CCI_COMMAND_COMPLETE	BIT(31)
-
-/**
- * struct ucsi_operations - UCSI I/O operations
- * @read: Read operation
- * @sync_write: Blocking write operation
- * @async_write: Non-blocking write operation
- * @update_altmodes: Squashes duplicate DP altmodes
- *
- * Read and write routines for UCSI interface. @sync_write must wait for the
- * Command Completion Event from the PPM before returning, and @async_write must
- * return immediately after sending the data to the PPM.
- */
-struct ucsi_operations {
-	int (*read)(struct ucsi *ucsi, unsigned int offset,
-		    void *val, size_t val_len);
-	int (*sync_write)(struct ucsi *ucsi, unsigned int offset,
-			  const void *val, size_t val_len);
-	int (*async_write)(struct ucsi *ucsi, unsigned int offset,
-			   const void *val, size_t val_len);
-	bool (*update_altmodes)(struct ucsi *ucsi, struct ucsi_altmode *orig,
-				struct ucsi_altmode *updated);
-};
-
-struct ucsi *ucsi_create(struct device *dev, const struct ucsi_operations *ops);
-void ucsi_destroy(struct ucsi *ucsi);
-int ucsi_register(struct ucsi *ucsi);
-void ucsi_unregister(struct ucsi *ucsi);
-void *ucsi_get_drvdata(struct ucsi *ucsi);
-void ucsi_set_drvdata(struct ucsi *ucsi, void *data);
-
-void ucsi_connector_change(struct ucsi *ucsi, u8 num);
-
 /* -------------------------------------------------------------------------- */
 
 /* Commands */
@@ -465,7 +414,6 @@  int ucsi_send_command(struct ucsi *ucsi, u64 command,
 		      void *retval, size_t size);
 
 void ucsi_altmode_update_active(struct ucsi_connector *con);
-int ucsi_resume(struct ucsi *ucsi);
 
 #if IS_ENABLED(CONFIG_POWER_SUPPLY)
 int ucsi_register_port_psy(struct ucsi_connector *con);