- 31 Aug, 2017 1 commit
-
-
H. Nikolaus Schaller authored
Tested on Pyra prototype with bq27421. Signed-off-by:
H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 30 Aug, 2017 2 commits
-
-
Hans de Goede authored
On some devices the USB Type-C port power (USB PD 2.0) negotiation is done by a separate port-controller IC, while the current limit is controlled through another (charger) IC. It has been decided to model this by modelling the external Type-C power brick (adapter/charger) as a power-supply class device which supplies the charger-IC, with its voltage-now and current-max representing the negotiated voltage and max current draw. This commit adds support for this to the bq24190_charger driver by adding an external_power_changed callback and calling power_supply_set_input_current_limit_from_supplier from this callback. This callback will only get called if the bq24190 has a parent-supply. Note this replaces the functionality to get the current-limit from an extcon device, which will be removed in a follow-up commit. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Tony Lindgren <tony@atomide.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Hans de Goede authored
Register the 5V boost converter as a regulator named "usb_otg_vbus". This commit also adds support for bq24190_platform_data, through which non device-tree platforms can pass the regulator_init_data (containing mappings for the consumer amongst other things). Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Acked-by:
Tony Lindgren <tony@atomide.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 29 Aug, 2017 12 commits
-
-
Liam Breck authored
Set pre-charge and charge-term current, obtained from power_supply_battery_info. Add sysfs attributes precharge_current & charge_term_current. Cc: Hans de Goede <hdegoede@redhat.com> Acked-by:
Tony Lindgren <tony@atomide.com> Signed-off-by:
Liam Breck <kernel@networkimprov.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
Set minimum system voltage limit obtained from device property. Cc: Hans de Goede <hdegoede@redhat.com> Acked-by:
Tony Lindgren <tony@atomide.com> Signed-off-by:
Liam Breck <kernel@networkimprov.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
Add get_config(). Rename set_mode_host() to set_config(). Call get_config() and hw_init() after power_supply_register(). No functional changes. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Liam Breck <kernel@networkimprov.net> Acked-by:
Tony Lindgren <tony@atomide.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
Document monitored-battery and ti,system-minimum-microvolt properties. Cc: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Signed-off-by:
Liam Breck <kernel@networkimprov.net> Acked-by:
Tony Lindgren <tony@atomide.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
BQ2751X & BQ27510G3 have identical regs & props. BQ2750X & BQ27510G3 have identical props. BQ27500 & BQ27510G1 & BQ27510G2 have identical regs & props. BQ27500 & BQ27520G2 have identical props. Remove the duplicate arrays. No functional changes to the driver. Signed-off-by:
Liam Breck <kernel@networkimprov.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
Support data memory update on BQ27425. Parameters from TI datasheets are also provided for BQ27500, 545, 421, 441, 621; however these are commented out, as they are not tested. Add BQ27XXX_O_CFGUP & _O_RAM for use in bq27xxx_chip_data[n].opts and by data memory update functions. Signed-off-by:
Liam Breck <kernel@networkimprov.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
For the existing features, these chips act like others already ID'd, so they had false but functional IDs. We will be adding features which require correct IDs, so the following IDs are added: BQ2752X, 531, 542, 546, 742, 425, 441, 621 Chip-specific features are now tracked by BQ27XXX_O_* flags in di->opts. No functional changes to the driver. Signed-off-by:
Liam Breck <kernel@networkimprov.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
To support new features which require different data for each chip, we unify the bq27xxx_regs and bq27xxx_battery_props tables into a single one. No functional changes to the driver. Signed-off-by:
Liam Breck <kernel@networkimprov.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Liam Breck authored
bq24192i was previously only in ID table, so add it to DT table. Cc: Tony Lindgren <tony@atomide.com> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Liam Breck <kernel@networkimprov.net> Acked-by:
Tony Lindgren <tony@atomide.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Hans de Goede authored
Export the input current limit of the charger as a POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT property on the charger power_supply class device. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Hans de Goede authored
On some devices the USB Type-C port power (USB PD 2.0) negotiation is done by a separate port-controller IC, while the current limit is controlled through another (charger) IC. It has been decided to model this by modelling the external Type-C power brick (adapter/charger) as a power-supply class device which supplies the charger-IC, with its voltage-now and current-max representing the negotiated voltage and max current draw. This commit adds a power_supply_set_input_current_limit_from_supplier helper function which charger power-supply drivers can call to get the max-current from their supplier and have this applied through their set_property call-back to their input-current-limit. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Hans de Goede authored
Fix drivers/power/supply/max17042_battery.c:1059:6: warning: 'acpi_id' may be used uninitialized in this function. No idea why my gcc version did not catch this. Reported-by:
kbuild test robot <fengguang.wu@intel.com> Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 28 Aug, 2017 4 commits
-
-
Markus Elfring authored
power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies() Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by:
Markus Elfring <elfring@users.sourceforge.net> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Bhumika Goyal authored
Make these const as they are only passed as an argument to the function device_create_file and device_remove_file and the corresponding arguments are of type const. Done using Coccinelle. Signed-off-by:
Bhumika Goyal <bhumirks@gmail.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Hans de Goede authored
On some x86/ACPI boards the DSDT defines an ACPI event handler for the max17047 IRQ, this causes several problems: 1) We need to share the IRQ to avoid an error getting it 2) Even of we are willing to share, we may fail to share because some DSDTs claim it exclusivly 3) If we are unable to share the IRQ, or the IRQ is only listed as an ACPI event source and not in the max1704 firmware node, then the charge threshold IRQ (which is used to give an IRQ every 1 percent charge change) becomes a problem, the ACPI event handler will not update this to the next 1 percent threshold, so the IRQ keeps firing and we get an IRQ storm pegging 1 CPU core. This happens despite the max17042 driver not setting the charge threshold because Windows uses it and leaves it set on reboot. So if we are unable to get the IRQ we need to reprogram the charge threshold to its disabled setting. This commit fixes al of the above, while at it it also makes the error msg when being unable to get the IRQ consistent with other messages. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Hans de Goede authored
Some x86 devices enumerate a max17047 fuel-gauge through a MAX17047 ACPI firmware-node, add support for this. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 12 Aug, 2017 1 commit
-
-
Colin Ian King authored
Don't populate various read only arrays on the stack but make them static const, making the object code smaller and saves 148 bytes overall: Before: text data bss dec hex filename 11940 4496 64 16500 4074 lp8788-charger.o After: text data bss dec hex filename 11472 4816 64 16352 3fe0 lp8788-charger.o Signed-off-by:
Colin Ian King <colin.king@canonical.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 11 Aug, 2017 3 commits
-
-
Christophe JAILLET authored
Use 'sizeof(*var)' instead of the equivalent 'sizeof(data structure type)' because it is less verbose. Signed-off-by:
Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Christophe JAILLET authored
Update a comment which is no more up to date since commit 2ed9e9b6. Signed-off-by:
Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Christophe JAILLET authored
'devm_kzalloc()' can return NULL. Return -ENOMEM in this case in order to avoid a NULL pointer dereference later on. Signed-off-by:
Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 09 Aug, 2017 2 commits
-
-
Hans de Goede authored
Commit 2848e039 ("power: supply: Make power_supply_am_i_supplied return -ENODEV if there are no suppliers") was supposed to make power_supply_am_i_supplied() return -ENODEV when there are no supplies which supply the supply passed to it. But instead it will only return -ENODEV when there are no supplies at all as data->count++; is incremented on every call of the iterator, rather then only when __power_supply_is_supplied_by returns true. This commit fixes this. Fixes: 2848e039 ("power: supply: Make power_supply_am_i_supplied ...") Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Bhumika Goyal authored
Add const to bin_attribute structures as they are only passed to the functions sysfs_{remove/create}_bin_file or device_{remove/create}_bin_file. The corresponding parameters passed are of type const, so declare the structures to be const. Done using Coccinelle: @M disable optional_qualifier@ identifier s; position p; @@ static struct bin_attribute s@p={...}; @okay1@ position p; identifier m.s; @@ ( sysfs_create_bin_file(...,&s@p,...) | sysfs_remove_bin_file(...,&s@p,...) ) @bad@ position p!={m.p,okay1.p}; identifier m.s; @@ s@p @change depends on !bad disable optional_qualifier@ identifier m.s; @@ static +const struct bin_attribute s={...}; Same script was modified for device_{create/remove}_bin_file functions. Signed-off-by:
Bhumika Goyal <bhumirks@gmail.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
- 25 Jul, 2017 9 commits
-
-
Andrew F. Davis authored
When the BQ27xxx driver was originally written the w1 subsystem only allowed device drivers for w1 attached devices to live in the w1 subsystem. Kernel driver subsystems expect that the driver for a device live in the directory of the subsystem for which it implements functionality, not in the directory of the bus that it is attached. To work around this, the BQ27xxx driver was implemented as a platform device driver and the interface driver would instantiate this device from within the w1 directory, then pass a w1 read callback as platform data. As we can now have the w1 interface driver in the power/supply directory (like we do already with the i2c interface driver) we can remove this middle-layer platform driver. Signed-off-by:
Andrew F. Davis <afd@ti.com> Acked-by:
Pali Rohár <pali.rohar@gmail.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Sebastian Reichel authored
Merge immutable branch moving bq27000 driver from w1 subsystem into power-supply subsystem. Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Andrew F. Davis authored
The HDQ interface driver should be in this folder just like the I2C interface driver. Move this driver out of drivers/w1/slave and into drivers/power/supply. Signed-off-by:
Andrew F. Davis <afd@ti.com> Acked-by:
Pali Rohár <pali.rohar@gmail.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Dragos Bogdan authored
LTC2944 is compatible with LTC2943, but uses different voltage and current computing constants. Signed-off-by:
Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by:
Ladislav Michl <ladis@linux-mips.org> Tested-by:
Dragos Bogdan <dragos.bogdan@analog.com> Acked-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Ladislav Michl authored
LTC2942 is pin compatible with LTC2941 providing additional informations about battery voltage and temperature. It can be runtime detected using bit A7 in the Status register. Signed-off-by:
Ladislav Michl <ladis@linux-mips.org> Acked-by:
Rob Herring <robh@kernel.org> Acked-by:
Dragos Bogdan <dragos.bogdan@analog.com> Tested-by:
Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Ladislav Michl authored
In order to support LTC2942 which has temperature registers at different offsets than LTC2943 use following register naming scheme (prefixes): - LTC294X_ common registers - LTC2942_ chips specific registers - LTC2943_ specific registers LTC2944 is compatible with LTC2943 but uses different constants to compute voltage and current, so replace num_regs misused for device indentification with real device id to discriminate between those two. There are no functional changes. Signed-off-by:
Ladislav Michl <ladis@linux-mips.org> Acked-by:
Dragos Bogdan <dragos.bogdan@analog.com> Tested-by:
Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Phil Reid authored
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>
-
Phil Reid authored
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>
-
Phil Reid authored
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>
-
- 24 Jul, 2017 6 commits
-
-
Sebastian Reichel authored
Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Alex A. Mihaylov authored
The MAX17211 monitor a single cell pack. The MAX17215 monitor and balance a 2S or 3S pack or monitor a multiple-series cell pack. Both device use 1-Wire interfce. Signed-off-by:
Alex A. Mihaylov <minimumlaw@rambler.ru> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Arvind Yadav authored
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. File size before: text data bss dec hex filename 2673 400 0 3073 c01 power/supply/pcf50633-charger.o File size After adding 'const': text data bss dec hex filename 2737 336 0 3073 bed power/supply/pcf50633-charger.o Signed-off-by:
Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Rob Herring authored
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by:
Rob Herring <robh@kernel.org> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: linux-pm@vger.kernel.org Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Sergei Shtylyov authored
of_irq_get() may return any negative error number as well as 0 on failure, while the driver only checks for -EPROBE_DEFER, blithely continuing with the call to devm_request_irq() -- that function expects *unsigned int*, so would probably fail anyway when a large IRQ number resulting from a conversion of a negative error number is passed to it... This, however, is incorrect behavior -- error number is not IRQ number. Check for 'irq <= 0' instead and return -ENXIO from probe if of_irq_get() returned 0. Fixes: a09209ac ("power: supply: act8945a_charger: Add status change update support") Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-
Arnd Bergmann authored
When CONFIG_OMAP_USB2 is set to 'm' and the charger driver is built-in, we get this link failure: drivers/power/supply/cpcap-charger.o: In function `cpcap_charger_probe': cpcap-charger.c:(.text+0x48c): undefined reference to `omap_usb2_set_comparator' drivers/power/supply/cpcap-charger.o: In function `cpcap_charger_remove': cpcap-charger.c:(.text+0x774): undefined reference to `omap_usb2_set_comparator' This adds a dependency to prevent that problem, while still allowing compile-testing with the OMAP_USB2 driver completely disabled. Fixes: 0c9888e3 ("power: supply: cpcap-charger: Add minimal CPCAP PMIC battery charger") Signed-off-by:
Arnd Bergmann <arnd@arndb.de> Signed-off-by:
Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-