Skip to content

Commit 3da3f87

Browse files
committed
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (46 commits) mfd: Fix mismatch in twl4030 mutex lock-unlock mfd: twl6030-pwm.c needs MODULE_LICENSE mfd: Fix the omap-usb-host clock API usage on usbhs_disable() mfd: Acknowledge WM8994 IRQs before reporting mfd: Acknowlege all WM831x IRQs before we handle them mfd: Avoid two assignments if failures happen in tps65910_i2c_probe regulator: Storing tps65912 error codes in u8 mfd: Don't leak init_data in tps65910_i2c_probe regulator: aat2870: Add AAT2870 regulator driver backlight: Add AAT2870 backlight driver mfd: Add AAT2870 mfd driver mfd: Remove dead code from max8997-irq mfd: Move TPS55910 Kconfig option mfd: Fix missing stmpe kerneldoc mfd: Fix off-by-one value range checking for tps65912_i2c_write mfd: Add devices for WM831x clocking module mfd: Remove comp{1,2}_threshold sysfs entries in tps65911_comparator_remove mfd: Don't ask about the TPS65912 core driver in Kconfig mfd: Fix off by one in WM831x IRQ code mfd: Add tps65921 support from twl-core ...
2 parents 968e75f + e178ccb commit 3da3f87

44 files changed

Lines changed: 4118 additions & 452 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/gpio/Kconfig‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ config GPIO_TC3589X
280280
This enables support for the GPIOs found on the TC3589X
281281
I/O Expander.
282282

283+
config GPIO_TPS65912
284+
tristate "TI TPS65912 GPIO"
285+
depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI)
286+
help
287+
This driver supports TPS65912 gpio chip
288+
283289
config GPIO_TWL4030
284290
tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
285291
depends on TWL4030_CORE

‎drivers/gpio/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o
4848
obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o
4949
obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o
5050
obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o
51+
obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o
5152
obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o
5253
obj-$(CONFIG_MACH_U300) += gpio-u300.o
5354
obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o

