History log of /openbmc/linux/drivers/power/supply/ab8500_fg.c (Results 1 – 25 of 80)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.6.25, v6.6.24, v6.6.23, v6.6.16, v6.6.15, v6.6.14, v6.6.13, v6.6.12, v6.6.11, v6.6.10, v6.6.9, v6.6.8, v6.6.7, v6.6.6, v6.6.5, v6.6.4, v6.6.3, v6.6.2, v6.5.11, v6.6.1, v6.5.10, v6.6, v6.5.9, v6.5.8, v6.5.7, v6.5.6, v6.5.5, v6.5.4, v6.5.3, v6.5.2, v6.1.51, v6.5.1, v6.1.50, v6.5, v6.1.49, v6.1.48, v6.1.46, v6.1.45, v6.1.44, v6.1.43, v6.1.42, v6.1.41, v6.1.40, v6.1.39, v6.1.38, v6.1.37, v6.1.36, v6.4, v6.1.35, v6.1.34, v6.1.33, v6.1.32, v6.1.31, v6.1.30, v6.1.29, v6.1.28, v6.1.27, v6.1.26, v6.3, v6.1.25
# a5299ce4 15-Apr-2023 Hans de Goede <hdegoede@redhat.com>

power: supply: ab8500: Fix external_power_changed race

ab8500_btemp_external_power_changed() dereferences di->btemp_psy,
which gets sets in ab8500_btemp_probe() like this:

di->btemp_psy = d

power: supply: ab8500: Fix external_power_changed race

ab8500_btemp_external_power_changed() dereferences di->btemp_psy,
which gets sets in ab8500_btemp_probe() like this:

di->btemp_psy = devm_power_supply_register(dev, &ab8500_btemp_desc,
&psy_cfg);

As soon as devm_power_supply_register() has called device_add()
the external_power_changed callback can get called. So there is a window
where ab8500_btemp_external_power_changed() may get called while
di->btemp_psy has not been set yet leading to a NULL pointer dereference.

Fixing this is easy. The external_power_changed callback gets passed
the power_supply which will eventually get stored in di->btemp_psy,
so ab8500_btemp_external_power_changed() can simply directly use
the passed in psy argument which is always valid.

And the same applies to ab8500_fg_external_power_changed().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


Revision tags: v6.1.24, v6.1.23, v6.1.22, v6.1.21, v6.1.20, v6.1.19, v6.1.18, v6.1.17, v6.1.16, v6.1.15, v6.1.14, v6.1.13, v6.2, v6.1.12, v6.1.11, v6.1.10, v6.1.9, v6.1.8, v6.1.7, v6.1.6, v6.1.5, v6.0.19, v6.0.18, v6.1.4, v6.1.3, v6.0.17, v6.1.2, v6.0.16, v6.1.1, v6.0.15, v6.0.14, v6.0.13, v6.1, v6.0.12
# a441f3b9 05-Dec-2022 ye xingchen <ye.xingchen@zte.com.cn>

power: supply: use sysfs_emit() instead of sprintf() for sysfs show()

As documented in Documentation/filesystems/sysfs.rst the sysfs show()
function should use sysfs_emit() or sysfs_emit_at() to for

power: supply: use sysfs_emit() instead of sprintf() for sysfs show()

As documented in Documentation/filesystems/sysfs.rst the sysfs show()
function should use sysfs_emit() or sysfs_emit_at() to format the
userspace return value. This replaces all sysfs related instances of
sprintf() with sysfs_emit() in the power-supply subsystem.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
[Drop sysfs_emit changes done for code not related to sysfs show
and reword commit message]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 35aa0628 05-Dec-2022 ye xingchen <ye.xingchen@zte.com.cn>

power: supply: use sysfs_emit() instead of scnprintf() for sysfs show()

As documented in Documentation/filesystems/sysfs.rst the sysfs
show() function should use sysfs_emit() or sysfs_emit_at() to
f

power: supply: use sysfs_emit() instead of scnprintf() for sysfs show()

As documented in Documentation/filesystems/sysfs.rst the sysfs
show() function should use sysfs_emit() or sysfs_emit_at() to
format the userspace return value. This replaces all instances
of scnprintf() with sysfs_emit() in the power-supply subsystem.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
[reword commit message]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


