/
0094-tilcdc-introduce-panel-tfp410-power-down-gpio-contro.patch
120 lines (107 loc) · 3.98 KB
/
0094-tilcdc-introduce-panel-tfp410-power-down-gpio-contro.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From 80681122d5265312a2205402af9b34574a763073 Mon Sep 17 00:00:00 2001
From: Pantelis Antoniou <panto@antoniou-consulting.com>
Date: Wed, 30 Jan 2013 18:15:57 +0200
Subject: [PATCH 094/184] tilcdc: introduce panel & tfp410 power down gpio
control
Introduce power down GPIO support for panels and tfp410.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/gpu/drm/tilcdc/tilcdc_panel.c | 26 +++++++++++++++++++++++++-
drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 23 +++++++++++++++++------
2 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index d1463f5..f4b794d 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -21,6 +21,7 @@
#include <video/display_timing.h>
#include <video/of_display_timing.h>
#include <video/videomode.h>
+#include <linux/of_gpio.h>
#include "tilcdc_drv.h"
@@ -29,6 +30,7 @@ struct panel_module {
struct tilcdc_panel_info *info;
struct display_timings *timings;
struct backlight_device *backlight;
+ int gpio;
};
#define to_panel_module(x) container_of(x, struct panel_module, base)
@@ -359,9 +361,10 @@ static int panel_probe(struct platform_device *pdev)
struct panel_module *panel_mod;
struct tilcdc_module *mod;
struct pinctrl *pinctrl;
+ enum of_gpio_flags ofgpioflags;
+ unsigned long gpioflags;
int ret = -EINVAL;
-
/* bail out early if no DT data: */
if (!node) {
dev_err(&pdev->dev, "device-tree data is missing\n");
@@ -397,6 +400,27 @@ static int panel_probe(struct platform_device *pdev)
if (panel_mod->backlight)
dev_info(&pdev->dev, "found backlight\n");
+ panel_mod->gpio = of_get_named_gpio_flags(pdev->dev.of_node, "ti,power-gpio",
+ 0, &ofgpioflags);
+ if (IS_ERR_VALUE(panel_mod->gpio)) {
+ dev_warn(&pdev->dev, "panel: No power control GPIO\n");
+ } else {
+ gpioflags = GPIOF_DIR_OUT;
+ if (ofgpioflags & OF_GPIO_ACTIVE_LOW) {
+ gpioflags |= GPIOF_INIT_LOW;
+ dev_info(&pdev->dev, "Power GPIO active low, initial state set to low\n");
+ } else {
+ gpioflags |= GPIOF_INIT_HIGH;
+ dev_info(&pdev->dev, "Power GPIO active high, initial state set to high\n");
+ }
+ ret = devm_gpio_request_one(&pdev->dev, panel_mod->gpio,
+ gpioflags, "panel:PDN");
+ if (ret != 0) {
+ dev_err(&pdev->dev, "Failed to request power gpio\n");
+ goto fail;
+ }
+ }
+
return 0;
fail:
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index 10444ee..c9cd8f1 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -329,6 +329,8 @@ static int tfp410_probe(struct platform_device *pdev)
struct tilcdc_module *mod;
struct pinctrl *pinctrl;
uint32_t i2c_phandle;
+ enum of_gpio_flags ofgpioflags;
+ unsigned long gpioflags;
int ret = -EINVAL;
/* bail out early if no DT data: */
@@ -368,14 +370,23 @@ static int tfp410_probe(struct platform_device *pdev)
of_node_put(i2c_node);
- tfp410_mod->gpio = of_get_named_gpio_flags(node, "powerdn-gpio",
- 0, NULL);
+ tfp410_mod->gpio = of_get_named_gpio_flags(pdev->dev.of_node, "ti,power-gpio",
+ 0, &ofgpioflags);
if (IS_ERR_VALUE(tfp410_mod->gpio)) {
- dev_warn(&pdev->dev, "No power down GPIO\n");
+ dev_warn(&pdev->dev, "tftp410: No power control GPIO\n");
} else {
- ret = gpio_request(tfp410_mod->gpio, "DVI_PDn");
- if (ret) {
- dev_err(&pdev->dev, "could not get DVI_PDn gpio\n");
+ gpioflags = GPIOF_DIR_OUT;
+ if (ofgpioflags & OF_GPIO_ACTIVE_LOW) {
+ gpioflags |= GPIOF_INIT_LOW;
+ dev_info(&pdev->dev, "Power GPIO active low, initial state set to low\n");
+ } else {
+ gpioflags |= GPIOF_INIT_HIGH;
+ dev_info(&pdev->dev, "Power GPIO active high, initial state set to high\n");
+ }
+ ret = devm_gpio_request_one(&pdev->dev, tfp410_mod->gpio,
+ gpioflags, "tfp410:PDN");
+ if (ret != 0) {
+ dev_err(&pdev->dev, "Failed to request power gpio\n");
goto fail;
}
}
--
1.8.2.1