Skip to content

Commit

Permalink
OMAPDSS: AnalogTV: Add ops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tomi Valkeinen committed Jun 17, 2013
1 parent 7700c2d commit fb8efa4
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
72 changes: 72 additions & 0 deletions drivers/video/omap2/dss/venc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
26 changes: 26 additions & 0 deletions include/video/omapdss.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit fb8efa4

Please sign in to comment.