Revision tags: v6.0.11, v6.0.10, v5.15.80, v6.0.9, v5.15.79, v6.0.8, v5.15.78, v6.0.7, v5.15.77, v5.15.76, v6.0.6, v6.0.5, v5.15.75, v6.0.4, v6.0.3, v6.0.2, v5.15.74, v5.15.73, v6.0.1, v5.15.72, v6.0, v5.15.71, v5.15.70, v5.15.69, v5.15.68, v5.15.67, v5.15.66, v5.15.65, v5.15.64, v5.15.63, v5.15.62, v5.15.61, v5.15.60, v5.15.59, v5.19, v5.15.58, v5.15.57, v5.15.56, v5.15.55, v5.15.54, v5.15.53, v5.15.52, v5.15.51, v5.15.50, v5.15.49, v5.15.48, v5.15.47, v5.15.46
# a1124c84 08-Jun-2022 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

power: supply: ab8500: Remove flush_scheduled_work() call.

It seems to me that ab8500 driver is using dedicated workqueues and
is not calling schedule{,_delayed}_work{,_on}(). Then, there will be
no

power: supply: ab8500: Remove flush_scheduled_work() call.

It seems to me that ab8500 driver is using dedicated workqueues and
is not calling schedule{,_delayed}_work{,_on}(). Then, there will be
no work to flush using flush_scheduled_work().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 13a4223d 22-Jun-2022 Jiang Jian <jiangjian@cdjrlc.com>

power: supply: ab8500_fg: drop duplicated 'is' in comment

Fix word duplication typo 'is is' -> 'is'.

Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com>
[update commit message]
Signed-off-by: Sebastia

power: supply: ab8500_fg: drop duplicated 'is' in comment

Fix word duplication typo 'is is' -> 'is'.

Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com>
[update commit message]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 0f5de2f0 07-Jun-2022 Gao Chao <gaochao49@huawei.com>

power: supply: ab8500_fg: add missing destroy_workqueue in ab8500_fg_probe

In ab8500_fg_probe, misses destroy_workqueue in error path, this patch
fixes that.

