aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-09-17Merge tag 'for-v4.3-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supplyLinus Torvalds1-6/+2
Pull power supply fixes from Sebastian Reichel: "twl4030-charger fixes" * tag 'for-v4.3-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: twl4030_charger: fix another compile error Revert "twl4030_charger: correctly handle -EPROBE_DEFER from devm_usb_get_phy_by_node"
2015-09-11Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linuxLinus Torvalds2-2/+2
Pull thermal updates from Zhang Rui: - use int instead of unsigned long to represent temperature to avoid bogus overheat detection when negative temperature reported. From Sascha Hauer. - export available thermal governors information to user space via sysfs. From Wei Ni. - introduce new thermal driver for Wildcat Point platform controller hub, which uses PCH thermal sensor and associated critical and hot trip points. From Tushar Dave. - add suuport for Intel Skylake and Denlow platforms in powerclamp driver. - some small cleanups in thermal core. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: Add Intel PCH thermal driver thermal: Add comment explaining test for critical temperature thermal: Use IS_ENABLED instead of #ifdef thermal: remove unnecessary call to thermal_zone_device_set_polling thermal: trivial: fix typo in comment thermal: consistently use int for temperatures thermal: add available policies sysfs attribute thermal/powerclamp: add cpu id for denlow platform thermal/powerclamp: add cpu id for Skylake u/y thermal/powerclamp: add cpu id for skylake h/s
2015-09-10twl4030_charger: fix another compile errorGrazvydas Ignotas1-1/+1
When CONFIG_CHARGER_TWL4030=y and CONFIG_TWL4030_MADC=m we get a compile error: drivers/built-in.o: In function `twl4030_charger_update_current': twl4030_charger.c:(.text+0x504681): undefined reference to `twl4030_get_madc_conversion' Use IS_REACHABLE to fix it. Cc: NeilBrown <neil@brown.name> Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-10Revert "twl4030_charger: correctly handle -EPROBE_DEFER from devm_usb_get_phy_by_node"Sebastian Reichel1-5/+1
Revert commit 3fc3895e4fe17ee92ae1d1bb9f04da6069e8c370, since it introduced a boot failure on some OMAP platforms. Reported-by: Kevin Hilman <khilman@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-01Merge tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pmLinus Torvalds2-1/+60
Pull power management and ACPI updates from Rafael Wysocki: "From the number of commits perspective, the biggest items are ACPICA and cpufreq changes with the latter taking the lead (over 50 commits). On the cpufreq front, there are many cleanups and minor fixes in the core and governors, driver updates etc. We also have a new cpufreq driver for Mediatek MT8173 chips. ACPICA mostly updates its debug infrastructure and adds a number of fixes and cleanups for a good measure. The Operating Performance Points (OPP) framework is updated with new DT bindings and support for them among other things. We have a few updates of the generic power domains framework and a reorganization of the ACPI device enumeration code and bus type operations. And a lot of fixes and cleanups all over. Included is one branch from the MFD tree as it contains some PM-related driver core and ACPI PM changes a few other commits are based on. Specifics: - ACPICA update to upstream revision 20150818 including method tracing extensions to allow more in-depth AML debugging in the kernel and a number of assorted fixes and cleanups (Bob Moore, Lv Zheng, Markus Elfring). - ACPI sysfs code updates and a documentation update related to AML method tracing (Lv Zheng). - ACPI EC driver fix related to serialized evaluations of _Qxx methods and ACPI tools updates allowing the EC userspace tool to be built from the kernel source (Lv Zheng). - ACPI processor driver updates preparing it for future introduction of CPPC support and ACPI PCC mailbox driver updates (Ashwin Chaugule). - ACPI interrupts enumeration fix for a regression related to the handling of IRQ attribute conflicts between MADT and the ACPI namespace (Jiang Liu). - Fixes related to ACPI device PM (Mika Westerberg, Srinidhi Kasagar). - ACPI device registration code reorganization to separate the sysfs-related code and bus type operations from the rest (Rafael J Wysocki). - Assorted cleanups in the ACPI core (Jarkko Nikula, Mathias Krause, Andy Shevchenko, Rafael J Wysocki, Nicolas Iooss). - ACPI cpufreq driver and ia64 cpufreq driver fixes and cleanups (Pan Xinhui, Rafael J Wysocki). - cpufreq core cleanups on top of the previous changes allowing it to preseve its sysfs directories over system suspend/resume (Viresh Kumar, Rafael J Wysocki, Sebastian Andrzej Siewior). - cpufreq fixes and cleanups related to governors (Viresh Kumar). - cpufreq updates (core and the cpufreq-dt driver) related to the turbo/boost mode support (Viresh Kumar, Bartlomiej Zolnierkiewicz). - New DT bindings for Operating Performance Points (OPP), support for them in the OPP framework and in the cpufreq-dt driver plus related OPP framework fixes and cleanups (Viresh Kumar). - cpufreq powernv driver updates (Shilpasri G Bhat). - New cpufreq driver for Mediatek MT8173 (Pi-Cheng Chen). - Assorted cpufreq driver (speedstep-lib, sfi, integrator) cleanups and fixes (Abhilash Jindal, Andrzej Hajda, Cristian Ardelean). - intel_pstate driver updates including Skylake-S support, support for enabling HW P-states per CPU and an additional vendor bypass list entry (Kristen Carlson Accardi, Chen Yu, Ethan Zhao). - cpuidle core fixes related to the handling of coupled idle states (Xunlei Pang). - intel_idle driver updates including Skylake Client support and support for freeze-mode-specific idle states (Len Brown). - Driver core updates related to power management (Andy Shevchenko, Rafael J Wysocki). - Generic power domains framework fixes and cleanups (Jon Hunter, Geert Uytterhoeven, Rajendra Nayak, Ulf Hansson). - Device PM QoS framework update to allow the latency tolerance setting to be exposed to user space via sysfs (Mika Westerberg). - devfreq support for PPMUv2 in Exynos5433 and a fix for an incorrect exynos-ppmu DT binding (Chanwoo Choi, Javier Martinez Canillas). - System sleep support updates (Alan Stern, Len Brown, SungEun Kim). - rockchip-io AVS support updates (Heiko Stuebner). - PM core clocks support fixup (Colin Ian King). - Power capping RAPL driver update including support for Skylake H/S and Broadwell-H (Radivoje Jovanovic, Seiichi Ikarashi). - Generic device properties framework fixes related to the handling of static (driver-provided) property sets (Andy Shevchenko). - turbostat and cpupower updates (Len Brown, Shilpasri G Bhat, Shreyas B Prabhu)" * tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (180 commits) cpufreq: speedstep-lib: Use monotonic clock cpufreq: powernv: Increase the verbosity of OCC console messages cpufreq: sfi: use kmemdup rather than duplicating its implementation cpufreq: drop !cpufreq_driver check from cpufreq_parse_governor() cpufreq: rename cpufreq_real_policy as cpufreq_user_policy cpufreq: remove redundant 'policy' field from user_policy cpufreq: remove redundant 'governor' field from user_policy cpufreq: update user_policy.* on success cpufreq: use memcpy() to copy policy cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event cpufreq: mediatek: Add MT8173 cpufreq driver dt-bindings: mediatek: Add MT8173 CPU DVFS clock bindings PM / Domains: Fix typo in description of genpd_dev_pm_detach() PM / Domains: Remove unusable governor dummies PM / Domains: Make pm_genpd_init() available to modules PM / domains: Align column headers and data in pm_genpd_summary output powercap / RAPL: disable the 2nd power limit properly tools: cpupower: Fix error when running cpupower monitor PM / OPP: Drop unlikely before IS_ERR(_OR_NULL) PM / OPP: Fix static checker warning (broken 64bit big endian systems) ...
2015-08-31Merge tag 'regulator-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulatorLinus Torvalds1-0/+1
Pull regulator updates from Mark Brown: "The biggest changes in the core this time around have been some refactorings that move us towards being able to drop the list of regulators maintained by the core and instead just use the driver model list maintained for the class devices for regulators which will make the code smaller and avoid some potential bugs. Otherwise another fairly quiet release for the regulator API, highlights include: - a new API for setting voltages based on a minimum, target, maximum triplet - support for continuous voltage ranges rather than tables of explicit steps in the PWM regulator, requiring less explicit configuration - new driver support for Dialog DA9215, Maxim 77843, Mediatek MT6311 and Qualcomm RPM" * tag 'regulator-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (70 commits) regulator: mt6311: fix platform_no_drv_owner.cocci warnings regulator: ltc3589: Remove unnecessary MODULE_ALIAS() regulator: ad5398: Remove unnecessary MODULE_ALIAS() regulator: pfuze100: Remove unnecessary MODULE_ALIAS() regulator: core: use debug level print in regulator_check_drms regulator: lp872x: handle error case regulator: lp872x: use the private data instead of updating I2C device platform data regulator: isl9305: Export OF module alias information regulators: max77693: register driver earlier to avoid deferred probe regulator: qcom_smd: Set n_voltages for pm8941_lnldo regulator: core: Use IS_ERR_OR_NULL() regulator: core: Define regulator_set_voltage_triplet() regulator: Regulator driver for the Qualcomm RPM regulator: pbias: Fix broken pbias disable functionality regulator: core: Spelling fix regulator: core: Use class device list for regulator_list in late init regulator: core: Move more deallocation into class unregister regulator: core: Reduce rdev locking region when releasing regulator Input: Remove the max77843 haptic driver Input: max77693: Add support for Maxim 77843 ...
2015-08-21bq2415x_charger: Allow to load and use driver even if notify device is not registered yetPali Rohár1-64/+79
Driver bq2415x_charger works also without notify power supply device for charger detection. But when charger detection is specified in DT, then bq2415x_charger refused to loaded with -EPROBE_DEFER. This patch rewrites code so that notify device for charger detection is checked when power supply event is received and not when registering power supply device. So this patch allows to use bq2415x_charger driver also when kernel is compiled without driver for notify power supply device. Now after this patch scheduled workqueue is called after INIT_DELAYED_WORK, so it also fix problem when scheduled workqueue was called before init. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-08PM / AVS: rockchip-io: add io selectors and supplies for rk3368Heiko Stuebner1-0/+59
This adds the necessary data for handling io voltage domains on the rk3368. As interesting tidbit, the rk3368 contains two separate iodomain areas. One in the regular General Register Files (GRF) and one in PMUGRF in the pmu power domain. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-08PM / AVS: rockchip-io: depend on CONFIG_POWER_AVSHeiko Stuebner1-1/+1
The rockchip io-domain driver currently only depends on ARCH_ROCKCHIP itself. This makes it possible to select the power-domain driver, but not the POWER_AVS class and results in the iodomain-driver not getting build in this case. So add the additional dependency, which also results in the driver config option now being placed nicely into the AVS submenu. Fixes: 662a958638bd ("PM / AVS: rockchip-io: add driver handling Rockchip io domains") Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-07twl4030_charger: fix compile error when TWL4030_MADC not available.NeilBrown1-1/+16
We can only use the madc to check for 'ac' availability if the madc has been compiled in. If not: assume always using USB. Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: NeilBrown <neil@brown.name> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05power: bq24190_charger: Fix charge type sysfs propertyAndreas Dannenberg1-1/+1
Access to the BQ24190's configurable charge type property (none, trickle, fast) is being masked by an incorrect power_supply_property entry. After applying this patch a new 'charge_type' property will appear in the bq24190-charger sysfs folder backed up by getters/setters already present in the driver. Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Acked-by: Dan Murphy <dmurphy@ti.com> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05power: Allow compile test of GPIO consumers if !GPIOLIBGeert Uytterhoeven1-6/+11
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05power: Export I2C module alias information in missing driversJavier Martinez Canillas2-1/+2
The I2C core always reports the MODALIAS uevent as "i2c:<client name" regardless if the driver was matched using the I2C id_table or the of_match_table. So the driver needs to export the I2C table and this be built into the module or udev won't have the necessary information to auto load the correct module when the device is added. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: Increase current carefully while watching voltage.NeilBrown1-6/+61
The USB Battery Charging spec (BC1.2) suggests a dedicated charging port can deliver from 0.5 to 5.0A at between 4.75 and 5.25 volts. To choose the "correct" current voltage setting requires a trial and error approach: try to draw current and see if the voltage drops too low. Even with a configured Standard Downstream Port, it may not be possible to reliably pull 500mA - depending on cable quality and source quality I have reports of charging failure due to the voltage dropping too low. To address both these concerns, this patch introduce incremental current setting. The current pull from VBUS is increased in steps of 20mA every 100ms until the target is reached or until the measure voltage drops below 4.75V. If the voltage does go too low, the target current is reduced by 20mA and kept there. This applies to currents selected automatically, or to values set via sysfs. So setting a large value will cause the maximum available to be used - up to the limit of 1.7A imposed by the hardware. Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: add ac/mode to match usb/modeNeilBrown1-8/+27
This allows AC charging to be turned off, much like usb charging. "continuous" mode is not available though. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: add software controlled linear charging mode.NeilBrown1-5/+50
Add a 'continuous' option for usb charging which enables the "linear" charging mode of the twl4030. Linear charging does a good job with not-so-reliable power sources. Auto mode does not work well as it switches off when voltage drops momentarily. Care must be taken not to over-charge. It was used with a bike hub dynamo since a year or so. In that case there are automatically charging stops when the cyclist needs a break. Original-by: Andreas Kemnade <andreas@kemnade.info> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: enable manual enable/disable of usb charging.NeilBrown1-0/+59
'off' or 'auto' to /sys/class/power/twl4030_usb/mode will now enable or disable charging from USB port. Normally this is enabled on 'plug' and disabled on 'unplug'. Unplug will still disable charging. 'plug' will only enable it if 'auto' if selected. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: allow max_current to be managed via sysfs.NeilBrown1-0/+72
'max_current' sysfs attributes are created which allow the max to be set. Whenever a current source changes, the default is restored. This will be followed by a uevent, so user-space can decide to update again. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: distinguish between USB current and 'AC' currentNeilBrown1-7/+29
The twl4030 charger has two current sources, 'USB' and 'AC' (presumably "Accessory Charger" because it isn't Alternating Current). If 'AC' is providing current, we should set the current limit differently to when it isn't (and so USB is used). So split 'cur' into 'usb_cur' and 'ac_cur' and use accordingly. Now we must review the current setting on any interrupt or USB event which might indicate that the charger-source has changed. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: allow fine control of charger current.NeilBrown1-8/+160
The twl4030 allows control of the incoming current. Part of this control is a 'CGAIN' setting which doubles the range for half the precision. This control affects several different current setting, so all need to be updated at once when CGAIN is changed. With this patch, all of these current setting are managed by the driver, but most are left at their default settings. The current drawn is set to 500mA if the allow_usb module parameter is set, and to 100mA otherwise. More fine control will appear in later patches. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: split uA calculation into a function.NeilBrown1-13/+35
We will need this calculation in other places, so create functions to map between register value and uA value. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: trust phy to determine when USB power is available.NeilBrown1-27/+6
The usb phy driver already determines when VBUS is available, so repeating the test in the charger driver is pointless duplication. On probe, process the last event from the phy, and from then on, do whatever the phy tells us without double-checking. Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: correctly handle -EPROBE_DEFER from devm_usb_get_phy_by_nodeNeilBrown1-1/+5
Now that twl4030_bci_probe can safely return -EPROBE_DEFER, do so when devm_usb_get_phy_by_node returns that error. Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: convert to module_platform_driver instead of ..._probe.Pavel Machek1-3/+3
Drivers using module_platform_driver_probe cannot return EPROBE_DEFER from the probe function, which makes them rather useless these days... Convert to module_platform_driver() so EPROBE_DEFER can be used. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05twl4030_charger: use runtime_pm to keep usb phy active while charging.NeilBrown1-13/+5
The twl4030 usb phy needs to be active while we are using the USB VBUS as a current source for charging. In particular, the usb3v1 regulator must be enabled and the PHY_PWR_PHYPWD bit must be set to keep the phy powered. commit ab37813f4093a5f59cb8e083cde277289dc72ed3 twl4030_charger: Allow charger to control the regulator that feeds it gave the charger control over the regulator, but didn't resolve the PHY_PWR_PHYPWD issue. Now that both of these are controlled by runtime_pm in phy-twl4030-usb, we can simply take a runtime_pm reference to the USB phy whenever the charger wants to use it as a current source. So this patch reverts the above commit, and adds the necessary runtime_pm calls. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-03thermal: consistently use int for temperaturesSascha Hauer2-2/+2
The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Darren Hart <dvhart@linux.intel.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Peter Feuerer <peter@piie.net> Cc: Punit Agrawal <punit.agrawal@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean Delvare <jdelvare@suse.de> Cc: Peter Feuerer <peter@piie.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: linux-acpi@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Guenter Roeck <linux@roeck-us.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Darren Hart <dvhart@infradead.org> Cc: lm-sensors@lm-sensors.org Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-08-03rx51-battery: Set name to rx51-batteryPali Rohár1-1/+1
For compatibility between board code and DT, set battery name to same value. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27power: olpc_battery: clean up eeprom read functionVladimir Zapolskiy1-6/+1
The change removes redundant sysfs binary file boundary check while reading eeprom content from userspace, the check is done on caller side in fs/sysfs/file.c, if binary attribute size is not zero. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27power: ds2781_battery: clean up eeprom read/write functionsVladimir Zapolskiy1-8/+0
The change removes redundant calculation of left space on eeprom while reading or writing "param_eeprom" or "user_eeprom", the checks are not needed, since this task is done on caller side in fs/sysfs/file.c Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27power: ds2780_battery: clean up eeprom read/write functionsVladimir Zapolskiy1-18/+2
The change removes redundant sysfs binary file boundary checks while reading or writing "param_eeprom" or "user_eeprom", the checks are not needed, since this task is done on caller side in fs/sysfs/file.c Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27power_supply: bq24735: Convert to using managed resourcesVaishali Thakkar1-38/+13
Use managed resource functions like devm_kasprintf and devm_power_supply_register in bq24735_charger_probe. To be compatible with the change, replace various gotos by direct returns and drop unneeded labels. Also, remove bq24735_charger_remove as it is now redundant. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27power/reset: zx: Remove unnecessary include fileJun Nie1-2/+0
Including ARM related header file cause build failure in i386 build because COMILE_TEST also involve building zx driver. Remove the unnecessary include file. Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24power: bq27x00_battery: Checkpatch fixesAndrew F. Davis1-13/+11
Remove space before tab. Remove unnecessary line continuations. Add braces to else statement. Remove unnecessary parentheses. Remove unneeded blank lines. Remove unnecessary 'out of memory' message. Add missing line after declarations. Change use of printk to pr_err. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24power: bq27x00_battery: Fix function parameter alignmentAndrew F. Davis1-7/+7
Fix the alignment of function parameters on new lines. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24power: bq27x00_battery: Fix lines over 80 characters longAndrew F. Davis1-37/+37
Shorted lines over 80 characters long by reducing tab count. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24power: bq27x00_battery: Add manufacturer propertyAndrew F. Davis1-0/+9
Add the manufacturer property to the bq27x00 driver. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Dan Murphy <dmurphy@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24power/reset: zx: Register restart handlerJun Nie3-0/+90
Register with kernel restart handler instead of setting arm_pm_restart directly. Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24power/ltc2941-battery-gauge.c: Use the devicetree node name as supply nameMike Looijmans1-46/+8
Make it possible to set the name of the supply from the devicetree. Like other power supply drivers just use the node name. This makes the code smaller as well, as it doesn't need to allocate memory to hold the name and allocate a unique ID. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24twl4030_charger: use devres for power_supply_register and kzalloc.NeilBrown1-25/+11
Final allocations/registrations are now managed by devres. Signed-off-by: NeilBrown <neilb@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-24twl4030_charger: use devm_request_threaded_irqNeilBrown1-12/+6
This simplifies the error paths. Signed-off-by: NeilBrown <neilb@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-20power: reset: at91: add sama5d3 reset functionJosh Wu1-7/+19
This patch introduces a new compatible string: "atmel,sama5d3-rstc" and new reset function for sama5d3 and later chips. As in sama5d3 or later chips, we don't have to shutdown the DDR controller before reset. Shutdown the DDR controller before reset is a workaround to avoid DDR signal driving the bus, but since sama5d3 and later chips there is no such a conflict. So in this patch: 1. the sama5d3 reset function only need to write the rstc register and return. 2. we can remove the code related with sama5d3 DDR controller as we don't use it at all. Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-16drivers: max77693: Move state container to common headerKrzysztof Kozlowski1-0/+1
This prepares for merging some of the drivers between max77693 and max77843 so the child MFD driver can be attached to any parent MFD main driver. Move the state container to common header file. Additionally add consistent 'i2c' prefixes to its members (of 'struct i2c_client' type). Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-13power_supply: Drop owner assignment from i2c_driverKrzysztof Kozlowski3-3/+0
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-09power_supply: rt9455_charger: Properly notify userspace about charging eventsAnda-Maria Nicolae1-2/+14
Charging events this patch refers to are: - charger is connected to/disconnected from the power source - battery is reconnected to the charger, after it was absent. When the charger is connected to/disconnected from the power source, CHRVPI interrupt occurs and PWR_RDY bit is either set or cleared. PWR_RDY bit is updated after 1-2 seconds CHRVPI interrupt has occurred. power_supply_changed() should be called after PWR_RDY bit is updated. /sys/class/power_supply/rt9455-charger/online file displays the value of PWR_RDY bit. This way, if the userspace is notified that a charging event has occurred and the userspace reads /sys/class/power_supply/rt9455-charger/online file, this file is properly updated when the userspace reads it. This is the reason why power_supply_changed() is called in rt9455_pwr_rdy_work_callback(), instead of being called in interrupt handler. Since no interrupt is triggered when the battery is reconnected to the charger, the userspace is never notified that the battery is reconnected. This is why power_supply_changed() is called in rt9455_max_charging_time_work_callback(), so that the userspace is notified that the battery is reconnected. Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae@intel.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-02Merge tag 'module-builtin_driver-v4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linuxLinus Torvalds1-1/+1
Pull module_platform_driver replacement from Paul Gortmaker: "Replace module_platform_driver with builtin_platform driver in non modules. We see an increasing number of non-modular drivers using modular_driver() type register functions. There are several downsides to letting this continue unchecked: - The code can appear modular to a reader of the code, and they won't know if the code really is modular without checking the Makefile and Kconfig to see if compilation is governed by a bool or tristate. - Coders of drivers may be tempted to code up an __exit function that is never used, just in order to satisfy the required three args of the modular registration function. - Non-modular code ends up including the <module.h> which increases CPP overhead that they don't need. - It hinders us from performing better separation of the module init code and the generic init code. So here we introduce similar macros for builtin drivers. Then we convert builtin drivers (controlled by a bool Kconfig) by making the following type of mapping: module_platform_driver() ---> builtin_platform_driver() module_platform_driver_probe() ---> builtin_platform_driver_probe(). The set of drivers that are converted here are just the ones that showed up as relying on an implicit include of <module.h> during a pending header cleanup. So we convert them here vs adding an include of <module.h> to non-modular code to avoid compile fails. Additonal conversions can be done asynchronously at any time. Once again, an unused module_exit function that is removed here appears in the diffstat as an outlier wrt all the other changes" * tag 'module-builtin_driver-v4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: drivers/clk: convert sunxi/clk-mod0.c to use builtin_platform_driver drivers/power: Convert non-modular syscon-reboot to use builtin_platform_driver drivers/soc: Convert non-modular soc-realview to use builtin_platform_driver drivers/soc: Convert non-modular tegra/pmc to use builtin_platform_driver drivers/cpufreq: Convert non-modular s5pv210-cpufreq.c to use builtin_platform_driver drivers/cpuidle: Convert non-modular drivers to use builtin_platform_driver drivers/platform: Convert non-modular pdev_bus to use builtin_platform_driver platform_device: better support builtin boilerplate avoidance
2015-07-01Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linuxLinus Torvalds1-8/+8
Pull module updates from Rusty Russell: "Main excitement here is Peter Zijlstra's lockless rbtree optimization to speed module address lookup. He found some abusers of the module lock doing that too. A little bit of parameter work here too; including Dan Streetman's breaking up the big param mutex so writing a parameter can load another module (yeah, really). Unfortunately that broke the usual suspects, !CONFIG_MODULES and !CONFIG_SYSFS, so those fixes were appended too" * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (26 commits) modules: only use mod->param_lock if CONFIG_MODULES param: fix module param locks when !CONFIG_SYSFS. rcu: merge fix for Convert ACCESS_ONCE() to READ_ONCE() and WRITE_ONCE() module: add per-module param_lock module: make perm const params: suppress unused variable error, warn once just in case code changes. modules: clarify CONFIG_MODULE_COMPRESS help, suggest 'N'. kernel/module.c: avoid ifdefs for sig_enforce declaration kernel/workqueue.c: remove ifdefs over wq_power_efficient kernel/params.c: export param_ops_bool_enable_only kernel/params.c: generalize bool_enable_only kernel/module.c: use generic module param operaters for sig_enforce kernel/params: constify struct kernel_param_ops uses sysfs: tightened sysfs permission checks module: Rework module_addr_{min,max} module: Use __module_address() for module_address_lookup() module: Make the mod_tree stuff conditional on PERF_EVENTS || TRACING module: Optimize __module_address() using a latched RB-tree rbtree: Implement generic latch_tree seqlock: Introduce raw_read_seqcount_latch() ...
2015-06-26power: axp288_charger: fix for API changeStephen Rothwell1-3/+3
Caused by commit 843735b788a4 ("power: axp288_charger: axp288 charger driver") from the battery tree interacting with commit 046050f6e623 ("extcon: Update the prototype of extcon_register_notifier() with enum extcon") from the extcon tree. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-06-26Merge tag 'usb-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbLinus Torvalds1-12/+9
Pull USB updates from Greg KH: "Here's the big USB patchset for 4.2-rc1. As is normal these days, the majority of changes are in the gadget drivers, with a bunch of other small driver changes. All of these have been in linux-next with no reported issues" * tag 'usb-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (175 commits) usb: dwc3: Use ASCII space in Kconfig usb: chipidea: add work-around for Marvell HSIC PHY startup usb: chipidea: allow multiple instances to use default ci_default_pdata dt-bindings: Consolidate ChipIdea USB ci13xxx bindings phy: add Marvell HSIC 28nm PHY phy: Add Marvell USB 2.0 OTG 28nm PHY dt-bindings: Add Marvell PXA1928 USB and HSIC PHY bindings USB: ssb: use devm_kzalloc USB: ssb: fix error handling in ssb_hcd_create_pdev() usb: isp1760: check for null return from kzalloc cdc-acm: Add support of ATOL FPrint fiscal printers usb: chipidea: usbmisc_imx: Remove unneeded semicolon USB: usbtmc: add device quirk for Rigol DS6104 USB: serial: mos7840: Use setup_timer phy: twl4030-usb: add ABI documentation phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function. phy: twl4030-usb: remove pointless 'suspended' test in 'suspend' callback. phy: twl4030-usb: make runtime pm more reliable. drivers:usb:fsl: Fix compilation error for fsl ehci drv usb: renesas_usbhs: Don't disable the pipe if Control write status stage ...
2015-06-23Merge tag 'for-4.2' of git://git.infradead.org/battery-2.6Linus Torvalds21-88/+4971
Pull power supply and reset updates from Sebastian Reichel: - new charger drivers: BQ24257, BQ25890, AXP288, RT9455 - MAX17042 battery: add health & temperature support - BQ2415x charger: add ACPI support - misc fixes and cleanups * tag 'for-4.2' of git://git.infradead.org/battery-2.6: (32 commits) power_supply: Correct kerneldoc copy paste errors wm831x_power: Fix off-by-one at free_irq() power_supply: rt9455_charger: Fix error reported by static analysis tool power_supply: bq24257: use flags argument of devm_gpiod_get power_supply: bq25890: use flags argument of devm_gpiod_get sbs-battery: add option to always register battery power: Add devm_power_supply_get_by_phandle() helper function power_supply: max17042: Add OF support for setting thresholds power_supply: sysfs: Bring back write to writeable properties power_supply: rt9455_charger: Check if CONFIG_USB_PHY is enabled power: reset: gpio-restart: increase priority slightly power_supply: bq25890: make chip_id int power_supply: Add support for Richtek RT9455 battery charger Documentation: devicetree: Add Richtek RT9455 bindings of: Add vendor prefix for Richtek Technology Corporation power_supply: 88pm860x_charger: Do not call free_irq() twice power: bq24190_charger: Change first_time flag reset condition power: axp288_charger: axp288 charger driver power: max17042_battery: add HEALTH and TEMP_* properties support power_supply: Add support for TI BQ25890 charger chip ...
2015-06-19power_supply: Correct kerneldoc copy paste errorsBjorn Andersson1-3/+3
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>