* [PATCH v4 5/8] dt-bindings: input: document stpmic1 pmic onkey
From: Pascal PAILLET-LME @ 2018-10-18 9:02 UTC (permalink / raw)
To: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
Cc: Pascal PAILLET-LME
In-Reply-To: <1539853324-29051-1-git-send-email-p.paillet@st.com>
From: pascal paillet <p.paillet@st.com>
The stpmic1 pmic is able to manage an onkey button. It can be configured
to shut-down the power supplies on a long key-press with an adjustable
duration.
Signed-off-by: pascal paillet <p.paillet@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
changes in v4:
* remove interrupt-parent description
* remove st,onkey-pwroff-enabled and power-off-time-sec properties
.../devicetree/bindings/input/st,stpmic1-onkey.txt | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt
diff --git a/Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt b/Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt
new file mode 100644
index 0000000..4494613
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/st,stpmic1-onkey.txt
@@ -0,0 +1,28 @@
+STMicroelectronics STPMIC1 Onkey
+
+Required properties:
+
+- compatible = "st,stpmic1-onkey";
+- interrupts: interrupt line to use
+- interrupt-names = "onkey-falling", "onkey-rising"
+ onkey-falling: happens when onkey is pressed; IT_PONKEY_F of pmic
+ onkey-rising: happens when onkey is released; IT_PONKEY_R of pmic
+
+Optional properties:
+
+- st,onkey-clear-cc-flag: onkey is able power on after an
+ over-current shutdown event.
+- st,onkey-pu-inactive: onkey pull up is not active
+- power-off-time-sec: Duration in seconds which the key should be kept
+ pressed for device to power off automatically (from 1 to 16 seconds).
+ see See Documentation/devicetree/bindings/input/keys.txt
+
+Example:
+
+onkey {
+ compatible = "st,stpmic1-onkey";
+ interrupt-parent = <&pmic>;
+ interrupts = <IT_PONKEY_F 0>,<IT_PONKEY_R 1>;
+ interrupt-names = "onkey-falling", "onkey-rising";
+ power-off-time-sec = <10>;
+};
--
1.9.1
^ permalink raw reply related
* [PATCH v4 6/8] input: stpmic1: add stpmic1 onkey driver
From: Pascal PAILLET-LME @ 2018-10-18 9:02 UTC (permalink / raw)
To: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
Cc: Pascal PAILLET-LME
In-Reply-To: <1539853324-29051-1-git-send-email-p.paillet@st.com>
From: pascal paillet <p.paillet@st.com>
The stpmic1 pmic is able to manage an onkey button. This driver exposes
the stpmic1 onkey as an input device. It can also be configured to
shut-down the power supplies on a long key-press with an adjustable
duration.
Signed-off-by: pascal paillet <p.paillet@st.com>
---
changes in v4:
* remove remove function
* merge stpmic1_onkey_dt_params() in probe function
* suppresse struct pmic_onkey_config
* rename PONKEY_PU_ACTIVE to PONKEY_PU_INACTIVE
drivers/input/misc/Kconfig | 11 +++
drivers/input/misc/Makefile | 2 +
drivers/input/misc/stpmic1_onkey.c | 197 +++++++++++++++++++++++++++++++++++++
3 files changed, 210 insertions(+)
create mode 100644 drivers/input/misc/stpmic1_onkey.c
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index ca59a2b..279fb02 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -851,4 +851,15 @@ config INPUT_SC27XX_VIBRA
To compile this driver as a module, choose M here. The module will
be called sc27xx_vibra.
+config INPUT_STPMIC1_ONKEY
+ tristate "STPMIC1 PMIC Onkey support"
+ depends on MFD_STPMIC1
+ help
+ Say Y to enable support of onkey embedded into STPMIC1 PMIC. onkey
+ can be used to wakeup from low power modes and force a shut-down on
+ long press.
+
+ To compile this driver as a module, choose M here: the
+ module will be called stpmic1_onkey.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 9d0f9d1..1b44202 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
+obj-$(CONFIG_INPUT_STPMIC1_ONKEY) += stpmic1_onkey.o
obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON) += tps65218-pwrbutton.o
obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o
@@ -81,3 +82,4 @@ obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
+
diff --git a/drivers/input/misc/stpmic1_onkey.c b/drivers/input/misc/stpmic1_onkey.c
new file mode 100644
index 0000000..6a7f08b
--- /dev/null
+++ b/drivers/input/misc/stpmic1_onkey.c
@@ -0,0 +1,197 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) STMicroelectronics 2018
+// Author: Pascal Paillet <p.paillet@st.com> for STMicroelectronics.
+
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/stpmic1.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/regmap.h>
+
+/**
+ * struct stpmic1_onkey - OnKey data
+ * @input_dev: pointer to input device
+ * @irq_falling: irq that we are hooked on to
+ * @irq_rising: irq that we are hooked on to
+ */
+struct stpmic1_onkey {
+ struct input_dev *input_dev;
+ int irq_falling;
+ int irq_rising;
+};
+
+static irqreturn_t onkey_falling_irq(int irq, void *ponkey)
+{
+ struct stpmic1_onkey *onkey = ponkey;
+ struct input_dev *input_dev = onkey->input_dev;
+
+ input_report_key(input_dev, KEY_POWER, 1);
+ pm_wakeup_event(input_dev->dev.parent, 0);
+ input_sync(input_dev);
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t onkey_rising_irq(int irq, void *ponkey)
+{
+ struct stpmic1_onkey *onkey = ponkey;
+ struct input_dev *input_dev = onkey->input_dev;
+
+ input_report_key(input_dev, KEY_POWER, 0);
+ pm_wakeup_event(input_dev->dev.parent, 0);
+ input_sync(input_dev);
+
+ return IRQ_HANDLED;
+}
+
+static int stpmic1_onkey_probe(struct platform_device *pdev)
+{
+ struct stpmic1 *pmic = dev_get_drvdata(pdev->dev.parent);
+ struct device *dev = &pdev->dev;
+ struct input_dev *input_dev;
+ struct stpmic1_onkey *onkey;
+ unsigned int val, reg = 0;
+ int error;
+
+ onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL);
+ if (!onkey)
+ return -ENOMEM;
+
+ onkey->irq_falling = platform_get_irq_byname(pdev, "onkey-falling");
+ if (onkey->irq_falling < 0) {
+ dev_err(dev, "failed: request IRQ onkey-falling %d\n",
+ onkey->irq_falling);
+ return onkey->irq_falling;
+ }
+
+ onkey->irq_rising = platform_get_irq_byname(pdev, "onkey-rising");
+ if (onkey->irq_rising < 0) {
+ dev_err(dev, "failed: request IRQ onkey-rising %d\n",
+ onkey->irq_rising);
+ return onkey->irq_rising;
+ }
+
+ if (!device_property_read_u32(dev, "power-off-time-sec", &val)) {
+ if ((val > 0) && (val <= 16)) {
+ dev_dbg(dev, "power-off-time=%d seconds\n", val);
+ reg |= PONKEY_PWR_OFF;
+ reg |= ((16 - val) & PONKEY_TURNOFF_TIMER_MASK);
+ } else {
+ dev_err(dev, "power-off-time-sec out of range\n");
+ return -EINVAL;
+ }
+ }
+
+ if (device_property_present(dev, "st,onkey-clear-cc-flag"))
+ reg |= PONKEY_CC_FLAG_CLEAR;
+
+ error = regmap_update_bits(pmic->regmap, PKEY_TURNOFF_CR,
+ PONKEY_TURNOFF_MASK, reg);
+ if (error) {
+ dev_err(dev, "PKEY_TURNOFF_CR write failed: %d\n", error);
+ return error;
+ }
+
+ if (device_property_present(dev, "st,onkey-pu-inactive")) {
+ error = regmap_update_bits(pmic->regmap, PADS_PULL_CR,
+ PONKEY_PU_INACTIVE,
+ PONKEY_PU_INACTIVE);
+ if (error) {
+ dev_err(dev, "ONKEY Pads configuration failed: %d\n", error);
+ return error;
+ }
+ }
+
+ input_dev = devm_input_allocate_device(dev);
+ if (!input_dev) {
+ dev_err(dev, "Can't allocate Pwr Onkey Input Device\n");
+ return -ENOMEM;
+ }
+
+ input_dev->name = "pmic_onkey";
+ input_dev->phys = "pmic_onkey/input0";
+
+ input_set_capability(input_dev, EV_KEY, KEY_POWER);
+
+ onkey->input_dev = input_dev;
+
+ /* interrupt is nested in a thread */
+ error = devm_request_threaded_irq(dev, onkey->irq_falling, NULL,
+ onkey_falling_irq, IRQF_ONESHOT,
+ dev_name(dev), onkey);
+ if (error) {
+ dev_err(dev, "Can't get IRQ Onkey Falling: %d\n", error);
+ return error;
+ }
+
+ error = devm_request_threaded_irq(dev, onkey->irq_rising, NULL,
+ onkey_rising_irq, IRQF_ONESHOT,
+ dev_name(dev), onkey);
+ if (error) {
+ dev_err(dev, "Can't get IRQ Onkey Rising: %d\n", error);
+ return error;
+ }
+
+ error = input_register_device(input_dev);
+ if (error) {
+ dev_err(dev, "Can't register power button: %d\n", error);
+ return error;
+ }
+
+ platform_set_drvdata(pdev, onkey);
+ device_init_wakeup(dev, true);
+
+ return 0;
+}
+
+static int __maybe_unused stpmic1_onkey_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct stpmic1_onkey *onkey = platform_get_drvdata(pdev);
+
+ if (device_may_wakeup(dev)) {
+ enable_irq_wake(onkey->irq_falling);
+ enable_irq_wake(onkey->irq_rising);
+ }
+ return 0;
+}
+
+static int __maybe_unused stpmic1_onkey_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct stpmic1_onkey *onkey = platform_get_drvdata(pdev);
+
+ if (device_may_wakeup(dev)) {
+ disable_irq_wake(onkey->irq_falling);
+ disable_irq_wake(onkey->irq_rising);
+ }
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm,
+ stpmic1_onkey_suspend,
+ stpmic1_onkey_resume);
+
+static const struct of_device_id of_stpmic1_onkey_match[] = {
+ { .compatible = "st,stpmic1-onkey" },
+ { },
+};
+
+MODULE_DEVICE_TABLE(of, of_stpmic1_onkey_match);
+
+static struct platform_driver stpmic1_onkey_driver = {
+ .probe = stpmic1_onkey_probe,
+ .driver = {
+ .name = "stpmic1_onkey",
+ .of_match_table = of_match_ptr(of_stpmic1_onkey_match),
+ .pm = &stpmic1_onkey_pm,
+ },
+};
+module_platform_driver(stpmic1_onkey_driver);
+
+MODULE_DESCRIPTION("Onkey driver for STPMIC1");
+MODULE_AUTHOR("Pascal Paillet <p.paillet@st.com>");
+MODULE_LICENSE("GPL v2");
--
1.9.1
^ permalink raw reply related
* [PATCH v4 7/8] dt-bindings: watchdog: document stpmic1 pmic watchdog
From: Pascal PAILLET-LME @ 2018-10-18 9:02 UTC (permalink / raw)
To: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
Cc: Pascal PAILLET-LME
In-Reply-To: <1539853324-29051-1-git-send-email-p.paillet@st.com>
From: pascal paillet <p.paillet@st.com>
The stpmic1 PMIC embeds a watchdog which is disabled by default.
In case of watchdog, the PMIC goes off.
Signed-off-by: pascal paillet <p.paillet@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/watchdog/st,stpmic1-wdt.txt | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 Documentation/devicetree/bindings/watchdog/st,stpmic1-wdt.txt
diff --git a/Documentation/devicetree/bindings/watchdog/st,stpmic1-wdt.txt b/Documentation/devicetree/bindings/watchdog/st,stpmic1-wdt.txt
new file mode 100644
index 0000000..7cc1407
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/st,stpmic1-wdt.txt
@@ -0,0 +1,11 @@
+STMicroelectronics STPMIC1 Watchdog
+
+Required properties:
+
+- compatible : should be "st,stpmic1-wdt"
+
+Example:
+
+watchdog {
+ compatible = "st,stpmic1-wdt";
+};
--
1.9.1
^ permalink raw reply related
* [PATCH v4 8/8] watchdog: stpmic1: add stpmic1 watchdog driver
From: Pascal PAILLET-LME @ 2018-10-18 9:02 UTC (permalink / raw)
To: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
Cc: Pascal PAILLET-LME
In-Reply-To: <1539853324-29051-1-git-send-email-p.paillet@st.com>
From: pascal paillet <p.paillet@st.com>
The stpmic1 PMIC embeds a watchdog which is disabled by default. As soon
as the watchdog is started, it must be refreshed periodically otherwise
the PMIC goes off.
Signed-off-by: pascal paillet <p.paillet@st.com>
---
changes in v4:
* fix stop watchdog function
* Kconfig: fix grammar issue
drivers/watchdog/Kconfig | 12 ++++
drivers/watchdog/Makefile | 1 +
drivers/watchdog/stpmic1_wdt.c | 139 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 152 insertions(+)
create mode 100644 drivers/watchdog/stpmic1_wdt.c
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 5ea8909..6d2ffef 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -806,6 +806,18 @@ config STM32_WATCHDOG
To compile this driver as a module, choose M here: the
module will be called stm32_iwdg.
+config STPMIC1_WATCHDOG
+ tristate "STPMIC1 PMIC watchdog support"
+ depends on MFD_STPMIC1
+ select WATCHDOG_CORE
+ help
+ Say Y here to include watchdog support embedded into STPMIC1 PMIC.
+ If the watchdog timer expires, stpmic1 will shut down all its power
+ supplies.
+
+ To compile this driver as a module, choose M here: the
+ module will be called spmic1_wdt.
+
config UNIPHIER_WATCHDOG
tristate "UniPhier watchdog support"
depends on ARCH_UNIPHIER || COMPILE_TEST
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index bf92e7b..2649cf3 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -217,3 +217,4 @@ obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
obj-$(CONFIG_MENF21BMC_WATCHDOG) += menf21bmc_wdt.o
obj-$(CONFIG_MENZ069_WATCHDOG) += menz69_wdt.o
obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o
+obj-$(CONFIG_STPMIC1_WATCHDOG) += stpmic1_wdt.o
diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
new file mode 100644
index 0000000..a6cbc27
--- /dev/null
+++ b/drivers/watchdog/stpmic1_wdt.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) STMicroelectronics 2018
+// Author: Pascal Paillet <p.paillet@st.com> for STMicroelectronics.
+
+#include <linux/kernel.h>
+#include <linux/mfd/stpmic1.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/watchdog.h>
+
+/* WATCHDOG CONTROL REGISTER bit */
+#define WDT_START BIT(0)
+#define WDT_PING BIT(1)
+#define WDT_START_MASK BIT(0)
+#define WDT_PING_MASK BIT(1)
+#define WDT_STOP 0
+
+#define PMIC_WDT_MIN_TIMEOUT 1
+#define PMIC_WDT_MAX_TIMEOUT 256
+#define PMIC_WDT_DEFAULT_TIMEOUT 30
+
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout,
+ "Watchdog cannot be stopped once started (default="
+ __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+struct stpmic1_wdt {
+ struct stpmic1 *pmic;
+ struct watchdog_device wdtdev;
+};
+
+static int pmic_wdt_start(struct watchdog_device *wdd)
+{
+ struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
+
+ return regmap_update_bits(wdt->pmic->regmap,
+ WCHDG_CR, WDT_START_MASK, WDT_START);
+}
+
+static int pmic_wdt_stop(struct watchdog_device *wdd)
+{
+ struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
+
+ return regmap_update_bits(wdt->pmic->regmap,
+ WCHDG_CR, WDT_START_MASK, WDT_STOP);
+}
+
+static int pmic_wdt_ping(struct watchdog_device *wdd)
+{
+ struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
+
+ return regmap_update_bits(wdt->pmic->regmap,
+ WCHDG_CR, WDT_PING_MASK, WDT_PING);
+}
+
+static int pmic_wdt_set_timeout(struct watchdog_device *wdd,
+ unsigned int timeout)
+{
+ struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
+
+ wdd->timeout = timeout;
+ /* timeout is equal to register value + 1 */
+ return regmap_write(wdt->pmic->regmap, WCHDG_TIMER_CR, timeout - 1);
+}
+
+static const struct watchdog_info pmic_watchdog_info = {
+ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
+ .identity = "STPMIC1 PMIC Watchdog",
+};
+
+static const struct watchdog_ops pmic_watchdog_ops = {
+ .owner = THIS_MODULE,
+ .start = pmic_wdt_start,
+ .stop = pmic_wdt_stop,
+ .ping = pmic_wdt_ping,
+ .set_timeout = pmic_wdt_set_timeout,
+};
+
+static int pmic_wdt_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct stpmic1 *pmic;
+ struct stpmic1_wdt *wdt;
+
+ if (!pdev->dev.parent)
+ return -EINVAL;
+
+ pmic = dev_get_drvdata(pdev->dev.parent);
+ if (!pmic)
+ return -EINVAL;
+
+ wdt = devm_kzalloc(&pdev->dev, sizeof(struct stpmic1_wdt), GFP_KERNEL);
+ if (!wdt)
+ return -ENOMEM;
+
+ wdt->pmic = pmic;
+
+ wdt->wdtdev.info = &pmic_watchdog_info;
+ wdt->wdtdev.ops = &pmic_watchdog_ops;
+ wdt->wdtdev.min_timeout = PMIC_WDT_MIN_TIMEOUT;
+ wdt->wdtdev.max_timeout = PMIC_WDT_MAX_TIMEOUT;
+
+ wdt->wdtdev.timeout = PMIC_WDT_DEFAULT_TIMEOUT;
+ watchdog_init_timeout(&wdt->wdtdev, 0, &pdev->dev);
+
+ watchdog_set_nowayout(&wdt->wdtdev, nowayout);
+ watchdog_set_drvdata(&wdt->wdtdev, wdt);
+
+ ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdtdev);
+ if (ret)
+ return ret;
+
+ dev_dbg(wdt->pmic->dev, "PMIC Watchdog driver probed\n");
+ return 0;
+}
+
+static const struct of_device_id of_pmic_wdt_match[] = {
+ { .compatible = "st,stpmic1-wdt" },
+ { },
+};
+
+MODULE_DEVICE_TABLE(of, of_pmic_wdt_match);
+
+static struct platform_driver stpmic1_wdt_driver = {
+ .probe = pmic_wdt_probe,
+ .driver = {
+ .name = "stpmic1-wdt",
+ .of_match_table = of_pmic_wdt_match,
+ },
+};
+module_platform_driver(stpmic1_wdt_driver);
+
+MODULE_DESCRIPTION("Watchdog driver for STPMIC1 device");
+MODULE_AUTHOR("Pascal Paillet <p.paillet@st.com>");
+MODULE_LICENSE("GPL v2");
--
1.9.1
^ permalink raw reply related
* Re: [PATCH 3/5] dt-bindings: add more optional properties for elan_i2c touchpads
From: Rob Herring @ 2018-10-18 13:04 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Hans de Goede, Dmitry Torokhov, KT Liao, linux-input,
linux-kernel@vger.kernel.org, devicetree
In-Reply-To: <CAO-hwJ+z6YdnLdbzeh-7f99cBBjHfbLKLzKo-fQQaC_W8bt_Uw@mail.gmail.com>
On Thu, Oct 18, 2018 at 3:10 AM Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>
> On Wed, Oct 17, 2018 at 10:15 PM Rob Herring <robh@kernel.org> wrote:
> >
> > On Fri, Oct 12, 2018 at 04:24:11PM +0200, Benjamin Tissoires wrote:
> > > Some new touchpads IC are connected through PS/2 and I2C. On some of these
> > > new IC, the I2C part doesn't have all of the information available.
> > > We need to be able to forward the touchpad parameters from PS/2 and
> > > thus, we need those new optional properties.
> > >
> > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=1628715
> > > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > > ---
> > > Documentation/devicetree/bindings/input/elan_i2c.txt | 8 ++++++++
> > > 1 file changed, 8 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/input/elan_i2c.txt b/Documentation/devicetree/bindings/input/elan_i2c.txt
> > > index 797607460735..ace6bcb0b4eb 100644
> > > --- a/Documentation/devicetree/bindings/input/elan_i2c.txt
> > > +++ b/Documentation/devicetree/bindings/input/elan_i2c.txt
> > > @@ -13,6 +13,14 @@ Optional properties:
> > > pinctrl binding [1]).
> > > - vcc-supply: a phandle for the regulator supplying 3.3V power.
> > > - elan,trackpoint: touchpad can support a trackpoint (boolean)
> > > +- elan,clickpad: touchpad is a clickpad (the entire surface is a button)
> >
> > > +- elan,max_x: the maximum reported value on the X axis
> > > +- elan,max_y: the maximum reported value on the Y axis
> > > +- elan,min_x: the minimum reported value on the X axis
> > > +- elan,min_y: the minimum reported value on the Y axis
> > > +- elan,x_res: the resolution of the X axis (in units per mm)
> > > +- elan,y_res: the resolution of the Y axis (in units per mm)
> > > +- elan,width: max reported width of a blob
> >
> > Can't we use standard touchscreen properties here? (Yes, I get this is a
> > touchpad, not touchscreen).
>
> Hey Rob,
>
> Well, there is that (it's a touchpad driver) and we can't also really
> use the of_touchscreen.c implementation.
> If both concerns are not an issue, we can then move the [min/max/res]
> properties to the touchscreen ones.
Neither is problem for me. Bindings don't have to map 1:1 to kernel code.
> Regarding 'elan,width', this is something missing from the standard ts
> properties, and AFAICT, this controls the maximum reported
> width/height of a touch.
> I should probably rename them to max_width, max_height.
Sure, just use '-' rather than '_' in property names.
> Hans, do you think we should add such properties to of_touchscreen.c
> too? (the width/height ones)
>
> Cheers,
> Benjamin
^ permalink raw reply
* Re: [PATCH] HID: quirks: fix support for Apple Magic Keyboards
From: Benjamin Tissoires @ 2018-10-18 13:04 UTC (permalink / raw)
To: gregkh; +Cc: ncopa, 3.8+, open list:HID CORE LAYER, Jiri Kosina, seobrien
In-Reply-To: <20181017165510.GA7468@kroah.com>
On Wed, Oct 17, 2018 at 6:55 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Wed, Oct 17, 2018 at 06:49:16PM +0200, Benjamin Tissoires wrote:
> > On Wed, Oct 17, 2018 at 5:55 PM Natanael Copa <ncopa@alpinelinux.org> wrote:
> > >
> > > On Wed, 17 Oct 2018 16:59:15 +0200
> > > Benjamin Tissoires <benjamin.tissoires@redhat.com> wrote:
> > >
> > > > Hi Natanael,
> > > >
> > > > On Wed, Oct 17, 2018 at 4:52 PM Natanael Copa <ncopa@alpinelinux.org> wrote:
> > > > >
> > > > > Commit ee3454924370 ("HID: add support for Apple Magic Keyboards") added
> > > > > support for the Magic Keyboard over Bluetooth, but did not add the
> > > > > BT_VENDOR_ID_APPLE to hid-quirks. Fix this so hid-apple driver is used
> > > > > over hid-generic.
> > > > >
> > > > > This fixes the Fn key, which does not work at all with hid-generic.
> > > > >
> > > > > Fixes: ee3454924370 ("HID: add support for Apple Magic Keyboards")
> > > > > Bugzilla-id: https://bugzilla.kernel.org/show_bug.cgi?id=99881
> > > > > Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> > > > > ---
> > > > > This should be backported to stable too.
> > > > >
> > > > > drivers/hid/hid-quirks.c | 3 +++
> > > > > 1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
> > > > > index 249d49b6b16c..a3b3aecf8628 100644
> > > > > --- a/drivers/hid/hid-quirks.c
> > > > > +++ b/drivers/hid/hid-quirks.c
> > > > > @@ -270,6 +270,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
> > > > > { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
> > > > > { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) },
> > > > > { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
> > > > > + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
> > > > > + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI) },
> > > > > + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI) },
> > > >
> > > > NACK, this should not be required with kernels v4.17+ IIRC.
> > > >
> > > > If it doesn't work on a recent kernel, please raise the issue, but I
> > > > am actually chasing down the new inclusions of these when we add new
> > > > device support.
> > >
> > > Fair enough. I think it may be needed for 4.14.y kernels though, to fix
> > > commit b6cc0ba2cbf4 (HID: add support for Apple Magic Keyboards).
> > >
> > > Fn key did not work without this patch on 4.14.76 for me.
> >
> > Right, b6cc0ba2cbf4 has been added to 4.14.75 and is not working
> > because tweaking hid_have_special_driver[] is not required in current
> > kernels anymore.
> >
> > @stable folks, would it be possible to take this patch in the v4.9 and
> > v4.14 trees? It can't go into Linus' tree, but I'd be glad to give my
> > Acked-by for a stable backport.
>
> Sure, if you resend it in a format that I can apply it in, with the text
> saying why this is not applicable to newer kernel versions.
>
Thanks Greg.
Natanel, can you resend this patch with the explanation to stable@ and
Cc me so I can give my Ack?
Cheers,
Benjamin
^ permalink raw reply
* Re: [PATCH v4 8/8] watchdog: stpmic1: add stpmic1 watchdog driver
From: Guenter Roeck @ 2018-10-18 13:34 UTC (permalink / raw)
To: Pascal PAILLET-LME, dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
In-Reply-To: <1539853324-29051-9-git-send-email-p.paillet@st.com>
On 10/18/2018 02:02 AM, Pascal PAILLET-LME wrote:
> From: pascal paillet <p.paillet@st.com>
>
> The stpmic1 PMIC embeds a watchdog which is disabled by default. As soon
> as the watchdog is started, it must be refreshed periodically otherwise
> the PMIC goes off.
>
> Signed-off-by: pascal paillet <p.paillet@st.com>
> ---
> changes in v4:
> * fix stop watchdog function
> * Kconfig: fix grammar issue
>
> drivers/watchdog/Kconfig | 12 ++++
> drivers/watchdog/Makefile | 1 +
> drivers/watchdog/stpmic1_wdt.c | 139 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 152 insertions(+)
> create mode 100644 drivers/watchdog/stpmic1_wdt.c
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 5ea8909..6d2ffef 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -806,6 +806,18 @@ config STM32_WATCHDOG
> To compile this driver as a module, choose M here: the
> module will be called stm32_iwdg.
>
> +config STPMIC1_WATCHDOG
> + tristate "STPMIC1 PMIC watchdog support"
> + depends on MFD_STPMIC1
> + select WATCHDOG_CORE
> + help
> + Say Y here to include watchdog support embedded into STPMIC1 PMIC.
> + If the watchdog timer expires, stpmic1 will shut down all its power
> + supplies.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called spmic1_wdt.
> +
> config UNIPHIER_WATCHDOG
> tristate "UniPhier watchdog support"
> depends on ARCH_UNIPHIER || COMPILE_TEST
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index bf92e7b..2649cf3 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -217,3 +217,4 @@ obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
> obj-$(CONFIG_MENF21BMC_WATCHDOG) += menf21bmc_wdt.o
> obj-$(CONFIG_MENZ069_WATCHDOG) += menz69_wdt.o
> obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o
> +obj-$(CONFIG_STPMIC1_WATCHDOG) += stpmic1_wdt.o
> diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
> new file mode 100644
> index 0000000..a6cbc27
> --- /dev/null
> +++ b/drivers/watchdog/stpmic1_wdt.c
> @@ -0,0 +1,139 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (C) STMicroelectronics 2018
> +// Author: Pascal Paillet <p.paillet@st.com> for STMicroelectronics.
> +
> +#include <linux/kernel.h>
> +#include <linux/mfd/stpmic1.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/of.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/watchdog.h>
> +
> +/* WATCHDOG CONTROL REGISTER bit */
> +#define WDT_START BIT(0)
> +#define WDT_PING BIT(1)
> +#define WDT_START_MASK BIT(0)
> +#define WDT_PING_MASK BIT(1)
> +#define WDT_STOP 0
> +
> +#define PMIC_WDT_MIN_TIMEOUT 1
> +#define PMIC_WDT_MAX_TIMEOUT 256
> +#define PMIC_WDT_DEFAULT_TIMEOUT 30
> +
> +static bool nowayout = WATCHDOG_NOWAYOUT;
> +module_param(nowayout, bool, 0);
> +MODULE_PARM_DESC(nowayout,
> + "Watchdog cannot be stopped once started (default="
> + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
> +
> +struct stpmic1_wdt {
> + struct stpmic1 *pmic;
> + struct watchdog_device wdtdev;
> +};
> +
> +static int pmic_wdt_start(struct watchdog_device *wdd)
> +{
> + struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
> +
> + return regmap_update_bits(wdt->pmic->regmap,
> + WCHDG_CR, WDT_START_MASK, WDT_START);
> +}
> +
> +static int pmic_wdt_stop(struct watchdog_device *wdd)
> +{
> + struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
> +
> + return regmap_update_bits(wdt->pmic->regmap,
> + WCHDG_CR, WDT_START_MASK, WDT_STOP);
> +}
> +
> +static int pmic_wdt_ping(struct watchdog_device *wdd)
> +{
> + struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
> +
> + return regmap_update_bits(wdt->pmic->regmap,
> + WCHDG_CR, WDT_PING_MASK, WDT_PING);
> +}
> +
> +static int pmic_wdt_set_timeout(struct watchdog_device *wdd,
> + unsigned int timeout)
> +{
> + struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd);
> +
> + wdd->timeout = timeout;
> + /* timeout is equal to register value + 1 */
> + return regmap_write(wdt->pmic->regmap, WCHDG_TIMER_CR, timeout - 1);
> +}
> +
> +static const struct watchdog_info pmic_watchdog_info = {
> + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
> + .identity = "STPMIC1 PMIC Watchdog",
> +};
> +
> +static const struct watchdog_ops pmic_watchdog_ops = {
> + .owner = THIS_MODULE,
> + .start = pmic_wdt_start,
> + .stop = pmic_wdt_stop,
> + .ping = pmic_wdt_ping,
> + .set_timeout = pmic_wdt_set_timeout,
> +};
> +
> +static int pmic_wdt_probe(struct platform_device *pdev)
> +{
> + int ret;
> + struct stpmic1 *pmic;
> + struct stpmic1_wdt *wdt;
> +
> + if (!pdev->dev.parent)
> + return -EINVAL;
> +
> + pmic = dev_get_drvdata(pdev->dev.parent);
> + if (!pmic)
> + return -EINVAL;
> +
> + wdt = devm_kzalloc(&pdev->dev, sizeof(struct stpmic1_wdt), GFP_KERNEL);
> + if (!wdt)
> + return -ENOMEM;
> +
> + wdt->pmic = pmic;
> +
> + wdt->wdtdev.info = &pmic_watchdog_info;
> + wdt->wdtdev.ops = &pmic_watchdog_ops;
> + wdt->wdtdev.min_timeout = PMIC_WDT_MIN_TIMEOUT;
> + wdt->wdtdev.max_timeout = PMIC_WDT_MAX_TIMEOUT;
Sorry I missed that earlier: You'll also want to set wdtdev.parent.
Thanks,
Guenter
> +
> + wdt->wdtdev.timeout = PMIC_WDT_DEFAULT_TIMEOUT;
> + watchdog_init_timeout(&wdt->wdtdev, 0, &pdev->dev);
> +
> + watchdog_set_nowayout(&wdt->wdtdev, nowayout);
> + watchdog_set_drvdata(&wdt->wdtdev, wdt);
> +
> + ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdtdev);
> + if (ret)
> + return ret;
> +
> + dev_dbg(wdt->pmic->dev, "PMIC Watchdog driver probed\n");
> + return 0;
> +}
> +
> +static const struct of_device_id of_pmic_wdt_match[] = {
> + { .compatible = "st,stpmic1-wdt" },
> + { },
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_pmic_wdt_match);
> +
> +static struct platform_driver stpmic1_wdt_driver = {
> + .probe = pmic_wdt_probe,
> + .driver = {
> + .name = "stpmic1-wdt",
> + .of_match_table = of_pmic_wdt_match,
> + },
> +};
> +module_platform_driver(stpmic1_wdt_driver);
> +
> +MODULE_DESCRIPTION("Watchdog driver for STPMIC1 device");
> +MODULE_AUTHOR("Pascal Paillet <p.paillet@st.com>");
> +MODULE_LICENSE("GPL v2");
>
^ permalink raw reply
* Re: [PATCH v4 6/8] input: stpmic1: add stpmic1 onkey driver
From: dmitry.torokhov @ 2018-10-18 18:12 UTC (permalink / raw)
To: Pascal PAILLET-LME, lee.jones
Cc: robh+dt@kernel.org, mark.rutland@arm.com, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
In-Reply-To: <1539853324-29051-7-git-send-email-p.paillet@st.com>
On Thu, Oct 18, 2018 at 09:02:13AM +0000, Pascal PAILLET-LME wrote:
> From: pascal paillet <p.paillet@st.com>
>
> The stpmic1 pmic is able to manage an onkey button. This driver exposes
> the stpmic1 onkey as an input device. It can also be configured to
> shut-down the power supplies on a long key-press with an adjustable
> duration.
>
> Signed-off-by: pascal paillet <p.paillet@st.com>
OK, so this has dependency on linux/mfd/stpmic1.h and therefore I expect
it will go in through Lee's tree.
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> changes in v4:
> * remove remove function
> * merge stpmic1_onkey_dt_params() in probe function
> * suppresse struct pmic_onkey_config
> * rename PONKEY_PU_ACTIVE to PONKEY_PU_INACTIVE
>
> drivers/input/misc/Kconfig | 11 +++
> drivers/input/misc/Makefile | 2 +
> drivers/input/misc/stpmic1_onkey.c | 197 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 210 insertions(+)
> create mode 100644 drivers/input/misc/stpmic1_onkey.c
>
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index ca59a2b..279fb02 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -851,4 +851,15 @@ config INPUT_SC27XX_VIBRA
> To compile this driver as a module, choose M here. The module will
> be called sc27xx_vibra.
>
> +config INPUT_STPMIC1_ONKEY
> + tristate "STPMIC1 PMIC Onkey support"
> + depends on MFD_STPMIC1
> + help
> + Say Y to enable support of onkey embedded into STPMIC1 PMIC. onkey
> + can be used to wakeup from low power modes and force a shut-down on
> + long press.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called stpmic1_onkey.
> +
> endif
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index 9d0f9d1..1b44202 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -71,6 +71,7 @@ obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
> obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
> obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
> obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
> +obj-$(CONFIG_INPUT_STPMIC1_ONKEY) += stpmic1_onkey.o
> obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON) += tps65218-pwrbutton.o
> obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
> obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o
> @@ -81,3 +82,4 @@ obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
> obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
> obj-$(CONFIG_INPUT_YEALINK) += yealink.o
> obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
> +
> diff --git a/drivers/input/misc/stpmic1_onkey.c b/drivers/input/misc/stpmic1_onkey.c
> new file mode 100644
> index 0000000..6a7f08b
> --- /dev/null
> +++ b/drivers/input/misc/stpmic1_onkey.c
> @@ -0,0 +1,197 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (C) STMicroelectronics 2018
> +// Author: Pascal Paillet <p.paillet@st.com> for STMicroelectronics.
> +
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/mfd/stpmic1.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/property.h>
> +#include <linux/regmap.h>
> +
> +/**
> + * struct stpmic1_onkey - OnKey data
> + * @input_dev: pointer to input device
> + * @irq_falling: irq that we are hooked on to
> + * @irq_rising: irq that we are hooked on to
> + */
> +struct stpmic1_onkey {
> + struct input_dev *input_dev;
> + int irq_falling;
> + int irq_rising;
> +};
> +
> +static irqreturn_t onkey_falling_irq(int irq, void *ponkey)
> +{
> + struct stpmic1_onkey *onkey = ponkey;
> + struct input_dev *input_dev = onkey->input_dev;
> +
> + input_report_key(input_dev, KEY_POWER, 1);
> + pm_wakeup_event(input_dev->dev.parent, 0);
> + input_sync(input_dev);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t onkey_rising_irq(int irq, void *ponkey)
> +{
> + struct stpmic1_onkey *onkey = ponkey;
> + struct input_dev *input_dev = onkey->input_dev;
> +
> + input_report_key(input_dev, KEY_POWER, 0);
> + pm_wakeup_event(input_dev->dev.parent, 0);
> + input_sync(input_dev);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int stpmic1_onkey_probe(struct platform_device *pdev)
> +{
> + struct stpmic1 *pmic = dev_get_drvdata(pdev->dev.parent);
> + struct device *dev = &pdev->dev;
> + struct input_dev *input_dev;
> + struct stpmic1_onkey *onkey;
> + unsigned int val, reg = 0;
> + int error;
> +
> + onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL);
> + if (!onkey)
> + return -ENOMEM;
> +
> + onkey->irq_falling = platform_get_irq_byname(pdev, "onkey-falling");
> + if (onkey->irq_falling < 0) {
> + dev_err(dev, "failed: request IRQ onkey-falling %d\n",
> + onkey->irq_falling);
> + return onkey->irq_falling;
> + }
> +
> + onkey->irq_rising = platform_get_irq_byname(pdev, "onkey-rising");
> + if (onkey->irq_rising < 0) {
> + dev_err(dev, "failed: request IRQ onkey-rising %d\n",
> + onkey->irq_rising);
> + return onkey->irq_rising;
> + }
> +
> + if (!device_property_read_u32(dev, "power-off-time-sec", &val)) {
> + if ((val > 0) && (val <= 16)) {
> + dev_dbg(dev, "power-off-time=%d seconds\n", val);
> + reg |= PONKEY_PWR_OFF;
> + reg |= ((16 - val) & PONKEY_TURNOFF_TIMER_MASK);
> + } else {
> + dev_err(dev, "power-off-time-sec out of range\n");
> + return -EINVAL;
> + }
> + }
> +
> + if (device_property_present(dev, "st,onkey-clear-cc-flag"))
> + reg |= PONKEY_CC_FLAG_CLEAR;
> +
> + error = regmap_update_bits(pmic->regmap, PKEY_TURNOFF_CR,
> + PONKEY_TURNOFF_MASK, reg);
> + if (error) {
> + dev_err(dev, "PKEY_TURNOFF_CR write failed: %d\n", error);
> + return error;
> + }
> +
> + if (device_property_present(dev, "st,onkey-pu-inactive")) {
> + error = regmap_update_bits(pmic->regmap, PADS_PULL_CR,
> + PONKEY_PU_INACTIVE,
> + PONKEY_PU_INACTIVE);
> + if (error) {
> + dev_err(dev, "ONKEY Pads configuration failed: %d\n", error);
> + return error;
> + }
> + }
> +
> + input_dev = devm_input_allocate_device(dev);
> + if (!input_dev) {
> + dev_err(dev, "Can't allocate Pwr Onkey Input Device\n");
> + return -ENOMEM;
> + }
> +
> + input_dev->name = "pmic_onkey";
> + input_dev->phys = "pmic_onkey/input0";
> +
> + input_set_capability(input_dev, EV_KEY, KEY_POWER);
> +
> + onkey->input_dev = input_dev;
> +
> + /* interrupt is nested in a thread */
> + error = devm_request_threaded_irq(dev, onkey->irq_falling, NULL,
> + onkey_falling_irq, IRQF_ONESHOT,
> + dev_name(dev), onkey);
> + if (error) {
> + dev_err(dev, "Can't get IRQ Onkey Falling: %d\n", error);
> + return error;
> + }
> +
> + error = devm_request_threaded_irq(dev, onkey->irq_rising, NULL,
> + onkey_rising_irq, IRQF_ONESHOT,
> + dev_name(dev), onkey);
> + if (error) {
> + dev_err(dev, "Can't get IRQ Onkey Rising: %d\n", error);
> + return error;
> + }
> +
> + error = input_register_device(input_dev);
> + if (error) {
> + dev_err(dev, "Can't register power button: %d\n", error);
> + return error;
> + }
> +
> + platform_set_drvdata(pdev, onkey);
> + device_init_wakeup(dev, true);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused stpmic1_onkey_suspend(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct stpmic1_onkey *onkey = platform_get_drvdata(pdev);
> +
> + if (device_may_wakeup(dev)) {
> + enable_irq_wake(onkey->irq_falling);
> + enable_irq_wake(onkey->irq_rising);
> + }
> + return 0;
> +}
> +
> +static int __maybe_unused stpmic1_onkey_resume(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct stpmic1_onkey *onkey = platform_get_drvdata(pdev);
> +
> + if (device_may_wakeup(dev)) {
> + disable_irq_wake(onkey->irq_falling);
> + disable_irq_wake(onkey->irq_rising);
> + }
> + return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm,
> + stpmic1_onkey_suspend,
> + stpmic1_onkey_resume);
> +
> +static const struct of_device_id of_stpmic1_onkey_match[] = {
> + { .compatible = "st,stpmic1-onkey" },
> + { },
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_stpmic1_onkey_match);
> +
> +static struct platform_driver stpmic1_onkey_driver = {
> + .probe = stpmic1_onkey_probe,
> + .driver = {
> + .name = "stpmic1_onkey",
> + .of_match_table = of_match_ptr(of_stpmic1_onkey_match),
> + .pm = &stpmic1_onkey_pm,
> + },
> +};
> +module_platform_driver(stpmic1_onkey_driver);
> +
> +MODULE_DESCRIPTION("Onkey driver for STPMIC1");
> +MODULE_AUTHOR("Pascal Paillet <p.paillet@st.com>");
> +MODULE_LICENSE("GPL v2");
> --
> 1.9.1
--
Dmitry
^ permalink raw reply
* Re: [PATCH v4 1/8] dt-bindings: mfd: document stpmic1
From: Rob Herring @ 2018-10-18 18:47 UTC (permalink / raw)
Cc: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com,
Pascal PAILLET-LME
In-Reply-To: <1539853324-29051-2-git-send-email-p.paillet@st.com>
On Thu, 18 Oct 2018 09:02:11 +0000, Pascal PAILLET-LME wrote:
> From: pascal paillet <p.paillet@st.com>
>
> stpmic1 is a pmic from STMicroelectronics. The STPMIC1 integrates 10
> regulators , 3 switches, a watchdog and an input for a power on key.
>
> Signed-off-by: pascal paillet <p.paillet@st.com>
> ---
> changes in v4:
> * remove interrupt-parent description
> * pmic1@33 renamed to pmic@33
> * fix indentation
>
> .../devicetree/bindings/mfd/st,stpmic1.txt | 131 +++++++++++++++++++++
> include/dt-bindings/mfd/st,stpmic1.h | 46 ++++++++
> 2 files changed, 177 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mfd/st,stpmic1.txt
> create mode 100644 include/dt-bindings/mfd/st,stpmic1.h
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH] Input: uinput - fix Spectre v1 vulnerability
From: Alan Cox @ 2018-10-18 19:43 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: Dmitry Torokhov, linux-input, linux-kernel
In-Reply-To: <2856297d-9af0-e005-f926-e9596d437fad@embeddedor.com>
On Tue, 16 Oct 2018 20:12:43 +0200
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> On 10/16/18 8:09 PM, Dmitry Torokhov wrote:
>
> >
> > /dev/uinput
>
> I've got it. This explains it all. :)
>
> > must be 0600, or accessible to equally privileged user, or you'll be opening your system to much mischief.
Still a correct change.
CAP_SYS_RAWIO is not the same as being root, especially in a container.
Alan
^ permalink raw reply
* Re: [PATCH] Input: uinput - fix Spectre v1 vulnerability
From: Dmitry Torokhov @ 2018-10-18 20:07 UTC (permalink / raw)
To: One Thousand Gnomes
Cc: Gustavo A. R. Silva, linux-input@vger.kernel.org, lkml
In-Reply-To: <20181018204344.4c135203@alans-desktop>
On Thu, Oct 18, 2018 at 12:43 PM Alan Cox <gnomes@lxorguk.ukuu.org.uk> wrote:
>
> On Tue, 16 Oct 2018 20:12:43 +0200
> "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
>
> > On 10/16/18 8:09 PM, Dmitry Torokhov wrote:
> >
> > >
> > > /dev/uinput
> >
> > I've got it. This explains it all. :)
> >
> > > must be 0600, or accessible to equally privileged user, or you'll be opening your system to much mischief.
>
> Still a correct change.
>
> CAP_SYS_RAWIO is not the same as being root, especially in a container.
Giving access to uinput in an unprivileged container is nutty as well.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v2 1/8] dt-bindings: input: touchscreen: sx8654: add reset-gpio property
From: Rob Herring @ 2018-10-18 20:34 UTC (permalink / raw)
Cc: dmitry.torokhov, robh+dt, mark.rutland, linux-input, devicetree,
linux-kernel, Richard Leitner
In-Reply-To: <20181017125116.20077-2-richard.leitner@skidata.com>
On Wed, 17 Oct 2018 14:51:09 +0200, Richard Leitner wrote:
> Document the reset-gpio property for the sx8654 touchscreen controller
> driver.
>
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
> Documentation/devicetree/bindings/input/touchscreen/sx8654.txt | 4 ++++
> 1 file changed, 4 insertions(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH v2 3/8] dt-bindings: input: touchscreen: sx8654: add compatible models
From: Rob Herring @ 2018-10-18 20:35 UTC (permalink / raw)
Cc: dmitry.torokhov, robh+dt, mark.rutland, linux-input, devicetree,
linux-kernel, Richard Leitner
In-Reply-To: <20181017125116.20077-4-richard.leitner@skidata.com>
On Wed, 17 Oct 2018 14:51:11 +0200, Richard Leitner wrote:
> As the sx865[456] share the same datasheet and differ only in the
> presence of a "capacitive proximity detection circuit" and a "haptics
> motor driver for LRA/ERM" add them to the compatbiles. As the driver
> doesn't implement these features it should be no problem.
>
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
> Documentation/devicetree/bindings/input/touchscreen/sx8654.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH v2 5/8] dt-bindings: input: touchscreen: sx8654: add sx8650 to comatibles
From: Rob Herring @ 2018-10-18 20:35 UTC (permalink / raw)
Cc: dmitry.torokhov, robh+dt, mark.rutland, linux-input, devicetree,
linux-kernel, Richard Leitner
In-Reply-To: <20181017125116.20077-6-richard.leitner@skidata.com>
On Wed, 17 Oct 2018 14:51:13 +0200, Richard Leitner wrote:
> As the sx8650 is quite similar to the sx8654 support for it will be
> added in the driver. Therefore add it to the compatibles.
>
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
> Documentation/devicetree/bindings/input/touchscreen/sx8654.txt | 1 +
> 1 file changed, 1 insertion(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH] Input: pm8941-pwrkey - Add pms405 pwrkey support
From: Dmitry Torokhov @ 2018-10-19 0:01 UTC (permalink / raw)
To: Vinod, Rob Herring
Cc: Bjorn Andersson, Mark Rutland, linux-input, devicetree,
linux-kernel
In-Reply-To: <20181018052437.GW2400@vkoul-mobl>
On Thu, Oct 18, 2018 at 10:54:37AM +0530, Vinod wrote:
> On 19-09-18, 18:49, Bjorn Andersson wrote:
> > From: Vinod Koul <vkoul@kernel.org>
> >
> > Update the binding and driver for pms405 pwrkey.
>
> Rob, Dmitry
>
> Gentle reminder for this patch...
>
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> > Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt | 1 +
> > drivers/input/misc/pm8941-pwrkey.c | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > index 34ab5763f494..736fba3bad54 100644
> > --- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > @@ -8,6 +8,7 @@ PROPERTIES
> > Definition: must be one of:
> > "qcom,pm8941-pwrkey"
> > "qcom,pm8941-resin"
> > + "qcom,pms405-pwrkey"
> >
> > - reg:
> > Usage: required
> > diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
> > index 48153e0ca19a..fccf63263c1c 100644
> > --- a/drivers/input/misc/pm8941-pwrkey.c
> > +++ b/drivers/input/misc/pm8941-pwrkey.c
> > @@ -317,6 +317,7 @@ static const struct pm8941_data resin_data = {
> > static const struct of_device_id pm8941_pwr_key_id_table[] = {
> > { .compatible = "qcom,pm8941-pwrkey", .data = &pwrkey_data },
> > { .compatible = "qcom,pm8941-resin", .data = &resin_data },
> > + { .compatible = "qcom,pms405-pwrkey", .data = &pwrkey_data },
I am sure I asked this question before (in context of a different
driver), but why do we need this compatible if we already have
pm8941-pwrkey compatible? Isn't pms405-pwrkey compatible with
pm8941-pwrkey as far as power key block goes? In which cases do we need
new compatibles and when can we reuse existing ones? Rob?
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: synaptics - avoid using uninitialized variable when probing
From: Peter Hutterer @ 2018-10-19 5:46 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Benjamin Tissoires, linux-kernel
In-Reply-To: <20181017001443.GA232819@dtor-ws>
On Tue, Oct 16, 2018 at 05:14:43PM -0700, Dmitry Torokhov wrote:
> synaptics_detect() does not check whether sending commands to the
> device succeeds and instead relies on getting unique data from the
> device. Let's make sure we seed entire buffer with zeroes to make sure
> we not use garbage on stack that just happen to be 0x47.
>
> Reported-by: syzbot+13cb3b01d0784e4ffc3f@syzkaller.appspotmail.com
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
doh, was just about to send out the same patch.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Cheers,
Peter
> ---
> drivers/input/mouse/synaptics.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 55d33500d55e..5e85f3cca867 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -99,9 +99,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode)
> int synaptics_detect(struct psmouse *psmouse, bool set_properties)
> {
> struct ps2dev *ps2dev = &psmouse->ps2dev;
> - u8 param[4];
> -
> - param[0] = 0;
> + u8 param[4] = { 0 };
>
> ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
> ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
> --
> 2.19.1.331.ge82ca0e54c-goog
>
>
> --
> Dmitry
^ permalink raw reply
* Fw: PROBLEM: Keyboard not responding after resuming from suspend/hibernate
From: Numan Demirdöğen @ 2018-10-19 7:20 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: peterz, mingo, linux-kernel, linux-input
In-Reply-To: <20180831215121.1b1f66bf@korsan.localdomain>
[-- Attachment #1: Type: text/plain, Size: 5844 bytes --]
On Fri, 31 Aug 2018 21:53:11 +0300
Numan Demirdöğen <if.gnu.linux@gmail.com> wrote:
>If I put laptop to suspend or hibernate by closing lid, power
>manager or any other method and then I resume/wake up laptop, keyboard
>is not responding. My laptop is a Sony Vaio VPCEH2F1E.
>
>Steps to produce bug:
>1. Boot
>2. Put laptop to sleep
>3. Resume
>
>What I expect to happen: Keyboard responds to key press.
>What happens: Keyboard does not respond but mouse and trackball are
>working.
>
>git bisect point 9d659ae14b545c4296e812c70493bfdc999b5c1c as the first
>bad commit.
>
>Bad commit link:
>https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=9d659ae14b545c4296e812c70493bfdc999b5c1c
>
> Link to actual bug report:
>https://bugzilla.kernel.org/show_bug.cgi?id=195471
>
>awk -f ver_linux
>Linux korsan 4.18.5-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 24 12:48:58
>UTC 2018 x86_64 GNU/Linux GNU C 8.2.0
>GNU Make 4.2.1
>Binutils 2.31.1
>Util-linux 2.32.1
>Mount 2.32.1
>Module-init-tools 25
>E2fsprogs 1.44.4
>Jfsutils 1.1.15
>Reiserfsprogs 3.6.27
>Xfsprogs 4.17.0
>Pcmciautils 018
>Linux C Library 2.28
>Dynamic linker (ldd) 2.28
>Linux C++ Library 6.0.25
>Procps 3.3.15
>Kbd 2.0.4
>Console-tools 2.0.4
>Sh-utils 8.29
>Udev 239
>Wireless-tools 30
>Modules Loaded ac agpgart ahci arc4 ath ath3k ath9k
>ath9k_common ath9k_hw atkbd battery bluetooth bpfilter ccm cdrom
>cfg80211 coretemp crc16 crc32c_generic crc32c_intel crc32_pclmul
>crct10dif_pclmul cryptd drm drm_kms_helper ecdh_generic ehci_hcd
>ehci_pci evdev ext4 fb_sys_fops fscrypto fuse ghash_clmulni_intel
>gpio_ich hid hid_generic i2c_algo_bit i2c_i801 i8042 i915 input_leds
>intel_cstate intel_gtt intel_powerclamp intel_rapl intel_rapl_perf
>intel_uncore iptable_filter iptable_mangle iptable_nat ip_tables
>irqbypass iTCO_vendor_support iTCO_wdt jbd2 kvm kvm_intel led_class
>libahci libata libcrc32c libps2 lpc_ich mac80211 mac_hid mbcache mei
>mei_me mousedev msr nf_conntrack nf_conntrack_ipv4 nf_defrag_ipv4
>nf_nat nf_nat_ipv4 pcc_cpufreq psmouse rfkill rtc_cmos scsi_mod sd_mod
>serio serio_raw snd snd_hda_codec snd_hda_codec_conexant
>snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_core snd_hda_intel
>snd_hwdep snd_pcm snd_timer sony_laptop soundcore sr_mod syscopyarea
>sysfillrect sysimgblt usb_common usbcore usbhid x86_pkg_temp_thermal
>x_tables
>
>dmesg | grep i8042
>[ 0.574078] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M]
>at 0x60,0x64 irq 1,12 [ 0.575936] serio: i8042 KBD port at
>0x60,0x64 irq 1 [ 0.576143] serio: i8042 AUX port at 0x60,0x64 irq
>12 [ 0.618880] input: AT Translated Set 2 keyboard
>as /devices/platform/i8042/serio0/input/input3 [ 11.248435] input:
>AlpsPS/2 ALPS GlidePoint as /devices/platform/i8042/serio1/input/input5
>
>cat /proc/interrupts
> CPU0 CPU1 CPU2 CPU3
> 0: 8 0 0 0 IO-APIC
> 2-edge timer 1: 0 0 0 10286
> IO-APIC 1-edge i8042 8: 0 0
> 0 1 IO-APIC 8-edge rtc0 9: 0
> 9479 0 0 IO-APIC 9-fasteoi acpi 12:
> 0 0 370114 0 IO-APIC 12-edge i8042
> 16: 197457 0 0 0 IO-APIC
> 16-fasteoi ehci_hcd:usb1, ath9k 19: 0 0
> 0 0 IO-APIC 19-fasteoi i801_smbus 23:
> 0 0 71055 0 IO-APIC 23-fasteoi
> ehci_hcd:usb2 24: 0 74549 0 0
> PCI-MSI 512000-edge ahci[0000:00:1f.2] 25: 0
> 14 0 0 PCI-MSI 360448-edge mei_me
> 26: 0 0 138870 0 PCI-MSI
> 32768-edge i915 27: 0 0 0
> 330 PCI-MSI 442368-edge snd_hda_intel:card0
>NMI: 24 22 25 21 Non-maskable
>interrupts LOC: 534734 446934 603337 440320 Local
>timer interrupts SPU: 0 0 0 0
>Spurious interrupts PMI: 24 22 25 21
>Performance monitoring interrupts IWI: 26 12
>43115 22 IRQ work interrupts RTR: 0
>0 0 0 APIC ICR read retries RES: 95282
>76970 60242 46409 Rescheduling interrupts CAL:
>66746 75300 70554 69119 Function call interrupts
>TLB: 50929 54528 51413 48017 TLB shootdowns
>TRM: 0 0 0 0 Thermal event
>interrupts THR: 0 0 0 0
>Threshold APIC interrupts DFR: 0 0
>0 0 Deferred Error APIC interrupts MCE: 0
>0 0 0 Machine check exceptions MCP:
>18 19 19 19 Machine check polls
>HYP: 0 0 0 0 Hypervisor callback
>interrupts HRE: 0 0 0 0 Hyper-V
>reenlightenment interrupts HVS: 0 0
>0 0 Hyper-V stimer0 interrupts ERR: 0
>MIS: 0 PIN: 0 0 0 0
>Posted-interrupt notification event NPI: 0
>0 0 0 Nested posted-interrupt event PIW:
>0 0 0 0 Posted-interrupt wakeup event
>
>P.S: My native language is not English.
>
Hi,
I am forwarding this e-mail which describes a problem related to
suspend/hibernate at the advise of Pavel Machek.
--
Numan Demirdöğen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH] Input: pm8941-pwrkey - Add pms405 pwrkey support
From: Vinod @ 2018-10-19 9:05 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Rob Herring, Bjorn Andersson, Mark Rutland, linux-input,
devicetree, linux-kernel
In-Reply-To: <20181019000116.GD210757@dtor-ws>
On 18-10-18, 17:01, Dmitry Torokhov wrote:
> On Thu, Oct 18, 2018 at 10:54:37AM +0530, Vinod wrote:
> > On 19-09-18, 18:49, Bjorn Andersson wrote:
> > > From: Vinod Koul <vkoul@kernel.org>
> > >
> > > Update the binding and driver for pms405 pwrkey.
> >
> > Rob, Dmitry
> >
> > Gentle reminder for this patch...
> >
> > > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > ---
> > > Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt | 1 +
> > > drivers/input/misc/pm8941-pwrkey.c | 1 +
> > > 2 files changed, 2 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > > index 34ab5763f494..736fba3bad54 100644
> > > --- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > > +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > > @@ -8,6 +8,7 @@ PROPERTIES
> > > Definition: must be one of:
> > > "qcom,pm8941-pwrkey"
> > > "qcom,pm8941-resin"
> > > + "qcom,pms405-pwrkey"
> > >
> > > - reg:
> > > Usage: required
> > > diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
> > > index 48153e0ca19a..fccf63263c1c 100644
> > > --- a/drivers/input/misc/pm8941-pwrkey.c
> > > +++ b/drivers/input/misc/pm8941-pwrkey.c
> > > @@ -317,6 +317,7 @@ static const struct pm8941_data resin_data = {
> > > static const struct of_device_id pm8941_pwr_key_id_table[] = {
> > > { .compatible = "qcom,pm8941-pwrkey", .data = &pwrkey_data },
> > > { .compatible = "qcom,pm8941-resin", .data = &resin_data },
> > > + { .compatible = "qcom,pms405-pwrkey", .data = &pwrkey_data },
>
> I am sure I asked this question before (in context of a different
> driver), but why do we need this compatible if we already have
> pm8941-pwrkey compatible? Isn't pms405-pwrkey compatible with
> pm8941-pwrkey as far as power key block goes? In which cases do we need
> new compatibles and when can we reuse existing ones? Rob?
Relooking I do think that reuse of pm8941-pwrkey is entirely feasible,
thanks for the suggestion. We can drop this and I will update DTS
--
~Vinod
^ permalink raw reply
* Re: [PATCH v4 4/8] regulator: stpmic1: add stpmic1 regulator driver
From: Mark Brown @ 2018-10-19 11:50 UTC (permalink / raw)
To: Pascal PAILLET-LME
Cc: dmitry.torokhov@gmail.com, robh+dt@kernel.org,
mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com,
wim@linux-watchdog.org, linux@roeck-us.net,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
benjamin.gaignard@linaro.org, eballetbo@gmail.com
In-Reply-To: <1539853324-29051-5-git-send-email-p.paillet@st.com>
[-- Attachment #1: Type: text/plain, Size: 822 bytes --]
On Thu, Oct 18, 2018 at 09:02:12AM +0000, Pascal PAILLET-LME wrote:
> + for (i = 0; i < ARRAY_SIZE(stpmic1_regulator_cfgs); i++) {
> + /* Parse DT & find regulators to register */
> + init_data = stpmic1_regulators_matches[i].init_data;
> + if (init_data)
> + init_data->regulator_init = &stpmic1_regulator_parse_dt;
> +
> + rdev = stpmic1_regulator_register(pdev, i, init_data, regul);
> + if (IS_ERR(rdev))
> + return PTR_ERR(rdev);
This looks mostly good, the only big thing is this - the default is to
just unconditionally register all the regulators that exist rather than
only those that are configured on that particular platform. This is a
bit simpler and means that all the readback of the configuration for the
unconfigured regulators is available for diagnostics. Is there a reason
not to do that?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for the Trekstor Primetab T13B tablet
From: Andy Shevchenko @ 2018-10-19 12:48 UTC (permalink / raw)
To: marian.cepok
Cc: Hans de Goede, Darren Hart, Andy Shevchenko, linux-input,
Platform Driver, Linux Kernel Mailing List
In-Reply-To: <20181008072505.GA8334@mcepok-pc>
On Mon, Oct 8, 2018 at 10:25 AM Marian Cepok <marian.cepok@gmail.com> wrote:
>
> Add touchscreen info for the Trekstor Primetab T13B tablet.
>
Pushed to my review and testing queue, thanks!
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Marian Cepok <marian.cepok@gmail.com>
> ---
> drivers/platform/x86/touchscreen_dmi.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
> index cb204f973491..c07954f0efc6 100644
> --- a/drivers/platform/x86/touchscreen_dmi.c
> +++ b/drivers/platform/x86/touchscreen_dmi.c
> @@ -381,6 +381,22 @@ static const struct ts_dmi_data trekstor_primebook_c13_data = {
> .properties = trekstor_primebook_c13_props,
> };
>
> +static const struct property_entry trekstor_primetab_t13b_props[] = {
> + PROPERTY_ENTRY_U32("touchscreen-size-x", 2500),
> + PROPERTY_ENTRY_U32("touchscreen-size-y", 1900),
> + PROPERTY_ENTRY_STRING("firmware-name",
> + "gsl1680-trekstor-primetab-t13b.fw"),
> + PROPERTY_ENTRY_U32("silead,max-fingers", 10),
> + PROPERTY_ENTRY_BOOL("silead,home-button"),
> + PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
> + { }
> +};
> +
> +static const struct ts_dmi_data trekstor_primetab_t13b_data = {
> + .acpi_name = "MSSL1680:00",
> + .properties = trekstor_primetab_t13b_props,
> +};
> +
> static const struct property_entry trekstor_surftab_twin_10_1_props[] = {
> PROPERTY_ENTRY_U32("touchscreen-size-x", 1900),
> PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
> @@ -648,6 +664,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
> DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C13"),
> },
> },
> + {
> + /* Trekstor Primetab T13B */
> + .driver_data = (void *)&trekstor_primetab_t13b_data,
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "Primetab T13B"),
> + },
> + },
> {
> /* TrekStor SurfTab twin 10.1 ST10432-8 */
> .driver_data = (void *)&trekstor_surftab_twin_10_1_data,
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* [git pull] Input updates for v4.19-rc8
From: Dmitry Torokhov @ 2018-10-19 17:45 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-input, Linus Torvalds
Hi Greg,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive updates for the input subsystem. Just an addition to elan
touchpad driver ACPI table.
Changelog:
---------
Mikhail Nikiforov (1):
Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15IGM
Diffstat:
--------
drivers/input/mouse/elan_i2c_core.c | 1 +
1 file changed, 1 insertion(+)
Thanks.
--
Dmitry
^ permalink raw reply
* [PATCH v2] HID: hiddev: fix potential Spectre v1
From: Breno Leitao @ 2018-10-19 20:01 UTC (permalink / raw)
To: linux-usb, linux-input; +Cc: gustavo, jkosina, Breno Leitao, stable
uref->usage_index can be indirectly controlled by userspace, hence leading
to a potential exploitation of the Spectre variant 1 vulnerability.
This field is used as an array index by the hiddev_ioctl_usage() function,
when 'cmd' is either HIDIOCGCOLLECTIONINDEX, HIDIOCGUSAGES or
HIDIOCSUSAGES.
For cmd == HIDIOCGCOLLECTIONINDEX case, uref->usage_index is compared to
field->maxusage and then used as an index to dereference field->usage
array. The same thing happens to the cmd == HIDIOC{G,S}USAGES cases, where
uref->usage_index is checked against an array maximum value and then it is
used as an index in an array.
This is a summary of the HIDIOCGCOLLECTIONINDEX case, which matches the
traditional Spectre V1 first load:
copy_from_user(uref, user_arg, sizeof(*uref))
if (uref->usage_index >= field->maxusage)
goto inval;
i = field->usage[uref->usage_index].collection_index;
return i;
This patch fixes this by sanitizing field uref->usage_index before using it
to index field->usage (HIDIOCGCOLLECTIONINDEX) or field->value in
HIDIOC{G,S}USAGES arrays, thus, avoiding speculation in the first load.
Signed-off-by: Breno Leitao <leitao@debian.org>
Cc: <stable@vger.kernel.org>
--
v2: Contemplate cmd == HIDIOC{G,S}USAGES case
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 23872d08308c..a746017fac17 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -512,14 +512,24 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
if (cmd == HIDIOCGCOLLECTIONINDEX) {
if (uref->usage_index >= field->maxusage)
goto inval;
+ uref->usage_index =
+ array_index_nospec(uref->usage_index,
+ field->maxusage);
} else if (uref->usage_index >= field->report_count)
goto inval;
}
- if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
- (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
- uref->usage_index + uref_multi->num_values > field->report_count))
- goto inval;
+ if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
+ if (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
+ uref->usage_index + uref_multi->num_values >
+ field->report_count)
+ goto inval;
+
+ uref->usage_index =
+ array_index_nospec(uref->usage_index,
+ field->report_count -
+ uref_multi->num_values);
+ }
switch (cmd) {
case HIDIOCGUSAGE:
--
2.17.1
^ permalink raw reply related
* Re: [git pull] Input updates for v4.19-rc8
From: Greg Kroah-Hartman @ 2018-10-20 7:08 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-kernel, linux-input, Linus Torvalds
In-Reply-To: <20181019174508.GA47209@dtor-ws>
On Fri, Oct 19, 2018 at 10:45:08AM -0700, Dmitry Torokhov wrote:
> Hi Greg,
>
> Please pull from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
>
> to receive updates for the input subsystem. Just an addition to elan
> touchpad driver ACPI table.
Now merged, thanks.
greg k-h
^ permalink raw reply
* Re: [PATCH] Input: uinput - fix Spectre v1 vulnerability
From: Pavel Machek @ 2018-10-22 14:14 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: Dmitry Torokhov, linux-input, linux-kernel
In-Reply-To: <ead3e95a-1acb-362a-0ee2-d02dbc4f378c@embeddedor.com>
[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]
On Tue 2018-10-16 19:52:58, Gustavo A. R. Silva wrote:
> Hi Dmitry,
>
> On 10/16/18 7:21 PM, Dmitry Torokhov wrote:
> > Hi Gustavo,
> >
> > On Tue, Oct 16, 2018 at 01:13:13PM +0200, Gustavo A. R. Silva wrote:
> >> setup.code can be indirectly controlled by user-space, hence leading to
> >> a potential exploitation of the Spectre variant 1 vulnerability.
> >>
> >> This issue was detected with the help of Smatch:
> >>
> >> drivers/input/misc/uinput.c:512 uinput_abs_setup() warn: potential
> >> spectre issue 'dev->absinfo' [w] (local cap)
> >>
> >> Fix this by sanitizing setup.code before using it to index dev->absinfo.
> >
> > So we are saying that attacker, by repeatedly calling ioctl(...,
> > UI_ABS_SETUP, ...) will be able to poison branch predictor and discover
> > another program or kernel secrets? But uinput is a privileged interface
> > open to root only, as it allows injecting arbitrary keystrokes into the
> > kernel. And since only root can use uinput, meh?
> >
>
> Oh I see... in that case this is a false positive.
No, please lets fix it.
Some people are trying to make sure kernel is "more priviledged" than
root -- its called secure boot etc.
And "if you givean attacker possibility to generate keystrokes, he can
read kernel memory as well"... is very unexpected.
Unexpected is bad when talking about security.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: 2nd Fan quirk for Thinkpad P50 causes spurios touchpad/trackpoint events on ThinkPad L570
From: Henrique de Moraes Holschuh @ 2018-10-23 3:47 UTC (permalink / raw)
To: Jaak Ristioja
Cc: Alexander Kappner, Jouke Witteveen,
linux-input-u79uwXL29TY76Z2rM5mHXA,
platform-driver-x86-u79uwXL29TY76Z2rM5mHXA,
ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Pali Rohár,
Andy Shevchenko
In-Reply-To: <36111ed4-621c-47a8-bc6a-66cf756a0ac6-89mTbI93R4uuvFJfX82//w@public.gmane.org>
On Sat, 13 Oct 2018, Jaak Ristioja wrote:
> On 27.08.2018 19:22, Jaak Ristioja wrote:
> > Upgrading Linux from 4.16 to 4.17, a ThinkPad L570 started receiving
> > spurious input events, mostly right mouse button click events, but also
> > cursor jumps.
> >
> > I have not attempted to understand whether these events come from the
> > trackpoint or touchpad or some other driver, but I managed to bisect
> > this issue to commit a986c75a7df0 titled "platform/x86: thinkpad_acpi:
> > Add 2nd Fan Support for Thinkpad P50" by Alexander Kappner.
> >
> > Apparently the quirk mitigation is applied when the BIOS version begins
> > with N1. The BIOS version on the L570 in question is N1XET57W (1.35 )
> > which is probably why this commit causes the described problems on the
> > ThinkPad L570. How exactly? - I don't know.
> >
> > The issue did not reproduce when running some stable 4.17 and 4.18
> > kernels with commit a986c75a7df0 reverted.
> >
> > Please fix this for future kernels. Thanks! :)
>
> Ping. Do you need any additional information?
It looks like it is failing to detect N1X and N1 as different models,
the bug is likely on this commit:
commit 846a416b4630fc960c10500b4194ad504bc22d4b
platform/x86: thinkpad_acpi: Proper model/release matching
Real life has been **extremely** busy, so I'd appreciate a patch.
Otherwise I will eventually get to it, but it might take a few
weeks(!!).
--
Henrique Holschuh
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox