| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * LCD / Backlight control code for Sharp SL-6000x (tosa) |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2005 Dirk Opfer |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 15 | 11 | #include <linux/device.h> |
|---|
| 16 | 12 | #include <linux/spi/spi.h> |
|---|
| 17 | 13 | #include <linux/i2c.h> |
|---|
| 18 | | -#include <linux/gpio.h> |
|---|
| 14 | +#include <linux/gpio/consumer.h> |
|---|
| 19 | 15 | #include <linux/fb.h> |
|---|
| 20 | 16 | #include <linux/backlight.h> |
|---|
| 21 | 17 | #include <linux/slab.h> |
|---|
| 22 | 18 | |
|---|
| 23 | 19 | #include <asm/mach/sharpsl_param.h> |
|---|
| 24 | 20 | |
|---|
| 25 | | -#include <mach/tosa.h> |
|---|
| 21 | +#include "tosa_bl.h" |
|---|
| 26 | 22 | |
|---|
| 27 | 23 | #define COMADJ_DEFAULT 97 |
|---|
| 28 | 24 | |
|---|
| .. | .. |
|---|
| 32 | 28 | struct tosa_bl_data { |
|---|
| 33 | 29 | struct i2c_client *i2c; |
|---|
| 34 | 30 | struct backlight_device *bl; |
|---|
| 31 | + struct gpio_desc *gpio; |
|---|
| 35 | 32 | |
|---|
| 36 | 33 | int comadj; |
|---|
| 37 | 34 | }; |
|---|
| .. | .. |
|---|
| 46 | 43 | i2c_smbus_write_byte_data(data->i2c, DAC_CH2, (u8)(brightness & 0xff)); |
|---|
| 47 | 44 | |
|---|
| 48 | 45 | /* SetBacklightVR */ |
|---|
| 49 | | - gpio_set_value(TOSA_GPIO_BL_C20MA, brightness & 0x100); |
|---|
| 46 | + gpiod_set_value(data->gpio, brightness & 0x100); |
|---|
| 50 | 47 | |
|---|
| 51 | 48 | tosa_bl_enable(spi, brightness); |
|---|
| 52 | 49 | } |
|---|
| .. | .. |
|---|
| 91 | 88 | return -ENOMEM; |
|---|
| 92 | 89 | |
|---|
| 93 | 90 | 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); |
|---|
| 97 | 93 | if (ret) { |
|---|
| 98 | 94 | dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); |
|---|
| 99 | 95 | return ret; |
|---|