Skip to content
Open
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
10 changes: 10 additions & 0 deletions Documentation/devicetree/bindings/usb/apple,sn201202x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ properties:
without end, as on the J613, so the port keeps the data role it
negotiated and refuses a swap.

apple,no-hpd-synthesis:
type: boolean
description:
Pass the display side only the HPD changes the controller reports for
the port's DisplayPort route. No IRQ_HPD is made up for an HPD pulse
the controller coalesced, and the display connector is not probed
again when a USB4 route starts on the shared fabric. The T8140 and
T8142 machines' ports, whose external display pipes are driven this
way, have it.

connector:
$ref: /schemas/connector/usb-connector.yaml#

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 @@ -1936,6 +1936,7 @@
hpm1: usb-pd@a {
compatible = "apple,sn201202x";
reg = <0xa SPMI_USID>;
apple,no-hpd-synthesis;
apple,sleep-ssps;
interrupts = <37 IRQ_TYPE_EDGE_RISING>,
<39 IRQ_TYPE_EDGE_RISING>,
Expand All @@ -1962,6 +1963,7 @@
compatible = "apple,sn201202x";
reg = <0xc SPMI_USID>;
apple,debug-lock-key = "007J";
apple,no-hpd-synthesis;
apple,sleep-ssps;
interrupts = <11 IRQ_TYPE_EDGE_RISING>,
<13 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,no-hpd-synthesis;

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,no-hpd-synthesis;

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,no-hpd-synthesis;

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,no-hpd-synthesis;

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,no-hpd-synthesis;

typec1: connector {
compatible = "usb-c-connector";
Expand Down
18 changes: 10 additions & 8 deletions drivers/usb/typec/tipd/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,10 @@ static int cd321x_typec_update_mode(struct tps6598x *tps,
* disconnects and retrains the link anew, matching an
* uncoalesced HPD drop. A port with a displayport reference
* reports the pulse out of band instead, as a disconnect and
* a connect (see cd321x_update_work()).
* a connect (see cd321x_update_work()). A port whose DT gives
* apple,no-hpd-synthesis reports none.
*/
hpd_pulse = !tps->h17_display &&
hpd_pulse = !tps->no_hpd_synthesis &&
!(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode) &&
cd321x->state_valid &&
cd321x->state.alt == cd321x->port_altmode_dp &&
Expand Down Expand Up @@ -1489,11 +1490,13 @@ static void cd321x_update_work(struct work_struct *work)
goto retry;
tipd_boot_host_started(tps, new_role);

/* A new USB4 route can disturb another port on the shared fabric. */
/*
* A new USB4 route can disturb another port on the shared fabric: have
* the display side probe this one again, unless its DT says the display
* side takes only the controller's own HPD reports.
*/
if (IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode &&
!of_machine_is_compatible("apple,t8140") &&
!of_machine_is_compatible("apple,t8142") &&
usb4_started && !cd321x->display_route_active)
!tps->no_hpd_synthesis && usb4_started && !cd321x->display_route_active)
drm_connector_oob_hotplug_event(cd321x->connector_fwnode,
connector_status_unknown);

Expand Down Expand Up @@ -4335,8 +4338,7 @@ int tipd_init(struct tps6598x *tps)
return -EPROBE_DEFER;

dev_dbg(tps->dev, "Type-C probe start\n");
tps->h17_display = of_machine_is_compatible("apple,t8140") ||
of_machine_is_compatible("apple,t8142");
tps->no_hpd_synthesis = device_property_read_bool(tps->dev, "apple,no-hpd-synthesis");
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
7 changes: 5 additions & 2 deletions drivers/usb/typec/tipd/tps6598x.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,11 @@ struct tipd_data {
};

struct tps6598x {
/* Native H17 routes retain ENOSPC admission and their own HPD path. */
u8 h17_display:1;
/*
* apple,no-hpd-synthesis: the display side gets only the HPD changes the
* controller reports (the T8140 and T8142 ports).
*/
u8 no_hpd_synthesis:1;
/* On the list tipd_port_replug() looks a port up on, by its role switch; its replug. */
struct list_head port_node;
struct work_struct replug_work;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def function(file, name):
bool dp_sid_event,dp_sid_hpd_low,dp_sid_irq;
struct { u32 status_rx,configure,mode_data; } dp_sid_status; };
struct tps6598x { void *partner, *dev, *port, *psy; int lock; u32 data_status; enum usb_role *role_sw;
void *partner_altmode_dp; };
void *partner_altmode_dp; bool no_hpd_synthesis; };
struct cd321x { struct tps6598x tps; struct cd321x_status update_status;
struct cd321x_pm_state pm; struct delayed_work update_work, resume_work;
struct typec_mux_state state; bool state_valid, display_route_active, cur_partner_is_pd;
Expand Down Expand Up @@ -289,6 +289,8 @@ def function(file, name):
static void init(void)
{
memset(&display,0,sizeof(display)); memset(&sink,0,sizeof(sink)); memset(&port,0,sizeof(port));
/* The J700 ports' DT, as in t8140-j700.dts */
port.tps.no_hpd_synthesis = true;
sink.connected = true; display.connector = &sink; display.external_prepared = true;
raw_error = raw_links = 0;
display.external_running = display.external_power_attempted = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def probe(root):
unit = quiesce.make_unit(root)
unit = unit.replace(block(unit, 'int main('), block(unit, 'int main(').replace('int main(', 'int __attribute__((unused)) prior_main(', 1), 1)
unit = unit.replace('struct tipd_data {', 'struct fwnode_handle;\nstruct tipd_data { unsigned irq_mask1; int (*init)(struct tps6598x *); int (*switch_power_state)(struct tps6598x *, int); int (*register_port)(struct tps6598x *, struct fwnode_handle *); bool (*read_data_status)(struct tps6598x *); bool (*read_power_status)(struct tps6598x *); int (*connect)(struct tps6598x *,u32); void (*ready)(struct tps6598x *); void *irq_handler;')
unit = unit.replace('struct tps6598x {', 'struct tps6598x { bool dbma_at_probe,wakeup,h17_display; u32 status; bool (*sleep_event)(struct tps6598x *);')
unit = unit.replace('struct tps6598x {', 'struct tps6598x { bool dbma_at_probe,wakeup,no_hpd_synthesis; u32 status; bool (*sleep_event)(struct tps6598x *);')
helpers = r"""
#undef dev_err
#define dev_err(...) ((void)0)
Expand Down
Loading