bool SM5414_hal_chg_set_property(struct i2c_client *client,
			      enum power_supply_property psp,
			      const union power_supply_propval *val)
{
	struct sec_charger_info *charger = i2c_get_clientdata(client);
	switch (psp) {
	/* val->intval : type */
	case POWER_SUPPLY_PROP_ONLINE:
		if (charger->cable_type == POWER_SUPPLY_TYPE_OTG) {
			SM5414_charger_otg_control(client);
		} else if (charger->cable_type == POWER_SUPPLY_TYPE_BATTERY) {
			SM5414_charger_function_control(client);
			SM5414_charger_otg_control(client);
		} else {
			SM5414_charger_function_control(client);
		}
		break;
	case POWER_SUPPLY_PROP_CURRENT_MAX: /* input current limit set */
		/* calculated input current limit value */
	case POWER_SUPPLY_PROP_CURRENT_NOW:
		SM5414_set_input_current_limit_data(client, val->intval);
		break;
	case POWER_SUPPLY_PROP_CURRENT_AVG:
		SM5414_set_fast_charging_current_data(client, val->intval);
		break;
	default:
		return false;
	}

	return true;
}
示例#2
0
bool sec_hal_chg_set_property(struct i2c_client *client,
			      enum power_supply_property psp,
			      const union power_supply_propval *val)
{
	struct sec_charger_info *charger = i2c_get_clientdata(client);
	switch (psp) {
	/* val->intval : type */
	case POWER_SUPPLY_PROP_ONLINE:
		if (charger->charging_current < 0)
			SM5414_charger_otg_control(client);
		else if (charger->charging_current > 0)
			SM5414_charger_function_control(client);
		else {
			SM5414_charger_function_control(client);
			SM5414_charger_otg_control(client);
		}
		dev_dbg(&client->dev, "%s: PROP_ONLINE \n", __func__);
		break;
	/* val->intval : charging current */
	case POWER_SUPPLY_PROP_CURRENT_NOW:
		dev_dbg(&client->dev, "%s: PROP_CURRENT_NOW \n", __func__);
		break;
	default:
		return false;
	}

	return true;
}