From: Tomi Valkeinen Date: Fri, 24 May 2013 10:19:50 +0000 (+0300) Subject: OMAPDSS: AnalogTV: Add ops X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fb8efa49660ea450ad632c9d8b70f12e4a43a495;p=openwrt%2Fstaging%2Fblogic.git OMAPDSS: AnalogTV: Add ops Add "ops" style method for using analog TV functionality. Ops style calls will allow us to have arbitrarily long display pipelines, where each entity can call ops in the previous display entity. Signed-off-by: Tomi Valkeinen --- diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index e47b64eee62c..496a106fe823 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -564,6 +564,16 @@ int omapdss_venc_check_timings(struct omap_dss_device *dssdev, return -EINVAL; } +static void venc_get_timings(struct omap_dss_device *dssdev, + struct omap_video_timings *timings) +{ + mutex_lock(&venc.venc_lock); + + *timings = venc.timings; + + mutex_unlock(&venc.venc_lock); +} + u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev) { /* Invert due to VENC_L21_WC_CTL:INV=1 */ @@ -779,6 +789,67 @@ static int venc_probe_pdata(struct platform_device *vencdev) return 0; } +static int venc_connect(struct omap_dss_device *dssdev, + struct omap_dss_device *dst) +{ + struct omap_overlay_manager *mgr; + int r; + + r = venc_init_regulator(); + if (r) + return r; + + mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); + if (!mgr) + return -ENODEV; + + r = dss_mgr_connect(mgr, dssdev); + if (r) + return r; + + r = omapdss_output_set_device(dssdev, dst); + if (r) { + DSSERR("failed to connect output to new device: %s\n", + dst->name); + dss_mgr_disconnect(mgr, dssdev); + return r; + } + + return 0; +} + +static void venc_disconnect(struct omap_dss_device *dssdev, + struct omap_dss_device *dst) +{ + WARN_ON(dst != dssdev->device); + + if (dst != dssdev->device) + return; + + omapdss_output_unset_device(dssdev); + + if (dssdev->manager) + dss_mgr_disconnect(dssdev->manager, dssdev); +} + +static const struct omapdss_atv_ops venc_ops = { + .connect = venc_connect, + .disconnect = venc_disconnect, + + .enable = omapdss_venc_display_enable, + .disable = omapdss_venc_display_disable, + + .check_timings = omapdss_venc_check_timings, + .set_timings = omapdss_venc_set_timings, + .get_timings = venc_get_timings, + + .set_type = omapdss_venc_set_type, + .invert_vid_out_polarity = omapdss_venc_invert_vid_out_polarity, + + .set_wss = omapdss_venc_set_wss, + .get_wss = omapdss_venc_get_wss, +}; + static void venc_init_output(struct platform_device *pdev) { struct omap_dss_device *out = &venc.output; @@ -788,6 +859,7 @@ static void venc_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_VENC; out->name = "venc.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; + out->ops.atv = &venc_ops; out->owner = THIS_MODULE; omapdss_register_output(out); diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 3b3903fa1500..adb103633bd1 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -628,6 +628,31 @@ struct omapdss_dvi_ops { struct omap_video_timings *timings); }; +struct omapdss_atv_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); + + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + + void (*set_type)(struct omap_dss_device *dssdev, + enum omap_dss_venc_type type); + void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev, + bool invert_polarity); + + int (*set_wss)(struct omap_dss_device *dssdev, u32 wss); + u32 (*get_wss)(struct omap_dss_device *dssdev); +}; + struct omap_dss_device { /* old device, to be removed */ struct device old_dev; @@ -697,6 +722,7 @@ struct omap_dss_device { const struct omapdss_dpi_ops *dpi; const struct omapdss_sdi_ops *sdi; const struct omapdss_dvi_ops *dvi; + const struct omapdss_atv_ops *atv; } ops; /* helper variable for driver suspend/resume */