void (*trace_status)(u32 status);
int (*apply_patch)(struct tps6598x *tps);
int (*init)(struct tps6598x *tps);
+ int (*switch_power_state)(struct tps6598x *tps, u8 target_state);
int (*reset)(struct tps6598x *tps);
};
static int tps6598x_probe(struct i2c_client *client)
{
- struct device_node *np = client->dev.of_node;
struct tps6598x *tps;
struct fwnode_handle *fwnode;
u32 status;
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
tps->i2c_protocol = true;
- if (np && of_device_is_compatible(np, "apple,cd321x")) {
- /* Switch CD321X chips to the correct system power state */
- ret = cd321x_switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0);
- if (ret)
- return ret;
-
- }
-
tps->data = i2c_get_match_data(client);
if (!tps->data)
return -EINVAL;
+ if (tps->data->switch_power_state) {
+ ret = tps->data->switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0);
+ if (ret)
+ return ret;
+ }
+
/* Make sure the controller has application firmware running */
ret = tps6598x_check_mode(tps);
if (ret < 0)
.trace_status = trace_tps6598x_status,
.init = cd321x_init,
.reset = cd321x_reset,
+ .switch_power_state = cd321x_switch_power_state,
};
static const struct tipd_data tps6598x_data = {