aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-01-26 05:32:34 -0500
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-01-28 15:50:11 -0500
commitf8bd493456c3da372ae81ed8f6b903f6207b9d98 (patch)
tree2f81cc7fa93df9025eb281ee9c2843d09b5201e6
parent1c16697bf9d5b206cb0d2b905a54de5e077296be (diff)
video: use gpio_request_one
Using gpio_request_one can make the code simpler because it can set the direction and initial value in one shot. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Michael Hennerich <michael.hennerich@analog.com> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--drivers/video/bf537-lq035.c12
-rw-r--r--drivers/video/bf54x-lq043fb.c4
-rw-r--r--drivers/video/bfin-lq035q1-fb.c8
-rw-r--r--drivers/video/bfin_adv7393fb.c5
-rw-r--r--drivers/video/msm/mddi_client_nt35399.c7
-rw-r--r--drivers/video/msm/mddi_client_toshiba.c7
-rw-r--r--drivers/video/omap/lcd_inn1610.c10
-rw-r--r--drivers/video/omap2/displays/panel-taal.c4
-rw-r--r--drivers/video/omap2/displays/panel-tpo-td043mtea1.c11
9 files changed, 20 insertions, 48 deletions
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c
index bea53c1a4950..befbc80d11fc 100644
--- a/drivers/video/bf537-lq035.c
+++ b/drivers/video/bf537-lq035.c
@@ -383,23 +383,19 @@ static int __devinit request_ports(void)
383 } 383 }
384 384
385#if (defined(UD) && defined(LBR)) 385#if (defined(UD) && defined(LBR))
386 if (gpio_request(UD, KBUILD_MODNAME)) { 386 if (gpio_request_one(UD, GPIOF_OUT_INIT_LOW, KBUILD_MODNAME)) {
387 pr_err("requesting GPIO %d failed\n", UD); 387 pr_err("requesting GPIO %d failed\n", UD);
388 return -EBUSY; 388 return -EBUSY;
389 } 389 }
390 390
391 if (gpio_request(LBR, KBUILD_MODNAME)) { 391 if (gpio_request_one(LBR, GPIOF_OUT_INIT_HIGH, KBUILD_MODNAME)) {
392 pr_err("requesting GPIO %d failed\n", LBR); 392 pr_err("requesting GPIO %d failed\n", LBR);
393 gpio_free(UD); 393 gpio_free(UD);
394 return -EBUSY; 394 return -EBUSY;
395 } 395 }
396
397 gpio_direction_output(UD, 0);
398 gpio_direction_output(LBR, 1);
399
400#endif 396#endif
401 397
402 if (gpio_request(MOD, KBUILD_MODNAME)) { 398 if (gpio_request_one(MOD, GPIOF_OUT_INIT_HIGH, KBUILD_MODNAME)) {
403 pr_err("requesting GPIO %d failed\n", MOD); 399 pr_err("requesting GPIO %d failed\n", MOD);
404#if (defined(UD) && defined(LBR)) 400#if (defined(UD) && defined(LBR))
405 gpio_free(LBR); 401 gpio_free(LBR);
@@ -408,8 +404,6 @@ static int __devinit request_ports(void)
408 return -EBUSY; 404 return -EBUSY;
409 } 405 }
410 406
411 gpio_direction_output(MOD, 1);
412
413 SSYNC(); 407 SSYNC();
414 return 0; 408 return 0;
415} 409}
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index 46b03f53985f..dc2f0047769b 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -240,7 +240,7 @@ static int request_ports(struct bfin_bf54xfb_info *fbi)
240 u16 eppi_req_18[] = EPPI0_18; 240 u16 eppi_req_18[] = EPPI0_18;
241 u16 disp = fbi->mach_info->disp; 241 u16 disp = fbi->mach_info->disp;
242 242
243 if (gpio_request(disp, DRIVER_NAME)) { 243 if (gpio_request_one(disp, GPIOF_OUT_INIT_HIGH, DRIVER_NAME)) {
244 printk(KERN_ERR "Requesting GPIO %d failed\n", disp); 244 printk(KERN_ERR "Requesting GPIO %d failed\n", disp);
245 return -EFAULT; 245 return -EFAULT;
246 } 246 }
@@ -263,8 +263,6 @@ static int request_ports(struct bfin_bf54xfb_info *fbi)
263 } 263 }
264 } 264 }
265 265
266 gpio_direction_output(disp, 1);
267
268 return 0; 266 return 0;
269} 267}
270 268
diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
index c633068372c9..86922ac84412 100644
--- a/drivers/video/bfin-lq035q1-fb.c
+++ b/drivers/video/bfin-lq035q1-fb.c
@@ -365,10 +365,10 @@ static int __devinit bfin_lq035q1_request_ports(struct platform_device *pdev,
365 * Drive PPI_FS3 Low 365 * Drive PPI_FS3 Low
366 */ 366 */
367 if (ANOMALY_05000400) { 367 if (ANOMALY_05000400) {
368 int ret = gpio_request(P_IDENT(P_PPI0_FS3), "PPI_FS3"); 368 int ret = gpio_request_one(P_IDENT(P_PPI0_FS3),
369 GPIOF_OUT_INIT_LOW, "PPI_FS3");
369 if (ret) 370 if (ret)
370 return ret; 371 return ret;
371 gpio_direction_output(P_IDENT(P_PPI0_FS3), 0);
372 } 372 }
373 373
374 if (ppi16) 374 if (ppi16)
@@ -716,14 +716,14 @@ static int __devinit bfin_lq035q1_probe(struct platform_device *pdev)
716 } 716 }
717 717
718 if (info->disp_info->use_bl) { 718 if (info->disp_info->use_bl) {
719 ret = gpio_request(info->disp_info->gpio_bl, "LQ035 Backlight"); 719 ret = gpio_request_one(info->disp_info->gpio_bl,
720 GPIOF_OUT_INIT_LOW, "LQ035 Backlight");
720 721
721 if (ret) { 722 if (ret) {
722 dev_err(&pdev->dev, "failed to request GPIO %d\n", 723 dev_err(&pdev->dev, "failed to request GPIO %d\n",
723 info->disp_info->gpio_bl); 724 info->disp_info->gpio_bl);
724 goto out9; 725 goto out9;
725 } 726 }
726 gpio_direction_output(info->disp_info->gpio_bl, 0);
727 } 727 }
728 728
729 ret = register_framebuffer(fbinfo); 729 ret = register_framebuffer(fbinfo);
diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c
index 811dd7f6aa41..c99281429214 100644
--- a/drivers/video/bfin_adv7393fb.c
+++ b/drivers/video/bfin_adv7393fb.c
@@ -411,12 +411,13 @@ static int __devinit bfin_adv7393_fb_probe(struct i2c_client *client,
411 411
412 /* Workaround "PPI Does Not Start Properly In Specific Mode" */ 412 /* Workaround "PPI Does Not Start Properly In Specific Mode" */
413 if (ANOMALY_05000400) { 413 if (ANOMALY_05000400) {
414 if (gpio_request(P_IDENT(P_PPI0_FS3), "PPI0_FS3")) { 414 ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW,
415 "PPI0_FS3")
416 if (ret) {
415 dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); 417 dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n");
416 ret = -EBUSY; 418 ret = -EBUSY;
417 goto out_8; 419 goto out_8;
418 } 420 }
419 gpio_direction_output(P_IDENT(P_PPI0_FS3), 0);
420 } 421 }
421 422
422 if (peripheral_request_list(ppi_pins, DRIVER_NAME)) { 423 if (peripheral_request_list(ppi_pins, DRIVER_NAME)) {
diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c
index f239f4a25e01..7fcd67e132bf 100644
--- a/drivers/video/msm/mddi_client_nt35399.c
+++ b/drivers/video/msm/mddi_client_nt35399.c
@@ -155,14 +155,10 @@ static int setup_vsync(struct panel_info *panel, int init)
155 ret = 0; 155 ret = 0;
156 goto uninit; 156 goto uninit;
157 } 157 }
158 ret = gpio_request(gpio, "vsync"); 158 ret = gpio_request_one(gpio, GPIOF_IN, "vsync");
159 if (ret) 159 if (ret)
160 goto err_request_gpio_failed; 160 goto err_request_gpio_failed;
161 161
162 ret = gpio_direction_input(gpio);
163 if (ret)
164 goto err_gpio_direction_input_failed;
165
166 ret = irq = gpio_to_irq(gpio); 162 ret = irq = gpio_to_irq(gpio);
167 if (ret < 0) 163 if (ret < 0)
168 goto err_get_irq_num_failed; 164 goto err_get_irq_num_failed;
@@ -180,7 +176,6 @@ uninit:
180 free_irq(gpio_to_irq(gpio), panel->client_data); 176 free_irq(gpio_to_irq(gpio), panel->client_data);
181err_request_irq_failed: 177err_request_irq_failed:
182err_get_irq_num_failed: 178err_get_irq_num_failed:
183err_gpio_direction_input_failed:
184 gpio_free(gpio); 179 gpio_free(gpio);
185err_request_gpio_failed: 180err_request_gpio_failed:
186 return ret; 181 return ret;
diff --git a/drivers/video/msm/mddi_client_toshiba.c b/drivers/video/msm/mddi_client_toshiba.c
index f9bc932ac46b..053eb6877330 100644
--- a/drivers/video/msm/mddi_client_toshiba.c
+++ b/drivers/video/msm/mddi_client_toshiba.c
@@ -186,14 +186,10 @@ static int setup_vsync(struct panel_info *panel,
186 ret = 0; 186 ret = 0;
187 goto uninit; 187 goto uninit;
188 } 188 }
189 ret = gpio_request(gpio, "vsync"); 189 ret = gpio_request_one(gpio, GPIOF_IN, "vsync");
190 if (ret) 190 if (ret)
191 goto err_request_gpio_failed; 191 goto err_request_gpio_failed;
192 192
193 ret = gpio_direction_input(gpio);
194 if (ret)
195 goto err_gpio_direction_input_failed;
196
197 ret = irq = gpio_to_irq(gpio); 193 ret = irq = gpio_to_irq(gpio);
198 if (ret < 0) 194 if (ret < 0)
199 goto err_get_irq_num_failed; 195 goto err_get_irq_num_failed;
@@ -210,7 +206,6 @@ uninit:
210 free_irq(gpio_to_irq(gpio), panel); 206 free_irq(gpio_to_irq(gpio), panel);
211err_request_irq_failed: 207err_request_irq_failed:
212err_get_irq_num_failed: 208err_get_irq_num_failed:
213err_gpio_direction_input_failed:
214 gpio_free(gpio); 209 gpio_free(gpio);
215err_request_gpio_failed: 210err_request_gpio_failed:
216 return ret; 211 return ret;
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index 7e8bd8e08a98..e3d3d135aa48 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -22,7 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25#include <asm/gpio.h> 25#include <linux/gpio.h>
26#include "omapfb.h" 26#include "omapfb.h"
27 27
28#define MODULE_NAME "omapfb-lcd_h3" 28#define MODULE_NAME "omapfb-lcd_h3"
@@ -32,20 +32,18 @@ static int innovator1610_panel_init(struct lcd_panel *panel,
32{ 32{
33 int r = 0; 33 int r = 0;
34 34
35 if (gpio_request(14, "lcd_en0")) { 35 /* configure GPIO(14, 15) as outputs */
36 if (gpio_request_one(14, GPIOF_OUT_INIT_LOW, "lcd_en0")) {
36 pr_err(MODULE_NAME ": can't request GPIO 14\n"); 37 pr_err(MODULE_NAME ": can't request GPIO 14\n");
37 r = -1; 38 r = -1;
38 goto exit; 39 goto exit;
39 } 40 }
40 if (gpio_request(15, "lcd_en1")) { 41 if (gpio_request_one(15, GPIOF_OUT_INIT_LOW, "lcd_en1")) {
41 pr_err(MODULE_NAME ": can't request GPIO 15\n"); 42 pr_err(MODULE_NAME ": can't request GPIO 15\n");
42 gpio_free(14); 43 gpio_free(14);
43 r = -1; 44 r = -1;
44 goto exit; 45 goto exit;
45 } 46 }
46 /* configure GPIO(14, 15) as outputs */
47 gpio_direction_output(14, 0);
48 gpio_direction_output(15, 0);
49exit: 47exit:
50 return r; 48 return r;
51} 49}
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 00c5c615585f..0f21fa5a16ae 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -1019,14 +1019,12 @@ static int taal_probe(struct omap_dss_device *dssdev)
1019 if (panel_data->use_ext_te) { 1019 if (panel_data->use_ext_te) {
1020 int gpio = panel_data->ext_te_gpio; 1020 int gpio = panel_data->ext_te_gpio;
1021 1021
1022 r = gpio_request(gpio, "taal irq"); 1022 r = gpio_request_one(gpio, GPIOF_IN, "taal irq");
1023 if (r) { 1023 if (r) {
1024 dev_err(&dssdev->dev, "GPIO request failed\n"); 1024 dev_err(&dssdev->dev, "GPIO request failed\n");
1025 goto err_gpio; 1025 goto err_gpio;
1026 } 1026 }
1027 1027
1028 gpio_direction_input(gpio);
1029
1030 r = request_irq(gpio_to_irq(gpio), taal_te_isr, 1028 r = request_irq(gpio_to_irq(gpio), taal_te_isr,
1031 IRQF_TRIGGER_RISING, 1029 IRQF_TRIGGER_RISING,
1032 "taal vsync", dssdev); 1030 "taal vsync", dssdev);
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index e6649aa89591..880c313d6bcc 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -408,17 +408,12 @@ static int tpo_td043_probe(struct omap_dss_device *dssdev)
408 } 408 }
409 409
410 if (gpio_is_valid(nreset_gpio)) { 410 if (gpio_is_valid(nreset_gpio)) {
411 ret = gpio_request(nreset_gpio, "lcd reset"); 411 ret = gpio_request_one(nreset_gpio, GPIOF_OUT_INIT_LOW,
412 "lcd reset");
412 if (ret < 0) { 413 if (ret < 0) {
413 dev_err(&dssdev->dev, "couldn't request reset GPIO\n"); 414 dev_err(&dssdev->dev, "couldn't request reset GPIO\n");
414 goto fail_gpio_req; 415 goto fail_gpio_req;
415 } 416 }
416
417 ret = gpio_direction_output(nreset_gpio, 0);
418 if (ret < 0) {
419 dev_err(&dssdev->dev, "couldn't set GPIO direction\n");
420 goto fail_gpio_direction;
421 }
422 } 417 }
423 418
424 ret = sysfs_create_group(&dssdev->dev.kobj, &tpo_td043_attr_group); 419 ret = sysfs_create_group(&dssdev->dev.kobj, &tpo_td043_attr_group);
@@ -427,8 +422,6 @@ static int tpo_td043_probe(struct omap_dss_device *dssdev)
427 422
428 return 0; 423 return 0;
429 424
430fail_gpio_direction:
431 gpio_free(nreset_gpio);
432fail_gpio_req: 425fail_gpio_req:
433 regulator_put(tpo_td043->vcc_reg); 426 regulator_put(tpo_td043->vcc_reg);
434fail_regulator: 427fail_regulator: