Commit bb36dbfd authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAPDSS: Taal: remove external backlight support

Taal panel driver supports two kinds of backlight control: 1) using DSI
commands sent to the panel to control the backlight, 2) calling function
pointers going to the board file to control the backlight.

The second option is a bit hacky, and will no longer be needed when the
PWM driver supports the backlight features. After that we can use the
standard PWM backlight driver.

This patch removes the second backlight control mechanism, and adds a
boolean field, use_dsi_backlight, to nokia_dsi_panel_data which the
board file can use to inform whether the panel driver should use DSI
commands to control the backlight.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 0373cac6
...@@ -208,8 +208,6 @@ struct taal_data { ...@@ -208,8 +208,6 @@ struct taal_data {
struct delayed_work te_timeout_work; struct delayed_work te_timeout_work;
bool use_dsi_bl;
bool cabc_broken; bool cabc_broken;
unsigned cabc_mode; unsigned cabc_mode;
...@@ -541,7 +539,6 @@ static int taal_bl_update_status(struct backlight_device *dev) ...@@ -541,7 +539,6 @@ static int taal_bl_update_status(struct backlight_device *dev)
{ {
struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev); struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev);
struct taal_data *td = dev_get_drvdata(&dssdev->dev); struct taal_data *td = dev_get_drvdata(&dssdev->dev);
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r; int r;
int level; int level;
...@@ -555,23 +552,16 @@ static int taal_bl_update_status(struct backlight_device *dev) ...@@ -555,23 +552,16 @@ static int taal_bl_update_status(struct backlight_device *dev)
mutex_lock(&td->lock); mutex_lock(&td->lock);
if (td->use_dsi_bl) { if (td->enabled) {
if (td->enabled) { dsi_bus_lock(dssdev);
dsi_bus_lock(dssdev);
r = taal_wake_up(dssdev); r = taal_wake_up(dssdev);
if (!r) if (!r)
r = taal_dcs_write_1(td, DCS_BRIGHTNESS, level); r = taal_dcs_write_1(td, DCS_BRIGHTNESS, level);
dsi_bus_unlock(dssdev); dsi_bus_unlock(dssdev);
} else {
r = 0;
}
} else { } else {
if (!panel_data->set_backlight) r = 0;
r = -EINVAL;
else
r = panel_data->set_backlight(dssdev, level);
} }
mutex_unlock(&td->lock); mutex_unlock(&td->lock);
...@@ -950,7 +940,7 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -950,7 +940,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
{ {
struct backlight_properties props; struct backlight_properties props;
struct taal_data *td; struct taal_data *td;
struct backlight_device *bldev; struct backlight_device *bldev = NULL;
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
struct panel_config *panel_config = NULL; struct panel_config *panel_config = NULL;
int r, i; int r, i;
...@@ -1011,35 +1001,26 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -1011,35 +1001,26 @@ static int taal_probe(struct omap_dss_device *dssdev)
taal_hw_reset(dssdev); taal_hw_reset(dssdev);
/* if no platform set_backlight() defined, presume DSI backlight if (panel_data->use_dsi_backlight) {
* control */ memset(&props, 0, sizeof(struct backlight_properties));
memset(&props, 0, sizeof(struct backlight_properties));
if (!panel_data->set_backlight)
td->use_dsi_bl = true;
if (td->use_dsi_bl)
props.max_brightness = 255; props.max_brightness = 255;
else
props.max_brightness = 127;
props.type = BACKLIGHT_RAW;
bldev = backlight_device_register(dev_name(&dssdev->dev), &dssdev->dev,
dssdev, &taal_bl_ops, &props);
if (IS_ERR(bldev)) {
r = PTR_ERR(bldev);
goto err_bl;
}
td->bldev = bldev; props.type = BACKLIGHT_RAW;
bldev = backlight_device_register(dev_name(&dssdev->dev),
&dssdev->dev, dssdev, &taal_bl_ops, &props);
if (IS_ERR(bldev)) {
r = PTR_ERR(bldev);
goto err_bl;
}
td->bldev = bldev;
bldev->props.fb_blank = FB_BLANK_UNBLANK; bldev->props.fb_blank = FB_BLANK_UNBLANK;
bldev->props.power = FB_BLANK_UNBLANK; bldev->props.power = FB_BLANK_UNBLANK;
if (td->use_dsi_bl)
bldev->props.brightness = 255; bldev->props.brightness = 255;
else
bldev->props.brightness = 127;
taal_bl_update_status(bldev); taal_bl_update_status(bldev);
}
if (panel_data->use_ext_te) { if (panel_data->use_ext_te) {
int gpio = panel_data->ext_te_gpio; int gpio = panel_data->ext_te_gpio;
...@@ -1097,7 +1078,8 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -1097,7 +1078,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
if (panel_data->use_ext_te) if (panel_data->use_ext_te)
gpio_free(panel_data->ext_te_gpio); gpio_free(panel_data->ext_te_gpio);
err_gpio: err_gpio:
backlight_device_unregister(bldev); if (bldev != NULL)
backlight_device_unregister(bldev);
err_bl: err_bl:
destroy_workqueue(td->workqueue); destroy_workqueue(td->workqueue);
err_wq: err_wq:
...@@ -1126,9 +1108,11 @@ static void __exit taal_remove(struct omap_dss_device *dssdev) ...@@ -1126,9 +1108,11 @@ static void __exit taal_remove(struct omap_dss_device *dssdev)
} }
bldev = td->bldev; bldev = td->bldev;
bldev->props.power = FB_BLANK_POWERDOWN; if (bldev != NULL) {
taal_bl_update_status(bldev); bldev->props.power = FB_BLANK_POWERDOWN;
backlight_device_unregister(bldev); taal_bl_update_status(bldev);
backlight_device_unregister(bldev);
}
taal_cancel_ulps_work(dssdev); taal_cancel_ulps_work(dssdev);
taal_cancel_esd_work(dssdev); taal_cancel_esd_work(dssdev);
......
...@@ -10,9 +10,7 @@ struct omap_dss_device; ...@@ -10,9 +10,7 @@ struct omap_dss_device;
* @ext_te_gpio: external TE GPIO * @ext_te_gpio: external TE GPIO
* @esd_interval: interval of ESD checks, 0 = disabled (ms) * @esd_interval: interval of ESD checks, 0 = disabled (ms)
* @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
* @max_backlight_level: maximum backlight level * @use_dsi_backlight: true if panel uses DSI command to control backlight
* @set_backlight: pointer to backlight set function
* @get_backlight: pointer to backlight get function
*/ */
struct nokia_dsi_panel_data { struct nokia_dsi_panel_data {
const char *name; const char *name;
...@@ -25,9 +23,7 @@ struct nokia_dsi_panel_data { ...@@ -25,9 +23,7 @@ struct nokia_dsi_panel_data {
unsigned esd_interval; unsigned esd_interval;
unsigned ulps_timeout; unsigned ulps_timeout;
int max_backlight_level; bool use_dsi_backlight;
int (*set_backlight)(struct omap_dss_device *dssdev, int level);
int (*get_backlight)(struct omap_dss_device *dssdev);
}; };
#endif /* __OMAP_NOKIA_DSI_PANEL_H */ #endif /* __OMAP_NOKIA_DSI_PANEL_H */
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