summaryrefslogtreecommitdiff
path: root/drivers/video/backlight
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/atmel-pwm-bl.c19
-rw-r--r--drivers/video/backlight/corgi_lcd.c19
-rw-r--r--drivers/video/backlight/l4f00242t03.c29
-rw-r--r--drivers/video/backlight/lm3533_bl.c8
-rw-r--r--drivers/video/backlight/lms283gf05.c24
-rw-r--r--drivers/video/backlight/lp855x_bl.c10
-rw-r--r--drivers/video/backlight/ot200_bl.c21
-rw-r--r--drivers/video/backlight/tosa_bl.c8
-rw-r--r--drivers/video/backlight/tosa_lcd.c7
9 files changed, 48 insertions, 97 deletions
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
index 0443a4f71858..df1cbb7ef6ca 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -127,7 +127,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
struct atmel_pwm_bl *pwmbl;
int retval;
- pwmbl = kzalloc(sizeof(struct atmel_pwm_bl), GFP_KERNEL);
+ pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl),
+ GFP_KERNEL);
if (!pwmbl)
return -ENOMEM;
@@ -154,7 +155,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
goto err_free_mem;
if (pwmbl->gpio_on != -1) {
- retval = gpio_request(pwmbl->gpio_on, "gpio_atmel_pwm_bl");
+ retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on,
+ "gpio_atmel_pwm_bl");
if (retval) {
pwmbl->gpio_on = -1;
goto err_free_pwm;
@@ -164,7 +166,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
retval = gpio_direction_output(pwmbl->gpio_on,
0 ^ pdata->on_active_low);
if (retval)
- goto err_free_gpio;
+ goto err_free_pwm;
}
memset(&props, 0, sizeof(struct backlight_properties));
@@ -174,7 +176,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
&atmel_pwm_bl_ops, &props);
if (IS_ERR(bldev)) {
retval = PTR_ERR(bldev);
- goto err_free_gpio;
+ goto err_free_pwm;
}
pwmbl->bldev = bldev;
@@ -196,13 +198,9 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
err_free_bl_dev:
platform_set_drvdata(pdev, NULL);
backlight_device_unregister(bldev);
-err_free_gpio:
- if (pwmbl->gpio_on != -1)
- gpio_free(pwmbl->gpio_on);
err_free_pwm:
pwm_channel_free(&pwmbl->pwmc);
err_free_mem:
- kfree(pwmbl);
return retval;
}
@@ -210,15 +208,12 @@ static int __exit atmel_pwm_bl_remove(struct platform_device *pdev)
{
struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
- if (pwmbl->gpio_on != -1) {
+ if (pwmbl->gpio_on != -1)
gpio_set_value(pwmbl->gpio_on, 0);
- gpio_free(pwmbl->gpio_on);
- }
pwm_channel_disable(&pwmbl->pwmc);
pwm_channel_free(&pwmbl->pwmc);
backlight_device_unregister(pwmbl->bldev);
platform_set_drvdata(pdev, NULL);
- kfree(pwmbl);
return 0;
}
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 23d732677ba1..c781768ba892 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -492,7 +492,8 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
lcd->gpio_backlight_cont = -1;
if (gpio_is_valid(pdata->gpio_backlight_on)) {
- err = gpio_request(pdata->gpio_backlight_on, "BL_ON");
+ err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on,
+ "BL_ON");
if (err) {
dev_err(&spi->dev, "failed to request GPIO%d for "
"backlight_on\n", pdata->gpio_backlight_on);
@@ -504,11 +505,12 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
}
if (gpio_is_valid(pdata->gpio_backlight_cont)) {
- err = gpio_request(pdata->gpio_backlight_cont, "BL_CONT");
+ err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont,
+ "BL_CONT");
if (err) {
dev_err(&spi->dev, "failed to request GPIO%d for "
"backlight_cont\n", pdata->gpio_backlight_cont);
- goto err_free_backlight_on;
+ return err;
}
lcd->gpio_backlight_cont = pdata->gpio_backlight_cont;
@@ -525,11 +527,6 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
}
}
return 0;
-
-err_free_backlight_on:
- if (gpio_is_valid(lcd->gpio_backlight_on))
- gpio_free(lcd->gpio_backlight_on);
- return err;
}
static int __devinit corgi_lcd_probe(struct spi_device *spi)
@@ -602,12 +599,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi)
backlight_update_status(lcd->bl_dev);
backlight_device_unregister(lcd->bl_dev);
- if (gpio_is_valid(lcd->gpio_backlight_on))
- gpio_free(lcd->gpio_backlight_on);
-
- if (gpio_is_valid(lcd->gpio_backlight_cont))
- gpio_free(lcd->gpio_backlight_cont);
-
corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);
lcd_device_unregister(lcd->lcd_dev);
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index 40f606a86093..2d90c0648aa0 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -175,28 +175,27 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
priv->spi = spi;
- ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH,
- "lcd l4f00242t03 reset");
+ ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
+ GPIOF_OUT_INIT_HIGH, "lcd l4f00242t03 reset");
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 reset gpio.\n");
return ret;
}
- ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW,
- "lcd l4f00242t03 data enable");
+ ret = devm_gpio_request_one(&spi->dev, pdata->data_enable_gpio,
+ GPIOF_OUT_INIT_LOW, "lcd l4f00242t03 data enable");
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 data en gpio.\n");
- goto err;
+ return ret;
}
priv->io_reg = regulator_get(&spi->dev, "vdd");
if (IS_ERR(priv->io_reg)) {
- ret = PTR_ERR(priv->io_reg);
dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
__func__);
- goto err2;
+ return PTR_ERR(priv->io_reg);
}
priv->core_reg = regulator_get(&spi->dev, "vcore");
@@ -204,14 +203,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
ret = PTR_ERR(priv->core_reg);
dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
__func__);
- goto err3;
+ goto err1;
}
priv->ld = lcd_device_register("l4f00242t03",
&spi->dev, priv, &l4f_ops);
if (IS_ERR(priv->ld)) {
ret = PTR_ERR(priv->ld);
- goto err4;
+ goto err2;
}
/* Init the LCD */
@@ -223,14 +222,10 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
return 0;
-err4:
+err2:
regulator_put(priv->core_reg);
-err3:
+err1:
regulator_put(priv->io_reg);
-err2:
- gpio_free(pdata->data_enable_gpio);
-err:
- gpio_free(pdata->reset_gpio);
return ret;
}
@@ -238,16 +233,12 @@ err:
static int __devexit l4f00242t03_remove(struct spi_device *spi)
{
struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev);
- struct l4f00242t03_pdata *pdata = priv->spi->dev.platform_data;
l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN);
lcd_device_unregister(priv->ld);
dev_set_drvdata(&spi->dev, NULL);
- gpio_free(pdata->data_enable_gpio);
- gpio_free(pdata->reset_gpio);
-
regulator_put(priv->io_reg);
regulator_put(priv->core_reg);
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index bebeb63607db..18dca0c29c68 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -295,7 +295,7 @@ static int __devinit lm3533_bl_probe(struct platform_device *pdev)
return -EINVAL;
}
- bl = kzalloc(sizeof(*bl), GFP_KERNEL);
+ bl = devm_kzalloc(&pdev->dev, sizeof(*bl), GFP_KERNEL);
if (!bl) {
dev_err(&pdev->dev,
"failed to allocate memory for backlight\n");
@@ -317,8 +317,7 @@ static int __devinit lm3533_bl_probe(struct platform_device *pdev)
&lm3533_bl_ops, &props);
if (IS_ERR(bd)) {
dev_err(&pdev->dev, "failed to register backlight device\n");
- ret = PTR_ERR(bd);
- goto err_free;
+ return PTR_ERR(bd);
}
bl->bd = bd;
@@ -348,8 +347,6 @@ err_sysfs_remove:
sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
err_unregister:
backlight_device_unregister(bd);
-err_free:
- kfree(bl);
return ret;
}
@@ -367,7 +364,6 @@ static int __devexit lm3533_bl_remove(struct platform_device *pdev)
lm3533_ctrlbank_disable(&bl->cb);
sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
backlight_device_unregister(bd);
- kfree(bl);
return 0;
}
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
index a9f2c36966f1..ea43f2254196 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -158,29 +158,27 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
int ret = 0;
if (pdata != NULL) {
- ret = gpio_request(pdata->reset_gpio, "LMS285GF05 RESET");
+ ret = devm_gpio_request(&spi->dev, pdata->reset_gpio,
+ "LMS285GF05 RESET");
if (ret)
return ret;
ret = gpio_direction_output(pdata->reset_gpio,
!pdata->reset_inverted);
if (ret)
- goto err;
+ return ret;
}
st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
GFP_KERNEL);
if (st == NULL) {
dev_err(&spi->dev, "No memory for device state\n");
- ret = -ENOMEM;
- goto err;
+ return -ENOMEM;
}
ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
- if (IS_ERR(ld)) {
- ret = PTR_ERR(ld);
- goto err;
- }
+ if (IS_ERR(ld))
+ return PTR_ERR(ld);
st->spi = spi;
st->ld = ld;
@@ -193,24 +191,14 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
return 0;
-
-err:
- if (pdata != NULL)
- gpio_free(pdata->reset_gpio);
-
- return ret;
}
static int __devexit lms283gf05_remove(struct spi_device *spi)
{
struct lms283gf05_state *st = dev_get_drvdata(&spi->dev);
- struct lms283gf05_pdata *pdata = st->spi->dev.platform_data;
lcd_device_unregister(st->ld);
- if (pdata != NULL)
- gpio_free(pdata->reset_gpio);
-
return 0;
}
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 72a0e0c917cf..aa6d4f71131f 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -14,11 +14,15 @@
#include <linux/i2c.h>
#include <linux/backlight.h>
#include <linux/err.h>
-#include <linux/lp855x.h>
+#include <linux/platform_data/lp855x.h>
/* Registers */
-#define BRIGHTNESS_CTRL (0x00)
-#define DEVICE_CTRL (0x01)
+#define BRIGHTNESS_CTRL 0x00
+#define DEVICE_CTRL 0x01
+#define EEPROM_START 0xA0
+#define EEPROM_END 0xA7
+#define EPROM_START 0xA0
+#define EPROM_END 0xAF
#define BUF_SIZE 20
#define DEFAULT_BL_NAME "lcd-backlight"
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c
index f519d55a294c..469cf0f109d2 100644
--- a/drivers/video/backlight/ot200_bl.c
+++ b/drivers/video/backlight/ot200_bl.c
@@ -84,7 +84,8 @@ static int ot200_backlight_probe(struct platform_device *pdev)
int retval = 0;
/* request gpio */
- if (gpio_request(GPIO_DIMM, "ot200 backlight dimmer") < 0) {
+ if (devm_gpio_request(&pdev->dev, GPIO_DIMM,
+ "ot200 backlight dimmer") < 0) {
dev_err(&pdev->dev, "failed to request GPIO %d\n", GPIO_DIMM);
return -ENODEV;
}
@@ -93,14 +94,13 @@ static int ot200_backlight_probe(struct platform_device *pdev)
pwm_timer = cs5535_mfgpt_alloc_timer(7, MFGPT_DOMAIN_ANY);
if (!pwm_timer) {
dev_err(&pdev->dev, "MFGPT 7 not available\n");
- retval = -ENODEV;
- goto error_mfgpt_alloc;
+ return -ENODEV;
}
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
retval = -ENOMEM;
- goto error_kzalloc;
+ goto error_devm_kzalloc;
}
/* setup gpio */
@@ -122,26 +122,21 @@ static int ot200_backlight_probe(struct platform_device *pdev)
if (IS_ERR(bl)) {
dev_err(&pdev->dev, "failed to register backlight\n");
retval = PTR_ERR(bl);
- goto error_backlight_device_register;
+ goto error_devm_kzalloc;
}
platform_set_drvdata(pdev, bl);
return 0;
-error_backlight_device_register:
- kfree(data);
-error_kzalloc:
+error_devm_kzalloc:
cs5535_mfgpt_free_timer(pwm_timer);
-error_mfgpt_alloc:
- gpio_free(GPIO_DIMM);
return retval;
}
static int ot200_backlight_remove(struct platform_device *pdev)
{
struct backlight_device *bl = platform_get_drvdata(pdev);
- struct ot200_backlight_data *data = bl_get_data(bl);
backlight_device_unregister(bl);
@@ -152,9 +147,7 @@ static int ot200_backlight_remove(struct platform_device *pdev)
MAX_COMP2 - dim_table[100]);
cs5535_mfgpt_free_timer(pwm_timer);
- gpio_free(GPIO_DIMM);
- kfree(data);
return 0;
}
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index 0d54e607e82d..49342e1d20be 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -92,14 +92,14 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj;
- ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight");
+ ret = devm_gpio_request(&client->dev, TOSA_GPIO_BL_C20MA, "backlight");
if (ret) {
dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
return ret;
}
ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0);
if (ret)
- goto err_gpio_dir;
+ return ret;
i2c_set_clientdata(client, data);
data->i2c = client;
@@ -123,8 +123,6 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
err_reg:
data->bl = NULL;
-err_gpio_dir:
- gpio_free(TOSA_GPIO_BL_C20MA);
return ret;
}
@@ -135,8 +133,6 @@ static int __devexit tosa_bl_remove(struct i2c_client *client)
backlight_device_unregister(data->bl);
data->bl = NULL;
- gpio_free(TOSA_GPIO_BL_C20MA);
-
return 0;
}
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 47823b8efff0..33047a66cc24 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -193,7 +193,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
data->spi = spi;
dev_set_drvdata(&spi->dev, data);
- ret = gpio_request(TOSA_GPIO_TG_ON, "tg #pwr");
+ ret = devm_gpio_request(&spi->dev, TOSA_GPIO_TG_ON, "tg #pwr");
if (ret < 0)
goto err_gpio_tg;
@@ -201,7 +201,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0);
if (ret < 0)
- goto err_gpio_dir;
+ goto err_gpio_tg;
mdelay(60);
tosa_lcd_tg_init(data);
@@ -221,8 +221,6 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
err_register:
tosa_lcd_tg_off(data);
-err_gpio_dir:
- gpio_free(TOSA_GPIO_TG_ON);
err_gpio_tg:
dev_set_drvdata(&spi->dev, NULL);
return ret;
@@ -239,7 +237,6 @@ static int __devexit tosa_lcd_remove(struct spi_device *spi)
tosa_lcd_tg_off(data);
- gpio_free(TOSA_GPIO_TG_ON);
dev_set_drvdata(&spi->dev, NULL);
return 0;