summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)Author
2013-11-18Merge tag 'for-v3.13' of git://git.infradead.org/battery-2.6Linus Torvalds
Pull battery updates from Anton Vorontsov: "Highlights: - A new driver for TI BQ24735 Battery Chargers, courtesy of NVidia. - Device tree bindings for TWL4030 chips. - Random fixes and cleanups" * tag 'for-v3.13' of git://git.infradead.org/battery-2.6: pm2301-charger: Remove unneeded NULL checks twl4030_charger: Add devicetree support power_supply: Fix documentation for TEMP_*ALERT* properties max17042_battery: Support regmap to access device's registers max17042_battery: Use SIMPLE_DEV_PM_OPS charger-manager : Replace kzalloc to devm_kzalloc and remove uneccessary code bq2415x_charger: Fix max battery regulation voltage tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code tps65090-charger: Drop devm_free_irq of devm_ allocated irq power_supply: Add support for bq24735 charger pm2301-charger: Staticize pm2xxx_charger_die_therm_mngt pm2301-charger: Check return value of regulator_enable ab8500-charger: Remove redundant break ab8500-charger: Check return value of regulator_enable isp1704_charger: Fix driver to work with changes introduced in v3.5
2013-11-15tree-wide: use reinit_completion instead of INIT_COMPLETIONWolfram Sang
Use this new function to make code more comprehensible, since we are reinitialzing the completion, not initializing. [akpm@linux-foundation.org: linux-next resyncs] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13) Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-11-12pm2301-charger: Remove unneeded NULL checksDan Carpenter
If "pm2" were NULL we would oops printing the error message. Fortunately, that's not possible so I have removed the NULL checks. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-11-12twl4030_charger: Add devicetree supportNeilBrown
This allows the charger to be enabled with devicetree, and allows the parameters for charging the backup battery to be set. Signed-off-by: NeilBrown <neilb@suse.de> Acked-by: Kumar Gala <galak@codeaurora.org> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25max17042_battery: Support regmap to access device's registersJonghwa Lee
This patch makes max17042 fuelguage driver uses regmap API to access its device's registers. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25max17042_battery: Use SIMPLE_DEV_PM_OPSManish Badarkhe
Use the SIMPLE_DEV_PM_OPS macro to declare the driver's pm_ops. Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25charger-manager : Replace kzalloc to devm_kzalloc and remove uneccessary codeJonghwa Lee
Use devm function for dynamic memory allocation. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25bq2415x_charger: Fix max battery regulation voltageAlexandre Belloni
As per the datasheets, maximum battery regulation voltage is 4440mV. The formula is (voltage - offset) / step, so the maximum value is: (4440 - 3500) / 20 = 47 Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Thanks-to: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT codeManish Badarkhe
Instead of "#if defined(CONFIG_OF)" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code. Also, arranged header files in alphabetically. Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com> Acked-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25tps65090-charger: Drop devm_free_irq of devm_ allocated irqWei Yongjun
The devm_request_irq function allocates irq that is released when a driver detaches. Thus, there is no reason to explicitly call devm_free_irq in probe or remove functions. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25power_supply: Add support for bq24735 chargerDarbha Sriharsha
Adds support for the bq24735 charger chipset. The bq24735 is a high-efficiency, synchronous battery charger. It allows control of the charging current, input current, and the charger voltage DAC's through SMBus. Signed-off-by: Darbha Sriharsha <dsriharsha@nvidia.com> Signed-off-by: Rhyland Klein <rklein@nvidia.com> Thanks-to: Stephen Warren <swarren@wwwdotorg.org> Thanks-to: Thierry Reding <thierry.reding@gmail.com> Thanks-to: Manish Badarkhe <badarkhe.manish@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25pm2301-charger: Staticize pm2xxx_charger_die_therm_mngtSachin Kamat
pm2xxx_charger_die_therm_mngt is used only in this file. Make it static. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25pm2301-charger: Check return value of regulator_enableSachin Kamat
Check the return value of regulator_enable to silence the following warning: drivers/power/pm2301_charger.c:725:20: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25ab8500-charger: Remove redundant breakSachin Kamat
Each of the if-else blocks has a break statement. Remove the additional one which is unreachable. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25ab8500-charger: Check return value of regulator_enableSachin Kamat
Check the return value of regulator_enable to silence the following type of warnings: drivers/power/ab8500_charger.c:1390:20: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-22isp1704_charger: Fix driver to work with changes introduced in v3.5Pali Rohár
* omap musb driver does not report USB_EVENT_ENUMERATED event anymore * omap musb driver reporting USB_EVENT_VBUS when charger is connected * read last event from phy->last_event (instead from ulpi register) * do not call wall charger detection more times Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-09-13Remove GENERIC_HARDIRQ config optionMartin Schwidefsky
After the last architecture switched to generic hard irqs the config options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code for !CONFIG_GENERIC_HARDIRQS can be removed. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-09-10Merge tag 'for-v3.12' of git://git.infradead.org/battery-2.6Linus Torvalds
Pull battery/power supply driver updates from Anton Vorontsov: "New drivers: - APM X-Gene system reboot driver by Feng Kan and Loc Ho (APM). - Qualcomm MSM reboot/poweroff driver by Abhimanyu Kapur (Codeaurora). - Texas Instruments BQ24190 charger driver by Mark A. Greer (Animal Creek Technologies). - Texas Instruments TWL4030 MADC battery driver by Lukas Märdian and Marek Belisko (Golden Delicious Computers). The driver is used on Freerunner GTA04 phones. Highlighted fixes and improvements: - Suspend/wakeup logic improvements: power supply objects will block system suspend until all power supply events are processed. Thanks to Zoran Markovic (Linaro), Arve Hjonnevag and Todd Poynor (Google)" * tag 'for-v3.12' of git://git.infradead.org/battery-2.6: rx51_battery: Fix channel number when reading adc value power: Add twl4030_madc battery driver. bq24190_charger: Workaround SS definition problem on i386 builds power_supply: Prevent suspend until power supply events are processed vexpress-poweroff: Should depend on the required infrastructure twl4030-charger: Fix compiler warning with regulator_enable() rx51_battery: Replace hardcoded channels values. bq24190_charger: Add support for TI BQ24190 Battery Charger ab8500-charger: We print an unintended error message max8925_power: Fix missing of_node_put power_supply: Replace strict_strtol() with kstrtol() power: Add APM X-Gene system reboot driver power_supply: tosa_battery: Get rid of irq_to_gpio usage power supply: collie_battery: Convert to use dev_pm_ops power_supply: Make goldfish_battery depend on GOLDFISH || COMPILE_TEST power: reset: Add msm restart support MAINTAINERS: drivers/power: add entry for SmartReflex AVS drivers
2013-08-30rx51_battery: Fix channel number when reading adc valueMarek Belisko
This issue was introduced in commit 8e2747f031bd "power: rx51_battery: Replace hardcoded channels values." Original code use channel as argument which was shifted by one in function. After mentioned commit argument is already shifted so we need to get index back. Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-30power: Add twl4030_madc battery driver.Marek Belisko
This driver is used and tested on gta04 phone. It's using twl4030_madc (similar to rx51 existing driver). Driver also implement charging and discharging calibration data so user can define ranges and level. Signed-off-by: Marek Belisko <marek@goldelico.com> Signed-off-by: Lukas Märdian <lukas@goldelico.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-28bq24190_charger: Workaround SS definition problem on i386 buildsAnton Vorontsov
For __i386__ builds we have: arch/x86/include/uapi/asm/ptrace-abi.h:#define SS 16 And in the driver: BQ24190_SYSFS_FIELD_RO(vbus_stat, SS, VBUS_STAT) That breaks the build like this: drivers/power/bq24190_charger.c:375:138: error: ‘BQ24190_REG_16’ undeclared here (not in a function) drivers/power/bq24190_charger.c:375:162: error: ‘BQ24190_REG_16_THERM_STAT_MASK’ undeclared here (not in a function) drivers/power/bq24190_charger.c:375:203: error: ‘BQ24190_REG_16_THERM_STAT_SHIFT’ undeclared here (not in a function) With this commit we workaround the problem by undefining 'SS'. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27power_supply: Prevent suspend until power supply events are processedZoran Markovic
This patch, originally authored by Arve Hjonnevag and Todd Poynor, prevents the system from entering suspend mode until the power supply plug, unplug, or any other change of state event is fully processed. This guarantees that the screen lights up and displays the battery charging state. The implementation uses the power supply wakeup_source object. Cc: David Woodhouse <dwmw2@infradead.org> Cc: Arve Hjonnevag <arve@android.com> Cc: Todd Poynor <toddpoynor@google.com> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Zoran Markovic <zoran.markovic@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27vexpress-poweroff: Should depend on the required infrastructurePawel Moll
ARM Versatile Express reset driver requires platform-specific config infrastructure to be present in the kernel. When VEXPRESS_CONFIG is not selected, the build will fail like this: drivers/built-in.o: In function `vexpress_reset_do.clone.0': iio-trig-interrupt.c:(.text+0x1aff38): undefined reference to `__vexpress_config_func_get' iio-trig-interrupt.c:(.text+0x1aff4c): undefined reference to `vexpress_config_write' Added required dependency to the Kconfig entry. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27twl4030-charger: Fix compiler warning with regulator_enable()Peter Ujfalusi
The return value of regulator_enable need to be checked. This patch fixes the following warning: drivers/power/twl4030_charger.c: In function ‘twl4030_charger_enable_usb’: drivers/power/twl4030_charger.c:192:20: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27rx51_battery: Replace hardcoded channels values.Marek Belisko
In twl4030_madc header exist defines for fixed channels + add rx51 specific channels and replace all hardcoded channels values. Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27bq24190_charger: Add support for TI BQ24190 Battery ChargerMark A. Greer
Add driver support for the Texas Instruments BQ24190 battery charger. Some of the information provided by the device is about the charger and other information is about the battery so create two power_supply objects (one for each) and provide the appropriate information for each one. The device has many fields that go beyond what is reasonable to report or modify using the existing 'POWER_SUPPLY_PROP_*' properties so the driver exports the register fields via sysfs. They are prefixed by 'f_' (for 'field') to make it easier to distinguish between a register field and a "normal" sysfs file exported by the power_supply infrastructure. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27ab8500-charger: We print an unintended error messageDan Carpenter
There is a missing break statement here, so we print an error message that the USB type is invalid. The original code still works fine though except for the error message. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27max8925_power: Fix missing of_node_putLibo Chen
Decrease np device_node refcount after we are done with the node. Signed-off-by: Libo Chen <libo.chen@huawei.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-20treewide: Fix typo in printkMasanari Iida
Correct spelling typo in printk Signed-off-by: Masanari Iida <standby24x7@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-08-09power_supply: Replace strict_strtol() with kstrtol()Jingoo Han
The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtol() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09power: Add APM X-Gene system reboot driverLoc Ho
Add APM X-Gene SoC system reboot driver. This driver handles only system reboot. System shutdown is board specific and can be handled by board driver or GPIO based shutdown driver. Signed-off-by: Loc Ho <lho@apm.com> Signed-off-by: Feng Kan <fkan@apm.com> Signed-off-by: Kumar Sankaran <ksankaran@apm.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09power_supply: tosa_battery: Get rid of irq_to_gpio usageAndrea Adami
This commit fixes the following error: linux/drivers/power/tosa_battery.c:153:2: error: implicit declaration of function 'irq_to_gpio' [-Werror=implicit-function-declaration] Since 9d08d5d77a355510c2f5657c86b0a4b25acfe72c, irq_to_gpio() is no longer available but still in use by collie_battery.c. As it's just for a debug message, just get rid of this call. Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09power supply: collie_battery: Convert to use dev_pm_opsAndrea Adami
This commit fixes the following warnings: linux/drivers/power/collie_battery.c:372:2: warning: initialization from incompatible pointer type [enabled by default] linux/drivers/power/collie_battery.c:372:2: warning: (near initialization for 'collie_bat_driver.suspend') [enabled by default] Referencess: MFD: ucb1x00-core: convert to use dev_pm_ops https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/mfd?id=5a09b7120a965a7d7e8494d0ed509135bbce0118 MFD: mcp-core: remove legacy driver suspend/resume methods https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/mfd?id=cf4abfcc0df2985ff6061f74e63b8353f2a1d0bc Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09power_supply: Make goldfish_battery depend on GOLDFISH || COMPILE_TESTPaul Gortmaker
Nearly all the other goldfish peripherals (mtd, keyboard, etc) have a dependency on the main platform's GOLDFISH Kconfig item, but this one got skipped. Even with consistency as a justification, there was initial resistance[1] from some people to adding it however, as they wanted the extra compile coverage. Now, with CONFIG_COMPILE_TEST, we have the middle ground that will give people the coverage who want it, and let those who don't want it to skip ever seeing the option presented. [1] https://lkml.org/lkml/2013/2/27/333 Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09power: reset: Add msm restart supportAbhimanyu Kapur
Add support for restart and poweroff functionality present on MSM chipsets with the MPM2 ps-hold hardware. Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org> Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-07-10Merge tag 'for-v3.11' of git://git.infradead.org/battery-2.6Linus Torvalds
Pull battery subsystem update from Anton Vorontsov: "Nothing exciting this time, just assorted fixes and cleanups" * tag 'for-v3.11' of git://git.infradead.org/battery-2.6: (25 commits) charger-manager: Fix regulator_get() return check charger-manager: Fix a bug when it unregisters notifier block of extcon tps65090-charger: Add dt node to power_supply sbs-battery: Add dt to power_supply struct power_supply: Add of_node_put to fix refcount power_supply: Move of_node out of the #ifdef CONFIG_OF power/reset: Make the vexpress driver optional on arm and arm64 charger-manager: Add missing newlines, fix a couple of typos, add pr_fmt tps65090-charger: Fix AC detect MAINTAINERS: Update email address for Anton Vorontsov charger-manager: Ensure event is not used as format string power_supply: Replace strict_strtoul() with kstrtoul() generic-adc-battery: Fix checking if none of the channels are supported power: Use platform_{get,set}_drvdata() pm2301_charger: Return error if create_singlethread_workqueue fails pm2301_charger: Fix NULL pointer dereference lp8727_charger: Support the device tree feature twl4030_charger: Remove unnecessary platform_set_drvdata() rx51_battery: Remove unnecessary platform_set_drvdata() jz4740-battery: Remove unnecessary platform_set_drvdata() ...
2013-07-09reboot: arm: change reboot_mode to use enum reboot_modeRobin Holt
Preparing to move the parsing of reboot= to generic kernel code forces the change in reboot_mode handling to use the enum. [akpm@linux-foundation.org: fix arch/arm/mach-socfpga/socfpga.c] Signed-off-by: Robin Holt <holt@sgi.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Russ Anderson <rja@sgi.com> Cc: Robin Holt <holt@sgi.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-06-28charger-manager: Fix regulator_get() return checkJonghwa Lee
This patch fixes return value checking of regulator_get() in charger-manager driver. The API, regulator_get(), returns ERR_PTR() when it fails to get regulator with given name, not NULL. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-28charger-manager: Fix a bug when it unregisters notifier block of extconJonghwa Lee
This patch prevents NULL pointer error cauesed by unregistering unregistered exton notifier block. At the probing time of charger manager, it tries to remove extcon notifier block when it fails to initialize them. It has to be applied for only registered one. Otherwise, it'd make kernel panic. To make it work right, it checks extcon_specific_cable_nb's extcon_dev node. If extcon cable notifier block was registered successfully, it has proper extcon_dev pointer if not so it has NULL pointer. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-28tps65090-charger: Add dt node to power_supplyRhyland Klein
Passing in the dt node for this charger enables the logic in the core to lookup this device, to see if it is supplying another power_supply, through dt. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-28sbs-battery: Add dt to power_supply structRhyland Klein
By passing in the dt node of this device, we enable the logic for linking power_supplies together from dt. This is specified by adding a "power-supplies" property with a phandle to the charger for a given supply. Enable this logic now for the sbs-battery driver. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-28power_supply: Add of_node_put to fix refcountRhyland Klein
of_parse_phandle increments the refcount for a dt node before returning it. Add of_node_put where needed to properly decrement the refcount when we are done using a given node. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-21power/reset: Make the vexpress driver optional on arm and arm64Pawel Moll
The driver can be used on either arm or arm64 platforms, but the latter doesn't have any platform-specific configuration options, so it must be possible to manually enable the driver. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-10PM / AVS: SmartReflex: use devm_* API to initialize SmartReflexAndrii Tseglytskyi
Use of of devm_* API for resource allocation provides benefits such as auto handling of resource free. This reduces possibility have memory leaks in case of wrong error handling. All direct release calls should be removed to avoid races. Reported-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-06-10PM / AVS: SmartReflex: use omap_sr * for enable/disable interfaceAndrii Tseglytskyi
SmartReflex driver interface is natively divided to two parts: - external SmartReflex interface - interface between SmartReflex driver and SmartReflex Class Functions which belong to AVS class interface can use struct omap_sr* instead of struct voltatedomain*, to provide a direct connection between SR driver and SR class. This allows us to optimize and not do additional lookups where none is required. sr_enable() and sr_disable() are interface functions between SR driver and SR class. They are typically used by Class driver to enable/disable SmartReflex hardware module. Now they take struct omap_sr* as input parameter. Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-06-10PM / AVS: SmartReflex: use omap_sr * for minmax interfacesAndrii Tseglytskyi
SmartReflex driver interface is natively divided to two parts: - external SmartReflex interface - interface between SmartReflex driver and SmartReflex Class Functions which belong to AVS class interface can use struct omap_sr* instead of struct voltatedomain*, to provide a direct connection between SR driver and SR class. This allows us to optimize and not do additional lookups where none is required. sr_configure_minmax() is interface function between SR driver and SR class. It is typically used by Class driver to configure MINMAXAVG module inside SmartReflex module. Now it takes struct omap_sr* as input parameter. Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-06-10PM / AVS: SmartReflex: use omap_sr * for errgen interfacesAndrii Tseglytskyi
SmartReflex driver interface is natively divided to two parts: - external SmartReflex interface - interface between SmartReflex driver and SmartReflex Class Functions which belong to AVS class interface can use struct omap_sr* instead of struct voltatedomain*, to provide a direct connection between SR driver and SR class. This allows us to optimize and not do additional lookups where none is required. sr_disable_errgen() and sr_configure_errgen() are interface functions between SR driver and SR class. They are typically used by Class driver to configure error generator module during SmartReflex enable/disable sequence. Now they take struct omap_sr* as input parameter. Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-06-10PM / AVS: SmartReflex: fix driver nameAndrii Tseglytskyi
DRIVER_NAME was undefined for SmartReflex. Now it is defined with valid value "smartreflex". It is needed to define proper value for: MODULE_ALIAS("platform:" DRIVER_NAME); Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-06-10PM / AVS: SmartReflex: disable runtime PM on driver removeAndrii Tseglytskyi
Runtime PM should be disabled for device on driver remove, otherwise runtime PM will be not balanced, and this will cause an error message, on next driver probe. Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-06-10PM / AVS: SmartReflex: disable errgen before vpbound disableNishanth Menon
vpboundsintr_en is available inside the IP block as an re-sycned version and one which is not. Due to this, there is an 1 sysclk cycle window where the SR_SInterruptz signal could be asserted low. IF, intr_en is cleared on the exact same cycle as the irqclr, an additional pulse is generated which indicates for VP that an additional adjustment of voltage is required. This results in VP doing two voltage adjustments for the SRERR (based on configuration, upto 4 steps), instead of the needed 1 step. Due to the unexpected pulse from AVS which breaks the AVS-VP communication protocol, VP also ends up in a stuck condition by entering a state where VP module remains non-responsive to any futher AVS adjustment events. This creates the symptom called "TRANXDONE Timeout" scenario. By disabling errgen prior to disable of intr_en, this situation can be avoided. Signed-off-by: Vincent Bour <v-bour@ti.com> Signed-off-by: Leonardo Affortunati <l-affortunati@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Andrii.Tseglytskyi <andrii.tseglytskyi@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>