aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c4
-rw-r--r--arch/sh/boards/mach-migor/setup.c2
-rw-r--r--drivers/media/video/ov772x.c22
-rw-r--r--include/media/ov772x.h10
4 files changed, 15 insertions, 23 deletions
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 1f5fa5c44f6d..71f556fe3f38 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -471,8 +471,8 @@ static struct i2c_board_info ap325rxa_i2c_camera[] = {
471}; 471};
472 472
473static struct ov772x_camera_info ov7725_info = { 473static struct ov772x_camera_info ov7725_info = {
474 .buswidth = SOCAM_DATAWIDTH_8, 474 .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
475 .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, 475 OV772X_FLAG_8BIT,
476 .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0), 476 .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0),
477}; 477};
478 478
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 507c77be476d..9b4676fa6fbb 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -431,7 +431,7 @@ static struct i2c_board_info migor_i2c_camera[] = {
431}; 431};
432 432
433static struct ov772x_camera_info ov7725_info = { 433static struct ov772x_camera_info ov7725_info = {
434 .buswidth = SOCAM_DATAWIDTH_8, 434 .flags = OV772X_FLAG_8BIT,
435}; 435};
436 436
437static struct soc_camera_link ov7725_link = { 437static struct soc_camera_link ov7725_link = {
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 3a45e945a528..7f8ece30c77b 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -547,7 +547,6 @@ static const struct v4l2_queryctrl ov772x_controls[] = {
547 }, 547 },
548}; 548};
549 549
550
551/* 550/*
552 * general function 551 * general function
553 */ 552 */
@@ -634,7 +633,12 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
634 struct soc_camera_link *icl = to_soc_camera_link(icd); 633 struct soc_camera_link *icl = to_soc_camera_link(icd);
635 unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER | 634 unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
636 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH | 635 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
637 SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth; 636 SOCAM_DATA_ACTIVE_HIGH;
637
638 if (priv->info->flags & OV772X_FLAG_8BIT)
639 flags |= SOCAM_DATAWIDTH_8;
640 else
641 flags |= SOCAM_DATAWIDTH_10;
638 642
639 return soc_camera_apply_sensor_flags(icl, flags); 643 return soc_camera_apply_sensor_flags(icl, flags);
640} 644}
@@ -1040,15 +1044,6 @@ static int ov772x_video_probe(struct soc_camera_device *icd,
1040 return -ENODEV; 1044 return -ENODEV;
1041 1045
1042 /* 1046 /*
1043 * ov772x only use 8 or 10 bit bus width
1044 */
1045 if (SOCAM_DATAWIDTH_10 != priv->info->buswidth &&
1046 SOCAM_DATAWIDTH_8 != priv->info->buswidth) {
1047 dev_err(&client->dev, "bus width error\n");
1048 return -ENODEV;
1049 }
1050
1051 /*
1052 * check and show product ID and manufacturer ID 1047 * check and show product ID and manufacturer ID
1053 */ 1048 */
1054 pid = i2c_smbus_read_byte_data(client, PID); 1049 pid = i2c_smbus_read_byte_data(client, PID);
@@ -1130,7 +1125,6 @@ static int ov772x_probe(struct i2c_client *client,
1130 const struct i2c_device_id *did) 1125 const struct i2c_device_id *did)
1131{ 1126{
1132 struct ov772x_priv *priv; 1127 struct ov772x_priv *priv;
1133 struct ov772x_camera_info *info;
1134 struct soc_camera_device *icd = client->dev.platform_data; 1128 struct soc_camera_device *icd = client->dev.platform_data;
1135 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 1129 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
1136 struct soc_camera_link *icl; 1130 struct soc_camera_link *icl;
@@ -1145,8 +1139,6 @@ static int ov772x_probe(struct i2c_client *client,
1145 if (!icl || !icl->priv) 1139 if (!icl || !icl->priv)
1146 return -EINVAL; 1140 return -EINVAL;
1147 1141
1148 info = icl->priv;
1149
1150 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { 1142 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
1151 dev_err(&adapter->dev, 1143 dev_err(&adapter->dev,
1152 "I2C-Adapter doesn't support " 1144 "I2C-Adapter doesn't support "
@@ -1158,7 +1150,7 @@ static int ov772x_probe(struct i2c_client *client,
1158 if (!priv) 1150 if (!priv)
1159 return -ENOMEM; 1151 return -ENOMEM;
1160 1152
1161 priv->info = info; 1153 priv->info = icl->priv;
1162 1154
1163 v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops); 1155 v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
1164 1156
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 14c77efd6a85..548bf1155c83 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -15,8 +15,9 @@
15#include <media/soc_camera.h> 15#include <media/soc_camera.h>
16 16
17/* for flags */ 17/* for flags */
18#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ 18#define OV772X_FLAG_VFLIP (1 << 0) /* Vertical flip image */
19#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ 19#define OV772X_FLAG_HFLIP (1 << 1) /* Horizontal flip image */
20#define OV772X_FLAG_8BIT (1 << 2) /* default 10 bit */
20 21
21/* 22/*
22 * for Edge ctrl 23 * for Edge ctrl
@@ -53,9 +54,8 @@ struct ov772x_edge_ctrl {
53 * ov772x camera info 54 * ov772x camera info
54 */ 55 */
55struct ov772x_camera_info { 56struct ov772x_camera_info {
56 unsigned long buswidth; 57 unsigned long flags;
57 unsigned long flags; 58 struct ov772x_edge_ctrl edgectrl;
58 struct ov772x_edge_ctrl edgectrl;
59}; 59};
60 60
61#endif /* __OV772X_H__ */ 61#endif /* __OV772X_H__ */