Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: tipd: Move switch_power_state to tipd_data

When support for CD321x was originally added no other hardware variant
was supported and there was no need for struct tipd_data. Now that it
exists move the special case in there so that we can drop the
of_device_is_compatible_check entirely.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Sven Peter <sven@kernel.org>
Link: https://lore.kernel.org/r/20250914-apple-usb3-tipd-v1-3-4e99c8649024@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sven Peter and committed by
Greg Kroah-Hartman
ff175d85 b3dddff5

+8 -9
+8 -9
drivers/usb/typec/tipd/core.c
··· 118 118 void (*trace_status)(u32 status); 119 119 int (*apply_patch)(struct tps6598x *tps); 120 120 int (*init)(struct tps6598x *tps); 121 + int (*switch_power_state)(struct tps6598x *tps, u8 target_state); 121 122 int (*reset)(struct tps6598x *tps); 122 123 }; 123 124 ··· 1294 1293 1295 1294 static int tps6598x_probe(struct i2c_client *client) 1296 1295 { 1297 - struct device_node *np = client->dev.of_node; 1298 1296 struct tps6598x *tps; 1299 1297 struct fwnode_handle *fwnode; 1300 1298 u32 status; ··· 1331 1331 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) 1332 1332 tps->i2c_protocol = true; 1333 1333 1334 - if (np && of_device_is_compatible(np, "apple,cd321x")) { 1335 - /* Switch CD321X chips to the correct system power state */ 1336 - ret = cd321x_switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0); 1337 - if (ret) 1338 - return ret; 1339 - 1340 - } 1341 - 1342 1334 tps->data = i2c_get_match_data(client); 1343 1335 if (!tps->data) 1344 1336 return -EINVAL; 1337 + 1338 + if (tps->data->switch_power_state) { 1339 + ret = tps->data->switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0); 1340 + if (ret) 1341 + return ret; 1342 + } 1345 1343 1346 1344 /* Make sure the controller has application firmware running */ 1347 1345 ret = tps6598x_check_mode(tps); ··· 1523 1525 .trace_status = trace_tps6598x_status, 1524 1526 .init = cd321x_init, 1525 1527 .reset = cd321x_reset, 1528 + .switch_power_state = cd321x_switch_power_state, 1526 1529 }; 1527 1530 1528 1531 static const struct tipd_data tps6598x_data = {