Commit f8bd493456c3da372ae81ed8f6b903f6207b9d98
Committed by
Florian Tobias Schandinat
1 parent
1c16697bf9
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 9 changed files with 20 additions and 48 deletions Side-by-side Diff
- drivers/video/bf537-lq035.c
- drivers/video/bf54x-lq043fb.c
- drivers/video/bfin-lq035q1-fb.c
- drivers/video/bfin_adv7393fb.c
- drivers/video/msm/mddi_client_nt35399.c
- drivers/video/msm/mddi_client_toshiba.c
- drivers/video/omap/lcd_inn1610.c
- drivers/video/omap2/displays/panel-taal.c
- drivers/video/omap2/displays/panel-tpo-td043mtea1.c
drivers/video/bf537-lq035.c
... | ... | @@ -383,23 +383,19 @@ |
383 | 383 | } |
384 | 384 | |
385 | 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 | 387 | pr_err("requesting GPIO %d failed\n", UD); |
388 | 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 | 392 | pr_err("requesting GPIO %d failed\n", LBR); |
393 | 393 | gpio_free(UD); |
394 | 394 | return -EBUSY; |
395 | 395 | } |
396 | - | |
397 | - gpio_direction_output(UD, 0); | |
398 | - gpio_direction_output(LBR, 1); | |
399 | - | |
400 | 396 | #endif |
401 | 397 | |
402 | - if (gpio_request(MOD, KBUILD_MODNAME)) { | |
398 | + if (gpio_request_one(MOD, GPIOF_OUT_INIT_HIGH, KBUILD_MODNAME)) { | |
403 | 399 | pr_err("requesting GPIO %d failed\n", MOD); |
404 | 400 | #if (defined(UD) && defined(LBR)) |
405 | 401 | gpio_free(LBR); |
... | ... | @@ -407,8 +403,6 @@ |
407 | 403 | #endif |
408 | 404 | return -EBUSY; |
409 | 405 | } |
410 | - | |
411 | - gpio_direction_output(MOD, 1); | |
412 | 406 | |
413 | 407 | SSYNC(); |
414 | 408 | return 0; |
drivers/video/bf54x-lq043fb.c
... | ... | @@ -240,7 +240,7 @@ |
240 | 240 | u16 eppi_req_18[] = EPPI0_18; |
241 | 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 | 244 | printk(KERN_ERR "Requesting GPIO %d failed\n", disp); |
245 | 245 | return -EFAULT; |
246 | 246 | } |
... | ... | @@ -262,8 +262,6 @@ |
262 | 262 | return -EFAULT; |
263 | 263 | } |
264 | 264 | } |
265 | - | |
266 | - gpio_direction_output(disp, 1); | |
267 | 265 | |
268 | 266 | return 0; |
269 | 267 | } |
drivers/video/bfin-lq035q1-fb.c
... | ... | @@ -365,10 +365,10 @@ |
365 | 365 | * Drive PPI_FS3 Low |
366 | 366 | */ |
367 | 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 | 370 | if (ret) |
370 | 371 | return ret; |
371 | - gpio_direction_output(P_IDENT(P_PPI0_FS3), 0); | |
372 | 372 | } |
373 | 373 | |
374 | 374 | if (ppi16) |
375 | 375 | |
... | ... | @@ -716,14 +716,14 @@ |
716 | 716 | } |
717 | 717 | |
718 | 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 | 722 | if (ret) { |
722 | 723 | dev_err(&pdev->dev, "failed to request GPIO %d\n", |
723 | 724 | info->disp_info->gpio_bl); |
724 | 725 | goto out9; |
725 | 726 | } |
726 | - gpio_direction_output(info->disp_info->gpio_bl, 0); | |
727 | 727 | } |
728 | 728 | |
729 | 729 | ret = register_framebuffer(fbinfo); |
drivers/video/bfin_adv7393fb.c
... | ... | @@ -411,12 +411,13 @@ |
411 | 411 | |
412 | 412 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ |
413 | 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 | 417 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); |
416 | 418 | ret = -EBUSY; |
417 | 419 | goto out_8; |
418 | 420 | } |
419 | - gpio_direction_output(P_IDENT(P_PPI0_FS3), 0); | |
420 | 421 | } |
421 | 422 | |
422 | 423 | if (peripheral_request_list(ppi_pins, DRIVER_NAME)) { |
drivers/video/msm/mddi_client_nt35399.c
... | ... | @@ -155,14 +155,10 @@ |
155 | 155 | ret = 0; |
156 | 156 | goto uninit; |
157 | 157 | } |
158 | - ret = gpio_request(gpio, "vsync"); | |
158 | + ret = gpio_request_one(gpio, GPIOF_IN, "vsync"); | |
159 | 159 | if (ret) |
160 | 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 | 162 | ret = irq = gpio_to_irq(gpio); |
167 | 163 | if (ret < 0) |
168 | 164 | goto err_get_irq_num_failed; |
... | ... | @@ -180,7 +176,6 @@ |
180 | 176 | free_irq(gpio_to_irq(gpio), panel->client_data); |
181 | 177 | err_request_irq_failed: |
182 | 178 | err_get_irq_num_failed: |
183 | -err_gpio_direction_input_failed: | |
184 | 179 | gpio_free(gpio); |
185 | 180 | err_request_gpio_failed: |
186 | 181 | return ret; |
drivers/video/msm/mddi_client_toshiba.c
... | ... | @@ -186,14 +186,10 @@ |
186 | 186 | ret = 0; |
187 | 187 | goto uninit; |
188 | 188 | } |
189 | - ret = gpio_request(gpio, "vsync"); | |
189 | + ret = gpio_request_one(gpio, GPIOF_IN, "vsync"); | |
190 | 190 | if (ret) |
191 | 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 | 193 | ret = irq = gpio_to_irq(gpio); |
198 | 194 | if (ret < 0) |
199 | 195 | goto err_get_irq_num_failed; |
... | ... | @@ -210,7 +206,6 @@ |
210 | 206 | free_irq(gpio_to_irq(gpio), panel); |
211 | 207 | err_request_irq_failed: |
212 | 208 | err_get_irq_num_failed: |
213 | -err_gpio_direction_input_failed: | |
214 | 209 | gpio_free(gpio); |
215 | 210 | err_request_gpio_failed: |
216 | 211 | return ret; |
drivers/video/omap/lcd_inn1610.c
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | #include <linux/module.h> |
23 | 23 | #include <linux/platform_device.h> |
24 | 24 | |
25 | -#include <asm/gpio.h> | |
25 | +#include <linux/gpio.h> | |
26 | 26 | #include "omapfb.h" |
27 | 27 | |
28 | 28 | #define MODULE_NAME "omapfb-lcd_h3" |
29 | 29 | |
30 | 30 | |
... | ... | @@ -32,20 +32,18 @@ |
32 | 32 | { |
33 | 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 | 37 | pr_err(MODULE_NAME ": can't request GPIO 14\n"); |
37 | 38 | r = -1; |
38 | 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 | 42 | pr_err(MODULE_NAME ": can't request GPIO 15\n"); |
42 | 43 | gpio_free(14); |
43 | 44 | r = -1; |
44 | 45 | goto exit; |
45 | 46 | } |
46 | - /* configure GPIO(14, 15) as outputs */ | |
47 | - gpio_direction_output(14, 0); | |
48 | - gpio_direction_output(15, 0); | |
49 | 47 | exit: |
50 | 48 | return r; |
51 | 49 | } |
drivers/video/omap2/displays/panel-taal.c
... | ... | @@ -1019,13 +1019,11 @@ |
1019 | 1019 | if (panel_data->use_ext_te) { |
1020 | 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 | 1023 | if (r) { |
1024 | 1024 | dev_err(&dssdev->dev, "GPIO request failed\n"); |
1025 | 1025 | goto err_gpio; |
1026 | 1026 | } |
1027 | - | |
1028 | - gpio_direction_input(gpio); | |
1029 | 1027 | |
1030 | 1028 | r = request_irq(gpio_to_irq(gpio), taal_te_isr, |
1031 | 1029 | IRQF_TRIGGER_RISING, |
drivers/video/omap2/displays/panel-tpo-td043mtea1.c
... | ... | @@ -408,17 +408,12 @@ |
408 | 408 | } |
409 | 409 | |
410 | 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 | 413 | if (ret < 0) { |
413 | 414 | dev_err(&dssdev->dev, "couldn't request reset GPIO\n"); |
414 | 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 | 419 | ret = sysfs_create_group(&dssdev->dev.kobj, &tpo_td043_attr_group); |
... | ... | @@ -427,8 +422,6 @@ |
427 | 422 | |
428 | 423 | return 0; |
429 | 424 | |
430 | -fail_gpio_direction: | |
431 | - gpio_free(nreset_gpio); | |
432 | 425 | fail_gpio_req: |
433 | 426 | regulator_put(tpo_td043->vcc_reg); |
434 | 427 | fail_regulator: |