diff options
author | Daniel Drake <dsd@laptop.org> | 2010-10-19 17:24:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-23 11:11:24 -0400 |
commit | cdff10a18d005eac83524917e7789d57b20877ef (patch) | |
tree | 2146946444612e3d806dcda289c924ce7c5ed684 /drivers/media | |
parent | 75e2bdad8901a0b599e01a96229be922eef1e488 (diff) |
[media] cafe_ccic: Configure ov7670 correctly
Force smbus communication, disable QCIF mode, and set the correct
clock speed on the OLPC XO-1.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-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/cafe_ccic.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 1ff082350c9a..7c849eaf8519 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/dmi.h> | ||
28 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
29 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
30 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
@@ -46,6 +47,7 @@ | |||
46 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
47 | #include <asm/io.h> | 48 | #include <asm/io.h> |
48 | 49 | ||
50 | #include "ov7670.h" | ||
49 | #include "cafe_ccic-regs.h" | 51 | #include "cafe_ccic-regs.h" |
50 | 52 | ||
51 | #define CAFE_VERSION 0x000002 | 53 | #define CAFE_VERSION 0x000002 |
@@ -1974,11 +1976,33 @@ static irqreturn_t cafe_irq(int irq, void *data) | |||
1974 | * PCI interface stuff. | 1976 | * PCI interface stuff. |
1975 | */ | 1977 | */ |
1976 | 1978 | ||
1979 | static const struct dmi_system_id olpc_xo1_dmi[] = { | ||
1980 | { | ||
1981 | .matches = { | ||
1982 | DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), | ||
1983 | DMI_MATCH(DMI_PRODUCT_NAME, "XO"), | ||
1984 | DMI_MATCH(DMI_PRODUCT_VERSION, "1"), | ||
1985 | }, | ||
1986 | }, | ||
1987 | { } | ||
1988 | }; | ||
1989 | |||
1977 | static int cafe_pci_probe(struct pci_dev *pdev, | 1990 | static int cafe_pci_probe(struct pci_dev *pdev, |
1978 | const struct pci_device_id *id) | 1991 | const struct pci_device_id *id) |
1979 | { | 1992 | { |
1980 | int ret; | 1993 | int ret; |
1981 | struct cafe_camera *cam; | 1994 | struct cafe_camera *cam; |
1995 | struct ov7670_config sensor_cfg = { | ||
1996 | /* This controller only does SMBUS */ | ||
1997 | .use_smbus = true, | ||
1998 | |||
1999 | /* | ||
2000 | * Exclude QCIF mode, because it only captures a tiny portion | ||
2001 | * of the sensor FOV | ||
2002 | */ | ||
2003 | .min_width = 320, | ||
2004 | .min_height = 240, | ||
2005 | }; | ||
1982 | 2006 | ||
1983 | /* | 2007 | /* |
1984 | * Start putting together one of our big camera structures. | 2008 | * Start putting together one of our big camera structures. |
@@ -2036,6 +2060,10 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2036 | if (ret) | 2060 | if (ret) |
2037 | goto out_freeirq; | 2061 | goto out_freeirq; |
2038 | 2062 | ||
2063 | /* Apply XO-1 clock speed */ | ||
2064 | if (dmi_check_system(olpc_xo1_dmi)) | ||
2065 | sensor_cfg.clock_speed = 45; | ||
2066 | |||
2039 | cam->sensor_addr = 0x42; | 2067 | cam->sensor_addr = 0x42; |
2040 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &cam->i2c_adapter, | 2068 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &cam->i2c_adapter, |
2041 | NULL, "ov7670", cam->sensor_addr, NULL); | 2069 | NULL, "ov7670", cam->sensor_addr, NULL); |
@@ -2043,6 +2071,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2043 | ret = -ENODEV; | 2071 | ret = -ENODEV; |
2044 | goto out_smbus; | 2072 | goto out_smbus; |
2045 | } | 2073 | } |
2074 | |||
2046 | ret = cafe_cam_init(cam); | 2075 | ret = cafe_cam_init(cam); |
2047 | if (ret) | 2076 | if (ret) |
2048 | goto out_smbus; | 2077 | goto out_smbus; |