Skip to content

Commit 055c9fa

Browse files
committedJul 10, 2012
Merge tag 'fixes-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: "Yes, this is a *LATE* GPIO pull request with fixes for v3.5. Grant moved across the planet and accidentally fell off the grid, so he asked me to take over the GPIO merges for a while 10 days ago. Since then I went over the archives and collected this pile of fixes, and pulled two of them from the TI maintainer Kevin Hilman. Then waited for them to at least hit linux-next once or twice." GPIO fixes for v3.5: - Invalid context restore on bank 0 for OMAP driver in runtime suspend/resume cycle - Check for NULL platform data in sta-2x11 driver - Constrain selection of the V1 MSM GPIO driver to applicable platforms (Kconfig issue) - Make sure the correct output value is set in the wm8994 driver - Export devm_gpio_request_one() so it can be used in modules. Apparently some in-kernel modules can be configured to use this leading to breakage. - Check that the GPIO is valid in the lantiq driver - Fix the flag bits introduced for v3.5, so they don't overlap - Fix a device tree intialization bug for imx21-compatible devices - Carry over the OF node to the TPS65910 GPIO chip struct * tag 'fixes-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: tps65910: initialize of_node of gpio_chip gpio/mxc: make irqs work for fsl,imx21-gpio devices gpio: fix bits conflict for gpio flags mips: pci-lantiq: Fix check for valid gpio gpio: export devm_gpio_request_one gpiolib: wm8994: Pay attention to the value set when enabling as output gpio/msm_v1: CONFIG_GPIO_MSM_V1 is only available on three SoCs gpio-sta2x11: don't use pdata if null gpio/omap: fix invalid context restore of gpio bank-0 gpio/omap: fix irq loss while in idle with debounce on
2 parents 310959e + 46bada6 commit 055c9fa

File tree

9 files changed

+33
-13
lines changed

9 files changed

+33
-13
lines changed
 

‎arch/mips/pci/pci-lantiq.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev)
129129

130130
/* setup reset gpio used by pci */
131131
reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);
132-
if (reset_gpio > 0)
132+
if (gpio_is_valid(reset_gpio))
133133
devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset");
134134

135135
/* enable auto-switching between PCI and EBU */
@@ -192,7 +192,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev)
192192
ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN);
193193

194194
/* toggle reset pin */
195-
if (reset_gpio > 0) {
195+
if (gpio_is_valid(reset_gpio)) {
196196
__gpio_set_value(reset_gpio, 0);
197197
wmb();
198198
mdelay(1);

‎drivers/gpio/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ config GPIO_MPC8XXX
136136

137137
config GPIO_MSM_V1
138138
tristate "Qualcomm MSM GPIO v1"
139-
depends on GPIOLIB && ARCH_MSM
139+
depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50)
140140
help
141141
Say yes here to support the GPIO interface on ARM v6 based
142142
Qualcomm MSM chips. Most of the pins on the MSM can be

‎drivers/gpio/devres.c

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio,
9898

9999
return 0;
100100
}
101+
EXPORT_SYMBOL(devm_gpio_request_one);
101102

102103
/**
103104
* devm_gpio_free - free an interrupt

‎drivers/gpio/gpio-mxc.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,12 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
398398
writel(~0, port->base + GPIO_ISR);
399399

400400
if (mxc_gpio_hwtype == IMX21_GPIO) {
401-
/* setup one handler for all GPIO interrupts */
402-
if (pdev->id == 0)
403-
irq_set_chained_handler(port->irq,
404-
mx2_gpio_irq_handler);
401+
/*
402+
* Setup one handler for all GPIO interrupts. Actually setting
403+
* the handler is needed only once, but doing it for every port
404+
* is more robust and easier.
405+
*/
406+
irq_set_chained_handler(port->irq, mx2_gpio_irq_handler);
405407
} else {
406408
/* setup one handler for each entry */
407409
irq_set_chained_handler(port->irq, mx3_gpio_irq_handler);

‎drivers/gpio/gpio-omap.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank)
174174
if (bank->dbck_enable_mask && !bank->dbck_enabled) {
175175
clk_enable(bank->dbck);
176176
bank->dbck_enabled = true;
177+
178+
__raw_writel(bank->dbck_enable_mask,
179+
bank->base + bank->regs->debounce_en);
177180
}
178181
}
179182

180183
static inline void _gpio_dbck_disable(struct gpio_bank *bank)
181184
{
182185
if (bank->dbck_enable_mask && bank->dbck_enabled) {
186+
/*
187+
* Disable debounce before cutting it's clock. If debounce is
188+
* enabled but the clock is not, GPIO module seems to be unable
189+
* to detect events and generate interrupts at least on OMAP3.
190+
*/
191+
__raw_writel(0, bank->base + bank->regs->debounce_en);
192+
183193
clk_disable(bank->dbck);
184194
bank->dbck_enabled = false;
185195
}
@@ -1081,7 +1091,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
10811091
bank->is_mpuio = pdata->is_mpuio;
10821092
bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
10831093
bank->loses_context = pdata->loses_context;
1084-
bank->get_context_loss_count = pdata->get_context_loss_count;
10851094
bank->regs = pdata->regs;
10861095
#ifdef CONFIG_OF_GPIO
10871096
bank->chip.of_node = of_node_get(node);
@@ -1135,6 +1144,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
11351144
omap_gpio_chip_init(bank);
11361145
omap_gpio_show_rev(bank);
11371146

1147+
if (bank->loses_context)
1148+
bank->get_context_loss_count = pdata->get_context_loss_count;
1149+
11381150
pm_runtime_put(bank->dev);
11391151

11401152
list_add_tail(&bank->node, &omap_gpio_list);

‎drivers/gpio/gpio-sta2x11.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev)
383383
}
384384
spin_lock_init(&chip->lock);
385385
gsta_gpio_setup(chip);
386-
for (i = 0; i < GSTA_NR_GPIO; i++)
387-
gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
386+
if (gpio_pdata)
387+
for (i = 0; i < GSTA_NR_GPIO; i++)
388+
gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
388389

389390
/* 384 was used in previous code: be compatible for other drivers */
390391
err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE);

‎drivers/gpio/gpio-tps65910.c

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev)
149149
tps65910_gpio->gpio_chip.set = tps65910_gpio_set;
150150
tps65910_gpio->gpio_chip.get = tps65910_gpio_get;
151151
tps65910_gpio->gpio_chip.dev = &pdev->dev;
152+
tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node;
152153
if (pdata && pdata->gpio_base)
153154
tps65910_gpio->gpio_chip.base = pdata->gpio_base;
154155
else

‎drivers/gpio/gpio-wm8994.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ static int wm8994_gpio_direction_out(struct gpio_chip *chip,
8989
struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
9090
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
9191

92+
if (value)
93+
value = WM8994_GPN_LVL;
94+
9295
return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset,
93-
WM8994_GPN_DIR, 0);
96+
WM8994_GPN_DIR | WM8994_GPN_LVL, value);
9497
}
9598

9699
static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value)

‎include/linux/gpio.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
/* Gpio pin is open source */
2323
#define GPIOF_OPEN_SOURCE (1 << 3)
2424

25-
#define GPIOF_EXPORT (1 << 2)
26-
#define GPIOF_EXPORT_CHANGEABLE (1 << 3)
25+
#define GPIOF_EXPORT (1 << 4)
26+
#define GPIOF_EXPORT_CHANGEABLE (1 << 5)
2727
#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
2828
#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
2929

0 commit comments

Comments
 (0)
Please sign in to comment.