1
0
Fork 0
Commit Graph

185 Commits (c1fecabecc352e40f99e6c5d7a74b8fcdfb38ae1)

Author SHA1 Message Date
Linus Torvalds c1fecabecc power supply and reset changes for the v4.19 series
* Improve support for TI bq20z75 in sbs-battery
 * Add Qualcomm PM8xxx reboot driver
 * Add cros-ec USBPD charger driver
 * Move ds2760 battery driver from w1 to power-supply and add DT support
 * Misc. fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlt8iTUACgkQ2O7X88g7
 +poDsQ//WKpd+hI0poP4X4MZ6cV3kmZH9u4Tbx1MsG7lywIE8BZZ+JQmeix9fmWp
 05reMM95zrgbWesY72/2Zpdj7G2IiNWPgaTCnBymyhcWM0y1gwM6ftHvY/Ed+pxz
 in4vjzwE0VIYK/lE64Evr1V8SqpKTtM3fco0M0snkrgyJ9FmAuT+fbnEyqNNdjHm
 hUSTRZGW6Cv1TFyhgf8bEm7s2paT5uhuABuaKYM2/XQ7PYTjF7IRA7QY871h2y6n
 9GQ7uZxtjYRTsQ5uBh1DDFuN56pvXFY1sdJxNtry+/JbQSIvzdHAVbS3mRYgbajJ
 ALfy2bKadNslbew5VSaEEswTNSZOcQ8/MNlA2o6C64mSbQ2gUfBB3wkWduO4o1jd
 uTAbCGYGCf89RocG53CieLIphK752Igd+41kkANZm0H5hu4bjNuZr1nHY1ynZSWG
 NNN1vus/IjPhd92Sx6joKHbOu9LXUukM/EQBHOGXUpgsh9zNmLnCVLLgH+jG792C
 uT3Sh4qHliWxfajd7uVR6ytALVgz6Vtp9Ry+SpOIgXMGYzcHH0x4H3Cn1gcgwu3O
 1PrTFk0+kgjZ7eOLz0X2niE3YE/+WvKKkjpf9fnimFhxppxdIA2aoJseXmYex6A2
 1tsos9wlV+Th5FAVAilq1DTKwGQ3UGTYNYbPbOaQtt9qimbCuYc=
 =UTGp
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:

 - Improve support for TI bq20z75 in sbs-battery

 - Add Qualcomm PM8xxx reboot driver

 - Add cros-ec USBPD charger driver

 - Move ds2760 battery driver from w1 to power-supply and add DT support

 - Misc fixes

* tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (28 commits)
  power: supply: bq27xxx: Update comments
  power: supply: max77693_charger: fix unintentional fall-through
  power: supply: mark expected switch fall-throughs
  power: supply: lego_ev3_battery: fix Vce offset
  power: supply: lego_ev3_battery: Don't ignore iio_read_channel_processed() return value
  power: supply: ds2760_battery: add devicetree probing
  power: supply: ds2760_battery: merge ds2760 supply driver with its w1 slave companion
  w1: core: match sub-nodes of bus masters in devicetree
  dt-bindings: w1: document bindings for ds2760 battery monitor
  dt-bindings: w1: document generic onewire bindings
  power: supply: adp5061: Fix a couple off by ones
  dt-bindings: power: reset: qcom: Add resin binding
  adp5061: New driver for ADP5061 I2C battery charger
  power: generic-adc-battery: check for duplicate properties copied from iio channels
  power: generic-adc-battery: fix out-of-bounds write when copying channel properties
  power: supply: axp288_charger: Fix initial constant_charge_current value
  power: supply: ab8500: stop using getnstimeofday64()
  power: gemini-poweroff: Avoid more spurious poweroffs
  power: vexpress: fix corruption in notifier registration
  power: remove possible deadlock when unregistering power_supply
  ...
