hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/video/fbdev/omap/lcd_ams_delta.c
....@@ -1,34 +1,20 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Based on drivers/video/omap/lcd_inn1510.c
34 *
45 * LCD panel support for the Amstrad E3 (Delta) videophone.
56 *
67 * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the
10
- * Free Software Foundation; either version 2 of the License, or (at your
11
- * option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful, but
14
- * WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License along
19
- * with this program; if not, write to the Free Software Foundation, Inc.,
20
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
218 */
229
2310 #include <linux/module.h>
2411 #include <linux/platform_device.h>
2512 #include <linux/io.h>
2613 #include <linux/delay.h>
14
+#include <linux/gpio/consumer.h>
2715 #include <linux/lcd.h>
28
-#include <linux/gpio.h>
2916
3017 #include <mach/hardware.h>
31
-#include <mach/board-ams-delta.h>
3218
3319 #include "omapfb.h"
3420
....@@ -41,6 +27,8 @@
4127 /* LCD class device section */
4228
4329 static int ams_delta_lcd;
30
+static struct gpio_desc *gpiod_vblen;
31
+static struct gpio_desc *gpiod_ndisp;
4432
4533 static int ams_delta_lcd_set_power(struct lcd_device *dev, int power)
4634 {
....@@ -99,41 +87,17 @@
9987
10088 /* omapfb panel section */
10189
102
-static const struct gpio _gpios[] = {
103
- {
104
- .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN,
105
- .flags = GPIOF_OUT_INIT_LOW,
106
- .label = "lcd_vblen",
107
- },
108
- {
109
- .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP,
110
- .flags = GPIOF_OUT_INIT_LOW,
111
- .label = "lcd_ndisp",
112
- },
113
-};
114
-
115
-static int ams_delta_panel_init(struct lcd_panel *panel,
116
- struct omapfb_device *fbdev)
117
-{
118
- return gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
119
-}
120
-
121
-static void ams_delta_panel_cleanup(struct lcd_panel *panel)
122
-{
123
- gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
124
-}
125
-
12690 static int ams_delta_panel_enable(struct lcd_panel *panel)
12791 {
128
- gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 1);
129
- gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 1);
92
+ gpiod_set_value(gpiod_ndisp, 1);
93
+ gpiod_set_value(gpiod_vblen, 1);
13094 return 0;
13195 }
13296
13397 static void ams_delta_panel_disable(struct lcd_panel *panel)
13498 {
135
- gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 0);
136
- gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0);
99
+ gpiod_set_value(gpiod_vblen, 0);
100
+ gpiod_set_value(gpiod_ndisp, 0);
137101 }
138102
139103 static struct lcd_panel ams_delta_panel = {
....@@ -154,8 +118,6 @@
154118 .pcd = 0,
155119 .acb = 37,
156120
157
- .init = ams_delta_panel_init,
158
- .cleanup = ams_delta_panel_cleanup,
159121 .enable = ams_delta_panel_enable,
160122 .disable = ams_delta_panel_disable,
161123 };
....@@ -166,9 +128,23 @@
166128 static int ams_delta_panel_probe(struct platform_device *pdev)
167129 {
168130 struct lcd_device *lcd_device = NULL;
169
-#ifdef CONFIG_LCD_CLASS_DEVICE
170131 int ret;
171132
133
+ gpiod_vblen = devm_gpiod_get(&pdev->dev, "vblen", GPIOD_OUT_LOW);
134
+ if (IS_ERR(gpiod_vblen)) {
135
+ ret = PTR_ERR(gpiod_vblen);
136
+ dev_err(&pdev->dev, "VBLEN GPIO request failed (%d)\n", ret);
137
+ return ret;
138
+ }
139
+
140
+ gpiod_ndisp = devm_gpiod_get(&pdev->dev, "ndisp", GPIOD_OUT_LOW);
141
+ if (IS_ERR(gpiod_ndisp)) {
142
+ ret = PTR_ERR(gpiod_ndisp);
143
+ dev_err(&pdev->dev, "NDISP GPIO request failed (%d)\n", ret);
144
+ return ret;
145
+ }
146
+
147
+#ifdef CONFIG_LCD_CLASS_DEVICE
172148 lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL,
173149 &ams_delta_lcd_ops);
174150