diff mbox series

[v8,1/3] usb: typec: tcpci: move tcpci.h to include/linux/usb/ directory

Message ID 20220308073431.1217890-1-xji@analogixsemi.com
State Superseded
Headers show
Series [v8,1/3] usb: typec: tcpci: move tcpci.h to include/linux/usb/ directory | expand

Commit Message

Xin Ji March 8, 2022, 7:34 a.m. UTC
As for convenience use TCPCI register definition, move tcpci.h to
include/linux/usb/ directory.

Signed-off-by: Xin Ji <xji@analogixsemi.com>

---
V7 -> V8: Fix Guanter's comment, remove unnecessary explain.
---
 drivers/usb/typec/tcpm/tcpci.c                        | 3 +--
 drivers/usb/typec/tcpm/tcpci_maxim.c                  | 3 +--
 drivers/usb/typec/tcpm/tcpci_mt6360.c                 | 3 +--
 drivers/usb/typec/tcpm/tcpci_rt1711h.c                | 2 +-
 {drivers/usb/typec/tcpm => include/linux/usb}/tcpci.h | 1 +
 5 files changed, 5 insertions(+), 7 deletions(-)
 rename {drivers/usb/typec/tcpm => include/linux/usb}/tcpci.h (99%)

Comments

Heikki Krogerus March 8, 2022, 10:10 a.m. UTC | #1
On Tue, Mar 08, 2022 at 03:34:28PM +0800, Xin Ji wrote:
> As for convenience use TCPCI register definition, move tcpci.h to
> include/linux/usb/ directory.

To be honest, I was still hoping for a better explanation here.

The reason why this header is made global is because some USB PD
controllers - PD controllers consisting of a microcontroller
(acting as the TCPM) and a port controller (TCPC) - may require that
the driver for the PD controller accesses directly also the on-chip
port controller in some cases.

I was hoping that that was explained in the commit message somehow.

> Signed-off-by: Xin Ji <xji@analogixsemi.com>
> 
> ---
> V7 -> V8: Fix Guanter's comment, remove unnecessary explain.
> ---
>  drivers/usb/typec/tcpm/tcpci.c                        | 3 +--
>  drivers/usb/typec/tcpm/tcpci_maxim.c                  | 3 +--
>  drivers/usb/typec/tcpm/tcpci_mt6360.c                 | 3 +--
>  drivers/usb/typec/tcpm/tcpci_rt1711h.c                | 2 +-
>  {drivers/usb/typec/tcpm => include/linux/usb}/tcpci.h | 1 +
>  5 files changed, 5 insertions(+), 7 deletions(-)
>  rename {drivers/usb/typec/tcpm => include/linux/usb}/tcpci.h (99%)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index e07d26a3cd8e..9c907296596f 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -13,11 +13,10 @@
>  #include <linux/property.h>
>  #include <linux/regmap.h>
>  #include <linux/usb/pd.h>
> +#include <linux/usb/tcpci.h>
>  #include <linux/usb/tcpm.h>
>  #include <linux/usb/typec.h>
>  
> -#include "tcpci.h"
> -
>  #define	PD_RETRY_COUNT_DEFAULT			3
>  #define	PD_RETRY_COUNT_3_0_OR_HIGHER		2
>  #define	AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV	3500
> diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c b/drivers/usb/typec/tcpm/tcpci_maxim.c
> index df2505570f07..4b6705f3d7b7 100644
> --- a/drivers/usb/typec/tcpm/tcpci_maxim.c
> +++ b/drivers/usb/typec/tcpm/tcpci_maxim.c
> @@ -11,11 +11,10 @@
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  #include <linux/usb/pd.h>
> +#include <linux/usb/tcpci.h>
>  #include <linux/usb/tcpm.h>
>  #include <linux/usb/typec.h>
>  
> -#include "tcpci.h"
> -
>  #define PD_ACTIVITY_TIMEOUT_MS				10000
>  
>  #define TCPC_VENDOR_ALERT				0x80
> diff --git a/drivers/usb/typec/tcpm/tcpci_mt6360.c b/drivers/usb/typec/tcpm/tcpci_mt6360.c
> index f1bd9e09bc87..9e0338bce7ef 100644
> --- a/drivers/usb/typec/tcpm/tcpci_mt6360.c
> +++ b/drivers/usb/typec/tcpm/tcpci_mt6360.c
> @@ -11,10 +11,9 @@
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
> +#include <linux/usb/tcpci.h>
>  #include <linux/usb/tcpm.h>
>  
> -#include "tcpci.h"
> -
>  #define MT6360_REG_VCONNCTRL1	0x8C
>  #define MT6360_REG_MODECTRL2	0x8F
>  #define MT6360_REG_SWRESET	0xA0
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index b56a0880a044..3291ca4948da 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -10,9 +10,9 @@
>  #include <linux/i2c.h>
>  #include <linux/interrupt.h>
>  #include <linux/gpio/consumer.h>
> +#include <linux/usb/tcpci.h>
>  #include <linux/usb/tcpm.h>
>  #include <linux/regmap.h>
> -#include "tcpci.h"
>  
>  #define RT1711H_VID		0x29CF
>  #define RT1711H_PID		0x1711
> diff --git a/drivers/usb/typec/tcpm/tcpci.h b/include/linux/usb/tcpci.h
> similarity index 99%
> rename from drivers/usb/typec/tcpm/tcpci.h
> rename to include/linux/usb/tcpci.h
> index b2edd45f13c6..20c0bedb8ec8 100644
> --- a/drivers/usb/typec/tcpm/tcpci.h
> +++ b/include/linux/usb/tcpci.h
> @@ -9,6 +9,7 @@
>  #define __LINUX_USB_TCPCI_H
>  
>  #include <linux/usb/typec.h>
> +#include <linux/usb/tcpm.h>
>  
>  #define TCPC_VENDOR_ID			0x0
>  #define TCPC_PRODUCT_ID			0x2
> -- 
> 2.25.1
Xin Ji March 9, 2022, 2:09 a.m. UTC | #2
On Tue, Mar 08, 2022 at 06:41:27AM -0800, Guenter Roeck wrote:
> On 3/8/22 02:10, Heikki Krogerus wrote:
> > On Tue, Mar 08, 2022 at 03:34:28PM +0800, Xin Ji wrote:
> > > As for convenience use TCPCI register definition, move tcpci.h to
> > > include/linux/usb/ directory.
> > 
> > To be honest, I was still hoping for a better explanation here.
> > 
> > The reason why this header is made global is because some USB PD
> > controllers - PD controllers consisting of a microcontroller
> > (acting as the TCPM) and a port controller (TCPC) - may require that
> > the driver for the PD controller accesses directly also the on-chip
> > port controller in some cases.
> > 
> > I was hoping that that was explained in the commit message somehow.
> > 
> 
> Same here.
> 
> Guenter

