diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2012-07-09 03:25:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-09-26 15:55:22 -0400 |
commit | 8f35c7bc265c99fadb5b4057f623e2e242043736 (patch) | |
tree | a5842a10391d6a167be7fc99b5d2d3a977521f67 /drivers/media/platform | |
parent | 451d43ad44b00bd6d518254086378464ffef96ef (diff) |
[media] media: coda: add horizontal / vertical flipping support
The hardware can also rotate in 90° steps, but there is no
corresponding V4L2_CID defined yet.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/coda.c | 19 | ||||
-rw-r--r-- | drivers/media/platform/coda.h | 9 |
2 files changed, 27 insertions, 1 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 2e046d057e66..23985b3447ac 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -141,6 +141,7 @@ struct coda_dev { | |||
141 | }; | 141 | }; |
142 | 142 | ||
143 | struct coda_params { | 143 | struct coda_params { |
144 | u8 rot_mode; | ||
144 | u8 h264_intra_qp; | 145 | u8 h264_intra_qp; |
145 | u8 h264_inter_qp; | 146 | u8 h264_inter_qp; |
146 | u8 mpeg4_intra_qp; | 147 | u8 mpeg4_intra_qp; |
@@ -700,7 +701,7 @@ static void coda_device_run(void *m2m_priv) | |||
700 | } | 701 | } |
701 | 702 | ||
702 | /* submit */ | 703 | /* submit */ |
703 | coda_write(dev, 0, CODA_CMD_ENC_PIC_ROT_MODE); | 704 | coda_write(dev, CODA_ROT_MIR_ENABLE | ctx->params.rot_mode, CODA_CMD_ENC_PIC_ROT_MODE); |
704 | coda_write(dev, quant_param, CODA_CMD_ENC_PIC_QS); | 705 | coda_write(dev, quant_param, CODA_CMD_ENC_PIC_QS); |
705 | 706 | ||
706 | 707 | ||
@@ -1276,6 +1277,18 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl) | |||
1276 | "s_ctrl: id = %d, val = %d\n", ctrl->id, ctrl->val); | 1277 | "s_ctrl: id = %d, val = %d\n", ctrl->id, ctrl->val); |
1277 | 1278 | ||
1278 | switch (ctrl->id) { | 1279 | switch (ctrl->id) { |
1280 | case V4L2_CID_HFLIP: | ||
1281 | if (ctrl->val) | ||
1282 | ctx->params.rot_mode |= CODA_MIR_HOR; | ||
1283 | else | ||
1284 | ctx->params.rot_mode &= ~CODA_MIR_HOR; | ||
1285 | break; | ||
1286 | case V4L2_CID_VFLIP: | ||
1287 | if (ctrl->val) | ||
1288 | ctx->params.rot_mode |= CODA_MIR_VER; | ||
1289 | else | ||
1290 | ctx->params.rot_mode &= ~CODA_MIR_VER; | ||
1291 | break; | ||
1279 | case V4L2_CID_MPEG_VIDEO_BITRATE: | 1292 | case V4L2_CID_MPEG_VIDEO_BITRATE: |
1280 | ctx->params.bitrate = ctrl->val / 1000; | 1293 | ctx->params.bitrate = ctrl->val / 1000; |
1281 | break; | 1294 | break; |
@@ -1321,6 +1334,10 @@ static int coda_ctrls_setup(struct coda_ctx *ctx) | |||
1321 | v4l2_ctrl_handler_init(&ctx->ctrls, 9); | 1334 | v4l2_ctrl_handler_init(&ctx->ctrls, 9); |
1322 | 1335 | ||
1323 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | 1336 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
1337 | V4L2_CID_HFLIP, 0, 1, 1, 0); | ||
1338 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | ||
1339 | V4L2_CID_VFLIP, 0, 1, 1, 0); | ||
1340 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | ||
1324 | V4L2_CID_MPEG_VIDEO_BITRATE, 0, 32767000, 1, 0); | 1341 | V4L2_CID_MPEG_VIDEO_BITRATE, 0, 32767000, 1, 0); |
1325 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | 1342 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
1326 | V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 60, 1, 16); | 1343 | V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 60, 1, 16); |
diff --git a/drivers/media/platform/coda.h b/drivers/media/platform/coda.h index 332401033194..f3f5e43c1ac2 100644 --- a/drivers/media/platform/coda.h +++ b/drivers/media/platform/coda.h | |||
@@ -188,6 +188,15 @@ | |||
188 | #define CODA_CMD_ENC_PIC_SRC_ADDR_CR 0x188 | 188 | #define CODA_CMD_ENC_PIC_SRC_ADDR_CR 0x188 |
189 | #define CODA_CMD_ENC_PIC_QS 0x18c | 189 | #define CODA_CMD_ENC_PIC_QS 0x18c |
190 | #define CODA_CMD_ENC_PIC_ROT_MODE 0x190 | 190 | #define CODA_CMD_ENC_PIC_ROT_MODE 0x190 |
191 | #define CODA_ROT_MIR_ENABLE (1 << 4) | ||
192 | #define CODA_ROT_0 (0x0 << 0) | ||
193 | #define CODA_ROT_90 (0x1 << 0) | ||
194 | #define CODA_ROT_180 (0x2 << 0) | ||
195 | #define CODA_ROT_270 (0x3 << 0) | ||
196 | #define CODA_MIR_NONE (0x0 << 2) | ||
197 | #define CODA_MIR_VER (0x1 << 2) | ||
198 | #define CODA_MIR_HOR (0x2 << 2) | ||
199 | #define CODA_MIR_VER_HOR (0x3 << 2) | ||
191 | #define CODA_CMD_ENC_PIC_OPTION 0x194 | 200 | #define CODA_CMD_ENC_PIC_OPTION 0x194 |
192 | #define CODA_CMD_ENC_PIC_BB_START 0x198 | 201 | #define CODA_CMD_ENC_PIC_BB_START 0x198 |
193 | #define CODA_CMD_ENC_PIC_BB_SIZE 0x19c | 202 | #define CODA_CMD_ENC_PIC_BB_SIZE 0x19c |