summaryrefslogtreecommitdiff
path: root/include/linux/mfd/abx500
AgeCommit message (Collapse)Author
2016-07-12mfd: db8500 stop passing around platform dataArnd Bergmann
Except for the constant DB8500_PRCMU_FW_VERSION_OFFSET number, nothing is ever passed through the platform data and used in a driver, so we can simply stop passing it around. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2015-03-13power_supply: Change ownership from driver to coreKrzysztof Kozlowski
Change the ownership of power_supply structure from each driver implementing the class to the power supply core. The patch changes power_supply_register() function thus all drivers implementing power supply class are adjusted. Each driver provides the implementation of power supply. However it should not be the owner of power supply class instance because it is exposed by core to other subsystems with power_supply_get_by_name(). These other subsystems have no knowledge when the driver will unregister the power supply. This leads to several issues when driver is unbound - mostly because user of power supply accesses freed memory. Instead let the core own the instance of struct 'power_supply'. Other users of this power supply will still access valid memory because it will be freed when device reference count reaches 0. Currently this means "it will leak" but power_supply_put() call in next patches will solve it. This solves invalid memory references in following race condition scenario: Thread 1: charger manager Thread 2: power supply driver, used by charger manager THREAD 1 (charger manager) THREAD 2 (power supply driver) ========================== ============================== psy = power_supply_get_by_name() Driver unbind, .remove power_supply_unregister() Device fully removed psy->get_property() The 'get_property' call is executed in invalid context because the driver was unbound and struct 'power_supply' memory was freed. This could be observed easily with charger manager driver (here compiled with max17040 fuel gauge): $ cat /sys/devices/virtual/power_supply/cm-battery/capacity & $ echo "1-0036" > /sys/bus/i2c/drivers/max17040/unbind [ 55.725123] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 55.732584] pgd = d98d4000 [ 55.734060] [00000000] *pgd=5afa2831, *pte=00000000, *ppte=00000000 [ 55.740318] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM [ 55.746210] Modules linked in: [ 55.749259] CPU: 1 PID: 2936 Comm: cat Tainted: G W 3.19.0-rc1-next-20141226-00048-gf79f475f3c44-dirty #1496 [ 55.760190] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 55.766270] task: d9b76f00 ti: daf54000 task.ti: daf54000 [ 55.771647] PC is at 0x0 [ 55.774182] LR is at charger_get_property+0x2f4/0x36c [ 55.779201] pc : [<00000000>] lr : [<c034b0b4>] psr: 60000013 [ 55.779201] sp : daf55e90 ip : 00000003 fp : 00000000 [ 55.790657] r10: 00000000 r9 : c06e2878 r8 : d9b26c68 [ 55.795865] r7 : dad81610 r6 : daec7410 r5 : daf55ebc r4 : 00000000 [ 55.802367] r3 : 00000000 r2 : daf55ebc r1 : 0000002a r0 : d9b26c68 [ 55.808879] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 55.815994] Control: 10c5387d Table: 598d406a DAC: 00000015 [ 55.821723] Process cat (pid: 2936, stack limit = 0xdaf54210) [ 55.827451] Stack: (0xdaf55e90 to 0xdaf56000) [ 55.831795] 5e80: 60000013 c01459c4 0000002a c06f8ef8 [ 55.839956] 5ea0: db651000 c06f8ef8 daebac00 c04cb668 daebac08 c0346864 00000000 c01459c4 [ 55.848115] 5ec0: d99eaa80 c06f8ef8 00000fff 00001000 db651000 c027f25c c027f240 d99eaa80 [ 55.856274] 5ee0: d9a06c00 c0146218 daf55f18 00001000 d99eaa80 db4c18c0 00000001 00000001 [ 55.864468] 5f00: daf55f80 c0144c78 c0144c54 c0107f90 00015000 d99eaab0 00000000 00000000 [ 55.872603] 5f20: 000051c7 00000000 db4c18c0 c04a9370 00015000 00001000 daf55f80 00001000 [ 55.880763] 5f40: daf54000 00015000 00000000 c00e53dc db4c18c0 c00e548c 0000000d 00008124 [ 55.888937] 5f60: 00000001 00000000 00000000 db4c18c0 db4c18c0 00001000 00015000 c00e5550 [ 55.897099] 5f80: 00000000 00000000 00001000 00001000 00015000 00000003 00000003 c000f364 [ 55.905239] 5fa0: 00000000 c000f1a0 00001000 00015000 00000003 00015000 00001000 0001333c [ 55.913399] 5fc0: 00001000 00015000 00000003 00000003 00000002 00000000 00000000 00000000 [ 55.921560] 5fe0: 7fffe000 be999850 0000a225 b6f3c19c 60000010 00000003 00000000 00000000 [ 55.929744] [<c034b0b4>] (charger_get_property) from [<c0346864>] (power_supply_show_property+0x48/0x20c) [ 55.939286] [<c0346864>] (power_supply_show_property) from [<c027f25c>] (dev_attr_show+0x1c/0x48) [ 55.948130] [<c027f25c>] (dev_attr_show) from [<c0146218>] (sysfs_kf_seq_show+0x84/0x104) [ 55.956298] [<c0146218>] (sysfs_kf_seq_show) from [<c0144c78>] (kernfs_seq_show+0x24/0x28) [ 55.964536] [<c0144c78>] (kernfs_seq_show) from [<c0107f90>] (seq_read+0x1b0/0x484) [ 55.972172] [<c0107f90>] (seq_read) from [<c00e53dc>] (__vfs_read+0x18/0x4c) [ 55.979188] [<c00e53dc>] (__vfs_read) from [<c00e548c>] (vfs_read+0x7c/0x100) [ 55.986304] [<c00e548c>] (vfs_read) from [<c00e5550>] (SyS_read+0x40/0x8c) [ 55.993164] [<c00e5550>] (SyS_read) from [<c000f1a0>] (ret_fast_syscall+0x0/0x48) [ 56.000626] Code: bad PC value [ 56.011652] ---[ end trace 7b64343fbdae8ef1 ]--- Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> [for the nvec part] Reviewed-by: Marc Dietrich <marvin24@gmx.de> [for compal-laptop.c] Acked-by: Darren Hart <dvhart@linux.intel.com> [for the mfd part] Acked-by: Lee Jones <lee.jones@linaro.org> [for the hid part] Acked-by: Jiri Kosina <jkosina@suse.cz> [for the acpi part] Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-01-21power: ab8500_fg.c: Remove unused functionRickard Strandqvist
Remove the function ab8500_fg_reinit() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-11-25mfd: ab8500-sysctrl: Drop ab8500_restartGuenter Roeck
ab8500_restart is not called from anywhere in the kernel, so drop it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-21mfd: ab8500-debugfs: BIG clean-upLee Jones
When checkpatch is run on ab8500-debugfs.c it screamed blue murder! This patch fixes up all of the errors/warnings reported: WARNING: line over 80 characters + err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... + printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n", WARNING: Prefer seq_puts to seq_printf + seq_printf(s, AB8500_NAME_STRING " register values:\n"); WARNING: Prefer seq_puts to seq_printf + seq_printf(s, AB8500_NAME_STRING " register values:\n"); WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... + printk(KERN_INFO"ab8500 register values:\n"); WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... + printk(KERN_INFO" bank 0x%02X:\n", i); WARNING: externs should be avoided in .c files +extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); WARNING: quoted string split across lines + pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" " + "for crash analyze.\n"); WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... + printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__); WARNING: Prefer seq_puts to seq_printf + seq_printf(s, "name: number: number of: wake:\n"); WARNING: line over 80 characters + return single_open(file, ab8500_print_modem_registers, inode->i_private); WARNING: line over 80 characters + return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private); WARNING: line over 80 characters + return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private); WARNING: line over 80 characters + vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS, WARNING: line over 80 characters +static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p) WARNING: line over 80 characters +static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = { WARNING: line over 80 characters + vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h); WARNING: quoted string split across lines + dev_err(dev, "debugfs error input: " + "should be egal to 1, 4, 8 or 16\n"); WARNING: Missing a blank line after declarations + char *s = b; + if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) { WARNING: simple_strtoul is obsolete, use kstrtoul instead + loc.mask = simple_strtoul(b, &b, 0); WARNING: simple_strtol is obsolete, use kstrtol instead + loc.shift = simple_strtol(b, &b, 0); WARNING: simple_strtoul is obsolete, use kstrtoul instead + loc.bank = simple_strtoul(b, &b, 0); WARNING: simple_strtoul is obsolete, use kstrtoul instead + loc.addr = simple_strtoul(b, &b, 0); WARNING: simple_strtoul is obsolete, use kstrtoul instead + val = simple_strtoul(b, &b, 0); WARNING: quoted string split across lines + pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d" + "value=0x%X\n", (write) ? "write" : "read", WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... + printk(KERN_ERR "sysfs_create_file failed %d\n", err); WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... + printk(KERN_ERR "request_threaded_irq failed %d, %lu\n", ERROR: code indent should use tabs where possible + err, user_val);$ WARNING: please, no spaces at the start of a line + err, user_val);$ WARNING: Missing a blank line after declarations + struct resource *res; + debug_bank = AB8500_MISC; ERROR: space required after that ',' (ctx:VxV) + sizeof(*dev_attr)*num_irqs,GFP_KERNEL); ^ WARNING: return of an errno should typically be -ve (return -ENXIO) + return ENXIO; WARNING: line over 80 characters + file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops); WARNING: line over 80 characters + file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP), WARNING: line over 80 characters + ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops); total: 2 errors, 44 warnings, 3230 lines checked Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-04mfd: dbx500/abx500: root out hardcoded IRQ assignmentsLinus Walleij
The DBx500 and ABx500 should be getting their IRQs from the device tree and nowhere else. Get rid of all the static assignments everywhere, delete it from the driver, platform data and the board files in one swift strike. Lots of cross-dependencies in the MFD drivers for PRCMU and AB8500 makes it necessary to strike everywhere at once to eradicate IRQs passed as resources and platform data to the left and right around the platform. Cc: Mark Brown <broonie@kernel.org> Cc: Samuel Ortiz <sameo@linux.intel.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-01-21mfd/pinctrl: Delete platform data headerLinus Walleij
This deletes the special AB8500 GPIO platform data passing header and merges the few remaining contents down into the abx500 pinctrl driver which handles the abx500 GPIO device. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21mfd: ab8500: Delete all GPIO platform data instancesLinus Walleij
This deletes all instances where the AB8500 GPIO platform data is passed around. It is completely unused in the kernel now, so it does not hurt anyone. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-07-10Merge tag 'mfd-3.11-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next Pull MFD update from Samuel Ortiz: "For the 3.11 merge we only have one new MFD driver for the Kontron PLD. But we also have: - Support for the TPS659038 PMIC from the palmas driver. - Intel's Coleto Creek and Avoton SoCs support from the lpc_ich driver. - RTL8411B support from the rtsx driver. - More DT support for the Arizona, max8998, twl4030-power and the ti_am335x_tsadc drivers. - The SSBI driver move under MFD. - A conversion to the devm_* API for most of the MFD drivers. - The twl4030-power got split from twl-core into its own module. - A major ti_am335x_adc cleanup, leading to a proper DT support. - Our regular arizona and wm* updates and cleanups from the Wolfson folks. - A better error handling and initialization, and a regulator subdevice addition for the 88pm80x driver. - A bulk platform_set_drvdata() call removal that's no longer need since commit 0998d0631001 ("device-core: Ensure drvdata = NULL when no driver is bound") * tag 'mfd-3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next: (102 commits) mfd: sec: Provide max_register to regmap mfd: wm8994: Remove duplicate check for active JACKDET MAINTAINERS: Add include directory to MFD file patterns mfd: sec: Remove fields not used since regmap conversion watchdog: Kontron PLD watchdog timer driver mfd: max8998: Add support for Device Tree regulator: max8998: Use arrays for specifying voltages in platform data mfd: max8998: Add irq domain support regulator: palmas: Add TPS659038 support mfd: Kontron PLD mfd driver mfd: palmas: Add TPS659038 PMIC support mfd: palmas: Add SMPS10_BOOST feature mfd: palmas: Check if irq is valid mfd: lpc_ich: iTCO_wdt patch for Intel Coleto Creek DeviceIDs mfd: twl-core: Change TWL6025 references to TWL6032 mfd: davinci_voicecodec: Fix build breakage mfd: vexpress: Make the driver optional for arm and arm64 mfd: htc-egpio: Use devm_ioremap_nocache() instead of ioremap_nocache() mfd: davinci_voicecodec: Convert to use devm_* APIs mfd: twl4030-power: Fix relocking on error ...
2013-06-13mfd: ab8500-core: Add device for new RTC version for AB8540 cut2Alexandre Torgue
AB8540 RTC have changed between AB8540_cut1 and AB8540_cut2.Different ressources to define for those two version. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Julien Delacou <julien.delacou@stericsson.com> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-06-06mfd: db8500: Update register definition for u8540 clockPhilippe Begnic
PRCMU and ab8500 registers updated for u8540 Signed-off-by: Philippe Begnic <philippe.begnic@st.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mike Turquette <mturquette@linaro.org>
2013-05-17mfd: ab8500-sysctrl: Always enable pm_power_off handlerFabio Baltieri
AB8500 sysctrl driver implements a pm_power_off handler, but that is currently not registered until a specific platform data field is enabled. This patch drops the platform data field and always registers ab8500_power_off if no other pm_power_off handler was defined before, and also introduces the necessary cleanup code in the driver's remove function. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-04-30Merge tag 'for-v3.10' of git://git.infradead.org/battery-2.6Linus Torvalds
Pull battery updates from Anton Vorontsov: "Highlights: - OpenFirmware/DeviceTree support for the Power Supply core: the core now automatically populates supplied_from hierarchy from the device tree. With these patches chargers and batteries can now lookup each other without the board files support shim. Rhyland Klein at NVIDIA did the work - New ST-Ericsson ABX500 hwmon driver. The driver is heavily using the AB85xx core and depends on some recent changes to it, so that is why the driver comes through the battery tree. It has an appropriate ack from the hwmon maintainer (i.e. Guenter Roeck). Martin Persson at ST-Ericsson and Hongbo Zhang at Linaro authored the driver - Final bits to sync AB85xx ST-Ericsson changes into mainline. The changes touch mfd parts, but these were acked by the appropriate MFD maintainer (ie Samuel Ortiz). Lee Jones at Linaro did most of the work and lead the submission process. Minor changes, but still worth mentioning: - Battery temperature reporting fix for Nokia N900 phones - Versatile Express poweroff driver moved into drivers/power/reset/ - Tree-wide: use devm_kzalloc() where appropriate - Tree-wide: dev_pm_ops cleanups/fixes" * tag 'for-v3.10' of git://git.infradead.org/battery-2.6: (112 commits) pm2301-charger: Fix suspend/resume charger-manager: Use kmemdup instead of kzalloc + memcpy power_supply: Populate supplied_from hierarchy from the device tree power_supply: Add core support for supplied_from power_supply: Define Binding for power-supplies rx51_battery: Fix reporting temperature hwmon: Add ST-Ericsson ABX500 hwmon driver ab8500_bmdata: Export abx500_res_to_temp tables for hwmon ab8500_{bmdata,fg}: Add const attributes to some data arrays ab8500_bmdata: Eliminate CamelCase warning of some variables ab8500_btemp: Make ab8500_btemp_get* interfaces public goldfish_battery: Use resource_size() lp8788-charger: Use PAGE_SIZE for the sysfs read operation max8925_power: Use devm_kzalloc() da9030_battery: Use devm_kzalloc() da9052-battery: Use devm_kzalloc() ds2760_battery: Use devm_kzalloc() ds2780_battery: Use devm_kzalloc() gpio-charger: Use devm_kzalloc() isp1704_charger: Use devm_kzalloc() ...
2013-04-16ab8500_btemp: Make ab8500_btemp_get* interfaces publicHongbo Zhang
Make ab8500_btemp_get_temp interface public, export it and also export the ab8500_btemp_get, ab8500_btemp_get_batctrl_temp interfaces, so that the ab8500 hwmon driver can use them. Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-04-03ARM: ux500: Pass regulator platform data using the new formatLee Jones
Regulator platform data is now passed though a single structure as opposed to the old way where four separate struct elements were required. This patch makes use of the new format. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-07ab8500-charger: Add UsbLineCtrl2 referenceMarcus Cooper
When the state of USB Charge detection is changed then the calls use a define for another register in other bank. This change creates a new define for the correct register and removes the magic numbers that are present. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-03-07ab8500-bm: Add support for the new ab8540 platformLee Jones
Provide AB8540 platform specific information required to run the Battery Management subsystem on AB8540 based devices. For this to happen we see the introduction of separate platform specific data structures and a means in which to process them. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Add usb power path supportLee Jones
AB8540 supports power path function in USB charging mode for fast power up with dead and weak battery, and it could extend the battery age. When USB charging starts, if the Vbattrue is below than SW cut off voltage, power path and pre-charge should be enabled. If Vbattrue is higher than SW cut off voltage, power path and pre-charge should be disabled. This is to make sure full current to battery charge. At the end of charge, power path should be enable again to reduce charging the battery again. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Charge only mode fixes for the ab9540Lee Jones
Fix for charging not getting enabled in charge only mode by external charger. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Quick re-attach charging behaviourLee Jones
Due to a bug in some AB8500 ASICs charger removal cannot always be detected if the removal and reinsertion is done to close in time. This patch detects above described case and handles the situation so that charging will be kept turned on. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-charger: Add backup battery charge voltages on the ab8540Yang QU
Add 2.7v, 2.9v, 3.0v, 3.2v and 3.3v charging voltages for backup battery. Before that only 2.5v, 2.6v, 2.8v, 3.1v were available. Signed-off-by: Yang QU <yang.qu@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Maxime COQUELIN <maxime.coquelin@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Tested-by: Xiao Mei ZHANG <xiaomei.zhang@stericsson.com>
2013-03-07ab8500-fg: Add power cut feature for ab8505 and ab8540Lee Jones
Add support for a power cut feature which allows user to configure when ab8505 and ab8540 based platforms should shut down system due to low battery. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07mfd: ab8500-debug: Add support for the AB8540Lee Jones
Allow GPADC debug information to be shown when executing on an AB8540 based platform. Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2013-03-07mfd: ab8500-gpadc: Add support for the AB8540Lee Jones
This patch enables the GPADC to work on AB8540 based platforms. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2013-03-07mfd: ab8500-sysctrl: Add new reset functionLee Jones
Add a new reset function which uses the AB WD with 0 timeout. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2013-03-07mfd: ab8500-core: Add Interrupt support for ab8540Lee Jones
ITSource/ITLatch 7, 8, 9 and 10 don't exist on AB8540. This patch replaces them with '-1' in the interrupt list, and handles the '-1' in the code accordingly. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2013-03-07mfd: ab8500-gpadc: Add gpadc hw conversionLee Jones
Add the support of gpacd hw conversion and make the number of sample configurable. Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2013-03-07mfd: ab8500-sysctrl: Update correct turn on statusRajkumar Kasirajan
In L9540, turn_on_status register is not updated correctly if the device is rebooted with AC/USB charger connected. Due to this, the device boots android instead of entering into charge only mode. Read the AC/USB status register to detect the charger presence and update the turn on status manually. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Per Forlin <per.forlin@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Rupesh KUMAR <rupesh.kumar@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Tested-by: Rupesh KUMAR <rupesh.kumar@stericsson.com> Tested-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2013-02-24Merge tag 'mfd-3.9-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6 Pull MFS updates from Samuel Ortiz: "This is the MFD pull request for the 3.9 merge window. No new drivers this time, but a bunch of fairly big cleanups: - Roger Quadros worked on a OMAP USBHS and TLL platform data consolidation, OMAP5 support and clock management code cleanup. - The first step of a major sync for the ab8500 driver from Lee Jones. In particular, the debugfs and the sysct interfaces got extended and improved. - Peter Ujfalusi sent a nice patchset for cleaning and fixing the twl-core driver, with a much needed module id lookup code improvement. - The regular wm5102 and arizona cleanups and fixes from Mark Brown. - Laxman Dewangan extended the palmas APIs in order to implement the palmas GPIO and rt drivers. - Laxman also added DT support for the tps65090 driver. - The Intel SCH and ICH drivers got a couple fixes from Aaron Sierra and Darren Hart. - Linus Walleij patchset for the ab8500 driver allowed ab8500 and ab9540 based devices to switch to the new abx500 pin-ctrl driver. - The max8925 now has device tree and irqdomain support thanks to Qing Xu. - The recently added rtsx driver got a few cleanups and fixes for a better card detection code path and now also supports the RTS5227 chipset, thanks to Wei Wang and Roger Tseng." * tag 'mfd-3.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (109 commits) mfd: lpc_ich: Use devres API to allocate private data mfd: lpc_ich: Add Device IDs for Intel Wellsburg PCH mfd: lpc_sch: Accomodate partial population of the MFD devices mfd: da9052-i2c: Staticize da9052_i2c_fix() mfd: syscon: Fix sparse warning mfd: twl-core: Fix kernel panic on boot mfd: rtsx: Fix issue that booting OS with SD card inserted mfd: ab8500: Fix compile error mfd: Add missing GENERIC_HARDIRQS dependecies Documentation: Add docs for max8925 dt mfd: max8925: Add dts mfd: max8925: Support dt for backlight mfd: max8925: Fix onkey driver irq base mfd: max8925: Fix mfd device register failure mfd: max8925: Add irqdomain for dt mfd: vexpress: Allow vexpress-sysreg to self-initialise mfd: rtsx: Support RTS5227 mfd: rtsx: Implement driving adjustment to device-dependent callbacks mfd: vexpress: Add pseudo-GPIO based LEDs mfd: ab8500: Rename ab8500 to abx500 for hwmon driver ...
2013-02-20Merge tag 'for-v3.9' of git://git.infradead.org/battery-2.6Linus Torvalds
Pull battery updates from Anton Vorontsov: "Four new drivers: - goldfish_battery: This is Android Emulator battery driver. Originally from Google, but Intel folks reshaped it for mainline - pm2301_charger: A new driver for ST-Ericsson 2301 Power Management chip, uses AB8500 battery management core - qnap-poweroff: The driver adds poweroff functionality for QNAP NAS boxes - restart-poweroff: A generic driver that implements 'power off by restarting'. The actual poweroff functionality is implemented through a bootloader, so Linux' task is just to restart the box. The driver is useful on Buffalo Linkstation LS-XHL and LS-CHLv2 boards. Andrew Lunn worked on submitting the driver (as well as qnap-poweroff above). Additionally: - A lot of fixes for ab8500 drivers. This is a part of efforts of syncing internal ST-Ericsson development tree with the mainline. Lee Jones @ Linaro worked on compilation and reshaping these series. - New health properties for the power supplies: "Watchdog timer expire" and "Safety timer expire" - As usual, a bunch of fixes/cleanups here and there" * tag 'for-v3.9' of git://git.infradead.org/battery-2.6: (81 commits) bq2415x_charger: Add support for offline and 100mA mode generic-adc-battery: Fix forever loop in gab_remove() goldfish_battery: Add missing GENERIC_HARDIRQS dependency da9030_battery: Include notifier.h bq27x00_battery: Fix reporting battery temperature power/reset: Remove newly introduced __dev* annotations lp8727_charger: Small cleanup in naming ab8500_btemp: Demote initcall sequence ds2782_battery: Add power_supply_changed() calls for proper uevent support power: Add battery driver for goldfish emulator u8500-charger: Delay for USB enumeration ab8500-bm: Remove individual [charger|btemp|fg|chargalg] pdata structures ab8500-charger: Do not touch VBUSOVV bits ab8500-fg: Use correct battery charge full design pm2301: LPN mode control support pm2301: Enable vbat low monitoring ab8500-bm: Flush all work queues before suspending ab8500-fg: Go to INIT_RECOVERY when charger removed ab8500-charger: Add support for autopower on AB8505 and AB9540 abx500-chargalg: Add new sysfs interface to get current charge status ... Fix up fairly straightforward conflicts in the ab8500 driver. But since it seems to be ARM-specific, I can't even compile-test the result..
2013-02-20Merge tag 'pinctrl-for-v3.9' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pinctrl changes from Linus Walleij: "These are the main pinctrl changes for the v3.9 merge window. The most interesting change by far is how the device core grabs pinctrl default handles avoiding the need to stick boilerplate into driver consumers. - Grabbing of default pinctrl handles from the device core. These are the hunks hitting drivers/base. All is ACKed by Greg, after a long discussion about different alternatives. - Some stuff also touches the MFD and ARM SoC trees, this has been coordinated and ACKed. - New drivers for: - The Tegra 114 sub-SoC - Allwinner sunxi - New ABx500 driver and sub-SoC drivers for AB8500, AB8505, AB9540 and AB8540. - Make it possible for hogged pins to enter a sleep mode, and make it possible for drivers to control that mode. - Various clean-up, extensions and device tree support to various pin controllers." * tag 'pinctrl-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (68 commits) pinctrl: tegra: add clfvs function to Tegra114 support pinctrl: generic: rename input schmitt disable pinctrl/pinconfig: add debug interface pinctrl: samsung: remove duplicated line ARM: ux500: use real AB8500 IRQ numbers instead of virtual ones ARM: ux500: remove irq_base property from platform_data pinctrl/abx500: use direct IRQ defines pinctrl/abx500: replace IRQ offsets with table read-in values pinctrl/abx500: move IRQ handling to ab8500-core pinctrl: exynos5440: remove erroneous __init pinctrl/abx500: adjust offset for get_mode() pinctrl/abx500: add Device Tree support pinctrl/abx500: align GPIO cluster boundaries pinctrl/abx500: prevent error path from corrupting returning error pinctrl: sunxi: add of_xlate function pinctrl/lantiq: fix pin number in ltq_pmx_gpio_request_enable pinctrl/lantiq: add functionality to falcon_pinconf_dbg_show pinctrl/lantiq: fix pinconfig parameters pinctrl/lantiq: one of the boot leds was defined incorrectly pinctrl/lantiq: only probe available pad controllers ...
2013-02-14Merge branch 'for-mfd' of git://git.linaro.org/people/ljones/linux-3.0-ux500 ↵Samuel Ortiz
into for-next Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-02-10ARM: ux500: remove irq_base property from platform_dataLee Jones
AB8500 GPIO no longer handles its GPIO IRQs. Instead, the AB8500 core driver has taken back the responsibility. Prior to this happening, the AB8500 GPIO driver provided a set of virtual IRQs which were used as a pass-through. These virtual IRQs had a base of MOP500_AB8500_VIR_GPIO_IRQ_BASE, which was passed though pdata. We don't need to do this anymore, so we're pulling out the property from the structure. Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-04mfd: ab8500-debugfs: Add interrupt debugBengt Jonsson
This patch adds an entry in debugfs to check number of interrupts from the AB. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
2013-02-04mfd: ab8500-core: Allow the possibility to dump all AB8500 registersMian Yousaf Kaukab
Implement an API so that a user may dump all AB8500 registers via debugfs file access. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-02-04mfd: ab8500-sysctrl: Provide configuration for SysClkReqRfClkBuf registersKennet Wallden
Add the possibility to pass configuration settings for SysCl1kReqRfClkBuf to SysClk8ReqRfClkBuf via platform data. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Kennet Wallden <kennet.wallden@stericsson.com> Reviewed-by: Karl-Johan PERNTZ <karl-johan.perntz@stericsson.com> Reviewed-by: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
2013-02-04mfd: ab8500-sysctrl: Provide a platform specific pm_power_off() call-backLee Jones
The kernel allows us to specify a function call-back which will be invoked when a system power-off request has been received. Here we provide one which is to be used when shutting down AB8500 based platforms. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-30pinctrl: add abx500 pinctrl driver corePatrice Chotard
This adds the AB8500 core driver, which will be utilized by the follow-on drivers for different ABx500 variants. Sselect the driver from the DBX500_SOC, as this chip is powering and clocking that SoC. Cc: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-01-30mfd: ab8500: update header file and version detectionLinus Walleij
This updates the AB8500 register map with defines for a few new chip variants and adds version detection helpers to handle the different variants. Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-01-23ab8500-bm: Remove individual [charger|btemp|fg|chargalg] pdata structuresLee Jones
None of the aforementioned components have their own dedicated platform data structures anymore. Instead they have all been merged into one big Battery Management container. Let's remove them and place all the nice newly added attributes into the core container. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-23ab8500-charger: Do not touch VBUSOVV bitsJonas Aaberg
Do not touch the VBUSOVV in USBCHTRL2 when running on AB8505. Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Tested-by: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
2013-01-23pm2301: Update watchdog for pm2xxx supportLoic Pallardy
AB and PMxxx doesn't have same watchdog refresh period. Add watchdog to refresh period parameters in x500 charger structure, this should kick watchdog every 30sec. The AC charging should also kick both pm2xxx and the AB charger watchdog. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Loic Pallardy <loic.pallardy@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23ab8500-btemp: Adaptation to AB8505 and AB9540 platformsMichel JAOUEN
Add AB9540 and AB8505 support to ABx500 BTEMP driver. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23pm2301: Provide u9540 support for the pm2301 chargerMichel JAOUEN
AC charger driver for the DB9540 based platforms. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Loic Pallardy <loic.pallardy@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com>
2013-01-22mfd: Fix compile errors and warnings when !CONFIG_AB8500_BMLee Jones
drivers/mfd/ab8500-core.c:1015:21: error: ‘ab8500_bm_data’ undeclared here include/linux/mfd/abx500/ab8500-bm.h:445:13: warning: ‘ab8500_fg_reinit’ defined but not used include/linux/mfd/abx500/ab8500-bm.h:448:13: warning: ‘ab8500_charger_usb_state_changed’ defined but not used include/linux/mfd/abx500/ab8500-bm.h:451:29: warning: ‘ab8500_btemp_get’ defined but not used include/linux/mfd/abx500/ab8500-bm.h:455:12: warning: ‘ab8500_btemp_get_batctrl_temp’ defined but not used include/linux/mfd/abx500/ab8500-bm.h:463:12: warning: ‘ab8500_fg_inst_curr_blocking’ defined but not used include/linux/mfd/abx500/ab8500-bm.h:442:12: warning: ‘ab8500_fg_inst_curr_done’ defined but not used include/linux/mfd/abx500/ab8500-bm.h:447:26: warning: ‘ab8500_fg_get’ defined but not used Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-01-15ab8500_bm: Adds support for Car/Travel AdaptersHakan Berg
The Travel and Carkit adapter should be handled directly by the charger driver. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_btemp: Ignore false btemp low interruptHakan Berg
Ignore the low btemp interrupts for ab8500 3.0 and 3.3 Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Hakan Berg <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_bm: Recharge condition not optimal for batteryMarcus Cooper
Today the battery recharge is determined with a voltage threshold. This voltage threshold is only valid when the battery is relaxed. In charging algorithm the voltage read is the loaded battery voltage and no compensation is done to get the relaxed voltage. When maintenance charging is not selected, this makes the recharging condition to almost immediately activate when there is a discharge present on the battery. Depending on which vendor the battery comes from this behavior can wear out the battery much faster than normal. The fuelgauge driver is responsible to monitor the actual battery capacity and is able to estimate the remaining capacity. It is better to use the remaining capacity as a limit to determine when battery should be recharged. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_bm: Skip first CCEOC irq for instant currentJohan Bjornstedt
When enabling the CCEOC irq we might get false interrupt from ab8500-driver due to the latched value will be saved and interpreted as an IRQ when enabled Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Johan Bjornstedt <johan.bjornstedt@stericsson.com> Signed-off-by: Henrik Solver <henrik.solver@stericsson.com> Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2012-11-28mfd: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Peter Tyser <ptyser@xes-inc.com> Cc: Daniel Walker <dwalker@fifo99.com> Cc: Bryan Huntsman <bryanh@codeaurora.org> Acked-by: David Brown <davidb@codeaurora.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>