Commit 7eae27cd authored by Linus Torvalds's avatar Linus Torvalds

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

Pull backlight updates from Lee Jones:
 "Fix-ups:
   - FB Backlight interaction overhaul
   - Remove superfluous code and simplify overall
   - Constify various structs and struct attributes

  Bug Fixes:
   - Repair LED flickering
   - Fix signedness bugs"

* tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (42 commits)
  backlight: sky81452-backlight: Remove unnecessary call to of_node_get()
  backlight: mp3309c: Fix LEDs flickering in PWM mode
  backlight: otm3225a: Drop driver owner assignment
  backlight: lp8788: Drop support for platform data
  backlight: lcd: Make lcd_class constant
  backlight: Make backlight_class constant
  backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode()
  const_structs.checkpatch: add lcd_ops
  fbdev: omap: lcd_ams_delta: Constify lcd_ops
  fbdev: imx: Constify lcd_ops
  fbdev: clps711x: Constify lcd_ops
  HID: picoLCD: Constify lcd_ops
  backlight: tdo24m: Constify lcd_ops
  backlight: platform_lcd: Constify lcd_ops
  backlight: otm3225a: Constify lcd_ops
  backlight: ltv350qv: Constify lcd_ops
  backlight: lms501kf03: Constify lcd_ops
  backlight: lms283gf05: Constify lcd_ops
  backlight: l4f00242t03: Constify lcd_ops
  backlight: jornada720_lcd: Constify lcd_ops
  ...
