Commit 2164b5af authored by Jonathan Corbet's avatar Jonathan Corbet Committed by Mauro Carvalho Chehab

[media] marvell-cam: Pass sensor parameters from the platform

Depending on the controller, the ov7670 sensor may be told to work with a
different clock speed or to use the SMBUS protocol.  Remove the wired-in
code and pass that information from the platform layer.  The Cafe driver
now just assumes it's running on an OLPC XO 1; I do not believe it has ever
run anywhere else.

Cc: Daniel Drake <dsd@laptop.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent abfa3df3
...@@ -403,6 +403,12 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -403,6 +403,12 @@ static int cafe_pci_probe(struct pci_dev *pdev,
mcam->plat_power_up = cafe_ctlr_power_up; mcam->plat_power_up = cafe_ctlr_power_up;
mcam->plat_power_down = cafe_ctlr_power_down; mcam->plat_power_down = cafe_ctlr_power_down;
mcam->dev = &pdev->dev; mcam->dev = &pdev->dev;
/*
* Set the clock speed for the XO 1; I don't believe this
* driver has ever run anywhere else.
*/
mcam->clock_speed = 45;
mcam->use_smbus = 1;
/* /*
* Get set up on the PCI bus. * Get set up on the PCI bus.
*/ */
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/dmi.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -1536,22 +1535,7 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs) ...@@ -1536,22 +1535,7 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs)
* Registration and such. * Registration and such.
*/ */
/* FIXME this is really platform stuff */
static const struct dmi_system_id olpc_xo1_dmi[] = {
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "OLPC"),
DMI_MATCH(DMI_PRODUCT_NAME, "XO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "1"),
},
},
{ }
};
static struct ov7670_config sensor_cfg = { static struct ov7670_config sensor_cfg = {
/* This controller only does SMBUS */
.use_smbus = true,
/* /*
* Exclude QCIF mode, because it only captures a tiny portion * Exclude QCIF mode, because it only captures a tiny portion
* of the sensor FOV * of the sensor FOV
...@@ -1590,13 +1574,11 @@ int mccic_register(struct mcam_camera *cam) ...@@ -1590,13 +1574,11 @@ int mccic_register(struct mcam_camera *cam)
mcam_ctlr_init(cam); mcam_ctlr_init(cam);
/* Apply XO-1 clock speed */
if (dmi_check_system(olpc_xo1_dmi))
sensor_cfg.clock_speed = 45;
/* /*
* Try to find the sensor. * Try to find the sensor.
*/ */
sensor_cfg.clock_speed = cam->clock_speed;
sensor_cfg.use_smbus = cam->use_smbus;
cam->sensor_addr = ov7670_info.addr; cam->sensor_addr = ov7670_info.addr;
cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev,
&cam->i2c_adapter, &ov7670_info, NULL); &cam->i2c_adapter, &ov7670_info, NULL);
......
...@@ -42,6 +42,8 @@ struct mcam_camera { ...@@ -42,6 +42,8 @@ struct mcam_camera {
spinlock_t dev_lock; spinlock_t dev_lock;
struct device *dev; /* For messages, dma alloc */ struct device *dev; /* For messages, dma alloc */
unsigned int chip_id; unsigned int chip_id;
short int clock_speed; /* Sensor clock speed, default 30 */
short int use_smbus; /* SMBUS or straight I2c? */
/* /*
* Callbacks from the core to the platform code. * Callbacks from the core to the platform code.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment