Commit 13cb61be authored by Lee Jones's avatar Lee Jones

Merge branches 'ib-backlight-auxdisplay-staging-omap-6.9',...

Merge branches 'ib-backlight-auxdisplay-staging-omap-6.9', 'ib-backlight-auxdisplay-hid-fb-6.9' and 'ib-backlight-hid-fbdev-lcd-scripts-6.10' into ibs-for-backlight-merged
...@@ -290,16 +290,8 @@ static int ht16k33_bl_update_status(struct backlight_device *bl) ...@@ -290,16 +290,8 @@ static int ht16k33_bl_update_status(struct backlight_device *bl)
return ht16k33_brightness_set(priv, brightness); 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 = { static const struct backlight_ops ht16k33_bl_ops = {
.update_status = ht16k33_bl_update_status, .update_status = ht16k33_bl_update_status,
.check_fb = ht16k33_bl_check_fb,
}; };
/* /*
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/fb.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include "hid-picolcd.h" #include "hid-picolcd.h"
...@@ -39,15 +38,9 @@ static int picolcd_set_brightness(struct backlight_device *bdev) ...@@ -39,15 +38,9 @@ static int picolcd_set_brightness(struct backlight_device *bdev)
return 0; 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 = { static const struct backlight_ops picolcd_blops = {
.update_status = picolcd_set_brightness, .update_status = picolcd_set_brightness,
.get_brightness = picolcd_get_brightness, .get_brightness = picolcd_get_brightness,
.check_fb = picolcd_check_bl_fb,
}; };
int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *report) 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) ...@@ -474,11 +474,6 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
if (error) if (error)
goto err; goto err;
/* Set up the framebuffer device */
error = picolcd_init_framebuffer(data);
if (error)
goto err;
/* Setup lcd class device */ /* Setup lcd class device */
error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev)); error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev));
if (error) if (error)
...@@ -489,6 +484,11 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data) ...@@ -489,6 +484,11 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
if (error) if (error)
goto err; goto err;
/* Set up the framebuffer device */
error = picolcd_init_framebuffer(data);
if (error)
goto err;
/* Setup the LED class devices */ /* Setup the LED class devices */
error = picolcd_init_leds(data, picolcd_out_report(REPORT_LED_STATE, hdev)); error = picolcd_init_leds(data, picolcd_out_report(REPORT_LED_STATE, hdev));
if (error) if (error)
...@@ -502,9 +502,9 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data) ...@@ -502,9 +502,9 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
return 0; return 0;
err: err:
picolcd_exit_leds(data); picolcd_exit_leds(data);
picolcd_exit_framebuffer(data);
picolcd_exit_backlight(data); picolcd_exit_backlight(data);
picolcd_exit_lcd(data); picolcd_exit_lcd(data);
picolcd_exit_framebuffer(data);
picolcd_exit_cir(data); picolcd_exit_cir(data);
picolcd_exit_keys(data); picolcd_exit_keys(data);
return error; return error;
...@@ -623,9 +623,9 @@ static void picolcd_remove(struct hid_device *hdev) ...@@ -623,9 +623,9 @@ static void picolcd_remove(struct hid_device *hdev)
/* Cleanup LED */ /* Cleanup LED */
picolcd_exit_leds(data); picolcd_exit_leds(data);
/* Clean up the framebuffer */ /* Clean up the framebuffer */
picolcd_exit_framebuffer(data);
picolcd_exit_backlight(data); picolcd_exit_backlight(data);
picolcd_exit_lcd(data); picolcd_exit_lcd(data);
picolcd_exit_framebuffer(data);
/* Cleanup input */ /* Cleanup input */
picolcd_exit_cir(data); picolcd_exit_cir(data);
picolcd_exit_keys(data); picolcd_exit_keys(data);
......
...@@ -493,6 +493,12 @@ int picolcd_init_framebuffer(struct picolcd_data *data) ...@@ -493,6 +493,12 @@ int picolcd_init_framebuffer(struct picolcd_data *data)
info->fix = picolcdfb_fix; info->fix = picolcdfb_fix;
info->fix.smem_len = PICOLCDFB_SIZE*8; 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; fbdata = info->par;
spin_lock_init(&fbdata->lock); spin_lock_init(&fbdata->lock);
fbdata->picolcd = data; fbdata->picolcd = data;
......
...@@ -46,7 +46,7 @@ static int picolcd_check_lcd_fb(struct lcd_device *ldev, struct fb_info *fb) ...@@ -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)); 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, .get_contrast = picolcd_get_contrast,
.set_contrast = picolcd_set_contrast, .set_contrast = picolcd_set_contrast,
.check_fb = picolcd_check_lcd_fb, .check_fb = picolcd_check_lcd_fb,
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/fb.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/mfd/aat2870.h> #include <linux/mfd/aat2870.h>
...@@ -90,15 +89,9 @@ static int aat2870_bl_update_status(struct backlight_device *bd) ...@@ -90,15 +89,9 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
return 0; 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 = { static const struct backlight_ops aat2870_bl_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = aat2870_bl_update_status, .update_status = aat2870_bl_update_status,
.check_fb = aat2870_bl_check_fb,
}; };
static int aat2870_bl_probe(struct platform_device *pdev) static int aat2870_bl_probe(struct platform_device *pdev)
......
...@@ -427,7 +427,7 @@ static int ams369fg06_set_brightness(struct backlight_device *bd) ...@@ -427,7 +427,7 @@ static int ams369fg06_set_brightness(struct backlight_device *bd)
return ret; return ret;
} }
static struct lcd_ops ams369fg06_lcd_ops = { static const struct lcd_ops ams369fg06_lcd_ops = {
.get_power = ams369fg06_get_power, .get_power = ams369fg06_get_power,
.set_power = ams369fg06_set_power, .set_power = ams369fg06_set_power,
}; };
......
...@@ -98,7 +98,9 @@ static int fb_notifier_callback(struct notifier_block *self, ...@@ -98,7 +98,9 @@ static int fb_notifier_callback(struct notifier_block *self,
{ {
struct backlight_device *bd; struct backlight_device *bd;
struct fb_event *evdata = data; 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; int fb_blank = 0;
/* If we aren't interested in this event, skip it immediately ... */ /* If we aren't interested in this event, skip it immediately ... */
...@@ -110,7 +112,9 @@ static int fb_notifier_callback(struct notifier_block *self, ...@@ -110,7 +112,9 @@ static int fb_notifier_callback(struct notifier_block *self,
if (!bd->ops) if (!bd->ops)
goto out; 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; goto out;
fb_blank = *(int *)evdata->data; fb_blank = *(int *)evdata->data;
......
...@@ -99,18 +99,18 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) ...@@ -99,18 +99,18 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight)
return 0; return 0;
} }
static int bd6107_backlight_check_fb(struct backlight_device *backlight, static bool bd6107_backlight_controls_device(struct backlight_device *backlight,
struct fb_info *info) struct device *display_dev)
{ {
struct bd6107 *bd = bl_get_data(backlight); 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 = { static const struct backlight_ops bd6107_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = bd6107_backlight_update_status, .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) static int bd6107_probe(struct i2c_client *client)
......
...@@ -380,7 +380,7 @@ static int corgi_lcd_get_power(struct lcd_device *ld) ...@@ -380,7 +380,7 @@ static int corgi_lcd_get_power(struct lcd_device *ld)
return lcd->power; return lcd->power;
} }
static struct lcd_ops corgi_lcd_ops = { static const struct lcd_ops corgi_lcd_ops = {
.get_power = corgi_lcd_get_power, .get_power = corgi_lcd_get_power,
.set_power = corgi_lcd_set_power, .set_power = corgi_lcd_set_power,
.set_mode = corgi_lcd_set_mode, .set_mode = corgi_lcd_set_mode,
......
...@@ -30,18 +30,18 @@ static int gpio_backlight_update_status(struct backlight_device *bl) ...@@ -30,18 +30,18 @@ static int gpio_backlight_update_status(struct backlight_device *bl)
return 0; return 0;
} }
static int gpio_backlight_check_fb(struct backlight_device *bl, static bool gpio_backlight_controls_device(struct backlight_device *bl,
struct fb_info *info) struct device *display_dev)
{ {
struct gpio_backlight *gbl = bl_get_data(bl); 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 = { static const struct backlight_ops gpio_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = gpio_backlight_update_status, .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) static int gpio_backlight_probe(struct platform_device *pdev)
......
...@@ -559,7 +559,7 @@ static int hx8357_get_power(struct lcd_device *lcdev) ...@@ -559,7 +559,7 @@ static int hx8357_get_power(struct lcd_device *lcdev)
return lcd->state; return lcd->state;
} }
static struct lcd_ops hx8357_ops = { static const struct lcd_ops hx8357_ops = {
.set_power = hx8357_set_power, .set_power = hx8357_set_power,
.get_power = hx8357_get_power, .get_power = hx8357_get_power,
}; };
......
...@@ -472,7 +472,7 @@ static int ili922x_get_power(struct lcd_device *ld) ...@@ -472,7 +472,7 @@ static int ili922x_get_power(struct lcd_device *ld)
return ili->power; return ili->power;
} }
static struct lcd_ops ili922x_ops = { static const struct lcd_ops ili922x_ops = {
.get_power = ili922x_get_power, .get_power = ili922x_get_power,
.set_power = ili922x_set_power, .set_power = ili922x_set_power,
}; };
......
...@@ -161,7 +161,7 @@ static int ili9320_get_power(struct lcd_device *ld) ...@@ -161,7 +161,7 @@ static int ili9320_get_power(struct lcd_device *ld)
return lcd->power; return lcd->power;
} }
static struct lcd_ops ili9320_ops = { static const struct lcd_ops ili9320_ops = {
.get_power = ili9320_get_power, .get_power = ili9320_get_power,
.set_power = ili9320_set_power, .set_power = ili9320_set_power,
}; };
......
...@@ -81,7 +81,7 @@ static int jornada_lcd_set_power(struct lcd_device *ld, int power) ...@@ -81,7 +81,7 @@ static int jornada_lcd_set_power(struct lcd_device *ld, int power)
return 0; return 0;
} }
static struct lcd_ops jornada_lcd_props = { static const struct lcd_ops jornada_lcd_props = {
.get_contrast = jornada_lcd_get_contrast, .get_contrast = jornada_lcd_get_contrast,
.set_contrast = jornada_lcd_set_contrast, .set_contrast = jornada_lcd_set_contrast,
.get_power = jornada_lcd_get_power, .get_power = jornada_lcd_get_power,
......
...@@ -158,7 +158,7 @@ static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power) ...@@ -158,7 +158,7 @@ static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power)
return 0; return 0;
} }
static struct lcd_ops l4f_ops = { static const struct lcd_ops l4f_ops = {
.set_power = l4f00242t03_lcd_power_set, .set_power = l4f00242t03_lcd_power_set,
.get_power = l4f00242t03_lcd_power_get, .get_power = l4f00242t03_lcd_power_get,
}; };
......
...@@ -188,7 +188,7 @@ ATTRIBUTE_GROUPS(lcd_device); ...@@ -188,7 +188,7 @@ ATTRIBUTE_GROUPS(lcd_device);
* or a pointer to the newly allocated device. * or a pointer to the newly allocated device.
*/ */
struct lcd_device *lcd_device_register(const char *name, struct device *parent, 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; struct lcd_device *new_ld;
int rc; int rc;
...@@ -276,7 +276,7 @@ static int devm_lcd_device_match(struct device *dev, void *res, void *data) ...@@ -276,7 +276,7 @@ static int devm_lcd_device_match(struct device *dev, void *res, void *data)
*/ */
struct lcd_device *devm_lcd_device_register(struct device *dev, struct lcd_device *devm_lcd_device_register(struct device *dev,
const char *name, struct device *parent, const char *name, struct device *parent,
void *devdata, struct lcd_ops *ops) void *devdata, const struct lcd_ops *ops)
{ {
struct lcd_device **ptr, *lcd; struct lcd_device **ptr, *lcd;
......
...@@ -139,7 +139,7 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power) ...@@ -139,7 +139,7 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power)
return 0; return 0;
} }
static struct lcd_ops lms_ops = { static const struct lcd_ops lms_ops = {
.set_power = lms283gf05_power_set, .set_power = lms283gf05_power_set,
.get_power = NULL, .get_power = NULL,
}; };
......
...@@ -304,7 +304,7 @@ static int lms501kf03_set_power(struct lcd_device *ld, int power) ...@@ -304,7 +304,7 @@ static int lms501kf03_set_power(struct lcd_device *ld, int power)
return lms501kf03_power(lcd, 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, .get_power = lms501kf03_get_power,
.set_power = lms501kf03_set_power, .set_power = lms501kf03_set_power,
}; };
......
...@@ -217,7 +217,7 @@ static int ltv350qv_get_power(struct lcd_device *ld) ...@@ -217,7 +217,7 @@ static int ltv350qv_get_power(struct lcd_device *ld)
return lcd->power; return lcd->power;
} }
static struct lcd_ops ltv_ops = { static const struct lcd_ops ltv_ops = {
.get_power = ltv350qv_get_power, .get_power = ltv350qv_get_power,
.set_power = ltv350qv_set_power, .set_power = ltv350qv_set_power,
}; };
......
...@@ -62,18 +62,18 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight) ...@@ -62,18 +62,18 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight)
return 0; return 0;
} }
static int lv5207lp_backlight_check_fb(struct backlight_device *backlight, static bool lv5207lp_backlight_controls_device(struct backlight_device *backlight,
struct fb_info *info) struct device *display_dev)
{ {
struct lv5207lp *lv = bl_get_data(backlight); 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 = { static const struct backlight_ops lv5207lp_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = lv5207lp_backlight_update_status, .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) static int lv5207lp_probe(struct i2c_client *client)
......
...@@ -205,7 +205,7 @@ static int otm3225a_get_power(struct lcd_device *ld) ...@@ -205,7 +205,7 @@ static int otm3225a_get_power(struct lcd_device *ld)
return dd->power; return dd->power;
} }
static struct lcd_ops otm3225a_ops = { static const struct lcd_ops otm3225a_ops = {
.set_power = otm3225a_set_power, .set_power = otm3225a_set_power,
.get_power = otm3225a_get_power, .get_power = otm3225a_get_power,
}; };
......
...@@ -62,7 +62,7 @@ static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info) ...@@ -62,7 +62,7 @@ static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info)
return plcd->us->parent == info->device; 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, .get_power = platform_lcd_get_power,
.set_power = platform_lcd_set_power, .set_power = platform_lcd_set_power,
.check_fb = platform_lcd_match, .check_fb = platform_lcd_match,
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/fb.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/pwm.h> #include <linux/pwm.h>
...@@ -34,7 +33,6 @@ struct pwm_bl_data { ...@@ -34,7 +33,6 @@ struct pwm_bl_data {
int brightness); int brightness);
void (*notify_after)(struct device *, void (*notify_after)(struct device *,
int brightness); int brightness);
int (*check_fb)(struct device *, struct fb_info *);
void (*exit)(struct device *); void (*exit)(struct device *);
}; };
...@@ -129,17 +127,8 @@ static int pwm_backlight_update_status(struct backlight_device *bl) ...@@ -129,17 +127,8 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
return 0; 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 = { static const struct backlight_ops pwm_backlight_ops = {
.update_status = pwm_backlight_update_status, .update_status = pwm_backlight_update_status,
.check_fb = pwm_backlight_check_fb,
}; };
#ifdef CONFIG_OF #ifdef CONFIG_OF
...@@ -482,7 +471,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -482,7 +471,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->notify = data->notify; pb->notify = data->notify;
pb->notify_after = data->notify_after; pb->notify_after = data->notify_after;
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->enabled = false;
......
...@@ -322,7 +322,7 @@ static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m) ...@@ -322,7 +322,7 @@ static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m)
return lcd->adj_mode(lcd, mode); return lcd->adj_mode(lcd, mode);
} }
static struct lcd_ops tdo24m_ops = { static const struct lcd_ops tdo24m_ops = {
.get_power = tdo24m_get_power, .get_power = tdo24m_get_power,
.set_power = tdo24m_set_power, .set_power = tdo24m_set_power,
.set_mode = tdo24m_set_mode, .set_mode = tdo24m_set_mode,
......
...@@ -197,7 +197,7 @@ static int clps711x_lcd_set_power(struct lcd_device *lcddev, int blank) ...@@ -197,7 +197,7 @@ static int clps711x_lcd_set_power(struct lcd_device *lcddev, int blank)
return 0; return 0;
} }
static struct lcd_ops clps711x_lcd_ops = { static const struct lcd_ops clps711x_lcd_ops = {
.check_fb = clps711x_lcd_check_fb, .check_fb = clps711x_lcd_check_fb,
.get_power = clps711x_lcd_get_power, .get_power = clps711x_lcd_get_power,
.set_power = clps711x_lcd_set_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) ...@@ -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); mutex_unlock(&fb_info->bl_curve_mutex);
} }
EXPORT_SYMBOL_GPL(fb_bl_default_curve); 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 #endif
...@@ -857,7 +857,7 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power) ...@@ -857,7 +857,7 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
return 0; return 0;
} }
static struct lcd_ops imxfb_lcd_ops = { static const struct lcd_ops imxfb_lcd_ops = {
.check_fb = imxfb_lcd_check_fb, .check_fb = imxfb_lcd_check_fb,
.get_contrast = imxfb_lcd_get_contrast, .get_contrast = imxfb_lcd_get_contrast,
.set_contrast = imxfb_lcd_set_contrast, .set_contrast = imxfb_lcd_set_contrast,
......
...@@ -76,7 +76,7 @@ static int ams_delta_lcd_get_contrast(struct lcd_device *dev) ...@@ -76,7 +76,7 @@ static int ams_delta_lcd_get_contrast(struct lcd_device *dev)
return ams_delta_lcd & AMS_DELTA_MAX_CONTRAST; 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, .get_power = ams_delta_lcd_get_power,
.set_power = ams_delta_lcd_set_power, .set_power = ams_delta_lcd_set_power,
.get_contrast = ams_delta_lcd_get_contrast, .get_contrast = ams_delta_lcd_get_contrast,
......
...@@ -2140,17 +2140,10 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev) ...@@ -2140,17 +2140,10 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
return ch->bl_brightness; 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 = { static const struct backlight_ops sh_mobile_lcdc_bl_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = sh_mobile_lcdc_update_bl, .update_status = sh_mobile_lcdc_update_bl,
.get_brightness = sh_mobile_lcdc_get_brightness, .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, 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) ...@@ -530,17 +530,10 @@ static int ssd1307fb_get_brightness(struct backlight_device *bdev)
return par->contrast; 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 = { static const struct backlight_ops ssd1307fb_bl_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = ssd1307fb_update_bl, .update_status = ssd1307fb_update_bl,
.get_brightness = ssd1307fb_get_brightness, .get_brightness = ssd1307fb_get_brightness,
.check_fb = ssd1307fb_check_fb,
}; };
static struct ssd1307fb_deviceinfo ssd1307fb_ssd1305_deviceinfo = { static struct ssd1307fb_deviceinfo ssd1307fb_ssd1305_deviceinfo = {
...@@ -594,7 +587,6 @@ static int ssd1307fb_probe(struct i2c_client *client) ...@@ -594,7 +587,6 @@ static int ssd1307fb_probe(struct i2c_client *client)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct backlight_device *bl; struct backlight_device *bl;
char bl_name[12];
struct fb_info *info; struct fb_info *info;
struct fb_deferred_io *ssd1307fb_defio; struct fb_deferred_io *ssd1307fb_defio;
u32 vmem_size; u32 vmem_size;
...@@ -733,31 +725,30 @@ static int ssd1307fb_probe(struct i2c_client *client) ...@@ -733,31 +725,30 @@ static int ssd1307fb_probe(struct i2c_client *client)
if (ret) if (ret)
goto regulator_enable_error; goto regulator_enable_error;
ret = register_framebuffer(info); bl = backlight_device_register("ssd1307fb-bl", dev, par, &ssd1307fb_bl_ops,
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,
NULL); NULL);
if (IS_ERR(bl)) { if (IS_ERR(bl)) {
ret = PTR_ERR(bl); ret = PTR_ERR(bl);
dev_err(dev, "unable to register backlight device: %d\n", ret); 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.brightness = par->contrast;
bl->props.max_brightness = MAX_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); 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; return 0;
bl_init_error: fb_init_error:
unregister_framebuffer(info); backlight_device_unregister(bl);
panel_init_error: panel_init_error:
pwm_disable(par->pwm); pwm_disable(par->pwm);
pwm_put(par->pwm); pwm_put(par->pwm);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/types.h>
/** /**
* enum backlight_update_reason - what method was used to update backlight * enum backlight_update_reason - what method was used to update backlight
...@@ -110,7 +111,6 @@ enum backlight_scale { ...@@ -110,7 +111,6 @@ enum backlight_scale {
}; };
struct backlight_device; struct backlight_device;
struct fb_info;
/** /**
* struct backlight_ops - backlight operations * struct backlight_ops - backlight operations
...@@ -160,18 +160,18 @@ struct backlight_ops { ...@@ -160,18 +160,18 @@ struct backlight_ops {
int (*get_brightness)(struct backlight_device *); 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. * Check if the backlight controls the given display device. This
* This operation is optional and if not implemented it is assumed that the * operation is optional and if not implemented it is assumed that
* fbdev is always the one bound to the backlight. * the display is always the one controlled by the backlight.
* *
* RETURNS: * RETURNS:
* *
* If info is NULL or the info matches the fbdev bound to the backlight return true. * If display_dev is NULL or display_dev matches the device controlled by
* If info does not match the fbdev bound to the backlight return false. * 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);
}; };
/** /**
......
...@@ -738,6 +738,15 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); ...@@ -738,6 +738,15 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
extern void framebuffer_release(struct fb_info *info); 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); 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 */ /* fbmon.c */
#define FB_MAXTIMINGS 0 #define FB_MAXTIMINGS 0
#define FB_VSYNCTIMINGS 1 #define FB_VSYNCTIMINGS 1
......
...@@ -61,7 +61,7 @@ struct lcd_device { ...@@ -61,7 +61,7 @@ struct lcd_device {
points to something in the body of that driver, it is also invalid. */ points to something in the body of that driver, it is also invalid. */
struct mutex ops_lock; struct mutex ops_lock;
/* If this is NULL, the backing module is unloaded */ /* If this is NULL, the backing module is unloaded */
struct lcd_ops *ops; const struct lcd_ops *ops;
/* Serialise access to set_power method */ /* Serialise access to set_power method */
struct mutex update_lock; struct mutex update_lock;
/* The framebuffer notifier block */ /* The framebuffer notifier block */
...@@ -102,10 +102,10 @@ static inline void lcd_set_power(struct lcd_device *ld, int power) ...@@ -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, 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, extern struct lcd_device *devm_lcd_device_register(struct device *dev,
const char *name, struct device *parent, 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 lcd_device_unregister(struct lcd_device *ld);
extern void devm_lcd_device_unregister(struct device *dev, extern void devm_lcd_device_unregister(struct device *dev,
struct lcd_device *ld); struct lcd_device *ld);
......
...@@ -19,7 +19,6 @@ struct platform_pwm_backlight_data { ...@@ -19,7 +19,6 @@ struct platform_pwm_backlight_data {
int (*notify)(struct device *dev, int brightness); int (*notify)(struct device *dev, int brightness);
void (*notify_after)(struct device *dev, int brightness); void (*notify_after)(struct device *dev, int brightness);
void (*exit)(struct device *dev); void (*exit)(struct device *dev);
int (*check_fb)(struct device *dev, struct fb_info *info);
}; };
#endif #endif
...@@ -39,6 +39,7 @@ kgdb_arch ...@@ -39,6 +39,7 @@ kgdb_arch
kgdb_io kgdb_io
kobj_type kobj_type
kset_uevent_ops kset_uevent_ops
lcd_ops
lock_manager_operations lock_manager_operations
machine_desc machine_desc
microcode_ops 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