2018-08-21 18:06:27 -07:00
Sebastian Reichel 5198a48381 Merge branch 'psy-fixes' into psy-next
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2018-08-16 22:19:22 +02:00
Randy Dunlap ac3167257b headers: separate linux/mod_devicetable.h from linux/platform_device.h
At over 4000 #includes, <linux/platform_device.h> is the 9th most
#included header file in the Linux kernel.  It does not need
<linux/mod_devicetable.h>, so drop that header and explicitly add
<linux/mod_devicetable.h> to source files that need it.

   4146 #include <linux/platform_device.h>

After this patch, there are 225 files that use <linux/mod_devicetable.h>,
for a reduction of around 3900 times that <linux/mod_devicetable.h>
does not have to be read & parsed.

    225 #include <linux/mod_devicetable.h>

This patch was build-tested on 20 different arch-es.

It also makes these drivers SubmitChecklist#1 compliant.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <lkp@intel.com> # drivers/media/platform/vimc/
Reported-by: kbuild test robot <lkp@intel.com> # drivers/pinctrl/pinctrl-u300.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-07 17:52:26 +02:00
Linus Walleij ada1de89f3 power: gemini-poweroff: Avoid more spurious poweroffs
Even after the previous fix I have experienced more spurious
poweroffs on the gemini SoC. After this fix it finally seems
to go away.

Fixes: f7a388d6cd ("power: reset: Add a driver for the Gemini poweroff")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-07-06 16:34:01 +02:00
Sudeep Holla 09bebb1adb power: vexpress: fix corruption in notifier registration
Vexpress platforms provide two different restart handlers: SYS_REBOOT
that restart the entire system, while DB_RESET only restarts the
daughter board containing the CPU. DB_RESET is overridden by SYS_REBOOT
if it exists.

notifier_chain_register used in register_restart_handler by design
relies on notifiers to be registered once only, however vexpress restart
notifier can get registered twice. When this happen it corrupts list
of notifiers, as result some notifiers can be not called on proper
event, traverse on list can be cycled forever, and second unregister
can access already freed memory.

So far, since this was the only restart handler in the system, no issue
was observed even if the same notifier was registered twice. However
commit 6c5c0d48b6 ("watchdog: sp805: add restart handler") added
support for SP805 restart handlers and since the system under test
contains two vexpress restart and two SP805 watchdog instances, it was
observed that during the boot traversing the restart handler list looped
forever as there's a cycle in that list resulting in boot hang.

This patch fixes the issues by ensuring that the notifier is installed
only once.

Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Fixes: 46c99ac662 ("power/reset: vexpress: Register with kernel restart handler")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-07-06 16:23:45 +02:00
Vinod Koul e6a578e289 power: reset: qcom-pon: Add Qcom PON driver
Add support Qualcomm PM8xxx PON which is responsible for reboot
mode support.

Co-developed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-07-06 15:53:58 +02:00
Alexey Khoroshilov f052df96c4 power: reset: zx-reboot: put device node in zx_reboot_probe()
zx_reboot_probe() increments refcnt of zx296702-pcu device node by
of_find_compatible_node() and leaves it undecremented on both
successful and error paths.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-06-28 14:20:38 +02:00
Mike Looijmans 77142a6112 gpio-poweroff: Use gpiod_set_value_cansleep
The power-off call is done in a context that must be able to sleep, so
use gpiod_set_value_cansleep instead of the atomic gpiod_set_value call.

This fixes a kernel warning at shutdown when the gpio is controlled
through an IO expander for example.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-04-25 23:05:59 +02:00
Ladislav Michl fd73a3e618 power: reset: at91-reset: Switch from the pr_*() to the dev_*() logging functions
Use dev_info() instead of pr_info().

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-19 20:51:17 +01:00
Ladislav Michl ab08824826 power: reset: at91-poweroff: Remove redundant dev_err call in at91_poweroff_probe()
There is an error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundancy.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-19 20:50:51 +01:00
Ladislav Michl 062836db01 power: reset: at91-poweroff: Switch from the pr_*() to the dev_*() logging functions
Use dev_info() instead of pr_info().

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-19 20:50:24 +01:00
Colin Ian King 93619fdec9 power: reset: make function sc27xx_poweroff_shutdown static
The function sc27xx_poweroff_shutdown is local to the source and does
not need to be in global scope, so make it static.

