26 Dec, 2016
1 commit
-
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.Signed-off-by: Thomas Gleixner
Cc: Peter Zijlstra
15 Dec, 2016
1 commit
-
Pull power supply and reset updates from Sebastian Reichel:
- new driver for Intel PIIX4
- lots of module autoload fixes
- misc fixes
* tag 'for-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
power_supply: wm97xx_battery: use power_supply_get_drvdata
wm8350_power: use permission-specific DEVICE_ATTR variants
power: ipaq_micro_battery: fix alias
power: supply: bq27xxx_battery: Fix register map for BQ27510 and BQ27520
bq24190_charger: Fix PM runtime use for bq24190_battery_set_property
power: supply: lp8788: remove an unneeded NULL check
power: reset: zx-reboot: Fix module autoload
power: reset: syscon-reboot-mode: Fix module autoload
power: reset: at91-poweroff: Fix module autoload
power: reset: at91-reset: Fix module autoload
power: supply: axp288_fuel_gauge: Fix module autoload
power: supply: max8997_charger: Fix module autoload
power: supply: max17040: Change register transaction length from 8 bits to 16 bits
power: supply: bq27xxx_battery: don't update poll_interval param if same
power: supply: improve function-level documentation
power: reset: Add Intel PIIX4 poweroff driver
24 Nov, 2016
5 commits
-
As the power supply framework provides a way to store and retrieve
private supply data, use it.In the process, change the platform data for wm97xx_battery from a
container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata.Signed-off-by: Robert Jarzmik
Acked-by: Charles Keepax
Signed-off-by: Sebastian Reichel -
Use DEVICE_ATTR_RO for read only attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
//Signed-off-by: Julia Lawall
Acked-by: Charles Keepax
Signed-off-by: Sebastian Reichel -
The alias for the ipaq_micro_battery driver is incorrect, fix it so the
module can be auto-loaded.Signed-off-by: Russell King
Signed-off-by: Sebastian Reichel -
The BQ27510 and BQ27520 use a slightly different register map than the
BQ27500, add a new type enum and add these gauges to it.Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Based-on-patch-by: Kenneth R. Crudup
Signed-off-by: Andrew F. Davis
Signed-off-by: Sebastian Reichel -
There's a typo, it should do pm_runtime_get_sync, not put.
Fixes: d7bf353fd0aa3 ("bq24190_charger: Add support for TI BQ24190 Battery Charger")
Cc: Mark A. Greer
Signed-off-by: Tony Lindgren
Reviewed-by: Mark Greer
Signed-off-by: Sebastian Reichel
21 Oct, 2016
1 commit
-
When testing SD hotplug automatically, I got bunch of
useless log like this:[ 588.357838] mmc0: card 0007 removed
[ 589.492664] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3300000 done
[ 589.500698] vccio_sd: ramp_delay not set
[ 589.504817] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3300000 done
[ 589.669705] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3300000 done
[ 589.677593] vccio_sd: ramp_delay not set
[ 589.681581] rockchip-iodomain ff770000.syscon:io-domains: Setting to 1800000 done
[ 590.032820] dwmmc_rockchip ff0c0000.dwmmc: Successfully tuned phase to 140
[ 590.039725] mmc0: new ultra high speed SDR50 SDHC card at address 0007
[ 590.046641] mmcblk0: mmc0:0007 SD32G 29.3 GiB
[ 590.052163] mmcblk0: p1Moreover the code is intent to print the 'uV' for debug but
later print it using dev_info. It looks more like to me that
it should be the real intention of the code. Anyway, let's
mark this verbose log as debug message.Signed-off-by: Shawn Lin
Reviewed-by: Heiko Stuebner
Acked-by: Kevin Hilman
Signed-off-by: Rafael J. Wysocki
19 Oct, 2016
10 commits
-
We checked that "pdata->chg_params" is non-NULL earlier in this function
so when we add "i" to it, it's still non-NULL.Signed-off-by: Dan Carpenter
Acked-by: Milo Kim
Signed-off-by: Sebastian Reichel -
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/power/reset/zx-reboot.ko | grep alias
$After this patch:
$ modinfo drivers/power/reset/zx-reboot.ko | grep alias
alias: of:N*T*Czte,sysctrlC*
alias: of:N*T*Czte,sysctrlSigned-off-by: Javier Martinez Canillas
Signed-off-by: Sebastian Reichel -
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/power/reset/syscon-reboot-mode.ko | grep alias
$After this patch:
$ modinfo drivers/power/reset/syscon-reboot-mode.ko | grep alias
alias: of:N*T*Csyscon-reboot-modeC*
alias: of:N*T*Csyscon-reboot-modeSigned-off-by: Javier Martinez Canillas
Signed-off-by: Sebastian Reichel -
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/power/reset/at91-poweroff.ko | grep alias
$After this patch:
$ modinfo drivers/power/reset/at91-poweroff.ko | grep alias
alias: of:N*T*Catmel,at91sam9x5-shdwcC*
alias: of:N*T*Catmel,at91sam9x5-shdwc
alias: of:N*T*Catmel,at91sam9rl-shdwcC*
alias: of:N*T*Catmel,at91sam9rl-shdwc
alias: of:N*T*Catmel,at91sam9260-shdwcC*
alias: of:N*T*Catmel,at91sam9260-shdwcSigned-off-by: Javier Martinez Canillas
Signed-off-by: Sebastian Reichel -
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/power/reset/at91-reset.ko | grep alias
$After this patch:
$ modinfo drivers/power/reset/at91-reset.ko | grep alias
alias: of:N*T*Catmel,sama5d3-rstcC*
alias: of:N*T*Catmel,sama5d3-rstc
alias: of:N*T*Catmel,at91sam9g45-rstcC*
alias: of:N*T*Catmel,at91sam9g45-rstc
alias: of:N*T*Catmel,at91sam9260-rstcC*
alias: of:N*T*Catmel,at91sam9260-rstc
alias: platform:at91-sam9g45-reset
alias: platform:at91-sam9260-resetSigned-off-by: Javier Martinez Canillas
Signed-off-by: Sebastian Reichel -
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/power/supply/axp288_fuel_gauge.ko | grep alias
$After this patch:
$ modinfo drivers/power/supply/axp288_fuel_gauge.ko | grep alias
alias: platform:axp288_fuel_gaugeSigned-off-by: Javier Martinez Canillas
Signed-off-by: Sebastian Reichel -
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/power/supply/max8997_charger.ko | grep alias
$After this patch:
$ modinfo drivers/power/supply/max8997_charger.ko | grep alias
alias: platform:max8997-batterySigned-off-by: Javier Martinez Canillas
Signed-off-by: Sebastian Reichel -
According to the datasheet, MAX17040 has six 16-bit registers.
Register reads and writes are only valid if all 16 bits are transferred.
Any write command that is terminated early is ignored.
So it's better to change register transacton length from 8 bits to 16 bits.Signed-off-by: Liu Xiang
Signed-off-by: Sebastian Reichel -
To avoid canceling the delayed workqueue needlessly, and scheduling an
immediate polling. Check if the new poll_interval value is different
than the previous setting.Cc: Tony Lindgren
Cc: Sebastian Reichel
Signed-off-by: Matt Ranostay
Signed-off-by: Sebastian Reichel -
In drivers/power/supply/ab8500_fg.c, fix two typos and adjust the function
name in two cases to correspond to the names of the defined functions.In drivers/power/supply/power_supply_core.c, change two variable names to
the names of the corresponding parameters.Issue detected using Coccinelle (http://coccinelle.lip6.fr/)
Signed-off-by: Julia Lawall
Signed-off-by: Sebastian Reichel
18 Oct, 2016
1 commit
-
Add a driver which allows powering off the system via an Intel PIIX4
southbridge, by entering the PIIX4 SOff state. This is useful on the
MIPS Malta development board, where it will power down the FPGA based
board until its ON/NMI button is pressed, or the QEMU implementation of
the MIPS Malta board where it will cause QEMU to exit.Signed-off-by: Paul Burton
Cc: Sebastian Reichel
Cc: Dmitry Eremin-Solenikov
Cc: David Woodhouse
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Reichel
07 Oct, 2016
1 commit
-
Pull power supply and reset updates from Sebastian Reichel:
- move power supply drivers to drivers/power/supply
- unify location of power supply DT documentation
- tps65217-charger: IRQ support
- act8945a-charger: misc. cleanups & improvements
- sbs-battery cleanup
- fix users of deprecated create_singlethread_workqueue()
- misc fixes.* tag 'for-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (46 commits)
power: supply: bq27xxx_battery: allow kernel poll_interval parameter runtime update
power: supply: sbs-battery: Cleanup removal of chip->pdata
power: reset: st: Remove obsolete platforms from dt doc
power: reset: st-poweroff: Remove obsolete platforms.
power: reset: zx-reboot: Unmap region obtained by of_iomap
power: reset: xgene-reboot: Unmap region obtained by of_iomap
power: supply: ab8500: cleanup with list_first_entry_or_null()
power: reset: add in missing white space in error message text
sbs-battery: make writes to ManufacturerAccess optional
power: bq24257: Fix use of uninitialized pointer bq->charger
power: supply: sbs-battery: simplify DT parsing
power: supply: bq24735-charger: Request status GPIO with initial input setup
power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect
power: supply: act8945a_charger: Add max current property
power: supply: act8945a_charger: Add capacity level property
doc: bindings: power: act8945a-charger: Update properties.
power: supply: act8945a_charger: Fix the power supply type
power: supply: act8945a_charger: Add status change update support
power: supply: act8945a_charger: Improve state handling
power: supply: act8945a_charger: Remove "battery_temperature"
...
21 Sep, 2016
2 commits
-
Fix issue with poll_interval being not updated till the previous
interval expired.Cc: Tony Lindgren
Cc: Liam Breck
Signed-off-by: Matt Ranostay
Signed-off-by: Sebastian Reichel -
There where still a few lingering references to pdata after commit
power: supply: sbs-battery: simplify DT parsing.Remove pdata from struct·sbs_info and conditional checks to ser if this
was set from the i2c read / write functions.
Instead of call max in each function for incrementing poll_retry_count
do it once in the probe function.
Fixup null pointer dereference in to pdata in sbs_external_power_changed.
Change retry counts to u32 to avoid need for max.Signed-off-by: Phil Reid
Signed-off-by: Sebastian Reichel
20 Sep, 2016
7 commits
-
This patch removes support for STiH415/6 SoC's from the
st-poweroff driver, as support for these platforms is
being removed from the kernel.Signed-off-by: Peter Griffin
Cc:
Signed-off-by: Sebastian Reichel -
Free memory mapping, if probe is not successful.
Signed-off-by: Arvind Yadav
Signed-off-by: Sebastian Reichel -
Free memory mapping, if probe is not successful.
Signed-off-by: Arvind Yadav
Signed-off-by: Sebastian Reichel -
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().Signed-off-by: Masahiro Yamada
Signed-off-by: Sebastian Reichel -
A dev_err message spans two lines and the literal string is missing
a white space between words. Add the white space.Signed-off-by: Colin Ian King
Signed-off-by: Sebastian Reichel -
According to the Smart Battery Data Specification, the use
of ManufacturerAcess (register 0x0) is implementation-defined.
It appears that some batteries use writes to this register
in order to implement certain functionality, but others may
simply NAK all writes to it. As a result, write failures to
ManufacturerAccess should not be used as an indicator of
battery presence, nor as a failure to enter sleep mode.The failed write access was seen with SANYO AP13J3K.
Cc: Brian Norris
Signed-off-by: Guenter Roeck
Signed-off-by: Sebastian Reichel -
bq->charger is initialized in bq24257_power_supply_init.
Therefore, bq24257_power_supply_init should be called before the
registration of the IRQ handler bq24257_irq_handler_thread that calls
power_supply_changed(bq->charger).Signed-off-by: Georges Savoundararadj
Cc: Aurelien Chanot
Cc: Andreas Dannenberg
Cc: Sebastian Reichel
Cc: David Woodhouse
Fixes: 2219a935963e ("power_supply: Add TI BQ24257 charger driver")
Signed-off-by: Sebastian Reichel
13 Sep, 2016
1 commit
-
Use a more common logging style.
Miscellanea:
o Use pr_warn
o Coalesce formats adding missing spaces
o Argument alignment
o Remove unnecessary OOM messages as k.alloc does stack dumpsSigned-off-by: Joe Perches
Acked-by: Nishanth Menon
[khilman: update shortlog]
Signed-off-by: Kevin Hilman
Signed-off-by: Rafael J. Wysocki
07 Sep, 2016
1 commit
-
After the change to use the gpio descriptor interface, we get a warning if
-Wmaybe-uninitialized is added back to the build flags (it is currently
disabled:drivers/power/supply/sbs-battery.c: In function 'sbs_probe':
drivers/power/supply/sbs-battery.c:760:28: error: 'pdata' may be used uninitialized in this function [-Werror=maybe-uninitialized]The problem is that if neither the DT properties nor a platform_data
pointer are provided, the chip->pdata pointer gets set to an uninitialized
value.Looking at the code some more, I found that the sbs_of_populate_pdata
function is more complex than necessary and has confusing calling
conventions of possibly returning a valid pointer, a NULL pointer
or an ERR_PTR pointer (in addition to the uninitialized pointer).To fix all of that, this gets rid of the chip->pdata pointer and
simply moves the two integers into the sbs_info structure. This
makes it much clearer from reading sbs_probe() what the precedence
of the three possible values are (pdata, DT, hardcoded defaults)
and completely avoids the #ifdef CONFIG_OF guards as
of_property_read_u32() gets replaced with a compile-time stub
when that is disabled, and returns an error if passed a NULL of_node
pointer.Signed-off-by: Arnd Bergmann
Fixes: 3b5dd3a49496 ("power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect")
Signed-off-by: Sebastian Reichel
05 Sep, 2016
1 commit
-
This requests the status GPIO with initial input setup. It is required
to read the GPIO status at probe time and thus correctly avoid sending
I2C messages when AC is not plugged.When requesting the GPIO without initial input setup, it always reads 0
which causes probe to fail as it assumes the charger is connected, sends
I2C messages and fails.While at it, this switches the driver over to gpiod API.
Signed-off-by: Paul Kocialkowski
Signed-off-by: Sebastian Reichel
01 Sep, 2016
3 commits
-
Switch to using new gpio_desc interface and devm gpio get calls to
automatically manage gpio resource. Use gpiod_get_value which handles
active high / low calls.If gpio_detect is set then force loading of the driver as it is
reasonable to assume that the battery may not be present.Update the is_present flag immediately in the IRQ.
Remove legacy gpio specification from platform data.
Signed-off-by: Phil Reid
Signed-off-by: Sebastian Reichel -
Add the power supply's current max property,
POWER_SUPPLY_PROP_CURRENT_MAX.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
Add the power supply capacity level property, it corresponds to
POWER_SUPPLY_CAPACITY_LEVEL_*.It also utilizes the precision voltage detector function module
to catch the low battery voltage.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel
31 Aug, 2016
5 commits
-
The power supply type property is varying as the external power
supply changes. It is not a constant.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
Add the charger status change interrupt support, it will report
the power supply changed event.This interrupt is generated by one of the conditions as below:
- the state machine jumps out of or into the EOC state
- the CHGIN input voltage goes out of or into the valid range.
- the battery temperature goes out of or into the valid range.
- the PRECHARGE time-out occurs.
- the total charge time-out occurs.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
When get the property, first check the charger state machine,
then check the status bit to decide what value is assigned to
the corresponding property.Retain the SUSCHG bit of REG 0x71 when configure the timers to
avoid losting the charger suspending info after boot.Signed-off-by: Wenyou Yang
Signed-off-by: Fengguang Wu
Signed-off-by: Sebastian Reichel -
Remove "battery_temperature" member, it is redundant, it is the
hardware's responsibility to handle TH pin properly.
It is unnecessary to use the dt property to check if there is
a battery temperature monitor or not.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
Since the act8945a_charger is regarded as a sub-device, all properties will
be assigned to its own device node. All properties can be achieved from its
own node, instead of from its parent device.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel