Commit 78230c46 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'omapdrm-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next

omapdrm patches for v4.17

* Fix sparse warnings from omapdrm
* HPD support for DVI connector
* Big cleanup to remove static variables

* tag 'omapdrm-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (69 commits)
  drm/omap: fix compile error when DPI is disabled
  drm/omap: fix compile error when debugfs is disabled
  drm: omapdrm: displays: panel-dsi-cm: Fix field access before set
  drm/omap: cleanup color space conversion
  drm/omap: Allow HDMI audio setup even if we do not have video configured
  drm/omap: fix maximum sizes
  drm/omap: add writeback funcs to dispc_ops
  drm/omap: fix scaling limits for WB
  drm/omap: fix WB height with interlace
  drm/omap: fix WBDELAYCOUNT with interlace
  drm/omap: fix WBDELAYCOUNT for HDMI
  drm/omap: set WB channel-in in wb_setup()
  drm/omap: Add pclk setting case when channel is DSS_WB
  drm/omap: dispc: disp_wb_setup to check return code
  drm/omap: remove leftover enums
  dt-bindings: display: add HPD gpio to DVI connector
  drm/omap: add HPD support to connector-dvi
  drm/omap: Init fbdev emulation only when we have displays
  drm/omap: cleanup fbdev init/free
  drm/omap: fix omap_fbdev_free() when omap_fbdev_create() wasn't called
  ...