‎drivers/gpio/gpio-tps65912.c‎

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
* Copyright 2011 Texas Instruments Inc.
3+
*
4+
* Author: Margarita Olaya <magi@slimlogic.co.uk>
5+
*
6+
* This program is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License as published by the
8+
* Free Software Foundation; either version 2 of the License, or (at your
9+
* option) any later version.
10+
*
11+
* This driver is based on wm8350 implementation.
12+
*/
13+
14+
#include <linux/kernel.h>
15+
#include <linux/module.h>
16+
#include <linux/errno.h>
17+
#include <linux/gpio.h>
18+
#include <linux/mfd/core.h>
19+
#include <linux/platform_device.h>
20+
#include <linux/seq_file.h>
21+
#include <linux/slab.h>
22+
#include <linux/mfd/tps65912.h>
23+
24+
struct tps65912_gpio_data {
25+
struct tps65912 *tps65912;
26+
struct gpio_chip gpio_chip;
27+
};
28+
29+
static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
30+
{
31+
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
32+
int val;
33+
34+
val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset);
35+
36+
if (val & GPIO_STS_MASK)
37+
return 1;
38+
39+
return 0;
40+
}
41+
42+
static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
43+
int value)
44+
{
45+
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
46+
47+
if (value)
48+
tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
49+
GPIO_SET_MASK);
50+
else
51+
tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
52+
GPIO_SET_MASK);
53+
}
54+
55+
static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
56+
int value)
57+
{
58+
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
59+
60+
/* Set the initial value */
61+
tps65912_gpio_set(gc, offset, value);
62+
63+
return tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
64+
GPIO_CFG_MASK);
65+
}
66+
67+
static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset)
68+
{
69+
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
70+
71+
return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
72+
GPIO_CFG_MASK);
73+
74+
}
75+
76+
static struct gpio_chip template_chip = {
77+
.label = "tps65912",
78+
.owner = THIS_MODULE,
79+
.direction_input = tps65912_gpio_input,
80+
.direction_output = tps65912_gpio_output,
81+
.get = tps65912_gpio_get,
82+
.set = tps65912_gpio_set,
83+
.can_sleep = 1,
84+
.ngpio = 5,
85+
.base = -1,
86+
};
87+
88+
static int __devinit tps65912_gpio_probe(struct platform_device *pdev)
89+
{
90+
struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent);
91+
struct tps65912_board *pdata = tps65912->dev->platform_data;
92+
struct tps65912_gpio_data *tps65912_gpio;
93+
int ret;
94+
95+
tps65912_gpio = kzalloc(sizeof(*tps65912_gpio), GFP_KERNEL);
96+
if (tps65912_gpio == NULL)
97+
return -ENOMEM;
98+
99+
tps65912_gpio->tps65912 = tps65912;
100+
tps65912_gpio->gpio_chip = template_chip;
101+
tps65912_gpio->gpio_chip.dev = &pdev->dev;
102+
if (pdata && pdata->gpio_base)
103+
tps65912_gpio->gpio_chip.base = pdata->gpio_base;
104+
105+
ret = gpiochip_add(&tps65912_gpio->gpio_chip);
106+
if (ret < 0) {
107+
dev_err(&pdev->dev, "Failed to register gpiochip, %d\n", ret);
108+
goto err;
109+
}
110+
111+
platform_set_drvdata(pdev, tps65912_gpio);
112+
113+
return ret;
114+
115+
err:
116+
kfree(tps65912_gpio);
117+
return ret;
118+
}
119+
120+
static int __devexit tps65912_gpio_remove(struct platform_device *pdev)
121+
{
122+
struct tps65912_gpio_data *tps65912_gpio = platform_get_drvdata(pdev);
123+
int ret;
124+
125+
ret = gpiochip_remove(&tps65912_gpio->gpio_chip);
126+
if (ret == 0)
127+
kfree(tps65912_gpio);
128+
129+
return ret;
130+
}
131+
132+
static struct platform_driver tps65912_gpio_driver = {
133+
.driver = {
134+
.name = "tps65912-gpio",
135+
.owner = THIS_MODULE,
136+
},
137+
.probe = tps65912_gpio_probe,
138+
.remove = __devexit_p(tps65912_gpio_remove),
139+
};
140+
141+
static int __init tps65912_gpio_init(void)
142+
{
143+
return platform_driver_register(&tps65912_gpio_driver);
144+
}
145+
subsys_initcall(tps65912_gpio_init);
146+
147+
static void __exit tps65912_gpio_exit(void)
148+
{
149+
platform_driver_unregister(&tps65912_gpio_driver);
150+
}
151+
module_exit(tps65912_gpio_exit);
152+
153+
MODULE_AUTHOR("Margarita Olaya Cabrera <magi@slimlogic.co.uk>");
154+
MODULE_DESCRIPTION("GPIO interface for TPS65912 PMICs");
155+
MODULE_LICENSE("GPL v2");
156+
MODULE_ALIAS("platform:tps65912-gpio");

‎drivers/mfd/Kconfig‎

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,37 @@ config MFD_TPS6586X
171171
This driver can also be built as a module. If so, the module
172172
will be called tps6586x.
173173

174+
config MFD_TPS65910
175+
bool "TPS65910 Power Management chip"
176+
depends on I2C=y && GPIOLIB
177+
select MFD_CORE
178+
select GPIO_TPS65910
179+
help
180+
if you say yes here you get support for the TPS65910 series of
181+
Power Management chips.
182+
183+
config MFD_TPS65912
184+
bool
185+
depends on GPIOLIB
186+
187+
config MFD_TPS65912_I2C
188+
bool "TPS95612 Power Management chip with I2C"
189+
select MFD_CORE
190+
select MFD_TPS65912
191+
depends on I2C=y && GPIOLIB
192+
help
193+
If you say yes here you get support for the TPS65912 series of
194+
PM chips with I2C interface.
195+
196+
config MFD_TPS65912_SPI
197+
bool "TPS65912 Power Management chip with SPI"
198+
select MFD_CORE
199+
select MFD_TPS65912
200+
depends on SPI_MASTER && GPIOLIB
201+
help
202+
If you say yes here you get support for the TPS65912 series of
203+
PM chips with SPI interface.
204+
174205
config MENELAUS
175206
bool "Texas Instruments TWL92330/Menelaus PM chip"
176207
depends on I2C=y && ARCH_OMAP2
@@ -662,8 +693,9 @@ config MFD_JANZ_CMODIO
662693
CAN and GPIO controllers.
663694

664695
config MFD_JZ4740_ADC
665-
tristate "Support for the JZ4740 SoC ADC core"
696+
bool "Support for the JZ4740 SoC ADC core"
666697
select MFD_CORE
698+
select GENERIC_IRQ_CHIP
667699
depends on MACH_JZ4740
668700
help
669701
Say yes here if you want support for the ADC unit in the JZ4740 SoC.
@@ -725,18 +757,19 @@ config MFD_PM8XXX_IRQ
725757
This is required to use certain other PM 8xxx features, such as GPIO
726758
and MPP.
727759

728-
config MFD_TPS65910
729-
bool "TPS65910 Power Management chip"
730-
depends on I2C=y && GPIOLIB
731-
select MFD_CORE
732-
select GPIO_TPS65910
733-
help
734-
if you say yes here you get support for the TPS65910 series of
735-
Power Management chips.
736-
737760
config TPS65911_COMPARATOR
738761
tristate
739762

763+
config MFD_AAT2870_CORE
764+
bool "Support for the AnalogicTech AAT2870"
765+
select MFD_CORE
766+
depends on I2C=y && GPIOLIB
767+
help
768+
If you say yes here you get support for the AAT2870.
769+
This driver provides common support for accessing the device,
770+
additional drivers must be enabled in order to use the
771+
functionality of the device.
772+
740773
endif # MFD_SUPPORT
741774

742775
menu "Multimedia Capabilities Port drivers"

‎drivers/mfd/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o tmio_core.o
2323

2424
obj-$(CONFIG_MFD_WM8400) += wm8400-core.o
2525
wm831x-objs := wm831x-core.o wm831x-irq.o wm831x-otp.o
26+
wm831x-objs += wm831x-auxadc.o
2627
obj-$(CONFIG_MFD_WM831X) += wm831x.o
2728
obj-$(CONFIG_MFD_WM831X_I2C) += wm831x-i2c.o
2829
obj-$(CONFIG_MFD_WM831X_SPI) += wm831x-spi.o
@@ -35,6 +36,11 @@ obj-$(CONFIG_MFD_WM8994) += wm8994-core.o wm8994-irq.o
3536
obj-$(CONFIG_TPS6105X) += tps6105x.o
3637
obj-$(CONFIG_TPS65010) += tps65010.o
3738
obj-$(CONFIG_TPS6507X) += tps6507x.o
39+
obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65910-irq.o
40+
tps65912-objs := tps65912-core.o tps65912-irq.o
41+
obj-$(CONFIG_MFD_TPS65912) += tps65912.o
42+
obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o
43+
obj-$(CONFIG_MFD_TPS65912_SPI) += tps65912-spi.o
3844
obj-$(CONFIG_MENELAUS) += menelaus.o
3945

4046
obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
@@ -94,5 +100,5 @@ obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o
94100
obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o
95101
obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o
96102
obj-$(CONFIG_MFD_PM8XXX_IRQ) += pm8xxx-irq.o
97-
obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65910-irq.o
98103
obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
104+
obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o

0 commit comments

Comments
 (0)