Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Documentation/devicetree/bindings/usb/apple,sn201202x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ properties:
Tell the controller the system's power state (SSPS) around a
firmware-driven suspend, S3 before it and S0 after.

apple,display-native-hpd:
type: boolean
description: |
The display route behind this controller's port has its own HPD path,
as the display coprocessor routes of the T8140 and T8142 do. The driver
passes on the HPD level of the port's data status only: it does not
follow the partner's DP status updates, synthesize IRQ_HPD pulses, or
send the display connector a recheck when a USB4 route starts.

apple,debug-lock-key:
$ref: /schemas/types.yaml#/definitions/string
description:
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/apple/t8140-j700.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,7 @@
hpm1: usb-pd@a {
compatible = "apple,sn201202x";
reg = <0xa SPMI_USID>;
apple,display-native-hpd;
apple,sleep-ssps;
interrupts = <37 IRQ_TYPE_EDGE_RISING>,
<39 IRQ_TYPE_EDGE_RISING>,
Expand All @@ -1958,6 +1959,7 @@
hpm0: usb-pd@c {
compatible = "apple,sn201202x";
reg = <0xc SPMI_USID>;
apple,display-native-hpd;
apple,debug-lock-key = "007J";
apple,sleep-ssps;
interrupts = <11 IRQ_TYPE_EDGE_RISING>,
Expand Down
3 changes: 3 additions & 0 deletions arch/arm64/boot/dts/apple/t8142-j704-usb.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
hpm0: usb-pd@c {
compatible = "apple,sn201202x";
reg = <0xc SPMI_USID>;
apple,display-native-hpd;

typec0: connector {
compatible = "usb-c-connector";
Expand Down Expand Up @@ -208,6 +209,7 @@
hpm1: usb-pd@a {
compatible = "apple,sn201202x";
reg = <0xa SPMI_USID>;
apple,display-native-hpd;

typec1: connector {
compatible = "usb-c-connector";
Expand Down Expand Up @@ -360,6 +362,7 @@
hpm3: usb-pd@c {
compatible = "apple,sn201202x";
reg = <0xc SPMI_USID>;
apple,display-native-hpd;

typec3: connector {
compatible = "usb-c-connector";
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/apple/t8142-j813-usb.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
hpm0: usb-pd@c {
compatible = "apple,sn201202x";
reg = <0xc SPMI_USID>;
apple,display-native-hpd;

typec0: connector {
compatible = "usb-c-connector";
Expand Down Expand Up @@ -210,6 +211,7 @@
hpm1: usb-pd@a {
compatible = "apple,sn201202x";
reg = <0xa SPMI_USID>;
apple,display-native-hpd;

typec1: connector {
compatible = "usb-c-connector";
Expand Down
19 changes: 10 additions & 9 deletions drivers/usb/typec/tipd/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,13 @@ EXPORT_SYMBOL_IF_KUNIT(cd321x_mux_gave_up);
* converter can keep DATA_STATUS at HPD high while the display behind it is
* unplugged, and report that only in its DP status. Once the controller has
* signalled a DP status for this connection, that status must show HPD too.
* A display route with its own HPD path (apple,display-native-hpd) takes the
* DATA_STATUS level only.
*/
static bool cd321x_uses_dp_sid(const struct tps6598x *tps)
{
return device_is_compatible(tps->dev, "apple,sn201202x") &&
!of_machine_is_compatible("apple,t8140") &&
!of_machine_is_compatible("apple,t8142");
!tps->display_native_hpd;
}

static u64 cd321x_irq_mask(const struct tps6598x *tps)
Expand Down Expand Up @@ -924,7 +925,7 @@ static int cd321x_typec_update_mode(struct tps6598x *tps,
* reference reports the pulse out of band instead, as a
* disconnect and a connect (see cd321x_update_work()).
*/
hpd_pulse = !tps->h17_display &&
hpd_pulse = !tps->display_native_hpd &&
!(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode) &&
(st->data_status_changed & CD321X_DATA_STATUS_HPD_LEVEL) &&
(dp_data.status & DP_STATUS_HPD_STATE) &&
Expand Down Expand Up @@ -1414,10 +1415,12 @@ static void cd321x_update_work(struct work_struct *work)
if (ret)
goto retry;

/* A new USB4 route can disturb another port on the shared fabric. */
/*
* A new USB4 route can disturb another port on the shared fabric. A display
* route with its own HPD path is not sent the hint.
*/
if (IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode &&
!of_machine_is_compatible("apple,t8140") &&
!of_machine_is_compatible("apple,t8142") &&
!tps->display_native_hpd &&
usb4_started && !cd321x->display_route_active)
drm_connector_oob_hotplug_event(cd321x->connector_fwnode,
connector_status_unknown);
Expand Down Expand Up @@ -3489,6 +3492,7 @@ int tipd_init(struct tps6598x *tps)
return -EPROBE_DEFER;

dev_dbg(tps->dev, "Type-C probe start\n");
tps->display_native_hpd = device_property_read_bool(tps->dev, "apple,display-native-hpd");
tps->reset = devm_gpiod_get_optional(tps->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(tps->reset))
return dev_err_probe(tps->dev, PTR_ERR(tps->reset),
Expand Down Expand Up @@ -3807,9 +3811,6 @@ int tipd_resume(struct tps6598x *tps)
{
int ret;

tps->h17_display = of_machine_is_compatible("apple,t8140") ||
of_machine_is_compatible("apple,t8142");

ret = tps6598x_check_mode(tps);
if (ret < 0)
return ret;
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/typec/tipd/tps6598x.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ struct tipd_data {
};

struct tps6598x {
/* Native H17 routes retain ENOSPC admission and their own HPD path. */
u8 h17_display:1;
/*
* apple,display-native-hpd: the port's display route has its own HPD path
* (the T8140 and T8142 display routes).
*/
u8 display_native_hpd:1;
struct device *dev;
struct regmap *regmap;
struct mutex lock; /* device lock */
Expand Down
Loading