Hi heikki, Guenter, OK, I'll add it in the commit message.

Thanks,
Xin

> 
> > > Signed-off-by: Xin Ji <xji@analogixsemi.com>
> > > 
> > > ---
> > > V7 -> V8: Fix Guanter's comment, remove unnecessary explain.
> > > ---
> > >   drivers/usb/typec/tcpm/tcpci.c                        | 3 +--
> > >   drivers/usb/typec/tcpm/tcpci_maxim.c                  | 3 +--
> > >   drivers/usb/typec/tcpm/tcpci_mt6360.c                 | 3 +--
> > >   drivers/usb/typec/tcpm/tcpci_rt1711h.c                | 2 +-
> > >   {drivers/usb/typec/tcpm => include/linux/usb}/tcpci.h | 1 +
> > >   5 files changed, 5 insertions(+), 7 deletions(-)
> > >   rename {drivers/usb/typec/tcpm => include/linux/usb}/tcpci.h (99%)
> > > 
> > > diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> > > index e07d26a3cd8e..9c907296596f 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci.c
> > > +++ b/drivers/usb/typec/tcpm/tcpci.c
> > > @@ -13,11 +13,10 @@
> > >   #include <linux/property.h>
> > >   #include <linux/regmap.h>
> > >   #include <linux/usb/pd.h>
> > > +#include <linux/usb/tcpci.h>
> > >   #include <linux/usb/tcpm.h>
> > >   #include <linux/usb/typec.h>
> > > -#include "tcpci.h"
> > > -
> > >   #define	PD_RETRY_COUNT_DEFAULT			3
> > >   #define	PD_RETRY_COUNT_3_0_OR_HIGHER		2
> > >   #define	AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV	3500
> > > diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c b/drivers/usb/typec/tcpm/tcpci_maxim.c
> > > index df2505570f07..4b6705f3d7b7 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci_maxim.c
> > > +++ b/drivers/usb/typec/tcpm/tcpci_maxim.c
> > > @@ -11,11 +11,10 @@
> > >   #include <linux/module.h>
> > >   #include <linux/regmap.h>
> > >   #include <linux/usb/pd.h>
> > > +#include <linux/usb/tcpci.h>
> > >   #include <linux/usb/tcpm.h>
> > >   #include <linux/usb/typec.h>
> > > -#include "tcpci.h"
> > > -
> > >   #define PD_ACTIVITY_TIMEOUT_MS				10000
> > >   #define TCPC_VENDOR_ALERT				0x80
> > > diff --git a/drivers/usb/typec/tcpm/tcpci_mt6360.c b/drivers/usb/typec/tcpm/tcpci_mt6360.c
> > > index f1bd9e09bc87..9e0338bce7ef 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci_mt6360.c
> > > +++ b/drivers/usb/typec/tcpm/tcpci_mt6360.c
> > > @@ -11,10 +11,9 @@
> > >   #include <linux/of.h>
> > >   #include <linux/platform_device.h>
> > >   #include <linux/regmap.h>
> > > +#include <linux/usb/tcpci.h>
> > >   #include <linux/usb/tcpm.h>
> > > -#include "tcpci.h"
> > > -
> > >   #define MT6360_REG_VCONNCTRL1	0x8C
> > >   #define MT6360_REG_MODECTRL2	0x8F
> > >   #define MT6360_REG_SWRESET	0xA0
> > > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > index b56a0880a044..3291ca4948da 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > @@ -10,9 +10,9 @@
> > >   #include <linux/i2c.h>
> > >   #include <linux/interrupt.h>
> > >   #include <linux/gpio/consumer.h>
> > > +#include <linux/usb/tcpci.h>
> > >   #include <linux/usb/tcpm.h>
> > >   #include <linux/regmap.h>
> > > -#include "tcpci.h"
> > >   #define RT1711H_VID		0x29CF
> > >   #define RT1711H_PID		0x1711
> > > diff --git a/drivers/usb/typec/tcpm/tcpci.h b/include/linux/usb/tcpci.h
> > > similarity index 99%
> > > rename from drivers/usb/typec/tcpm/tcpci.h
> > > rename to include/linux/usb/tcpci.h
> > > index b2edd45f13c6..20c0bedb8ec8 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci.h
> > > +++ b/include/linux/usb/tcpci.h
> > > @@ -9,6 +9,7 @@
> > >   #define __LINUX_USB_TCPCI_H
> > >   #include <linux/usb/typec.h>
> > > +#include <linux/usb/tcpm.h>
> > >   #define TCPC_VENDOR_ID			0x0
> > >   #define TCPC_PRODUCT_ID			0x2
> > > -- 
> > > 2.25.1
> >
diff mbox series

