diff options
author | Jonathan Corbet <corbet@lwn.net> | 2011-06-11 13:46:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:53:00 -0400 |
commit | 2164b5af1dd42ebb7b5aa6bbcf9d9c3c067db246 (patch) | |
tree | a1bf041212c79fe6be251afacdedb5e2eda5534e /drivers/media | |
parent | abfa3df36c01a32b081fb448750181af76eb9d55 (diff) |
[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: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/marvell-ccic/cafe-driver.c | 6 | ||||
-rw-r--r-- | drivers/media/video/marvell-ccic/mcam-core.c | 22 | ||||
-rw-r--r-- | drivers/media/video/marvell-ccic/mcam-core.h | 2 |
3 files changed, 10 insertions, 20 deletions
diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 3f38f2a0643f..08edf950dabf 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c | |||
@@ -404,6 +404,12 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
404 | mcam->plat_power_down = cafe_ctlr_power_down; | 404 | mcam->plat_power_down = cafe_ctlr_power_down; |
405 | mcam->dev = &pdev->dev; | 405 | mcam->dev = &pdev->dev; |
406 | /* | 406 | /* |
407 | * Set the clock speed for the XO 1; I don't believe this | ||
408 | * driver has ever run anywhere else. | ||
409 | */ | ||
410 | mcam->clock_speed = 45; | ||
411 | mcam->use_smbus = 1; | ||
412 | /* | ||
407 | * Get set up on the PCI bus. | 413 | * Get set up on the PCI bus. |
408 | */ | 414 | */ |
409 | ret = pci_enable_device(pdev); | 415 | ret = pci_enable_device(pdev); |
diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 18fce9e69f38..0d6023435557 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
10 | #include <linux/dmi.h> | ||
11 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
12 | #include <linux/i2c.h> | 11 | #include <linux/i2c.h> |
13 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
@@ -1536,22 +1535,7 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs) | |||
1536 | * Registration and such. | 1535 | * Registration and such. |
1537 | */ | 1536 | */ |
1538 | 1537 | ||
1539 | /* FIXME this is really platform stuff */ | ||
1540 | static const struct dmi_system_id olpc_xo1_dmi[] = { | ||
1541 | { | ||
1542 | .matches = { | ||
1543 | DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), | ||
1544 | DMI_MATCH(DMI_PRODUCT_NAME, "XO"), | ||
1545 | DMI_MATCH(DMI_PRODUCT_VERSION, "1"), | ||
1546 | }, | ||
1547 | }, | ||
1548 | { } | ||
1549 | }; | ||
1550 | |||
1551 | static struct ov7670_config sensor_cfg = { | 1538 | static struct ov7670_config sensor_cfg = { |
1552 | /* This controller only does SMBUS */ | ||
1553 | .use_smbus = true, | ||
1554 | |||
1555 | /* | 1539 | /* |
1556 | * Exclude QCIF mode, because it only captures a tiny portion | 1540 | * Exclude QCIF mode, because it only captures a tiny portion |
1557 | * of the sensor FOV | 1541 | * of the sensor FOV |
@@ -1590,13 +1574,11 @@ int mccic_register(struct mcam_camera *cam) | |||
1590 | 1574 | ||
1591 | mcam_ctlr_init(cam); | 1575 | mcam_ctlr_init(cam); |
1592 | 1576 | ||
1593 | /* Apply XO-1 clock speed */ | ||
1594 | if (dmi_check_system(olpc_xo1_dmi)) | ||
1595 | sensor_cfg.clock_speed = 45; | ||
1596 | |||
1597 | /* | 1577 | /* |
1598 | * Try to find the sensor. | 1578 | * Try to find the sensor. |
1599 | */ | 1579 | */ |
1580 | sensor_cfg.clock_speed = cam->clock_speed; | ||
1581 | sensor_cfg.use_smbus = cam->use_smbus; | ||
1600 | cam->sensor_addr = ov7670_info.addr; | 1582 | cam->sensor_addr = ov7670_info.addr; |
1601 | cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, | 1583 | cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, |
1602 | &cam->i2c_adapter, &ov7670_info, NULL); | 1584 | &cam->i2c_adapter, &ov7670_info, NULL); |
diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index 0b55b8e6bb7e..21485e7ec8f2 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h | |||
@@ -42,6 +42,8 @@ struct mcam_camera { | |||
42 | spinlock_t dev_lock; | 42 | spinlock_t dev_lock; |
43 | struct device *dev; /* For messages, dma alloc */ | 43 | struct device *dev; /* For messages, dma alloc */ |
44 | unsigned int chip_id; | 44 | unsigned int chip_id; |
45 | short int clock_speed; /* Sensor clock speed, default 30 */ | ||
46 | short int use_smbus; /* SMBUS or straight I2c? */ | ||
45 | 47 | ||
46 | /* | 48 | /* |
47 | * Callbacks from the core to the platform code. | 49 | * Callbacks from the core to the platform code. |