aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndrew Chew <achew@nvidia.com>2011-06-23 19:19:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:53:29 -0400
commite29c9bfb3823b7733448a3232d1864c14f28fb44 (patch)
treeef53f0b1486ffb584c3fb905d4cb7f0d699a26f4 /drivers/media
parent970aa9e04e40f8a73691c3c5c3c7bd76fee6f8f2 (diff)
[media] V4L: ov9740: Reorder video and core ops
This is to avoid needing a forward declaration when ov9740_s_power() (in the subsequent patch) calls ov9740_s_fmt(). Signed-off-by: Andrew Chew <achew@nvidia.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/ov9740.c186
1 files changed, 93 insertions, 93 deletions
diff --git a/drivers/media/video/ov9740.c b/drivers/media/video/ov9740.c
index decd70650eac..cd63eaae2dfe 100644
--- a/drivers/media/video/ov9740.c
+++ b/drivers/media/video/ov9740.c
@@ -573,90 +573,6 @@ static unsigned long ov9740_query_bus_param(struct soc_camera_device *icd)
573 return soc_camera_apply_sensor_flags(icl, flags); 573 return soc_camera_apply_sensor_flags(icl, flags);
574} 574}
575 575
576/* Get status of additional camera capabilities */
577static int ov9740_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
578{
579 struct ov9740_priv *priv = to_ov9740(sd);
580
581 switch (ctrl->id) {
582 case V4L2_CID_VFLIP:
583 ctrl->value = priv->flag_vflip;
584 break;
585 case V4L2_CID_HFLIP:
586 ctrl->value = priv->flag_hflip;
587 break;
588 default:
589 return -EINVAL;
590 }
591
592 return 0;
593}
594
595/* Set status of additional camera capabilities */
596static int ov9740_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
597{
598 struct ov9740_priv *priv = to_ov9740(sd);
599
600 switch (ctrl->id) {
601 case V4L2_CID_VFLIP:
602 priv->flag_vflip = ctrl->value;
603 break;
604 case V4L2_CID_HFLIP:
605 priv->flag_hflip = ctrl->value;
606 break;
607 default:
608 return -EINVAL;
609 }
610
611 return 0;
612}
613
614/* Get chip identification */
615static int ov9740_g_chip_ident(struct v4l2_subdev *sd,
616 struct v4l2_dbg_chip_ident *id)
617{
618 struct ov9740_priv *priv = to_ov9740(sd);
619
620 id->ident = priv->ident;
621 id->revision = priv->revision;
622
623 return 0;
624}
625
626#ifdef CONFIG_VIDEO_ADV_DEBUG
627static int ov9740_get_register(struct v4l2_subdev *sd,
628 struct v4l2_dbg_register *reg)
629{
630 struct i2c_client *client = v4l2_get_subdevdata(sd);
631 int ret;
632 u8 val;
633
634 if (reg->reg & ~0xffff)
635 return -EINVAL;
636
637 reg->size = 2;
638
639 ret = ov9740_reg_read(client, reg->reg, &val);
640 if (ret)
641 return ret;
642
643 reg->val = (__u64)val;
644
645 return ret;
646}
647
648static int ov9740_set_register(struct v4l2_subdev *sd,
649 struct v4l2_dbg_register *reg)
650{
651 struct i2c_client *client = v4l2_get_subdevdata(sd);
652
653 if (reg->reg & ~0xffff || reg->val & ~0xff)
654 return -EINVAL;
655
656 return ov9740_reg_write(client, reg->reg, reg->val);
657}
658#endif
659
660/* select nearest higher resolution for capture */ 576/* select nearest higher resolution for capture */
661static void ov9740_res_roundup(u32 *width, u32 *height) 577static void ov9740_res_roundup(u32 *width, u32 *height)
662{ 578{
@@ -863,6 +779,90 @@ static int ov9740_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
863 return 0; 779 return 0;
864} 780}
865 781
782/* Get status of additional camera capabilities */
783static int ov9740_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
784{
785 struct ov9740_priv *priv = to_ov9740(sd);
786
787 switch (ctrl->id) {
788 case V4L2_CID_VFLIP:
789 ctrl->value = priv->flag_vflip;
790 break;
791 case V4L2_CID_HFLIP:
792 ctrl->value = priv->flag_hflip;
793 break;
794 default:
795 return -EINVAL;
796 }
797
798 return 0;
799}
800
801/* Set status of additional camera capabilities */
802static int ov9740_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
803{
804 struct ov9740_priv *priv = to_ov9740(sd);
805
806 switch (ctrl->id) {
807 case V4L2_CID_VFLIP:
808 priv->flag_vflip = ctrl->value;
809 break;
810 case V4L2_CID_HFLIP:
811 priv->flag_hflip = ctrl->value;
812 break;
813 default:
814 return -EINVAL;
815 }
816
817 return 0;
818}
819
820/* Get chip identification */
821static int ov9740_g_chip_ident(struct v4l2_subdev *sd,
822 struct v4l2_dbg_chip_ident *id)
823{
824 struct ov9740_priv *priv = to_ov9740(sd);
825
826 id->ident = priv->ident;
827 id->revision = priv->revision;
828
829 return 0;
830}
831
832#ifdef CONFIG_VIDEO_ADV_DEBUG
833static int ov9740_get_register(struct v4l2_subdev *sd,
834 struct v4l2_dbg_register *reg)
835{
836 struct i2c_client *client = v4l2_get_subdevdata(sd);
837 int ret;
838 u8 val;
839
840 if (reg->reg & ~0xffff)
841 return -EINVAL;
842
843 reg->size = 2;
844
845 ret = ov9740_reg_read(client, reg->reg, &val);
846 if (ret)
847 return ret;
848
849 reg->val = (__u64)val;
850
851 return ret;
852}
853
854static int ov9740_set_register(struct v4l2_subdev *sd,
855 struct v4l2_dbg_register *reg)
856{
857 struct i2c_client *client = v4l2_get_subdevdata(sd);
858
859 if (reg->reg & ~0xffff || reg->val & ~0xff)
860 return -EINVAL;
861
862 return ov9740_reg_write(client, reg->reg, reg->val);
863}
864#endif
865
866static int ov9740_video_probe(struct soc_camera_device *icd, 866static int ov9740_video_probe(struct soc_camera_device *icd,
867 struct i2c_client *client) 867 struct i2c_client *client)
868{ 868{
@@ -929,6 +929,15 @@ static struct soc_camera_ops ov9740_ops = {
929 .num_controls = ARRAY_SIZE(ov9740_controls), 929 .num_controls = ARRAY_SIZE(ov9740_controls),
930}; 930};
931 931
932static struct v4l2_subdev_video_ops ov9740_video_ops = {
933 .s_stream = ov9740_s_stream,
934 .s_mbus_fmt = ov9740_s_fmt,
935 .try_mbus_fmt = ov9740_try_fmt,
936 .enum_mbus_fmt = ov9740_enum_fmt,
937 .cropcap = ov9740_cropcap,
938 .g_crop = ov9740_g_crop,
939};
940
932static struct v4l2_subdev_core_ops ov9740_core_ops = { 941static struct v4l2_subdev_core_ops ov9740_core_ops = {
933 .g_ctrl = ov9740_g_ctrl, 942 .g_ctrl = ov9740_g_ctrl,
934 .s_ctrl = ov9740_s_ctrl, 943 .s_ctrl = ov9740_s_ctrl,
@@ -939,15 +948,6 @@ static struct v4l2_subdev_core_ops ov9740_core_ops = {
939#endif 948#endif
940}; 949};
941 950
942static struct v4l2_subdev_video_ops ov9740_video_ops = {
943 .s_stream = ov9740_s_stream,
944 .s_mbus_fmt = ov9740_s_fmt,
945 .try_mbus_fmt = ov9740_try_fmt,
946 .enum_mbus_fmt = ov9740_enum_fmt,
947 .cropcap = ov9740_cropcap,
948 .g_crop = ov9740_g_crop,
949};
950
951static struct v4l2_subdev_ops ov9740_subdev_ops = { 951static struct v4l2_subdev_ops ov9740_subdev_ops = {
952 .core = &ov9740_core_ops, 952 .core = &ov9740_core_ops,
953 .video = &ov9740_video_ops, 953 .video = &ov9740_video_ops,