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

Commit ecc8b370 authored by Tomi Valkeinen's avatar Tomi Valkeinen
Browse files

OMAPDSS: Add panel dev pointer to dssdev



We are about to remove the dss bus support, which also means that the
omap_dss_device won't be a real device anymore. This means that the
embedded "dev" struct needs to be removed from omap_dss_device.

After we've finished the removal of the dss bus, we see the following
changes:

- struct omap_dss_device won't be a real Linux device anymore, but more
  like a "display entity".
- struct omap_dss_driver won't be a Linux device driver, but "display
  entity ops".
- The panel devices/drivers won't be omapdss devices/drivers, but
  platform/i2c/spi/etc devices/drivers, whichever fits the control
  mechanism of the panel.
- The panel drivers will create omap_dss_device and omap_dss_driver,
  fill the required fields, and register the omap_dss_device to
  omapdss.
- omap_dss_device won't have an embedded dev struct anymore, but a
  dev pointer to the actual device that manages the omap_dss_device.

The model described above resembles the model that has been discussed
with CDF (common display framework).

For the duration of the conversion, we temporarily have two devs in the
dssdev, the old "old_dev", which is a full embedded device struct, and the
new "dev", which is a pointer to the device. "old_dev" will be removed
in the future.

For devices belonging to dss bus the dev is initialized to point to
old_dev. This way all the code can just use the dev, for both old and
new style panels.

Both the new and old style panel drivers work during the conversion, and
only after the dss bus support is removed will the old style panels stop
to compile.

Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 94140f0d
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
	int max_brightness, brightness;
	struct backlight_properties props;

	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dev_dbg(dssdev->dev, "%s\n", __func__);

	if (!panel_data)
		return -EINVAL;
@@ -519,7 +519,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
	dssdev->panel.timings = acx_panel_timings;

	if (gpio_is_valid(panel_data->reset_gpio)) {
		r = devm_gpio_request_one(&dssdev->dev, panel_data->reset_gpio,
		r = devm_gpio_request_one(dssdev->dev, panel_data->reset_gpio,
				GPIOF_OUT_INIT_LOW, "lcd reset");
		if (r)
			return r;
@@ -538,7 +538,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)

	r = panel_detect(md);
	if (r) {
		dev_err(&dssdev->dev, "%s panel detect error\n", __func__);
		dev_err(dssdev->dev, "%s panel detect error\n", __func__);
		if (!md->enabled && gpio_is_valid(panel_data->reset_gpio))
			gpio_set_value(panel_data->reset_gpio, 0);

@@ -593,7 +593,7 @@ static void acx_panel_remove(struct omap_dss_device *dssdev)
{
	struct acx565akm_device *md = &acx_dev;

	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dev_dbg(dssdev->dev, "%s\n", __func__);
	sysfs_remove_group(&md->bl_dev->dev.kobj, &bldev_attr_group);
	backlight_device_unregister(md->bl_dev);
	mutex_lock(&acx_dev.mutex);
@@ -607,7 +607,7 @@ static int acx_panel_power_on(struct omap_dss_device *dssdev)
	struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
	int r;

	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dev_dbg(dssdev->dev, "%s\n", __func__);

	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
		return 0;
@@ -667,7 +667,7 @@ static void acx_panel_power_off(struct omap_dss_device *dssdev)
	struct acx565akm_device *md = &acx_dev;
	struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);

	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dev_dbg(dssdev->dev, "%s\n", __func__);

	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
		return;
@@ -704,7 +704,7 @@ static int acx_panel_enable(struct omap_dss_device *dssdev)
{
	int r;

	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dev_dbg(dssdev->dev, "%s\n", __func__);
	r = acx_panel_power_on(dssdev);

	if (r)
@@ -716,7 +716,7 @@ static int acx_panel_enable(struct omap_dss_device *dssdev)

static void acx_panel_disable(struct omap_dss_device *dssdev)
{
	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dev_dbg(dssdev->dev, "%s\n", __func__);
	acx_panel_power_off(dssdev);
	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
+13 −13
Original line number Diff line number Diff line
@@ -536,7 +536,7 @@ static int generic_dpi_panel_power_on(struct omap_dss_device *dssdev)
{
	int r, i;
	struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
	struct panel_config *panel_config = drv_data->panel_config;

	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
@@ -567,7 +567,7 @@ static int generic_dpi_panel_power_on(struct omap_dss_device *dssdev)
static void generic_dpi_panel_power_off(struct omap_dss_device *dssdev)
{
	struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
	struct panel_config *panel_config = drv_data->panel_config;
	int i;

@@ -593,7 +593,7 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
	struct panel_drv_data *drv_data = NULL;
	int i, r;

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

	if (!panel_data || !panel_data->name)
		return -EINVAL;
@@ -609,7 +609,7 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
		return -EINVAL;

	for (i = 0; i < panel_data->num_gpios; ++i) {
		r = devm_gpio_request_one(&dssdev->dev, panel_data->gpios[i],
		r = devm_gpio_request_one(dssdev->dev, panel_data->gpios[i],
				panel_data->gpio_invert[i] ?
				GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
				"panel gpio");
@@ -619,7 +619,7 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)

	dssdev->panel.timings = panel_config->timings;

	drv_data = devm_kzalloc(&dssdev->dev, sizeof(*drv_data), GFP_KERNEL);
	drv_data = devm_kzalloc(dssdev->dev, sizeof(*drv_data), GFP_KERNEL);
	if (!drv_data)
		return -ENOMEM;

@@ -628,21 +628,21 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)

	mutex_init(&drv_data->lock);

	dev_set_drvdata(&dssdev->dev, drv_data);
	dev_set_drvdata(dssdev->dev, drv_data);

	return 0;
}

static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)
{
	dev_dbg(&dssdev->dev, "remove\n");
	dev_dbg(dssdev->dev, "remove\n");

	dev_set_drvdata(&dssdev->dev, NULL);
	dev_set_drvdata(dssdev->dev, NULL);
}

static int generic_dpi_panel_enable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
	int r;

	mutex_lock(&drv_data->lock);
@@ -660,7 +660,7 @@ static int generic_dpi_panel_enable(struct omap_dss_device *dssdev)

static void generic_dpi_panel_disable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);

	mutex_lock(&drv_data->lock);

@@ -674,7 +674,7 @@ static void generic_dpi_panel_disable(struct omap_dss_device *dssdev)
static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev,
		struct omap_video_timings *timings)
{
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);

	mutex_lock(&drv_data->lock);

@@ -688,7 +688,7 @@ static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev,
static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev,
		struct omap_video_timings *timings)
{
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);

	mutex_lock(&drv_data->lock);

@@ -700,7 +700,7 @@ static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev,
static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
		struct omap_video_timings *timings)
{
	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
	struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
	int r;

