int sensor_num = 0,err;
struct device *dev = &pdev->dev;
struct rkcamera_platform_data *new_camera_list;
-
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
int pwr_active = 0, rst_active = 0, pwdn_active = 0;
int orientation = 0;
struct rkcamera_platform_data *new_camera;
+
+ char sensor_name[20] = {0};
+ char *name = NULL;
+
+ strcpy(sensor_name,cp->name);
+ name = sensor_name;
+ if(strstr(sensor_name,"_") != NULL){
+ name = strsep(&name,"_");
+ }
+
new_camera = kzalloc(sizeof(struct rkcamera_platform_data),GFP_KERNEL);
if(!sensor_num)
{
sensor_num ++;
new_camera_list->next_camera = new_camera;
new_camera_list = new_camera;
-
+
if (of_property_read_u32(cp, "flash_attach", &flash_attach)) {
dprintk("%s:Get %s rockchip,flash_attach failed!\n",__func__, cp->name);
}
printk("%s:Get %s rockchip,orientation failed!\n",__func__, cp->name);
}
- strcpy(new_camera->dev.i2c_cam_info.type, cp->name);
+ strcpy(new_camera->dev.i2c_cam_info.type, name);
new_camera->dev.i2c_cam_info.addr = i2c_add>>1;
new_camera->dev.desc_info.host_desc.bus_id = RK29_CAM_PLATFORM_DEV_ID+cif_chl;/*yzm*/
new_camera->dev.desc_info.host_desc.i2c_adapter_id = i2c_chl;/*yzm*/
- new_camera->dev.desc_info.host_desc.module_name = cp->name;/*const*/
+ new_camera->dev.desc_info.host_desc.module_name = name;/*const*/
new_camera->dev.device_info.name = "soc-camera-pdrv";
if(is_front)
- sprintf(new_camera->dev_name,"%s_%s",cp->name,"front");
+ sprintf(new_camera->dev_name,"%s_%s",name,"front");
else
- sprintf(new_camera->dev_name,"%s_%s",cp->name,"back");
+ sprintf(new_camera->dev_name,"%s_%s",name,"back");
new_camera->dev.device_info.dev.init_name =(const char*)&new_camera->dev_name[0];
new_camera->io.gpio_reset = reset;
new_camera->io.gpio_powerdown = powerdown;
static DEFINE_IDR(i2c_adapter_idr);
static struct device_type i2c_client_type;
+static int i2c_check_addr_ex(struct i2c_adapter *adapter, int addr);
static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
/* ------------------------------------------------------------------------- */
}
/* Check for address business */
+ #if 0
status = i2c_check_addr_busy(adap, client->addr);
if (status)
goto out_err;
+ #else
+ /* ddl@rock-chips.com : Devices which have some i2c addr can work in same i2c bus,
+ if devices havn't work at the same time.*/
+ status = i2c_check_addr_ex(adap, client->addr);
+ if (status != 0)
+ dev_err(&adap->dev, "%d i2c clients have been registered at 0x%02x",
+ status, client->addr);
+ #endif
client->dev.parent = &client->adapter->dev;
client->dev.bus = &i2c_bus_type;
ACPI_HANDLE_SET(&client->dev, info->acpi_node.handle);
/* For 10-bit clients, add an arbitrary offset to avoid collisions */
+
+ /* ddl@rock-chips.com : Devices which have some i2c addr can work in same i2c bus,
+ if devices havn't work at the same time.*/
+ #if 0
dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
client->addr | ((client->flags & I2C_CLIENT_TEN)
? 0xa000 : 0));
+ #else
+ if (status == 0)
+ dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
+ client->addr);
+ else
+ dev_set_name(&client->dev, "%d-%04x-%01x", i2c_adapter_id(adap),
+ client->addr,status);
+ #endif
+
status = device_register(&client->dev);
if (status)
goto out_err;
EXPORT_SYMBOL(i2c_del_driver);
/* ------------------------------------------------------------------------- */
+/* ddl@rock-chips.com : Devices which have some i2c addr can work in same i2c bus,
+ if devices havn't work at the same time.*/
+struct i2c_addr_cnt
+{
+ int addr;
+ int cnt;
+};
+static int __i2c_check_addr_ex(struct device *dev, void *addrp)
+{
+ struct i2c_client *client = i2c_verify_client(dev);
+ struct i2c_addr_cnt *addrinfo = (struct i2c_addr_cnt *)addrp;
+ int addr = addrinfo->addr;
+
+ if (client && client->addr == addr) {
+ addrinfo->cnt++;
+ }
+ return 0;
+}
+static int i2c_check_addr_ex(struct i2c_adapter *adapter, int addr)
+{
+ struct i2c_addr_cnt addrinfo;
+
+ addrinfo.addr = addr;
+ addrinfo.cnt = 0;
+ device_for_each_child(&adapter->dev, &addrinfo, __i2c_check_addr_ex);
+ return addrinfo.cnt;
+}
/**
* i2c_use_client - increments the reference count of the i2c client structure
1. Delete SOCAM_DATAWIDTH_8 in SENSOR_BUS_PARAM parameters,it conflict with V4L2_MBUS_PCLK_SAMPLE_FALLING.
*v0.1.7:
1. Add power and powerdown controled by PMU.
+*v0.1.8:
+ 1. Support front and rear camera support are the same.
*/
-#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x7)
+#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x8)
static int version = RK_CAM_VERSION_CODE;
module_param(version, int, S_IRUGO);