Cleans up sparse warning:
drivers/power/reset/sc27xx-poweroff.c:28:6: warning: symbol
'sc27xx_poweroff_shutdown' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-13 12:10:04 +01:00
Sebastian Reichel 75dd56c0cd Merge branch 'fixes' into for-next
Merge for-stable fixes branch into for-next development branch.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-12 14:35:10 +01:00
Moritz Fischer d85b4f7b7f power: reset: gpio-poweroff: Support for timeout from device property
Add support for reading a timeout value from device property.
Fall back to previous default of 3s if nothing is specified.

Signed-off-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2018-03-09 17:15:03 +01:00
Baolin Wang 3f5faf3a06 power: reset: Add Spreadtrum SC27xx PMIC power off support
On Spreadtrum platform, we need power off system through external SC27xx
series PMICs including the SC2720, SC2721, SC2723, SC2730 and SC2731 chips.
Thus this patch adds SC27xx series PMICs power-off support.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-03-09 17:11:31 +01:00
Linus Walleij 4a9be94055 power: gemini-poweroff: Avoid spurious poweroff
On the D-Link DIR-685 we get spurious poweroff from
infrared. Since that block (CIR) doesn't even have a
driver this can be safely ignored, we can revisit this
code once we have a device supporting CIR.

On the D-Link DNS-313 we get spurious poweroff from
the power button. This appears to be an initialization
issue: we need to enable the block (start the state
machine) before we clear any dangling IRQ.

This patch fixes both issues.

Fixes: f7a388d6cd ("power: reset: Add a driver for the Gemini poweroff")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-02-22 21:35:04 +01:00
Alexandre Belloni 6ab739bc1d power: reset: Add a driver for the Microsemi Ocelot reset
The Microsemi Ocelot SoC has a register allowing to reset the MIPS core.
Unfortunately, the syscon-reboot driver can't be used directly (but almost)
as the reset control may be disabled using another register.

Cc: linux-pm@vger.kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-02-12 11:23:46 +01:00
Julia Lawall 8eb96f136f power: reset: account for const type of of_device_id.data
This driver creates a const structure that it stores in the data
field of an of_device_id array.

Add const to the declaration of the location that receives a value
from the data field to ensure that the compiler will continue to check
that the value is not modified and remove the const-dropping cast on
the access to the data field.

Done using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-01-08 18:40:57 +01:00
Dong Aisheng baf61639b8 power: reset: remove unused imx-snvs-poweroff driver
There's no user of it in kernel now and it basically functions the same
as the generic syscon-poweroff.c to which we have already switched.
So let's remove it.

Cc: Robin Gong <yibin.gong@nxp.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-01-08 18:09:25 +01:00
Bjorn Andersson fd8b8f17d8 power: reset: msm: Clarify restart and poweroff
When PSHOLD in a Qualcomm platform is deasserted the PMIC will perform
either a power off or a restart of the system. The action to take is
configured in the PON block, which is controlled by a separate driver.

As the configuration logic was added to the pm8941-pwrkey driver the
comment in do_msm_poweroff() is no longer valid and the name
do_msm_restart() is misleading. Update the naming and drop the comment.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-01-08 18:04:43 +01:00
Jesse Chan 348c7cf5fc power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
This change resolves a new compile-time warning
when built as a loadable module:

WARNING: modpost: missing MODULE_LICENSE() in drivers/power/reset/zx-reboot.o
see include/linux/module.h for more information

This adds the license as "GPL v2", which matches the header of the file.

MODULE_DESCRIPTION and MODULE_AUTHOR are also added.