parents a85629f4 1fd949f6
......@@ -284,27 +284,14 @@ static int ht16k33_initialize(struct ht16k33_priv *priv)
static int ht16k33_bl_update_status(struct backlight_device *bl)
{
int brightness = bl->props.brightness;
const int brightness = backlight_get_brightness(bl);
struct ht16k33_priv *priv = bl_get_data(bl);
if (bl->props.power != FB_BLANK_UNBLANK ||
bl->props.fb_blank != FB_BLANK_UNBLANK ||
bl->props.state & BL_CORE_FBBLANK)
brightness = 0;
return ht16k33_brightness_set(priv, brightness);
}
static int ht16k33_bl_check_fb(struct backlight_device *bl, struct fb_info *fi)
{
struct ht16k33_priv *priv = bl_get_data(bl);
return (fi == NULL) || (fi->par == priv);
}
static const struct backlight_ops ht16k33_bl_ops = {
.update_status = ht16k33_bl_update_status,
.check_fb = ht16k33_bl_check_fb,
};
/*
......
......@@ -9,7 +9,6 @@
#include <linux/hid.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include "hid-picolcd.h"
......@@ -39,15 +38,9 @@ static int picolcd_set_brightness(struct backlight_device *bdev)
return 0;
}
static int picolcd_check_bl_fb(struct backlight_device *bdev, struct fb_info *fb)
{
return fb && fb == picolcd_fbinfo((struct picolcd_data *)bl_get_data(bdev));
}
static const struct backlight_ops picolcd_blops = {
.update_status = picolcd_set_brightness,
.get_brightness = picolcd_get_brightness,
.check_fb = picolcd_check_bl_fb,
};
int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *report)
......
......@@ -474,11 +474,6 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
if (error)
goto err;
/* Set up the framebuffer device */
error = picolcd_init_framebuffer(data);
if (error)
goto err;
/* Setup lcd class device */
error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev));
if (error)
......@@ -489,6 +484,11 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
if (error)
goto err;
/* Set up the framebuffer device */
error = picolcd_init_framebuffer(data);
if (error)
goto err;
/* Setup the LED class devices */
error = picolcd_init_leds(data, picolcd_out_report(REPORT_LED_STATE, hdev));
if (error)
......@@ -502,9 +502,9 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
return 0;
err:
picolcd_exit_leds(data);
picolcd_exit_framebuffer(data);
picolcd_exit_backlight(data);
picolcd_exit_lcd(data);
picolcd_exit_framebuffer(data);
picolcd_exit_cir(data);
picolcd_exit_keys(data);
return error;
......@@ -623,9 +623,9 @@ static void picolcd_remove(struct hid_device *hdev)
/* Cleanup LED */
picolcd_exit_leds(data);
/* Clean up the framebuffer */
picolcd_exit_framebuffer(data);
picolcd_exit_backlight(data);
picolcd_exit_lcd(data);
picolcd_exit_framebuffer(data);
/* Cleanup input */
picolcd_exit_cir(data);
picolcd_exit_keys(data);
......
......@@ -491,6 +491,12 @@ int picolcd_init_framebuffer(struct picolcd_data *data)
info->fix = picolcdfb_fix;
info->fix.smem_len = PICOLCDFB_SIZE*8;
#ifdef CONFIG_FB_BACKLIGHT
#ifdef CONFIG_HID_PICOLCD_BACKLIGHT
info->bl_dev = data->backlight;
#endif
#endif
fbdata = info->par;
spin_lock_init(&fbdata->lock);
fbdata->picolcd = data;
......
......@@ -46,7 +46,7 @@ static int picolcd_check_lcd_fb(struct lcd_device *ldev, struct fb_info *fb)
return fb && fb == picolcd_fbinfo((struct picolcd_data *)lcd_get_data(ldev));
}
static struct lcd_ops picolcd_lcdops = {
static const struct lcd_ops picolcd_lcdops = {
.get_contrast = picolcd_get_contrast,
.set_contrast = picolcd_set_contrast,
.check_fb = picolcd_check_lcd_fb,
......
......@@ -194,9 +194,7 @@ static int update_onboard_backlight(struct backlight_device *bd)
struct fbtft_par *par = bl_get_data(bd);
bool on;
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s: power=%d, fb_blank=%d\n",
__func__, bd->props.power, bd->props.fb_blank);
fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: power=%d\n", __func__, bd->props.power);
on = !backlight_is_blank(bd);
/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
......
......@@ -133,9 +133,8 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)
struct fbtft_par *par = bl_get_data(bd);
bool polarity = par->polarity;
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s: polarity=%d, power=%d, fb_blank=%d\n",
__func__, polarity, bd->props.power, bd->props.fb_blank);
fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: polarity=%d, power=%d\n", __func__,
polarity, bd->props.power);
if (!backlight_is_blank(bd))
gpiod_set_value(par->gpio.led[0], polarity);
......
......@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/mfd/aat2870.h>
......@@ -90,15 +89,9 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
return 0;
}
static int aat2870_bl_check_fb(struct backlight_device *bd, struct fb_info *fi)
{
return 1;
}
static const struct backlight_ops aat2870_bl_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = aat2870_bl_update_status,
.check_fb = aat2870_bl_check_fb,
};
static int aat2870_bl_probe(struct platform_device *pdev)
......
......@@ -427,7 +427,7 @@ static int ams369fg06_set_brightness(struct backlight_device *bd)
return ret;
}
static struct lcd_ops ams369fg06_lcd_ops = {
static const struct lcd_ops ams369fg06_lcd_ops = {
.get_power = ams369fg06_get_power,
.set_power = ams369fg06_set_power,
};
......
......@@ -98,7 +98,9 @@ static int fb_notifier_callback(struct notifier_block *self,
{
struct backlight_device *bd;
struct fb_event *evdata = data;
int node = evdata->info->node;
struct fb_info *info = evdata->info;
struct backlight_device *fb_bd = fb_bl_device(info);
int node = info->node;
int fb_blank = 0;
/* If we aren't interested in this event, skip it immediately ... */
......@@ -110,7 +112,9 @@ static int fb_notifier_callback(struct notifier_block *self,
if (!bd->ops)
goto out;
if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
if (bd->ops->controls_device && !bd->ops->controls_device(bd, info->device))
goto out;
if (fb_bd && fb_bd != bd)
goto out;
fb_blank = *(int *)evdata->data;
......@@ -118,14 +122,12 @@ static int fb_notifier_callback(struct notifier_block *self,
bd->fb_bl_on[node] = true;
if (!bd->use_count++) {
bd->props.state &= ~BL_CORE_FBBLANK;
bd->props.fb_blank = FB_BLANK_UNBLANK;
backlight_update_status(bd);
}
} else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) {
bd->fb_bl_on[node] = false;
if (!(--bd->use_count)) {
bd->props.state |= BL_CORE_FBBLANK;
bd->props.fb_blank = fb_blank;
backlight_update_status(bd);
}
}
......@@ -317,8 +319,6 @@ static ssize_t scale_show(struct device *dev,
}
static DEVICE_ATTR_RO(scale);
static struct class *backlight_class;
#ifdef CONFIG_PM_SLEEP
static int backlight_suspend(struct device *dev)
{
......@@ -369,6 +369,12 @@ static struct attribute *bl_device_attrs[] = {
};
ATTRIBUTE_GROUPS(bl_device);
static const struct class backlight_class = {
.name = "backlight",
.dev_groups = bl_device_groups,
.pm = &backlight_class_dev_pm_ops,
};
/**
* backlight_force_update - tell the backlight subsystem that hardware state
* has changed
......@@ -418,7 +424,7 @@ struct backlight_device *backlight_device_register(const char *name,
mutex_init(&new_bd->update_lock);
mutex_init(&new_bd->ops_lock);
new_bd->dev.class = backlight_class;
new_bd->dev.class = &backlight_class;
new_bd->dev.parent = parent;
new_bd->dev.release = bl_device_release;
dev_set_name(&new_bd->dev, "%s", name);
......@@ -510,7 +516,7 @@ struct backlight_device *backlight_device_get_by_name(const char *name)
{
struct device *dev;
dev = class_find_device_by_name(backlight_class, name);
dev = class_find_device_by_name(&backlight_class, name);
return dev ? to_backlight_device(dev) : NULL;
}
......@@ -678,7 +684,7 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node)
{
struct device *dev;
dev = class_find_device(backlight_class, NULL, node, of_parent_match);
dev = class_find_device(&backlight_class, NULL, node, of_parent_match);
return dev ? to_backlight_device(dev) : NULL;
}
......@@ -746,20 +752,19 @@ EXPORT_SYMBOL(devm_of_find_backlight);
static void __exit backlight_class_exit(void)
{
class_destroy(backlight_class);
class_unregister(&backlight_class);
}
static int __init backlight_class_init(void)
{
backlight_class = class_create("backlight");
if (IS_ERR(backlight_class)) {
pr_warn("Unable to create backlight class; errno = %ld\n",
PTR_ERR(backlight_class));
return PTR_ERR(backlight_class);
int ret;
ret = class_register(&backlight_class);
if (ret) {
pr_warn("Unable to create backlight class; errno = %d\n", ret);
return ret;
}
backlight_class->dev_groups = bl_device_groups;
backlight_class->pm = &backlight_class_dev_pm_ops;
INIT_LIST_HEAD(&backlight_dev_list);
mutex_init(&backlight_dev_list_mutex);
BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier);
......
......@@ -99,18 +99,18 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight)
return 0;
}
static int bd6107_backlight_check_fb(struct backlight_device *backlight,
struct fb_info *info)
static bool bd6107_backlight_controls_device(struct backlight_device *backlight,
struct device *display_dev)
{
struct bd6107 *bd = bl_get_data(backlight);
return !bd->pdata->dev || bd->pdata->dev == info->device;
return !bd->pdata->dev || bd->pdata->dev == display_dev;
}
static const struct backlight_ops bd6107_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = bd6107_backlight_update_status,
.check_fb = bd6107_backlight_check_fb,
.controls_device = bd6107_backlight_controls_device,
};
static int bd6107_probe(struct i2c_client *client)
......
......@@ -380,7 +380,7 @@ static int corgi_lcd_get_power(struct lcd_device *ld)
return lcd->power;
}
static struct lcd_ops corgi_lcd_ops = {
static const struct lcd_ops corgi_lcd_ops = {
.get_power = corgi_lcd_get_power,
.set_power = corgi_lcd_set_power,
.set_mode = corgi_lcd_set_mode,
......
......@@ -30,18 +30,18 @@ static int gpio_backlight_update_status(struct backlight_device *bl)
return 0;
}
static int gpio_backlight_check_fb(struct backlight_device *bl,
struct fb_info *info)
static bool gpio_backlight_controls_device(struct backlight_device *bl,
struct device *display_dev)
{
struct gpio_backlight *gbl = bl_get_data(bl);
return !gbl->dev || gbl->dev == info->device;
return !gbl->dev || gbl->dev == display_dev;
}
static const struct backlight_ops gpio_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = gpio_backlight_update_status,
.check_fb = gpio_backlight_check_fb,
.controls_device = gpio_backlight_controls_device,
};
static int gpio_backlight_probe(struct platform_device *pdev)
......
......@@ -559,7 +559,7 @@ static int hx8357_get_power(struct lcd_device *lcdev)
return lcd->state;
}
static struct lcd_ops hx8357_ops = {
static const struct lcd_ops hx8357_ops = {
.set_power = hx8357_set_power,
.get_power = hx8357_get_power,
};
......
......@@ -472,7 +472,7 @@ static int ili922x_get_power(struct lcd_device *ld)
return ili->power;
}
static struct lcd_ops ili922x_ops = {
static const struct lcd_ops ili922x_ops = {
.get_power = ili922x_get_power,
.set_power = ili922x_set_power,
};
......
......@@ -161,7 +161,7 @@ static int ili9320_get_power(struct lcd_device *ld)
return lcd->power;
}
static struct lcd_ops ili9320_ops = {
static const struct lcd_ops ili9320_ops = {
.get_power = ili9320_get_power,
.set_power = ili9320_set_power,
};
......
......@@ -81,7 +81,7 @@ static int jornada_lcd_set_power(struct lcd_device *ld, int power)
return 0;
}
static struct lcd_ops jornada_lcd_props = {
static const struct lcd_ops jornada_lcd_props = {
.get_contrast = jornada_lcd_get_contrast,
.set_contrast = jornada_lcd_set_contrast,
.get_power = jornada_lcd_get_power,
......
......@@ -158,7 +158,7 @@ static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power)
return 0;
}
static struct lcd_ops l4f_ops = {
static const struct lcd_ops l4f_ops = {
.set_power = l4f00242t03_lcd_power_set,
.get_power = l4f00242t03_lcd_power_get,
};
......
......@@ -159,8 +159,6 @@ static ssize_t max_contrast_show(struct device *dev,
}
static DEVICE_ATTR_RO(max_contrast);
static struct class *lcd_class;
static void lcd_device_release(struct device *dev)
{
struct lcd_device *ld = to_lcd_device(dev);
......@@ -175,6 +173,11 @@ static struct attribute *lcd_device_attrs[] = {
};
ATTRIBUTE_GROUPS(lcd_device);
static const struct class lcd_class = {
.name = "lcd",
.dev_groups = lcd_device_groups,
};
/**
* lcd_device_register - register a new object of lcd_device class.
* @name: the name of the new object(must be the same as the name of the
......@@ -188,7 +191,7 @@ ATTRIBUTE_GROUPS(lcd_device);
* or a pointer to the newly allocated device.
*/
struct lcd_device *lcd_device_register(const char *name, struct device *parent,
void *devdata, struct lcd_ops *ops)
void *devdata, const struct lcd_ops *ops)
{
struct lcd_device *new_ld;
int rc;
......@@ -202,7 +205,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
mutex_init(&new_ld->ops_lock);
mutex_init(&new_ld->update_lock);
new_ld->dev.class = lcd_class;
new_ld->dev.class = &lcd_class;
new_ld->dev.parent = parent;
new_ld->dev.release = lcd_device_release;
dev_set_name(&new_ld->dev, "%s", name);
......@@ -276,7 +279,7 @@ static int devm_lcd_device_match(struct device *dev, void *res, void *data)
*/
struct lcd_device *devm_lcd_device_register(struct device *dev,
const char *name, struct device *parent,
void *devdata, struct lcd_ops *ops)
void *devdata, const struct lcd_ops *ops)
{
struct lcd_device **ptr, *lcd;
......@@ -318,19 +321,19 @@ EXPORT_SYMBOL(devm_lcd_device_unregister);
static void __exit lcd_class_exit(void)
{
class_destroy(lcd_class);
class_unregister(&lcd_class);
}
static int __init lcd_class_init(void)
{
lcd_class = class_create("lcd");
if (IS_ERR(lcd_class)) {
pr_warn("Unable to create backlight class; errno = %ld\n",
PTR_ERR(lcd_class));
return PTR_ERR(lcd_class);
int ret;
ret = class_register(&lcd_class);
if (ret) {
pr_warn("Unable to create backlight class; errno = %d\n", ret);
return ret;
}
lcd_class->dev_groups = lcd_device_groups;
return 0;
}
......
......@@ -139,7 +139,7 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power)
return 0;
}
static struct lcd_ops lms_ops = {
static const struct lcd_ops lms_ops = {
.set_power = lms283gf05_power_set,
.get_power = NULL,
};
......
......@@ -304,7 +304,7 @@ static int lms501kf03_set_power(struct lcd_device *ld, int power)
return lms501kf03_power(lcd, power);
}
static struct lcd_ops lms501kf03_lcd_ops = {
static const struct lcd_ops lms501kf03_lcd_ops = {
.get_power = lms501kf03_get_power,
.set_power = lms501kf03_set_power,
};
......
......@@ -12,7 +12,6 @@
#include <linux/mfd/lp8788.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/slab.h>
/* Register address */
......@@ -31,149 +30,40 @@
#define MAX_BRIGHTNESS 127
#define DEFAULT_BL_NAME "lcd-backlight"
struct lp8788_bl_config {
enum lp8788_bl_ctrl_mode bl_mode;
enum lp8788_bl_dim_mode dim_mode;
enum lp8788_bl_full_scale_current full_scale;
enum lp8788_bl_ramp_step rise_time;
enum lp8788_bl_ramp_step fall_time;
enum pwm_polarity pwm_pol;
};
struct lp8788_bl {
struct lp8788 *lp;
struct backlight_device *bl_dev;
struct lp8788_backlight_platform_data *pdata;
enum lp8788_bl_ctrl_mode mode;
struct pwm_device *pwm;
};
static struct lp8788_bl_config default_bl_config = {
.bl_mode = LP8788_BL_REGISTER_ONLY,
.dim_mode = LP8788_DIM_EXPONENTIAL,
.full_scale = LP8788_FULLSCALE_1900uA,
.rise_time = LP8788_RAMP_8192us,
.fall_time = LP8788_RAMP_8192us,
.pwm_pol = PWM_POLARITY_NORMAL,
};
static inline bool is_brightness_ctrl_by_pwm(enum lp8788_bl_ctrl_mode mode)
{
return mode == LP8788_BL_COMB_PWM_BASED;
}
static inline bool is_brightness_ctrl_by_register(enum lp8788_bl_ctrl_mode mode)
{
return mode == LP8788_BL_REGISTER_ONLY ||
mode == LP8788_BL_COMB_REGISTER_BASED;
}
static int lp8788_backlight_configure(struct lp8788_bl *bl)
{
struct lp8788_backlight_platform_data *pdata = bl->pdata;
struct lp8788_bl_config *cfg = &default_bl_config;
int ret;
u8 val;
/*
* Update chip configuration if platform data exists,
* otherwise use the default settings.
*/
if (pdata) {
cfg->bl_mode = pdata->bl_mode;
cfg->dim_mode = pdata->dim_mode;
cfg->full_scale = pdata->full_scale;
cfg->rise_time = pdata->rise_time;
cfg->fall_time = pdata->fall_time;
cfg->pwm_pol = pdata->pwm_pol;
}
/* Brightness ramp up/down */
val = (cfg->rise_time << LP8788_BL_RAMP_RISE_SHIFT) | cfg->fall_time;
val = (LP8788_RAMP_8192us << LP8788_BL_RAMP_RISE_SHIFT) | LP8788_RAMP_8192us;
ret = lp8788_write_byte(bl->lp, LP8788_BL_RAMP, val);
if (ret)
return ret;
/* Fullscale current setting */
val = (cfg->full_scale << LP8788_BL_FULLSCALE_SHIFT) |
(cfg->dim_mode << LP8788_BL_DIM_MODE_SHIFT);
val = (LP8788_FULLSCALE_1900uA << LP8788_BL_FULLSCALE_SHIFT) |
(LP8788_DIM_EXPONENTIAL << LP8788_BL_DIM_MODE_SHIFT);
/* Brightness control mode */
switch (cfg->bl_mode) {
case LP8788_BL_REGISTER_ONLY:
val |= LP8788_BL_EN;
break;
case LP8788_BL_COMB_PWM_BASED:
case LP8788_BL_COMB_REGISTER_BASED:
val |= LP8788_BL_EN | LP8788_BL_PWM_INPUT_EN |
(cfg->pwm_pol << LP8788_BL_PWM_POLARITY_SHIFT);
break;
default:
dev_err(bl->lp->dev, "invalid mode: %d\n", cfg->bl_mode);
return -EINVAL;
}
bl->mode = cfg->bl_mode;
return lp8788_write_byte(bl->lp, LP8788_BL_CONFIG, val);
}
static void lp8788_pwm_ctrl(struct lp8788_bl *bl, int br, int max_br)
{
unsigned int period;
unsigned int duty;
struct device *dev;
struct pwm_device *pwm;
if (!bl->pdata)
return;
period = bl->pdata->period_ns;
duty = br * period / max_br;
dev = bl->lp->dev;
/* request PWM device with the consumer name */
if (!bl->pwm) {
pwm = devm_pwm_get(dev, LP8788_DEV_BACKLIGHT);
if (IS_ERR(pwm)) {
dev_err(dev, "can not get PWM device\n");
return;
}
bl->pwm = pwm;
/*
* FIXME: pwm_apply_args() should be removed when switching to
* the atomic PWM API.
*/
pwm_apply_args(pwm);
}
pwm_config(bl->pwm, duty, period);
if (duty)
pwm_enable(bl->pwm);
else
pwm_disable(bl->pwm);
}
static int lp8788_bl_update_status(struct backlight_device *bl_dev)
{
struct lp8788_bl *bl = bl_get_data(bl_dev);
enum lp8788_bl_ctrl_mode mode = bl->mode;
if (bl_dev->props.state & BL_CORE_SUSPENDED)
bl_dev->props.brightness = 0;
if (is_brightness_ctrl_by_pwm(mode)) {
int brt = bl_dev->props.brightness;
int max = bl_dev->props.max_brightness;
lp8788_pwm_ctrl(bl, brt, max);
} else if (is_brightness_ctrl_by_register(mode)) {
u8 brt = bl_dev->props.brightness;
lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, brt);
}
lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, bl_dev->props.brightness);
return 0;
}
......@@ -187,30 +77,16 @@ static int lp8788_backlight_register(struct lp8788_bl *bl)
{
struct backlight_device *bl_dev;
struct backlight_properties props;
struct lp8788_backlight_platform_data *pdata = bl->pdata;
int init_brt;
char *name;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_PLATFORM;
props.max_brightness = MAX_BRIGHTNESS;
/* Initial brightness */
if (pdata)
init_brt = min_t(int, pdata->initial_brightness,
props.max_brightness);
else
init_brt = 0;
props.brightness = init_brt;
props.brightness = 0;
/* Backlight device name */
if (!pdata || !pdata->name)
name = DEFAULT_BL_NAME;
else
name = pdata->name;
bl_dev = backlight_device_register(name, bl->lp->dev, bl,
bl_dev = backlight_device_register(DEFAULT_BL_NAME, bl->lp->dev, bl,
&lp8788_bl_ops, &props);
if (IS_ERR(bl_dev))
return PTR_ERR(bl_dev);
......@@ -230,16 +106,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lp8788_bl *bl = dev_get_drvdata(dev);
enum lp8788_bl_ctrl_mode mode = bl->mode;
char *strmode;
if (is_brightness_ctrl_by_pwm(mode))
strmode = "PWM based";
else if (is_brightness_ctrl_by_register(mode))
strmode = "Register based";
else
strmode = "Invalid mode";
const char *strmode = "Register based";
return scnprintf(buf, PAGE_SIZE, "%s\n", strmode);
}
......@@ -266,8 +133,6 @@ static int lp8788_backlight_probe(struct platform_device *pdev)
return -ENOMEM;
bl->lp = lp;
if (lp->pdata)
bl->pdata = lp->pdata->bl_pdata;
platform_set_drvdata(pdev, bl);
......
......@@ -217,7 +217,7 @@ static int ltv350qv_get_power(struct lcd_device *ld)
return lcd->power;
}
static struct lcd_ops ltv_ops = {
static const struct lcd_ops ltv_ops = {
.get_power = ltv350qv_get_power,
.set_power = ltv350qv_set_power,
};
......
......@@ -62,18 +62,18 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight)
return 0;
}
static int lv5207lp_backlight_check_fb(struct backlight_device *backlight,
struct fb_info *info)
static bool lv5207lp_backlight_controls_device(struct backlight_device *backlight,
struct device *display_dev)
{
struct lv5207lp *lv = bl_get_data(backlight);
return !lv->pdata->dev || lv->pdata->dev == info->device;
return !lv->pdata->dev || lv->pdata->dev == display_dev;
}
static const struct backlight_ops lv5207lp_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = lv5207lp_backlight_update_status,
.check_fb = lv5207lp_backlight_check_fb,
.controls_device = lv5207lp_backlight_controls_device,
};
static int lv5207lp_probe(struct i2c_client *client)
......
......@@ -97,15 +97,10 @@ static int mp3309c_enable_device(struct mp3309c_chip *chip)
/*
* I2C register #1 - Set working mode:
* - set one of the two dimming mode:
* - PWM dimming using an external PWM dimming signal
* - analog dimming using I2C commands
* - enable/disable synchronous mode
* - set overvoltage protection (OVP)
*/
reg_val = 0x00;
if (chip->pdata->dimming_mode == DIMMING_PWM)
reg_val |= REG_I2C_1_DIMS;
if (chip->pdata->sync_mode)
reg_val |= REG_I2C_1_SYNC;
reg_val |= chip->pdata->over_voltage_protection;
......@@ -205,8 +200,9 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip,
struct mp3309c_platform_data *pdata)
{
int ret, i;
unsigned int num_levels, tmp_value;
unsigned int tmp_value;
struct device *dev = chip->dev;
int num_levels;
if (!dev_fwnode(dev))
return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n");
......@@ -363,7 +359,6 @@ static int mp3309c_probe(struct i2c_client *client)
props.scale = BACKLIGHT_SCALE_LINEAR;
props.type = BACKLIGHT_RAW;
props.power = FB_BLANK_UNBLANK;
props.fb_blank = FB_BLANK_UNBLANK;
chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip,
&mp3309c_bl_ops, &props);
if (IS_ERR(chip->bl))
......
......@@ -9,7 +9,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/slab.h>
#include <linux/platform_data/omap1_bl.h>
......@@ -20,7 +19,7 @@
#define OMAPBL_MAX_INTENSITY 0xff
struct omap_backlight {
int powermode;
bool enabled;
int current_intensity;
struct device *dev;
......@@ -37,24 +36,14 @@ static inline void omapbl_send_enable(int enable)
omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
}
static void omapbl_blank(struct omap_backlight *bl, int mode)
static void omapbl_enable(struct omap_backlight *bl, bool enable)
{
if (bl->pdata->set_power)
bl->pdata->set_power(bl->dev, mode);
switch (mode) {
case FB_BLANK_NORMAL:
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
case FB_BLANK_POWERDOWN:
omapbl_send_intensity(0);
omapbl_send_enable(0);
break;
case FB_BLANK_UNBLANK:
if (enable) {
omapbl_send_intensity(bl->current_intensity);
omapbl_send_enable(1);
break;
} else {
omapbl_send_intensity(0);
omapbl_send_enable(0);
}
}
......@@ -64,7 +53,7 @@ static int omapbl_suspend(struct device *dev)
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
omapbl_blank(bl, FB_BLANK_POWERDOWN);
omapbl_enable(bl, false);
return 0;
}
......@@ -73,33 +62,34 @@ static int omapbl_resume(struct device *dev)
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
omapbl_blank(bl, bl->powermode);
omapbl_enable(bl, bl->enabled);
return 0;
}
#endif
static int omapbl_set_power(struct backlight_device *dev, int state)
static void omapbl_set_enabled(struct backlight_device *dev, bool enable)
{
struct omap_backlight *bl = bl_get_data(dev);
omapbl_blank(bl, state);
bl->powermode = state;
return 0;
omapbl_enable(bl, enable);
bl->enabled = enable;
}
static int omapbl_update_status(struct backlight_device *dev)
{
struct omap_backlight *bl = bl_get_data(dev);
bool enable;
if (bl->current_intensity != dev->props.brightness) {
if (bl->powermode == FB_BLANK_UNBLANK)
if (bl->enabled)
omapbl_send_intensity(dev->props.brightness);
bl->current_intensity = dev->props.brightness;
}
if (dev->props.fb_blank != bl->powermode)
omapbl_set_power(dev, dev->props.fb_blank);
enable = !backlight_is_blank(dev);
if (enable != bl->enabled)
omapbl_set_enabled(dev, enable);
return 0;
}
......@@ -139,7 +129,7 @@ static int omapbl_probe(struct platform_device *pdev)
if (IS_ERR(dev))
return PTR_ERR(dev);
bl->powermode = FB_BLANK_POWERDOWN;
bl->enabled = false;
bl->current_intensity = 0;
bl->pdata = pdata;
......@@ -149,7 +139,6 @@ static int omapbl_probe(struct platform_device *pdev)
omap_cfg_reg(PWL); /* Conflicts with UART3 */
dev->props.fb_blank = FB_BLANK_UNBLANK;
dev->props.brightness = pdata->default_intensity;
omapbl_update_status(dev);
......
......@@ -205,7 +205,7 @@ static int otm3225a_get_power(struct lcd_device *ld)
return dd->power;
}
static struct lcd_ops otm3225a_ops = {
static const struct lcd_ops otm3225a_ops = {
.set_power = otm3225a_set_power,
.get_power = otm3225a_get_power,
};
......@@ -239,7 +239,6 @@ static int otm3225a_probe(struct spi_device *spi)
static struct spi_driver otm3225a_driver = {
.driver = {
.name = "otm3225a",
.owner = THIS_MODULE,
},
.probe = otm3225a_probe,
};
......
......@@ -62,7 +62,7 @@ static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info)
return plcd->us->parent == info->device;
}
static struct lcd_ops platform_lcd_ops = {
static const struct lcd_ops platform_lcd_ops = {
.get_power = platform_lcd_get_power,
.set_power = platform_lcd_set_power,
.check_fb = platform_lcd_match,
......
......@@ -11,7 +11,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/err.h>
#include <linux/pwm.h>
......@@ -34,7 +33,6 @@ struct pwm_bl_data {
int brightness);
void (*notify_after)(struct device *,
int brightness);
int (*check_fb)(struct device *, struct fb_info *);
void (*exit)(struct device *);
};
......@@ -129,17 +127,8 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
return 0;
}
static int pwm_backlight_check_fb(struct backlight_device *bl,
struct fb_info *info)
{
struct pwm_bl_data *pb = bl_get_data(bl);
return !pb->check_fb || pb->check_fb(pb->dev, info);
}
static const struct backlight_ops pwm_backlight_ops = {
.update_status = pwm_backlight_update_status,
.check_fb = pwm_backlight_check_fb,
};
#ifdef CONFIG_OF
......@@ -482,7 +471,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->notify = data->notify;
pb->notify_after = data->notify_after;
pb->check_fb = data->check_fb;
pb->exit = data->exit;
pb->dev = &pdev->dev;
pb->enabled = false;
......
......@@ -182,7 +182,7 @@ static const struct attribute_group sky81452_bl_attr_group = {
static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
struct device *dev)
{
struct device_node *np = of_node_get(dev->of_node);
struct device_node *np = dev->of_node;
struct sky81452_bl_platform_data *pdata;
int num_entry;
unsigned int sources[6];
......@@ -194,10 +194,8 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
of_node_put(np);
if (!pdata)
return ERR_PTR(-ENOMEM);
}
of_property_read_string(np, "name", &pdata->name);
pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm");
......@@ -217,7 +215,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
num_entry);
if (ret < 0) {
dev_err(dev, "led-sources node is invalid.\n");
of_node_put(np);
return ERR_PTR(-EINVAL);
}
......@@ -237,7 +234,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
if (ret < 0)
pdata->boost_current_limit = 2750;
of_node_put(np);
return pdata;
}
#else
......
......@@ -322,7 +322,7 @@ static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m)
return lcd->adj_mode(lcd, mode);
}
static struct lcd_ops tdo24m_ops = {
static const struct lcd_ops tdo24m_ops = {
.get_power = tdo24m_get_power,
.set_power = tdo24m_set_power,
.set_mode = tdo24m_set_mode,
......
......@@ -153,7 +153,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
sinfo->backlight = bl;
bl->props.power = FB_BLANK_UNBLANK;
bl->props.fb_blank = FB_BLANK_UNBLANK;
bl->props.brightness = atmel_bl_get_brightness(bl);
}
......
......@@ -197,7 +197,7 @@ static int clps711x_lcd_set_power(struct lcd_device *lcddev, int blank)
return 0;
}
static struct lcd_ops clps711x_lcd_ops = {
static const struct lcd_ops clps711x_lcd_ops = {
.check_fb = clps711x_lcd_check_fb,
.get_power = clps711x_lcd_get_power,
.set_power = clps711x_lcd_set_power,
......
......@@ -30,4 +30,10 @@ void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max)
mutex_unlock(&fb_info->bl_curve_mutex);
}
EXPORT_SYMBOL_GPL(fb_bl_default_curve);
struct backlight_device *fb_bl_device(struct fb_info *info)
{
return info->bl_dev;
}
EXPORT_SYMBOL(fb_bl_device);
#endif
......@@ -857,7 +857,7 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
return 0;
}
static struct lcd_ops imxfb_lcd_ops = {
static const struct lcd_ops imxfb_lcd_ops = {
.check_fb = imxfb_lcd_check_fb,
.get_contrast = imxfb_lcd_get_contrast,
.set_contrast = imxfb_lcd_set_contrast,
......
......@@ -76,7 +76,7 @@ static int ams_delta_lcd_get_contrast(struct lcd_device *dev)
return ams_delta_lcd & AMS_DELTA_MAX_CONTRAST;
}
static struct lcd_ops ams_delta_lcd_ops = {
static const struct lcd_ops ams_delta_lcd_ops = {
.get_power = ams_delta_lcd_get_power,
.set_power = ams_delta_lcd_set_power,
.get_contrast = ams_delta_lcd_get_contrast,
......
......@@ -356,11 +356,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
static int dsicm_bl_get_intensity(struct backlight_device *dev)
{
if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
dev->props.power == FB_BLANK_UNBLANK)
return dev->props.brightness;
return 0;
return backlight_get_brightness(dev);
}
static const struct backlight_ops dsicm_bl_ops = {
......@@ -1219,7 +1215,6 @@ static int dsicm_probe(struct platform_device *pdev)
ddata->bldev = bldev;
bldev->props.fb_blank = FB_BLANK_UNBLANK;
bldev->props.power = FB_BLANK_UNBLANK;
bldev->props.brightness = 255;
......
......@@ -340,11 +340,7 @@ static int acx565akm_bl_update_status(struct backlight_device *dev)
dev_dbg(&ddata->spi->dev, "%s\n", __func__);
if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
dev->props.power == FB_BLANK_UNBLANK)
level = dev->props.brightness;
else
level = 0;
level = backlight_get_brightness(dev);
if (ddata->has_bc)
acx565akm_set_brightness(ddata, level);
......@@ -363,8 +359,7 @@ static int acx565akm_bl_get_intensity(struct backlight_device *dev)
if (!ddata->has_bc)
return -ENODEV;
if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
dev->props.power == FB_BLANK_UNBLANK) {
if (!backlight_is_blank(dev)) {
if (ddata->has_bc)
return acx565akm_get_actual_brightness(ddata);
else
......@@ -758,7 +753,6 @@ static int acx565akm_probe(struct spi_device *spi)
}
memset(&props, 0, sizeof(props));
props.fb_blank = FB_BLANK_UNBLANK;
props.power = FB_BLANK_UNBLANK;
props.type = BACKLIGHT_RAW;
......
......@@ -2140,17 +2140,10 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
return ch->bl_brightness;
}
static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
struct fb_info *info)
{
return (info->bl_dev == bdev);
}
static const struct backlight_ops sh_mobile_lcdc_bl_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = sh_mobile_lcdc_update_bl,
.get_brightness = sh_mobile_lcdc_get_brightness,
.check_fb = sh_mobile_lcdc_check_fb,
};
static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
......
......@@ -530,17 +530,10 @@ static int ssd1307fb_get_brightness(struct backlight_device *bdev)
return par->contrast;
}
static int ssd1307fb_check_fb(struct backlight_device *bdev,
struct fb_info *info)
{
return (info->bl_dev == bdev);
}
static const struct backlight_ops ssd1307fb_bl_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = ssd1307fb_update_bl,
.get_brightness = ssd1307fb_get_brightness,
.check_fb = ssd1307fb_check_fb,
};
static struct ssd1307fb_deviceinfo ssd1307fb_ssd1305_deviceinfo = {
......@@ -594,7 +587,6 @@ static int ssd1307fb_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct backlight_device *bl;
char bl_name[12];
struct fb_info *info;
struct fb_deferred_io *ssd1307fb_defio;
u32 vmem_size;
......@@ -733,31 +725,30 @@ static int ssd1307fb_probe(struct i2c_client *client)
if (ret)
goto regulator_enable_error;
ret = register_framebuffer(info);
if (ret) {
dev_err(dev, "Couldn't register the framebuffer\n");
goto panel_init_error;
}
snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node);
bl = backlight_device_register(bl_name, dev, par, &ssd1307fb_bl_ops,
bl = backlight_device_register("ssd1307fb-bl", dev, par, &ssd1307fb_bl_ops,
NULL);
if (IS_ERR(bl)) {
ret = PTR_ERR(bl);
dev_err(dev, "unable to register backlight device: %d\n", ret);
goto bl_init_error;
goto panel_init_error;
}
info->bl_dev = bl;
ret = register_framebuffer(info);
if (ret) {
dev_err(dev, "Couldn't register the framebuffer\n");
goto fb_init_error;
}
bl->props.brightness = par->contrast;
bl->props.max_brightness = MAX_CONTRAST;
info->bl_dev = bl;
dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size);
return 0;
bl_init_error:
unregister_framebuffer(info);
fb_init_error:
backlight_device_unregister(bl);
panel_init_error:
pwm_disable(par->pwm);
pwm_put(par->pwm);
......
......@@ -13,6 +13,7 @@
#include <linux/fb.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/types.h>
/**
* enum backlight_update_reason - what method was used to update backlight
......@@ -110,7 +111,6 @@ enum backlight_scale {
};
struct backlight_device;
struct fb_info;
/**
* struct backlight_ops - backlight operations
......@@ -160,18 +160,18 @@ struct backlight_ops {
int (*get_brightness)(struct backlight_device *);
/**
* @check_fb: Check the framebuffer device.
* @controls_device: Check against the display device
*
* Check if given framebuffer device is the one bound to this backlight.
* This operation is optional and if not implemented it is assumed that the
* fbdev is always the one bound to the backlight.
* Check if the backlight controls the given display device. This
* operation is optional and if not implemented it is assumed that
* the display is always the one controlled by the backlight.
*
* RETURNS:
*
* If info is NULL or the info matches the fbdev bound to the backlight return true.
* If info does not match the fbdev bound to the backlight return false.
* If display_dev is NULL or display_dev matches the device controlled by
* the backlight, return true. Otherwise return false.
*/
int (*check_fb)(struct backlight_device *bd, struct fb_info *info);
bool (*controls_device)(struct backlight_device *bd, struct device *display_dev);
};
/**
......@@ -218,25 +218,6 @@ struct backlight_properties {
*/
int power;
/**
* @fb_blank: The power state from the FBIOBLANK ioctl.
*
* When the FBIOBLANK ioctl is called @fb_blank is set to the
* blank parameter and the update_status() operation is called.
*
* When the backlight device is enabled @fb_blank is set
* to FB_BLANK_UNBLANK. When the backlight device is disabled
* @fb_blank is set to FB_BLANK_POWERDOWN.
*
* Backlight drivers should avoid using this property. It has been
* replaced by state & BL_CORE_FBLANK (although most drivers should
* use backlight_is_blank() as the preferred means to get the blank
* state).
*
* fb_blank is deprecated and will be removed.
*/
int fb_blank;
/**
* @type: The type of backlight supported.
*
......@@ -366,7 +347,6 @@ static inline int backlight_enable(struct backlight_device *bd)
return 0;
bd->props.power = FB_BLANK_UNBLANK;
bd->props.fb_blank = FB_BLANK_UNBLANK;
bd->props.state &= ~BL_CORE_FBBLANK;
return backlight_update_status(bd);
......@@ -382,7 +362,6 @@ static inline int backlight_disable(struct backlight_device *bd)
return 0;
bd->props.power = FB_BLANK_POWERDOWN;
bd->props.fb_blank = FB_BLANK_POWERDOWN;
bd->props.state |= BL_CORE_FBBLANK;
return backlight_update_status(bd);
......@@ -395,15 +374,13 @@ static inline int backlight_disable(struct backlight_device *bd)
* Display is expected to be blank if any of these is true::
*
* 1) if power in not UNBLANK
* 2) if fb_blank is not UNBLANK
* 3) if state indicate BLANK or SUSPENDED
* 2) if state indicate BLANK or SUSPENDED
*
* Returns true if display is expected to be blank, false otherwise.
*/
static inline bool backlight_is_blank(const struct backlight_device *bd)
{
return bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK ||
bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK);
}
......
......@@ -742,6 +742,15 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
extern void framebuffer_release(struct fb_info *info);
extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
#if IS_ENABLED(CONFIG_FB_BACKLIGHT)
struct backlight_device *fb_bl_device(struct fb_info *info);
#else
static inline struct backlight_device *fb_bl_device(struct fb_info *info)
{
return NULL;
}
#endif
/* fbmon.c */
#define FB_MAXTIMINGS 0
#define FB_VSYNCTIMINGS 1
......
......@@ -61,7 +61,7 @@ struct lcd_device {
points to something in the body of that driver, it is also invalid. */
struct mutex ops_lock;
/* If this is NULL, the backing module is unloaded */
struct lcd_ops *ops;
const struct lcd_ops *ops;
/* Serialise access to set_power method */
struct mutex update_lock;
/* The framebuffer notifier block */
......@@ -102,10 +102,10 @@ static inline void lcd_set_power(struct lcd_device *ld, int power)
}
extern struct lcd_device *lcd_device_register(const char *name,
struct device *parent, void *devdata, struct lcd_ops *ops);
struct device *parent, void *devdata, const struct lcd_ops *ops);
extern struct lcd_device *devm_lcd_device_register(struct device *dev,
const char *name, struct device *parent,
void *devdata, struct lcd_ops *ops);
void *devdata, const struct lcd_ops *ops);
extern void lcd_device_unregister(struct lcd_device *ld);
extern void devm_lcd_device_unregister(struct device *dev,
struct lcd_device *ld);
......
......@@ -11,7 +11,6 @@
#define __MFD_LP8788_H__
#include <linux/irqdomain.h>
#include <linux/pwm.h>
#include <linux/regmap.h>
#define LP8788_DEV_BUCK "lp8788-buck"
......@@ -87,12 +86,6 @@ enum lp8788_charger_event {
CHARGER_DETECTED,
};
enum lp8788_bl_ctrl_mode {
LP8788_BL_REGISTER_ONLY,
LP8788_BL_COMB_PWM_BASED, /* PWM + I2C, changed by PWM input */
LP8788_BL_COMB_REGISTER_BASED, /* PWM + I2C, changed by I2C */
};
enum lp8788_bl_dim_mode {
LP8788_DIM_EXPONENTIAL,
LP8788_DIM_LINEAR,
......@@ -201,31 +194,6 @@ struct lp8788_charger_platform_data {
enum lp8788_charger_event event);
};
/*
* struct lp8788_backlight_platform_data
* @name : backlight driver name. (default: "lcd-backlight")
* @initial_brightness : initial value of backlight brightness
* @bl_mode : brightness control by pwm or lp8788 register
* @dim_mode : dimming mode selection
* @full_scale : full scale current setting
* @rise_time : brightness ramp up step time
* @fall_time : brightness ramp down step time
* @pwm_pol : pwm polarity setting when bl_mode is pwm based
* @period_ns : platform specific pwm period value. unit is nano.
Only valid when bl_mode is LP8788_BL_COMB_PWM_BASED
*/
struct lp8788_backlight_platform_data {
char *name;
int initial_brightness;
enum lp8788_bl_ctrl_mode bl_mode;
enum lp8788_bl_dim_mode dim_mode;
enum lp8788_bl_full_scale_current full_scale;
enum lp8788_bl_ramp_step rise_time;
enum lp8788_bl_ramp_step fall_time;
enum pwm_polarity pwm_pol;
unsigned int period_ns;
};
/*
* struct lp8788_led_platform_data
* @name : led driver name. (default: "keyboard-backlight")
......@@ -267,7 +235,6 @@ struct lp8788_vib_platform_data {
* @buck2_dvs : configurations for buck2 dvs
* @chg_pdata : platform data for charger driver
* @alarm_sel : rtc alarm selection (1 or 2)
* @bl_pdata : configurable data for backlight driver
* @led_pdata : configurable data for led driver
* @vib_pdata : configurable data for vibrator driver
* @adc_pdata : iio map data for adc driver
......@@ -289,9 +256,6 @@ struct lp8788_platform_data {
/* rtc alarm */
enum lp8788_alarm_sel alarm_sel;
/* backlight */
struct lp8788_backlight_platform_data *bl_pdata;
/* current sinks */
struct lp8788_led_platform_data *led_pdata;
struct lp8788_vib_platform_data *vib_pdata;
......
......@@ -6,7 +6,6 @@
struct omap_backlight_config {
int default_intensity;
int (*set_power)(struct device *dev, int state);
};
#endif
......@@ -19,7 +19,6 @@ struct platform_pwm_backlight_data {
int (*notify)(struct device *dev, int brightness);
void (*notify_after)(struct device *dev, int brightness);
void (*exit)(struct device *dev);
int (*check_fb)(struct device *dev, struct fb_info *info);
};
#endif
......@@ -39,6 +39,7 @@ kgdb_arch
kgdb_io
kobj_type
kset_uevent_ops
lcd_ops
lock_manager_operations
machine_desc
microcode_ops
......
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