aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVipul Kumar Samar <vipulkumar.samar@st.com>2012-12-07 09:59:37 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-12-10 04:03:50 -0500
commitac713cc9fcb8a5f9503af08421772b85ca4685f1 (patch)
treeb2a712700477bb7056c0b0cd26896441890823f5
parentbe2f6f5a7833b99bdee97c4b877dcd2afc6cdd00 (diff)
mfd: stmpe: Update DT support for stmpe driver
This patch extends existing DT support for stmpe devices. This updates: - missing header files in stmpe.c - stmpe_of_probe() with pwm, rotator and new bindings. - Bindings are updated in binding document. Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--Documentation/devicetree/bindings/mfd/stmpe.txt9
-rw-r--r--drivers/mfd/stmpe.c21
2 files changed, 21 insertions, 9 deletions
diff --git a/Documentation/devicetree/bindings/mfd/stmpe.txt b/Documentation/devicetree/bindings/mfd/stmpe.txt
index c98450887d5e..56edb5520685 100644
--- a/Documentation/devicetree/bindings/mfd/stmpe.txt
+++ b/Documentation/devicetree/bindings/mfd/stmpe.txt
@@ -1,8 +1,11 @@
1* STMPE Multi-Functional Device 1* ST Microelectronics STMPE Multi-Functional Device
2
3STMPE is an MFD device which may expose the following inbuilt devices: gpio,
4keypad, touchscreen, adc, pwm, rotator.
2 5
3Required properties: 6Required properties:
4 - compatible : "st,stmpe[811|1601|2401|2403]" 7 - compatible : "st,stmpe[610|801|811|1601|2401|2403]"
5 - reg : I2C address of the device 8 - reg : I2C/SPI address of the device
6 9
7Optional properties: 10Optional properties:
8 - interrupts : The interrupt outputs from the controller 11 - interrupts : The interrupt outputs from the controller
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index 90c6151bc52e..b18cc1a1b162 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -7,6 +7,7 @@
7 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 7 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
8 */ 8 */
9 9
10#include <linux/err.h>
10#include <linux/gpio.h> 11#include <linux/gpio.h>
11#include <linux/export.h> 12#include <linux/export.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -14,6 +15,7 @@
14#include <linux/irq.h> 15#include <linux/irq.h>
15#include <linux/irqdomain.h> 16#include <linux/irqdomain.h>
16#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_gpio.h>
17#include <linux/pm.h> 19#include <linux/pm.h>
18#include <linux/slab.h> 20#include <linux/slab.h>
19#include <linux/mfd/core.h> 21#include <linux/mfd/core.h>
@@ -1012,6 +1014,9 @@ void __devinit stmpe_of_probe(struct stmpe_platform_data *pdata,
1012{ 1014{
1013 struct device_node *child; 1015 struct device_node *child;
1014 1016
1017 pdata->id = -1;
1018 pdata->irq_trigger = IRQF_TRIGGER_NONE;
1019
1015 of_property_read_u32(np, "st,autosleep-timeout", 1020 of_property_read_u32(np, "st,autosleep-timeout",
1016 &pdata->autosleep_timeout); 1021 &pdata->autosleep_timeout);
1017 1022
@@ -1020,15 +1025,16 @@ void __devinit stmpe_of_probe(struct stmpe_platform_data *pdata,
1020 for_each_child_of_node(np, child) { 1025 for_each_child_of_node(np, child) {
1021 if (!strcmp(child->name, "stmpe_gpio")) { 1026 if (!strcmp(child->name, "stmpe_gpio")) {
1022 pdata->blocks |= STMPE_BLOCK_GPIO; 1027 pdata->blocks |= STMPE_BLOCK_GPIO;
1023 } 1028 } else if (!strcmp(child->name, "stmpe_keypad")) {
1024 if (!strcmp(child->name, "stmpe_keypad")) {
1025 pdata->blocks |= STMPE_BLOCK_KEYPAD; 1029 pdata->blocks |= STMPE_BLOCK_KEYPAD;
1026 } 1030 } else if (!strcmp(child->name, "stmpe_touchscreen")) {
1027 if (!strcmp(child->name, "stmpe_touchscreen")) {
1028 pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; 1031 pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN;
1029 } 1032 } else if (!strcmp(child->name, "stmpe_adc")) {
1030 if (!strcmp(child->name, "stmpe_adc")) {
1031 pdata->blocks |= STMPE_BLOCK_ADC; 1033 pdata->blocks |= STMPE_BLOCK_ADC;
1034 } else if (!strcmp(child->name, "stmpe_pwm")) {
1035 pdata->blocks |= STMPE_BLOCK_PWM;
1036 } else if (!strcmp(child->name, "stmpe_rotator")) {
1037 pdata->blocks |= STMPE_BLOCK_ROTATOR;
1032 } 1038 }
1033 } 1039 }
1034} 1040}
@@ -1099,6 +1105,9 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
1099 return -ENODEV; 1105 return -ENODEV;
1100 } 1106 }
1101 stmpe->variant = stmpe_noirq_variant_info[stmpe->partnum]; 1107 stmpe->variant = stmpe_noirq_variant_info[stmpe->partnum];
1108 } else if (pdata->irq_trigger == IRQF_TRIGGER_NONE) {
1109 pdata->irq_trigger =
1110 irqd_get_trigger_type(irq_get_irq_data(stmpe->irq));
1102 } 1111 }
1103 1112
1104 ret = stmpe_chip_init(stmpe); 1113 ret = stmpe_chip_init(stmpe);