[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220830175523.GA239841@roeck-us.net>
Date: Tue, 30 Aug 2022 10:55:23 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Badhri Jagan Sridharan <badhri@...gle.com>
Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Kyle Tso <kyletso@...gle.com>
Subject: Re: [PATCH v1 4/4] usb: typec: maxim_contaminant: Implement
check_contaminant callback
On Fri, Aug 26, 2022 at 01:40:01AM -0700, Badhri Jagan Sridharan wrote:
> Maxim TCPC has additional ADCs and low current(1ua) current source
> to measure the impedance of CC and SBU pins. When tcpm invokes
> the check_contaminant callback, Maxim TCPC measures the impedance
> of the CC & SBU pins and when the impedance measured is less than
> 1MOhm, it is assumed that USB-C port is contaminated. CC comparators
> are also checked to differentiate between presence of sink and
> contaminant. Once USB-C is deemed to be contaminated, MAXIM TCPC
> has additional hardware to disable normal DRP toggling cycle and
> enable 1ua on CC pins once every 2.4secs/4.8secs. Maxim TCPC
> interrupts AP once the impedance on the CC pin is above the
> 1MOhm threshold. The Maxim tcpc driver then signals TCPM_PORT_CLEAN
> to restart toggling.
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@...gle.com>
> ---
> drivers/usb/typec/tcpm/Makefile | 2 +-
> drivers/usb/typec/tcpm/maxim_contaminant.c | 338 +++++++++++++++++++++
> drivers/usb/typec/tcpm/tcpci_maxim.c | 34 ++-
> drivers/usb/typec/tcpm/tcpci_maxim.h | 68 +++++
> 4 files changed, 429 insertions(+), 13 deletions(-)
> create mode 100644 drivers/usb/typec/tcpm/maxim_contaminant.c
> create mode 100644 drivers/usb/typec/tcpm/tcpci_maxim.h
>
> diff --git a/drivers/usb/typec/tcpm/Makefile b/drivers/usb/typec/tcpm/Makefile
> index 906d9dced8e7..81e4e9421fa0 100644
> --- a/drivers/usb/typec/tcpm/Makefile
> +++ b/drivers/usb/typec/tcpm/Makefile
> @@ -7,4 +7,4 @@ obj-$(CONFIG_TYPEC_TCPCI) += tcpci.o
> obj-$(CONFIG_TYPEC_RT1711H) += tcpci_rt1711h.o
> obj-$(CONFIG_TYPEC_MT6360) += tcpci_mt6360.o
> obj-$(CONFIG_TYPEC_TCPCI_MT6370) += tcpci_mt6370.o
> -obj-$(CONFIG_TYPEC_TCPCI_MAXIM) += tcpci_maxim.o
> +obj-$(CONFIG_TYPEC_TCPCI_MAXIM) += tcpci_maxim.o maxim_contaminant.o
This creates two separate modules, which doesn't really add any value.
I would suggest to adjust the file names and create a single module
named tcpci_maxim instead. Renaming tcpci_maxim.c to, say,
tcpci_maxim_core.c and
obj-$(CONFIG_TYPEC_TCPCI_MAXIM) += tcpci_maxim.o
tcpci_maxim-y := tcpci_maxim_core.o maxim_contaminant.o
should do. This would also avoid the need for exporting symbols
from tcpci_maxim.c.
Thanks,
Guenter
Powered by blists - more mailing lists