devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] AM437x SK: Add power-button support
@ 2014-12-26 19:28 Felipe Balbi
  2014-12-26 19:28 ` [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile Felipe Balbi
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:28 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones
  Cc: Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, Felipe Balbi

Hi,

the following patches add tps65218 power button support and
make it usable with AM437x SK.

Developed and tested on top of v3.19-rc1. Logs at [1]

[1] http://hastebin.com/ecopenuqot

Felipe Balbi (5):
  mfd: tps65218: make INT[12] and STATUS registers volatile
  mfd: tps65218: make INT1 our status_base register
  input: misc: add tps65218 power button driver
  arm: boot: dts: am437x-sk: add power button binding
  arm: omap2plus_defconfig: enable TPS65218 power button

 arch/arm/boot/dts/am437x-sk-evm.dts     |   5 ++
 arch/arm/configs/omap2plus_defconfig    |   1 +
 drivers/input/misc/Kconfig              |  10 +++
 drivers/input/misc/Makefile             |   1 +
 drivers/input/misc/tps65218-pwrbutton.c | 135 ++++++++++++++++++++++++++++++++
 drivers/mfd/tps65218.c                  |  12 +++
 6 files changed, 164 insertions(+)
 create mode 100644 drivers/input/misc/tps65218-pwrbutton.c

-- 
2.2.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2014-12-26 19:28 [PATCH 0/5] AM437x SK: Add power-button support Felipe Balbi
@ 2014-12-26 19:28 ` Felipe Balbi
       [not found]   ` <1419622104-25812-2-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  2015-01-18  9:52   ` Lee Jones
  2014-12-26 19:28 ` [PATCH 2/5] mfd: tps65218: make INT1 our status_base register Felipe Balbi
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:28 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones
  Cc: Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, Felipe Balbi, stable, Keerthy

STATUS register can be modified by the HW, so we
should bypass cache because of that.

In the case of INT[12] registers, they are the ones
that actually clear the IRQ source at the time they
are read. If we rely on the cache for them, we will
never be able to clear the interrupt, which will cause
our IRQ line to be disabled due to IRQ throttling.

Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
Cc: <stable@vger.kernel.org> # v3.15+
Cc: Keerthy <j-keerthy@ti.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/mfd/tps65218.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
index 0d256cb..2243f75 100644
--- a/drivers/mfd/tps65218.c
+++ b/drivers/mfd/tps65218.c
@@ -125,10 +125,21 @@ int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
 }
 EXPORT_SYMBOL_GPL(tps65218_clear_bits);
 
+static const struct regmap_range tps65218_yes_ranges[] = {
+	regmap_reg_range(TPS65218_REG_INT1, TPS65218_REG_INT2),
+	regmap_reg_range(TPS65218_REG_STATUS, TPS65218_REG_STATUS),
+};
+
+static const struct regmap_access_table tps65218_volatile_table = {
+	.yes_ranges = tps65218_yes_ranges,
+	.n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges),
+};
+
 static struct regmap_config tps65218_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 	.cache_type = REGCACHE_RBTREE,
+	.volatile_table = &tps65218_volatile_table,
 };
 
 static const struct regmap_irq tps65218_irqs[] = {
-- 
2.2.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/5] mfd: tps65218: make INT1 our status_base register
  2014-12-26 19:28 [PATCH 0/5] AM437x SK: Add power-button support Felipe Balbi
  2014-12-26 19:28 ` [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile Felipe Balbi
@ 2014-12-26 19:28 ` Felipe Balbi
  2015-01-06 17:37   ` Felipe Balbi
  2015-01-18  9:52   ` Lee Jones
  2014-12-26 19:28 ` [PATCH 3/5] input: misc: add tps65218 power button driver Felipe Balbi
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:28 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones
  Cc: Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, Felipe Balbi, stable, Keerthy

If we don't tell regmap-irq that our first status
register is at offset 1, it will try to read offset
zero, which is the chipid register.

Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
Cc: <stable@vger.kernel.org> # v3.15+
Cc: Keerthy <j-keerthy@ti.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/mfd/tps65218.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
index 2243f75..d6b7643 100644
--- a/drivers/mfd/tps65218.c
+++ b/drivers/mfd/tps65218.c
@@ -204,6 +204,7 @@ static struct regmap_irq_chip tps65218_irq_chip = {
 
 	.num_regs = 2,
 	.mask_base = TPS65218_REG_INT_MASK1,
+	.status_base = TPS65218_REG_INT1,
 };
 
 static const struct of_device_id of_tps65218_match_table[] = {
-- 
2.2.0

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/5] input: misc: add tps65218 power button driver
  2014-12-26 19:28 [PATCH 0/5] AM437x SK: Add power-button support Felipe Balbi
  2014-12-26 19:28 ` [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile Felipe Balbi
  2014-12-26 19:28 ` [PATCH 2/5] mfd: tps65218: make INT1 our status_base register Felipe Balbi
@ 2014-12-26 19:28 ` Felipe Balbi
  2014-12-26 19:33   ` Felipe Balbi
  2014-12-26 23:41   ` Dmitry Torokhov
  2014-12-26 19:28 ` [PATCH 4/5] arm: boot: dts: am437x-sk: add power button binding Felipe Balbi
  2014-12-26 19:28 ` [PATCH 5/5] arm: omap2plus_defconfig: enable TPS65218 power button Felipe Balbi
  4 siblings, 2 replies; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:28 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones
  Cc: Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, Felipe Balbi

With this driver, we can report KEY_POWER on
AM437x SK. This patch has been tested with said
board.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/input/misc/Kconfig              |  10 +++
 drivers/input/misc/Makefile             |   1 +
 drivers/input/misc/tps65218-pwrbutton.c | 135 ++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 drivers/input/misc/tps65218-pwrbutton.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab..364cfb8 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -404,6 +404,16 @@ config INPUT_RETU_PWRBUTTON
 	  To compile this driver as a module, choose M here. The module will
 	  be called retu-pwrbutton.
 
+config INPUT_TPS65218_PWRBUTTON
+	tristate "TPS65218 Power button driver"
+	depends on MFD_TPS65218
+	help
+	  Say Y here if you want to enable power buttong reporting for
+	  the TPS65218 Power Management IC device.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called tps65218-pwrbutton.
+
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
 	depends on TWL4030_CORE
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 19c7603..a923753 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -59,6 +59,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_TPS65218_PWRBUTTON)	+= tps65218-pwrbutton.o
 obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
 obj-$(CONFIG_INPUT_TWL4030_VIBRA)	+= twl4030-vibra.o
 obj-$(CONFIG_INPUT_TWL6040_VIBRA)	+= twl6040-vibra.o
diff --git a/drivers/input/misc/tps65218-pwrbutton.c b/drivers/input/misc/tps65218-pwrbutton.c
new file mode 100644
index 0000000..a1f8a19
--- /dev/null
+++ b/drivers/input/misc/tps65218-pwrbutton.c
@@ -0,0 +1,135 @@
+/*
+ * Texas Instruments' TPS65218 Power Button Input Driver
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ * Author: Felipe Balbi <balbi@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/tps65218.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+struct tps65218_pwrbutton {
+	struct device *dev;
+	struct tps65218 *tps;
+	struct input_dev *idev;
+	int irq;
+
+	unsigned int pressed:1;
+};
+
+static irqreturn_t tps65218_pwr_irq(int irq, void *_pwr)
+{
+	struct tps65218_pwrbutton *pwr = _pwr;
+	unsigned int reg;
+	int ret;
+
+	ret = tps65218_reg_read(pwr->tps, TPS65218_REG_STATUS, &reg);
+	if (ret) {
+		dev_err(pwr->dev, "can't read register --> %d\n", ret);
+		goto out;
+	}
+
+	if (reg & TPS65218_STATUS_PB_STATE) {
+		input_report_key(pwr->idev, KEY_POWER, 1);
+		pm_wakeup_event(pwr->dev, 0);
+		pwr->pressed = true;
+	} else {
+		/*
+		 * we don't want to report KEY_POWER releases on any of the
+		 * other IRQ sources. Only when button was previously pressed
+		 */
+		if (pwr->pressed) {
+			input_report_key(pwr->idev, KEY_POWER, 0);
+			pwr->pressed = false;
+		}
+	}
+
+	input_sync(pwr->idev);
+
+out:
+	return IRQ_HANDLED;
+}
+
+static int tps65218_pwron_probe(struct platform_device *pdev)
+{
+	struct tps65218 *tps = dev_get_drvdata(pdev->dev.parent);
+	struct device *dev = &pdev->dev;
+	struct tps65218_pwrbutton *pwr;
+	struct input_dev *idev;
+	int ret;
+
+	pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL);
+	if (!pwr)
+		return -ENOMEM;
+
+	idev = devm_input_allocate_device(dev);
+	if (!idev)
+		return -ENOMEM;
+
+	idev->name = "tps65218_pwrbutton";
+	idev->phys = "tps65218_pwrbutton/input0";
+	idev->dev.parent = dev;
+	idev->id.bustype = BUS_I2C;
+
+	input_set_capability(idev, EV_KEY, KEY_POWER);
+
+	pwr->tps = tps;
+	pwr->dev = dev;
+	pwr->idev = idev;
+	pwr->irq = platform_get_irq(pdev, 0);
+	platform_set_drvdata(pdev, pwr);
+	device_init_wakeup(dev, true);
+
+	ret = devm_request_threaded_irq(dev, pwr->irq, NULL, tps65218_pwr_irq,
+			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+			dev_name(dev), pwr);
+	if (ret) {
+		dev_err(dev, "failed to request IRQ #%d --> %d\n",
+				pwr->irq, ret);
+		return ret;
+	}
+
+	ret = input_register_device(idev);
+	if (ret) {
+		dev_err(dev, "Can't register power button --> %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static struct of_device_id of_tps65218_pwr_match[] = {
+	{ .compatible = "ti,tps65218-pwrbutton" },
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, of_tps65218_pwr_match);
+
+static struct platform_driver tps65218_pwron_driver = {
+	.probe	= tps65218_pwron_probe,
+	.driver	= {
+		.name	= "tps65218_pwrbutton",
+		.of_match_table = of_tps65218_pwr_match,
+	},
+};
+module_platform_driver(tps65218_pwron_driver);
+
+MODULE_DESCRIPTION("TPS65218 Power Button");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
-- 
2.2.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/5] arm: boot: dts: am437x-sk: add power button binding
  2014-12-26 19:28 [PATCH 0/5] AM437x SK: Add power-button support Felipe Balbi
                   ` (2 preceding siblings ...)
  2014-12-26 19:28 ` [PATCH 3/5] input: misc: add tps65218 power button driver Felipe Balbi
@ 2014-12-26 19:28 ` Felipe Balbi
  2015-01-08  0:09   ` Tony Lindgren
  2014-12-26 19:28 ` [PATCH 5/5] arm: omap2plus_defconfig: enable TPS65218 power button Felipe Balbi
  4 siblings, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:28 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones
  Cc: Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, Felipe Balbi

Let this board report KEY_POWER so upper layers
can decide what to do when power button is pressed.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/boot/dts/am437x-sk-evm.dts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts
index 53bbfc9..c53840c 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -386,6 +386,11 @@
 			regulator-always-on;
 		};
 