Fixes: 010ddb813f35 ("power: supply: ab

power: supply: ab8500_fg: add missing destroy_workqueue in ab8500_fg_probe

In ab8500_fg_probe, misses destroy_workqueue in error path, this patch
fixes that.

Fixes: 010ddb813f35 ("power: supply: ab8500_fg: Allocate wq in probe")
Signed-off-by: Gao Chao <gaochao49@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


Revision tags: v5.15.45, v5.15.44, v5.15.43, v5.15.42, v5.18, v5.15.41, v5.15.40, v5.15.39, v5.15.38, v5.15.37, v5.15.36
# 010ddb81 23-Apr-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Allocate wq in probe

The workqueue is allocated in bind() but all interrupts are
registered in probe().

Some interrupts put work on the workqueue, which can have
bad side

power: supply: ab8500_fg: Allocate wq in probe

The workqueue is allocated in bind() but all interrupts are
registered in probe().

Some interrupts put work on the workqueue, which can have
bad side effects.

Allocate the workqueue in probe() instead, destroy it in
.remove() and make unbind() simply flush the workqueue.

Fixes: 1c1f13a006ed ("power: supply: ab8500: Move to componentized binding")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


Revision tags: v5.15.35, v5.15.34, v5.15.33, v5.15.32, v5.15.31, v5.17, v5.15.30, v5.15.29, v5.15.28, v5.15.27, v5.15.26
# 1ae4a91c 01-Mar-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Account for line impedance

We add the line impedance to the inner resistance determined
from the battery voltage or other means to improve the
capacity estimations.

Signed

power: supply: ab8500_fg: Account for line impedance

We add the line impedance to the inner resistance determined
from the battery voltage or other means to improve the
capacity estimations.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# bc5d4a24 25-Feb-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Use VBAT-to-Ri if possible

Augment the AB8500 fuel gauge to use the VBAT-to-Ri method of
estimating the internal resistance if possible. Else fall back
to using the tempera

power: supply: ab8500_fg: Use VBAT-to-Ri if possible

Augment the AB8500 fuel gauge to use the VBAT-to-Ri method of
estimating the internal resistance if possible. Else fall back
to using the temperature-to-Ri or just the default Ri.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 1f918e0f 25-Feb-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Standardize BTI resistance

The Battery Type Indicator (BTI) resistor is a resistor mounted
between a special terminal on the battery and ground. By sending
a fixed current (su

power: supply: ab8500: Standardize BTI resistance

The Battery Type Indicator (BTI) resistor is a resistor mounted
between a special terminal on the battery and ground. By sending
a fixed current (such as 7mA) through this resistor and measuring
the voltage over it, the resistance can be determined, and this
verifies the battery type.

Typical side view of the battery:

o o o
GND BTI +3.8V

Typical example of the electrical layout:

+3.8 V BTI
| |
| + |
_______ [ ] 7kOhm
___ |
| |
| |
GND GND

By verifying this resistance before attempting to charge the
battery we add an additional level of security.

In some systems this is used for plug-and-play of batteries with
different capacity. In other cases, this is merely used to verify
that the right type of battery is connected, if several batteries
have the same physical shape and can be plugged into the same
slot. Sometimes this is just a surplus security mechanism.

Nokia and Samsung among many other vendors are known to use these
BTI resistors.

Add the BTI properties to struct power_supply_battery_info and
switch the AB8500 charger code over to using it.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


Revision tags: v5.15.25, v5.15.24, v5.15.23, v5.15.22, v5.15.21, v5.15.20, v5.15.19, v5.15.18, v5.15.17, v5.4.173, v5.15.16, v5.15.15, v5.16
# cd4c7b27 06-Jan-2022 Changcheng Deng <deng.changcheng@zte.com.cn>

power: supply: ab8500: Remove unneeded variable

Remove unneeded variable used to store return value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.

power: supply: ab8500: Remove unneeded variable

Remove unneeded variable used to store return value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 6a476046 24-Jan-2022 Miaoqian Lin <linmq006@gmail.com>

power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init

kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add():

If this function returns

power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init

kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add():

If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object.

Fix memory leak by calling kobject_put().

Fixes: 8c0984e5a753 ("power: move power supply drivers to power/supply")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 3bab7363 28-Jan-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Drop useless parameter

All calls to ab8500_fg_calc_cap_discharge_voltage() require
compensation and pass true as the second argument so just drop
this argument.

Signed-off

power: supply: ab8500_fg: Drop useless parameter

All calls to ab8500_fg_calc_cap_discharge_voltage() require
compensation and pass true as the second argument so just drop
this argument.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 965a9904 28-Jan-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Safeguard compensated voltage

In some cases when the platform is dissapating more than
500mA the voltage measurements and compensation will become
instable. Add a parameter

power: supply: ab8500_fg: Safeguard compensated voltage

In some cases when the platform is dissapating more than
500mA the voltage measurements and compensation will become
instable. Add a parameter to bail out of the voltage
measurement if this happens.

This code was found in a Samsung vendor tree.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 673b5032 28-Jan-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Break out load compensated voltage

Break out the part of the function providing the load compensated
capacity that provides the load compensated voltage and use
that to get

power: supply: ab8500_fg: Break out load compensated voltage

Break out the part of the function providing the load compensated
capacity that provides the load compensated voltage and use
that to get the load compensated capacity.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# edc400e1 28-Jan-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Break loop for measurement

In the Samsung code tree we find that it can happen that this
measurement loop goes on for a long time, and it seems like a
good idea to break it

power: supply: ab8500_fg: Break loop for measurement

In the Samsung code tree we find that it can happen that this
measurement loop goes on for a long time, and it seems like a
good idea to break it after 70 iterations if it goes on for
too long.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# d662a7df 28-Jan-2022 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Swap max and overvoltage

We should terminate charging when we reach the voltage_max_design_uv
not overvoltage_limit_uv, this is an abuse of that struct member.

The overvoltag

power: supply: ab8500: Swap max and overvoltage

We should terminate charging when we reach the voltage_max_design_uv
not overvoltage_limit_uv, this is an abuse of that struct member.

The overvoltage limit is actually not configurable on the AB8500,
it is fixed to 4.75 V so drop a comment about that in the code.

Fixes: 2a5f41830aad ("power: supply: ab8500: Standardize voltages")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# a8e22309 29-Dec-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

power_supply: ab8500: use default_groups in kobj_type

There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field. Move

power_supply: ab8500: use default_groups in kobj_type

There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field. Move the ab8500 power supply sysfs code to use default_groups
field which has been the preferred way since aa30f47cf666 ("kobject: Add
support for default attribute groups to kobj_type") so that we can soon
get rid of the obsolete default_attrs field.

Cc: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org
Link: https://lore.kernel.org/r/20211229140908.2523513-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

show more ...


Revision tags: v5.15.10, v5.15.9
# 25fd3303 14-Dec-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply_core: Pass pointer to battery info

The function to retrieve battery info (from the device tree) assumes
we have a static info struct that gets populated by calling into
power_supply_ge

power: supply_core: Pass pointer to battery info

The function to retrieve battery info (from the device tree) assumes
we have a static info struct that gets populated by calling into
power_supply_get_battery_info().

This is awkward since I want to support tables of static battery
info by just assigning a pointer to all info based on e.g. a
compatible value in the device tree.

We also have a mixture of static and dynamically allocated
variables here.

Bite the bullet and let power_supply_get_battery_info() allocate
also the memory used for the very top level
struct power_supply_battery_info container. Pass pointers
around and lifecycle this with the psy device just like the
stuff we allocate inside it.

Change all current users over.

As part of the change, initializers need to be added to some
previously uninitialized fields in struct
power_supply_battery_info.

Reviewed-By: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


Revision tags: v5.15.8, v5.15.7, v5.15.6, v5.15.5, v5.15.4
# 0525f34d 20-Nov-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Standardize capacity lookup

The AB8500 charger only has one capacity table with
unspecified temperature, so we assume this capacity is given
for 20 degrees Celsius.

Convert t

power: supply: ab8500: Standardize capacity lookup

The AB8500 charger only has one capacity table with
unspecified temperature, so we assume this capacity is given
for 20 degrees Celsius.

Convert this table to use the OCV (open circuit voltage)
tables in struct power_supply_battery_ocv_table.

In the process, convert the fuel gauge driver to use
microvolts and microamperes so we can use the same internals
as the power supply subsystem without having to multiply
and divide with 1000 in a few places.

Also convert high_curr_threshold and lowbat_threshold to
use microamperes and microvolts as these are closely
related to these changes.

Drop the unused overbat_threshold member in the custom
struct ab8500_fg_parameters.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 67acb291 20-Nov-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Standardize temp res lookup

The lookup from battery temperature to internal resistance was
using its own format. Rewrite this to use the table inside
struct power_supply_batte

power: supply: ab8500: Standardize temp res lookup

The lookup from battery temperature to internal resistance was
using its own format. Rewrite this to use the table inside
struct power_supply_battery_info:s resist_table.

The supplied resistance table has to be rewritten to express
the resistance in percent of the factory resistance as a
side effect.

We can then rely on the library function
power_supply_temp2resist_simple() to interpolate the internal
resistance percent from the temperature.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# fc81c435 20-Nov-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500_fg: Init battery data in bind()

We were assigning some battery data state in probe() but
this is insecure as it depends on the proper probe order
between the components: the ch

power: supply: ab8500_fg: Init battery data in bind()

We were assigning some battery data state in probe() but
this is insecure as it depends on the proper probe order
between the components: the charger must probe first so
that the battery data is populated. Move the init to
the bind() call which is certain to happen after the
probe of the master and all components has happened.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 2a5f4183 20-Nov-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Standardize voltages

The nominal voltage in this charge driver corresponds to
both the voltage_min_design_uv and voltage_max_design_uv
of struct power_supply_battery_info so a

power: supply: ab8500: Standardize voltages

The nominal voltage in this charge driver corresponds to
both the voltage_min_design_uv and voltage_max_design_uv
of struct power_supply_battery_info so assign both if this
is undefined.

The overcharge max voltage (when the charger should cut off)
is migrated at the same time so we move both voltages to
struct power_supply_battery_info.

Adjust the code to deal directly with the microvolt values
instead of converting them to millivolts.

Add *_uv suffixes for clarity and to make sure we have
changed all code sites using this member.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 2d3559a5 20-Nov-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Standardize technology

The AB8500 custom battery type can be replaced by the
corresponding struct power_supply_battery_info field.

Remove the struct member and amend the code

power: supply: ab8500: Standardize technology

The AB8500 custom battery type can be replaced by the
corresponding struct power_supply_battery_info field.

Remove the struct member and amend the code to use the
standard property.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


# 22be8d77 20-Nov-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply: ab8500: Standardize design capacity

Now that we know that we have only one battery type to
deal with we can proceed to transfer properties to
struct power_supply_battery_info.

The de

power: supply: ab8500: Standardize design capacity

Now that we know that we have only one battery type to
deal with we can proceed to transfer properties to
struct power_supply_battery_info.

The designed capacity for the battery was in a custom field
of the custom battery type in mAh, transfer this to the
standard charge_full_design_uah property in
struct power_supply_battery_info and augment the code
accordingly.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

show more ...


1234