Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc-camera: ov772x: Modify buswidth control

This patch removes "buswidth" struct member, and sets the default buswidth
to the natively supported 10 bit. You can select 8 bit buswidth by new flag.
This patch also modify ap325rxa/migor setup.c

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Kuninori Morimoto and committed by
Mauro Carvalho Chehab
3675c750 906b1018

+15 -23
+2 -2
arch/sh/boards/mach-ap325rxa/setup.c
··· 471 471 }; 472 472 473 473 static struct ov772x_camera_info ov7725_info = { 474 - .buswidth = SOCAM_DATAWIDTH_8, 475 - .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, 474 + .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \ 475 + OV772X_FLAG_8BIT, 476 476 .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0), 477 477 }; 478 478
+1 -1
arch/sh/boards/mach-migor/setup.c
··· 431 431 }; 432 432 433 433 static struct ov772x_camera_info ov7725_info = { 434 - .buswidth = SOCAM_DATAWIDTH_8, 434 + .flags = OV772X_FLAG_8BIT, 435 435 }; 436 436 437 437 static struct soc_camera_link ov7725_link = {
+7 -15
drivers/media/video/ov772x.c
··· 547 547 }, 548 548 }; 549 549 550 - 551 550 /* 552 551 * general function 553 552 */ ··· 633 634 struct soc_camera_link *icl = to_soc_camera_link(icd); 634 635 unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER | 635 636 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH | 636 - SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth; 637 + SOCAM_DATA_ACTIVE_HIGH; 638 + 639 + if (priv->info->flags & OV772X_FLAG_8BIT) 640 + flags |= SOCAM_DATAWIDTH_8; 641 + else 642 + flags |= SOCAM_DATAWIDTH_10; 637 643 638 644 return soc_camera_apply_sensor_flags(icl, flags); 639 645 } ··· 1044 1040 return -ENODEV; 1045 1041 1046 1042 /* 1047 - * ov772x only use 8 or 10 bit bus width 1048 - */ 1049 - if (SOCAM_DATAWIDTH_10 != priv->info->buswidth && 1050 - SOCAM_DATAWIDTH_8 != priv->info->buswidth) { 1051 - dev_err(&client->dev, "bus width error\n"); 1052 - return -ENODEV; 1053 - } 1054 - 1055 - /* 1056 1043 * check and show product ID and manufacturer ID 1057 1044 */ 1058 1045 pid = i2c_smbus_read_byte_data(client, PID); ··· 1125 1130 const struct i2c_device_id *did) 1126 1131 { 1127 1132 struct ov772x_priv *priv; 1128 - struct ov772x_camera_info *info; 1129 1133 struct soc_camera_device *icd = client->dev.platform_data; 1130 1134 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 1131 1135 struct soc_camera_link *icl; ··· 1139 1145 if (!icl || !icl->priv) 1140 1146 return -EINVAL; 1141 1147 1142 - info = icl->priv; 1143 - 1144 1148 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { 1145 1149 dev_err(&adapter->dev, 1146 1150 "I2C-Adapter doesn't support " ··· 1150 1158 if (!priv) 1151 1159 return -ENOMEM; 1152 1160 1153 - priv->info = info; 1161 + priv->info = icl->priv; 1154 1162 1155 1163 v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops); 1156 1164
+5 -5
include/media/ov772x.h
··· 15 15 #include <media/soc_camera.h> 16 16 17 17 /* for flags */ 18 - #define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ 19 - #define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ 18 + #define OV772X_FLAG_VFLIP (1 << 0) /* Vertical 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 23 * for Edge ctrl ··· 54 53 * ov772x camera info 55 54 */ 56 55 struct ov772x_camera_info { 57 - unsigned long buswidth; 58 - unsigned long flags; 59 - struct ov772x_edge_ctrl edgectrl; 56 + unsigned long flags; 57 + struct ov772x_edge_ctrl edgectrl; 60 58 }; 61 59 62 60 #endif /* __OV772X_H__ */