Commit 3f2dcb64 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'backlight-next-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight updates from Lee Jones:
 "Old Drivers
   - Remove driver for S6E63M0
   - Remove driver for LD9040

  Fix-ups
   - Trivial (email address update); adp*_bl
   - Use 'atomic' PWM API; pwm_bl

  Bug Fixes
   - Remove pointless boolen '&ptr' check; lm3639_bl"

* tag 'backlight-next-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  backlight: Remove ld9040 driver
  backlight: Remove s6e63m0 driver
  backlight: lm3639: Unconditionally call led_classdev_unregister
  backlight: pwm_bl: Switch to using "atomic" PWM API
  backlight: Update MODULE AUTHOR email address
parents 3ea172c8 e1c9f2ea
sysfs interface for the S6E63M0 AMOLED LCD panel driver
-------------------------------------------------------
What: /sys/class/lcd/<lcd>/gamma_mode
Date: May, 2010
KernelVersion: v2.6.35
Contact: dri-devel@lists.freedesktop.org
Description:
(RW) Read or write the gamma mode. Following three modes are
supported:
0 - gamma value 2.2,
1 - gamma value 1.9 and
2 - gamma value 1.7.
What: /sys/class/lcd/<lcd>/gamma_table
Date: May, 2010
KernelVersion: v2.6.35
Contact: dri-devel@lists.freedesktop.org
Description:
(RO) Displays the size of the gamma table i.e. the number of
gamma modes available.
This is a backlight lcd driver. These interfaces are an extension to the API
documented in Documentation/ABI/testing/sysfs-class-lcd and in
Documentation/ABI/stable/sysfs-class-backlight (under
/sys/class/backlight/<backlight>/).
...@@ -111,22 +111,6 @@ config LCD_HP700 ...@@ -111,22 +111,6 @@ config LCD_HP700
If you have an HP Jornada 700 series handheld (710/720/728) If you have an HP Jornada 700 series handheld (710/720/728)
say Y to enable LCD control driver. say Y to enable LCD control driver.
config LCD_S6E63M0
tristate "S6E63M0 AMOLED LCD Driver"
depends on SPI && BACKLIGHT_CLASS_DEVICE
default n
help
If you have an S6E63M0 LCD Panel, say Y to enable its
LCD control driver.
config LCD_LD9040
tristate "LD9040 AMOLED LCD Driver"
depends on SPI && BACKLIGHT_CLASS_DEVICE
default n
help
If you have an LD9040 Panel, say Y to enable its
control driver.
config LCD_AMS369FG06 config LCD_AMS369FG06
tristate "AMS369FG06 AMOLED LCD Driver" tristate "AMS369FG06 AMOLED LCD Driver"
depends on SPI && BACKLIGHT_CLASS_DEVICE depends on SPI && BACKLIGHT_CLASS_DEVICE
......
...@@ -9,13 +9,11 @@ obj-$(CONFIG_LCD_HX8357) += hx8357.o ...@@ -9,13 +9,11 @@ obj-$(CONFIG_LCD_HX8357) += hx8357.o
obj-$(CONFIG_LCD_ILI922X) += ili922x.o obj-$(CONFIG_LCD_ILI922X) += ili922x.o
obj-$(CONFIG_LCD_ILI9320) += ili9320.o obj-$(CONFIG_LCD_ILI9320) += ili9320.o
obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o
obj-$(CONFIG_LCD_LD9040) += ld9040.o
obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o
obj-$(CONFIG_LCD_LMS501KF03) += lms501kf03.o obj-$(CONFIG_LCD_LMS501KF03) += lms501kf03.o
obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o
obj-$(CONFIG_LCD_OTM3225A) += otm3225a.o obj-$(CONFIG_LCD_OTM3225A) += otm3225a.o
obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o
obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.o
obj-$(CONFIG_LCD_TDO24M) += tdo24m.o obj-$(CONFIG_LCD_TDO24M) += tdo24m.o
obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o
obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o
......
...@@ -391,7 +391,7 @@ static struct platform_driver adp5520_bl_driver = { ...@@ -391,7 +391,7 @@ static struct platform_driver adp5520_bl_driver = {
module_platform_driver(adp5520_bl_driver); module_platform_driver(adp5520_bl_driver);
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
MODULE_DESCRIPTION("ADP5520(01) Backlight Driver"); MODULE_DESCRIPTION("ADP5520(01) Backlight Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:adp5520-backlight"); MODULE_ALIAS("platform:adp5520-backlight");
...@@ -822,5 +822,5 @@ static struct i2c_driver adp8860_driver = { ...@@ -822,5 +822,5 @@ static struct i2c_driver adp8860_driver = {
module_i2c_driver(adp8860_driver); module_i2c_driver(adp8860_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
MODULE_DESCRIPTION("ADP8860 Backlight driver"); MODULE_DESCRIPTION("ADP8860 Backlight driver");
...@@ -992,5 +992,5 @@ static struct i2c_driver adp8870_driver = { ...@@ -992,5 +992,5 @@ static struct i2c_driver adp8870_driver = {
module_i2c_driver(adp8870_driver); module_i2c_driver(adp8870_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
MODULE_DESCRIPTION("ADP8870 Backlight driver"); MODULE_DESCRIPTION("ADP8870 Backlight driver");
This diff is collapsed.
/*
* Gamma level definitions.
*
* Copyright (c) 2011 Samsung Electronics
* InKi Dae <inki.dae@samsung.com>
* Donghwa Lee <dh09.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _LD9040_BRIGHTNESS_H
#define _LD9040_BRIGHTNESS_H
#define MAX_GAMMA_LEVEL 25
#define GAMMA_TABLE_COUNT 21
/* gamma value: 2.2 */
static const unsigned int ld9040_22_300[] = {
0x00, 0xa7, 0xb4, 0xae, 0xbf, 0x00, 0x91,
0x00, 0xb2, 0xb4, 0xaa, 0xbb, 0x00, 0xac,
0x00, 0xb3, 0xb1, 0xaa, 0xbc, 0x00, 0xb3
};
static const unsigned int ld9040_22_290[] = {
0x00, 0xa9, 0xb7, 0xae, 0xbd, 0x00, 0x89,
0x00, 0xb7, 0xb6, 0xa8, 0xba, 0x00, 0xa4,
0x00, 0xb1, 0xb4, 0xaa, 0xbb, 0x00, 0xaa
};
static const unsigned int ld9040_22_280[] = {
0x00, 0xa9, 0xb6, 0xad, 0xbf, 0x00, 0x86,
0x00, 0xb8, 0xb5, 0xa8, 0xbc, 0x00, 0xa0,
0x00, 0xb3, 0xb3, 0xa9, 0xbc, 0x00, 0xa7
};
static const unsigned int ld9040_22_270[] = {
0x00, 0xa8, 0xb8, 0xae, 0xbe, 0x00, 0x84,
0x00, 0xb9, 0xb7, 0xa8, 0xbc, 0x00, 0x9d,
0x00, 0xb2, 0xb5, 0xaa, 0xbc, 0x00, 0xa4
};
static const unsigned int ld9040_22_260[] = {
0x00, 0xa4, 0xb8, 0xb0, 0xbf, 0x00, 0x80,
0x00, 0xb8, 0xb6, 0xaa, 0xbc, 0x00, 0x9a,
0x00, 0xb0, 0xb5, 0xab, 0xbd, 0x00, 0xa0
};
static const unsigned int ld9040_22_250[] = {
0x00, 0xa4, 0xb9, 0xaf, 0xc1, 0x00, 0x7d,
0x00, 0xb9, 0xb6, 0xaa, 0xbb, 0x00, 0x97,
0x00, 0xb1, 0xb5, 0xaa, 0xbf, 0x00, 0x9d
};
static const unsigned int ld9040_22_240[] = {
0x00, 0xa2, 0xb9, 0xaf, 0xc2, 0x00, 0x7a,
0x00, 0xb9, 0xb7, 0xaa, 0xbd, 0x00, 0x94,
0x00, 0xb0, 0xb5, 0xab, 0xbf, 0x00, 0x9a
};
static const unsigned int ld9040_22_230[] = {
0x00, 0xa0, 0xb9, 0xaf, 0xc3, 0x00, 0x77,
0x00, 0xb9, 0xb7, 0xab, 0xbe, 0x00, 0x90,
0x00, 0xb0, 0xb6, 0xab, 0xbf, 0x00, 0x97
};
static const unsigned int ld9040_22_220[] = {
0x00, 0x9e, 0xba, 0xb0, 0xc2, 0x00, 0x75,
0x00, 0xb9, 0xb8, 0xab, 0xbe, 0x00, 0x8e,
0x00, 0xb0, 0xb6, 0xac, 0xbf, 0x00, 0x94
};
static const unsigned int ld9040_22_210[] = {
0x00, 0x9c, 0xb9, 0xb0, 0xc4, 0x00, 0x72,
0x00, 0xb8, 0xb8, 0xac, 0xbf, 0x00, 0x8a,
0x00, 0xb0, 0xb6, 0xac, 0xc0, 0x00, 0x91
};
static const unsigned int ld9040_22_200[] = {
0x00, 0x9a, 0xba, 0xb1, 0xc4, 0x00, 0x6f,
0x00, 0xb8, 0xb8, 0xad, 0xc0, 0x00, 0x86,
0x00, 0xb0, 0xb7, 0xad, 0xc0, 0x00, 0x8d
};
static const unsigned int ld9040_22_190[] = {
0x00, 0x97, 0xba, 0xb2, 0xc5, 0x00, 0x6c,
0x00, 0xb8, 0xb8, 0xae, 0xc1, 0x00, 0x82,
0x00, 0xb0, 0xb6, 0xae, 0xc2, 0x00, 0x89
};
static const unsigned int ld9040_22_180[] = {
0x00, 0x93, 0xba, 0xb3, 0xc5, 0x00, 0x69,
0x00, 0xb8, 0xb9, 0xae, 0xc1, 0x00, 0x7f,
0x00, 0xb0, 0xb6, 0xae, 0xc3, 0x00, 0x85
};
static const unsigned int ld9040_22_170[] = {
0x00, 0x8b, 0xb9, 0xb3, 0xc7, 0x00, 0x65,
0x00, 0xb7, 0xb8, 0xaf, 0xc3, 0x00, 0x7a,
0x00, 0x80, 0xb6, 0xae, 0xc4, 0x00, 0x81
};
static const unsigned int ld9040_22_160[] = {
0x00, 0x89, 0xba, 0xb3, 0xc8, 0x00, 0x62,
0x00, 0xb6, 0xba, 0xaf, 0xc3, 0x00, 0x76,
0x00, 0xaf, 0xb7, 0xae, 0xc4, 0x00, 0x7e
};
static const unsigned int ld9040_22_150[] = {
0x00, 0x82, 0xba, 0xb4, 0xc7, 0x00, 0x5f,
0x00, 0xb5, 0xba, 0xb0, 0xc3, 0x00, 0x72,
0x00, 0xae, 0xb8, 0xb0, 0xc3, 0x00, 0x7a
};
static const unsigned int ld9040_22_140[] = {
0x00, 0x7b, 0xbb, 0xb4, 0xc8, 0x00, 0x5b,
0x00, 0xb5, 0xba, 0xb1, 0xc4, 0x00, 0x6e,
0x00, 0xae, 0xb9, 0xb0, 0xc5, 0x00, 0x75
};
static const unsigned int ld9040_22_130[] = {
0x00, 0x71, 0xbb, 0xb5, 0xc8, 0x00, 0x57,
0x00, 0xb5, 0xbb, 0xb0, 0xc5, 0x00, 0x6a,
0x00, 0xae, 0xb9, 0xb1, 0xc6, 0x00, 0x70
};
static const unsigned int ld9040_22_120[] = {
0x00, 0x47, 0xba, 0xb6, 0xca, 0x00, 0x53,
0x00, 0xb5, 0xbb, 0xb3, 0xc6, 0x00, 0x65,
0x00, 0xae, 0xb8, 0xb3, 0xc7, 0x00, 0x6c
};
static const unsigned int ld9040_22_110[] = {
0x00, 0x13, 0xbb, 0xb7, 0xca, 0x00, 0x4f,
0x00, 0xb4, 0xbb, 0xb3, 0xc7, 0x00, 0x60,
0x00, 0xad, 0xb8, 0xb4, 0xc7, 0x00, 0x67
};
static const unsigned int ld9040_22_100[] = {
0x00, 0x13, 0xba, 0xb8, 0xcb, 0x00, 0x4b,
0x00, 0xb3, 0xbc, 0xb4, 0xc7, 0x00, 0x5c,
0x00, 0xac, 0xb8, 0xb4, 0xc8, 0x00, 0x62
};
static const unsigned int ld9040_22_90[] = {
0x00, 0x13, 0xb9, 0xb8, 0xcd, 0x00, 0x46,
0x00, 0xb1, 0xbc, 0xb5, 0xc8, 0x00, 0x56,
0x00, 0xaa, 0xb8, 0xb4, 0xc9, 0x00, 0x5d
};
static const unsigned int ld9040_22_80[] = {
0x00, 0x13, 0xba, 0xb9, 0xcd, 0x00, 0x41,
0x00, 0xb0, 0xbe, 0xb5, 0xc9, 0x00, 0x51,
0x00, 0xa9, 0xb9, 0xb5, 0xca, 0x00, 0x57
};
static const unsigned int ld9040_22_70[] = {
0x00, 0x13, 0xb9, 0xb9, 0xd0, 0x00, 0x3c,
0x00, 0xaf, 0xbf, 0xb6, 0xcb, 0x00, 0x4b,
0x00, 0xa8, 0xb9, 0xb5, 0xcc, 0x00, 0x52
};
static const unsigned int ld9040_22_50[] = {
0x00, 0x13, 0xb2, 0xba, 0xd2, 0x00, 0x30,
0x00, 0xaf, 0xc0, 0xb8, 0xcd, 0x00, 0x3d,
0x00, 0xa8, 0xb8, 0xb7, 0xcd, 0x00, 0x44
};
struct ld9040_gamma {
unsigned int *gamma_22_table[MAX_GAMMA_LEVEL];
};
static struct ld9040_gamma gamma_table = {
.gamma_22_table[0] = (unsigned int *)&ld9040_22_50,
.gamma_22_table[1] = (unsigned int *)&ld9040_22_70,
.gamma_22_table[2] = (unsigned int *)&ld9040_22_80,
.gamma_22_table[3] = (unsigned int *)&ld9040_22_90,
.gamma_22_table[4] = (unsigned int *)&ld9040_22_100,
.gamma_22_table[5] = (unsigned int *)&ld9040_22_110,
.gamma_22_table[6] = (unsigned int *)&ld9040_22_120,
.gamma_22_table[7] = (unsigned int *)&ld9040_22_130,
.gamma_22_table[8] = (unsigned int *)&ld9040_22_140,
.gamma_22_table[9] = (unsigned int *)&ld9040_22_150,
.gamma_22_table[10] = (unsigned int *)&ld9040_22_160,
.gamma_22_table[11] = (unsigned int *)&ld9040_22_170,
.gamma_22_table[12] = (unsigned int *)&ld9040_22_180,
.gamma_22_table[13] = (unsigned int *)&ld9040_22_190,
.gamma_22_table[14] = (unsigned int *)&ld9040_22_200,
.gamma_22_table[15] = (unsigned int *)&ld9040_22_210,
.gamma_22_table[16] = (unsigned int *)&ld9040_22_220,
.gamma_22_table[17] = (unsigned int *)&ld9040_22_230,
.gamma_22_table[18] = (unsigned int *)&ld9040_22_240,
.gamma_22_table[19] = (unsigned int *)&ld9040_22_250,
.gamma_22_table[20] = (unsigned int *)&ld9040_22_260,
.gamma_22_table[21] = (unsigned int *)&ld9040_22_270,
.gamma_22_table[22] = (unsigned int *)&ld9040_22_280,
.gamma_22_table[23] = (unsigned int *)&ld9040_22_290,
.gamma_22_table[24] = (unsigned int *)&ld9040_22_300,
};
#endif
...@@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client) ...@@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client)
regmap_write(pchip->regmap, REG_ENABLE, 0x00); regmap_write(pchip->regmap, REG_ENABLE, 0x00);
if (&pchip->cdev_torch) led_classdev_unregister(&pchip->cdev_torch);
led_classdev_unregister(&pchip->cdev_torch); led_classdev_unregister(&pchip->cdev_flash);
if (&pchip->cdev_flash)
led_classdev_unregister(&pchip->cdev_flash);
if (pchip->bled) if (pchip->bled)
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode); device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
return 0; return 0;
......
...@@ -28,10 +28,8 @@ ...@@ -28,10 +28,8 @@
struct pwm_bl_data { struct pwm_bl_data {
struct pwm_device *pwm; struct pwm_device *pwm;
struct device *dev; struct device *dev;
unsigned int period;
unsigned int lth_brightness; unsigned int lth_brightness;
unsigned int *levels; unsigned int *levels;
bool enabled;
struct regulator *power_supply; struct regulator *power_supply;
struct gpio_desc *enable_gpio; struct gpio_desc *enable_gpio;
unsigned int scale; unsigned int scale;
...@@ -46,31 +44,35 @@ struct pwm_bl_data { ...@@ -46,31 +44,35 @@ struct pwm_bl_data {
void (*exit)(struct device *); void (*exit)(struct device *);
}; };
static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) static void pwm_backlight_power_on(struct pwm_bl_data *pb)
{ {
struct pwm_state state;
int err; int err;
if (pb->enabled) pwm_get_state(pb->pwm, &state);
if (state.enabled)
return; return;
err = regulator_enable(pb->power_supply); err = regulator_enable(pb->power_supply);
if (err < 0) if (err < 0)
dev_err(pb->dev, "failed to enable power supply\n"); dev_err(pb->dev, "failed to enable power supply\n");
pwm_enable(pb->pwm); state.enabled = true;
pwm_apply_state(pb->pwm, &state);
if (pb->post_pwm_on_delay) if (pb->post_pwm_on_delay)
msleep(pb->post_pwm_on_delay); msleep(pb->post_pwm_on_delay);
if (pb->enable_gpio) if (pb->enable_gpio)
gpiod_set_value_cansleep(pb->enable_gpio, 1); gpiod_set_value_cansleep(pb->enable_gpio, 1);
pb->enabled = true;
} }
static void pwm_backlight_power_off(struct pwm_bl_data *pb) static void pwm_backlight_power_off(struct pwm_bl_data *pb)
{ {
if (!pb->enabled) struct pwm_state state;
pwm_get_state(pb->pwm, &state);
if (!state.enabled)
return; return;
if (pb->enable_gpio) if (pb->enable_gpio)
...@@ -79,24 +81,27 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) ...@@ -79,24 +81,27 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb)
if (pb->pwm_off_delay) if (pb->pwm_off_delay)
msleep(pb->pwm_off_delay); msleep(pb->pwm_off_delay);
pwm_config(pb->pwm, 0, pb->period); state.enabled = false;
pwm_disable(pb->pwm); state.duty_cycle = 0;
pwm_apply_state(pb->pwm, &state);
regulator_disable(pb->power_supply); regulator_disable(pb->power_supply);
pb->enabled = false;
} }
static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness) static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness)
{ {
unsigned int lth = pb->lth_brightness; unsigned int lth = pb->lth_brightness;
struct pwm_state state;
u64 duty_cycle; u64 duty_cycle;
pwm_get_state(pb->pwm, &state);
if (pb->levels) if (pb->levels)
duty_cycle = pb->levels[brightness]; duty_cycle = pb->levels[brightness];
else else
duty_cycle = brightness; duty_cycle = brightness;
duty_cycle *= pb->period - lth; duty_cycle *= state.period - lth;
do_div(duty_cycle, pb->scale); do_div(duty_cycle, pb->scale);
return duty_cycle + lth; return duty_cycle + lth;
...@@ -106,7 +111,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) ...@@ -106,7 +111,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
{ {
struct pwm_bl_data *pb = bl_get_data(bl); struct pwm_bl_data *pb = bl_get_data(bl);
int brightness = bl->props.brightness; int brightness = bl->props.brightness;
int duty_cycle; struct pwm_state state;
if (bl->props.power != FB_BLANK_UNBLANK || if (bl->props.power != FB_BLANK_UNBLANK ||
bl->props.fb_blank != FB_BLANK_UNBLANK || bl->props.fb_blank != FB_BLANK_UNBLANK ||
...@@ -117,9 +122,10 @@ static int pwm_backlight_update_status(struct backlight_device *bl) ...@@ -117,9 +122,10 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
brightness = pb->notify(pb->dev, brightness); brightness = pb->notify(pb->dev, brightness);
if (brightness > 0) { if (brightness > 0) {
duty_cycle = compute_duty_cycle(pb, brightness); pwm_get_state(pb->pwm, &state);
pwm_config(pb->pwm, duty_cycle, pb->period); state.duty_cycle = compute_duty_cycle(pb, brightness);
pwm_backlight_power_on(pb, brightness); pwm_apply_state(pb->pwm, &state);
pwm_backlight_power_on(pb);
} else } else
pwm_backlight_power_off(pb); pwm_backlight_power_off(pb);
...@@ -447,7 +453,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -447,7 +453,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct pwm_bl_data *pb; struct pwm_bl_data *pb;
struct pwm_state state; struct pwm_state state;
struct pwm_args pargs;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -478,7 +483,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -478,7 +483,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->check_fb = data->check_fb; pb->check_fb = data->check_fb;
pb->exit = data->exit; pb->exit = data->exit;
pb->dev = &pdev->dev; pb->dev = &pdev->dev;
pb->enabled = false;
pb->post_pwm_on_delay = data->post_pwm_on_delay; pb->post_pwm_on_delay = data->post_pwm_on_delay;
pb->pwm_off_delay = data->pwm_off_delay; pb->pwm_off_delay = data->pwm_off_delay;
...@@ -539,10 +543,26 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -539,10 +543,26 @@ static int pwm_backlight_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "got pwm for backlight\n"); dev_dbg(&pdev->dev, "got pwm for backlight\n");
if (!data->levels) { /* Sync up PWM state. */
/* Get the PWM period (in nanoseconds) */ pwm_init_state(pb->pwm, &state);
pwm_get_state(pb->pwm, &state);
/*
* The DT case will set the pwm_period_ns field to 0 and store the
* period, parsed from the DT, in the PWM device. For the non-DT case,
* set the period from platform data if it has not already been set
* via the PWM lookup table.
*/
if (!state.period && (data->pwm_period_ns > 0))
state.period = data->pwm_period_ns;
ret = pwm_apply_state(pb->pwm, &state);
if (ret) {
dev_err(&pdev->dev, "failed to apply initial PWM state: %d\n",
ret);
goto err_alloc;
}
if (!data->levels) {
ret = pwm_backlight_brightness_default(&pdev->dev, data, ret = pwm_backlight_brightness_default(&pdev->dev, data,
state.period); state.period);
if (ret < 0) { if (ret < 0) {
...@@ -559,24 +579,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -559,24 +579,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->levels = data->levels; pb->levels = data->levels;
} }
/* pb->lth_brightness = data->lth_brightness * (state.period / pb->scale);
* FIXME: pwm_apply_args() should be removed when switching to
* the atomic PWM API.
*/
pwm_apply_args(pb->pwm);
/*
* The DT case will set the pwm_period_ns field to 0 and store the
* period, parsed from the DT, in the PWM device. For the non-DT case,
* set the period from platform data if it has not already been set
* via the PWM lookup table.
*/
pwm_get_args(pb->pwm, &pargs);
pb->period = pargs.period;
if (!pb->period && (data->pwm_period_ns > 0))
pb->period = data->pwm_period_ns;
pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale);
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW; props.type = BACKLIGHT_RAW;
......
This diff is collapsed.
/* linux/drivers/video/samsung/s6e63m0_brightness.h
*
* Gamma level definitions.
*
* Copyright (c) 2009 Samsung Electronics
* InKi Dae <inki.dae@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _S6E63M0_BRIGHTNESS_H
#define _S6E63M0_BRIGHTNESS_H
#define MAX_GAMMA_LEVEL 11
#define GAMMA_TABLE_COUNT 21
/* gamma value: 2.2 */
static const unsigned int s6e63m0_22_300[] = {
0x18, 0x08, 0x24, 0x5f, 0x50, 0x2d, 0xB6,
0xB9, 0xA7, 0xAd, 0xB1, 0x9f, 0xbe, 0xC0,
0xB5, 0x00, 0xa0, 0x00, 0xa4, 0x00, 0xdb
};
static const unsigned int s6e63m0_22_280[] = {
0x18, 0x08, 0x24, 0x64, 0x56, 0x33, 0xB6,
0xBA, 0xA8, 0xAC, 0xB1, 0x9D, 0xC1, 0xC1,
0xB7, 0x00, 0x9C, 0x00, 0x9F, 0x00, 0xD6
};
static const unsigned int s6e63m0_22_260[] = {
0x18, 0x08, 0x24, 0x66, 0x58, 0x34, 0xB6,
0xBA, 0xA7, 0xAF, 0xB3, 0xA0, 0xC1, 0xC2,
0xB7, 0x00, 0x97, 0x00, 0x9A, 0x00, 0xD1
};
static const unsigned int s6e63m0_22_240[] = {
0x18, 0x08, 0x24, 0x62, 0x54, 0x30, 0xB9,
0xBB, 0xA9, 0xB0, 0xB3, 0xA1, 0xC1, 0xC3,
0xB7, 0x00, 0x91, 0x00, 0x95, 0x00, 0xDA
};
static const unsigned int s6e63m0_22_220[] = {
0x18, 0x08, 0x24, 0x63, 0x53, 0x31, 0xB8,
0xBC, 0xA9, 0xB0, 0xB5, 0xA2, 0xC4, 0xC4,
0xB8, 0x00, 0x8B, 0x00, 0x8E, 0x00, 0xC2
};
static const unsigned int s6e63m0_22_200[] = {
0x18, 0x08, 0x24, 0x66, 0x55, 0x34, 0xBA,
0xBD, 0xAB, 0xB1, 0xB5, 0xA3, 0xC5, 0xC6,
0xB9, 0x00, 0x85, 0x00, 0x88, 0x00, 0xBA
};
static const unsigned int s6e63m0_22_170[] = {
0x18, 0x08, 0x24, 0x69, 0x54, 0x37, 0xBB,
0xBE, 0xAC, 0xB4, 0xB7, 0xA6, 0xC7, 0xC8,
0xBC, 0x00, 0x7B, 0x00, 0x7E, 0x00, 0xAB
};
static const unsigned int s6e63m0_22_140[] = {
0x18, 0x08, 0x24, 0x6C, 0x54, 0x3A, 0xBC,
0xBF, 0xAC, 0xB7, 0xBB, 0xA9, 0xC9, 0xC9,
0xBE, 0x00, 0x71, 0x00, 0x73, 0x00, 0x9E
};
static const unsigned int s6e63m0_22_110[] = {
0x18, 0x08, 0x24, 0x70, 0x51, 0x3E, 0xBF,
0xC1, 0xAF, 0xB9, 0xBC, 0xAB, 0xCC, 0xCC,
0xC2, 0x00, 0x65, 0x00, 0x67, 0x00, 0x8D
};
static const unsigned int s6e63m0_22_90[] = {
0x18, 0x08, 0x24, 0x73, 0x4A, 0x3D, 0xC0,
0xC2, 0xB1, 0xBB, 0xBE, 0xAC, 0xCE, 0xCF,
0xC5, 0x00, 0x5D, 0x00, 0x5E, 0x00, 0x82
};
static const unsigned int s6e63m0_22_30[] = {
0x18, 0x08, 0x24, 0x78, 0xEC, 0x3D, 0xC8,
0xC2, 0xB6, 0xC4, 0xC7, 0xB6, 0xD5, 0xD7,
0xCC, 0x00, 0x39, 0x00, 0x36, 0x00, 0x51
};
/* gamma value: 1.9 */
static const unsigned int s6e63m0_19_300[] = {
0x18, 0x08, 0x24, 0x61, 0x5F, 0x39, 0xBA,
0xBD, 0xAD, 0xB1, 0xB6, 0xA5, 0xC4, 0xC5,
0xBC, 0x00, 0xA0, 0x00, 0xA4, 0x00, 0xDB
};
static const unsigned int s6e63m0_19_280[] = {
0x18, 0x08, 0x24, 0x61, 0x60, 0x39, 0xBB,
0xBE, 0xAD, 0xB2, 0xB6, 0xA6, 0xC5, 0xC7,
0xBD, 0x00, 0x9B, 0x00, 0x9E, 0x00, 0xD5
};
static const unsigned int s6e63m0_19_260[] = {
0x18, 0x08, 0x24, 0x63, 0x61, 0x3B, 0xBA,
0xBE, 0xAC, 0xB3, 0xB8, 0xA7, 0xC6, 0xC8,
0xBD, 0x00, 0x96, 0x00, 0x98, 0x00, 0xCF
};
static const unsigned int s6e63m0_19_240[] = {
0x18, 0x08, 0x24, 0x67, 0x64, 0x3F, 0xBB,
0xBE, 0xAD, 0xB3, 0xB9, 0xA7, 0xC8, 0xC9,
0xBE, 0x00, 0x90, 0x00, 0x92, 0x00, 0xC8
};
static const unsigned int s6e63m0_19_220[] = {
0x18, 0x08, 0x24, 0x68, 0x64, 0x40, 0xBC,
0xBF, 0xAF, 0xB4, 0xBA, 0xA9, 0xC8, 0xCA,
0xBE, 0x00, 0x8B, 0x00, 0x8C, 0x00, 0xC0
};
static const unsigned int s6e63m0_19_200[] = {
0x18, 0x08, 0x24, 0x68, 0x64, 0x3F, 0xBE,
0xC0, 0xB0, 0xB6, 0xBB, 0xAB, 0xC8, 0xCB,
0xBF, 0x00, 0x85, 0x00, 0x86, 0x00, 0xB8
};
static const unsigned int s6e63m0_19_170[] = {
0x18, 0x08, 0x24, 0x69, 0x64, 0x40, 0xBF,
0xC1, 0xB0, 0xB9, 0xBE, 0xAD, 0xCB, 0xCD,
0xC2, 0x00, 0x7A, 0x00, 0x7B, 0x00, 0xAA
};
static const unsigned int s6e63m0_19_140[] = {
0x18, 0x08, 0x24, 0x6E, 0x65, 0x45, 0xC0,
0xC3, 0xB2, 0xBA, 0xBE, 0xAE, 0xCD, 0xD0,
0xC4, 0x00, 0x70, 0x00, 0x70, 0x00, 0x9C
};
static const unsigned int s6e63m0_19_110[] = {
0x18, 0x08, 0x24, 0x6F, 0x65, 0x46, 0xC2,
0xC4, 0xB3, 0xBF, 0xC2, 0xB2, 0xCF, 0xD1,
0xC6, 0x00, 0x64, 0x00, 0x64, 0x00, 0x8D
};
static const unsigned int s6e63m0_19_90[] = {
0x18, 0x08, 0x24, 0x74, 0x60, 0x4A, 0xC3,
0xC6, 0xB5, 0xBF, 0xC3, 0xB2, 0xD2, 0xD3,
0xC8, 0x00, 0x5B, 0x00, 0x5B, 0x00, 0x81
};
static const unsigned int s6e63m0_19_30[] = {
0x18, 0x08, 0x24, 0x84, 0x45, 0x4F, 0xCA,
0xCB, 0xBC, 0xC9, 0xCB, 0xBC, 0xDA, 0xDA,
0xD0, 0x00, 0x35, 0x00, 0x34, 0x00, 0x4E
};
/* gamma value: 1.7 */
static const unsigned int s6e63m0_17_300[] = {
0x18, 0x08, 0x24, 0x70, 0x70, 0x4F, 0xBF,
0xC2, 0xB2, 0xB8, 0xBC, 0xAC, 0xCB, 0xCD,
0xC3, 0x00, 0xA0, 0x00, 0xA4, 0x00, 0xDB
};
static const unsigned int s6e63m0_17_280[] = {
0x18, 0x08, 0x24, 0x71, 0x71, 0x50, 0xBF,
0xC2, 0xB2, 0xBA, 0xBE, 0xAE, 0xCB, 0xCD,
0xC3, 0x00, 0x9C, 0x00, 0x9F, 0x00, 0xD6
};
static const unsigned int s6e63m0_17_260[] = {
0x18, 0x08, 0x24, 0x72, 0x72, 0x50, 0xC0,
0xC3, 0xB4, 0xB9, 0xBE, 0xAE, 0xCC, 0xCF,
0xC4, 0x00, 0x97, 0x00, 0x9A, 0x00, 0xD1
};
static const unsigned int s6e63m0_17_240[] = {
0x18, 0x08, 0x24, 0x71, 0x72, 0x4F, 0xC2,
0xC4, 0xB5, 0xBB, 0xBF, 0xB0, 0xCC, 0xCF,
0xC3, 0x00, 0x91, 0x00, 0x95, 0x00, 0xCA
};
static const unsigned int s6e63m0_17_220[] = {
0x18, 0x08, 0x24, 0x71, 0x73, 0x4F, 0xC2,
0xC5, 0xB5, 0xBD, 0xC0, 0xB2, 0xCD, 0xD1,
0xC5, 0x00, 0x8B, 0x00, 0x8E, 0x00, 0xC2
};
static const unsigned int s6e63m0_17_200[] = {
0x18, 0x08, 0x24, 0x72, 0x75, 0x51, 0xC2,
0xC6, 0xB5, 0xBF, 0xC1, 0xB3, 0xCE, 0xD1,
0xC6, 0x00, 0x85, 0x00, 0x88, 0x00, 0xBA
};
static const unsigned int s6e63m0_17_170[] = {
0x18, 0x08, 0x24, 0x75, 0x77, 0x54, 0xC3,
0xC7, 0xB7, 0xC0, 0xC3, 0xB4, 0xD1, 0xD3,
0xC9, 0x00, 0x7B, 0x00, 0x7E, 0x00, 0xAB
};
static const unsigned int s6e63m0_17_140[] = {
0x18, 0x08, 0x24, 0x7B, 0x77, 0x58, 0xC3,
0xC8, 0xB8, 0xC2, 0xC6, 0xB6, 0xD3, 0xD4,
0xCA, 0x00, 0x71, 0x00, 0x73, 0x00, 0x9E
};
static const unsigned int s6e63m0_17_110[] = {
0x18, 0x08, 0x24, 0x81, 0x7B, 0x5D, 0xC6,
0xCA, 0xBB, 0xC3, 0xC7, 0xB8, 0xD6, 0xD8,
0xCD, 0x00, 0x65, 0x00, 0x67, 0x00, 0x8D
};
static const unsigned int s6e63m0_17_90[] = {
0x18, 0x08, 0x24, 0x82, 0x7A, 0x5B, 0xC8,
0xCB, 0xBD, 0xC5, 0xCA, 0xBA, 0xD6, 0xD8,
0xCE, 0x00, 0x5D, 0x00, 0x5E, 0x00, 0x82
};
static const unsigned int s6e63m0_17_30[] = {
0x18, 0x08, 0x24, 0x8F, 0x73, 0x63, 0xD1,
0xD0, 0xC5, 0xCC, 0xD1, 0xC2, 0xDE, 0xE0,
0xD6, 0x00, 0x39, 0x00, 0x36, 0x00, 0x51
};
struct s6e63m0_gamma {
unsigned int *gamma_22_table[MAX_GAMMA_LEVEL];
unsigned int *gamma_19_table[MAX_GAMMA_LEVEL];
unsigned int *gamma_17_table[MAX_GAMMA_LEVEL];
};
static struct s6e63m0_gamma gamma_table = {
.gamma_22_table[0] = (unsigned int *)&s6e63m0_22_30,
.gamma_22_table[1] = (unsigned int *)&s6e63m0_22_90,
.gamma_22_table[2] = (unsigned int *)&s6e63m0_22_110,
.gamma_22_table[3] = (unsigned int *)&s6e63m0_22_140,
.gamma_22_table[4] = (unsigned int *)&s6e63m0_22_170,
.gamma_22_table[5] = (unsigned int *)&s6e63m0_22_200,
.gamma_22_table[6] = (unsigned int *)&s6e63m0_22_220,
.gamma_22_table[7] = (unsigned int *)&s6e63m0_22_240,
.gamma_22_table[8] = (unsigned int *)&s6e63m0_22_260,
.gamma_22_table[9] = (unsigned int *)&s6e63m0_22_280,
.gamma_22_table[10] = (unsigned int *)&s6e63m0_22_300,
.gamma_19_table[0] = (unsigned int *)&s6e63m0_19_30,
.gamma_19_table[1] = (unsigned int *)&s6e63m0_19_90,
.gamma_19_table[2] = (unsigned int *)&s6e63m0_19_110,
.gamma_19_table[3] = (unsigned int *)&s6e63m0_19_140,
.gamma_19_table[4] = (unsigned int *)&s6e63m0_19_170,
.gamma_19_table[5] = (unsigned int *)&s6e63m0_19_200,
.gamma_19_table[6] = (unsigned int *)&s6e63m0_19_220,
.gamma_19_table[7] = (unsigned int *)&s6e63m0_19_240,
.gamma_19_table[8] = (unsigned int *)&s6e63m0_19_260,
.gamma_19_table[9] = (unsigned int *)&s6e63m0_19_280,
.gamma_19_table[10] = (unsigned int *)&s6e63m0_19_300,
.gamma_17_table[0] = (unsigned int *)&s6e63m0_17_30,
.gamma_17_table[1] = (unsigned int *)&s6e63m0_17_90,
.gamma_17_table[2] = (unsigned int *)&s6e63m0_17_110,
.gamma_17_table[3] = (unsigned int *)&s6e63m0_17_140,
.gamma_17_table[4] = (unsigned int *)&s6e63m0_17_170,
.gamma_17_table[5] = (unsigned int *)&s6e63m0_17_200,
.gamma_17_table[6] = (unsigned int *)&s6e63m0_17_220,
.gamma_17_table[7] = (unsigned int *)&s6e63m0_17_240,
.gamma_17_table[8] = (unsigned int *)&s6e63m0_17_260,
.gamma_17_table[9] = (unsigned int *)&s6e63m0_17_280,
.gamma_17_table[10] = (unsigned int *)&s6e63m0_17_300,
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment