static int soc_camera_platform_video_probe(struct soc_camera_device *icd) { icd->formats = p6_format; icd->num_formats = ARRAY_SIZE(p6_format); return soc_camera_video_start(icd); }
/* Interface active, can use i2c. If it fails, it can indeed mean, that * this wasn't our capture interface, so, we wait for the right one */ static int mt9v022_video_probe(struct soc_camera_device *icd) { struct i2c_client *client = to_i2c_client(icd->control); struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); struct soc_camera_link *icl = client->dev.platform_data; s32 data; int ret; unsigned long flags; if (!icd->dev.parent || to_soc_camera_host(icd->dev.parent)->nr != icd->iface) return -ENODEV; /* Read out the chip version register */ data = reg_read(client, MT9V022_CHIP_VERSION); /* must be 0x1311 or 0x1313 */ if (data != 0x1311 && data != 0x1313) { ret = -ENODEV; dev_info(&icd->dev, "No MT9V022 detected, ID register 0x%x\n", data); goto ei2c; } /* Soft reset */ ret = reg_write(client, MT9V022_RESET, 1); if (ret < 0) goto ei2c; /* 15 clock cycles */ udelay(200); if (reg_read(client, MT9V022_RESET)) { dev_err(&icd->dev, "Resetting MT9V022 failed!\n"); goto ei2c; } /* Set monochrome or colour sensor type */ if (sensor_type && (!strcmp("colour", sensor_type) || !strcmp("color", sensor_type))) { ret = reg_write(client, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11); mt9v022->model = V4L2_IDENT_MT9V022IX7ATC; icd->formats = mt9v022_colour_formats; } else { ret = reg_write(client, MT9V022_PIXEL_OPERATION_MODE, 0x11); mt9v022->model = V4L2_IDENT_MT9V022IX7ATM; icd->formats = mt9v022_monochrome_formats; } if (ret < 0) goto eisis; icd->num_formats = 0; /* * This is a 10bit sensor, so by default we only allow 10bit. * The platform may support different bus widths due to * different routing of the data lines. */ if (icl->query_bus_param) flags = icl->query_bus_param(icl); else flags = SOCAM_DATAWIDTH_10; if (flags & SOCAM_DATAWIDTH_10) icd->num_formats++; else icd->formats++; if (flags & SOCAM_DATAWIDTH_8) icd->num_formats++; ret = soc_camera_video_start(icd); if (ret < 0) goto eisis; dev_info(&icd->dev, "Detected a MT9V022 chip ID %x, %s sensor\n", data, mt9v022->model == V4L2_IDENT_MT9V022IX7ATM ? "monochrome" : "colour"); return 0; eisis: ei2c: return ret; }