if (r)
return r;
- r = omapdss_output_set_device(dst, dst->next);
+ r = omapdss_device_connect(dst->dss, dst, dst->next);
if (r) {
- DSSERR("failed to connect output to new device: %s\n",
- dst->name);
- goto err_mgr_disconnect;
+ dss_mgr_disconnect(dst);
+ return r;
}
- r = omapdss_device_connect(dst->dss, dst, dst->next);
- if (r)
- goto err_output_unset;
-
return 0;
-
-err_output_unset:
- omapdss_output_unset_device(dst);
-err_mgr_disconnect:
- dss_mgr_disconnect(dst);
- return r;
}
static void dpi_disconnect(struct omap_dss_device *src,
{
struct omap_dss_device *out = &dpi->output;
u32 port_num = 0;
+ int r;
of_property_read_u32(port, "reg", &port_num);
dpi->id = port_num <= 2 ? port_num : 0;
return PTR_ERR(out->next);
}
+ r = omapdss_output_validate(out);
+ if (r) {
+ omapdss_device_put(out->next);
+ out->next = NULL;
+ return r;
+ }
+
omapdss_device_register(out);
return 0;
if (r)
return r;
- r = omapdss_output_set_device(dst, dst->next);
+ r = omapdss_device_connect(dst->dss, dst, dst->next);
if (r) {
- DSSERR("failed to connect output to new device: %s\n",
- dst->name);
- goto err_mgr_disconnect;
+ dss_mgr_disconnect(dst);
+ return r;
}
- r = omapdss_device_connect(dst->dss, dst, dst->next);
- if (r)
- goto err_output_unset;
-
return 0;
-
-err_output_unset:
- omapdss_output_unset_device(dst);
-err_mgr_disconnect:
- dss_mgr_disconnect(dst);
- return r;
}
static void dsi_disconnect(struct omap_dss_device *src,
static int dsi_init_output(struct dsi_data *dsi)
{
struct omap_dss_device *out = &dsi->output;
+ int r;
out->dev = dsi->dev;
out->id = dsi->module_id == 0 ?
return PTR_ERR(out->next);
}
+ r = omapdss_output_validate(out);
+ if (r) {
+ omapdss_device_put(out->next);
+ out->next = NULL;
+ return r;
+ }
+
omapdss_device_register(out);
return 0;
if (r)
return r;
- r = omapdss_output_set_device(dst, dst->next);
+ r = omapdss_device_connect(dst->dss, dst, dst->next);
if (r) {
- DSSERR("failed to connect output to new device: %s\n",
- dst->name);
- goto err_mgr_disconnect;
+ dss_mgr_disconnect(dst);
+ return r;
}
- r = omapdss_device_connect(dst->dss, dst, dst->next);
- if (r)
- goto err_output_unset;
-
return 0;
-
-err_output_unset:
- omapdss_output_unset_device(dst);
-err_mgr_disconnect:
- dss_mgr_disconnect(dst);
- return r;
}
static void hdmi_disconnect(struct omap_dss_device *src,
static int hdmi4_init_output(struct omap_hdmi *hdmi)
{
struct omap_dss_device *out = &hdmi->output;
+ int r;
out->dev = &hdmi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_HDMI;
return PTR_ERR(out->next);
}
+ r = omapdss_output_validate(out);
+ if (r) {
+ omapdss_device_put(out->next);
+ out->next = NULL;
+ return r;
+ }
+
omapdss_device_register(out);
return 0;
if (r)
return r;
- r = omapdss_output_set_device(dst, dst->next);
+ r = omapdss_device_connect(dst->dss, dst, dst->next);
if (r) {
- DSSERR("failed to connect output to new device: %s\n",
- dst->name);
- goto err_mgr_disconnect;
+ dss_mgr_disconnect(dst);
+ return r;
}
- r = omapdss_device_connect(dst->dss, dst, dst->next);
- if (r)
- goto err_output_unset;
-
return 0;
-
-err_output_unset:
- omapdss_output_unset_device(dst);
-err_mgr_disconnect:
- dss_mgr_disconnect(dst);
- return r;
}
static void hdmi_disconnect(struct omap_dss_device *src,
static int hdmi5_init_output(struct omap_hdmi *hdmi)
{
struct omap_dss_device *out = &hdmi->output;
+ int r;
out->dev = &hdmi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_HDMI;
return PTR_ERR(out->next);
}
+ r = omapdss_output_validate(out);
+ if (r) {
+ omapdss_device_put(out->next);
+ out->next = NULL;
+ return r;
+ }
+
omapdss_device_register(out);
return 0;
#define for_each_dss_output(d) \
while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_OUTPUT)) != NULL)
-int omapdss_output_set_device(struct omap_dss_device *out,
- struct omap_dss_device *dssdev);
+int omapdss_output_validate(struct omap_dss_device *out);
int omapdss_output_unset_device(struct omap_dss_device *out);
typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
static DEFINE_MUTEX(output_lock);
-int omapdss_output_set_device(struct omap_dss_device *out,
- struct omap_dss_device *dssdev)
+int omapdss_output_validate(struct omap_dss_device *out)
{
- int r = 0;
-
- mutex_lock(&output_lock);
-
- if (out->output_type != dssdev->type) {
+ if (out->next && out->output_type != out->next->type) {
dev_err(out->dev, "output type and display type don't match\n");
- r = -EINVAL;
+ return -EINVAL;
}
- mutex_unlock(&output_lock);
-
- return r;
+ return 0;
}
-EXPORT_SYMBOL(omapdss_output_set_device);
+EXPORT_SYMBOL(omapdss_output_validate);
int omapdss_output_unset_device(struct omap_dss_device *out)
{
if (r)
return r;
- r = omapdss_output_set_device(dst, dst);
+ r = omapdss_device_connect(dst->dss, dst, dst->next);
if (r) {
- DSSERR("failed to connect output to new device: %s\n",
- dst->name);
- goto err_mgr_disconnect;
+ dss_mgr_disconnect(dst);
+ return r;
}
- r = omapdss_device_connect(dst->dss, dst, dst->next);
- if (r)
- goto err_output_unset;
-
return 0;
-
-err_output_unset:
- omapdss_output_unset_device(dst);
-err_mgr_disconnect:
- dss_mgr_disconnect(dst);
- return r;
}
static void sdi_disconnect(struct omap_dss_device *src,
static int sdi_init_output(struct sdi_device *sdi)
{
struct omap_dss_device *out = &sdi->output;
+ int r;
out->dev = &sdi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_SDI;
return PTR_ERR(out->next);
}
+ r = omapdss_output_validate(out);
+ if (r) {
+ omapdss_device_put(out->next);
+ out->next = NULL;
+ return r;
+ }
+
omapdss_device_register(out);
return 0;
if (r)
return r;
- r = omapdss_output_set_device(dst, dst->next);
+ r = omapdss_device_connect(dst->dss, dst, dst->next);
if (r) {
- DSSERR("failed to connect output to new device: %s\n",
- dst->name);
- goto err_mgr_disconnect;
+ dss_mgr_disconnect(dst);
+ return r;
}
- r = omapdss_device_connect(dst->dss, dst, dst->next);
- if (r)
- goto err_output_unset;
-
return 0;
-
-err_output_unset:
- omapdss_output_unset_device(dst);
-err_mgr_disconnect:
- dss_mgr_disconnect(dst);
- return r;
}
static void venc_disconnect(struct omap_dss_device *src,
static int venc_init_output(struct venc_device *venc)
{
struct omap_dss_device *out = &venc->output;
+ int r;
out->dev = &venc->pdev->dev;
out->id = OMAP_DSS_OUTPUT_VENC;
return PTR_ERR(out->next);
}
+ r = omapdss_output_validate(out);
+ if (r) {
+ omapdss_device_put(out->next);
+ out->next = NULL;
+ return r;
+ }
+
omapdss_device_register(out);
return 0;