static void smb347_otg_status(enum usb_otg_state to, enum usb_otg_state from, void *data) { struct i2c_client *client = charger->client; int ret; if ((from == OTG_STATE_A_SUSPEND) && (to == OTG_STATE_A_HOST)) { /* configure charger */ ret = smb347_configure_charger(client, 0); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); /* ENABLE OTG */ ret = smb347_configure_otg(client, 1); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); } else if ((from == OTG_STATE_A_HOST) && (to == OTG_STATE_A_SUSPEND)) { /* Disable OTG */ ret = smb347_configure_otg(client, 0); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); /* configure charger */ ret = smb347_configure_charger(client, 1); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); } }
static int smb347_shutdown(struct i2c_client *client) { int ret; printk("smb347_shutdown+\n"); /* Disable OTG */ ret = smb347_configure_otg(client, 0); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); /* configure charger */ ret = smb347_configure_charger(client, 1); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); printk("smb347_shutdown-\n"); return 0; }
static int smb347_shutdown(struct i2c_client *client) { int ret; printk("smb347_shutdown+\n"); cancel_delayed_work(&charger->curr_limit_work); smb347_set_InputCurrentlimit(charger->client, 1800); /* Disable OTG */ ret = smb347_configure_otg(client, 0); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); /* configure charger */ ret = smb347_configure_charger(client, 1); if (ret < 0) dev_err(&client->dev, "%s() error in configuring" "otg..\n", __func__); printk("smb347_shutdown-\n"); return 0; }