drivers/platform/chrome/cros_typec_altmode.c
276
int cros_typec_displayport_status_update(struct typec_altmode *altmode,
drivers/platform/chrome/cros_typec_altmode.c
280
typec_altmode_get_drvdata(altmode);
drivers/platform/chrome/cros_typec_altmode.c
284
dev_dbg(&altmode->dev,
drivers/platform/chrome/cros_typec_altmode.c
290
dev_dbg(&altmode->dev,
drivers/platform/chrome/cros_typec_altmode.h
20
int cros_typec_displayport_status_update(struct typec_altmode *altmode,
drivers/platform/chrome/cros_typec_altmode.h
31
static inline int cros_typec_displayport_status_update(struct typec_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
100
struct pmic_glink_altmode *altmode;
drivers/soc/qcom/pmic_glink_altmode.c
143
static int pmic_glink_altmode_request(struct pmic_glink_altmode *altmode, u32 cmd, u32 arg)
drivers/soc/qcom/pmic_glink_altmode.c
153
guard(mutex)(&altmode->lock);
drivers/soc/qcom/pmic_glink_altmode.c
155
req.hdr.owner = cpu_to_le32(altmode->owner_id);
drivers/soc/qcom/pmic_glink_altmode.c
161
ret = pmic_glink_send(altmode->client, &req, sizeof(req));
drivers/soc/qcom/pmic_glink_altmode.c
163
dev_err(altmode->dev, "failed to send altmode request: %#x (%d)\n", cmd, ret);
drivers/soc/qcom/pmic_glink_altmode.c
167
left = wait_for_completion_timeout(&altmode->pan_ack, 5 * HZ);
drivers/soc/qcom/pmic_glink_altmode.c
169
dev_err(altmode->dev, "timeout waiting for altmode request ack for: %#x\n", cmd);
drivers/soc/qcom/pmic_glink_altmode.c
176
static void pmic_glink_altmode_enable_dp(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
197
dev_err(altmode->dev, "failed to switch mux to DP: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
205
dev_err(altmode->dev, "failed to setup retimer to DP: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
208
static void pmic_glink_altmode_enable_tbt(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
228
dev_err(altmode->dev,
drivers/soc/qcom/pmic_glink_altmode.c
255
dev_err(altmode->dev, "failed to switch mux to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
263
dev_err(altmode->dev, "failed to setup retimer to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
266
static void pmic_glink_altmode_enable_usb4(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
293
dev_err(altmode->dev, "failed to switch mux to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
301
dev_err(altmode->dev, "failed to setup retimer to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
304
static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
315
dev_err(altmode->dev, "failed to switch mux to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
323
dev_err(altmode->dev, "failed to setup retimer to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
326
static void pmic_glink_altmode_safe(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
337
dev_err(altmode->dev, "failed to switch mux to safe mode: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
345
dev_err(altmode->dev, "failed to setup retimer to USB: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
351
struct pmic_glink_altmode *altmode = alt_port->altmode;
drivers/soc/qcom/pmic_glink_altmode.c
363
pmic_glink_altmode_safe(altmode, alt_port);
drivers/soc/qcom/pmic_glink_altmode.c
365
pmic_glink_altmode_enable_dp(altmode, alt_port,
drivers/soc/qcom/pmic_glink_altmode.c
379
pmic_glink_altmode_enable_tbt(altmode, alt_port);
drivers/soc/qcom/pmic_glink_altmode.c
381
pmic_glink_altmode_enable_usb4(altmode, alt_port);
drivers/soc/qcom/pmic_glink_altmode.c
383
pmic_glink_altmode_enable_usb(altmode, alt_port);
drivers/soc/qcom/pmic_glink_altmode.c
385
pmic_glink_altmode_safe(altmode, alt_port);
drivers/soc/qcom/pmic_glink_altmode.c
387
dev_err(altmode->dev, "Got unknown mux_ctrl: %u on port %u, forcing safe mode\n",
drivers/soc/qcom/pmic_glink_altmode.c
389
pmic_glink_altmode_safe(altmode, alt_port);
drivers/soc/qcom/pmic_glink_altmode.c
392
pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index);
drivers/soc/qcom/pmic_glink_altmode.c
412
static void pmic_glink_altmode_sc8180xp_notify(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
427
dev_warn(altmode->dev, "invalid length of USBC_NOTIFY indication: %zd\n", len);
drivers/soc/qcom/pmic_glink_altmode.c
442
if (port >= ARRAY_SIZE(altmode->ports) || !altmode->ports[port].altmode) {
drivers/soc/qcom/pmic_glink_altmode.c
443
dev_dbg(altmode->dev, "notification on undefined port %d\n", port);
drivers/soc/qcom/pmic_glink_altmode.c
447
alt_port = &altmode->ports[port];
drivers/soc/qcom/pmic_glink_altmode.c
460
static void pmic_glink_altmode_sc8280xp_notify(struct pmic_glink_altmode *altmode,
drivers/soc/qcom/pmic_glink_altmode.c
471
dev_warn(altmode->dev, "invalid length USBC_NOTIFY_IND: %zd\n",
drivers/soc/qcom/pmic_glink_altmode.c
481
if (port >= ARRAY_SIZE(altmode->ports) || !altmode->ports[port].altmode) {
drivers/soc/qcom/pmic_glink_altmode.c
482
dev_dbg(altmode->dev, "notification on undefined port %d\n", port);
drivers/soc/qcom/pmic_glink_altmode.c
486
alt_port = &altmode->ports[port];
drivers/soc/qcom/pmic_glink_altmode.c
509
struct pmic_glink_altmode *altmode = priv;
drivers/soc/qcom/pmic_glink_altmode.c
519
complete(&altmode->pan_ack);
drivers/soc/qcom/pmic_glink_altmode.c
522
pmic_glink_altmode_sc8280xp_notify(altmode, svid, data, len);
drivers/soc/qcom/pmic_glink_altmode.c
525
pmic_glink_altmode_sc8180xp_notify(altmode, data, len);
drivers/soc/qcom/pmic_glink_altmode.c
547
struct pmic_glink_altmode *altmode = work_to_altmode(work);
drivers/soc/qcom/pmic_glink_altmode.c
550
ret = pmic_glink_altmode_request(altmode, ALTMODE_PAN_EN, 0);
drivers/soc/qcom/pmic_glink_altmode.c
552
dev_err(altmode->dev, "failed to request altmode notifications: %d\n", ret);
drivers/soc/qcom/pmic_glink_altmode.c
557
struct pmic_glink_altmode *altmode = priv;
drivers/soc/qcom/pmic_glink_altmode.c
560
schedule_work(&altmode->enable_work);
drivers/soc/qcom/pmic_glink_altmode.c
572
struct pmic_glink_altmode *altmode;
drivers/soc/qcom/pmic_glink_altmode.c
579
altmode = devm_kzalloc(dev, sizeof(*altmode), GFP_KERNEL);
drivers/soc/qcom/pmic_glink_altmode.c
580
if (!altmode)
drivers/soc/qcom/pmic_glink_altmode.c
583
altmode->dev = dev;
drivers/soc/qcom/pmic_glink_altmode.c
587
altmode->owner_id = (unsigned long)match->data;
drivers/soc/qcom/pmic_glink_altmode.c
589
altmode->owner_id = PMIC_GLINK_OWNER_USBC_PAN;
drivers/soc/qcom/pmic_glink_altmode.c
591
INIT_WORK(&altmode->enable_work, pmic_glink_altmode_enable_worker);
drivers/soc/qcom/pmic_glink_altmode.c
592
init_completion(&altmode->pan_ack);
drivers/soc/qcom/pmic_glink_altmode.c
593
mutex_init(&altmode->lock);
drivers/soc/qcom/pmic_glink_altmode.c
603
if (port >= ARRAY_SIZE(altmode->ports)) {
drivers/soc/qcom/pmic_glink_altmode.c
608
if (altmode->ports[port].altmode) {
drivers/soc/qcom/pmic_glink_altmode.c
614
alt_port = &altmode->ports[port];
drivers/soc/qcom/pmic_glink_altmode.c
615
alt_port->altmode = altmode;
drivers/soc/qcom/pmic_glink_altmode.c
679
for (port = 0; port < ARRAY_SIZE(altmode->ports); port++) {
drivers/soc/qcom/pmic_glink_altmode.c
680
alt_port = &altmode->ports[port];
drivers/soc/qcom/pmic_glink_altmode.c
689
altmode->client = devm_pmic_glink_client_alloc(dev,
drivers/soc/qcom/pmic_glink_altmode.c
690
altmode->owner_id,
drivers/soc/qcom/pmic_glink_altmode.c
693
altmode);
drivers/soc/qcom/pmic_glink_altmode.c
694
if (IS_ERR(altmode->client))
drivers/soc/qcom/pmic_glink_altmode.c
695
return PTR_ERR(altmode->client);
drivers/soc/qcom/pmic_glink_altmode.c
697
pmic_glink_client_register(altmode->client);
drivers/usb/typec/bus.c
103
partner = altmode->partner;
drivers/usb/typec/bus.c
105
ret = typec_altmode_set_switches(is_port ? altmode : partner, conf, data);
drivers/usb/typec/bus.c
128
struct altmode *partner = to_altmode(adev)->partner;
drivers/usb/typec/bus.c
159
struct altmode *partner = to_altmode(adev)->partner;
drivers/usb/typec/bus.c
17
typec_altmode_set_retimer(struct altmode *alt, unsigned long conf, void *data)
drivers/usb/typec/bus.c
188
struct altmode *partner = to_altmode(adev)->partner;
drivers/usb/typec/bus.c
218
struct altmode *altmode;
drivers/usb/typec/bus.c
223
altmode = to_altmode(adev);
drivers/usb/typec/bus.c
225
if (!altmode->partner)
drivers/usb/typec/bus.c
228
pdev = &altmode->partner->adev;
drivers/usb/typec/bus.c
261
struct altmode *partner = to_altmode(adev)->partner;
drivers/usb/typec/bus.c
291
struct altmode *partner = to_altmode(adev)->partner;
drivers/usb/typec/bus.c
32
typec_altmode_set_mux(struct altmode *alt, unsigned long conf, void *data)
drivers/usb/typec/bus.c
324
struct altmode *altmode;
drivers/usb/typec/bus.c
330
altmode = to_altmode(adev);
drivers/usb/typec/bus.c
333
if (!altmode->partner)
drivers/usb/typec/bus.c
335
pdev = &altmode->partner->adev;
drivers/usb/typec/bus.c
337
if (!altmode->plug[sop])
drivers/usb/typec/bus.c
339
pdev = &altmode->plug[sop]->adev;
drivers/usb/typec/bus.c
363
struct altmode *port = to_altmode(adev)->partner;
drivers/usb/typec/bus.c
469
struct typec_altmode *altmode = to_typec_altmode(dev);
drivers/usb/typec/bus.c
476
if (id->svid == altmode->svid)
drivers/usb/typec/bus.c
48
typec_altmode_set_switches(struct altmode *alt, unsigned long conf, void *data)
drivers/usb/typec/bus.c
483
const struct typec_altmode *altmode = to_typec_altmode(dev);
drivers/usb/typec/bus.c
488
if (add_uevent_var(env, "SVID=%04X", altmode->svid))
drivers/usb/typec/bus.c
491
if (add_uevent_var(env, "MODE=%u", altmode->mode))
drivers/usb/typec/bus.c
494
return add_uevent_var(env, "MODALIAS=typec:id%04X", altmode->svid);
drivers/usb/typec/bus.c
497
static int typec_altmode_create_links(struct altmode *alt)
drivers/usb/typec/bus.c
514
static void typec_altmode_remove_links(struct altmode *alt)
drivers/usb/typec/bus.c
524
struct altmode *altmode = to_altmode(adev);
drivers/usb/typec/bus.c
528
if (!altmode->partner)
drivers/usb/typec/bus.c
531
ret = typec_altmode_create_links(altmode);
drivers/usb/typec/bus.c
539
typec_altmode_remove_links(altmode);
drivers/usb/typec/bus.c
548
struct altmode *altmode = to_altmode(adev);
drivers/usb/typec/bus.c
550
typec_altmode_remove_links(altmode);
drivers/usb/typec/bus.c
63
struct altmode *port_altmode;
drivers/usb/typec/bus.c
90
struct altmode *altmode;
drivers/usb/typec/bus.c
91
struct altmode *partner;
drivers/usb/typec/bus.c
97
altmode = to_altmode(adev);
drivers/usb/typec/bus.c
99
if (!altmode->partner)
drivers/usb/typec/bus.h
24
struct altmode *partner;
drivers/usb/typec/bus.h
25
struct altmode *plug[2];
drivers/usb/typec/bus.h
28
#define to_altmode(d) container_of(d, struct altmode, adev)
drivers/usb/typec/class.c
244
static void typec_altmode_set_partner(struct altmode *altmode)
drivers/usb/typec/class.c
246
struct typec_altmode *adev = &altmode->adev;
drivers/usb/typec/class.c
249
struct altmode *partner;
drivers/usb/typec/class.c
258
altmode->partner = partner;
drivers/usb/typec/class.c
264
partner->plug[plug->index] = altmode;
drivers/usb/typec/class.c
266
partner->partner = altmode;
drivers/usb/typec/class.c
270
static void typec_altmode_put_partner(struct altmode *altmode)
drivers/usb/typec/class.c
272
struct altmode *partner = altmode->partner;
drivers/usb/typec/class.c
279
adev = &altmode->adev;
drivers/usb/typec/class.c
372
struct altmode *altmode = to_altmode(adev);
drivers/usb/typec/class.c
387
if (altmode->partner && !enter && altmode->partner->adev.active)
drivers/usb/typec/class.c
388
typec_altmode_exit(&altmode->partner->adev);
drivers/usb/typec/class.c
389
} else if (altmode->partner) {
drivers/usb/typec/class.c
390
if (enter && !altmode->partner->adev.active) {
drivers/usb/typec/class.c
411
struct altmode *alt = to_altmode(to_typec_altmode(dev));
drivers/usb/typec/class.c
608
struct altmode *alt = to_altmode(to_typec_altmode(dev));
drivers/usb/typec/class.c
646
struct altmode *alt;
drivers/usb/typec/mode_selection.c
214
struct typec_altmode *altmode = to_typec_altmode(dev);
drivers/usb/typec/mode_selection.c
215
const struct typec_altmode *pdev = typec_altmode_get_partner(altmode);
drivers/usb/typec/mode_selection.c
218
if (pdev && altmode->ops && altmode->ops->activate) {
drivers/usb/typec/tcpm/tcpm.c
1872
struct typec_altmode *altmode;
drivers/usb/typec/tcpm/tcpm.c
1879
altmode = typec_partner_register_altmode(port->partner,
drivers/usb/typec/tcpm/tcpm.c
1881
if (IS_ERR(altmode)) {
drivers/usb/typec/tcpm/tcpm.c
1884
altmode = NULL;
drivers/usb/typec/tcpm/tcpm.c
1886
port->partner_altmode[i] = altmode;
drivers/usb/typec/tcpm/tcpm.c
1893
struct typec_altmode *altmode;
drivers/usb/typec/tcpm/tcpm.c
1899
altmode = typec_plug_register_altmode(port->plug_prime,
drivers/usb/typec/tcpm/tcpm.c
1901
if (IS_ERR(altmode)) {
drivers/usb/typec/tcpm/tcpm.c
1904
altmode = NULL;
drivers/usb/typec/tcpm/tcpm.c
1906
port->plug_prime_altmode[i] = altmode;
drivers/usb/typec/tcpm/tcpm.c
2902
static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
drivers/usb/typec/tcpm/tcpm.c
2904
struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
drivers/usb/typec/tcpm/tcpm.c
2912
header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
drivers/usb/typec/tcpm/tcpm.c
2913
header |= VDO_OPOS(altmode->mode);
drivers/usb/typec/tcpm/tcpm.c
2918
static int tcpm_altmode_exit(struct typec_altmode *altmode)
drivers/usb/typec/tcpm/tcpm.c
2920
struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
drivers/usb/typec/tcpm/tcpm.c
2928
header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
drivers/usb/typec/tcpm/tcpm.c
2929
header |= VDO_OPOS(altmode->mode);
drivers/usb/typec/tcpm/tcpm.c
2934
static int tcpm_altmode_vdm(struct typec_altmode *altmode,
drivers/usb/typec/tcpm/tcpm.c
2937
struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
drivers/usb/typec/tcpm/tcpm.c
2949
static int tcpm_cable_altmode_enter(struct typec_altmode *altmode, enum typec_plug_index sop,
drivers/usb/typec/tcpm/tcpm.c
2952
struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
drivers/usb/typec/tcpm/tcpm.c
2960
header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
drivers/usb/typec/tcpm/tcpm.c
2961
header |= VDO_OPOS(altmode->mode);
drivers/usb/typec/tcpm/tcpm.c
2966
static int tcpm_cable_altmode_exit(struct typec_altmode *altmode, enum typec_plug_index sop)
drivers/usb/typec/tcpm/tcpm.c
2968
struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
drivers/usb/typec/tcpm/tcpm.c
2976
header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
drivers/usb/typec/tcpm/tcpm.c
2977
header |= VDO_OPOS(altmode->mode);
drivers/usb/typec/tcpm/tcpm.c
2982
static int tcpm_cable_altmode_vdm(struct typec_altmode *altmode, enum typec_plug_index sop,
drivers/usb/typec/tcpm/tcpm.c
2985
struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
drivers/usb/typec/ucsi/ucsi.c
321
const struct typec_altmode *altmode = NULL;
drivers/usb/typec/ucsi/ucsi.c
340
altmode = typec_altmode_get_partner(con->port_altmode[cur]);
drivers/usb/typec/ucsi/ucsi.c
344
con->partner_altmode[i] == altmode);
drivers/usb/typec/ucsi/ucsi.c
346
if (altmode)
drivers/usb/typec/ucsi/ucsi.c
347
svid = altmode->svid;
include/linux/usb/typec.h
181
void typec_unregister_altmode(struct typec_altmode *altmode);
include/linux/usb/typec_altmode.h
103
int typec_cable_altmode_enter(struct typec_altmode *altmode, enum typec_plug_index sop, u32 *vdo);
include/linux/usb/typec_altmode.h
104
int typec_cable_altmode_exit(struct typec_altmode *altmode, enum typec_plug_index sop);
include/linux/usb/typec_altmode.h
105
int typec_cable_altmode_vdm(struct typec_altmode *altmode, enum typec_plug_index sop,
include/linux/usb/typec_altmode.h
113
typec_altmode_get_cable_svdm_version(struct typec_altmode *altmode)
include/linux/usb/typec_altmode.h
115
return typec_get_cable_svdm_version(typec_altmode2port(altmode));
include/linux/usb/typec_altmode.h
158
struct typec_altmode *typec_altmode_get_plug(struct typec_altmode *altmode,
include/linux/usb/typec_altmode.h
170
typec_altmode_get_orientation(struct typec_altmode *altmode)
include/linux/usb/typec_altmode.h
172
return typec_get_orientation(typec_altmode2port(altmode));
include/linux/usb/typec_altmode.h
180
typec_altmode_get_svdm_version(struct typec_altmode *altmode)
include/linux/usb/typec_altmode.h
182
return typec_get_negotiated_svdm_version(typec_altmode2port(altmode));
include/linux/usb/typec_altmode.h
193
typec_altmode_get_data_role(struct typec_altmode *altmode)
include/linux/usb/typec_altmode.h
195
return typec_get_data_role(typec_altmode2port(altmode));
include/linux/usb/typec_altmode.h
210
int (*probe)(struct typec_altmode *altmode);
include/linux/usb/typec_altmode.h
211
void (*remove)(struct typec_altmode *altmode);
include/linux/usb/typec_altmode.h
49
static inline void typec_altmode_set_drvdata(struct typec_altmode *altmode,
include/linux/usb/typec_altmode.h
52
dev_set_drvdata(&altmode->dev, data);
include/linux/usb/typec_altmode.h
55
static inline void *typec_altmode_get_drvdata(struct typec_altmode *altmode)
include/linux/usb/typec_altmode.h
57
return dev_get_drvdata(&altmode->dev);
include/linux/usb/typec_altmode.h
70
int (*enter)(struct typec_altmode *altmode, u32 *vdo);
include/linux/usb/typec_altmode.h
71
int (*exit)(struct typec_altmode *altmode);
include/linux/usb/typec_altmode.h
72
void (*attention)(struct typec_altmode *altmode, u32 vdo);
include/linux/usb/typec_altmode.h
73
int (*vdm)(struct typec_altmode *altmode, const u32 hdr,
include/linux/usb/typec_altmode.h
75
int (*notify)(struct typec_altmode *altmode, unsigned long conf,
include/linux/usb/typec_altmode.h
77
int (*activate)(struct typec_altmode *altmode, int activate);
include/linux/usb/typec_altmode.h
80
int typec_altmode_enter(struct typec_altmode *altmode, u32 *vdo);
include/linux/usb/typec_altmode.h
81
int typec_altmode_exit(struct typec_altmode *altmode);
include/linux/usb/typec_altmode.h
82
int typec_altmode_attention(struct typec_altmode *altmode, u32 vdo);
include/linux/usb/typec_altmode.h
83
int typec_altmode_vdm(struct typec_altmode *altmode,
include/linux/usb/typec_altmode.h
85
int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf,
include/linux/usb/typec_altmode.h
88
typec_altmode_get_partner(struct typec_altmode *altmode);
include/linux/usb/typec_altmode.h
97
int (*enter)(struct typec_altmode *altmode, enum typec_plug_index sop, u32 *vdo);
include/linux/usb/typec_altmode.h
98
int (*exit)(struct typec_altmode *altmode, enum typec_plug_index sop);
include/linux/usb/typec_altmode.h
99
int (*vdm)(struct typec_altmode *altmode, enum typec_plug_index sop,