aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2009-09-22 19:46:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:48 -0400
commit4cf8e53b3b55fa2f9b2a6b9c3e557b649adf7c6a (patch)
tree3a3ca1ba8ced694568f7c0ee31c19f7fcc6e38a9 /drivers/mfd
parent1e5db00687c1ebd93a902caf1d3694209013cb3e (diff)
mfd/gpio: add a GPIO interface to the UCB1400 MFD chip driver via gpiolib
Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: David Brownell <david-b@pacbell.net> Cc: Samuel Ortiz <sameo@openedhand.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ucb1400_core.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/mfd/ucb1400_core.c b/drivers/mfd/ucb1400_core.c
index 78c2135c5de6..2afc08006e6d 100644
--- a/drivers/mfd/ucb1400_core.c
+++ b/drivers/mfd/ucb1400_core.c
@@ -48,9 +48,11 @@ static int ucb1400_core_probe(struct device *dev)
48 int err; 48 int err;
49 struct ucb1400 *ucb; 49 struct ucb1400 *ucb;
50 struct ucb1400_ts ucb_ts; 50 struct ucb1400_ts ucb_ts;
51 struct ucb1400_gpio ucb_gpio;
51 struct snd_ac97 *ac97; 52 struct snd_ac97 *ac97;
52 53
53 memset(&ucb_ts, 0, sizeof(ucb_ts)); 54 memset(&ucb_ts, 0, sizeof(ucb_ts));
55 memset(&ucb_gpio, 0, sizeof(ucb_gpio));
54 56
55 ucb = kzalloc(sizeof(struct ucb1400), GFP_KERNEL); 57 ucb = kzalloc(sizeof(struct ucb1400), GFP_KERNEL);
56 if (!ucb) { 58 if (!ucb) {
@@ -68,25 +70,44 @@ static int ucb1400_core_probe(struct device *dev)
68 goto err0; 70 goto err0;
69 } 71 }
70 72
73 /* GPIO */
74 ucb_gpio.ac97 = ac97;
75 ucb->ucb1400_gpio = platform_device_alloc("ucb1400_gpio", -1);
76 if (!ucb->ucb1400_gpio) {
77 err = -ENOMEM;
78 goto err0;
79 }
80 err = platform_device_add_data(ucb->ucb1400_gpio, &ucb_gpio,
81 sizeof(ucb_gpio));
82 if (err)
83 goto err1;
84 err = platform_device_add(ucb->ucb1400_gpio);
85 if (err)
86 goto err1;
87
71 /* TOUCHSCREEN */ 88 /* TOUCHSCREEN */
72 ucb_ts.ac97 = ac97; 89 ucb_ts.ac97 = ac97;
73 ucb->ucb1400_ts = platform_device_alloc("ucb1400_ts", -1); 90 ucb->ucb1400_ts = platform_device_alloc("ucb1400_ts", -1);
74 if (!ucb->ucb1400_ts) { 91 if (!ucb->ucb1400_ts) {
75 err = -ENOMEM; 92 err = -ENOMEM;
76 goto err0; 93 goto err2;
77 } 94 }
78 err = platform_device_add_data(ucb->ucb1400_ts, &ucb_ts, 95 err = platform_device_add_data(ucb->ucb1400_ts, &ucb_ts,
79 sizeof(ucb_ts)); 96 sizeof(ucb_ts));
80 if (err) 97 if (err)
81 goto err1; 98 goto err3;
82 err = platform_device_add(ucb->ucb1400_ts); 99 err = platform_device_add(ucb->ucb1400_ts);
83 if (err) 100 if (err)
84 goto err1; 101 goto err3;
85 102
86 return 0; 103 return 0;
87 104
88err1: 105err3:
89 platform_device_put(ucb->ucb1400_ts); 106 platform_device_put(ucb->ucb1400_ts);
107err2:
108 platform_device_unregister(ucb->ucb1400_gpio);
109err1:
110 platform_device_put(ucb->ucb1400_gpio);
90err0: 111err0:
91 kfree(ucb); 112 kfree(ucb);
92err: 113err:
@@ -98,6 +119,8 @@ static int ucb1400_core_remove(struct device *dev)
98 struct ucb1400 *ucb = dev_get_drvdata(dev); 119 struct ucb1400 *ucb = dev_get_drvdata(dev);
99 120
100 platform_device_unregister(ucb->ucb1400_ts); 121 platform_device_unregister(ucb->ucb1400_ts);
122 platform_device_unregister(ucb->ucb1400_gpio);
123
101 kfree(ucb); 124 kfree(ucb);
102 return 0; 125 return 0;
103} 126}