Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1651786 > unrolled thread
| Started by | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| First post | 2017-05-27 09:00 +0200 |
| Last post | 2017-05-30 06:50 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/2] power: reset: reboot-mode: Make include file global Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-05-27 09:00 +0200
[PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-05-27 09:00 +0200
Re: [PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-05-30 05:00 +0200
Re: [PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-05-30 06:50 +0200
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Date | 2017-05-27 09:00 +0200 |
| Subject | [PATCH 1/2] power: reset: reboot-mode: Make include file global |
| Message-ID | <tLDRD-8cl-1@gated-at.bofh.it> |
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>
---
drivers/power/reset/reboot-mode.c | 2 +-
drivers/power/reset/syscon-reboot-mode.c | 2 +-
{drivers/power/reset => include/linux}/reboot-mode.h | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename {drivers/power/reset => include/linux}/reboot-mode.h (100%)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index fb512183ace3..8f975ca0a8c4 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -13,7 +13,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/reboot.h>
-#include "reboot-mode.h"
+#include <linux/reboot-mode.h>
#define PREFIX "mode-"
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index c8c371b285b1..563a97d7f73e 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -15,7 +15,7 @@
#include <linux/reboot.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
-#include "reboot-mode.h"
+#include <linux/reboot-mode.h>
struct syscon_reboot_mode {
struct regmap *map;
diff --git a/drivers/power/reset/reboot-mode.h b/include/linux/reboot-mode.h
similarity index 100%
rename from drivers/power/reset/reboot-mode.h
rename to include/linux/reboot-mode.h
--
2.12.0
[toc] | [next] | [standalone]
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Date | 2017-05-27 09:00 +0200 |
| Subject | [PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support |
| Message-ID | <tLDRD-8cl-3@gated-at.bofh.it> |
| In reply to | #1651786 |
In some Qualcomm platforms the magic for informing LK which mode to
reboot into is stored in the PON_SOFT_RB_SPARE register. Register with
the reboot mode helpers to expose this to the user.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
drivers/input/misc/Kconfig | 1 +
drivers/input/misc/pm8941-pwrkey.c | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 3872488c3fd7..56552e16fab1 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -132,6 +132,7 @@ config INPUT_PCSPKR
config INPUT_PM8941_PWRKEY
tristate "Qualcomm PM8941 power key support"
depends on MFD_SPMI_PMIC
+ select REBOOT_MODE
help
Say Y here if you want support for the power key usually found
on boards using a Qualcomm PM8941 compatible PMIC.
diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
index 18ad956454f1..c48be6dbaa78 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -22,6 +22,7 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
+#include <linux/reboot-mode.h>
#include <linux/regmap.h>
#define PON_REV2 0x01
@@ -42,6 +43,7 @@
#define PON_DBC_CTL 0x71
#define PON_DBC_DELAY_MASK 0x7
+#define PON_SOFT_RB_SPARE 0x8f
struct pm8941_pwrkey {
struct device *dev;
@@ -52,8 +54,26 @@ struct pm8941_pwrkey {
unsigned int revision;
struct notifier_block reboot_notifier;
+
+ struct reboot_mode_driver reboot_mode;
};
+static int pm8941_reboot_mode_write(struct reboot_mode_driver *reboot,
+ unsigned int magic)
+{
+ struct pm8941_pwrkey *pwrkey = container_of(reboot, struct pm8941_pwrkey,
+ reboot_mode);
+ int ret;
+
+ ret = regmap_update_bits(pwrkey->regmap,
+ pwrkey->baseaddr + PON_SOFT_RB_SPARE,
+ 0xfc, magic << 2);
+ if (ret < 0)
+ dev_err(pwrkey->dev, "update reboot mode bits failed\n");
+
+ return ret;
+}
+
static int pm8941_reboot_notify(struct notifier_block *nb,
unsigned long code, void *unused)
{
@@ -256,6 +276,14 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
return error;
}
+ pwrkey->reboot_mode.dev = &pdev->dev;
+ pwrkey->reboot_mode.write = pm8941_reboot_mode_write;
+ error = devm_reboot_mode_register(&pdev->dev, &pwrkey->reboot_mode);
+ if (error) {
+ dev_err(&pdev->dev, "can't register reboot mode\n");
+ return error;
+ }
+
platform_set_drvdata(pdev, pwrkey);
device_init_wakeup(&pdev->dev, 1);
--
2.12.0
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Date | 2017-05-30 05:00 +0200 |
| Subject | Re: [PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support |
| Message-ID | <tMFy2-12b-5@gated-at.bofh.it> |
| In reply to | #1651787 |
On Fri, May 26, 2017 at 11:51:30PM -0700, Bjorn Andersson wrote:
> In some Qualcomm platforms the magic for informing LK which mode to
> reboot into is stored in the PON_SOFT_RB_SPARE register. Register with
> the reboot mode helpers to expose this to the user.
Hmm, is the power key driver the best place to have this? WHy isn't this
a driver in its own right?
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> drivers/input/misc/Kconfig | 1 +
> drivers/input/misc/pm8941-pwrkey.c | 28 ++++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 3872488c3fd7..56552e16fab1 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -132,6 +132,7 @@ config INPUT_PCSPKR
> config INPUT_PM8941_PWRKEY
> tristate "Qualcomm PM8941 power key support"
> depends on MFD_SPMI_PMIC
> + select REBOOT_MODE
> help
> Say Y here if you want support for the power key usually found
> on boards using a Qualcomm PM8941 compatible PMIC.
> diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
> index 18ad956454f1..c48be6dbaa78 100644
> --- a/drivers/input/misc/pm8941-pwrkey.c
> +++ b/drivers/input/misc/pm8941-pwrkey.c
> @@ -22,6 +22,7 @@
> #include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/reboot.h>
> +#include <linux/reboot-mode.h>
> #include <linux/regmap.h>
>
> #define PON_REV2 0x01
> @@ -42,6 +43,7 @@
> #define PON_DBC_CTL 0x71
> #define PON_DBC_DELAY_MASK 0x7
>
> +#define PON_SOFT_RB_SPARE 0x8f
>
> struct pm8941_pwrkey {
> struct device *dev;
> @@ -52,8 +54,26 @@ struct pm8941_pwrkey {
>
> unsigned int revision;
> struct notifier_block reboot_notifier;
> +
> + struct reboot_mode_driver reboot_mode;
> };
>
> +static int pm8941_reboot_mode_write(struct reboot_mode_driver *reboot,
> + unsigned int magic)
> +{
> + struct pm8941_pwrkey *pwrkey = container_of(reboot, struct pm8941_pwrkey,
> + reboot_mode);
> + int ret;
> +
> + ret = regmap_update_bits(pwrkey->regmap,
> + pwrkey->baseaddr + PON_SOFT_RB_SPARE,
> + 0xfc, magic << 2);
> + if (ret < 0)
> + dev_err(pwrkey->dev, "update reboot mode bits failed\n");
> +
> + return ret;
> +}
> +
> static int pm8941_reboot_notify(struct notifier_block *nb,
> unsigned long code, void *unused)
> {
> @@ -256,6 +276,14 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
> return error;
> }
>
> + pwrkey->reboot_mode.dev = &pdev->dev;
> + pwrkey->reboot_mode.write = pm8941_reboot_mode_write;
> + error = devm_reboot_mode_register(&pdev->dev, &pwrkey->reboot_mode);
> + if (error) {
> + dev_err(&pdev->dev, "can't register reboot mode\n");
> + return error;
> + }
> +
> platform_set_drvdata(pdev, pwrkey);
> device_init_wakeup(&pdev->dev, 1);
>
> --
> 2.12.0
>
Thanks.
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Date | 2017-05-30 06:50 +0200 |
| Subject | Re: [PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support |
| Message-ID | <tMHgt-2mn-7@gated-at.bofh.it> |
| In reply to | #1652785 |
On Mon 29 May 19:53 PDT 2017, Dmitry Torokhov wrote: > On Fri, May 26, 2017 at 11:51:30PM -0700, Bjorn Andersson wrote: > > In some Qualcomm platforms the magic for informing LK which mode to > > reboot into is stored in the PON_SOFT_RB_SPARE register. Register with > > the reboot mode helpers to expose this to the user. > > Hmm, is the power key driver the best place to have this? WHy isn't this > a driver in its own right? > The functionality is part of the "PON" block in the Qualcomm PMICs, other functionality from this block relates to configuration and handling related to power-key and reset-key. Several of these properties are intermingled, so I do believe it's best to handle them in a single driver; that said, it might no longer be correct to name the driver "pwrkey" or that it is a "misc input" driver. Regards, Bjorn
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web