Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d3573c8 authored by Tomi Valkeinen's avatar Tomi Valkeinen
Browse files

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: default avatarJani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@nokia.com>
parent 823c8e4a
Loading
Loading
Loading
Loading
+38 −21
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <linux/mutex.h>

#include <plat/display.h>
#include <plat/nokia-dsi-panel.h>

/* DSI Virtual channel. Hardcoded for now. */
#define TCH 0
@@ -85,7 +86,6 @@ struct taal_data {
	bool mirror;

	bool te_enabled;
	bool use_ext_te;

	atomic_t do_update;
	struct {
@@ -107,6 +107,12 @@ struct taal_data {
	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 hw_guard_start(struct taal_data *td, int guard_msec)
@@ -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 taal_data *td = dev_get_drvdata(&dssdev->dev);
	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
	int r;
	int level;

@@ -310,10 +317,10 @@ static int taal_bl_update_status(struct backlight_device *dev)
			r = 0;
		}
	} else {
		if (!dssdev->set_backlight)
		if (!panel_data->set_backlight)
			r = -EINVAL;
		else
			r = dssdev->set_backlight(dssdev, level);
			r = panel_data->set_backlight(dssdev, level);
	}

	mutex_unlock(&td->lock);
@@ -503,16 +510,18 @@ static struct attribute_group taal_attr_group = {

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;

	gpio_set_value(dssdev->reset_gpio, 1);
	gpio_set_value(panel_data->reset_gpio, 1);
	udelay(10);
	/* reset the panel */
	gpio_set_value(dssdev->reset_gpio, 0);
	gpio_set_value(panel_data->reset_gpio, 0);
	/* assert reset for at least 10us */
	udelay(10);
	gpio_set_value(dssdev->reset_gpio, 1);
	gpio_set_value(panel_data->reset_gpio, 1);
	/* wait 5ms after releasing reset */
	msleep(5);
}
@@ -522,6 +531,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
	struct backlight_properties props;
	struct taal_data *td;
	struct backlight_device *bldev;
	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
	int r;

	const struct omap_video_timings taal_panel_timings = {
@@ -531,6 +541,11 @@ static int taal_probe(struct omap_dss_device *dssdev)

	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.timings = taal_panel_timings;
	dssdev->ctrl.pixel_size = 24;
@@ -561,7 +576,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
	/* if no platform set_backlight() defined, presume DSI backlight
	 * control */
	memset(&props, 0, sizeof(struct backlight_properties));
	if (!dssdev->set_backlight)
	if (!panel_data->set_backlight)
		td->use_dsi_bl = true;

	if (td->use_dsi_bl)
@@ -586,8 +601,8 @@ static int taal_probe(struct omap_dss_device *dssdev)

	taal_bl_update_status(bldev);

	if (dssdev->phy.dsi.ext_te) {
		int gpio = dssdev->phy.dsi.ext_te_gpio;
	if (panel_data->use_ext_te) {
		int gpio = panel_data->ext_te_gpio;

		r = gpio_request(gpio, "taal irq");
		if (r) {
@@ -610,8 +625,6 @@ static int taal_probe(struct omap_dss_device *dssdev)
		INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work,
					taal_te_timeout_work_callback);

		td->use_ext_te = true;

		dev_dbg(&dssdev->dev, "Using GPIO TE\n");
	}

@@ -623,11 +636,11 @@ static int taal_probe(struct omap_dss_device *dssdev)

	return 0;
err_sysfs:
	if (td->use_ext_te)
		free_irq(gpio_to_irq(dssdev->phy.dsi.ext_te_gpio), dssdev);
	if (panel_data->use_ext_te)
		free_irq(gpio_to_irq(panel_data->ext_te_gpio), dssdev);
err_irq:
	if (td->use_ext_te)
		gpio_free(dssdev->phy.dsi.ext_te_gpio);
	if (panel_data->use_ext_te)
		gpio_free(panel_data->ext_te_gpio);
err_gpio:
	backlight_device_unregister(bldev);
err_bl:
@@ -641,14 +654,15 @@ static int taal_probe(struct omap_dss_device *dssdev)
static void taal_remove(struct omap_dss_device *dssdev)
{
	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
	struct backlight_device *bldev;

	dev_dbg(&dssdev->dev, "remove\n");

	sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group);

	if (td->use_ext_te) {
		int gpio = dssdev->phy.dsi.ext_te_gpio;
	if (panel_data->use_ext_te) {
		int gpio = panel_data->ext_te_gpio;
		free_irq(gpio_to_irq(gpio), dssdev);
		gpio_free(gpio);
	}
@@ -958,6 +972,7 @@ static int taal_update(struct omap_dss_device *dssdev,
				    u16 x, u16 y, u16 w, u16 h)
{
	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
	int r;

	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,
	if (r)
		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.y = y;
		td->update_region.w = w;
@@ -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)
{
	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
	int r;

	if (enable)
@@ -1028,7 +1044,7 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
	else
		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);

	/* 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)
	struct taal_data *td = container_of(work, struct taal_data,
			esd_work.work);
	struct omap_dss_device *dssdev = td->dssdev;
	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
	u8 state1, state2;
	int r;

@@ -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
	 * 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);
		if (r)
			goto err;