forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/video/backlight/tosa_bl.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * LCD / Backlight control code for Sharp SL-6000x (tosa)
34 *
45 * Copyright (c) 2005 Dirk Opfer
56 * Copyright (c) 2007,2008 Dmitry Baryshkov
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
10
- *
117 */
128
139 #include <linux/kernel.h>
....@@ -15,14 +11,14 @@
1511 #include <linux/device.h>
1612 #include <linux/spi/spi.h>
1713 #include <linux/i2c.h>
18
-#include <linux/gpio.h>
14
+#include <linux/gpio/consumer.h>
1915 #include <linux/fb.h>
2016 #include <linux/backlight.h>
2117 #include <linux/slab.h>
2218
2319 #include <asm/mach/sharpsl_param.h>
2420
25
-#include <mach/tosa.h>
21
+#include "tosa_bl.h"
2622
2723 #define COMADJ_DEFAULT 97
2824
....@@ -32,6 +28,7 @@
3228 struct tosa_bl_data {
3329 struct i2c_client *i2c;
3430 struct backlight_device *bl;
31
+ struct gpio_desc *gpio;
3532
3633 int comadj;
3734 };
....@@ -46,7 +43,7 @@
4643 i2c_smbus_write_byte_data(data->i2c, DAC_CH2, (u8)(brightness & 0xff));
4744
4845 /* SetBacklightVR */
49
- gpio_set_value(TOSA_GPIO_BL_C20MA, brightness & 0x100);
46
+ gpiod_set_value(data->gpio, brightness & 0x100);
5047
5148 tosa_bl_enable(spi, brightness);
5249 }
....@@ -91,9 +88,8 @@
9188 return -ENOMEM;
9289
9390 data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj;
94
-
95
- ret = devm_gpio_request_one(&client->dev, TOSA_GPIO_BL_C20MA,
96
- GPIOF_OUT_INIT_LOW, "backlight");
91
+ data->gpio = devm_gpiod_get(&client->dev, "backlight", GPIOD_OUT_LOW);
92
+ ret = PTR_ERR_OR_ZERO(data->gpio);
9793 if (ret) {
9894 dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
9995 return ret;