Add bool value that stores the CC change information received in
the interrupt of TCPC alert line. In sink role when in disconnected
state, polling the CC lines causes the chip to be awaken from sleep
mode increasing the power usage. When partner is connected, or any
other CC lines change happens, the chip informs about it with alert.
It can be cached and used instead of asking the chip directly.
Signed-off-by: Michał Barnaś <barnas@google.com>
Add support for VBUS measuring part of the TCPCI compliant device.
This device should be used as a child-node for the more specific
TCPC driver and referenced by the vbus property in the usb-c
connector node.
Signed-off-by: Michał Barnaś <barnas@google.com>
Add generic functions that will be common to all TCPCI compliant
drivers like registers reading, writing and updating.
Signed-off-by: Michał Barnaś <barnas@google.com>
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.
Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
1. Support USB-C drivers TCPC, PPC, and VBUS with UTCPD H/W IP
2. UTCPD is interconnected with Timer-triggered EADC for updating
VBUS/VCONN voltage periodically
Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
Add driver for NXP nx20p3483 power path controller that can be used
to control and protect sink and source path of USB-C connector.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Add support for ppc shell command with subcommands that can print
the status of PPC (dead battery, sinking, sourcing, vbus detected),
dump registers and request the PPC to exit dead battery mode.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commit adds an API to the Power Path Controllers (PPC) that
may be used with USB-C subsystem to control the current paths,
enabling and disabling sourcing and sinking VBUS and protect against
shorts, overvoltage and overcurrent.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
As noted in PR#63165 checking of result should use comparison to
success value instead of checking if result is negative. It will
allow to check if function returned invalid but positive value.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
These two functions are used together so there is no need for
splitting them into two functions. This commit also makes this
function required to be implemented by the TCPC driver.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
TCPC API functions should be able to inform the caller if the function
is supported and successfully executed. Bool values doesn't allow this
so it is needed to change the type to int.
For is_rx_pending_msg function the return code should conform to
existing error codes, so in case of function being not supported,
the -ENOSYS should be returned. In case of successful execution,
if there is no pending message, the -ENODATA should be returned and
in case of message pending, the value of 0.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Add "chip" subcommand that displays the vendor, product and device
identifiers for all TCPC referenced by USB-C connectors.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
There was a new Kconfig for USB-C init priority that is conflicting
with currently used Kconfig for init of VBUS and TCPC.
This commit changes the names to more specific related to the subsystem
they belong to.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
The Dead Battery resistors interfere with port partner
detection. So, Dead Battery is disabled after the system
starts and sets the Rd or Rp resistors on the CC lines.
Tested on b_g474e_dpow1 with JP5 set to USBC.
Tested on stm32g081b_eval with JP17 set to D5V.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
This change enables the ISR Hard Reset sent bits, so that
an interrupt is generated when a Hard Reset is sent or
the Hard Reset failed.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
The Hard Reset sent signal was tested twice in the same
"if else" structure but only handled in the last test. This
change removes the first detection so that Hard Reset can
be correctly detected.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
When operating as a Source, the driver will wait indefinitely for
a GoodCRC message from a Sink. This PR adds a timer to trigger a
no response when a GoodCRC message isn't received.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
Since all UCPD devices share the same ISR, the interrupt
should be enabled after all UCPD devices are initialized.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
At system startup, the SYSCFG ITLINE registers might not
indicate an interrupt even though a UCPD interrupt is pending.
This cause the ISR to be called repeatedly without being serviced,
resulting in a system lockup. Reading the UCPD Status Reg instead
of the SYSCFG ITLINE register fixes the issue.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
Update TCPC driver to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
The "@return" command should be used for the arbitrary return
description, and "@retval <return value>" for the description
of named return value
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
Use DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) to determine
number of potential interrupt sources. This mitigates
the wasting of memory on devices with mutliple UCPD ports
but only one UCPD port is used.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>
Assign the pins for the STM32G071b and STM32G081b STM32
UCPD peripherals so the UCPD driver can properly
configure the device.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>