	mutex_lock(&drv_data->lock);
+5 −5
Original line number Diff line number Diff line
@@ -109,12 +109,12 @@ static int lb035q02_panel_probe(struct omap_dss_device *dssdev)

	dssdev->panel.timings = lb035q02_timings;

	ld = devm_kzalloc(&dssdev->dev, sizeof(*ld), GFP_KERNEL);
	ld = devm_kzalloc(dssdev->dev, sizeof(*ld), GFP_KERNEL);
	if (!ld)
		return -ENOMEM;

	for (i = 0; i < panel_data->num_gpios; ++i) {
		r = devm_gpio_request_one(&dssdev->dev, panel_data->gpios[i],
		r = devm_gpio_request_one(dssdev->dev, panel_data->gpios[i],
				panel_data->gpio_invert[i] ?
				GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
				"panel gpio");
@@ -123,7 +123,7 @@ static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
	}

	mutex_init(&ld->lock);
	dev_set_drvdata(&dssdev->dev, ld);
	dev_set_drvdata(dssdev->dev, ld);

	return 0;
}
@@ -134,7 +134,7 @@ static void lb035q02_panel_remove(struct omap_dss_device *dssdev)

static int lb035q02_panel_enable(struct omap_dss_device *dssdev)
{
	struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev);
	struct lb035q02_data *ld = dev_get_drvdata(dssdev->dev);
	int r;

	mutex_lock(&ld->lock);
@@ -153,7 +153,7 @@ static int lb035q02_panel_enable(struct omap_dss_device *dssdev)

static void lb035q02_panel_disable(struct omap_dss_device *dssdev)
{
	struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev);
	struct lb035q02_data *ld = dev_get_drvdata(dssdev->dev);

