提交 8d3573c8 编写于 作者: T Tomi Valkeinen

OMAP: DSS2: Taal: Use Nokia DSI panel data

Get board specific information from the Nokia DSI panel data structure
instead of the DSS.
Signed-off-by: NJani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: NTomi Valkeinen <tomi.valkeinen@nokia.com>
上级 823c8e4a
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <plat/display.h> #include <plat/display.h>
#include <plat/nokia-dsi-panel.h>
/* DSI Virtual channel. Hardcoded for now. */ /* DSI Virtual channel. Hardcoded for now. */
#define TCH 0 #define TCH 0
...@@ -85,7 +86,6 @@ struct taal_data { ...@@ -85,7 +86,6 @@ struct taal_data {
bool mirror; bool mirror;
bool te_enabled; bool te_enabled;
bool use_ext_te;
atomic_t do_update; atomic_t do_update;
struct { struct {
...@@ -107,6 +107,12 @@ struct taal_data { ...@@ -107,6 +107,12 @@ struct taal_data {
struct delayed_work esd_work; struct delayed_work esd_work;
}; };
static inline struct nokia_dsi_panel_data
*get_panel_data(const struct omap_dss_device *dssdev)
{
return (struct nokia_dsi_panel_data *) dssdev->data;
}
static void taal_esd_work(struct work_struct *work); static void taal_esd_work(struct work_struct *work);
static void hw_guard_start(struct taal_data *td, int guard_msec) static void hw_guard_start(struct taal_data *td, int guard_msec)
...@@ -288,6 +294,7 @@ static int taal_bl_update_status(struct backlight_device *dev) ...@@ -288,6 +294,7 @@ 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;
...@@ -310,10 +317,10 @@ static int taal_bl_update_status(struct backlight_device *dev) ...@@ -310,10 +317,10 @@ static int taal_bl_update_status(struct backlight_device *dev)
r = 0; r = 0;
} }
} else { } else {
if (!dssdev->set_backlight) if (!panel_data->set_backlight)
r = -EINVAL; r = -EINVAL;
else else
r = dssdev->set_backlight(dssdev, level); r = panel_data->set_backlight(dssdev, level);
} }
mutex_unlock(&td->lock); mutex_unlock(&td->lock);
...@@ -503,16 +510,18 @@ static struct attribute_group taal_attr_group = { ...@@ -503,16 +510,18 @@ static struct attribute_group taal_attr_group = {
static void taal_hw_reset(struct omap_dss_device *dssdev) static void taal_hw_reset(struct omap_dss_device *dssdev)
{ {
if (dssdev->reset_gpio == -1) struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
if (panel_data->reset_gpio == -1)
return; return;
gpio_set_value(dssdev->reset_gpio, 1); gpio_set_value(panel_data->reset_gpio, 1);
udelay(10); udelay(10);
/* reset the panel */ /* reset the panel */
gpio_set_value(dssdev->reset_gpio, 0); gpio_set_value(panel_data->reset_gpio, 0);
/* assert reset for at least 10us */ /* assert reset for at least 10us */
udelay(10); udelay(10);
gpio_set_value(dssdev->reset_gpio, 1); gpio_set_value(panel_data->reset_gpio, 1);
/* wait 5ms after releasing reset */ /* wait 5ms after releasing reset */
msleep(5); msleep(5);
} }
...@@ -522,6 +531,7 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -522,6 +531,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;
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r; int r;
const struct omap_video_timings taal_panel_timings = { const struct omap_video_timings taal_panel_timings = {
...@@ -531,6 +541,11 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -531,6 +541,11 @@ static int taal_probe(struct omap_dss_device *dssdev)
dev_dbg(&dssdev->dev, "probe\n"); dev_dbg(&dssdev->dev, "probe\n");
if (!panel_data || !panel_data->name) {
r = -EINVAL;
goto err;
}
dssdev->panel.config = OMAP_DSS_LCD_TFT; dssdev->panel.config = OMAP_DSS_LCD_TFT;
dssdev->panel.timings = taal_panel_timings; dssdev->panel.timings = taal_panel_timings;
dssdev->ctrl.pixel_size = 24; dssdev->ctrl.pixel_size = 24;
...@@ -561,7 +576,7 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -561,7 +576,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
/* if no platform set_backlight() defined, presume DSI backlight /* if no platform set_backlight() defined, presume DSI backlight
* control */ * control */
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
if (!dssdev->set_backlight) if (!panel_data->set_backlight)
td->use_dsi_bl = true; td->use_dsi_bl = true;
if (td->use_dsi_bl) if (td->use_dsi_bl)
...@@ -586,8 +601,8 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -586,8 +601,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
taal_bl_update_status(bldev); taal_bl_update_status(bldev);
if (dssdev->phy.dsi.ext_te) { if (panel_data->use_ext_te) {
int gpio = dssdev->phy.dsi.ext_te_gpio; int gpio = panel_data->ext_te_gpio;
r = gpio_request(gpio, "taal irq"); r = gpio_request(gpio, "taal irq");
if (r) { if (r) {
...@@ -610,8 +625,6 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -610,8 +625,6 @@ static int taal_probe(struct omap_dss_device *dssdev)
INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work, INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work,
taal_te_timeout_work_callback); taal_te_timeout_work_callback);
td->use_ext_te = true;
dev_dbg(&dssdev->dev, "Using GPIO TE\n"); dev_dbg(&dssdev->dev, "Using GPIO TE\n");
} }
...@@ -623,11 +636,11 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -623,11 +636,11 @@ static int taal_probe(struct omap_dss_device *dssdev)
return 0; return 0;
err_sysfs: err_sysfs:
if (td->use_ext_te) if (panel_data->use_ext_te)
free_irq(gpio_to_irq(dssdev->phy.dsi.ext_te_gpio), dssdev); free_irq(gpio_to_irq(panel_data->ext_te_gpio), dssdev);
err_irq: err_irq:
if (td->use_ext_te) if (panel_data->use_ext_te)
gpio_free(dssdev->phy.dsi.ext_te_gpio); gpio_free(panel_data->ext_te_gpio);
err_gpio: err_gpio:
backlight_device_unregister(bldev); backlight_device_unregister(bldev);
err_bl: err_bl:
...@@ -641,14 +654,15 @@ static int taal_probe(struct omap_dss_device *dssdev) ...@@ -641,14 +654,15 @@ static int taal_probe(struct omap_dss_device *dssdev)
static void taal_remove(struct omap_dss_device *dssdev) static void taal_remove(struct omap_dss_device *dssdev)
{ {
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);
struct backlight_device *bldev; struct backlight_device *bldev;
dev_dbg(&dssdev->dev, "remove\n"); dev_dbg(&dssdev->dev, "remove\n");
sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group); sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group);
if (td->use_ext_te) { if (panel_data->use_ext_te) {
int gpio = dssdev->phy.dsi.ext_te_gpio; int gpio = panel_data->ext_te_gpio;
free_irq(gpio_to_irq(gpio), dssdev); free_irq(gpio_to_irq(gpio), dssdev);
gpio_free(gpio); gpio_free(gpio);
} }
...@@ -958,6 +972,7 @@ static int taal_update(struct omap_dss_device *dssdev, ...@@ -958,6 +972,7 @@ static int taal_update(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h) u16 x, u16 y, u16 w, u16 h)
{ {
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;
dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h); dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
...@@ -978,7 +993,7 @@ static int taal_update(struct omap_dss_device *dssdev, ...@@ -978,7 +993,7 @@ static int taal_update(struct omap_dss_device *dssdev,
if (r) if (r)
goto err; goto err;
if (td->te_enabled && td->use_ext_te) { if (td->te_enabled && panel_data->use_ext_te) {
td->update_region.x = x; td->update_region.x = x;
td->update_region.y = y; td->update_region.y = y;
td->update_region.w = w; td->update_region.w = w;
...@@ -1021,6 +1036,7 @@ static int taal_sync(struct omap_dss_device *dssdev) ...@@ -1021,6 +1036,7 @@ static int taal_sync(struct omap_dss_device *dssdev)
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
{ {
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r; int r;
if (enable) if (enable)
...@@ -1028,7 +1044,7 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) ...@@ -1028,7 +1044,7 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
else else
r = taal_dcs_write_0(DCS_TEAR_OFF); r = taal_dcs_write_0(DCS_TEAR_OFF);
if (!td->use_ext_te) if (!panel_data->use_ext_te)
omapdss_dsi_enable_te(dssdev, enable); omapdss_dsi_enable_te(dssdev, enable);
/* XXX for some reason, DSI TE breaks if we don't wait here. /* XXX for some reason, DSI TE breaks if we don't wait here.
...@@ -1272,6 +1288,7 @@ static void taal_esd_work(struct work_struct *work) ...@@ -1272,6 +1288,7 @@ static void taal_esd_work(struct work_struct *work)
struct taal_data *td = container_of(work, struct taal_data, struct taal_data *td = container_of(work, struct taal_data,
esd_work.work); esd_work.work);
struct omap_dss_device *dssdev = td->dssdev; struct omap_dss_device *dssdev = td->dssdev;
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
u8 state1, state2; u8 state1, state2;
int r; int r;
...@@ -1312,7 +1329,7 @@ static void taal_esd_work(struct work_struct *work) ...@@ -1312,7 +1329,7 @@ static void taal_esd_work(struct work_struct *work)
} }
/* Self-diagnostics result is also shown on TE GPIO line. We need /* Self-diagnostics result is also shown on TE GPIO line. We need
* to re-enable TE after self diagnostics */ * to re-enable TE after self diagnostics */
if (td->use_ext_te && td->te_enabled) { if (td->te_enabled && panel_data->use_ext_te) {
r = taal_dcs_write_1(DCS_TEAR_ON, 0); r = taal_dcs_write_1(DCS_TEAR_ON, 0);
if (r) if (r)
goto err; goto err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册