+		power-button {
+			compatible = "ti,tps65218-pwrbutton";
+			status = "okay";
+			interrupts = <3 IRQ_TYPE_EDGE_BOTH>;
+		};
 	};
 
 	at24@50 {
-- 
2.2.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/5] arm: omap2plus_defconfig: enable TPS65218 power button
  2014-12-26 19:28 [PATCH 0/5] AM437x SK: Add power-button support Felipe Balbi
                   ` (3 preceding siblings ...)
  2014-12-26 19:28 ` [PATCH 4/5] arm: boot: dts: am437x-sk: add power button binding Felipe Balbi
@ 2014-12-26 19:28 ` Felipe Balbi
  2015-01-08  0:55   ` Tony Lindgren
  4 siblings, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:28 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones
  Cc: Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, Felipe Balbi

Enable tps65218 power button driver by default as
a dynamically linked module so AM437x SK can report
power button presses.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/configs/omap2plus_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index c2c3a85..f4a4b2f 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -183,6 +183,7 @@ CONFIG_TOUCHSCREEN_EDT_FT5X06=m
 CONFIG_TOUCHSCREEN_TSC2005=m
 CONFIG_TOUCHSCREEN_TSC2007=m
 CONFIG_INPUT_MISC=y
+CONFIG_INPUT_TPS65218_PWRBUTTON=m
 CONFIG_INPUT_TWL4030_PWRBUTTON=y
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_8250=y
-- 
2.2.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] input: misc: add tps65218 power button driver
  2014-12-26 19:28 ` [PATCH 3/5] input: misc: add tps65218 power button driver Felipe Balbi
@ 2014-12-26 19:33   ` Felipe Balbi
  2014-12-26 23:41   ` Dmitry Torokhov
  1 sibling, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2014-12-26 19:33 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

Hi,

On Fri, Dec 26, 2014 at 01:28:22PM -0600, Felipe Balbi wrote:
> +static struct of_device_id of_tps65218_pwr_match[] = {
> +	{ .compatible = "ti,tps65218-pwrbutton" },

forgot to document this compatible. I'll add it localy but still wait a
a few days before resending so people have time to review.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] input: misc: add tps65218 power button driver
  2014-12-26 19:28 ` [PATCH 3/5] input: misc: add tps65218 power button driver Felipe Balbi
  2014-12-26 19:33   ` Felipe Balbi
@ 2014-12-26 23:41   ` Dmitry Torokhov
  1 sibling, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2014-12-26 23:41 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Samuel Ortiz, Lee Jones, Linux OMAP Mailing List,
	linux-input, devicetree, Linux ARM Kernel Mailing List

Hi Felipe,

On Fri, Dec 26, 2014 at 01:28:22PM -0600, Felipe Balbi wrote:
> With this driver, we can report KEY_POWER on
> AM437x SK. This patch has been tested with said
> board.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
>  drivers/input/misc/Kconfig              |  10 +++
>  drivers/input/misc/Makefile             |   1 +
>  drivers/input/misc/tps65218-pwrbutton.c | 135 ++++++++++++++++++++++++++++++++
>  3 files changed, 146 insertions(+)
>  create mode 100644 drivers/input/misc/tps65218-pwrbutton.c
> 
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 23297ab..364cfb8 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -404,6 +404,16 @@ config INPUT_RETU_PWRBUTTON
>  	  To compile this driver as a module, choose M here. The module will
>  	  be called retu-pwrbutton.
>  
> +config INPUT_TPS65218_PWRBUTTON
> +	tristate "TPS65218 Power button driver"
> +	depends on MFD_TPS65218
> +	help
> +	  Say Y here if you want to enable power buttong reporting for
> +	  the TPS65218 Power Management IC device.
> +
> +	  To compile this driver as a module, choose M here. The module will
> +	  be called tps65218-pwrbutton.
> +
>  config INPUT_TWL4030_PWRBUTTON
>  	tristate "TWL4030 Power button Driver"
>  	depends on TWL4030_CORE
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index 19c7603..a923753 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -59,6 +59,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_TPS65218_PWRBUTTON)	+= tps65218-pwrbutton.o
>  obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
>  obj-$(CONFIG_INPUT_TWL4030_VIBRA)	+= twl4030-vibra.o
>  obj-$(CONFIG_INPUT_TWL6040_VIBRA)	+= twl6040-vibra.o
> diff --git a/drivers/input/misc/tps65218-pwrbutton.c b/drivers/input/misc/tps65218-pwrbutton.c
> new file mode 100644
> index 0000000..a1f8a19
> --- /dev/null
> +++ b/drivers/input/misc/tps65218-pwrbutton.c
> @@ -0,0 +1,135 @@
> +/*
> + * Texas Instruments' TPS65218 Power Button Input Driver
> + *
> + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
> + * Author: Felipe Balbi <balbi@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/mfd/tps65218.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +
> +struct tps65218_pwrbutton {
> +	struct device *dev;
> +	struct tps65218 *tps;
> +	struct input_dev *idev;
> +	int irq;

You do not need to store IRQ since you are not using it outside of
probe().

> +
> +	unsigned int pressed:1;

You probably can remove 'pressed' as well and send events directly to
input core and rely on it to filter out duplicates so there won't be
release event without press event. If you prefer to keep it please use
bool instead of bit field.

> +};
> +
> +static irqreturn_t tps65218_pwr_irq(int irq, void *_pwr)
> +{
> +	struct tps65218_pwrbutton *pwr = _pwr;
> +	unsigned int reg;
> +	int ret;
> +
> +	ret = tps65218_reg_read(pwr->tps, TPS65218_REG_STATUS, &reg);
> +	if (ret) {
> +		dev_err(pwr->dev, "can't read register --> %d\n", ret);
> +		goto out;
> +	}
> +
> +	if (reg & TPS65218_STATUS_PB_STATE) {
> +		input_report_key(pwr->idev, KEY_POWER, 1);
> +		pm_wakeup_event(pwr->dev, 0);
> +		pwr->pressed = true;
> +	} else {
> +		/*
> +		 * we don't want to report KEY_POWER releases on any of the
> +		 * other IRQ sources. Only when button was previously pressed
> +		 */
> +		if (pwr->pressed) {
> +			input_report_key(pwr->idev, KEY_POWER, 0);
> +			pwr->pressed = false;
> +		}
> +	}
> +
> +	input_sync(pwr->idev);
> +
> +out:
> +	return IRQ_HANDLED;
> +}
> +
> +static int tps65218_pwron_probe(struct platform_device *pdev)
> +{
> +	struct tps65218 *tps = dev_get_drvdata(pdev->dev.parent);
> +	struct device *dev = &pdev->dev;
> +	struct tps65218_pwrbutton *pwr;
> +	struct input_dev *idev;
> +	int ret;
> +
> +	pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL);
> +	if (!pwr)
> +		return -ENOMEM;
> +
> +	idev = devm_input_allocate_device(dev);
> +	if (!idev)
> +		return -ENOMEM;
> +
> +	idev->name = "tps65218_pwrbutton";
> +	idev->phys = "tps65218_pwrbutton/input0";
> +	idev->dev.parent = dev;
> +	idev->id.bustype = BUS_I2C;
> +
> +	input_set_capability(idev, EV_KEY, KEY_POWER);
> +
> +	pwr->tps = tps;
> +	pwr->dev = dev;
> +	pwr->idev = idev;
> +	pwr->irq = platform_get_irq(pdev, 0);
> +	platform_set_drvdata(pdev, pwr);
> +	device_init_wakeup(dev, true);
> +
> +	ret = devm_request_threaded_irq(dev, pwr->irq, NULL, tps65218_pwr_irq,
> +			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +			dev_name(dev), pwr);

