|
6 | 6 | #include <linux/backlight.h>
|
7 | 7 | #include <linux/err.h>
|
8 | 8 | #include <linux/fb.h>
|
9 |
| -#include <linux/gpio.h> /* Only for legacy support */ |
10 | 9 | #include <linux/gpio/consumer.h>
|
11 | 10 | #include <linux/init.h>
|
12 | 11 | #include <linux/kernel.h>
|
@@ -61,28 +60,6 @@ static const struct backlight_ops gpio_backlight_ops = {
|
61 | 60 | .check_fb = gpio_backlight_check_fb,
|
62 | 61 | };
|
63 | 62 |
|
64 |
| -static int gpio_backlight_probe_dt(struct platform_device *pdev, |
65 |
| - struct gpio_backlight *gbl) |
66 |
| -{ |
67 |
| - struct device *dev = &pdev->dev; |
68 |
| - int ret; |
69 |
| - |
70 |
| - gbl->def_value = device_property_read_bool(dev, "default-on"); |
71 |
| - |
72 |
| - gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); |
73 |
| - if (IS_ERR(gbl->gpiod)) { |
74 |
| - ret = PTR_ERR(gbl->gpiod); |
75 |
| - |
76 |
| - if (ret != -EPROBE_DEFER) { |
77 |
| - dev_err(dev, |
78 |
| - "Error: The gpios parameter is missing or invalid.\n"); |
79 |
| - } |
80 |
| - return ret; |
81 |
| - } |
82 |
| - |
83 |
| - return 0; |
84 |
| -} |
85 |
| - |
86 | 63 | static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl)
|
87 | 64 | {
|
88 | 65 | struct device_node *node = gbl->dev->of_node;
|
@@ -114,35 +91,18 @@ static int gpio_backlight_probe(struct platform_device *pdev)
|
114 | 91 |
|
115 | 92 | gbl->dev = &pdev->dev;
|
116 | 93 |
|
117 |
| - if (pdev->dev.fwnode) { |
118 |
| - ret = gpio_backlight_probe_dt(pdev, gbl); |
119 |
| - if (ret) |
120 |
| - return ret; |
121 |
| - } else if (pdata) { |
122 |
| - /* |
123 |
| - * Legacy platform data GPIO retrieveal. Do not expand |
124 |
| - * the use of this code path, currently only used by one |
125 |
| - * SH board. |
126 |
| - */ |
127 |
| - unsigned long flags = GPIOF_DIR_OUT; |
128 |
| - |
| 94 | + if (pdata) |
129 | 95 | gbl->fbdev = pdata->fbdev;
|
130 |
| - gbl->def_value = pdata->def_value; |
131 |
| - flags |= gbl->def_value ? GPIOF_INIT_HIGH : GPIOF_INIT_LOW; |
132 |
| - |
133 |
| - ret = devm_gpio_request_one(gbl->dev, pdata->gpio, flags, |
134 |
| - pdata ? pdata->name : "backlight"); |
135 |
| - if (ret < 0) { |
136 |
| - dev_err(&pdev->dev, "unable to request GPIO\n"); |
137 |
| - return ret; |
138 |
| - } |
139 |
| - gbl->gpiod = gpio_to_desc(pdata->gpio); |
140 |
| - if (!gbl->gpiod) |
141 |
| - return -EINVAL; |
142 |
| - } else { |
143 |
| - dev_err(&pdev->dev, |
144 |
| - "failed to find platform data or device tree node.\n"); |
145 |
| - return -ENODEV; |
| 96 | + |
| 97 | + gbl->def_value = device_property_read_bool(&pdev->dev, "default-on"); |
| 98 | + |
| 99 | + gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS); |
| 100 | + if (IS_ERR(gbl->gpiod)) { |
| 101 | + ret = PTR_ERR(gbl->gpiod); |
| 102 | + if (ret != -EPROBE_DEFER) |
| 103 | + dev_err(&pdev->dev, |
| 104 | + "Error: The gpios parameter is missing or invalid.\n"); |
| 105 | + return ret; |
146 | 106 | }
|
147 | 107 |
|
148 | 108 | memset(&props, 0, sizeof(props));
|
|
0 commit comments