	mutex_lock(&ld->lock);

+15 −15
Original line number Diff line number Diff line
@@ -311,16 +311,16 @@ static int n8x0_panel_power_on(struct omap_dss_device *dssdev)
	switch (rev & 0xfc) {
	case 0x9c:
		ddata->blizzard_ver = BLIZZARD_VERSION_S1D13744;
		dev_info(&dssdev->dev, "s1d13744 LCD controller rev %d "
		dev_info(dssdev->dev, "s1d13744 LCD controller rev %d "
			"initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
		break;
	case 0xa4:
		ddata->blizzard_ver = BLIZZARD_VERSION_S1D13745;
		dev_info(&dssdev->dev, "s1d13745 LCD controller rev %d "
		dev_info(dssdev->dev, "s1d13745 LCD controller rev %d "
			"initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
		break;
	default:
		dev_err(&dssdev->dev, "invalid s1d1374x revision %02x\n", rev);
		dev_err(dssdev->dev, "invalid s1d1374x revision %02x\n", rev);
		r = -ENODEV;
		goto err_inv_chip;
	}
@@ -341,13 +341,13 @@ static int n8x0_panel_power_on(struct omap_dss_device *dssdev)
		panel_name = "ls041y3";
		break;
	default:
		dev_err(&dssdev->dev, "invalid display ID 0x%x\n",
		dev_err(dssdev->dev, "invalid display ID 0x%x\n",
				display_id[0]);
		r = -ENODEV;
		goto err_inv_panel;
	}

	dev_info(&dssdev->dev, "%s rev %02x LCD detected\n",
	dev_info(dssdev->dev, "%s rev %02x LCD detected\n",
			panel_name, display_id[1]);

	send_sleep_out(spi);
@@ -416,7 +416,7 @@ static int n8x0_panel_probe(struct omap_dss_device *dssdev)
	struct panel_drv_data *ddata;
	int r;

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

	if (!bdata)
		return -EINVAL;
@@ -434,14 +434,14 @@ static int n8x0_panel_probe(struct omap_dss_device *dssdev)
	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;

	if (gpio_is_valid(bdata->panel_reset)) {
		r = devm_gpio_request_one(&dssdev->dev, bdata->panel_reset,
		r = devm_gpio_request_one(dssdev->dev, bdata->panel_reset,
				GPIOF_OUT_INIT_LOW, "PANEL RESET");
		if (r)
			return r;
	}

	if (gpio_is_valid(bdata->ctrl_pwrdown)) {
		r = devm_gpio_request_one(&dssdev->dev, bdata->ctrl_pwrdown,
		r = devm_gpio_request_one(dssdev->dev, bdata->ctrl_pwrdown,
				GPIOF_OUT_INIT_LOW, "PANEL PWRDOWN");
		if (r)
			return r;
@@ -452,9 +452,9 @@ static int n8x0_panel_probe(struct omap_dss_device *dssdev)

static void n8x0_panel_remove(struct omap_dss_device *dssdev)
{
	dev_dbg(&dssdev->dev, "remove\n");
	dev_dbg(dssdev->dev, "remove\n");

	dev_set_drvdata(&dssdev->dev, NULL);
	dev_set_drvdata(dssdev->dev, NULL);
}

static int n8x0_panel_enable(struct omap_dss_device *dssdev)
@@ -462,7 +462,7 @@ static int n8x0_panel_enable(struct omap_dss_device *dssdev)
	struct panel_drv_data *ddata = get_drv_data(dssdev);
	int r;

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

	mutex_lock(&ddata->lock);

@@ -488,7 +488,7 @@ static void n8x0_panel_disable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = get_drv_data(dssdev);

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

	mutex_lock(&ddata->lock);

@@ -521,13 +521,13 @@ static int n8x0_panel_update(struct omap_dss_device *dssdev,
	struct panel_drv_data *ddata = get_drv_data(dssdev);
	u16 dw, dh;

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

	dw = dssdev->panel.timings.x_res;
	dh = dssdev->panel.timings.y_res;

	if (x != 0 || y != 0 || w != dw || h != dh) {
		dev_err(&dssdev->dev, "invaid update region %d, %d, %d, %d\n",
		dev_err(dssdev->dev, "invaid update region %d, %d, %d, %d\n",
			x, y, w, h);
		return -EINVAL;
	}
@@ -548,7 +548,7 @@ static int n8x0_panel_sync(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = get_drv_data(dssdev);

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

	mutex_lock(&ddata->lock);
	rfbi_bus_lock();
+2 −2
Original line number Diff line number Diff line
@@ -98,14 +98,14 @@ static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
	dssdev->panel.timings = nec_8048_panel_timings;

	if (gpio_is_valid(pd->qvga_gpio)) {
		r = devm_gpio_request_one(&dssdev->dev, pd->qvga_gpio,
		r = devm_gpio_request_one(dssdev->dev, pd->qvga_gpio,
				GPIOF_OUT_INIT_HIGH, "lcd QVGA");
		if (r)
			return r;
	}

	if (gpio_is_valid(pd->res_gpio)) {
		r = devm_gpio_request_one(&dssdev->dev, pd->res_gpio,
		r = devm_gpio_request_one(dssdev->dev, pd->res_gpio,
				GPIOF_OUT_INIT_LOW, "lcd RES");
		if (r)
			return r;
Loading