Message ID | 20170526110413.24836-2-enric.balletbo@collabora.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Hi Enric, I'll also incorporate these changes into v14 of my patchset. (See my prev msg.) On Fri, May 26, 2017 at 4:04 AM, Enric Balletbo i Serra <enric.balletbo@collabora.com> wrote: > Add the parameters to define the battery charging voltage and charging > current. Charger driver can get this information from the struct > power_supply_battery_info and apply the desired value. > > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> > --- > Changes since v2: > - Requested by Sebastian Reichel > - Move to its own patch and apply to simple-battery framework. > Changes since v1: > - Requested by Rob Herring > - Rename ti,charge-* to charge-* to be standard properties. > - Use unit suffixes as per bindings/property-units.txt > > drivers/power/supply/power_supply_core.c | 6 ++++++ > include/linux/power_supply.h | 2 ++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c > index 862fa8fc..a6857c2 100644 > --- a/drivers/power/supply/power_supply_core.c > +++ b/drivers/power/supply/power_supply_core.c > @@ -530,6 +530,8 @@ int power_supply_get_battery_info(struct power_supply *psy, > info->energy_full_design_uwh = -EINVAL; > info->charge_full_design_uah = -EINVAL; > info->voltage_min_design_uv = -EINVAL; > + info->charge_voltage_uv = -EINVAL; > + info->charge_current_ua = -EINVAL; > > if (!psy->of_node) { > dev_warn(&psy->dev, "%s currently only supports devicetree\n", > @@ -559,6 +561,10 @@ int power_supply_get_battery_info(struct power_supply *psy, > &info->charge_full_design_uah); > of_property_read_u32(battery_np, "voltage-min-design-microvolt", > &info->voltage_min_design_uv); > + of_property_read_u32(battery_np, "charge-voltage-microvolt", > + &info->charge_voltage_uv); > + of_property_read_u32(battery_np, "charge-current-microamp", > + &info->charge_current_ua); > > return 0; > } > diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h > index 8220f7b..3eea323 100644 > --- a/include/linux/power_supply.h > +++ b/include/linux/power_supply.h > @@ -302,6 +302,8 @@ struct power_supply_battery_info { > int energy_full_design_uwh; /* microWatt-hours */ > int charge_full_design_uah; /* microAmp-hours */ > int voltage_min_design_uv; /* microVolts */ > + int charge_voltage_uv; /* microVolts */ > + int charge_current_ua; /* microAmp */ > }; > > extern struct atomic_notifier_head power_supply_notifier; > -- > 2.9.3 >
Hi Liam, 2017-05-26 23:22 GMT+02:00 Liam Breck <liam@networkimprov.net>: > Hi Enric, > > I'll also incorporate these changes into v14 of my patchset. (See my prev msg.) > Perfect, thanks > > On Fri, May 26, 2017 at 4:04 AM, Enric Balletbo i Serra > <enric.balletbo@collabora.com> wrote: >> Add the parameters to define the battery charging voltage and charging >> current. Charger driver can get this information from the struct >> power_supply_battery_info and apply the desired value. >> >> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> >> --- >> Changes since v2: >> - Requested by Sebastian Reichel >> - Move to its own patch and apply to simple-battery framework. >> Changes since v1: >> - Requested by Rob Herring >> - Rename ti,charge-* to charge-* to be standard properties. >> - Use unit suffixes as per bindings/property-units.txt >> >> drivers/power/supply/power_supply_core.c | 6 ++++++ >> include/linux/power_supply.h | 2 ++ >> 2 files changed, 8 insertions(+) >> >> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c >> index 862fa8fc..a6857c2 100644 >> --- a/drivers/power/supply/power_supply_core.c >> +++ b/drivers/power/supply/power_supply_core.c >> @@ -530,6 +530,8 @@ int power_supply_get_battery_info(struct power_supply *psy, >> info->energy_full_design_uwh = -EINVAL; >> info->charge_full_design_uah = -EINVAL; >> info->voltage_min_design_uv = -EINVAL; >> + info->charge_voltage_uv = -EINVAL; >> + info->charge_current_ua = -EINVAL; >> >> if (!psy->of_node) { >> dev_warn(&psy->dev, "%s currently only supports devicetree\n", >> @@ -559,6 +561,10 @@ int power_supply_get_battery_info(struct power_supply *psy, >> &info->charge_full_design_uah); >> of_property_read_u32(battery_np, "voltage-min-design-microvolt", >> &info->voltage_min_design_uv); >> + of_property_read_u32(battery_np, "charge-voltage-microvolt", >> + &info->charge_voltage_uv); >> + of_property_read_u32(battery_np, "charge-current-microamp", >> + &info->charge_current_ua); >> >> return 0; >> } >> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h >> index 8220f7b..3eea323 100644 >> --- a/include/linux/power_supply.h >> +++ b/include/linux/power_supply.h >> @@ -302,6 +302,8 @@ struct power_supply_battery_info { >> int energy_full_design_uwh; /* microWatt-hours */ >> int charge_full_design_uah; /* microAmp-hours */ >> int voltage_min_design_uv; /* microVolts */ >> + int charge_voltage_uv; /* microVolts */ >> + int charge_current_ua; /* microAmp */ >> }; >> >> extern struct atomic_notifier_head power_supply_notifier; >> -- >> 2.9.3 >>
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 862fa8fc..a6857c2 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -530,6 +530,8 @@ int power_supply_get_battery_info(struct power_supply *psy, info->energy_full_design_uwh = -EINVAL; info->charge_full_design_uah = -EINVAL; info->voltage_min_design_uv = -EINVAL; + info->charge_voltage_uv = -EINVAL; + info->charge_current_ua = -EINVAL; if (!psy->of_node) { dev_warn(&psy->dev, "%s currently only supports devicetree\n", @@ -559,6 +561,10 @@ int power_supply_get_battery_info(struct power_supply *psy, &info->charge_full_design_uah); of_property_read_u32(battery_np, "voltage-min-design-microvolt", &info->voltage_min_design_uv); + of_property_read_u32(battery_np, "charge-voltage-microvolt", + &info->charge_voltage_uv); + of_property_read_u32(battery_np, "charge-current-microamp", + &info->charge_current_ua); return 0; } diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 8220f7b..3eea323 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -302,6 +302,8 @@ struct power_supply_battery_info { int energy_full_design_uwh; /* microWatt-hours */ int charge_full_design_uah; /* microAmp-hours */ int voltage_min_design_uv; /* microVolts */ + int charge_voltage_uv; /* microVolts */ + int charge_current_ua; /* microAmp */ }; extern struct atomic_notifier_head power_supply_notifier;
Add the parameters to define the battery charging voltage and charging current. Charger driver can get this information from the struct power_supply_battery_info and apply the desired value. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> --- Changes since v2: - Requested by Sebastian Reichel - Move to its own patch and apply to simple-battery framework. Changes since v1: - Requested by Rob Herring - Rename ti,charge-* to charge-* to be standard properties. - Use unit suffixes as per bindings/property-units.txt drivers/power/supply/power_supply_core.c | 6 ++++++ include/linux/power_supply.h | 2 ++ 2 files changed, 8 insertions(+)