* [PATCH v6 0/6] mc13783: add pwr button support
@ 2011-07-22 14:17 Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice Philippe Rétornaz
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Hello
This add button handling for the MC13783 PMIC.
Patch 1 & 2 modify the mc13xxx MFD driver to use the platform data to
resgister the led subdevice and unconditionally register the regulator
subdevice (as suggested by Mark and Uwe).
Patch 3 remove the use of the *_USE_REGULATOR and *_USE_LED macros in
the platform files.
Patch 4 must be applied after patch 1,2,3 to remove the obsolete define.
Patch 5 modify the mc13xxx MFD driver to add a button subdevice and
also adds the mc13783-pwrbutton driver using a misc input device.
The last patch adds the power on button support to the mx31moboard boards.
v2: first patch modified according to comments by Dmitry Torokhov
v3: Implement review by Uwe
v4: Implement comments by Uwe and Mark
v5: Reorder patchset
v6: Minor corrections
Philippe R?tornaz (6):
mc13xxx: Unconditionally register regulator subdevice
mc13xxx: implicitly register led subdevice
mc13xxx: remove obsolete leds and regulators flags
mc13xxx: remove unused define
mc13783: add power button support
mx31moboard: Add MC13783 power button support
arch/arm/mach-imx/mach-mx27_3ds.c | 1 -
arch/arm/mach-imx/mach-mx31_3ds.c | 2 +-
arch/arm/mach-imx/mach-mx31lite.c | 3 +-
arch/arm/mach-imx/mach-mx31moboard.c | 11 +-
arch/arm/mach-imx/mach-pcm038.c | 3 +-
arch/arm/mach-mx5/mx51_efika.c | 2 +-
drivers/input/misc/Kconfig | 10 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/mc13783-pwrbutton.c | 282 ++++++++++++++++++++++++++++++++
drivers/mfd/mc13xxx-core.c | 17 ++-
include/linux/mfd/mc13783.h | 3 +-
include/linux/mfd/mc13xxx.h | 19 ++-
12 files changed, 336 insertions(+), 18 deletions(-)
create mode 100644 drivers/input/misc/mc13783-pwrbutton.c
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice
2011-07-22 14:17 [PATCH v6 0/6] mc13783: add pwr button support Philippe Rétornaz
@ 2011-07-22 14:17 ` Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 2/6] mc13xxx: implicitly register led subdevice Philippe Rétornaz
2011-07-24 3:44 ` [PATCH v6 0/6] mc13783: add pwr button support Shawn Guo
` (2 subsequent siblings)
3 siblings, 1 reply; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
drivers/mfd/mc13xxx-core.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 7e4d44b..c238f6b 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -763,10 +763,8 @@ err_revision:
if (pdata->flags & MC13XXX_USE_CODEC)
mc13xxx_add_subdevice(mc13xxx, "%s-codec");
- if (pdata->flags & MC13XXX_USE_REGULATOR) {
- mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
- &pdata->regulators, sizeof(pdata->regulators));
- }
+ mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
+ &pdata->regulators, sizeof(pdata->regulators));
if (pdata->flags & MC13XXX_USE_RTC)
mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/6] mc13xxx: implicitly register led subdevice
2011-07-22 14:17 ` [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice Philippe Rétornaz
@ 2011-07-22 14:17 ` Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Philippe Rétornaz
0 siblings, 1 reply; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
drivers/mfd/mc13xxx-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index c238f6b..2867c21 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -772,7 +772,7 @@ err_revision:
if (pdata->flags & MC13XXX_USE_TOUCHSCREEN)
mc13xxx_add_subdevice(mc13xxx, "%s-ts");
- if (pdata->flags & MC13XXX_USE_LED)
+ if (pdata->leds)
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
pdata->leds, sizeof(*pdata->leds));
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags
2011-07-22 14:17 ` [PATCH 2/6] mc13xxx: implicitly register led subdevice Philippe Rétornaz
@ 2011-07-22 14:17 ` Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 4/6] mc13xxx: remove unused define Philippe Rétornaz
2011-08-25 9:49 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Sascha Hauer
0 siblings, 2 replies; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
arch/arm/mach-imx/mach-mx27_3ds.c | 1 -
arch/arm/mach-imx/mach-mx31_3ds.c | 2 +-
arch/arm/mach-imx/mach-mx31lite.c | 3 +--
arch/arm/mach-imx/mach-mx31moboard.c | 3 +--
arch/arm/mach-imx/mach-pcm038.c | 3 +--
arch/arm/mach-mx5/mx51_efika.c | 2 +-
6 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 6e1accf..8cd507d 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -238,7 +238,6 @@ static struct mc13xxx_platform_data mc13783_pdata = {
.num_regulators = ARRAY_SIZE(mx27_3ds_regulators),
},
- .flags = MC13783_USE_REGULATOR,
};
/* SPI */
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 9b98244..7978f58 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -496,7 +496,7 @@ static struct mc13xxx_platform_data mc13783_pdata = {
.regulators = mx31_3ds_regulators,
.num_regulators = ARRAY_SIZE(mx31_3ds_regulators),
},
- .flags = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN,
+ .flags = MC13783_USE_TOUCHSCREEN,
};
/* SPI */
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index ac9b4ca..ae99cae 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -112,8 +112,7 @@ static const struct spi_imx_master spi1_pdata __initconst = {
};
static struct mc13xxx_platform_data mc13783_pdata __initdata = {
- .flags = MC13XXX_USE_RTC |
- MC13XXX_USE_REGULATOR,
+ .flags = MC13XXX_USE_RTC,
};
static struct spi_board_info mc13783_spi_dev __initdata = {
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 12ee755..579ca1f 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -270,8 +270,7 @@ static struct mc13xxx_platform_data moboard_pmic = {
.num_regulators = ARRAY_SIZE(moboard_regulators),
},
.leds = &moboard_leds,
- .flags = MC13XXX_USE_REGULATOR | MC13XXX_USE_RTC |
- MC13XXX_USE_ADC | MC13XXX_USE_LED,
+ .flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC,
};
static struct spi_board_info moboard_spi_board_info[] __initdata = {
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 853bb87..70aaa7d 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -266,8 +266,7 @@ static struct mc13xxx_platform_data pcm038_pmic = {
.regulators = pcm038_regulators,
.num_regulators = ARRAY_SIZE(pcm038_regulators),
},
- .flags = MC13783_USE_ADC | MC13783_USE_REGULATOR |
- MC13783_USE_TOUCHSCREEN,
+ .flags = MC13783_USE_ADC | MC13783_USE_TOUCHSCREEN,
};
static struct spi_board_info pcm038_spi_board_info[] __initdata = {
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
index 1105ef3..e2e4096 100644
--- a/arch/arm/mach-mx5/mx51_efika.c
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -567,7 +567,7 @@ static struct mc13xxx_regulator_init_data mx51_efika_regulators[] = {
};
static struct mc13xxx_platform_data mx51_efika_mc13892_data = {
- .flags = MC13XXX_USE_RTC | MC13XXX_USE_REGULATOR,
+ .flags = MC13XXX_USE_RTC,
.regulators = {
.num_regulators = ARRAY_SIZE(mx51_efika_regulators),
.regulators = mx51_efika_regulators,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/6] mc13xxx: remove unused define
2011-07-22 14:17 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Philippe Rétornaz
@ 2011-07-22 14:17 ` Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 5/6] mc13783: add power button support Philippe Rétornaz
2011-08-25 9:49 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Sascha Hauer
1 sibling, 1 reply; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
include/linux/mfd/mc13783.h | 2 --
include/linux/mfd/mc13xxx.h | 2 --
2 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 7d0f3d6..3756a30 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -112,8 +112,6 @@ static inline int mc13783_irq_ack(struct mc13783 *mc13783, int irq)
#define MC13783_USE_CODEC MC13XXX_USE_CODEC
#define MC13783_USE_ADC MC13XXX_USE_ADC
#define MC13783_USE_RTC MC13XXX_USE_RTC
-#define MC13783_USE_REGULATOR MC13XXX_USE_REGULATOR
-#define MC13783_USE_LED MC13XXX_USE_LED
#define MC13783_ADC_MODE_TS 1
#define MC13783_ADC_MODE_SINGLE_CHAN 2
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index c064bea..cef1497 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -142,8 +142,6 @@ struct mc13xxx_platform_data {
#define MC13XXX_USE_CODEC (1 << 1)
#define MC13XXX_USE_ADC (1 << 2)
#define MC13XXX_USE_RTC (1 << 3)
-#define MC13XXX_USE_REGULATOR (1 << 4)
-#define MC13XXX_USE_LED (1 << 5)
unsigned int flags;
struct mc13xxx_regulator_platform_data regulators;
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/6] mc13783: add power button support
2011-07-22 14:17 ` [PATCH 4/6] mc13xxx: remove unused define Philippe Rétornaz
@ 2011-07-22 14:17 ` Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 6/6] mx31moboard: Add MC13783 " Philippe Rétornaz
0 siblings, 1 reply; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
This adds support for the power-on buttons of MC13783 PMIC.
This is done using a misc input device.
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/misc/Kconfig | 10 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/mc13783-pwrbutton.c | 282 ++++++++++++++++++++++++++++++++
drivers/mfd/mc13xxx-core.c | 9 +
include/linux/mfd/mc13783.h | 1 +
include/linux/mfd/mc13xxx.h | 17 ++
6 files changed, 320 insertions(+), 0 deletions(-)
create mode 100644 drivers/input/misc/mc13783-pwrbutton.c
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 45dc6aa..4272658 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -100,6 +100,16 @@ config INPUT_MAX8925_ONKEY
To compile this driver as a module, choose M here: the module
will be called max8925_onkey.
+config INPUT_MC13783_PWRBUTTON
+ tristate "MC13783 ON buttons"
+ depends on MFD_MC13783
+ help
+ Support the ON buttons of MC13783 PMIC as an input device
+ reporting power button status.
+
+ To compile this driver as a module, choose M here: the module
+ will be called mc13783-pwrbutton.
+
config INPUT_APANEL
tristate "Fujitsu Lifebook Application Panel buttons"
depends on X86 && I2C && LEDS_CLASS
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 38efb2c..ecced4c 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o
obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o
obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o
+obj-$(CONFIG_INPUT_MC13783_PWRBUTTON) += mc13783-pwrbutton.o
obj-$(CONFIG_INPUT_PCAP) += pcap_keys.o
obj-$(CONFIG_INPUT_PCF50633_PMU) += pcf50633-input.o
obj-$(CONFIG_INPUT_PCF8574) += pcf8574_keypad.o
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
new file mode 100644
index 0000000..09b0522
--- /dev/null
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -0,0 +1,282 @@
+/**
+ * Copyright (C) 2011 Philippe R?tornaz
+ *
+ * Based on twl4030-pwrbutton driver by:
+ * Peter De Schrijver <peter.de-schrijver@nokia.com>
+ * Felipe Balbi <felipe.balbi@nokia.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/mc13783.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+
+struct mc13783_pwrb {
+ struct input_dev *pwr;
+ struct mc13xxx *mc13783;
+#define MC13783_PWRB_B1_POL_INVERT (1 << 0)
+#define MC13783_PWRB_B2_POL_INVERT (1 << 1)
+#define MC13783_PWRB_B3_POL_INVERT (1 << 2)
+ int flags;
+ unsigned short keymap[3];
+};
+
+#define MC13783_REG_INTERRUPT_SENSE_1 5
+#define MC13783_IRQSENSE1_ONOFD1S (1 << 3)
+#define MC13783_IRQSENSE1_ONOFD2S (1 << 4)
+#define MC13783_IRQSENSE1_ONOFD3S (1 << 5)
+
+#define MC13783_REG_POWER_CONTROL_2 15
+#define MC13783_POWER_CONTROL_2_ON1BDBNC 4
+#define MC13783_POWER_CONTROL_2_ON2BDBNC 6
+#define MC13783_POWER_CONTROL_2_ON3BDBNC 8
+#define MC13783_POWER_CONTROL_2_ON1BRSTEN (1 << 1)
+#define MC13783_POWER_CONTROL_2_ON2BRSTEN (1 << 2)
+#define MC13783_POWER_CONTROL_2_ON3BRSTEN (1 << 3)
+
+static irqreturn_t button_irq(int irq, void *_priv)
+{
+ struct mc13783_pwrb *priv = _priv;
+ int val;
+
+ mc13xxx_irq_ack(priv->mc13783, irq);
+ mc13xxx_reg_read(priv->mc13783, MC13783_REG_INTERRUPT_SENSE_1, &val);
+
+ switch (irq) {
+ case MC13783_IRQ_ONOFD1:
+ val = val & MC13783_IRQSENSE1_ONOFD1S ? 1 : 0;
+ if (priv->flags & MC13783_PWRB_B1_POL_INVERT)
+ val ^= 1;
+ input_report_key(priv->pwr, priv->keymap[0], val);
+ break;
+
+ case MC13783_IRQ_ONOFD2:
+ val = val & MC13783_IRQSENSE1_ONOFD2S ? 1 : 0;
+ if (priv->flags & MC13783_PWRB_B2_POL_INVERT)
+ val ^= 1;
+ input_report_key(priv->pwr, priv->keymap[1], val);
+ break;
+
+ case MC13783_IRQ_ONOFD3:
+ val = val & MC13783_IRQSENSE1_ONOFD3S ? 1 : 0;
+ if (priv->flags & MC13783_PWRB_B3_POL_INVERT)
+ val ^= 1;
+ input_report_key(priv->pwr, priv->keymap[2], val);
+ break;
+ }
+
+ input_sync(priv->pwr);
+
+ return IRQ_HANDLED;
+}
+
+static int __devinit mc13783_pwrbutton_probe(struct platform_device *pdev)
+{
+ const struct mc13xxx_buttons_platform_data *pdata;
+ struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
+ struct input_dev *pwr;
+ struct mc13783_pwrb *priv;
+ int err = 0;
+ int reg = 0;
+
+ pdata = dev_get_platdata(&pdev->dev);
+ if (!pdata) {
+ dev_err(&pdev->dev, "missing platform data\n");
+ return -ENODEV;
+ }
+
+ pwr = input_allocate_device();
+ if (!pwr) {
+ dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ return -ENOMEM;
+ }
+
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ if (!priv) {
+ err = -ENOMEM;
+ dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ goto free_input_dev;
+ }
+
+ reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
+ reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
+ reg |= (pdata->b3on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
+
+ priv->pwr = pwr;
+ priv->mc13783 = mc13783;
+
+ mc13xxx_lock(mc13783);
+
+ if (pdata->b1on_flags & MC13783_BUTTON_ENABLE) {
+ priv->keymap[0] = pdata->b1on_key;
+ if (pdata->b1on_key != KEY_RESERVED)
+ __set_bit(pdata->b1on_key, pwr->keybit);
+
+ if (pdata->b1on_flags & MC13783_BUTTON_POL_INVERT)
+ priv->flags |= MC13783_PWRB_B1_POL_INVERT;
+
+ if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN)
+ reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
+
+ err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
+ button_irq, "b1on", priv);
+ if (err) {
+ dev_dbg(&pdev->dev, "Can't request irq\n");
+ goto free_priv;
+ }
+ }
+
+ if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) {
+ priv->keymap[1] = pdata->b2on_key;
+ if (pdata->b2on_key != KEY_RESERVED)
+ __set_bit(pdata->b2on_key, pwr->keybit);
+
+ if (pdata->b2on_flags & MC13783_BUTTON_POL_INVERT)
+ priv->flags |= MC13783_PWRB_B2_POL_INVERT;
+
+ if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN)
+ reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
+
+ err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
+ button_irq, "b2on", priv);
+ if (err) {
+ dev_dbg(&pdev->dev, "Can't request irq\n");
+ goto free_irq_b1;
+ }
+ }
+
+ if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) {
+ priv->keymap[2] = pdata->b3on_key;
+ if (pdata->b3on_key != KEY_RESERVED)
+ __set_bit(pdata->b3on_key, pwr->keybit);
+
+ if (pdata->b3on_flags & MC13783_BUTTON_POL_INVERT)
+ priv->flags |= MC13783_PWRB_B3_POL_INVERT;
+
+ if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN)
+ reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
+
+ err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
+ button_irq, "b3on", priv);
+ if (err) {
+ dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
+ goto free_irq_b2;
+ }
+ }
+
+ mc13xxx_reg_rmw(mc13783, MC13783_REG_POWER_CONTROL_2, 0x3FE, reg);
+
+ mc13xxx_unlock(mc13783);
+
+ pwr->name = "mc13783_pwrbutton";
+ pwr->phys = "mc13783_pwrbutton/input0";
+ pwr->dev.parent = &pdev->dev;
+
+ pwr->keycode = priv->keymap;
+ pwr->keycodemax = ARRAY_SIZE(priv->keymap);
+ pwr->keycodesize = sizeof(priv->keymap[0]);
+ __set_bit(EV_KEY, pwr->evbit);
+
+ err = input_register_device(pwr);
+ if (err) {
+ dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
+ goto free_irq;
+ }
+
+ platform_set_drvdata(pdev, priv);
+
+ return 0;
+
+free_irq:
+ mc13xxx_lock(mc13783);
+
+ if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
+ mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv);
+
+free_irq_b2:
+ if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
+ mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD2, priv);
+
+free_irq_b1:
+ if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
+ mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
+
+free_priv:
+ mc13xxx_unlock(mc13783);
+ kfree(priv);
+
+free_input_dev:
+ input_free_device(pwr);
+
+ return err;
+}
+
+static int __devexit mc13783_pwrbutton_remove(struct platform_device *pdev)
+{
+ struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
+ const struct mc13xxx_buttons_platform_data *pdata;
+
+ pdata = dev_get_platdata(&pdev->dev);
+
+ mc13xxx_lock(priv->mc13783);
+
+ if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
+ mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
+ if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
+ mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
+ if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
+ mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
+
+ mc13xxx_unlock(priv->mc13783);
+
+ input_unregister_device(priv->pwr);
+ kfree(priv);
+ platform_set_drvdata(pdev, NULL);
+
+ return 0;
+}
+
+struct platform_driver mc13783_pwrbutton_driver = {
+ .probe = mc13783_pwrbutton_probe,
+ .remove = __devexit_p(mc13783_pwrbutton_remove),
+ .driver = {
+ .name = "mc13783-pwrbutton",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init mc13783_pwrbutton_init(void)
+{
+ return platform_driver_register(&mc13783_pwrbutton_driver);
+}
+module_init(mc13783_pwrbutton_init);
+
+static void __exit mc13783_pwrbutton_exit(void)
+{
+ platform_driver_unregister(&mc13783_pwrbutton_driver);
+}
+module_exit(mc13783_pwrbutton_exit);
+
+MODULE_ALIAS("platform:mc13783-pwrbutton");
+MODULE_DESCRIPTION("MC13783 Power Button");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Philippe Retornaz");
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 2867c21..ce4377f 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -716,6 +716,11 @@ static int mc13xxx_probe(struct spi_device *spi)
enum mc13xxx_id id;
int ret;
+ if (!pdata) {
+ dev_err(&spi->dev, "invalid platform data\n");
+ return -EINVAL;
+ }
+
mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
if (!mc13xxx)
return -ENOMEM;
@@ -776,6 +781,10 @@ err_revision:
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
pdata->leds, sizeof(*pdata->leds));
+ if (pdata->buttons)
+ mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
+ pdata->buttons, sizeof(*pdata->buttons));
+
return 0;
}
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 3756a30..aa824d0 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -106,6 +106,7 @@ static inline int mc13783_irq_ack(struct mc13783 *mc13783, int irq)
#define mc13783_regulator_platform_data mc13xxx_regulator_platform_data
#define mc13783_led_platform_data mc13xxx_led_platform_data
#define mc13783_leds_platform_data mc13xxx_leds_platform_data
+#define mc13783_buttons_platform_data mc13xxx_buttons_platform_data
#define mc13783_platform_data mc13xxx_platform_data
#define MC13783_USE_TOUCHSCREEN MC13XXX_USE_TOUCHSCREEN
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index cef1497..f24be68 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -137,6 +137,22 @@ struct mc13xxx_leds_platform_data {
char tc3_period;
};
+struct mc13xxx_buttons_platform_data {
+#define MC13783_BUTTON_DBNC_0MS 0
+#define MC13783_BUTTON_DBNC_30MS 1
+#define MC13783_BUTTON_DBNC_150MS 2
+#define MC13783_BUTTON_DBNC_750MS 3
+#define MC13783_BUTTON_ENABLE (1 << 2)
+#define MC13783_BUTTON_POL_INVERT (1 << 3)
+#define MC13783_BUTTON_RESET_EN (1 << 4)
+ int b1on_flags;
+ unsigned short b1on_key;
+ int b2on_flags;
+ unsigned short b2on_key;
+ int b3on_flags;
+ unsigned short b3on_key;
+};
+
struct mc13xxx_platform_data {
#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
#define MC13XXX_USE_CODEC (1 << 1)
@@ -146,6 +162,7 @@ struct mc13xxx_platform_data {
struct mc13xxx_regulator_platform_data regulators;
struct mc13xxx_leds_platform_data *leds;
+ struct mc13xxx_buttons_platform_data *buttons;
};
#endif /* ifndef __LINUX_MFD_MC13XXX_H */
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 6/6] mx31moboard: Add MC13783 power button support
2011-07-22 14:17 ` [PATCH 5/6] mc13783: add power button support Philippe Rétornaz
@ 2011-07-22 14:17 ` Philippe Rétornaz
2011-08-25 9:50 ` Sascha Hauer
0 siblings, 1 reply; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-22 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Add the power-on button on mx31moboard using MC13783 PMIC.
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
arch/arm/mach-imx/mach-mx31moboard.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 579ca1f..2a43492 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -28,6 +28,7 @@
#include <linux/spi/spi.h>
#include <linux/types.h>
#include <linux/memblock.h>
+#include <linux/input.h>
#include <linux/usb/otg.h>
#include <linux/usb/ulpi.h>
@@ -264,12 +265,19 @@ static struct mc13783_leds_platform_data moboard_leds = {
.tc2_period = MC13783_LED_PERIOD_10MS,
};
+static struct mc13783_buttons_platform_data moboard_buttons = {
+ .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE |
+ MC13783_BUTTON_POL_INVERT,
+ .b1on_key = KEY_POWER,
+};
+
static struct mc13xxx_platform_data moboard_pmic = {
.regulators = {
.regulators = moboard_regulators,
.num_regulators = ARRAY_SIZE(moboard_regulators),
},
.leds = &moboard_leds,
+ .buttons = &moboard_buttons,
.flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC,
};
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v6 0/6] mc13783: add pwr button support
2011-07-22 14:17 [PATCH v6 0/6] mc13783: add pwr button support Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice Philippe Rétornaz
@ 2011-07-24 3:44 ` Shawn Guo
2011-07-25 6:49 ` Philippe Rétornaz
2011-07-25 7:12 ` Wanlong Gao
2011-07-27 10:34 ` Samuel Ortiz
3 siblings, 1 reply; 16+ messages in thread
From: Shawn Guo @ 2011-07-24 3:44 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 22, 2011 at 04:17:06PM +0200, Philippe R?tornaz wrote:
> Hello
>
> This add button handling for the MC13783 PMIC.
>
> Patch 1 & 2 modify the mc13xxx MFD driver to use the platform data to
> resgister the led subdevice and unconditionally register the regulator
> subdevice (as suggested by Mark and Uwe).
>
> Patch 3 remove the use of the *_USE_REGULATOR and *_USE_LED macros in
> the platform files.
>
> Patch 4 must be applied after patch 1,2,3 to remove the obsolete define.
>
> Patch 5 modify the mc13xxx MFD driver to add a button subdevice and
> also adds the mc13783-pwrbutton driver using a misc input device.
>
> The last patch adds the power on button support to the mx31moboard boards.
>
> v2: first patch modified according to comments by Dmitry Torokhov
> v3: Implement review by Uwe
> v4: Implement comments by Uwe and Mark
> v5: Reorder patchset
> v6: Minor corrections
>
It seems you did not address the comment about possible NULL pdata I
put on v4?
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 0/6] mc13783: add pwr button support
2011-07-24 3:44 ` [PATCH v6 0/6] mc13783: add pwr button support Shawn Guo
@ 2011-07-25 6:49 ` Philippe Rétornaz
2011-07-25 7:13 ` Shawn Guo
0 siblings, 1 reply; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-25 6:49 UTC (permalink / raw)
To: linux-arm-kernel
Le dimanche 24 juillet 2011 05:44:19, Shawn Guo a ?crit :
> On Fri, Jul 22, 2011 at 04:17:06PM +0200, Philippe R?tornaz wrote:
> > Hello
> >
> > This add button handling for the MC13783 PMIC.
> >
> > Patch 1 & 2 modify the mc13xxx MFD driver to use the platform data to
> > resgister the led subdevice and unconditionally register the regulator
> > subdevice (as suggested by Mark and Uwe).
> >
> > Patch 3 remove the use of the *_USE_REGULATOR and *_USE_LED macros in
> > the platform files.
> >
> > Patch 4 must be applied after patch 1,2,3 to remove the obsolete define.
> >
> > Patch 5 modify the mc13xxx MFD driver to add a button subdevice and
> > also adds the mc13783-pwrbutton driver using a misc input device.
> >
> > The last patch adds the power on button support to the mx31moboard
> > boards.
> >
> > v2: first patch modified according to comments by Dmitry Torokhov
> > v3: Implement review by Uwe
> > v4: Implement comments by Uwe and Mark
> > v5: Reorder patchset
> > v6: Minor corrections
>
> It seems you did not address the comment about possible NULL pdata I
> put on v4?
Yes I did in patch 5:
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -716,6 +716,11 @@ static int mc13xxx_probe(struct spi_device *spi)
enum mc13xxx_id id;
int ret;
+ if (!pdata) {
+ dev_err(&spi->dev, "invalid platform data\n");
+ return -EINVAL;
+ }
+
Thanks,
Philippe
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 0/6] mc13783: add pwr button support
2011-07-22 14:17 [PATCH v6 0/6] mc13783: add pwr button support Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice Philippe Rétornaz
2011-07-24 3:44 ` [PATCH v6 0/6] mc13783: add pwr button support Shawn Guo
@ 2011-07-25 7:12 ` Wanlong Gao
2011-07-27 10:34 ` Samuel Ortiz
3 siblings, 0 replies; 16+ messages in thread
From: Wanlong Gao @ 2011-07-25 7:12 UTC (permalink / raw)
To: linux-arm-kernel
On 07/22/2011 10:17 PM, Philippe R?tornaz wrote:
> Hello
>
> This add button handling for the MC13783 PMIC.
>
> Patch 1& 2 modify the mc13xxx MFD driver to use the platform data to
> resgister the led subdevice and unconditionally register the regulator
> subdevice (as suggested by Mark and Uwe).
>
> Patch 3 remove the use of the *_USE_REGULATOR and *_USE_LED macros in
> the platform files.
>
> Patch 4 must be applied after patch 1,2,3 to remove the obsolete define.
>
> Patch 5 modify the mc13xxx MFD driver to add a button subdevice and
> also adds the mc13783-pwrbutton driver using a misc input device.
>
> The last patch adds the power on button support to the mx31moboard boards.
>
> v2: first patch modified according to comments by Dmitry Torokhov
> v3: Implement review by Uwe
> v4: Implement comments by Uwe and Mark
> v5: Reorder patchset
> v6: Minor corrections
>
> Philippe R?tornaz (6):
> mc13xxx: Unconditionally register regulator subdevice
> mc13xxx: implicitly register led subdevice
> mc13xxx: remove obsolete leds and regulators flags
> mc13xxx: remove unused define
> mc13783: add power button support
> mx31moboard: Add MC13783 power button support
>
> arch/arm/mach-imx/mach-mx27_3ds.c | 1 -
> arch/arm/mach-imx/mach-mx31_3ds.c | 2 +-
> arch/arm/mach-imx/mach-mx31lite.c | 3 +-
> arch/arm/mach-imx/mach-mx31moboard.c | 11 +-
> arch/arm/mach-imx/mach-pcm038.c | 3 +-
> arch/arm/mach-mx5/mx51_efika.c | 2 +-
> drivers/input/misc/Kconfig | 10 +
> drivers/input/misc/Makefile | 1 +
> drivers/input/misc/mc13783-pwrbutton.c | 282 ++++++++++++++++++++++++++++++++
> drivers/mfd/mc13xxx-core.c | 17 ++-
> include/linux/mfd/mc13783.h | 3 +-
> include/linux/mfd/mc13xxx.h | 19 ++-
> 12 files changed, 336 insertions(+), 18 deletions(-)
> create mode 100644 drivers/input/misc/mc13783-pwrbutton.c
>
Seems good now, cheers.
--
Thanks
Best Regards
Wanlong Gao
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 0/6] mc13783: add pwr button support
2011-07-25 6:49 ` Philippe Rétornaz
@ 2011-07-25 7:13 ` Shawn Guo
0 siblings, 0 replies; 16+ messages in thread
From: Shawn Guo @ 2011-07-25 7:13 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jul 25, 2011 at 08:49:25AM +0200, Philippe R?tornaz wrote:
> Le dimanche 24 juillet 2011 05:44:19, Shawn Guo a ?crit :
> > On Fri, Jul 22, 2011 at 04:17:06PM +0200, Philippe R?tornaz wrote:
> > > Hello
> > >
> > > This add button handling for the MC13783 PMIC.
> > >
> > > Patch 1 & 2 modify the mc13xxx MFD driver to use the platform data to
> > > resgister the led subdevice and unconditionally register the regulator
> > > subdevice (as suggested by Mark and Uwe).
> > >
> > > Patch 3 remove the use of the *_USE_REGULATOR and *_USE_LED macros in
> > > the platform files.
> > >
> > > Patch 4 must be applied after patch 1,2,3 to remove the obsolete define.
> > >
> > > Patch 5 modify the mc13xxx MFD driver to add a button subdevice and
> > > also adds the mc13783-pwrbutton driver using a misc input device.
> > >
> > > The last patch adds the power on button support to the mx31moboard
> > > boards.
> > >
> > > v2: first patch modified according to comments by Dmitry Torokhov
> > > v3: Implement review by Uwe
> > > v4: Implement comments by Uwe and Mark
> > > v5: Reorder patchset
> > > v6: Minor corrections
> >
> > It seems you did not address the comment about possible NULL pdata I
> > put on v4?
>
> Yes I did in patch 5:
>
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -716,6 +716,11 @@ static int mc13xxx_probe(struct spi_device *spi)
> enum mc13xxx_id id;
> int ret;
>
> + if (!pdata) {
> + dev_err(&spi->dev, "invalid platform data\n");
> + return -EINVAL;
> + }
> +
>
Ah, missed that. I thought it should be fixed with a separate patch
in the first place. But I'm fine with it, as long as it gets fixed :)
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 0/6] mc13783: add pwr button support
2011-07-22 14:17 [PATCH v6 0/6] mc13783: add pwr button support Philippe Rétornaz
` (2 preceding siblings ...)
2011-07-25 7:12 ` Wanlong Gao
@ 2011-07-27 10:34 ` Samuel Ortiz
2011-08-03 7:17 ` Philippe Rétornaz
3 siblings, 1 reply; 16+ messages in thread
From: Samuel Ortiz @ 2011-07-27 10:34 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philippe,
On Fri, Jul 22, 2011 at 04:17:06PM +0200, Philippe R?tornaz wrote:
> Hello
>
> This add button handling for the MC13783 PMIC.
I suppose I should take this one. Sascha, are you ok with me doing so ? Also,
are you fine with the imx changes ?
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v6 0/6] mc13783: add pwr button support
2011-07-27 10:34 ` Samuel Ortiz
@ 2011-08-03 7:17 ` Philippe Rétornaz
0 siblings, 0 replies; 16+ messages in thread
From: Philippe Rétornaz @ 2011-08-03 7:17 UTC (permalink / raw)
To: linux-arm-kernel
Le mercredi 27 juillet 2011 12:34:03, Samuel Ortiz a ?crit :
> On Fri, Jul 22, 2011 at 04:17:06PM +0200, Philippe R?tornaz wrote:
> > Hello
> >
> > This add button handling for the MC13783 PMIC.
>
> I suppose I should take this one. Sascha, are you ok with me doing so ?
> Also, are you fine with the imx changes ?
Ping ?
Thanks !
Philippe
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags
2011-07-22 14:17 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 4/6] mc13xxx: remove unused define Philippe Rétornaz
@ 2011-08-25 9:49 ` Sascha Hauer
1 sibling, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2011-08-25 9:49 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 22, 2011 at 04:17:09PM +0200, Philippe R?tornaz wrote:
> Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/mach-imx/mach-mx27_3ds.c | 1 -
> arch/arm/mach-imx/mach-mx31_3ds.c | 2 +-
> arch/arm/mach-imx/mach-mx31lite.c | 3 +--
> arch/arm/mach-imx/mach-mx31moboard.c | 3 +--
> arch/arm/mach-imx/mach-pcm038.c | 3 +--
> arch/arm/mach-mx5/mx51_efika.c | 2 +-
> 6 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
> index 6e1accf..8cd507d 100644
> --- a/arch/arm/mach-imx/mach-mx27_3ds.c
> +++ b/arch/arm/mach-imx/mach-mx27_3ds.c
> @@ -238,7 +238,6 @@ static struct mc13xxx_platform_data mc13783_pdata = {
> .num_regulators = ARRAY_SIZE(mx27_3ds_regulators),
>
> },
> - .flags = MC13783_USE_REGULATOR,
> };
>
> /* SPI */
> diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
> index 9b98244..7978f58 100644
> --- a/arch/arm/mach-imx/mach-mx31_3ds.c
> +++ b/arch/arm/mach-imx/mach-mx31_3ds.c
> @@ -496,7 +496,7 @@ static struct mc13xxx_platform_data mc13783_pdata = {
> .regulators = mx31_3ds_regulators,
> .num_regulators = ARRAY_SIZE(mx31_3ds_regulators),
> },
> - .flags = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN,
> + .flags = MC13783_USE_TOUCHSCREEN,
> };
>
> /* SPI */
> diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
> index ac9b4ca..ae99cae 100644
> --- a/arch/arm/mach-imx/mach-mx31lite.c
> +++ b/arch/arm/mach-imx/mach-mx31lite.c
> @@ -112,8 +112,7 @@ static const struct spi_imx_master spi1_pdata __initconst = {
> };
>
> static struct mc13xxx_platform_data mc13783_pdata __initdata = {
> - .flags = MC13XXX_USE_RTC |
> - MC13XXX_USE_REGULATOR,
> + .flags = MC13XXX_USE_RTC,
> };
>
> static struct spi_board_info mc13783_spi_dev __initdata = {
> diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
> index 12ee755..579ca1f 100644
> --- a/arch/arm/mach-imx/mach-mx31moboard.c
> +++ b/arch/arm/mach-imx/mach-mx31moboard.c
> @@ -270,8 +270,7 @@ static struct mc13xxx_platform_data moboard_pmic = {
> .num_regulators = ARRAY_SIZE(moboard_regulators),
> },
> .leds = &moboard_leds,
> - .flags = MC13XXX_USE_REGULATOR | MC13XXX_USE_RTC |
> - MC13XXX_USE_ADC | MC13XXX_USE_LED,
> + .flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC,
> };
>
> static struct spi_board_info moboard_spi_board_info[] __initdata = {
> diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
> index 853bb87..70aaa7d 100644
> --- a/arch/arm/mach-imx/mach-pcm038.c
> +++ b/arch/arm/mach-imx/mach-pcm038.c
> @@ -266,8 +266,7 @@ static struct mc13xxx_platform_data pcm038_pmic = {
> .regulators = pcm038_regulators,
> .num_regulators = ARRAY_SIZE(pcm038_regulators),
> },
> - .flags = MC13783_USE_ADC | MC13783_USE_REGULATOR |
> - MC13783_USE_TOUCHSCREEN,
> + .flags = MC13783_USE_ADC | MC13783_USE_TOUCHSCREEN,
> };
>
> static struct spi_board_info pcm038_spi_board_info[] __initdata = {
> diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
> index 1105ef3..e2e4096 100644
> --- a/arch/arm/mach-mx5/mx51_efika.c
> +++ b/arch/arm/mach-mx5/mx51_efika.c
> @@ -567,7 +567,7 @@ static struct mc13xxx_regulator_init_data mx51_efika_regulators[] = {
> };
>
> static struct mc13xxx_platform_data mx51_efika_mc13892_data = {
> - .flags = MC13XXX_USE_RTC | MC13XXX_USE_REGULATOR,
> + .flags = MC13XXX_USE_RTC,
> .regulators = {
> .num_regulators = ARRAY_SIZE(mx51_efika_regulators),
> .regulators = mx51_efika_regulators,
> --
> 1.6.3.3
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 6/6] mx31moboard: Add MC13783 power button support
2011-07-22 14:17 ` [PATCH 6/6] mx31moboard: Add MC13783 " Philippe Rétornaz
@ 2011-08-25 9:50 ` Sascha Hauer
0 siblings, 0 replies; 16+ messages in thread
From: Sascha Hauer @ 2011-08-25 9:50 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 22, 2011 at 04:17:12PM +0200, Philippe R?tornaz wrote:
> Add the power-on button on mx31moboard using MC13783 PMIC.
>
> Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
Please ping once the rest is merged.
Sascha
> ---
> arch/arm/mach-imx/mach-mx31moboard.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
> index 579ca1f..2a43492 100644
> --- a/arch/arm/mach-imx/mach-mx31moboard.c
> +++ b/arch/arm/mach-imx/mach-mx31moboard.c
> @@ -28,6 +28,7 @@
> #include <linux/spi/spi.h>
> #include <linux/types.h>
> #include <linux/memblock.h>
> +#include <linux/input.h>
>
> #include <linux/usb/otg.h>
> #include <linux/usb/ulpi.h>
> @@ -264,12 +265,19 @@ static struct mc13783_leds_platform_data moboard_leds = {
> .tc2_period = MC13783_LED_PERIOD_10MS,
> };
>
> +static struct mc13783_buttons_platform_data moboard_buttons = {
> + .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE |
> + MC13783_BUTTON_POL_INVERT,
> + .b1on_key = KEY_POWER,
> +};
> +
> static struct mc13xxx_platform_data moboard_pmic = {
> .regulators = {
> .regulators = moboard_regulators,
> .num_regulators = ARRAY_SIZE(moboard_regulators),
> },
> .leds = &moboard_leds,
> + .buttons = &moboard_buttons,
> .flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC,
> };
>
> --
> 1.6.3.3
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice
2011-07-21 18:04 [PATCH v5 " Philippe Rétornaz
@ 2011-07-21 18:04 ` Philippe Rétornaz
0 siblings, 0 replies; 16+ messages in thread
From: Philippe Rétornaz @ 2011-07-21 18:04 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
drivers/mfd/mc13xxx-core.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 7e4d44b..c238f6b 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -763,10 +763,8 @@ err_revision:
if (pdata->flags & MC13XXX_USE_CODEC)
mc13xxx_add_subdevice(mc13xxx, "%s-codec");
- if (pdata->flags & MC13XXX_USE_REGULATOR) {
- mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
- &pdata->regulators, sizeof(pdata->regulators));
- }
+ mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
+ &pdata->regulators, sizeof(pdata->regulators));
if (pdata->flags & MC13XXX_USE_RTC)
mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
--
1.6.3.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-08-25 9:50 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-22 14:17 [PATCH v6 0/6] mc13783: add pwr button support Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 2/6] mc13xxx: implicitly register led subdevice Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 4/6] mc13xxx: remove unused define Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 5/6] mc13783: add power button support Philippe Rétornaz
2011-07-22 14:17 ` [PATCH 6/6] mx31moboard: Add MC13783 " Philippe Rétornaz
2011-08-25 9:50 ` Sascha Hauer
2011-08-25 9:49 ` [PATCH 3/6] mc13xxx: remove obsolete leds and regulators flags Sascha Hauer
2011-07-24 3:44 ` [PATCH v6 0/6] mc13783: add pwr button support Shawn Guo
2011-07-25 6:49 ` Philippe Rétornaz
2011-07-25 7:13 ` Shawn Guo
2011-07-25 7:12 ` Wanlong Gao
2011-07-27 10:34 ` Samuel Ortiz
2011-08-03 7:17 ` Philippe Rétornaz
-- strict thread matches above, loose matches on Subject: below --
2011-07-21 18:04 [PATCH v5 " Philippe Rétornaz
2011-07-21 18:04 ` [PATCH 1/6] mc13xxx: Unconditionally register regulator subdevice Philippe Rétornaz
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).