Age | Commit message (Collapse) | Author | Files | Lines |
|
Make similar OF and ID table to extend support for ID match
using i2c_match_data(). Currently it works only for OF match
tables as the field is wrong for ID match.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230831171235.58477-1-biju.das.jz@bp.renesas.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
As defined by the Smart Battery Data Specification.
An _AVG suffix is added to the enum values REG_TIME_TO_EMPTY and
REG_TIME_TO_FULL to make the distinction clear.
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
The Smart Battery Data Specification allows for values 0..65535 mV,
there is no reason to limit the value to 20000.
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Currently sbs-battery supports three string properties -
manufacturer, model_name, and chemistry. Buffers for those
properties are currently defined as global variables.
This patch moves those global variables into struct sbs_info
and cache/reuse them as they are all constant values.
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel:
"battery/charger driver changes:
- core:
- provide function stubs if CONFIG_POWER_SUPPLY=n
- reduce loglevel for probe defer info
- surface:
- new battery and charger drivers for Surface
- bq27xxx:
- add bq78z100 support
- fix current_now/power_avg for newer chips
- cw2015:
- add CHARGE_NOW support
- ab8500:
- drop pdata support
- convert most DT bindings to YAML
- lots of minor fixes and cleanups
reset drivers:
- ltc2952-poweroff:
- make trigger delay configurable from DT
- minor fixes and cleanups"
* tag 'for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (97 commits)
power: supply: cpcap-battery: fix invalid usage of list cursor
power: supply: bq256xx: add kerneldoc for structure members
power: supply: act8945a: correct kerneldoc
power: supply: max17040: remove unneeded double cast
power: supply: max17040: handle device_property_read_u8_array() failure
power: supply: max14577: remove unneeded variable initialization
power: supply: surface-charger: Make symbol 'surface_ac_pm_ops' static
power: supply: surface-battery: Make some symbols static
power: reset: restart-poweroff: Add missing MODULE_DEVICE_TABLE
power: reset: hisi-reboot: add missing MODULE_DEVICE_TABLE
power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove()
power: supply: generic-adc-battery: fix possible use-after-free in gab_remove()
power: supply: Add AC driver for Surface Aggregator Module
power: supply: Add battery driver for Surface Aggregator Module
power: supply: bq25980: Move props from battery node
power: supply: core: Use true and false for bool variable
power: supply: goldfish: Remove the GOLDFISH dependency
power: reset: ltc2952: make trigger delay configurable
power: supply: cpcap-charger: Simplify bool conversion
power: supply: cpcap-charger: Add usleep to cpcap charger to avoid usb plug bounce
...
|
|
Introduce usage of dev_err_probe in probe routine, which
makes the code slightly more readable and removes some
lines of code. It also removes PROBE_DEFER errors being
logged by default, which are common when the battery is
waiting for the charger driver to be registered.
This also cleans up a useless goto and instead returns
directly.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Few drivers implement remove call-back only for ensuring a delayed
work gets cancelled prior driver removal. Clean-up these by switching
to use devm_delayed_work_autocancel() instead.
This change is compile-tested only. All testing is appreciated.
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/e5b1b0380cdd1aa066c9ac6d7a8b1a86ba1ddbbe.1616506559.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel:
"Power-supply core:
- add wireless type
- properly document current direction
Battery/charger driver changes:
- new fuel-gauge/charger driver for RN5T618/RN5T619
- new charger driver for BQ25980, BQ25975 and BQ25960
- bq27xxx-battery: add support for TI bq34z100
- gpio-charger: convert to GPIO descriptors
- gpio-charger: add optional support for charge current limiting
- max17040: add support for max17041, max17043, max17044
- max17040: add support for max17048, max17049, max17058, max17059
- smb347-charger: add DT support
- smb247-charger: add SMB345 and SMB358 support
- simple-battery: add temperature properties
- lots of minor fixes, cleanups and DT binding YAML conversions
Reset drivers:
- ocelot: Add support for Sparx5"
* tag 'for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (81 commits)
power: reset: POWER_RESET_OCELOT_RESET should depend on Ocelot or Sparx5
power: supply: bq25980: Fix uninitialized wd_reg_val and overrun
power: supply: ltc2941: Fix ptr to enum cast
power: supply: test-power: revise parameter printing to use sprintf
power: supply: charger-manager: fix incorrect check on charging_duration_ms
power: supply: max17040: Fix ptr to enum cast
power: supply: bq25980: Fix uninitialized wd_reg_val
power: supply: bq25980: remove redundant zero check on ret
power: reset: ocelot: Add support for Sparx5
dt-bindings: reset: ocelot: Add Sparx5 support
power: supply: sbs-battery: keep error code when get_property() fails
power: supply: bq25980: Add support for the BQ259xx family
dt-binding: bq25980: Add the bq25980 flash charger
power: supply: fix spelling mistake "unprecise" -> "imprecise"
power: supply: test_power: add missing newlines when printing parameters by sysfs
power: supply: pm2301: drop duplicated i2c_device_id
power: supply: charger-manager: drop unused charger assignment
power: supply: rt9455: skip 'struct acpi_device_id' when !CONFIG_ACPI
power: supply: goldfish: skip 'struct acpi_device_id' when !CONFIG_ACPI
power: supply: bq25890: skip 'struct acpi_device_id' when !CONFIG_ACPI
...
|
|
Looks like the I2C tunnel implementation from Chromebook's
embedded controller does not handle PEC correctly. Fix this
by disabling PEC for batteries behind those I2C tunnels as
a workaround.
Note, that some Chromebooks actually have been reported to
have working PEC support (with I2C tunnel). Since the problem
has not yet been fully understood this simply reverts all
Chromebooks to not use PEC for now.
Reported-by: "Milan P. Stanić" <mps@arvanta.net>
Reported-by: Vicente Bergas <vicencb@gmail.com>
CC: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Fixes: 7222bd603dd2 ("power: supply: sbs-battery: add PEC support")
Tested-by: Vicente Bergas <vicencb@gmail.com>
Tested-by: "Milan P. Stanić" <mps@arvanta.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Commit 395a7251dc2b (power: supply: sbs-battery: don't assume
i2c errors as battery disconnect) overwrites the original error code
returned from internal functions. On such a sporadic i2c error,
a user will get a wrong value without errors.
Fixes: 395a7251dc2b (power: supply: sbs-battery: don't assume i2c errors as battery disconnect)
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Current sbs-battery considers all smbus errors as disconnection events
when battery-detect pin isn't supplied, and restored to present state back
when any successful transaction is made.
This can lead to unwanted state changes between present and !present
when there's one i2c error and other following commands were successful.
This patch provides a unified way of checking presence by calling
sbs_get_battery_presence_and_health() when detect pin is not used.
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
This patch enables calling sbs_get_battery_presence_and_health()
without checking its chip type. No functional changes.
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Remove unused enable_detection flag which is always true after
the device is proved.
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
SBS batteries optionally have support for PEC. This enables
PEC handling based on the implemented SBS version as suggested
by the standard. The support for PEC is re-evaluated when the
battery is hotplugged into the system, since there might be
systems supporting batteries from different SBS generations.
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
The SBS battery implements SMBus block reads. Currently the
driver "emulates" this by doing an I2C byte read for the
length followed by an I2C block read. The I2C subsystem
actually provides a proper API for doing SMBus block reads,
which can and should be used instead. The current implementation
does not properly handle packet error checking (PEC).
Not all upstream systems using sbs-battery have I2C bus drivers
supporting I2C_M_RECV_LEN, so old implementation is kept as
fallback to keep things working. But this prints a warning,
which hopefully results in people implementing support for it.
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
The commit is a nice cleanup, but breaks booting on exynos5 based
chromebooks. It's seems to come down to exynos5's i2c driver not
implementing I2C_FUNC_SMBUS_READ_BLOCK_DATA. It's not yet clear
why that breaks boot / massively slows it down when userspace
starts, so revert the problematic patch.
This reverts commit c4b12a2f3f3de670f6be5e96092a2cab0b877f1a.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
This depends on the simplification of sbs_read_string_data, which
breaks booting exynos5 based chromebooks. More investigation is
required, so this patch and the simplification patch are reverted
for this merge window.
Note, that this is only a partial revert, since sbs_update_presence()
has not been removed. It is also required for the charger broadcast
disabling.
This reverts commit 79bcd5a4a66076a8a8dacd7f4a3be1952283aef4.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
sbs-battery does not use the ID parameter, so switch to i2c's
probe_new API.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Switch from DT specific of_property_* API to generic and more
modern device_property_* API.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
In certain designs, it is possible to add a battery on a populated i2c
bus without an sbs compliant charger. In that case, the battery will
unnecessarily and sometimes undesirably master the bus trying to write
info in the charger.
It is observed in many occasion that these battery "broadcasts" are even
corrupting other ongoing master to slave communication. I.e. the
multi-master support in the battery is inadequate.
Thankfully, the CHARGER_MODE bit allows designers to disable that SBS
battery behaviour.
This needs to be done once when the battery is first seen on the bus.
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
[rebased code]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
A battery, that is neither charged, nor discharged is not
always Full. If the charger is disabled for other reasons
it might simply be idle and should be marked accordingly.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Add support for reporting the SBS battery's condition flag
to userspace using the new "Calibration required" health status.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Expose the battery's manufacture date to userspace.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT/VOLTAGE_MAX support
Expose maximum charge current/voltage information requested
by the battery.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
This reads the battery chemistry from the battery chip instead
of incorrectly hardcoding the type to be Li-Ion.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Expose averaged current information, which is part of the SBS
standard and should be supported by all batteries.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
SBS batteries optionally have support for PEC. This enables
PEC handling based on the implemented SBS version as suggested
by the standard. The support for PEC is re-evaluated when the
battery is hotplugged into the system, since there might be
systems supporting batteries from different SBS generations.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
The SBS battery implements SMBus block reads. Currently the
driver "emulates" this by doing an I2C byte read for the
length followed by an I2C block read. The I2C subsystem
actually provides a proper API for doing SMBus block reads,
which can and should be used instead. The current implementation
does not properly handle packet error checking (PEC).
This change requires, that I2C bus drivers support I2C_M_RECV_LEN
or directly provide the SMBus API to access device manufacturer
and model name.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Add support for reporting the MaxError register from
battery fuel gauges following the smart battery standard.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Add support for BQ20Z65 manufacturer data to the sbs-battery
driver. Implementation has been verified using the public TRM
available from [0] and tested using a GE Flex 3S2P battery.
[0] http://www.ti.com/lit/pdf/sluu386
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
The "mode" variable is an enum and in this context GCC treats it as an
unsigned int so the error handling is never triggered.
Fixes: 51d075660457 ("bq20z75: Add support for charge properties")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
"Battery mode" is the name of the register, the bit manipulated by this
code is "CAPACITY_MODE" (Smart Battery System Specifications).
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Symbolic permissions 'S_IRUSR | S_IRGRP | S_IROTH' are not
preferred. Use octal permissions '0444'.
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
when the battery is set to sbs-mode and no gpio detection is enabled
"health" is always returning a value even when the battery is not present.
All other fields return "not present".
This leads to a scenario where the driver is constantly switching between
"present" and "not present" state. This generates a lot of constant
traffic on the i2c.
This commit changes the response of "health" to an error when the battery
is not responding leading to a consistent "not present" state.
Fixes: 76b16f4cdfb8 ("power: supply: sbs-battery: don't assume MANUFACTURER_DATA formats")
Cc: <stable@vger.kernel.org>
Signed-off-by: Michael Nosthoff <committed@heine.so>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
the type flag is stored in the chip->flags field not in the
client->flags field. This currently leads to never using the ti
specific health function as client->flags doesn't use that bit.
So it's always falling back to the general one.
Fixes: 76b16f4cdfb8 ("power: supply: sbs-battery: don't assume MANUFACTURER_DATA formats")
Cc: <stable@vger.kernel.org>
Signed-off-by: Michael Nosthoff <committed@heine.so>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Based on 3 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-or-later
has been chosen to replace the boilerplate/reference in 1105 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
This driver was originally submitted for the TI BQ20Z75 battery IC
(commit a7640bfa10c5 ("power_supply: Add driver for TI BQ20Z75 gas gauge
IC")) and later renamed to express generic SBS support. While it's
mostly true that this driver implemented a standard SBS command set, it
takes liberties with the REG_MANUFACTURER_DATA register. This register
is specified in the SBS spec, but it doesn't make any mention of what
its actual contents are.
We've sort of noticed this optionality previously, with commit
17c6d3979e5b ("sbs-battery: make writes to ManufacturerAccess
optional"), where we found that some batteries NAK writes to this
register.
What this really means is that so far, we've just been lucky that most
batteries have either been compatible with the TI chip, or else at least
haven't reported highly-unexpected values.
For instance, one battery I have here seems to report either 0x0000 or
0x0100 to the MANUFACTURER_ACCESS_STATUS command -- while this seems to
match either Wake Up (bits[11:8] = 0000b) or Normal Discharge
(bits[11:8] = 0001b) status for the TI part [1], they don't seem to
actually correspond to real states (for instance, I never see 0101b =
Charge, even when charging).
On other batteries, I'm getting apparently random data in return, which
means that occasionally, we interpret this as "battery not present" or
"battery is not healthy".
All in all, it seems to be a really bad idea to make assumptions about
REG_MANUFACTURER_DATA, unless we already know what battery we're using.
Therefore, this patch reimplements the "present" and "health" checks to
the following on most SBS batteries:
1. HEALTH: report "unknown" -- I couldn't find a standard SBS command
that gives us much useful here
2. PRESENT: just send a REG_STATUS command; if it succeeds, then the
battery is present
Also, we stop sending MANUFACTURER_ACCESS_SLEEP to non-TI parts. I have
no proof that this is useful and supported.
If someone explicitly provided a 'ti,bq20z75' compatible property, then
we continue to use the existing TI command behaviors, and we effectively
revert commit 17c6d3979e5b ("sbs-battery: make writes to
ManufacturerAccess optional") to again make these commands required.
[1] http://www.ti.com/lit/er/sluu265a/sluu265a.pdf
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
Since the return value is not checked anyhow, we don't need to store it.
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
|
|
Those variables are immediately assigned a value afterwards.
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
|
|
Currently when a gpio is defined for battery presence it is only used in
the sbs_get_battery_presence_and_health function for 2 properties.
All other properties currently try to read data form the battery before
returning an error if not present. We should know in advance that no
data is going to returned.
As the driver tries multiple times to access a property, this prevents
a lot of smbus accesses, which had a significant effect on device boot-up.
As when the device is registered lots of property accesses are attempted
during boot.
If no gpio is used for presence detection no change in behaviour should
occur.
Signed-off-by: Phil Reid <preid@electromag.com.au>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
|
|
At least with the Inspired Energy compatible batteries a delay is required
after setting the capacity mode bit from amp to watts or the reverse.
Setting the bit and then immediately pooling the status register results
in an unknown error being returned in the register. Add the delay results
in and ok status being return. This was also seen when reading the charge
and energy registers where the wrong value was returned for the requested
mode.
Signed-off-by: Phil Reid <preid@electromag.com.au>
Tested-by: Michael Heinemann <committed@heine.so>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
Sort the header includes prior to adding to the list.
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
checkpatch issued an error in having the FSF address in the comment.
As address may change and Linux already includes a copy.
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
The capacity mode bit is bit 15. Currently it is written as
default initialized enum and never shifted. This leads to
a behaviour where the BATTERY_MODE is not correctly
recognized and set again.
This commit initializes the enum accordingly.
Signed-off-by: Michael Heinemann <committed@heine.so>
Tested-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
According to the smart battery spec (1), the CAPACITY_MODE bit does not
influence the value read from RelativeStateOfCharge(), so don't bother
changing CAPACITY_MODE when doing such a read.
(1) - Smart Battery Data Specification, Rev 1.1, Dec. 11, 1998
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
A subset of smart battery commands return charge or energy depending on
the CAPACITY_MODE bit setting of BatteryMode(). In order to
unambiguously read a charge or energy value, it is necessary to ensure
that CAPACITY_MODE is set as desired, and not changed for the duration
of the attribute read.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|
|
i2c_smbus commands handle the correct byte order for smbus transactions
internally. This will currently result in incorrect operation on big
endian systems.
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
|