Patch

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index e07d26a3cd8e..9c907296596f 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -13,11 +13,10 @@ 
 #include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/usb/pd.h>
+#include <linux/usb/tcpci.h>
 #include <linux/usb/tcpm.h>
 #include <linux/usb/typec.h>
 
-#include "tcpci.h"
-
 #define	PD_RETRY_COUNT_DEFAULT			3
 #define	PD_RETRY_COUNT_3_0_OR_HIGHER		2
 #define	AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV	3500
diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c b/drivers/usb/typec/tcpm/tcpci_maxim.c
index df2505570f07..4b6705f3d7b7 100644
--- a/drivers/usb/typec/tcpm/tcpci_maxim.c
+++ b/drivers/usb/typec/tcpm/tcpci_maxim.c
@@ -11,11 +11,10 @@ 
 #include <linux/module.h>
 #include <linux/regmap.h>
 #include <linux/usb/pd.h>
+#include <linux/usb/tcpci.h>
 #include <linux/usb/tcpm.h>
 #include <linux/usb/typec.h>
 
-#include "tcpci.h"
-
 #define PD_ACTIVITY_TIMEOUT_MS				10000
 
 #define TCPC_VENDOR_ALERT				0x80
diff --git a/drivers/usb/typec/tcpm/tcpci_mt6360.c b/drivers/usb/typec/tcpm/tcpci_mt6360.c
index f1bd9e09bc87..9e0338bce7ef 100644
--- a/drivers/usb/typec/tcpm/tcpci_mt6360.c
+++ b/drivers/usb/typec/tcpm/tcpci_mt6360.c
@@ -11,10 +11,9 @@ 
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
+#include <linux/usb/tcpci.h>
 #include <linux/usb/tcpm.h>
 
-#include "tcpci.h"
-
 #define MT6360_REG_VCONNCTRL1	0x8C
 #define MT6360_REG_MODECTRL2	0x8F
 #define MT6360_REG_SWRESET	0xA0
diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
index b56a0880a044..3291ca4948da 100644
--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
+++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
@@ -10,9 +10,9 @@ 
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/gpio/consumer.h>
+#include <linux/usb/tcpci.h>
 #include <linux/usb/tcpm.h>
 #include <linux/regmap.h>
-#include "tcpci.h"
 
 #define RT1711H_VID		0x29CF
 #define RT1711H_PID		0x1711
diff --git a/drivers/usb/typec/tcpm/tcpci.h b/include/linux/usb/tcpci.h
similarity index 99%
rename from drivers/usb/typec/tcpm/tcpci.h
rename to include/linux/usb/tcpci.h
index b2edd45f13c6..20c0bedb8ec8 100644
--- a/drivers/usb/typec/tcpm/tcpci.h
+++ b/include/linux/usb/tcpci.h
@@ -9,6 +9,7 @@ 
 #define __LINUX_USB_TCPCI_H
 
 #include <linux/usb/typec.h>
+#include <linux/usb/tcpm.h>
 
 #define TCPC_VENDOR_ID			0x0
 #define TCPC_PRODUCT_ID			0x2