parents b65bd403 037f0315
...@@ -10,6 +10,7 @@ Optional properties: ...@@ -10,6 +10,7 @@ Optional properties:
- analog: the connector has DVI analog pins - analog: the connector has DVI analog pins
- digital: the connector has DVI digital pins - digital: the connector has DVI digital pins
- dual-link: the connector has pins for DVI dual-link - dual-link: the connector has pins for DVI dual-link
- hpd-gpios: HPD GPIO number
Required nodes: Required nodes:
- Video port for DVI input - Video port for DVI input
......
...@@ -40,14 +40,12 @@ static const struct videomode tvc_pal_vm = { ...@@ -40,14 +40,12 @@ static const struct videomode tvc_pal_vm = {
DISPLAY_FLAGS_VSYNC_LOW, DISPLAY_FLAGS_VSYNC_LOW,
}; };
static const struct of_device_id tvc_of_match[];
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
static int tvc_connect(struct omap_dss_device *dssdev) static int tvc_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
dev_dbg(ddata->dev, "connect\n"); dev_dbg(ddata->dev, "connect\n");
...@@ -55,10 +53,19 @@ static int tvc_connect(struct omap_dss_device *dssdev) ...@@ -55,10 +53,19 @@ static int tvc_connect(struct omap_dss_device *dssdev)
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(in)) {
dev_err(ddata->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.atv->connect(in, dssdev); r = in->ops.atv->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -73,6 +80,9 @@ static void tvc_disconnect(struct omap_dss_device *dssdev) ...@@ -73,6 +80,9 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.atv->disconnect(in, dssdev); in->ops.atv->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int tvc_enable(struct omap_dss_device *dssdev) static int tvc_enable(struct omap_dss_device *dssdev)
...@@ -175,32 +185,12 @@ static struct omap_dss_driver tvc_driver = { ...@@ -175,32 +185,12 @@ static struct omap_dss_driver tvc_driver = {
.set_wss = tvc_set_wss, .set_wss = tvc_set_wss,
}; };
static int tvc_probe_of(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0;
}
static int tvc_probe(struct platform_device *pdev) static int tvc_probe(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata; struct panel_drv_data *ddata;
struct omap_dss_device *dssdev; struct omap_dss_device *dssdev;
int r; int r;
if (!pdev->dev.of_node)
return -ENODEV;
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata) if (!ddata)
return -ENOMEM; return -ENOMEM;
...@@ -208,10 +198,6 @@ static int tvc_probe(struct platform_device *pdev) ...@@ -208,10 +198,6 @@ static int tvc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
ddata->dev = &pdev->dev; ddata->dev = &pdev->dev;
r = tvc_probe_of(pdev);
if (r)
return r;
ddata->vm = tvc_pal_vm; ddata->vm = tvc_pal_vm;
dssdev = &ddata->dssdev; dssdev = &ddata->dssdev;
...@@ -224,28 +210,22 @@ static int tvc_probe(struct platform_device *pdev) ...@@ -224,28 +210,22 @@ static int tvc_probe(struct platform_device *pdev)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register panel\n"); dev_err(&pdev->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit tvc_remove(struct platform_device *pdev) static int __exit tvc_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_display(&ddata->dssdev); omapdss_unregister_display(&ddata->dssdev);
tvc_disable(dssdev); tvc_disable(dssdev);
tvc_disconnect(dssdev); tvc_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#include <linux/gpio/consumer.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -44,6 +45,14 @@ struct panel_drv_data { ...@@ -44,6 +45,14 @@ struct panel_drv_data {
struct videomode vm; struct videomode vm;
struct i2c_adapter *i2c_adapter; struct i2c_adapter *i2c_adapter;
struct gpio_desc *hpd_gpio;
void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
void *hpd_cb_data;
bool hpd_enabled;
/* mutex for hpd fields above */
struct mutex hpd_lock;
}; };
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
...@@ -51,16 +60,25 @@ struct panel_drv_data { ...@@ -51,16 +60,25 @@ struct panel_drv_data {
static int dvic_connect(struct omap_dss_device *dssdev) static int dvic_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dvi->connect(in, dssdev); r = in->ops.dvi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -73,6 +91,9 @@ static void dvic_disconnect(struct omap_dss_device *dssdev) ...@@ -73,6 +91,9 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dvi->disconnect(in, dssdev); in->ops.dvi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int dvic_enable(struct omap_dss_device *dssdev) static int dvic_enable(struct omap_dss_device *dssdev)
...@@ -177,6 +198,9 @@ static int dvic_read_edid(struct omap_dss_device *dssdev, ...@@ -177,6 +198,9 @@ static int dvic_read_edid(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
int r, l, bytes_read; int r, l, bytes_read;
if (ddata->hpd_gpio && !gpiod_get_value_cansleep(ddata->hpd_gpio))
return -ENODEV;
if (!ddata->i2c_adapter) if (!ddata->i2c_adapter)
return -ENODEV; return -ENODEV;
...@@ -208,6 +232,9 @@ static bool dvic_detect(struct omap_dss_device *dssdev) ...@@ -208,6 +232,9 @@ static bool dvic_detect(struct omap_dss_device *dssdev)
unsigned char out; unsigned char out;
int r; int r;
if (ddata->hpd_gpio)
return gpiod_get_value_cansleep(ddata->hpd_gpio);
if (!ddata->i2c_adapter) if (!ddata->i2c_adapter)
return true; return true;
...@@ -216,6 +243,60 @@ static bool dvic_detect(struct omap_dss_device *dssdev) ...@@ -216,6 +243,60 @@ static bool dvic_detect(struct omap_dss_device *dssdev)
return r == 0; return r == 0;
} }
static int dvic_register_hpd_cb(struct omap_dss_device *dssdev,
void (*cb)(void *cb_data,
enum drm_connector_status status),
void *cb_data)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return -ENOTSUPP;
mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = cb;
ddata->hpd_cb_data = cb_data;
mutex_unlock(&ddata->hpd_lock);
return 0;
}
static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return;
mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = NULL;
ddata->hpd_cb_data = NULL;
mutex_unlock(&ddata->hpd_lock);
}
static void dvic_enable_hpd(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return;
mutex_lock(&ddata->hpd_lock);
ddata->hpd_enabled = true;
mutex_unlock(&ddata->hpd_lock);
}
static void dvic_disable_hpd(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return;
mutex_lock(&ddata->hpd_lock);
ddata->hpd_enabled = false;
mutex_unlock(&ddata->hpd_lock);
}
static struct omap_dss_driver dvic_driver = { static struct omap_dss_driver dvic_driver = {
.connect = dvic_connect, .connect = dvic_connect,
.disconnect = dvic_disconnect, .disconnect = dvic_disconnect,
...@@ -229,23 +310,60 @@ static struct omap_dss_driver dvic_driver = { ...@@ -229,23 +310,60 @@ static struct omap_dss_driver dvic_driver = {
.read_edid = dvic_read_edid, .read_edid = dvic_read_edid,
.detect = dvic_detect, .detect = dvic_detect,
.register_hpd_cb = dvic_register_hpd_cb,
.unregister_hpd_cb = dvic_unregister_hpd_cb,
.enable_hpd = dvic_enable_hpd,
.disable_hpd = dvic_disable_hpd,
}; };
static irqreturn_t dvic_hpd_isr(int irq, void *data)
{
struct panel_drv_data *ddata = data;
mutex_lock(&ddata->hpd_lock);
if (ddata->hpd_enabled && ddata->hpd_cb) {
enum drm_connector_status status;
if (dvic_detect(&ddata->dssdev))
status = connector_status_connected;
else
status = connector_status_disconnected;
ddata->hpd_cb(ddata->hpd_cb_data, status);
}
mutex_unlock(&ddata->hpd_lock);
return IRQ_HANDLED;
}
static int dvic_probe_of(struct platform_device *pdev) static int dvic_probe_of(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
struct device_node *adapter_node; struct device_node *adapter_node;
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
struct gpio_desc *gpio;
int r;
in = omapdss_of_find_source_for_first_ep(node); gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN);
if (IS_ERR(in)) { if (IS_ERR(gpio)) {
dev_err(&pdev->dev, "failed to find video source\n"); dev_err(&pdev->dev, "failed to parse HPD gpio\n");
return PTR_ERR(in); return PTR_ERR(gpio);
} }
ddata->in = in; ddata->hpd_gpio = gpio;
mutex_init(&ddata->hpd_lock);
if (ddata->hpd_gpio) {
r = devm_request_threaded_irq(&pdev->dev,
gpiod_to_irq(ddata->hpd_gpio), NULL, dvic_hpd_isr,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"DVI HPD", ddata);
if (r)
return r;
}
adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
if (adapter_node) { if (adapter_node) {
...@@ -253,7 +371,6 @@ static int dvic_probe_of(struct platform_device *pdev) ...@@ -253,7 +371,6 @@ static int dvic_probe_of(struct platform_device *pdev)
of_node_put(adapter_node); of_node_put(adapter_node);
if (adapter == NULL) { if (adapter == NULL) {
dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
omap_dss_put_device(ddata->in);
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
...@@ -275,9 +392,6 @@ static int dvic_probe(struct platform_device *pdev) ...@@ -275,9 +392,6 @@ static int dvic_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
if (!pdev->dev.of_node)
return -ENODEV;
r = dvic_probe_of(pdev); r = dvic_probe_of(pdev);
if (r) if (r)
return r; return r;
...@@ -300,9 +414,8 @@ static int dvic_probe(struct platform_device *pdev) ...@@ -300,9 +414,8 @@ static int dvic_probe(struct platform_device *pdev)
return 0; return 0;
err_reg: err_reg:
omap_dss_put_device(ddata->in);
i2c_put_adapter(ddata->i2c_adapter); i2c_put_adapter(ddata->i2c_adapter);
mutex_destroy(&ddata->hpd_lock);
return r; return r;
} }
...@@ -311,17 +424,16 @@ static int __exit dvic_remove(struct platform_device *pdev) ...@@ -311,17 +424,16 @@ static int __exit dvic_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_display(&ddata->dssdev); omapdss_unregister_display(&ddata->dssdev);
dvic_disable(dssdev); dvic_disable(dssdev);
dvic_disconnect(dssdev); dvic_disconnect(dssdev);
omap_dss_put_device(in);
i2c_put_adapter(ddata->i2c_adapter); i2c_put_adapter(ddata->i2c_adapter);
mutex_destroy(&ddata->hpd_lock);
return 0; return 0;
} }
......
...@@ -55,7 +55,7 @@ struct panel_drv_data { ...@@ -55,7 +55,7 @@ struct panel_drv_data {
static int hdmic_connect(struct omap_dss_device *dssdev) static int hdmic_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
dev_dbg(ddata->dev, "connect\n"); dev_dbg(ddata->dev, "connect\n");
...@@ -63,10 +63,19 @@ static int hdmic_connect(struct omap_dss_device *dssdev) ...@@ -63,10 +63,19 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(in)) {
dev_err(ddata->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.hdmi->connect(in, dssdev); r = in->ops.hdmi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -81,6 +90,9 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev) ...@@ -81,6 +90,9 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.hdmi->disconnect(in, dssdev); in->ops.hdmi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int hdmic_enable(struct omap_dss_device *dssdev) static int hdmic_enable(struct omap_dss_device *dssdev)
...@@ -302,7 +314,6 @@ static int hdmic_probe_of(struct platform_device *pdev) ...@@ -302,7 +314,6 @@ static int hdmic_probe_of(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
int gpio; int gpio;
/* HPD GPIO */ /* HPD GPIO */
...@@ -312,14 +323,6 @@ static int hdmic_probe_of(struct platform_device *pdev) ...@@ -312,14 +323,6 @@ static int hdmic_probe_of(struct platform_device *pdev)
else else
ddata->hpd_gpio = -ENODEV; ddata->hpd_gpio = -ENODEV;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -336,9 +339,6 @@ static int hdmic_probe(struct platform_device *pdev) ...@@ -336,9 +339,6 @@ static int hdmic_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
ddata->dev = &pdev->dev; ddata->dev = &pdev->dev;
if (!pdev->dev.of_node)
return -ENODEV;
r = hdmic_probe_of(pdev); r = hdmic_probe_of(pdev);
if (r) if (r)
return r; return r;
...@@ -349,7 +349,7 @@ static int hdmic_probe(struct platform_device *pdev) ...@@ -349,7 +349,7 @@ static int hdmic_probe(struct platform_device *pdev)
r = devm_gpio_request_one(&pdev->dev, ddata->hpd_gpio, r = devm_gpio_request_one(&pdev->dev, ddata->hpd_gpio,
GPIOF_DIR_IN, "hdmi_hpd"); GPIOF_DIR_IN, "hdmi_hpd");
if (r) if (r)
goto err_reg; return r;
r = devm_request_threaded_irq(&pdev->dev, r = devm_request_threaded_irq(&pdev->dev,
gpio_to_irq(ddata->hpd_gpio), gpio_to_irq(ddata->hpd_gpio),
...@@ -358,7 +358,7 @@ static int hdmic_probe(struct platform_device *pdev) ...@@ -358,7 +358,7 @@ static int hdmic_probe(struct platform_device *pdev)
IRQF_ONESHOT, IRQF_ONESHOT,
"hdmic hpd", ddata); "hdmic hpd", ddata);
if (r) if (r)
goto err_reg; return r;
} }
ddata->vm = hdmic_default_vm; ddata->vm = hdmic_default_vm;
...@@ -373,28 +373,22 @@ static int hdmic_probe(struct platform_device *pdev) ...@@ -373,28 +373,22 @@ static int hdmic_probe(struct platform_device *pdev)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register panel\n"); dev_err(&pdev->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit hdmic_remove(struct platform_device *pdev) static int __exit hdmic_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_display(&ddata->dssdev); omapdss_unregister_display(&ddata->dssdev);
hdmic_disable(dssdev); hdmic_disable(dssdev);
hdmic_disconnect(dssdev); hdmic_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -36,7 +36,7 @@ static int opa362_connect(struct omap_dss_device *dssdev, ...@@ -36,7 +36,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
dev_dbg(dssdev->dev, "connect\n"); dev_dbg(dssdev->dev, "connect\n");
...@@ -44,13 +44,22 @@ static int opa362_connect(struct omap_dss_device *dssdev, ...@@ -44,13 +44,22 @@ static int opa362_connect(struct omap_dss_device *dssdev,
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return -EBUSY; return -EBUSY;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.atv->connect(in, dssdev); r = in->ops.atv->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
dst->src = dssdev; dst->src = dssdev;
dssdev->dst = dst; dssdev->dst = dst;
ddata->in = in;
return 0; return 0;
} }
...@@ -74,6 +83,9 @@ static void opa362_disconnect(struct omap_dss_device *dssdev, ...@@ -74,6 +83,9 @@ static void opa362_disconnect(struct omap_dss_device *dssdev,
dssdev->dst = NULL; dssdev->dst = NULL;
in->ops.atv->disconnect(in, &ddata->dssdev); in->ops.atv->disconnect(in, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int opa362_enable(struct omap_dss_device *dssdev) static int opa362_enable(struct omap_dss_device *dssdev)
...@@ -171,19 +183,13 @@ static const struct omapdss_atv_ops opa362_atv_ops = { ...@@ -171,19 +183,13 @@ static const struct omapdss_atv_ops opa362_atv_ops = {
static int opa362_probe(struct platform_device *pdev) static int opa362_probe(struct platform_device *pdev)
{ {
struct device_node *node = pdev->dev.of_node;
struct panel_drv_data *ddata; struct panel_drv_data *ddata;
struct omap_dss_device *dssdev, *in; struct omap_dss_device *dssdev;
struct gpio_desc *gpio; struct gpio_desc *gpio;
int r; int r;
dev_dbg(&pdev->dev, "probe\n"); dev_dbg(&pdev->dev, "probe\n");
if (node == NULL) {
dev_err(&pdev->dev, "Unable to find device tree\n");
return -EINVAL;
}
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata) if (!ddata)
return -ENOMEM; return -ENOMEM;
...@@ -196,14 +202,6 @@ static int opa362_probe(struct platform_device *pdev) ...@@ -196,14 +202,6 @@ static int opa362_probe(struct platform_device *pdev)
ddata->enable_gpio = gpio; ddata->enable_gpio = gpio;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
dssdev = &ddata->dssdev; dssdev = &ddata->dssdev;
dssdev->ops.atv = &opa362_atv_ops; dssdev->ops.atv = &opa362_atv_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
...@@ -214,20 +212,16 @@ static int opa362_probe(struct platform_device *pdev) ...@@ -214,20 +212,16 @@ static int opa362_probe(struct platform_device *pdev)
r = omapdss_register_output(dssdev); r = omapdss_register_output(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register output\n"); dev_err(&pdev->dev, "Failed to register output\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit opa362_remove(struct platform_device *pdev) static int __exit opa362_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_output(&ddata->dssdev); omapdss_unregister_output(&ddata->dssdev);
...@@ -239,8 +233,6 @@ static int __exit opa362_remove(struct platform_device *pdev) ...@@ -239,8 +233,6 @@ static int __exit opa362_remove(struct platform_device *pdev)
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
opa362_disconnect(dssdev, dssdev->dst); opa362_disconnect(dssdev, dssdev->dst);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -32,19 +32,28 @@ static int tfp410_connect(struct omap_dss_device *dssdev, ...@@ -32,19 +32,28 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return -EBUSY; return -EBUSY;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
dst->src = dssdev; dst->src = dssdev;
dssdev->dst = dst; dssdev->dst = dst;
ddata->in = in;
return 0; return 0;
} }
...@@ -66,6 +75,9 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev, ...@@ -66,6 +75,9 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
dssdev->dst = NULL; dssdev->dst = NULL;
in->ops.dpi->disconnect(in, &ddata->dssdev); in->ops.dpi->disconnect(in, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int tfp410_enable(struct omap_dss_device *dssdev) static int tfp410_enable(struct omap_dss_device *dssdev)
...@@ -165,7 +177,6 @@ static int tfp410_probe_of(struct platform_device *pdev) ...@@ -165,7 +177,6 @@ static int tfp410_probe_of(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
int gpio; int gpio;
gpio = of_get_named_gpio(node, "powerdown-gpios", 0); gpio = of_get_named_gpio(node, "powerdown-gpios", 0);
...@@ -178,14 +189,6 @@ static int tfp410_probe_of(struct platform_device *pdev) ...@@ -178,14 +189,6 @@ static int tfp410_probe_of(struct platform_device *pdev)
return gpio; return gpio;
} }
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -201,9 +204,6 @@ static int tfp410_probe(struct platform_device *pdev) ...@@ -201,9 +204,6 @@ static int tfp410_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
if (!pdev->dev.of_node)
return -ENODEV;
r = tfp410_probe_of(pdev); r = tfp410_probe_of(pdev);
if (r) if (r)
return r; return r;
...@@ -214,7 +214,7 @@ static int tfp410_probe(struct platform_device *pdev) ...@@ -214,7 +214,7 @@ static int tfp410_probe(struct platform_device *pdev)
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to request PD GPIO %d\n", dev_err(&pdev->dev, "Failed to request PD GPIO %d\n",
ddata->pd_gpio); ddata->pd_gpio);
goto err_gpio; return r;
} }
} }
...@@ -229,21 +229,16 @@ static int tfp410_probe(struct platform_device *pdev) ...@@ -229,21 +229,16 @@ static int tfp410_probe(struct platform_device *pdev)
r = omapdss_register_output(dssdev); r = omapdss_register_output(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register output\n"); dev_err(&pdev->dev, "Failed to register output\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
err_gpio:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit tfp410_remove(struct platform_device *pdev) static int __exit tfp410_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_output(&ddata->dssdev); omapdss_unregister_output(&ddata->dssdev);
...@@ -255,8 +250,6 @@ static int __exit tfp410_remove(struct platform_device *pdev) ...@@ -255,8 +250,6 @@ static int __exit tfp410_remove(struct platform_device *pdev)
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
tfp410_disconnect(dssdev, dssdev->dst); tfp410_disconnect(dssdev, dssdev->dst);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -40,12 +40,20 @@ static int tpd_connect(struct omap_dss_device *dssdev, ...@@ -40,12 +40,20 @@ static int tpd_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.hdmi->connect(in, dssdev); r = in->ops.hdmi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
dst->src = dssdev; dst->src = dssdev;
dssdev->dst = dst; dssdev->dst = dst;
...@@ -56,6 +64,7 @@ static int tpd_connect(struct omap_dss_device *dssdev, ...@@ -56,6 +64,7 @@ static int tpd_connect(struct omap_dss_device *dssdev,
/* DC-DC converter needs at max 300us to get to 90% of 5V */ /* DC-DC converter needs at max 300us to get to 90% of 5V */
udelay(300); udelay(300);
ddata->in = in;
return 0; return 0;
} }
...@@ -77,6 +86,9 @@ static void tpd_disconnect(struct omap_dss_device *dssdev, ...@@ -77,6 +86,9 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
dssdev->dst = NULL; dssdev->dst = NULL;
in->ops.hdmi->disconnect(in, &ddata->dssdev); in->ops.hdmi->disconnect(in, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int tpd_enable(struct omap_dss_device *dssdev) static int tpd_enable(struct omap_dss_device *dssdev)
...@@ -269,23 +281,6 @@ static irqreturn_t tpd_hpd_isr(int irq, void *data) ...@@ -269,23 +281,6 @@ static irqreturn_t tpd_hpd_isr(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int tpd_probe_of(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0;
}
static int tpd_probe(struct platform_device *pdev) static int tpd_probe(struct platform_device *pdev)
{ {
struct omap_dss_device *in, *dssdev; struct omap_dss_device *in, *dssdev;
...@@ -299,37 +294,24 @@ static int tpd_probe(struct platform_device *pdev) ...@@ -299,37 +294,24 @@ static int tpd_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
if (!pdev->dev.of_node)
return -ENODEV;
r = tpd_probe_of(pdev);
if (r)
return r;
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0, gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0,
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(gpio)) { if (IS_ERR(gpio))
r = PTR_ERR(gpio); return PTR_ERR(gpio);
goto err_gpio;
}
ddata->ct_cp_hpd_gpio = gpio; ddata->ct_cp_hpd_gpio = gpio;
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1, gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1,
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(gpio)) { if (IS_ERR(gpio))
r = PTR_ERR(gpio); return PTR_ERR(gpio);
goto err_gpio;
}
ddata->ls_oe_gpio = gpio; ddata->ls_oe_gpio = gpio;
gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2, gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2,
GPIOD_IN); GPIOD_IN);
if (IS_ERR(gpio)) { if (IS_ERR(gpio))
r = PTR_ERR(gpio); return PTR_ERR(gpio);
goto err_gpio;
}
ddata->hpd_gpio = gpio; ddata->hpd_gpio = gpio;
...@@ -340,7 +322,7 @@ static int tpd_probe(struct platform_device *pdev) ...@@ -340,7 +322,7 @@ static int tpd_probe(struct platform_device *pdev)
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"tpd12s015 hpd", ddata); "tpd12s015 hpd", ddata);
if (r) if (r)
goto err_gpio; return r;
dssdev = &ddata->dssdev; dssdev = &ddata->dssdev;
dssdev->ops.hdmi = &tpd_hdmi_ops; dssdev->ops.hdmi = &tpd_hdmi_ops;
...@@ -355,21 +337,16 @@ static int tpd_probe(struct platform_device *pdev) ...@@ -355,21 +337,16 @@ static int tpd_probe(struct platform_device *pdev)
r = omapdss_register_output(dssdev); r = omapdss_register_output(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register output\n"); dev_err(&pdev->dev, "Failed to register output\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
err_gpio:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit tpd_remove(struct platform_device *pdev) static int __exit tpd_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_output(&ddata->dssdev); omapdss_unregister_output(&ddata->dssdev);
...@@ -381,8 +358,6 @@ static int __exit tpd_remove(struct platform_device *pdev) ...@@ -381,8 +358,6 @@ static int __exit tpd_remove(struct platform_device *pdev)
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
tpd_disconnect(dssdev, dssdev->dst); tpd_disconnect(dssdev, dssdev->dst);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -38,16 +38,25 @@ struct panel_drv_data { ...@@ -38,16 +38,25 @@ struct panel_drv_data {
static int panel_dpi_connect(struct omap_dss_device *dssdev) static int panel_dpi_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -60,6 +69,9 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev) ...@@ -60,6 +69,9 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dpi->disconnect(in, dssdev); in->ops.dpi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int panel_dpi_enable(struct omap_dss_device *dssdev) static int panel_dpi_enable(struct omap_dss_device *dssdev)
...@@ -157,7 +169,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev) ...@@ -157,7 +169,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
int r; int r;
struct display_timing timing; struct display_timing timing;
struct gpio_desc *gpio; struct gpio_desc *gpio;
...@@ -195,14 +206,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev) ...@@ -195,14 +206,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
videomode_from_timing(&timing, &ddata->vm); videomode_from_timing(&timing, &ddata->vm);
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -212,9 +215,6 @@ static int panel_dpi_probe(struct platform_device *pdev) ...@@ -212,9 +215,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
struct omap_dss_device *dssdev; struct omap_dss_device *dssdev;
int r; int r;
if (!pdev->dev.of_node)
return -ENODEV;
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
if (ddata == NULL) if (ddata == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -235,29 +235,22 @@ static int panel_dpi_probe(struct platform_device *pdev) ...@@ -235,29 +235,22 @@ static int panel_dpi_probe(struct platform_device *pdev)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register panel\n"); dev_err(&pdev->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit panel_dpi_remove(struct platform_device *pdev) static int __exit panel_dpi_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_display(dssdev); omapdss_unregister_display(dssdev);
panel_dpi_disable(dssdev); panel_dpi_disable(dssdev);
panel_dpi_disconnect(dssdev); panel_dpi_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -86,7 +86,7 @@ struct panel_drv_data { ...@@ -86,7 +86,7 @@ struct panel_drv_data {
struct workqueue_struct *workqueue; struct workqueue_struct *workqueue;
bool ulps_enabled; bool ulps_enabled;
unsigned ulps_timeout; unsigned int ulps_timeout;
struct delayed_work ulps_work; struct delayed_work ulps_work;
}; };
...@@ -513,7 +513,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, ...@@ -513,7 +513,7 @@ static ssize_t dsicm_show_ulps(struct device *dev,
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
unsigned t; unsigned int t;
mutex_lock(&ddata->lock); mutex_lock(&ddata->lock);
t = ddata->ulps_enabled; t = ddata->ulps_enabled;
...@@ -560,7 +560,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, ...@@ -560,7 +560,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev,
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
unsigned t; unsigned int t;
mutex_lock(&ddata->lock); mutex_lock(&ddata->lock);
t = ddata->ulps_timeout; t = ddata->ulps_timeout;
...@@ -759,37 +759,46 @@ static int dsicm_panel_reset(struct panel_drv_data *ddata) ...@@ -759,37 +759,46 @@ static int dsicm_panel_reset(struct panel_drv_data *ddata)
static int dsicm_connect(struct omap_dss_device *dssdev) static int dsicm_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct device *dev = &ddata->pdev->dev; struct device *dev = &ddata->pdev->dev;
struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dsi->connect(in, dssdev); r = in->ops.dsi->connect(in, dssdev);
if (r) { if (r) {
dev_err(dev, "Failed to connect to video source\n"); dev_err(dev, "Failed to connect to video source\n");
return r; goto err_connect;
} }
r = in->ops.dsi->request_vc(ddata->in, &ddata->channel); r = in->ops.dsi->request_vc(in, &ddata->channel);
if (r) { if (r) {
dev_err(dev, "failed to get virtual channel\n"); dev_err(dev, "failed to get virtual channel\n");
goto err_req_vc; goto err_req_vc;
} }
r = in->ops.dsi->set_vc_id(ddata->in, ddata->channel, TCH); r = in->ops.dsi->set_vc_id(in, ddata->channel, TCH);
if (r) { if (r) {
dev_err(dev, "failed to set VC_ID\n"); dev_err(dev, "failed to set VC_ID\n");
goto err_vc_id; goto err_vc_id;
} }
ddata->in = in;
return 0; return 0;
err_vc_id: err_vc_id:
in->ops.dsi->release_vc(ddata->in, ddata->channel); in->ops.dsi->release_vc(in, ddata->channel);
err_req_vc: err_req_vc:
in->ops.dsi->disconnect(in, dssdev); in->ops.dsi->disconnect(in, dssdev);
err_connect:
omap_dss_put_device(in);
return r; return r;
} }
...@@ -803,6 +812,9 @@ static void dsicm_disconnect(struct omap_dss_device *dssdev) ...@@ -803,6 +812,9 @@ static void dsicm_disconnect(struct omap_dss_device *dssdev)
in->ops.dsi->release_vc(in, ddata->channel); in->ops.dsi->release_vc(in, ddata->channel);
in->ops.dsi->disconnect(in, dssdev); in->ops.dsi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int dsicm_enable(struct omap_dss_device *dssdev) static int dsicm_enable(struct omap_dss_device *dssdev)
...@@ -1064,7 +1076,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev, ...@@ -1064,7 +1076,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
int r; int r;
int first = 1; int first = 1;
int plen; int plen;
unsigned buf_used = 0; unsigned int buf_used = 0;
if (size < w * h * 3) if (size < w * h * 3)
return -ENOMEM; return -ENOMEM;
...@@ -1223,7 +1235,6 @@ static int dsicm_probe_of(struct platform_device *pdev) ...@@ -1223,7 +1235,6 @@ static int dsicm_probe_of(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct device_node *backlight; struct device_node *backlight;
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in;
struct display_timing timing; struct display_timing timing;
int err; int err;
...@@ -1259,12 +1270,6 @@ static int dsicm_probe_of(struct platform_device *pdev) ...@@ -1259,12 +1270,6 @@ static int dsicm_probe_of(struct platform_device *pdev)
ddata->height_mm = 0; ddata->height_mm = 0;
of_property_read_u32(node, "height-mm", &ddata->height_mm); of_property_read_u32(node, "height-mm", &ddata->height_mm);
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl"); ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
if (IS_ERR(ddata->vpnl)) { if (IS_ERR(ddata->vpnl)) {
err = PTR_ERR(ddata->vpnl); err = PTR_ERR(ddata->vpnl);
...@@ -1281,8 +1286,6 @@ static int dsicm_probe_of(struct platform_device *pdev) ...@@ -1281,8 +1286,6 @@ static int dsicm_probe_of(struct platform_device *pdev)
ddata->vddi = NULL; ddata->vddi = NULL;
} }
ddata->in = in;
backlight = of_parse_phandle(node, "backlight", 0); backlight = of_parse_phandle(node, "backlight", 0);
if (backlight) { if (backlight) {
ddata->extbldev = of_find_backlight_by_node(backlight); ddata->extbldev = of_find_backlight_by_node(backlight);
...@@ -1317,9 +1320,6 @@ static int dsicm_probe(struct platform_device *pdev) ...@@ -1317,9 +1320,6 @@ static int dsicm_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
ddata->pdev = pdev; ddata->pdev = pdev;
if (!pdev->dev.of_node)
return -ENODEV;
ddata->vm.hactive = 864; ddata->vm.hactive = 864;
ddata->vm.vactive = 480; ddata->vm.vactive = 480;
ddata->vm.pixelclock = 864 * 480 * 60; ddata->vm.pixelclock = 864 * 480 * 60;
...@@ -1424,8 +1424,6 @@ static int __exit dsicm_remove(struct platform_device *pdev) ...@@ -1424,8 +1424,6 @@ static int __exit dsicm_remove(struct platform_device *pdev)
if (ddata->extbldev) if (ddata->extbldev)
put_device(&ddata->extbldev->dev); put_device(&ddata->extbldev->dev);
omap_dss_put_device(ddata->in);
dsicm_cancel_ulps_work(ddata); dsicm_cancel_ulps_work(ddata);
destroy_workqueue(ddata->workqueue); destroy_workqueue(ddata->workqueue);
......
...@@ -119,18 +119,27 @@ static void init_lb035q02_panel(struct spi_device *spi) ...@@ -119,18 +119,27 @@ static void init_lb035q02_panel(struct spi_device *spi)
static int lb035q02_connect(struct omap_dss_device *dssdev) static int lb035q02_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
init_lb035q02_panel(ddata->spi); init_lb035q02_panel(ddata->spi);
ddata->in = in;
return 0; return 0;
} }
...@@ -143,6 +152,9 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev) ...@@ -143,6 +152,9 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dpi->disconnect(in, dssdev); in->ops.dpi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int lb035q02_enable(struct omap_dss_device *dssdev) static int lb035q02_enable(struct omap_dss_device *dssdev)
...@@ -230,9 +242,7 @@ static struct omap_dss_driver lb035q02_ops = { ...@@ -230,9 +242,7 @@ static struct omap_dss_driver lb035q02_ops = {
static int lb035q02_probe_of(struct spi_device *spi) static int lb035q02_probe_of(struct spi_device *spi)
{ {
struct device_node *node = spi->dev.of_node;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *in;
struct gpio_desc *gpio; struct gpio_desc *gpio;
gpio = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW); gpio = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW);
...@@ -243,14 +253,6 @@ static int lb035q02_probe_of(struct spi_device *spi) ...@@ -243,14 +253,6 @@ static int lb035q02_probe_of(struct spi_device *spi)
ddata->enable_gpio = gpio; ddata->enable_gpio = gpio;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&spi->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -268,9 +270,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) ...@@ -268,9 +270,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
ddata->spi = spi; ddata->spi = spi;
if (!spi->dev.of_node)
return -ENODEV;
r = lb035q02_probe_of(spi); r = lb035q02_probe_of(spi);
if (r) if (r)
return r; return r;
...@@ -287,29 +286,22 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) ...@@ -287,29 +286,22 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&spi->dev, "Failed to register panel\n"); dev_err(&spi->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int lb035q02_panel_spi_remove(struct spi_device *spi) static int lb035q02_panel_spi_remove(struct spi_device *spi)
{ {
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_display(dssdev); omapdss_unregister_display(dssdev);
lb035q02_disable(dssdev); lb035q02_disable(dssdev);
lb035q02_disconnect(dssdev); lb035q02_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -115,16 +115,25 @@ static int init_nec_8048_wvga_lcd(struct spi_device *spi) ...@@ -115,16 +115,25 @@ static int init_nec_8048_wvga_lcd(struct spi_device *spi)
static int nec_8048_connect(struct omap_dss_device *dssdev) static int nec_8048_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -137,6 +146,9 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev) ...@@ -137,6 +146,9 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dpi->disconnect(in, dssdev); in->ops.dpi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int nec_8048_enable(struct omap_dss_device *dssdev) static int nec_8048_enable(struct omap_dss_device *dssdev)
...@@ -226,7 +238,6 @@ static int nec_8048_probe_of(struct spi_device *spi) ...@@ -226,7 +238,6 @@ static int nec_8048_probe_of(struct spi_device *spi)
{ {
struct device_node *node = spi->dev.of_node; struct device_node *node = spi->dev.of_node;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *in;
int gpio; int gpio;
gpio = of_get_named_gpio(node, "reset-gpios", 0); gpio = of_get_named_gpio(node, "reset-gpios", 0);
...@@ -239,14 +250,6 @@ static int nec_8048_probe_of(struct spi_device *spi) ...@@ -239,14 +250,6 @@ static int nec_8048_probe_of(struct spi_device *spi)
/* XXX the panel spec doesn't mention any QVGA pin?? */ /* XXX the panel spec doesn't mention any QVGA pin?? */
ddata->qvga_gpio = -ENOENT; ddata->qvga_gpio = -ENOENT;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&spi->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -277,9 +280,6 @@ static int nec_8048_probe(struct spi_device *spi) ...@@ -277,9 +280,6 @@ static int nec_8048_probe(struct spi_device *spi)
ddata->spi = spi; ddata->spi = spi;
if (!spi->dev.of_node)
return -ENODEV;
r = nec_8048_probe_of(spi); r = nec_8048_probe_of(spi);
if (r) if (r)
return r; return r;
...@@ -288,14 +288,14 @@ static int nec_8048_probe(struct spi_device *spi) ...@@ -288,14 +288,14 @@ static int nec_8048_probe(struct spi_device *spi)
r = devm_gpio_request_one(&spi->dev, ddata->qvga_gpio, r = devm_gpio_request_one(&spi->dev, ddata->qvga_gpio,
GPIOF_OUT_INIT_HIGH, "lcd QVGA"); GPIOF_OUT_INIT_HIGH, "lcd QVGA");
if (r) if (r)
goto err_gpio; return r;
} }
if (gpio_is_valid(ddata->res_gpio)) { if (gpio_is_valid(ddata->res_gpio)) {
r = devm_gpio_request_one(&spi->dev, ddata->res_gpio, r = devm_gpio_request_one(&spi->dev, ddata->res_gpio,
GPIOF_OUT_INIT_LOW, "lcd RES"); GPIOF_OUT_INIT_LOW, "lcd RES");
if (r) if (r)
goto err_gpio; return r;
} }
ddata->vm = nec_8048_panel_vm; ddata->vm = nec_8048_panel_vm;
...@@ -310,22 +310,16 @@ static int nec_8048_probe(struct spi_device *spi) ...@@ -310,22 +310,16 @@ static int nec_8048_probe(struct spi_device *spi)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&spi->dev, "Failed to register panel\n"); dev_err(&spi->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
err_gpio:
omap_dss_put_device(ddata->in);
return r;
} }
static int nec_8048_remove(struct spi_device *spi) static int nec_8048_remove(struct spi_device *spi)
{ {
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
dev_dbg(&ddata->spi->dev, "%s\n", __func__); dev_dbg(&ddata->spi->dev, "%s\n", __func__);
...@@ -334,8 +328,6 @@ static int nec_8048_remove(struct spi_device *spi) ...@@ -334,8 +328,6 @@ static int nec_8048_remove(struct spi_device *spi)
nec_8048_disable(dssdev); nec_8048_disable(dssdev);
nec_8048_disconnect(dssdev); nec_8048_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -61,16 +61,25 @@ static const struct videomode sharp_ls_vm = { ...@@ -61,16 +61,25 @@ static const struct videomode sharp_ls_vm = {
static int sharp_ls_connect(struct omap_dss_device *dssdev) static int sharp_ls_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -83,6 +92,9 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev) ...@@ -83,6 +92,9 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dpi->disconnect(in, dssdev); in->ops.dpi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int sharp_ls_enable(struct omap_dss_device *dssdev) static int sharp_ls_enable(struct omap_dss_device *dssdev)
...@@ -210,8 +222,6 @@ static int sharp_ls_get_gpio_of(struct device *dev, int index, int val, ...@@ -210,8 +222,6 @@ static int sharp_ls_get_gpio_of(struct device *dev, int index, int val,
static int sharp_ls_probe_of(struct platform_device *pdev) static int sharp_ls_probe_of(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct device_node *node = pdev->dev.of_node;
struct omap_dss_device *in;
int r; int r;
ddata->vcc = devm_regulator_get(&pdev->dev, "envdd"); ddata->vcc = devm_regulator_get(&pdev->dev, "envdd");
...@@ -245,14 +255,6 @@ static int sharp_ls_probe_of(struct platform_device *pdev) ...@@ -245,14 +255,6 @@ static int sharp_ls_probe_of(struct platform_device *pdev)
if (r) if (r)
return r; return r;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -268,9 +270,6 @@ static int sharp_ls_probe(struct platform_device *pdev) ...@@ -268,9 +270,6 @@ static int sharp_ls_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
if (!pdev->dev.of_node)
return -ENODEV;
r = sharp_ls_probe_of(pdev); r = sharp_ls_probe_of(pdev);
if (r) if (r)
return r; return r;
...@@ -287,29 +286,22 @@ static int sharp_ls_probe(struct platform_device *pdev) ...@@ -287,29 +286,22 @@ static int sharp_ls_probe(struct platform_device *pdev)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register panel\n"); dev_err(&pdev->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int __exit sharp_ls_remove(struct platform_device *pdev) static int __exit sharp_ls_remove(struct platform_device *pdev)
{ {
struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
omapdss_unregister_display(dssdev); omapdss_unregister_display(dssdev);
sharp_ls_disable(dssdev); sharp_ls_disable(dssdev);
sharp_ls_disconnect(dssdev); sharp_ls_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -216,12 +216,12 @@ static void set_display_state(struct panel_drv_data *ddata, int enabled) ...@@ -216,12 +216,12 @@ static void set_display_state(struct panel_drv_data *ddata, int enabled)
static int panel_enabled(struct panel_drv_data *ddata) static int panel_enabled(struct panel_drv_data *ddata)
{ {
__be32 v;
u32 disp_status; u32 disp_status;
int enabled; int enabled;
acx565akm_read(ddata, MIPID_CMD_READ_DISP_STATUS, acx565akm_read(ddata, MIPID_CMD_READ_DISP_STATUS, (u8 *)&v, 4);
(u8 *)&disp_status, 4); disp_status = __be32_to_cpu(v);
disp_status = __be32_to_cpu(disp_status);
enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10)); enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10));
dev_dbg(&ddata->spi->dev, dev_dbg(&ddata->spi->dev,
"LCD panel %senabled by bootloader (status 0x%04x)\n", "LCD panel %senabled by bootloader (status 0x%04x)\n",
...@@ -289,7 +289,7 @@ static void enable_backlight_ctrl(struct panel_drv_data *ddata, int enable) ...@@ -289,7 +289,7 @@ static void enable_backlight_ctrl(struct panel_drv_data *ddata, int enable)
acx565akm_write(ddata, MIPID_CMD_WRITE_CTRL_DISP, (u8 *)&ctrl, 2); acx565akm_write(ddata, MIPID_CMD_WRITE_CTRL_DISP, (u8 *)&ctrl, 2);
} }
static void set_cabc_mode(struct panel_drv_data *ddata, unsigned mode) static void set_cabc_mode(struct panel_drv_data *ddata, unsigned int mode)
{ {
u16 cabc_ctrl; u16 cabc_ctrl;
...@@ -303,12 +303,12 @@ static void set_cabc_mode(struct panel_drv_data *ddata, unsigned mode) ...@@ -303,12 +303,12 @@ static void set_cabc_mode(struct panel_drv_data *ddata, unsigned mode)
acx565akm_write(ddata, MIPID_CMD_WRITE_CABC, (u8 *)&cabc_ctrl, 2); acx565akm_write(ddata, MIPID_CMD_WRITE_CABC, (u8 *)&cabc_ctrl, 2);
} }
static unsigned get_cabc_mode(struct panel_drv_data *ddata) static unsigned int get_cabc_mode(struct panel_drv_data *ddata)
{ {
return ddata->cabc_mode; return ddata->cabc_mode;
} }
static unsigned get_hw_cabc_mode(struct panel_drv_data *ddata) static unsigned int get_hw_cabc_mode(struct panel_drv_data *ddata)
{ {
u8 cabc_ctrl; u8 cabc_ctrl;
...@@ -510,16 +510,25 @@ static const struct attribute_group bldev_attr_group = { ...@@ -510,16 +510,25 @@ static const struct attribute_group bldev_attr_group = {
static int acx565akm_connect(struct omap_dss_device *dssdev) static int acx565akm_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.sdi->connect(in, dssdev); r = in->ops.sdi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -532,6 +541,9 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev) ...@@ -532,6 +541,9 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.sdi->disconnect(in, dssdev); in->ops.sdi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
...@@ -700,12 +712,6 @@ static int acx565akm_probe_of(struct spi_device *spi) ...@@ -700,12 +712,6 @@ static int acx565akm_probe_of(struct spi_device *spi)
ddata->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); ddata->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0);
ddata->in = omapdss_of_find_source_for_first_ep(np);
if (IS_ERR(ddata->in)) {
dev_err(&spi->dev, "failed to find video source\n");
return PTR_ERR(ddata->in);
}
return 0; return 0;
} }
...@@ -720,9 +726,6 @@ static int acx565akm_probe(struct spi_device *spi) ...@@ -720,9 +726,6 @@ static int acx565akm_probe(struct spi_device *spi)
dev_dbg(&spi->dev, "%s\n", __func__); dev_dbg(&spi->dev, "%s\n", __func__);
if (!spi->dev.of_node)
return -ENODEV;
spi->mode = SPI_MODE_3; spi->mode = SPI_MODE_3;
ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL);
...@@ -826,7 +829,6 @@ static int acx565akm_probe(struct spi_device *spi) ...@@ -826,7 +829,6 @@ static int acx565akm_probe(struct spi_device *spi)
err_reg_bl: err_reg_bl:
err_detect: err_detect:
err_gpio: err_gpio:
omap_dss_put_device(ddata->in);
return r; return r;
} }
...@@ -834,7 +836,6 @@ static int acx565akm_remove(struct spi_device *spi) ...@@ -834,7 +836,6 @@ static int acx565akm_remove(struct spi_device *spi)
{ {
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
dev_dbg(&ddata->spi->dev, "%s\n", __func__); dev_dbg(&ddata->spi->dev, "%s\n", __func__);
...@@ -846,8 +847,6 @@ static int acx565akm_remove(struct spi_device *spi) ...@@ -846,8 +847,6 @@ static int acx565akm_remove(struct spi_device *spi)
acx565akm_disable(dssdev); acx565akm_disable(dssdev);
acx565akm_disconnect(dssdev); acx565akm_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -169,16 +169,25 @@ enum jbt_register { ...@@ -169,16 +169,25 @@ enum jbt_register {
static int td028ttec1_panel_connect(struct omap_dss_device *dssdev) static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -191,6 +200,9 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev) ...@@ -191,6 +200,9 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dpi->disconnect(in, dssdev); in->ops.dpi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int td028ttec1_panel_enable(struct omap_dss_device *dssdev) static int td028ttec1_panel_enable(struct omap_dss_device *dssdev)
...@@ -362,23 +374,6 @@ static struct omap_dss_driver td028ttec1_ops = { ...@@ -362,23 +374,6 @@ static struct omap_dss_driver td028ttec1_ops = {
.check_timings = td028ttec1_panel_check_timings, .check_timings = td028ttec1_panel_check_timings,
}; };
static int td028ttec1_probe_of(struct spi_device *spi)
{
struct device_node *node = spi->dev.of_node;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *in;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&spi->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0;
}
static int td028ttec1_panel_probe(struct spi_device *spi) static int td028ttec1_panel_probe(struct spi_device *spi)
{ {
struct panel_drv_data *ddata; struct panel_drv_data *ddata;
...@@ -404,13 +399,6 @@ static int td028ttec1_panel_probe(struct spi_device *spi) ...@@ -404,13 +399,6 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
ddata->spi_dev = spi; ddata->spi_dev = spi;
if (!spi->dev.of_node)
return -ENODEV;
r = td028ttec1_probe_of(spi);
if (r)
return r;
ddata->vm = td028ttec1_panel_vm; ddata->vm = td028ttec1_panel_vm;
dssdev = &ddata->dssdev; dssdev = &ddata->dssdev;
...@@ -423,21 +411,16 @@ static int td028ttec1_panel_probe(struct spi_device *spi) ...@@ -423,21 +411,16 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
r = omapdss_register_display(dssdev); r = omapdss_register_display(dssdev);
if (r) { if (r) {
dev_err(&spi->dev, "Failed to register panel\n"); dev_err(&spi->dev, "Failed to register panel\n");
goto err_reg; return r;
} }
return 0; return 0;
err_reg:
omap_dss_put_device(ddata->in);
return r;
} }
static int td028ttec1_panel_remove(struct spi_device *spi) static int td028ttec1_panel_remove(struct spi_device *spi)
{ {
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
dev_dbg(&ddata->spi_dev->dev, "%s\n", __func__); dev_dbg(&ddata->spi_dev->dev, "%s\n", __func__);
...@@ -446,8 +429,6 @@ static int td028ttec1_panel_remove(struct spi_device *spi) ...@@ -446,8 +429,6 @@ static int td028ttec1_panel_remove(struct spi_device *spi)
td028ttec1_panel_disable(dssdev); td028ttec1_panel_disable(dssdev);
td028ttec1_panel_disconnect(dssdev); td028ttec1_panel_disconnect(dssdev);
omap_dss_put_device(in);
return 0; return 0;
} }
......
...@@ -340,16 +340,25 @@ static void tpo_td043_power_off(struct panel_drv_data *ddata) ...@@ -340,16 +340,25 @@ static void tpo_td043_power_off(struct panel_drv_data *ddata)
static int tpo_td043_connect(struct omap_dss_device *dssdev) static int tpo_td043_connect(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in;
int r; int r;
if (omapdss_device_is_connected(dssdev)) if (omapdss_device_is_connected(dssdev))
return 0; return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev); r = in->ops.dpi->connect(in, dssdev);
if (r) if (r) {
omap_dss_put_device(in);
return r; return r;
}
ddata->in = in;
return 0; return 0;
} }
...@@ -362,6 +371,9 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev) ...@@ -362,6 +371,9 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev)
return; return;
in->ops.dpi->disconnect(in, dssdev); in->ops.dpi->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
} }
static int tpo_td043_enable(struct omap_dss_device *dssdev) static int tpo_td043_enable(struct omap_dss_device *dssdev)
...@@ -463,7 +475,6 @@ static int tpo_td043_probe_of(struct spi_device *spi) ...@@ -463,7 +475,6 @@ static int tpo_td043_probe_of(struct spi_device *spi)
{ {
struct device_node *node = spi->dev.of_node; struct device_node *node = spi->dev.of_node;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *in;
int gpio; int gpio;
gpio = of_get_named_gpio(node, "reset-gpios", 0); gpio = of_get_named_gpio(node, "reset-gpios", 0);
...@@ -473,14 +484,6 @@ static int tpo_td043_probe_of(struct spi_device *spi) ...@@ -473,14 +484,6 @@ static int tpo_td043_probe_of(struct spi_device *spi)
} }
ddata->nreset_gpio = gpio; ddata->nreset_gpio = gpio;
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&spi->dev, "failed to find video source\n");
return PTR_ERR(in);
}
ddata->in = in;
return 0; return 0;
} }
...@@ -509,9 +512,6 @@ static int tpo_td043_probe(struct spi_device *spi) ...@@ -509,9 +512,6 @@ static int tpo_td043_probe(struct spi_device *spi)
ddata->spi = spi; ddata->spi = spi;
if (!spi->dev.of_node)
return -ENODEV;
r = tpo_td043_probe_of(spi); r = tpo_td043_probe_of(spi);
if (r) if (r)
return r; return r;
...@@ -564,7 +564,6 @@ static int tpo_td043_probe(struct spi_device *spi) ...@@ -564,7 +564,6 @@ static int tpo_td043_probe(struct spi_device *spi)
err_sysfs: err_sysfs:
err_gpio_req: err_gpio_req:
err_regulator: err_regulator:
omap_dss_put_device(ddata->in);
return r; return r;
} }
...@@ -572,7 +571,6 @@ static int tpo_td043_remove(struct spi_device *spi) ...@@ -572,7 +571,6 @@ static int tpo_td043_remove(struct spi_device *spi)
{ {
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
dev_dbg(&ddata->spi->dev, "%s\n", __func__); dev_dbg(&ddata->spi->dev, "%s\n", __func__);
...@@ -581,8 +579,6 @@ static int tpo_td043_remove(struct spi_device *spi) ...@@ -581,8 +579,6 @@ static int tpo_td043_remove(struct spi_device *spi)
tpo_td043_disable(dssdev); tpo_td043_disable(dssdev);
tpo_td043_disconnect(dssdev); tpo_td043_disconnect(dssdev);
omap_dss_put_device(in);
sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group); sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group);
return 0; return 0;
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/list.h> #include <linux/list.h>
#include "dss.h"
#include "omapdss.h" #include "omapdss.h"
static bool dss_initialized; static struct dss_device *dss_device;
static const struct dispc_ops *ops;
static struct list_head omapdss_comp_list; static struct list_head omapdss_comp_list;
...@@ -31,27 +32,27 @@ struct omapdss_comp_node { ...@@ -31,27 +32,27 @@ struct omapdss_comp_node {
bool dss_core_component; bool dss_core_component;
}; };
void omapdss_set_is_initialized(bool set) struct dss_device *omapdss_get_dss(void)
{ {
dss_initialized = set; return dss_device;
} }
EXPORT_SYMBOL(omapdss_set_is_initialized); EXPORT_SYMBOL(omapdss_get_dss);
bool omapdss_is_initialized(void) void omapdss_set_dss(struct dss_device *dss)
{ {
return dss_initialized; dss_device = dss;
} }
EXPORT_SYMBOL(omapdss_is_initialized); EXPORT_SYMBOL(omapdss_set_dss);
void dispc_set_ops(const struct dispc_ops *o) struct dispc_device *dispc_get_dispc(struct dss_device *dss)
{ {
ops = o; return dss->dispc;
} }
EXPORT_SYMBOL(dispc_set_ops); EXPORT_SYMBOL(dispc_get_dispc);
const struct dispc_ops *dispc_get_ops(void) const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
{ {
return ops; return dss->dispc_ops;
} }
EXPORT_SYMBOL(dispc_get_ops); EXPORT_SYMBOL(dispc_get_ops);
......
This diff is collapsed.
...@@ -28,12 +28,11 @@ ...@@ -28,12 +28,11 @@
#include "omapdss.h" #include "omapdss.h"
void omapdss_default_get_timings(struct omap_dss_device *dssdev, static void omapdss_default_get_timings(struct omap_dss_device *dssdev,
struct videomode *vm) struct videomode *vm)
{ {
*vm = dssdev->panel.vm; *vm = dssdev->panel.vm;
} }
EXPORT_SYMBOL(omapdss_default_get_timings);
static LIST_HEAD(panel_list); static LIST_HEAD(panel_list);
static DEFINE_MUTEX(panel_list_mutex); static DEFINE_MUTEX(panel_list_mutex);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
struct dpi_data { struct dpi_data {
struct platform_device *pdev; struct platform_device *pdev;
enum dss_model dss_model; enum dss_model dss_model;
struct dss_device *dss;
struct regulator *vdds_dsi_reg; struct regulator *vdds_dsi_reg;
enum dss_clk_source clk_src; enum dss_clk_source clk_src;
...@@ -57,7 +58,8 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev) ...@@ -57,7 +58,8 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
return container_of(dssdev, struct dpi_data, output); return container_of(dssdev, struct dpi_data, output);
} }
static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel) static enum dss_clk_source dpi_get_clk_src_dra7xx(struct dpi_data *dpi,
enum omap_channel channel)
{ {
/* /*
* Possible clock sources: * Possible clock sources:
...@@ -69,23 +71,23 @@ static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel) ...@@ -69,23 +71,23 @@ static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel)
switch (channel) { switch (channel) {
case OMAP_DSS_CHANNEL_LCD: case OMAP_DSS_CHANNEL_LCD:
{ {
if (dss_pll_find_by_src(DSS_CLK_SRC_PLL1_1)) if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_1))
return DSS_CLK_SRC_PLL1_1; return DSS_CLK_SRC_PLL1_1;
break; break;
} }
case OMAP_DSS_CHANNEL_LCD2: case OMAP_DSS_CHANNEL_LCD2:
{ {
if (dss_pll_find_by_src(DSS_CLK_SRC_PLL1_3)) if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_3))
return DSS_CLK_SRC_PLL1_3; return DSS_CLK_SRC_PLL1_3;
if (dss_pll_find_by_src(DSS_CLK_SRC_PLL2_3)) if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL2_3))
return DSS_CLK_SRC_PLL2_3; return DSS_CLK_SRC_PLL2_3;
break; break;
} }
case OMAP_DSS_CHANNEL_LCD3: case OMAP_DSS_CHANNEL_LCD3:
{ {
if (dss_pll_find_by_src(DSS_CLK_SRC_PLL2_1)) if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL2_1))
return DSS_CLK_SRC_PLL2_1; return DSS_CLK_SRC_PLL2_1;
if (dss_pll_find_by_src(DSS_CLK_SRC_PLL1_3)) if (dss_pll_find_by_src(dpi->dss, DSS_CLK_SRC_PLL1_3))
return DSS_CLK_SRC_PLL1_3; return DSS_CLK_SRC_PLL1_3;
break; break;
} }
...@@ -132,7 +134,7 @@ static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi) ...@@ -132,7 +134,7 @@ static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi)
} }
case DSS_MODEL_DRA7: case DSS_MODEL_DRA7:
return dpi_get_clk_src_dra7xx(channel); return dpi_get_clk_src_dra7xx(dpi, channel);
default: default:
return DSS_CLK_SRC_FCK; return DSS_CLK_SRC_FCK;
...@@ -141,7 +143,7 @@ static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi) ...@@ -141,7 +143,7 @@ static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi)
struct dpi_clk_calc_ctx { struct dpi_clk_calc_ctx {
struct dss_pll *pll; struct dss_pll *pll;
unsigned clkout_idx; unsigned int clkout_idx;
/* inputs */ /* inputs */
...@@ -189,8 +191,9 @@ static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc, ...@@ -189,8 +191,9 @@ static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc,
ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc; ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc;
ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc; ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc;
return dispc_div_calc(dispc, ctx->pck_min, ctx->pck_max, return dispc_div_calc(ctx->pll->dss->dispc, dispc,
dpi_calc_dispc_cb, ctx); ctx->pck_min, ctx->pck_max,
dpi_calc_dispc_cb, ctx);
} }
...@@ -206,7 +209,7 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint, ...@@ -206,7 +209,7 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint,
ctx->pll_cinfo.clkdco = clkdco; ctx->pll_cinfo.clkdco = clkdco;
return dss_pll_hsdiv_calc_a(ctx->pll, clkdco, return dss_pll_hsdiv_calc_a(ctx->pll, clkdco,
ctx->pck_min, dss_get_max_fck_rate(), ctx->pck_min, dss_get_max_fck_rate(ctx->pll->dss),
dpi_calc_hsdiv_cb, ctx); dpi_calc_hsdiv_cb, ctx);
} }
...@@ -216,8 +219,9 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data) ...@@ -216,8 +219,9 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data)
ctx->fck = fck; ctx->fck = fck;
return dispc_div_calc(fck, ctx->pck_min, ctx->pck_max, return dispc_div_calc(ctx->pll->dss->dispc, fck,
dpi_calc_dispc_cb, ctx); ctx->pck_min, ctx->pck_max,
dpi_calc_dispc_cb, ctx);
} }
static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck, static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
...@@ -255,7 +259,8 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck, ...@@ -255,7 +259,8 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
} }
} }
static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) static bool dpi_dss_clk_calc(struct dpi_data *dpi, unsigned long pck,
struct dpi_clk_calc_ctx *ctx)
{ {
int i; int i;
...@@ -276,7 +281,8 @@ static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) ...@@ -276,7 +281,8 @@ static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)
ctx->pck_min = 0; ctx->pck_min = 0;
ctx->pck_max = pck + 1000 * i * i * i; ctx->pck_max = pck + 1000 * i * i * i;
ok = dss_div_calc(pck, ctx->pck_min, dpi_calc_dss_cb, ctx); ok = dss_div_calc(dpi->dss, pck, ctx->pck_min,
dpi_calc_dss_cb, ctx);
if (ok) if (ok)
return ok; return ok;
} }
...@@ -302,7 +308,7 @@ static int dpi_set_pll_clk(struct dpi_data *dpi, enum omap_channel channel, ...@@ -302,7 +308,7 @@ static int dpi_set_pll_clk(struct dpi_data *dpi, enum omap_channel channel,
if (r) if (r)
return r; return r;
dss_select_lcd_clk_source(channel, dpi->clk_src); dss_select_lcd_clk_source(dpi->dss, channel, dpi->clk_src);
dpi->mgr_config.clock_info = ctx.dispc_cinfo; dpi->mgr_config.clock_info = ctx.dispc_cinfo;
...@@ -320,11 +326,11 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req, ...@@ -320,11 +326,11 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,
int r; int r;
bool ok; bool ok;
ok = dpi_dss_clk_calc(pck_req, &ctx); ok = dpi_dss_clk_calc(dpi, pck_req, &ctx);
if (!ok) if (!ok)
return -EINVAL; return -EINVAL;
r = dss_set_fck_rate(ctx.fck); r = dss_set_fck_rate(dpi->dss, ctx.fck);
if (r) if (r)
return r; return r;
...@@ -339,8 +345,6 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req, ...@@ -339,8 +345,6 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,
static int dpi_set_mode(struct dpi_data *dpi) static int dpi_set_mode(struct dpi_data *dpi)
{ {
struct omap_dss_device *out = &dpi->output;
enum omap_channel channel = out->dispc_channel;
struct videomode *vm = &dpi->vm; struct videomode *vm = &dpi->vm;
int lck_div = 0, pck_div = 0; int lck_div = 0, pck_div = 0;
unsigned long fck = 0; unsigned long fck = 0;
...@@ -348,8 +352,8 @@ static int dpi_set_mode(struct dpi_data *dpi) ...@@ -348,8 +352,8 @@ static int dpi_set_mode(struct dpi_data *dpi)
int r = 0; int r = 0;
if (dpi->pll) if (dpi->pll)
r = dpi_set_pll_clk(dpi, channel, vm->pixelclock, &fck, r = dpi_set_pll_clk(dpi, dpi->output.dispc_channel,
&lck_div, &pck_div); vm->pixelclock, &fck, &lck_div, &pck_div);
else else
r = dpi_set_dispc_clk(dpi, vm->pixelclock, &fck, r = dpi_set_dispc_clk(dpi, vm->pixelclock, &fck,
&lck_div, &pck_div); &lck_div, &pck_div);
...@@ -365,16 +369,13 @@ static int dpi_set_mode(struct dpi_data *dpi) ...@@ -365,16 +369,13 @@ static int dpi_set_mode(struct dpi_data *dpi)
vm->pixelclock = pck; vm->pixelclock = pck;
} }
dss_mgr_set_timings(channel, vm); dss_mgr_set_timings(&dpi->output, vm);
return 0; return 0;
} }
static void dpi_config_lcd_manager(struct dpi_data *dpi) static void dpi_config_lcd_manager(struct dpi_data *dpi)
{ {
struct omap_dss_device *out = &dpi->output;
enum omap_channel channel = out->dispc_channel;
dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS; dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
dpi->mgr_config.stallmode = false; dpi->mgr_config.stallmode = false;
...@@ -384,14 +385,13 @@ static void dpi_config_lcd_manager(struct dpi_data *dpi) ...@@ -384,14 +385,13 @@ static void dpi_config_lcd_manager(struct dpi_data *dpi)
dpi->mgr_config.lcden_sig_polarity = 0; dpi->mgr_config.lcden_sig_polarity = 0;
dss_mgr_set_lcd_config(channel, &dpi->mgr_config); dss_mgr_set_lcd_config(&dpi->output, &dpi->mgr_config);
} }
static int dpi_display_enable(struct omap_dss_device *dssdev) static int dpi_display_enable(struct omap_dss_device *dssdev)
{ {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
struct omap_dss_device *out = &dpi->output; struct omap_dss_device *out = &dpi->output;
enum omap_channel channel = out->dispc_channel;
int r; int r;
mutex_lock(&dpi->lock); mutex_lock(&dpi->lock);
...@@ -408,11 +408,11 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) ...@@ -408,11 +408,11 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
goto err_reg_enable; goto err_reg_enable;
} }
r = dispc_runtime_get(); r = dispc_runtime_get(dpi->dss->dispc);
if (r) if (r)
goto err_get_dispc; goto err_get_dispc;
r = dss_dpi_select_source(out->port_num, channel); r = dss_dpi_select_source(dpi->dss, out->port_num, out->dispc_channel);
if (r) if (r)
goto err_src_sel; goto err_src_sel;
...@@ -430,7 +430,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) ...@@ -430,7 +430,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
mdelay(2); mdelay(2);
r = dss_mgr_enable(channel); r = dss_mgr_enable(&dpi->output);
if (r) if (r)
goto err_mgr_enable; goto err_mgr_enable;
...@@ -444,7 +444,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) ...@@ -444,7 +444,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
dss_pll_disable(dpi->pll); dss_pll_disable(dpi->pll);
err_pll_init: err_pll_init:
err_src_sel: err_src_sel:
dispc_runtime_put(); dispc_runtime_put(dpi->dss->dispc);
err_get_dispc: err_get_dispc:
if (dpi->vdds_dsi_reg) if (dpi->vdds_dsi_reg)
regulator_disable(dpi->vdds_dsi_reg); regulator_disable(dpi->vdds_dsi_reg);
...@@ -457,18 +457,18 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) ...@@ -457,18 +457,18 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
static void dpi_display_disable(struct omap_dss_device *dssdev) static void dpi_display_disable(struct omap_dss_device *dssdev)
{ {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
enum omap_channel channel = dpi->output.dispc_channel;
mutex_lock(&dpi->lock); mutex_lock(&dpi->lock);
dss_mgr_disable(channel); dss_mgr_disable(&dpi->output);
if (dpi->pll) { if (dpi->pll) {
dss_select_lcd_clk_source(channel, DSS_CLK_SRC_FCK); dss_select_lcd_clk_source(dpi->dss, dpi->output.dispc_channel,
DSS_CLK_SRC_FCK);
dss_pll_disable(dpi->pll); dss_pll_disable(dpi->pll);
} }
dispc_runtime_put(); dispc_runtime_put(dpi->dss->dispc);
if (dpi->vdds_dsi_reg) if (dpi->vdds_dsi_reg)
regulator_disable(dpi->vdds_dsi_reg); regulator_disable(dpi->vdds_dsi_reg);
...@@ -516,7 +516,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, ...@@ -516,7 +516,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
if (vm->hactive % 8 != 0) if (vm->hactive % 8 != 0)
return -EINVAL; return -EINVAL;
if (!dispc_mgr_timings_ok(channel, vm)) if (!dispc_mgr_timings_ok(dpi->dss->dispc, channel, vm))
return -EINVAL; return -EINVAL;
if (vm->pixelclock == 0) if (vm->pixelclock == 0)
...@@ -529,7 +529,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, ...@@ -529,7 +529,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
fck = ctx.pll_cinfo.clkout[ctx.clkout_idx]; fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
} else { } else {
ok = dpi_dss_clk_calc(vm->pixelclock, &ctx); ok = dpi_dss_clk_calc(dpi, vm->pixelclock, &ctx);
if (!ok) if (!ok)
return -EINVAL; return -EINVAL;
...@@ -602,7 +602,7 @@ static void dpi_init_pll(struct dpi_data *dpi) ...@@ -602,7 +602,7 @@ static void dpi_init_pll(struct dpi_data *dpi)
dpi->clk_src = dpi_get_clk_src(dpi); dpi->clk_src = dpi_get_clk_src(dpi);
pll = dss_pll_find_by_src(dpi->clk_src); pll = dss_pll_find_by_src(dpi->dss, dpi->clk_src);
if (!pll) if (!pll)
return; return;
...@@ -654,7 +654,6 @@ static int dpi_connect(struct omap_dss_device *dssdev, ...@@ -654,7 +654,6 @@ static int dpi_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
enum omap_channel channel = dpi->output.dispc_channel;
int r; int r;
r = dpi_init_regulator(dpi); r = dpi_init_regulator(dpi);
...@@ -663,7 +662,7 @@ static int dpi_connect(struct omap_dss_device *dssdev, ...@@ -663,7 +662,7 @@ static int dpi_connect(struct omap_dss_device *dssdev,
dpi_init_pll(dpi); dpi_init_pll(dpi);
r = dss_mgr_connect(channel, dssdev); r = dss_mgr_connect(&dpi->output, dssdev);
if (r) if (r)
return r; return r;
...@@ -671,7 +670,7 @@ static int dpi_connect(struct omap_dss_device *dssdev, ...@@ -671,7 +670,7 @@ static int dpi_connect(struct omap_dss_device *dssdev,
if (r) { if (r) {
DSSERR("failed to connect output to new device: %s\n", DSSERR("failed to connect output to new device: %s\n",
dst->name); dst->name);
dss_mgr_disconnect(channel, dssdev); dss_mgr_disconnect(&dpi->output, dssdev);
return r; return r;
} }
...@@ -682,7 +681,6 @@ static void dpi_disconnect(struct omap_dss_device *dssdev, ...@@ -682,7 +681,6 @@ static void dpi_disconnect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev); struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
enum omap_channel channel = dpi->output.dispc_channel;
WARN_ON(dst != dssdev->dst); WARN_ON(dst != dssdev->dst);
...@@ -691,7 +689,7 @@ static void dpi_disconnect(struct omap_dss_device *dssdev, ...@@ -691,7 +689,7 @@ static void dpi_disconnect(struct omap_dss_device *dssdev,
omapdss_output_unset_device(dssdev); omapdss_output_unset_device(dssdev);
dss_mgr_disconnect(channel, dssdev); dss_mgr_disconnect(&dpi->output, dssdev);
} }
static const struct omapdss_dpi_ops dpi_ops = { static const struct omapdss_dpi_ops dpi_ops = {
...@@ -748,8 +746,8 @@ static void dpi_uninit_output_port(struct device_node *port) ...@@ -748,8 +746,8 @@ static void dpi_uninit_output_port(struct device_node *port)
omapdss_unregister_output(out); omapdss_unregister_output(out);
} }
int dpi_init_port(struct platform_device *pdev, struct device_node *port, int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
enum dss_model dss_model) struct device_node *port, enum dss_model dss_model)
{ {
struct dpi_data *dpi; struct dpi_data *dpi;
struct device_node *ep; struct device_node *ep;
...@@ -776,6 +774,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port, ...@@ -776,6 +774,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port,
dpi->pdev = pdev; dpi->pdev = pdev;
dpi->dss_model = dss_model; dpi->dss_model = dss_model;
dpi->dss = dss;
port->data = dpi; port->data = dpi;
mutex_init(&dpi->lock); mutex_init(&dpi->lock);
......
This diff is collapsed.
...@@ -44,7 +44,6 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port) ...@@ -44,7 +44,6 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port)
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(dss_of_port_get_parent_device);
u32 dss_of_port_get_port_number(struct device_node *port) u32 dss_of_port_get_port_number(struct device_node *port)
{ {
...@@ -57,7 +56,6 @@ u32 dss_of_port_get_port_number(struct device_node *port) ...@@ -57,7 +56,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)
return reg; return reg;
} }
EXPORT_SYMBOL_GPL(dss_of_port_get_port_number);
struct omap_dss_device * struct omap_dss_device *
omapdss_of_find_source_for_first_ep(struct device_node *node) omapdss_of_find_source_for_first_ep(struct device_node *node)
......
This diff is collapsed.
This diff is collapsed.
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "omapdss.h" #include "omapdss.h"
#include "dss.h" #include "dss.h"
struct dss_device;
/* HDMI Wrapper */ /* HDMI Wrapper */
#define HDMI_WP_REVISION 0x0 #define HDMI_WP_REVISION 0x0
...@@ -324,8 +326,8 @@ phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp); ...@@ -324,8 +326,8 @@ phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);
/* HDMI PLL funcs */ /* HDMI PLL funcs */
void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s); void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll, int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev,
struct hdmi_wp_data *wp); struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
void hdmi_pll_uninit(struct hdmi_pll_data *hpll); void hdmi_pll_uninit(struct hdmi_pll_data *hpll);
/* HDMI PHY funcs */ /* HDMI PHY funcs */
...@@ -357,6 +359,9 @@ static inline bool hdmi_mode_has_audio(struct hdmi_config *cfg) ...@@ -357,6 +359,9 @@ static inline bool hdmi_mode_has_audio(struct hdmi_config *cfg)
struct omap_hdmi { struct omap_hdmi {
struct mutex lock; struct mutex lock;
struct platform_device *pdev; struct platform_device *pdev;
struct dss_device *dss;
struct dss_debugfs_entry *debugfs;
struct hdmi_wp_data wp; struct hdmi_wp_data wp;
struct hdmi_pll_data pll; struct hdmi_pll_data pll;
...@@ -384,4 +389,6 @@ struct omap_hdmi { ...@@ -384,4 +389,6 @@ struct omap_hdmi {
bool display_enabled; bool display_enabled;
}; };
#define dssdev_to_hdmi(dssdev) container_of(dssdev, struct omap_hdmi, output)
#endif #endif
This diff is collapsed.
...@@ -175,10 +175,10 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) ...@@ -175,10 +175,10 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3); REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3);
hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE); hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE);
hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE); hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE);
hdmi4_core_disable(NULL); hdmi4_core_disable(core);
return 0; return 0;
} }
err = hdmi4_core_enable(NULL); err = hdmi4_core_enable(core);
if (err) if (err)
return err; return err;
......
...@@ -266,8 +266,8 @@ void hdmi4_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp, ...@@ -266,8 +266,8 @@ void hdmi4_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s); void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s);
int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core); int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
int hdmi4_core_enable(struct omap_dss_device *dssdev); int hdmi4_core_enable(struct hdmi_core_data *core);
void hdmi4_core_disable(struct omap_dss_device *dssdev); void hdmi4_core_disable(struct hdmi_core_data *core);
void hdmi4_core_powerdown_disable(struct hdmi_core_data *core); void hdmi4_core_powerdown_disable(struct hdmi_core_data *core);
int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp); int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
......
This diff is collapsed.
...@@ -50,14 +50,14 @@ static void hdmi_core_ddc_init(struct hdmi_core_data *core) ...@@ -50,14 +50,14 @@ static void hdmi_core_ddc_init(struct hdmi_core_data *core)
{ {
void __iomem *base = core->base; void __iomem *base = core->base;
const unsigned long long iclk = 266000000; /* DSS L3 ICLK */ const unsigned long long iclk = 266000000; /* DSS L3 ICLK */
const unsigned ss_scl_high = 4600; /* ns */ const unsigned int ss_scl_high = 4600; /* ns */
const unsigned ss_scl_low = 5400; /* ns */ const unsigned int ss_scl_low = 5400; /* ns */
const unsigned fs_scl_high = 600; /* ns */ const unsigned int fs_scl_high = 600; /* ns */
const unsigned fs_scl_low = 1300; /* ns */ const unsigned int fs_scl_low = 1300; /* ns */
const unsigned sda_hold = 1000; /* ns */ const unsigned int sda_hold = 1000; /* ns */
const unsigned sfr_div = 10; const unsigned int sfr_div = 10;
unsigned long long sfr; unsigned long long sfr;
unsigned v; unsigned int v;
sfr = iclk / sfr_div; /* SFR_DIV */ sfr = iclk / sfr_div; /* SFR_DIV */
sfr /= 1000; /* SFR clock in kHz */ sfr /= 1000; /* SFR clock in kHz */
...@@ -430,11 +430,11 @@ static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core, ...@@ -430,11 +430,11 @@ static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
void __iomem *base = core->base; void __iomem *base = core->base;
u8 data[HDMI_INFOFRAME_SIZE(AVI)]; u8 data[HDMI_INFOFRAME_SIZE(AVI)];
u8 *ptr; u8 *ptr;
unsigned y, a, b, s; unsigned int y, a, b, s;
unsigned c, m, r; unsigned int c, m, r;
unsigned itc, ec, q, sc; unsigned int itc, ec, q, sc;
unsigned vic; unsigned int vic;
unsigned yq, cn, pr; unsigned int yq, cn, pr;
hdmi_avi_infoframe_pack(frame, data, sizeof(data)); hdmi_avi_infoframe_pack(frame, data, sizeof(data));
......
...@@ -99,7 +99,7 @@ static void hdmi_phy_configure_lanes(struct hdmi_phy_data *phy) ...@@ -99,7 +99,7 @@ static void hdmi_phy_configure_lanes(struct hdmi_phy_data *phy)
u16 lane_cfg = 0; u16 lane_cfg = 0;
int i; int i;
unsigned lane_cfg_val; unsigned int lane_cfg_val;
u16 pol_val = 0; u16 pol_val = 0;
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
......
...@@ -48,7 +48,7 @@ static int hdmi_pll_enable(struct dss_pll *dsspll) ...@@ -48,7 +48,7 @@ static int hdmi_pll_enable(struct dss_pll *dsspll)
r = pm_runtime_get_sync(&pll->pdev->dev); r = pm_runtime_get_sync(&pll->pdev->dev);
WARN_ON(r < 0); WARN_ON(r < 0);
dss_ctrl_pll_enable(DSS_PLL_HDMI, true); dss_ctrl_pll_enable(dsspll, true);
r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS); r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
if (r) if (r)
...@@ -65,7 +65,7 @@ static void hdmi_pll_disable(struct dss_pll *dsspll) ...@@ -65,7 +65,7 @@ static void hdmi_pll_disable(struct dss_pll *dsspll)
hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF); hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
dss_ctrl_pll_enable(DSS_PLL_HDMI, false); dss_ctrl_pll_enable(dsspll, false);
r = pm_runtime_put_sync(&pll->pdev->dev); r = pm_runtime_put_sync(&pll->pdev->dev);
WARN_ON(r < 0 && r != -ENOSYS); WARN_ON(r < 0 && r != -ENOSYS);
...@@ -128,7 +128,8 @@ static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = { ...@@ -128,7 +128,8 @@ static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = {
.has_refsel = true, .has_refsel = true,
}; };
static int hdmi_init_pll_data(struct platform_device *pdev, static int hdmi_init_pll_data(struct dss_device *dss,
struct platform_device *pdev,
struct hdmi_pll_data *hpll) struct hdmi_pll_data *hpll)
{ {
struct dss_pll *pll = &hpll->pll; struct dss_pll *pll = &hpll->pll;
...@@ -153,15 +154,15 @@ static int hdmi_init_pll_data(struct platform_device *pdev, ...@@ -153,15 +154,15 @@ static int hdmi_init_pll_data(struct platform_device *pdev,
pll->ops = &hdmi_pll_ops; pll->ops = &hdmi_pll_ops;
r = dss_pll_register(pll); r = dss_pll_register(dss, pll);
if (r) if (r)
return r; return r;
return 0; return 0;
} }
int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll, int hdmi_pll_init(struct dss_device *dss, struct platform_device *pdev,
struct hdmi_wp_data *wp) struct hdmi_pll_data *pll, struct hdmi_wp_data *wp)
{ {
int r; int r;
struct resource *res; struct resource *res;
...@@ -174,7 +175,7 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll, ...@@ -174,7 +175,7 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
if (IS_ERR(pll->base)) if (IS_ERR(pll->base))
return PTR_ERR(pll->base); return PTR_ERR(pll->base);
r = hdmi_init_pll_data(pdev, pll); r = hdmi_init_pll_data(dss, pdev, pll);
if (r) { if (r) {
DSSERR("failed to init HDMI PLL\n"); DSSERR("failed to init HDMI PLL\n");
return r; return r;
......
...@@ -168,7 +168,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp, ...@@ -168,7 +168,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp,
{ {
u32 timing_h = 0; u32 timing_h = 0;
u32 timing_v = 0; u32 timing_v = 0;
unsigned hsync_len_offset = 1; unsigned int hsync_len_offset = 1;
DSSDBG("Enter hdmi_wp_video_config_timing\n"); DSSDBG("Enter hdmi_wp_video_config_timing\n");
......
This diff is collapsed.
...@@ -156,7 +156,6 @@ struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *po ...@@ -156,7 +156,6 @@ struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *po
return NULL; return NULL;
} }
EXPORT_SYMBOL(omap_dss_find_output_by_port_node);
struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev) struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev)
{ {
...@@ -171,13 +170,16 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device ...@@ -171,13 +170,16 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device
EXPORT_SYMBOL(omapdss_find_output_from_display); EXPORT_SYMBOL(omapdss_find_output_from_display);
static const struct dss_mgr_ops *dss_mgr_ops; static const struct dss_mgr_ops *dss_mgr_ops;
static struct omap_drm_private *dss_mgr_ops_priv;
int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops) int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
struct omap_drm_private *priv)
{ {
if (dss_mgr_ops) if (dss_mgr_ops)
return -EBUSY; return -EBUSY;
dss_mgr_ops = mgr_ops; dss_mgr_ops = mgr_ops;
dss_mgr_ops_priv = priv;
return 0; return 0;
} }
...@@ -186,64 +188,71 @@ EXPORT_SYMBOL(dss_install_mgr_ops); ...@@ -186,64 +188,71 @@ EXPORT_SYMBOL(dss_install_mgr_ops);
void dss_uninstall_mgr_ops(void) void dss_uninstall_mgr_ops(void)
{ {
dss_mgr_ops = NULL; dss_mgr_ops = NULL;
dss_mgr_ops_priv = NULL;
} }
EXPORT_SYMBOL(dss_uninstall_mgr_ops); EXPORT_SYMBOL(dss_uninstall_mgr_ops);
int dss_mgr_connect(enum omap_channel channel, int dss_mgr_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst)
struct omap_dss_device *dst)
{ {
return dss_mgr_ops->connect(channel, dst); return dss_mgr_ops->connect(dss_mgr_ops_priv,
dssdev->dispc_channel, dst);
} }
EXPORT_SYMBOL(dss_mgr_connect); EXPORT_SYMBOL(dss_mgr_connect);
void dss_mgr_disconnect(enum omap_channel channel, void dss_mgr_disconnect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
dss_mgr_ops->disconnect(channel, dst); dss_mgr_ops->disconnect(dss_mgr_ops_priv, dssdev->dispc_channel, dst);
} }
EXPORT_SYMBOL(dss_mgr_disconnect); EXPORT_SYMBOL(dss_mgr_disconnect);
void dss_mgr_set_timings(enum omap_channel channel, const struct videomode *vm) void dss_mgr_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm)
{ {
dss_mgr_ops->set_timings(channel, vm); dss_mgr_ops->set_timings(dss_mgr_ops_priv, dssdev->dispc_channel, vm);
} }
EXPORT_SYMBOL(dss_mgr_set_timings); EXPORT_SYMBOL(dss_mgr_set_timings);
void dss_mgr_set_lcd_config(enum omap_channel channel, void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
const struct dss_lcd_mgr_config *config) const struct dss_lcd_mgr_config *config)
{ {
dss_mgr_ops->set_lcd_config(channel, config); dss_mgr_ops->set_lcd_config(dss_mgr_ops_priv,
dssdev->dispc_channel, config);
} }
EXPORT_SYMBOL(dss_mgr_set_lcd_config); EXPORT_SYMBOL(dss_mgr_set_lcd_config);
int dss_mgr_enable(enum omap_channel channel) int dss_mgr_enable(struct omap_dss_device *dssdev)
{ {
return dss_mgr_ops->enable(channel); return dss_mgr_ops->enable(dss_mgr_ops_priv, dssdev->dispc_channel);
} }
EXPORT_SYMBOL(dss_mgr_enable); EXPORT_SYMBOL(dss_mgr_enable);
void dss_mgr_disable(enum omap_channel channel) void dss_mgr_disable(struct omap_dss_device *dssdev)
{ {
dss_mgr_ops->disable(channel); dss_mgr_ops->disable(dss_mgr_ops_priv, dssdev->dispc_channel);
} }
EXPORT_SYMBOL(dss_mgr_disable); EXPORT_SYMBOL(dss_mgr_disable);
void dss_mgr_start_update(enum omap_channel channel) void dss_mgr_start_update(struct omap_dss_device *dssdev)
{ {
dss_mgr_ops->start_update(channel); dss_mgr_ops->start_update(dss_mgr_ops_priv, dssdev->dispc_channel);
} }
EXPORT_SYMBOL(dss_mgr_start_update); EXPORT_SYMBOL(dss_mgr_start_update);
int dss_mgr_register_framedone_handler(enum omap_channel channel, int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
void (*handler)(void *), void *data) void (*handler)(void *), void *data)
{ {
return dss_mgr_ops->register_framedone_handler(channel, handler, data); return dss_mgr_ops->register_framedone_handler(dss_mgr_ops_priv,
dssdev->dispc_channel,
handler, data);
} }
EXPORT_SYMBOL(dss_mgr_register_framedone_handler); EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
void dss_mgr_unregister_framedone_handler(enum omap_channel channel, void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
void (*handler)(void *), void *data) void (*handler)(void *), void *data)
{ {
dss_mgr_ops->unregister_framedone_handler(channel, handler, data); dss_mgr_ops->unregister_framedone_handler(dss_mgr_ops_priv,
dssdev->dispc_channel,
handler, data);
} }
EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler); EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -32,12 +32,12 @@ struct videomode; ...@@ -32,12 +32,12 @@ struct videomode;
struct videomode *omap_crtc_timings(struct drm_crtc *crtc); struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
enum omap_channel omap_crtc_channel(struct drm_crtc *crtc); enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
void omap_crtc_pre_init(void); void omap_crtc_pre_init(struct omap_drm_private *priv);
void omap_crtc_pre_uninit(void); void omap_crtc_pre_uninit(void);
struct drm_crtc *omap_crtc_init(struct drm_device *dev, struct drm_crtc *omap_crtc_init(struct drm_device *dev,
struct drm_plane *plane, struct omap_dss_device *dssdev); struct drm_plane *plane, struct omap_dss_device *dssdev);
int omap_crtc_wait_pending(struct drm_crtc *crtc); int omap_crtc_wait_pending(struct drm_crtc *crtc);
void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus); void omap_crtc_error_irq(struct drm_crtc *crtc, u32 irqstatus);
void omap_crtc_vblank_irq(struct drm_crtc *crtc); void omap_crtc_vblank_irq(struct drm_crtc *crtc);
#endif /* __OMAPDRM_CRTC_H__ */ #endif /* __OMAPDRM_CRTC_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -46,8 +46,12 @@ ...@@ -46,8 +46,12 @@
struct omap_drm_usergart; struct omap_drm_usergart;
struct omap_drm_private { struct omap_drm_private {
uint32_t omaprev; struct drm_device *ddev;
struct device *dev;
u32 omaprev;
struct dss_device *dss;
struct dispc_device *dispc;
const struct dispc_ops *dispc_ops; const struct dispc_ops *dispc_ops;
unsigned int num_crtcs; unsigned int num_crtcs;
...@@ -81,7 +85,7 @@ struct omap_drm_private { ...@@ -81,7 +85,7 @@ struct omap_drm_private {
/* irq handling: */ /* irq handling: */
spinlock_t wait_lock; /* protects the wait_list */ spinlock_t wait_lock; /* protects the wait_list */
struct list_head wait_list; /* list of omap_irq_wait */ struct list_head wait_list; /* list of omap_irq_wait */
uint32_t irq_mask; /* enabled irqs in addition to wait_list */ u32 irq_mask; /* enabled irqs in addition to wait_list */
/* memory bandwidth limit if it is needed on the platform */ /* memory bandwidth limit if it is needed on the platform */
unsigned int max_bandwidth; unsigned int max_bandwidth;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -32,7 +32,7 @@ void omap_drm_irq_uninstall(struct drm_device *dev); ...@@ -32,7 +32,7 @@ void omap_drm_irq_uninstall(struct drm_device *dev);
int omap_drm_irq_install(struct drm_device *dev); int omap_drm_irq_install(struct drm_device *dev);
struct omap_irq_wait *omap_irq_wait_init(struct drm_device *dev, struct omap_irq_wait *omap_irq_wait_init(struct drm_device *dev,
uint32_t irqmask, int count); u32 irqmask, int count);
int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait, int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
unsigned long timeout); unsigned long timeout);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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