diff options
| author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-07-26 11:02:00 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:27:22 -0400 |
| commit | 59ca25b7eb8f6675be94ec18beb8eb66293f550d (patch) | |
| tree | 14bb9da553e01a229f5b2fa7869330268c8c6e06 | |
| parent | 93ac81dcbec35455b9a8181bf3ddd2a225588434 (diff) | |
[media] V4L: ov6650: support the new mbus-config subdev ops
Extend the driver to also support [gs]_mbus_config() subdevice video
operations.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| -rw-r--r-- | drivers/media/video/ov6650.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index 456d9ad9ae5a..a26734d4cf30 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
| @@ -30,9 +30,9 @@ | |||
| 30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 31 | 31 | ||
| 32 | #include <media/soc_camera.h> | 32 | #include <media/soc_camera.h> |
| 33 | #include <media/soc_mediabus.h> | ||
| 33 | #include <media/v4l2-chip-ident.h> | 34 | #include <media/v4l2-chip-ident.h> |
| 34 | 35 | ||
| 35 | |||
| 36 | /* Register definitions */ | 36 | /* Register definitions */ |
| 37 | #define REG_GAIN 0x00 /* range 00 - 3F */ | 37 | #define REG_GAIN 0x00 /* range 00 - 3F */ |
| 38 | #define REG_BLUE 0x01 | 38 | #define REG_BLUE 0x01 |
| @@ -1111,6 +1111,55 @@ static struct v4l2_subdev_core_ops ov6650_core_ops = { | |||
| 1111 | #endif | 1111 | #endif |
| 1112 | }; | 1112 | }; |
| 1113 | 1113 | ||
| 1114 | static int ov6650_g_mbus_config(struct v4l2_subdev *sd, | ||
| 1115 | struct v4l2_mbus_config *cfg) | ||
| 1116 | { | ||
| 1117 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
| 1118 | struct soc_camera_device *icd = client->dev.platform_data; | ||
| 1119 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1120 | |||
| 1121 | cfg->flags = V4L2_MBUS_MASTER | | ||
| 1122 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | | ||
| 1123 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW | | ||
| 1124 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | | ||
| 1125 | V4L2_MBUS_DATA_ACTIVE_HIGH; | ||
| 1126 | cfg->type = V4L2_MBUS_PARALLEL; | ||
| 1127 | cfg->flags = soc_camera_apply_board_flags(icl, cfg); | ||
| 1128 | |||
| 1129 | return 0; | ||
| 1130 | } | ||
| 1131 | |||
| 1132 | static int ov6650_s_mbus_config(struct v4l2_subdev *sd, | ||
| 1133 | const struct v4l2_mbus_config *cfg) | ||
| 1134 | { | ||
| 1135 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
| 1136 | struct soc_camera_device *icd = client->dev.platform_data; | ||
| 1137 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1138 | unsigned long flags = soc_camera_apply_board_flags(icl, cfg); | ||
| 1139 | int ret; | ||
| 1140 | |||
| 1141 | if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING) | ||
| 1142 | ret = ov6650_reg_rmw(client, REG_COMJ, COMJ_PCLK_RISING, 0); | ||
| 1143 | else | ||
| 1144 | ret = ov6650_reg_rmw(client, REG_COMJ, 0, COMJ_PCLK_RISING); | ||
| 1145 | if (ret) | ||
| 1146 | return ret; | ||
| 1147 | |||
| 1148 | if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW) | ||
| 1149 | ret = ov6650_reg_rmw(client, REG_COMF, COMF_HREF_LOW, 0); | ||
| 1150 | else | ||
| 1151 | ret = ov6650_reg_rmw(client, REG_COMF, 0, COMF_HREF_LOW); | ||
| 1152 | if (ret) | ||
| 1153 | return ret; | ||
| 1154 | |||
| 1155 | if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) | ||
| 1156 | ret = ov6650_reg_rmw(client, REG_COMJ, COMJ_VSYNC_HIGH, 0); | ||
| 1157 | else | ||
| 1158 | ret = ov6650_reg_rmw(client, REG_COMJ, 0, COMJ_VSYNC_HIGH); | ||
| 1159 | |||
| 1160 | return ret; | ||
| 1161 | } | ||
| 1162 | |||
| 1114 | static struct v4l2_subdev_video_ops ov6650_video_ops = { | 1163 | static struct v4l2_subdev_video_ops ov6650_video_ops = { |
| 1115 | .s_stream = ov6650_s_stream, | 1164 | .s_stream = ov6650_s_stream, |
| 1116 | .g_mbus_fmt = ov6650_g_fmt, | 1165 | .g_mbus_fmt = ov6650_g_fmt, |
| @@ -1122,6 +1171,8 @@ static struct v4l2_subdev_video_ops ov6650_video_ops = { | |||
| 1122 | .s_crop = ov6650_s_crop, | 1171 | .s_crop = ov6650_s_crop, |
| 1123 | .g_parm = ov6650_g_parm, | 1172 | .g_parm = ov6650_g_parm, |
| 1124 | .s_parm = ov6650_s_parm, | 1173 | .s_parm = ov6650_s_parm, |
| 1174 | .g_mbus_config = ov6650_g_mbus_config, | ||
| 1175 | .s_mbus_config = ov6650_s_mbus_config, | ||
| 1125 | }; | 1176 | }; |
| 1126 | 1177 | ||
| 1127 | static struct v4l2_subdev_ops ov6650_subdev_ops = { | 1178 | static struct v4l2_subdev_ops ov6650_subdev_ops = { |
