summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>2026-07-14 11:48:18 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-07-17 12:31:27 +0200
commit1b21957eec2e8dc3bccc39abe8a4493a2cb53e44 (patch)
tree8889fd5d507134654ab7c98177c4c9504bcd556b
parent90b2a18d230b157525b368c44a2d234b0f2d02b3 (diff)
usb: typec: tipd: add read_power_status callback to tipd_data
Convert direct tps6598x_read_power_status() calls to use an indirect read_power_status callback through tipd_data. This allows variants (e.g. TPS66993) to provide their own power status reading logic while keeping existing behavior unchanged for TPS6598x, CD321x, and TPS25750. Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com> Link: https://patch.msgid.link/20260714061820.537792-3-radhey.shyam.pandey@amd.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/typec/tipd/core.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index b6335b36d384..9097b0d40a71 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -159,6 +159,7 @@ struct tipd_data {
int (*init)(struct tps6598x *tps);
int (*switch_power_state)(struct tps6598x *tps, u8 target_state);
bool (*read_data_status)(struct tps6598x *tps);
+ bool (*read_power_status)(struct tps6598x *tps);
int (*reset)(struct tps6598x *tps);
int (*connect)(struct tps6598x *tps, u32 status);
};
@@ -897,7 +898,7 @@ static irqreturn_t cd321x_interrupt(int irq, void *data)
goto err_unlock;
if (event & APPLE_CD_REG_INT_POWER_STATUS_UPDATE) {
- if (!tps6598x_read_power_status(tps))
+ if (!tps->data->read_power_status(tps))
goto err_unlock;
if (TPS_POWER_STATUS_PWROPMODE(tps->pwr_status) == TYPEC_PWR_MODE_PD) {
if (tps6598x_read_partner_identity(tps)) {
@@ -952,7 +953,7 @@ static irqreturn_t tps25750_interrupt(int irq, void *data)
goto err_clear_ints;
if (event[0] & TPS_REG_INT_POWER_STATUS_UPDATE)
- if (!tps6598x_read_power_status(tps))
+ if (!tps->data->read_power_status(tps))
goto err_clear_ints;
if (event[0] & TPS_REG_INT_DATA_STATUS_UPDATE)
@@ -1026,7 +1027,7 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
goto err_unlock;
if ((event1[0] | event2[0]) & TPS_REG_INT_POWER_STATUS_UPDATE)
- if (!tps6598x_read_power_status(tps))
+ if (!tps->data->read_power_status(tps))
goto err_unlock;
if ((event1[0] | event2[0]) & TPS_REG_INT_DATA_STATUS_UPDATE)
@@ -1839,7 +1840,7 @@ static int tps6598x_probe(struct i2c_client *client)
if (status & TPS_STATUS_PLUG_PRESENT) {
ret = -EINVAL;
- if (!tps6598x_read_power_status(tps))
+ if (!tps->data->read_power_status(tps))
goto err_unregister_port;
if (!tps->data->read_data_status(tps))
goto err_unregister_port;
@@ -1981,6 +1982,7 @@ static const struct tipd_data cd321x_data = {
.trace_status = trace_tps6598x_status,
.init = cd321x_init,
.read_data_status = cd321x_read_data_status,
+ .read_power_status = tps6598x_read_power_status,
.reset = cd321x_reset,
.switch_power_state = cd321x_switch_power_state,
.connect = cd321x_connect,
@@ -2000,6 +2002,7 @@ static const struct tipd_data tps6598x_data = {
.apply_patch = tps6598x_apply_patch,
.init = tps6598x_init,
.read_data_status = tps6598x_read_data_status,
+ .read_power_status = tps6598x_read_power_status,
.reset = tps6598x_reset,
.connect = tps6598x_connect,
};
@@ -2018,6 +2021,7 @@ static const struct tipd_data tps25750_data = {
.apply_patch = tps25750_apply_patch,
.init = tps25750_init,
.read_data_status = tps6598x_read_data_status,
+ .read_power_status = tps6598x_read_power_status,
.reset = tps25750_reset,
.connect = tps6598x_connect,
};