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

[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>

authored by

Jonathan Corbet and committed by
Mauro Carvalho Chehab
2164b5af abfa3df3

+10 -20
+6
drivers/media/video/marvell-ccic/cafe-driver.c
··· 404 404 mcam->plat_power_down = cafe_ctlr_power_down; 405 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 413 * Get set up on the PCI bus. 408 414 */ 409 415 ret = pci_enable_device(pdev);
+2 -20
drivers/media/video/marvell-ccic/mcam-core.c
··· 7 7 #include <linux/kernel.h> 8 8 #include <linux/module.h> 9 9 #include <linux/fs.h> 10 - #include <linux/dmi.h> 11 10 #include <linux/mm.h> 12 11 #include <linux/i2c.h> 13 12 #include <linux/interrupt.h> ··· 1535 1536 * Registration and such. 1536 1537 */ 1537 1538 1538 - /* FIXME this is really platform stuff */ 1539 - static const struct dmi_system_id olpc_xo1_dmi[] = { 1540 - { 1541 - .matches = { 1542 - DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), 1543 - DMI_MATCH(DMI_PRODUCT_NAME, "XO"), 1544 - DMI_MATCH(DMI_PRODUCT_VERSION, "1"), 1545 - }, 1546 - }, 1547 - { } 1548 - }; 1549 - 1550 1539 static struct ov7670_config sensor_cfg = { 1551 - /* This controller only does SMBUS */ 1552 - .use_smbus = true, 1553 - 1554 1540 /* 1555 1541 * Exclude QCIF mode, because it only captures a tiny portion 1556 1542 * of the sensor FOV ··· 1574 1590 1575 1591 mcam_ctlr_init(cam); 1576 1592 1577 - /* Apply XO-1 clock speed */ 1578 - if (dmi_check_system(olpc_xo1_dmi)) 1579 - sensor_cfg.clock_speed = 45; 1580 - 1581 1593 /* 1582 1594 * Try to find the sensor. 1583 1595 */ 1596 + sensor_cfg.clock_speed = cam->clock_speed; 1597 + sensor_cfg.use_smbus = cam->use_smbus; 1584 1598 cam->sensor_addr = ov7670_info.addr; 1585 1599 cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, 1586 1600 &cam->i2c_adapter, &ov7670_info, NULL);
+2
drivers/media/video/marvell-ccic/mcam-core.h
··· 42 42 spinlock_t dev_lock; 43 43 struct device *dev; /* For messages, dma alloc */ 44 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 49 * Callbacks from the core to the platform code.