I am very fond of calling variables that hold error codes "error", Then
you have:

	error = f();
	if (error) {
		/* handle error */
	}

> +	if (ret) {
> +		dev_err(dev, "failed to request IRQ #%d --> %d\n",
> +				pwr->irq, ret);
> +		return ret;
> +	}
> +
> +	ret = input_register_device(idev);
> +	if (ret) {
> +		dev_err(dev, "Can't register power button --> %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static struct of_device_id of_tps65218_pwr_match[] = {
> +	{ .compatible = "ti,tps65218-pwrbutton" },
> +	{ },
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_tps65218_pwr_match);
> +
> +static struct platform_driver tps65218_pwron_driver = {
> +	.probe	= tps65218_pwron_probe,
> +	.driver	= {
> +		.name	= "tps65218_pwrbutton",
> +		.of_match_table = of_tps65218_pwr_match,
> +	},
> +};
> +module_platform_driver(tps65218_pwron_driver);
> +
> +MODULE_DESCRIPTION("TPS65218 Power Button");
> +MODULE_LICENSE("GPL v2");
> +MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
> -- 
> 2.2.0
> 

Thanks!

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
       [not found]   ` <1419622104-25812-2-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
@ 2015-01-06 17:37     ` Felipe Balbi
  2015-01-08 16:25       ` Felipe Balbi
  0 siblings, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2015-01-06 17:37 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Linux ARM Kernel Mailing List,
	stable-u79uwXL29TY76Z2rM5mHXA, Keerthy

[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]

On Fri, Dec 26, 2014 at 01:28:20PM -0600, Felipe Balbi wrote:
> STATUS register can be modified by the HW, so we
> should bypass cache because of that.
> 
> In the case of INT[12] registers, they are the ones
> that actually clear the IRQ source at the time they
> are read. If we rely on the cache for them, we will
> never be able to clear the interrupt, which will cause
> our IRQ line to be disabled due to IRQ throttling.
> 
> Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # v3.15+
> Cc: Keerthy <j-keerthy-l0cyMroinI0@public.gmane.org>
> Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

ping

> ---
>  drivers/mfd/tps65218.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> index 0d256cb..2243f75 100644
> --- a/drivers/mfd/tps65218.c
> +++ b/drivers/mfd/tps65218.c
> @@ -125,10 +125,21 @@ int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
>  }
>  EXPORT_SYMBOL_GPL(tps65218_clear_bits);
>  
> +static const struct regmap_range tps65218_yes_ranges[] = {
> +	regmap_reg_range(TPS65218_REG_INT1, TPS65218_REG_INT2),
> +	regmap_reg_range(TPS65218_REG_STATUS, TPS65218_REG_STATUS),
> +};
> +
> +static const struct regmap_access_table tps65218_volatile_table = {
> +	.yes_ranges = tps65218_yes_ranges,
> +	.n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges),
> +};
> +
>  static struct regmap_config tps65218_regmap_config = {
>  	.reg_bits = 8,
>  	.val_bits = 8,
>  	.cache_type = REGCACHE_RBTREE,
> +	.volatile_table = &tps65218_volatile_table,
>  };
>  
>  static const struct regmap_irq tps65218_irqs[] = {
> -- 
> 2.2.0
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] mfd: tps65218: make INT1 our status_base register
  2014-12-26 19:28 ` [PATCH 2/5] mfd: tps65218: make INT1 our status_base register Felipe Balbi
@ 2015-01-06 17:37   ` Felipe Balbi
  2015-01-18  9:52   ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2015-01-06 17:37 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On Fri, Dec 26, 2014 at 01:28:21PM -0600, Felipe Balbi wrote:
> If we don't tell regmap-irq that our first status
> register is at offset 1, it will try to read offset
> zero, which is the chipid register.
> 
> Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> Cc: <stable@vger.kernel.org> # v3.15+
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Felipe Balbi <balbi@ti.com>

ping

> ---
>  drivers/mfd/tps65218.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> index 2243f75..d6b7643 100644
> --- a/drivers/mfd/tps65218.c
> +++ b/drivers/mfd/tps65218.c
> @@ -204,6 +204,7 @@ static struct regmap_irq_chip tps65218_irq_chip = {
>  
>  	.num_regs = 2,
>  	.mask_base = TPS65218_REG_INT_MASK1,
> +	.status_base = TPS65218_REG_INT1,
>  };
>  
>  static const struct of_device_id of_tps65218_match_table[] = {
> -- 
> 2.2.0
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] arm: boot: dts: am437x-sk: add power button binding
  2014-12-26 19:28 ` [PATCH 4/5] arm: boot: dts: am437x-sk: add power button binding Felipe Balbi
@ 2015-01-08  0:09   ` Tony Lindgren
  0 siblings, 0 replies; 19+ messages in thread
From: Tony Lindgren @ 2015-01-08  0:09 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List

* Felipe Balbi <balbi@ti.com> [141226 11:31]:
> Let this board report KEY_POWER so upper layers
> can decide what to do when power button is pressed.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>

Applying this one into omap-for-v3.20/dt thanks.

Tony

> ---
>  arch/arm/boot/dts/am437x-sk-evm.dts | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts
> index 53bbfc9..c53840c 100644
> --- a/arch/arm/boot/dts/am437x-sk-evm.dts
> +++ b/arch/arm/boot/dts/am437x-sk-evm.dts
> @@ -386,6 +386,11 @@
>  			regulator-always-on;
>  		};
>  
> +		power-button {
> +			compatible = "ti,tps65218-pwrbutton";
> +			status = "okay";
> +			interrupts = <3 IRQ_TYPE_EDGE_BOTH>;
> +		};
>  	};
>  
>  	at24@50 {
> -- 
> 2.2.0
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] arm: omap2plus_defconfig: enable TPS65218 power button
  2014-12-26 19:28 ` [PATCH 5/5] arm: omap2plus_defconfig: enable TPS65218 power button Felipe Balbi
@ 2015-01-08  0:55   ` Tony Lindgren
  0 siblings, 0 replies; 19+ messages in thread
From: Tony Lindgren @ 2015-01-08  0:55 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List

* Felipe Balbi <balbi@ti.com> [141226 11:31]:
> Enable tps65218 power button driver by default as
> a dynamically linked module so AM437x SK can report
> power button presses.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>

Applying this into omap-for-v3.20/defconfig thanks.

Tony

> ---
>  arch/arm/configs/omap2plus_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
> index c2c3a85..f4a4b2f 100644
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -183,6 +183,7 @@ CONFIG_TOUCHSCREEN_EDT_FT5X06=m
>  CONFIG_TOUCHSCREEN_TSC2005=m
>  CONFIG_TOUCHSCREEN_TSC2007=m
>  CONFIG_INPUT_MISC=y
> +CONFIG_INPUT_TPS65218_PWRBUTTON=m
>  CONFIG_INPUT_TWL4030_PWRBUTTON=y
>  # CONFIG_LEGACY_PTYS is not set
>  CONFIG_SERIAL_8250=y
> -- 
> 2.2.0
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2015-01-06 17:37     ` Felipe Balbi
@ 2015-01-08 16:25       ` Felipe Balbi
  2015-01-12 16:46         ` Felipe Balbi
  0 siblings, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2015-01-08 16:25 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy

[-- Attachment #1: Type: text/plain, Size: 2058 bytes --]

On Tue, Jan 06, 2015 at 11:37:34AM -0600, Felipe Balbi wrote:
> On Fri, Dec 26, 2014 at 01:28:20PM -0600, Felipe Balbi wrote:
> > STATUS register can be modified by the HW, so we
> > should bypass cache because of that.
> > 
> > In the case of INT[12] registers, they are the ones
> > that actually clear the IRQ source at the time they
> > are read. If we rely on the cache for them, we will
> > never be able to clear the interrupt, which will cause
> > our IRQ line to be disabled due to IRQ throttling.
> > 
> > Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> > Cc: <stable@vger.kernel.org> # v3.15+
> > Cc: Keerthy <j-keerthy@ti.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> 
> ping

another ping. Without this and the following patch TPS65218 power button
driver which was already applied by Dmitry, won't work.

> > ---
> >  drivers/mfd/tps65218.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> > index 0d256cb..2243f75 100644
> > --- a/drivers/mfd/tps65218.c
> > +++ b/drivers/mfd/tps65218.c
> > @@ -125,10 +125,21 @@ int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
> >  }
> >  EXPORT_SYMBOL_GPL(tps65218_clear_bits);
> >  
> > +static const struct regmap_range tps65218_yes_ranges[] = {
> > +	regmap_reg_range(TPS65218_REG_INT1, TPS65218_REG_INT2),
> > +	regmap_reg_range(TPS65218_REG_STATUS, TPS65218_REG_STATUS),
> > +};
> > +
> > +static const struct regmap_access_table tps65218_volatile_table = {
> > +	.yes_ranges = tps65218_yes_ranges,
> > +	.n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges),
> > +};
> > +
> >  static struct regmap_config tps65218_regmap_config = {
> >  	.reg_bits = 8,
> >  	.val_bits = 8,
> >  	.cache_type = REGCACHE_RBTREE,
> > +	.volatile_table = &tps65218_volatile_table,
> >  };
> >  
> >  static const struct regmap_irq tps65218_irqs[] = {
> > -- 
> > 2.2.0
> > 
> 
> -- 
> balbi



-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2015-01-08 16:25       ` Felipe Balbi
@ 2015-01-12 16:46         ` Felipe Balbi
  2015-01-14 17:07           ` Tony Lindgren
  0 siblings, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2015-01-12 16:46 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2498 bytes --]

Hi,

On Thu, Jan 08, 2015 at 10:25:12AM -0600, Felipe Balbi wrote:
> On Tue, Jan 06, 2015 at 11:37:34AM -0600, Felipe Balbi wrote:
> > On Fri, Dec 26, 2014 at 01:28:20PM -0600, Felipe Balbi wrote:
> > > STATUS register can be modified by the HW, so we
> > > should bypass cache because of that.
> > > 
> > > In the case of INT[12] registers, they are the ones
> > > that actually clear the IRQ source at the time they
> > > are read. If we rely on the cache for them, we will
> > > never be able to clear the interrupt, which will cause
> > > our IRQ line to be disabled due to IRQ throttling.
> > > 
> > > Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> > > Cc: <stable@vger.kernel.org> # v3.15+
> > > Cc: Keerthy <j-keerthy@ti.com>
> > > Cc: Lee Jones <lee.jones@linaro.org>
> > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > 
> > ping
> 
> another ping. Without this and the following patch TPS65218 power button
> driver which was already applied by Dmitry, won't work.

Anybody ? -rc4 is out and tps65218 is still broken because nobody has
acted on these two patches. All other patches which are meant for 3.20
merge window are applied and because of these pending, those patches
won't work.

> > > ---
> > >  drivers/mfd/tps65218.c | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> > > index 0d256cb..2243f75 100644
> > > --- a/drivers/mfd/tps65218.c
> > > +++ b/drivers/mfd/tps65218.c
> > > @@ -125,10 +125,21 @@ int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
> > >  }
> > >  EXPORT_SYMBOL_GPL(tps65218_clear_bits);
> > >  
> > > +static const struct regmap_range tps65218_yes_ranges[] = {
> > > +	regmap_reg_range(TPS65218_REG_INT1, TPS65218_REG_INT2),
> > > +	regmap_reg_range(TPS65218_REG_STATUS, TPS65218_REG_STATUS),
> > > +};
> > > +
> > > +static const struct regmap_access_table tps65218_volatile_table = {
> > > +	.yes_ranges = tps65218_yes_ranges,
> > > +	.n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges),
> > > +};
> > > +
> > >  static struct regmap_config tps65218_regmap_config = {
> > >  	.reg_bits = 8,
> > >  	.val_bits = 8,
> > >  	.cache_type = REGCACHE_RBTREE,
> > > +	.volatile_table = &tps65218_volatile_table,
> > >  };
> > >  
> > >  static const struct regmap_irq tps65218_irqs[] = {
> > > -- 
> > > 2.2.0
> > > 
> > 
> > -- 
> > balbi
> 
> 
> 
> -- 
> balbi



-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2015-01-12 16:46         ` Felipe Balbi
@ 2015-01-14 17:07           ` Tony Lindgren
  2015-01-16 22:57             ` Felipe Balbi
  0 siblings, 1 reply; 19+ messages in thread
From: Tony Lindgren @ 2015-01-14 17:07 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy, Andrew Morton

* Felipe Balbi <balbi@ti.com> [150112 08:50]:
> Hi,
> 
> On Thu, Jan 08, 2015 at 10:25:12AM -0600, Felipe Balbi wrote:
> > On Tue, Jan 06, 2015 at 11:37:34AM -0600, Felipe Balbi wrote:
> > > On Fri, Dec 26, 2014 at 01:28:20PM -0600, Felipe Balbi wrote:
> > > > STATUS register can be modified by the HW, so we
> > > > should bypass cache because of that.
> > > > 
> > > > In the case of INT[12] registers, they are the ones
> > > > that actually clear the IRQ source at the time they
> > > > are read. If we rely on the cache for them, we will
> > > > never be able to clear the interrupt, which will cause
> > > > our IRQ line to be disabled due to IRQ throttling.
> > > > 
> > > > Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> > > > Cc: <stable@vger.kernel.org> # v3.15+
> > > > Cc: Keerthy <j-keerthy@ti.com>
> > > > Cc: Lee Jones <lee.jones@linaro.org>
> > > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > 
> > > ping
> > 
> > another ping. Without this and the following patch TPS65218 power button
> > driver which was already applied by Dmitry, won't work.
> 
> Anybody ? -rc4 is out and tps65218 is still broken because nobody has
> acted on these two patches. All other patches which are meant for 3.20
> merge window are applied and because of these pending, those patches
> won't work.

Lee, are you planning to pick these two drivers/mfd patches?

Regards,

Tony

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2015-01-14 17:07           ` Tony Lindgren
@ 2015-01-16 22:57             ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2015-01-16 22:57 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones
  Cc: Felipe Balbi, Tony Lindgren, Torokhov, Linux OMAP Mailing List,
	linux-input, devicetree, Linux ARM Kernel Mailing List, stable,
	Keerthy, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

Hi,

On Wed, Jan 14, 2015 at 09:07:17AM -0800, Tony Lindgren wrote:
> > > > > STATUS register can be modified by the HW, so we
> > > > > should bypass cache because of that.
> > > > > 
> > > > > In the case of INT[12] registers, they are the ones
> > > > > that actually clear the IRQ source at the time they
> > > > > are read. If we rely on the cache for them, we will
> > > > > never be able to clear the interrupt, which will cause
> > > > > our IRQ line to be disabled due to IRQ throttling.
> > > > > 
> > > > > Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> > > > > Cc: <stable@vger.kernel.org> # v3.15+
> > > > > Cc: Keerthy <j-keerthy@ti.com>
> > > > > Cc: Lee Jones <lee.jones@linaro.org>
> > > > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > > 
> > > > ping
> > > 
> > > another ping. Without this and the following patch TPS65218 power button
> > > driver which was already applied by Dmitry, won't work.
> > 
> > Anybody ? -rc4 is out and tps65218 is still broken because nobody has
> > acted on these two patches. All other patches which are meant for 3.20
> > merge window are applied and because of these pending, those patches
> > won't work.
> 
> Lee, are you planning to pick these two drivers/mfd patches?

Samuel, Lee, is someone planning on picking these two patches up ?
v3.19 remains broken.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2014-12-26 19:28 ` [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile Felipe Balbi
       [not found]   ` <1419622104-25812-2-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
@ 2015-01-18  9:52   ` Lee Jones
  2015-01-19 14:41     ` Felipe Balbi
  1 sibling, 1 reply; 19+ messages in thread
From: Lee Jones @ 2015-01-18  9:52 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy

On Fri, 26 Dec 2014, Felipe Balbi wrote:

> STATUS register can be modified by the HW, so we
> should bypass cache because of that.
> 
> In the case of INT[12] registers, they are the ones
> that actually clear the IRQ source at the time they
> are read. If we rely on the cache for them, we will
> never be able to clear the interrupt, which will cause
> our IRQ line to be disabled due to IRQ throttling.
> 
> Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> Cc: <stable@vger.kernel.org> # v3.15+
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
>  drivers/mfd/tps65218.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Sorry for the delay.  It's difficult to get a WiFi signal 2000m up in
an Austrian mountain. :)

Applied now, thanks.

> diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> index 0d256cb..2243f75 100644
> --- a/drivers/mfd/tps65218.c
> +++ b/drivers/mfd/tps65218.c
> @@ -125,10 +125,21 @@ int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
>  }
>  EXPORT_SYMBOL_GPL(tps65218_clear_bits);
>  
> +static const struct regmap_range tps65218_yes_ranges[] = {
> +	regmap_reg_range(TPS65218_REG_INT1, TPS65218_REG_INT2),
> +	regmap_reg_range(TPS65218_REG_STATUS, TPS65218_REG_STATUS),
> +};
> +
> +static const struct regmap_access_table tps65218_volatile_table = {
> +	.yes_ranges = tps65218_yes_ranges,
> +	.n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges),
> +};
> +
>  static struct regmap_config tps65218_regmap_config = {
>  	.reg_bits = 8,
>  	.val_bits = 8,
>  	.cache_type = REGCACHE_RBTREE,
> +	.volatile_table = &tps65218_volatile_table,
>  };
>  
>  static const struct regmap_irq tps65218_irqs[] = {

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] mfd: tps65218: make INT1 our status_base register
  2014-12-26 19:28 ` [PATCH 2/5] mfd: tps65218: make INT1 our status_base register Felipe Balbi
  2015-01-06 17:37   ` Felipe Balbi
@ 2015-01-18  9:52   ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Lee Jones @ 2015-01-18  9:52 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tony Lindgren, Dmitry Torokhov, Samuel Ortiz,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy

On Fri, 26 Dec 2014, Felipe Balbi wrote:

> If we don't tell regmap-irq that our first status
> register is at offset 1, it will try to read offset
> zero, which is the chipid register.
> 
> Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> Cc: <stable@vger.kernel.org> # v3.15+
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
>  drivers/mfd/tps65218.c | 1 +
>  1 file changed, 1 insertion(+)

Sorry for the delay.  It's difficult to get a WiFi signal 2000m up in
an Austrian mountain. :)

Applied now, thanks.

> diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> index 2243f75..d6b7643 100644
> --- a/drivers/mfd/tps65218.c
> +++ b/drivers/mfd/tps65218.c
> @@ -204,6 +204,7 @@ static struct regmap_irq_chip tps65218_irq_chip = {
>  
>  	.num_regs = 2,
>  	.mask_base = TPS65218_REG_INT_MASK1,
> +	.status_base = TPS65218_REG_INT1,
>  };
>  
>  static const struct of_device_id of_tps65218_match_table[] = {

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile
  2015-01-18  9:52   ` Lee Jones
@ 2015-01-19 14:41     ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2015-01-19 14:41 UTC (permalink / raw)
  To: Lee Jones
  Cc: Felipe Balbi, Tony Lindgren, Dmitry Torokhov, Samuel Ortiz,
	Linux OMAP Mailing List, linux-input, devicetree,
	Linux ARM Kernel Mailing List, stable, Keerthy

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

On Sun, Jan 18, 2015 at 09:52:14AM +0000, Lee Jones wrote:
> On Fri, 26 Dec 2014, Felipe Balbi wrote:
> 
> > STATUS register can be modified by the HW, so we
> > should bypass cache because of that.
> > 
> > In the case of INT[12] registers, they are the ones
> > that actually clear the IRQ source at the time they
> > are read. If we rely on the cache for them, we will
> > never be able to clear the interrupt, which will cause
> > our IRQ line to be disabled due to IRQ throttling.
> > 
> > Fixes: 44b4dc6 mfd: tps65218: Add driver for the TPS65218 PMIC
> > Cc: <stable@vger.kernel.org> # v3.15+
> > Cc: Keerthy <j-keerthy@ti.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > ---
> >  drivers/mfd/tps65218.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> 
> Sorry for the delay.  It's difficult to get a WiFi signal 2000m up in
> an Austrian mountain. :)

now you're just making excuses ;-)

> Applied now, thanks.

thanks :-)

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-01-19 14:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-26 19:28 [PATCH 0/5] AM437x SK: Add power-button support Felipe Balbi
2014-12-26 19:28 ` [PATCH 1/5] mfd: tps65218: make INT[12] and STATUS registers volatile Felipe Balbi
     [not found]   ` <1419622104-25812-2-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2015-01-06 17:37     ` Felipe Balbi
2015-01-08 16:25       ` Felipe Balbi
2015-01-12 16:46         ` Felipe Balbi
2015-01-14 17:07           ` Tony Lindgren
2015-01-16 22:57             ` Felipe Balbi
2015-01-18  9:52   ` Lee Jones
2015-01-19 14:41     ` Felipe Balbi
2014-12-26 19:28 ` [PATCH 2/5] mfd: tps65218: make INT1 our status_base register Felipe Balbi
2015-01-06 17:37   ` Felipe Balbi
2015-01-18  9:52   ` Lee Jones
2014-12-26 19:28 ` [PATCH 3/5] input: misc: add tps65218 power button driver Felipe Balbi
2014-12-26 19:33   ` Felipe Balbi
2014-12-26 23:41   ` Dmitry Torokhov
2014-12-26 19:28 ` [PATCH 4/5] arm: boot: dts: am437x-sk: add power button binding Felipe Balbi
2015-01-08  0:09   ` Tony Lindgren
2014-12-26 19:28 ` [PATCH 5/5] arm: omap2plus_defconfig: enable TPS65218 power button Felipe Balbi
2015-01-08  0:55   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).