Signed-off-by: Jesse Chan <jc@linux.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-12-01 16:10:48 +01:00
Paul Burton fb615d61b5 Update MIPS email addresses
MIPS will soon not be a part of Imagination Technologies, and as such
many @imgtec.com email addresses will no longer be valid. This patch
updates the addresses for those who:

 - Have 10 or more patches in mainline authored using an @imgtec.com
   email address, or any patches dated within the past year.

 - Are still with Imagination but leaving as part of the MIPS business
   unit, as determined from an internal email address list.

 - Haven't already updated their email address (ie. JamesH) or expressed
   a desire to be excluded (ie. Maciej).

 - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
   myself.

New addresses are of the form firstname.lastname@mips.com, and all
verified against an internal email address list.  An entry is added to
.mailmap for each person such that get_maintainer.pl will report the new
addresses rather than @imgtec.com addresses which will soon be dead.

Instances of the affected addresses throughout the tree are then
mechanically replaced with the new @mips.com address.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
Acked-by: Dengcheng Zhu <dengcheng.zhu@mips.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Matt Redfearn <matt.redfearn@mips.com>
Acked-by: Matt Redfearn <matt.redfearn@mips.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: trivial@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-03 09:02:30 -07:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Rob Herring 2f04cd2a9b power: reset: Convert to using %pOF instead of full_name
Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-07-24 14:09:31 +02:00
Sebastian Reichel 153e9e90ff Merge branch 'psy-reboot-mode-immutable' into psy-next 2017-06-08 18:21:25 +02:00
Bjorn Andersson f1bea8793d power: reset: reboot-mode: Make include file global
Move the reboot-mode.h include file into include/linux to allow drivers
outside drivers/power/reset to implement reboot-mode.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-06-08 18:18:19 +02:00
Florian Fainelli 1d2495e8c2 power: reset: Default POWER_RESET_BRCMSTB to BMIPS_GENERIC
On Broadcom MIPS STB platforms, BMIPS_GENERIC is the Kconfig symbol that
is used, make this reboot driver default to that value to make sure we
can reboot a system properly.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-06-08 13:05:30 +02:00
Florian Fainelli 12031fcae9 power: reset: Allow selecting POWER_RESET_BRCMSTB on ARM64
Since commit 37eb56dc79 ("arm64: Add Broadcom Set Top Box Kconfig
entry point") we have ARCH_BRCMSTB also visible on ARM64 platform, yet
this reboot driver was not selectable, so fix that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-06-08 13:05:29 +02:00
Alexandre Belloni be04a0d77e power: reset: at91-sama5d2_shdwc: fix clobber list
Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6.

Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-06-08 13:05:29 +02:00
Alexandre Belloni 2e9bbbf694 power: reset: at91-poweroff: fix clobber list
Assembly in at91_lpddr_poweroff has r0 in the clobber list but uses r6.

Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-06-08 13:05:28 +02:00
Linus Walleij f7a388d6cd power: reset: Add a driver for the Gemini poweroff
The Gemini (SL3516) SoC has a special power controller block
that only deal with shutting down the system.

If you do not register a driver and activate the block, the
power button on the systems utilizing this SoC will do an
uncontrolled power cut, which is why it is important to have
a special poweroff driver.

The most basic functionality is to just shut down the system
by writing a special bit in the control register after the
system has reached pm_poweroff.

It also handles the poweroff from a button or other sources:

When the poweroff button is pressed, or a signal is sent to
poweroff from an infrared remote control, or when the RTC
fires a special alarm (!) the system emits an interrupt.
At this point, Linux must acknowledge the interrupt and
proceed to do an orderly shutdown of the system.

After adding this driver, pressing the poweroff button gives
this dmesg:

root@gemini:/
root@gemini:/ gemini-poweroff 4b000000.power-controller:
poweroff button pressed

calling shutdown scripts..
setting /dev/rtc0 from system time
unmounting file systems...
umount: tmpfs busy - remounted read-only
umount: can't unmount /: Invalid argument
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
uhci_hcd 0000:00:09.1: HCRESET not completed yet!
uhci_hcd 0000:00:09.0: HCRESET not completed yet!
reboot: Power down
gemini-poweroff 4b000000.power-controller: Gemini power off

Cc: Janos Laube <janos.dev@gmail.com>
Cc: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Cc: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-04-14 01:41:33 +02:00
Guy Shapiro f2c199db47 power: reset: syscon-poweroff: add a mask property
Make the syscon-poweroff driver accept value and mask instead of
just value.

Prior to this patch, the property name for the value was 'mask'. If
only the mask property is defined on a node, maintain compatibility
by using it as the value.

Signed-off-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-04-14 01:41:33 +02:00
Alexandre Belloni b6d30432e0 power: reset: at91-reset: remove leftover platform_device_id
commit eacd8d09db ("power/reset: at91-reset: remove useless
at91_reset_platform_probe()") removed non DT probe support but forgot to
remove the now useless id_table. Do that now.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-18 17:05:46 +01:00
Szemző András f22dfd86f0 power: reset: at91-reset: add samx7 support
Add samx7 support. It is lacking a few bits and needs a new reset function.

Signed-off-by: Szemző András <sza@esh.hu>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-18 17:05:38 +01:00
Alexandre Belloni 0b0408745e power: reset: at91-poweroff: timely shutdown LPDDR memories
LPDDR memories can only handle up to 400 uncontrolled power off. Ensure the
proper power off sequence is used before shutting down the platform.

Cc: <stable@vger.kernel.org> # 4.4+
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-16 23:21:33 +01:00
Thomas Gleixner 8b0e195314 ktime: Cleanup ktime_set() usage
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
2016-12-25 17:21:22 +01:00
Javier Martinez Canillas 93f7c27b4d power: reset: zx-reboot: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/zx-reboot.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/zx-reboot.ko | grep alias
alias:          of:N*T*Czte,sysctrlC*
alias:          of:N*T*Czte,sysctrl

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas 0a27aa9c31 power: reset: syscon-reboot-mode: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/syscon-reboot-mode.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/syscon-reboot-mode.ko | grep alias
alias:          of:N*T*Csyscon-reboot-modeC*
alias:          of:N*T*Csyscon-reboot-mode

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas c9ba9b7763 power: reset: at91-poweroff: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/at91-poweroff.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/at91-poweroff.ko | grep alias
alias:          of:N*T*Catmel,at91sam9x5-shdwcC*
alias:          of:N*T*Catmel,at91sam9x5-shdwc
alias:          of:N*T*Catmel,at91sam9rl-shdwcC*
alias:          of:N*T*Catmel,at91sam9rl-shdwc
alias:          of:N*T*Catmel,at91sam9260-shdwcC*
alias:          of:N*T*Catmel,at91sam9260-shdwc

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas 991de44036 power: reset: at91-reset: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/at91-reset.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/at91-reset.ko | grep alias
alias:          of:N*T*Catmel,sama5d3-rstcC*
alias:          of:N*T*Catmel,sama5d3-rstc
alias:          of:N*T*Catmel,at91sam9g45-rstcC*
alias:          of:N*T*Catmel,at91sam9g45-rstc
alias:          of:N*T*Catmel,at91sam9260-rstcC*
alias:          of:N*T*Catmel,at91sam9260-rstc
alias:          platform:at91-sam9g45-reset
alias:          platform:at91-sam9260-reset

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Paul Burton 29676833df power: reset: Add Intel PIIX4 poweroff driver
Add a driver which allows powering off the system via an Intel PIIX4
southbridge, by entering the PIIX4 SOff state. This is useful on the
MIPS Malta development board, where it will power down the FPGA based
board until its ON/NMI button is pressed, or the QEMU implementation of
the MIPS Malta board where it will cause QEMU to exit.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-18 05:13:37 +02:00
Peter Griffin 8ad5d85efd power: reset: st-poweroff: Remove obsolete platforms.
This patch removes support for STiH415/6 SoC's from the
st-poweroff driver, as support for these platforms is
being removed from the kernel.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Cc: <linux-pm@vger.kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:32:22 +02:00
Arvind Yadav 7531be5cdf power: reset: zx-reboot: Unmap region obtained by of_iomap
Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:25:41 +02:00
Arvind Yadav 896af83ef6 power: reset: xgene-reboot: Unmap region obtained by of_iomap
Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:24:06 +02:00
Colin Ian King 1dff6ce026 power: reset: add in missing white space in error message text
A dev_err message spans two lines and the literal string is missing
a white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:19:46 +02:00
Sebastian Reichel f7c8f1de03 Power Supply Fixes for 4.8 cycle
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJXsk2BAAoJENju1/PIO/qa0E4P/0rsS4Kzv+B61BJsoCIoXYOp
 p347gy6fS7QEJxSlHG430uVV74zlXQE3JTiBrjIdX2TKRA6EvD0RyM3/h+vfQU1c
 GviBJ53UwNlq1bBuJD1jkIHCvIW274FjX1h45Tytuzsi/8rLWas15oumnRFuOtyA
 UtgTbPtualYab01XgQyivv/dY4Dfb3d0aNPl3Nq77hAJMTVc9s1DLVqRMudqc0Zc
 e489mw+8l31L2pJs7CPxzNXqlS4YvMz4/mwbGCsqtEJTNHyzyrVH5VfCpMUNfGr4
 rZdqtF/nj/9c/DTIO6GvhoOVjja4MCEf3WpGCxrz2KUmhvxVTeBqsPStjE1xnC8u
 rNDDpRAwtjgpiw8fiEw+CXB5XsDMPmMSJi1KaOLz1q9O2GxHzoz2tgfjCh9V73qj
 J5pq1cQY2V6AkB+10WQ7afCnN3Zn2qDUoWXj2cvkd8yuvyfjTuC53Gd1sGpNk1dj
 f+euFLm6YYMvLv37vDCQDaxvzmud1Z60bgJy/uvbaVhcCABLUdbfwJpRf/3tWjp3
 rU3Lw43p5MPfBWHkZrzpQO33GEzO6FSrIkTr3YfVJiwAoViXgt5WEknbVde/pZDz
 Acn8UTE+6KeLrmrwA66pF++ewKjA7GgUzW50Ubju15rWujnwu5QVg/T+UVpGrB4k
 OYmwCtd5i2/OjnC+APnK
 =hK7R
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.8-rc' into psy-next

Power Supply Fixes for 4.8 cycle
2016-08-16 01:17:42 +02:00
Bjorn Andersson 8dfdd2a842 power: reset: syscon-reboot-mode: Use managed resource API
Use the managed resource version of reboot_mode_register().

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:29:34 +02:00
Bjorn Andersson c1a9634f1a power: reset: reboot-mode: Add managed resource API
Provide managed resource version of reboot_mode_register() and
reboot_mode_unregister() to simplify implementations.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:29:22 +02:00
Arvind Yadav bae170efd6 power: reset: hisi-reboot: Unmap region obtained by of_iomap
Free memory mapping, if probe is not successful.

Fixes: 4a9b373718 ("power: reset: move hisilicon reboot code")
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-12 22:42:37 +02:00
Andy Yan 7a4947cf6f power: reset: reboot-mode: fix build error of missing ioremap/iounmap on UM
commit 4fcd504edb ("power: reset: add reboot mode driver") uses api from
syscon, and syscon uses ioremap/iounmap which depends on HAS_IOMEM, so
let's depend on MFD_SYSCON instead of selecting it directly to avoid the
um-allyesconfig like build error on archs that without iomem:

drivers/mfd/syscon.c: In function 'of_syscon_register':
drivers/mfd/syscon.c:67:9: error: implicit declaration of function 'ioremap' [-Werror=implicit-function-declaration]
  base = ioremap(res.start, resource_size(&res));
         ^
drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  base = ioremap(res.start, resource_size(&res));
       ^
drivers/mfd/syscon.c:109:2: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
  iounmap(base);
  ^

Reported-by: Kbuild test robot <fengguang.wu@intel.com>
Fixes: 4fcd504edbf7("power: reset: add reboot mode driver")
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-12 22:42:36 +02:00