]> git.karo-electronics.de Git - linux-beck.git/commitdiff
OMAPDSS: AnalogTV: Add ops
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 24 May 2013 10:19:50 +0000 (13:19 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 17 Jun 2013 11:01:00 +0000 (14:01 +0300)
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 <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/venc.c
include/video/omapdss.h

index e47b64eee62cdf67dac8da459eda61c5c75fb5ac..496a106fe8231a2ff0f5f6aa473b017ff933a00a 100644 (file)
@@ -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);
index 3b3903fa1500653322ea6ac9baec0c71bba4a23a..adb103633bd18b01395d0680ce07717078511741 100644 (file)
@@ -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 */