17 #include <linux/module.h>
18 #include <linux/kernel.h>
20 #include <linux/ctype.h>
22 #include <linux/device.h>
25 #include <linux/videodev2.h>
26 #include <linux/slab.h>
28 #include <mach/hardware.h>
41 #define MODULE_NAME VPBE_VENC_SUBDEV_NAME
83 u32 new_val = (venc_read(sd, offset) & ~mask) | (val & mask);
85 venc_write(sd, offset, new_val);
101 #define VDAC_COMPONENT 0x543
102 #define VDAC_S_VIDEO 0x210
127 static void venc_enabledigitaloutput(
struct v4l2_subdev *sd,
int benable)
186 #define VDAC_CONFIG_SD_V3 0x0E21A6B6
187 #define VDAC_CONFIG_SD_V2 0x081141CF
204 venc_enabledigitaloutput(sd, 0);
250 venc_enabledigitaloutput(sd, 0);
284 #define VDAC_CONFIG_HD_V2 0x081141EF
290 static int venc_set_480p59_94(
struct v4l2_subdev *sd)
304 venc_enabledigitaloutput(sd, 0);
351 venc_enabledigitaloutput(sd, 0);
383 static int venc_set_720p60_internal(
struct v4l2_subdev *sd)
391 venc_enabledigitaloutput(sd, 0);
411 static int venc_set_1080i30_internal(
struct v4l2_subdev *sd)
419 venc_enabledigitaloutput(sd, 0);
442 return venc_set_ntsc(sd);
444 return venc_set_pal(sd);
449 static int venc_s_dv_timings(
struct v4l2_subdev *sd,
459 return venc_set_576p50(sd);
460 else if (height == 480)
461 return venc_set_480p59_94(sd);
462 else if ((height == 720) &&
465 ret = venc_set_720p60_internal(sd);
469 }
else if ((height == 1080) &&
472 ret = venc_set_1080i30_internal(sd);
488 ret = venc_set_dac(sd, output);
520 .s_routing = venc_s_routing,
521 .s_std_output = venc_s_std_output,
522 .s_dv_timings = venc_s_dv_timings,
526 .core = &venc_core_ops,
527 .video = &venc_video_ops,
539 ret = venc_s_routing(sd, 0, venc->
output, 0);
541 v4l2_err(sd,
"Error setting output during init\n");
545 ret = venc_s_std_output(sd, venc->
std);
547 v4l2_err(sd,
"Error setting std during init\n");
560 *venc = platform_get_drvdata(pdev);
566 const char *venc_name)
581 "vpbe unable to register venc sub device\n");
584 if (venc_initialize(&venc->
sd)) {
586 "vpbe venc initialization failed\n");
605 venc->
pdata = pdev->
dev.platform_data;
607 dev_err(venc->
pdev,
"Unable to get platform data for"
615 "Unable to get VENC register address map\n");
621 dev_err(venc->
pdev,
"Unable to reserve VENC MMIO region\n");
628 dev_err(venc->
pdev,
"Unable to map VENC IO space\n");
630 goto release_venc_mem_region;
637 "Unable to get VDAC_CONFIG address map\n");
643 resource_size(res),
"venc")) {
645 "Unable to reserve VDAC_CONFIG MMIO region\n");
654 "Unable to map VDAC_CONFIG IO space\n");
656 goto release_vdaccfg_mem_region;
660 platform_set_drvdata(pdev, venc);
661 dev_notice(venc->
pdev,
"VENC sub device probe success\n");
664 release_vdaccfg_mem_region:
668 release_venc_mem_region:
678 struct venc_state *venc = platform_get_drvdata(pdev);
696 .remove = venc_remove,