rM2: power: supply: sysfs: Copy over rM2 patches
Signed-off-by: Alistair Francis <alistair@alistair23.me>5.4-rM2-2.2.x-imx-deep-sleep
parent
53e60e4761
commit
064c838bd2
|
@ -77,6 +77,15 @@ static const char * const power_supply_scope_text[] = {
|
|||
"Unknown", "System", "Device"
|
||||
};
|
||||
|
||||
static const char * const power_supply_charger_mode_text[] = {
|
||||
"Charger", "OTG Supply", "Off"
|
||||
};
|
||||
|
||||
static const char * const power_supply_status_ex_text[] = {
|
||||
"Charger not connected", "POGO connected", "USB-C connected",
|
||||
"POGO/USB-C connected", "Changing", "Unknown"
|
||||
};
|
||||
|
||||
static ssize_t power_supply_show_usb_type(struct device *dev,
|
||||
enum power_supply_usb_type *usb_types,
|
||||
ssize_t num_usb_types,
|
||||
|
@ -171,6 +180,14 @@ static ssize_t power_supply_show_property(struct device *dev,
|
|||
ret = sprintf(buf, "%s\n",
|
||||
power_supply_scope_text[value.intval]);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGER_MODE:
|
||||
ret = sprintf(buf, "%s\n",
|
||||
power_supply_charger_mode_text[value.intval]);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_STATUS_EX:
|
||||
ret = sprintf(buf, "%s\n",
|
||||
power_supply_status_ex_text[value.intval]);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
|
||||
ret = sprintf(buf, "%s\n", value.strval);
|
||||
break;
|
||||
|
@ -208,6 +225,12 @@ static ssize_t power_supply_store_property(struct device *dev,
|
|||
case POWER_SUPPLY_PROP_SCOPE:
|
||||
ret = sysfs_match_string(power_supply_scope_text, buf);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGER_MODE:
|
||||
ret = sysfs_match_string(power_supply_charger_mode_text, buf);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_STATUS_EX:
|
||||
ret = sysfs_match_string(power_supply_status_ex_text, buf);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
@ -255,6 +278,7 @@ static struct device_attribute power_supply_attrs[] = {
|
|||
POWER_SUPPLY_ATTR(voltage_ocv),
|
||||
POWER_SUPPLY_ATTR(voltage_boot),
|
||||
POWER_SUPPLY_ATTR(current_max),
|
||||
POWER_SUPPLY_ATTR(current_max2),
|
||||
POWER_SUPPLY_ATTR(current_now),
|
||||
POWER_SUPPLY_ATTR(current_avg),
|
||||
POWER_SUPPLY_ATTR(current_boot),
|
||||
|
@ -310,6 +334,16 @@ static struct device_attribute power_supply_attrs[] = {
|
|||
POWER_SUPPLY_ATTR(model_name),
|
||||
POWER_SUPPLY_ATTR(manufacturer),
|
||||
POWER_SUPPLY_ATTR(serial_number),
|
||||
|
||||
/* MAX77818-charger specific property to switch between OTG Supply (host mode)
|
||||
* and charging (device mode)
|
||||
*/
|
||||
POWER_SUPPLY_ATTR(charger_mode),
|
||||
|
||||
/* MAX77818-charger specific property to get extended charger status indicating
|
||||
* which of the two charger inputs are connected
|
||||
*/
|
||||
POWER_SUPPLY_ATTR(status_ex),
|
||||
};
|
||||
|
||||
static struct attribute *
|
||||
|
|
Loading…
Reference in New Issue