diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cafe_ccic.c | 11 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 22 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 18 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 9 | ||||
-rw-r--r-- | drivers/media/video/mt9v011.c | 54 | ||||
-rw-r--r-- | drivers/media/video/mt9v011.h | 36 | ||||
-rw-r--r-- | drivers/media/video/ov7670.c | 74 | ||||
-rw-r--r-- | drivers/media/video/sr030pc30.c | 10 | ||||
-rw-r--r-- | drivers/media/video/v4l2-common.c | 19 |
9 files changed, 99 insertions, 154 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 49f1b8f1418e..55ffd60ffa7f 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -2001,6 +2001,11 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2001 | .min_width = 320, | 2001 | .min_width = 320, |
2002 | .min_height = 240, | 2002 | .min_height = 240, |
2003 | }; | 2003 | }; |
2004 | struct i2c_board_info ov7670_info = { | ||
2005 | .type = "ov7670", | ||
2006 | .addr = 0x42, | ||
2007 | .platform_data = &sensor_cfg, | ||
2008 | }; | ||
2004 | 2009 | ||
2005 | /* | 2010 | /* |
2006 | * Start putting together one of our big camera structures. | 2011 | * Start putting together one of our big camera structures. |
@@ -2062,9 +2067,9 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2062 | if (dmi_check_system(olpc_xo1_dmi)) | 2067 | if (dmi_check_system(olpc_xo1_dmi)) |
2063 | sensor_cfg.clock_speed = 45; | 2068 | sensor_cfg.clock_speed = 45; |
2064 | 2069 | ||
2065 | cam->sensor_addr = 0x42; | 2070 | cam->sensor_addr = ov7670_info.addr; |
2066 | cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, | 2071 | cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter, |
2067 | "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL); | 2072 | &ov7670_info, NULL); |
2068 | if (cam->sensor == NULL) { | 2073 | if (cam->sensor == NULL) { |
2069 | ret = -ENODEV; | 2074 | ret = -ENODEV; |
2070 | goto out_smbus; | 2075 | goto out_smbus; |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index f16461844c5c..6fc09dd41b9d 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1682,20 +1682,6 @@ static int cx25840_log_status(struct v4l2_subdev *sd) | |||
1682 | return 0; | 1682 | return 0; |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | static int cx25840_s_config(struct v4l2_subdev *sd, int irq, void *platform_data) | ||
1686 | { | ||
1687 | struct cx25840_state *state = to_state(sd); | ||
1688 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1689 | |||
1690 | if (platform_data) { | ||
1691 | struct cx25840_platform_data *pdata = platform_data; | ||
1692 | |||
1693 | state->pvr150_workaround = pdata->pvr150_workaround; | ||
1694 | set_input(client, state->vid_input, state->aud_input); | ||
1695 | } | ||
1696 | return 0; | ||
1697 | } | ||
1698 | |||
1699 | static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, | 1685 | static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, |
1700 | bool *handled) | 1686 | bool *handled) |
1701 | { | 1687 | { |
@@ -1787,7 +1773,6 @@ static const struct v4l2_ctrl_ops cx25840_ctrl_ops = { | |||
1787 | 1773 | ||
1788 | static const struct v4l2_subdev_core_ops cx25840_core_ops = { | 1774 | static const struct v4l2_subdev_core_ops cx25840_core_ops = { |
1789 | .log_status = cx25840_log_status, | 1775 | .log_status = cx25840_log_status, |
1790 | .s_config = cx25840_s_config, | ||
1791 | .g_chip_ident = cx25840_g_chip_ident, | 1776 | .g_chip_ident = cx25840_g_chip_ident, |
1792 | .g_ctrl = v4l2_subdev_g_ctrl, | 1777 | .g_ctrl = v4l2_subdev_g_ctrl, |
1793 | .s_ctrl = v4l2_subdev_s_ctrl, | 1778 | .s_ctrl = v4l2_subdev_s_ctrl, |
@@ -1974,7 +1959,6 @@ static int cx25840_probe(struct i2c_client *client, | |||
1974 | state->vid_input = CX25840_COMPOSITE7; | 1959 | state->vid_input = CX25840_COMPOSITE7; |
1975 | state->aud_input = CX25840_AUDIO8; | 1960 | state->aud_input = CX25840_AUDIO8; |
1976 | state->audclk_freq = 48000; | 1961 | state->audclk_freq = 48000; |
1977 | state->pvr150_workaround = 0; | ||
1978 | state->audmode = V4L2_TUNER_MODE_LANG1; | 1962 | state->audmode = V4L2_TUNER_MODE_LANG1; |
1979 | state->vbi_line_offset = 8; | 1963 | state->vbi_line_offset = 8; |
1980 | state->id = id; | 1964 | state->id = id; |
@@ -2034,6 +2018,12 @@ static int cx25840_probe(struct i2c_client *client, | |||
2034 | v4l2_ctrl_cluster(2, &state->volume); | 2018 | v4l2_ctrl_cluster(2, &state->volume); |
2035 | v4l2_ctrl_handler_setup(&state->hdl); | 2019 | v4l2_ctrl_handler_setup(&state->hdl); |
2036 | 2020 | ||
2021 | if (client->dev.platform_data) { | ||
2022 | struct cx25840_platform_data *pdata = client->dev.platform_data; | ||
2023 | |||
2024 | state->pvr150_workaround = pdata->pvr150_workaround; | ||
2025 | } | ||
2026 | |||
2037 | cx25840_ir_probe(sd); | 2027 | cx25840_ir_probe(sd); |
2038 | return 0; | 2028 | return 0; |
2039 | } | 2029 | } |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index ba03a448b41d..87f77a34eeab 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <media/saa7115.h> | 33 | #include <media/saa7115.h> |
34 | #include <media/tvp5150.h> | 34 | #include <media/tvp5150.h> |
35 | #include <media/tvaudio.h> | 35 | #include <media/tvaudio.h> |
36 | #include <media/mt9v011.h> | ||
36 | #include <media/i2c-addr.h> | 37 | #include <media/i2c-addr.h> |
37 | #include <media/tveeprom.h> | 38 | #include <media/tveeprom.h> |
38 | #include <media/v4l2-common.h> | 39 | #include <media/v4l2-common.h> |
@@ -1917,11 +1918,6 @@ static unsigned short tvp5150_addrs[] = { | |||
1917 | I2C_CLIENT_END | 1918 | I2C_CLIENT_END |
1918 | }; | 1919 | }; |
1919 | 1920 | ||
1920 | static unsigned short mt9v011_addrs[] = { | ||
1921 | 0xba >> 1, | ||
1922 | I2C_CLIENT_END | ||
1923 | }; | ||
1924 | |||
1925 | static unsigned short msp3400_addrs[] = { | 1921 | static unsigned short msp3400_addrs[] = { |
1926 | 0x80 >> 1, | 1922 | 0x80 >> 1, |
1927 | 0x88 >> 1, | 1923 | 0x88 >> 1, |
@@ -2624,11 +2620,17 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2624 | "tvp5150", 0, tvp5150_addrs); | 2620 | "tvp5150", 0, tvp5150_addrs); |
2625 | 2621 | ||
2626 | if (dev->em28xx_sensor == EM28XX_MT9V011) { | 2622 | if (dev->em28xx_sensor == EM28XX_MT9V011) { |
2623 | struct mt9v011_platform_data pdata; | ||
2624 | struct i2c_board_info mt9v011_info = { | ||
2625 | .type = "mt9v011", | ||
2626 | .addr = 0xba >> 1, | ||
2627 | .platform_data = &pdata, | ||
2628 | }; | ||
2627 | struct v4l2_subdev *sd; | 2629 | struct v4l2_subdev *sd; |
2628 | 2630 | ||
2629 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2631 | pdata.xtal = dev->sensor_xtal; |
2630 | &dev->i2c_adap, "mt9v011", 0, mt9v011_addrs); | 2632 | sd = v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap, |
2631 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); | 2633 | &mt9v011_info, NULL); |
2632 | } | 2634 | } |
2633 | 2635 | ||
2634 | 2636 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index e103b8fc7452..9fb86a081c0f 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -300,10 +300,15 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
300 | adap, type, 0, I2C_ADDRS(hw_addrs[idx])); | 300 | adap, type, 0, I2C_ADDRS(hw_addrs[idx])); |
301 | } else if (hw == IVTV_HW_CX25840) { | 301 | } else if (hw == IVTV_HW_CX25840) { |
302 | struct cx25840_platform_data pdata; | 302 | struct cx25840_platform_data pdata; |
303 | struct i2c_board_info cx25840_info = { | ||
304 | .type = "cx25840", | ||
305 | .addr = hw_addrs[idx], | ||
306 | .platform_data = &pdata, | ||
307 | }; | ||
303 | 308 | ||
304 | pdata.pvr150_workaround = itv->pvr150_workaround; | 309 | pdata.pvr150_workaround = itv->pvr150_workaround; |
305 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, | 310 | sd = v4l2_i2c_new_subdev_board(&itv->v4l2_dev, adap, |
306 | adap, type, 0, &pdata, hw_addrs[idx], NULL); | 311 | &cx25840_info, NULL); |
307 | } else { | 312 | } else { |
308 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 313 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
309 | adap, type, hw_addrs[idx], NULL); | 314 | adap, type, hw_addrs[idx], NULL); |
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index 209ff97261a9..4904d25f689f 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c | |||
@@ -12,17 +12,41 @@ | |||
12 | #include <asm/div64.h> | 12 | #include <asm/div64.h> |
13 | #include <media/v4l2-device.h> | 13 | #include <media/v4l2-device.h> |
14 | #include <media/v4l2-chip-ident.h> | 14 | #include <media/v4l2-chip-ident.h> |
15 | #include "mt9v011.h" | 15 | #include <media/mt9v011.h> |
16 | 16 | ||
17 | MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); | 17 | MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); |
18 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | 18 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); |
19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
20 | 20 | ||
21 | |||
22 | static int debug; | 21 | static int debug; |
23 | module_param(debug, int, 0); | 22 | module_param(debug, int, 0); |
24 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); | 23 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); |
25 | 24 | ||
25 | #define R00_MT9V011_CHIP_VERSION 0x00 | ||
26 | #define R01_MT9V011_ROWSTART 0x01 | ||
27 | #define R02_MT9V011_COLSTART 0x02 | ||
28 | #define R03_MT9V011_HEIGHT 0x03 | ||
29 | #define R04_MT9V011_WIDTH 0x04 | ||
30 | #define R05_MT9V011_HBLANK 0x05 | ||
31 | #define R06_MT9V011_VBLANK 0x06 | ||
32 | #define R07_MT9V011_OUT_CTRL 0x07 | ||
33 | #define R09_MT9V011_SHUTTER_WIDTH 0x09 | ||
34 | #define R0A_MT9V011_CLK_SPEED 0x0a | ||
35 | #define R0B_MT9V011_RESTART 0x0b | ||
36 | #define R0C_MT9V011_SHUTTER_DELAY 0x0c | ||
37 | #define R0D_MT9V011_RESET 0x0d | ||
38 | #define R1E_MT9V011_DIGITAL_ZOOM 0x1e | ||
39 | #define R20_MT9V011_READ_MODE 0x20 | ||
40 | #define R2B_MT9V011_GREEN_1_GAIN 0x2b | ||
41 | #define R2C_MT9V011_BLUE_GAIN 0x2c | ||
42 | #define R2D_MT9V011_RED_GAIN 0x2d | ||
43 | #define R2E_MT9V011_GREEN_2_GAIN 0x2e | ||
44 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | ||
45 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | ||
46 | |||
47 | #define MT9V011_VERSION 0x8232 | ||
48 | #define MT9V011_REV_B_VERSION 0x8243 | ||
49 | |||
26 | /* supported controls */ | 50 | /* supported controls */ |
27 | static struct v4l2_queryctrl mt9v011_qctrl[] = { | 51 | static struct v4l2_queryctrl mt9v011_qctrl[] = { |
28 | { | 52 | { |
@@ -469,23 +493,6 @@ static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt | |||
469 | return 0; | 493 | return 0; |
470 | } | 494 | } |
471 | 495 | ||
472 | static int mt9v011_s_config(struct v4l2_subdev *sd, int dumb, void *data) | ||
473 | { | ||
474 | struct mt9v011 *core = to_mt9v011(sd); | ||
475 | unsigned *xtal = data; | ||
476 | |||
477 | v4l2_dbg(1, debug, sd, "s_config called\n"); | ||
478 | |||
479 | if (xtal) { | ||
480 | core->xtal = *xtal; | ||
481 | v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n", | ||
482 | *xtal / 1000000, (*xtal / 1000) % 1000); | ||
483 | } | ||
484 | |||
485 | return 0; | ||
486 | } | ||
487 | |||
488 | |||
489 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 496 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
490 | static int mt9v011_g_register(struct v4l2_subdev *sd, | 497 | static int mt9v011_g_register(struct v4l2_subdev *sd, |
491 | struct v4l2_dbg_register *reg) | 498 | struct v4l2_dbg_register *reg) |
@@ -536,7 +543,6 @@ static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | |||
536 | .g_ctrl = mt9v011_g_ctrl, | 543 | .g_ctrl = mt9v011_g_ctrl, |
537 | .s_ctrl = mt9v011_s_ctrl, | 544 | .s_ctrl = mt9v011_s_ctrl, |
538 | .reset = mt9v011_reset, | 545 | .reset = mt9v011_reset, |
539 | .s_config = mt9v011_s_config, | ||
540 | .g_chip_ident = mt9v011_g_chip_ident, | 546 | .g_chip_ident = mt9v011_g_chip_ident, |
541 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 547 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
542 | .g_register = mt9v011_g_register, | 548 | .g_register = mt9v011_g_register, |
@@ -596,6 +602,14 @@ static int mt9v011_probe(struct i2c_client *c, | |||
596 | core->height = 480; | 602 | core->height = 480; |
597 | core->xtal = 27000000; /* Hz */ | 603 | core->xtal = 27000000; /* Hz */ |
598 | 604 | ||
605 | if (c->dev.platform_data) { | ||
606 | struct mt9v011_platform_data *pdata = c->dev.platform_data; | ||
607 | |||
608 | core->xtal = pdata->xtal; | ||
609 | v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n", | ||
610 | core->xtal / 1000000, (core->xtal / 1000) % 1000); | ||
611 | } | ||
612 | |||
599 | v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", | 613 | v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", |
600 | c->addr << 1, c->adapter->name, version); | 614 | c->addr << 1, c->adapter->name, version); |
601 | 615 | ||
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h deleted file mode 100644 index 3350fd6083c3..000000000000 --- a/drivers/media/video/mt9v011.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com) | ||
5 | * This code is placed under the terms of the GNU General Public License v2 | ||
6 | */ | ||
7 | |||
8 | #ifndef MT9V011_H_ | ||
9 | #define MT9V011_H_ | ||
10 | |||
11 | #define R00_MT9V011_CHIP_VERSION 0x00 | ||
12 | #define R01_MT9V011_ROWSTART 0x01 | ||
13 | #define R02_MT9V011_COLSTART 0x02 | ||
14 | #define R03_MT9V011_HEIGHT 0x03 | ||
15 | #define R04_MT9V011_WIDTH 0x04 | ||
16 | #define R05_MT9V011_HBLANK 0x05 | ||
17 | #define R06_MT9V011_VBLANK 0x06 | ||
18 | #define R07_MT9V011_OUT_CTRL 0x07 | ||
19 | #define R09_MT9V011_SHUTTER_WIDTH 0x09 | ||
20 | #define R0A_MT9V011_CLK_SPEED 0x0a | ||
21 | #define R0B_MT9V011_RESTART 0x0b | ||
22 | #define R0C_MT9V011_SHUTTER_DELAY 0x0c | ||
23 | #define R0D_MT9V011_RESET 0x0d | ||
24 | #define R1E_MT9V011_DIGITAL_ZOOM 0x1e | ||
25 | #define R20_MT9V011_READ_MODE 0x20 | ||
26 | #define R2B_MT9V011_GREEN_1_GAIN 0x2b | ||
27 | #define R2C_MT9V011_BLUE_GAIN 0x2c | ||
28 | #define R2D_MT9V011_RED_GAIN 0x2d | ||
29 | #define R2E_MT9V011_GREEN_2_GAIN 0x2e | ||
30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | ||
31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | ||
32 | |||
33 | #define MT9V011_VERSION 0x8232 | ||
34 | #define MT9V011_REV_B_VERSION 0x8243 | ||
35 | |||
36 | #endif | ||
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index c881a64b41fd..d4e7c11553c3 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -1449,47 +1449,6 @@ static int ov7670_g_chip_ident(struct v4l2_subdev *sd, | |||
1449 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); | 1449 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | static int ov7670_s_config(struct v4l2_subdev *sd, int dumb, void *data) | ||
1453 | { | ||
1454 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1455 | struct ov7670_config *config = data; | ||
1456 | struct ov7670_info *info = to_state(sd); | ||
1457 | int ret; | ||
1458 | |||
1459 | info->clock_speed = 30; /* default: a guess */ | ||
1460 | |||
1461 | /* | ||
1462 | * Must apply configuration before initializing device, because it | ||
1463 | * selects I/O method. | ||
1464 | */ | ||
1465 | if (config) { | ||
1466 | info->min_width = config->min_width; | ||
1467 | info->min_height = config->min_height; | ||
1468 | info->use_smbus = config->use_smbus; | ||
1469 | |||
1470 | if (config->clock_speed) | ||
1471 | info->clock_speed = config->clock_speed; | ||
1472 | } | ||
1473 | |||
1474 | /* Make sure it's an ov7670 */ | ||
1475 | ret = ov7670_detect(sd); | ||
1476 | if (ret) { | ||
1477 | v4l_dbg(1, debug, client, | ||
1478 | "chip found @ 0x%x (%s) is not an ov7670 chip.\n", | ||
1479 | client->addr << 1, client->adapter->name); | ||
1480 | kfree(info); | ||
1481 | return ret; | ||
1482 | } | ||
1483 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | ||
1484 | client->addr << 1, client->adapter->name); | ||
1485 | |||
1486 | info->fmt = &ov7670_formats[0]; | ||
1487 | info->sat = 128; /* Review this */ | ||
1488 | info->clkrc = info->clock_speed / 30; | ||
1489 | |||
1490 | return 0; | ||
1491 | } | ||
1492 | |||
1493 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1452 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1494 | static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) | 1453 | static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) |
1495 | { | 1454 | { |
@@ -1528,7 +1487,6 @@ static const struct v4l2_subdev_core_ops ov7670_core_ops = { | |||
1528 | .s_ctrl = ov7670_s_ctrl, | 1487 | .s_ctrl = ov7670_s_ctrl, |
1529 | .queryctrl = ov7670_queryctrl, | 1488 | .queryctrl = ov7670_queryctrl, |
1530 | .reset = ov7670_reset, | 1489 | .reset = ov7670_reset, |
1531 | .s_config = ov7670_s_config, | ||
1532 | .init = ov7670_init, | 1490 | .init = ov7670_init, |
1533 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1491 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1534 | .g_register = ov7670_g_register, | 1492 | .g_register = ov7670_g_register, |
@@ -1558,6 +1516,7 @@ static int ov7670_probe(struct i2c_client *client, | |||
1558 | { | 1516 | { |
1559 | struct v4l2_subdev *sd; | 1517 | struct v4l2_subdev *sd; |
1560 | struct ov7670_info *info; | 1518 | struct ov7670_info *info; |
1519 | int ret; | ||
1561 | 1520 | ||
1562 | info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL); | 1521 | info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL); |
1563 | if (info == NULL) | 1522 | if (info == NULL) |
@@ -1565,6 +1524,37 @@ static int ov7670_probe(struct i2c_client *client, | |||
1565 | sd = &info->sd; | 1524 | sd = &info->sd; |
1566 | v4l2_i2c_subdev_init(sd, client, &ov7670_ops); | 1525 | v4l2_i2c_subdev_init(sd, client, &ov7670_ops); |
1567 | 1526 | ||
1527 | info->clock_speed = 30; /* default: a guess */ | ||
1528 | if (client->dev.platform_data) { | ||
1529 | struct ov7670_config *config = client->dev.platform_data; | ||
1530 | |||
1531 | /* | ||
1532 | * Must apply configuration before initializing device, because it | ||
1533 | * selects I/O method. | ||
1534 | */ | ||
1535 | info->min_width = config->min_width; | ||
1536 | info->min_height = config->min_height; | ||
1537 | info->use_smbus = config->use_smbus; | ||
1538 | |||
1539 | if (config->clock_speed) | ||
1540 | info->clock_speed = config->clock_speed; | ||
1541 | } | ||
1542 | |||
1543 | /* Make sure it's an ov7670 */ | ||
1544 | ret = ov7670_detect(sd); | ||
1545 | if (ret) { | ||
1546 | v4l_dbg(1, debug, client, | ||
1547 | "chip found @ 0x%x (%s) is not an ov7670 chip.\n", | ||
1548 | client->addr << 1, client->adapter->name); | ||
1549 | kfree(info); | ||
1550 | return ret; | ||
1551 | } | ||
1552 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | ||
1553 | client->addr << 1, client->adapter->name); | ||
1554 | |||
1555 | info->fmt = &ov7670_formats[0]; | ||
1556 | info->sat = 128; /* Review this */ | ||
1557 | info->clkrc = info->clock_speed / 30; | ||
1568 | return 0; | 1558 | return 0; |
1569 | } | 1559 | } |
1570 | 1560 | ||
diff --git a/drivers/media/video/sr030pc30.c b/drivers/media/video/sr030pc30.c index 864696b7a006..c901721a1db3 100644 --- a/drivers/media/video/sr030pc30.c +++ b/drivers/media/video/sr030pc30.c | |||
@@ -714,15 +714,6 @@ static int sr030pc30_base_config(struct v4l2_subdev *sd) | |||
714 | return ret; | 714 | return ret; |
715 | } | 715 | } |
716 | 716 | ||
717 | static int sr030pc30_s_config(struct v4l2_subdev *sd, | ||
718 | int irq, void *platform_data) | ||
719 | { | ||
720 | struct sr030pc30_info *info = to_sr030pc30(sd); | ||
721 | |||
722 | info->pdata = platform_data; | ||
723 | return 0; | ||
724 | } | ||
725 | |||
726 | static int sr030pc30_s_stream(struct v4l2_subdev *sd, int enable) | 717 | static int sr030pc30_s_stream(struct v4l2_subdev *sd, int enable) |
727 | { | 718 | { |
728 | return 0; | 719 | return 0; |
@@ -763,7 +754,6 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on) | |||
763 | } | 754 | } |
764 | 755 | ||
765 | static const struct v4l2_subdev_core_ops sr030pc30_core_ops = { | 756 | static const struct v4l2_subdev_core_ops sr030pc30_core_ops = { |
766 | .s_config = sr030pc30_s_config, | ||
767 | .s_power = sr030pc30_s_power, | 757 | .s_power = sr030pc30_s_power, |
768 | .queryctrl = sr030pc30_queryctrl, | 758 | .queryctrl = sr030pc30_queryctrl, |
769 | .s_ctrl = sr030pc30_s_ctrl, | 759 | .s_ctrl = sr030pc30_s_ctrl, |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 3f0871b550ad..810eef43c216 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -407,18 +407,6 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, | |||
407 | /* Decrease the module use count to match the first try_module_get. */ | 407 | /* Decrease the module use count to match the first try_module_get. */ |
408 | module_put(client->driver->driver.owner); | 408 | module_put(client->driver->driver.owner); |
409 | 409 | ||
410 | if (sd) { | ||
411 | /* We return errors from v4l2_subdev_call only if we have the | ||
412 | callback as the .s_config is not mandatory */ | ||
413 | int err = v4l2_subdev_call(sd, core, s_config, | ||
414 | info->irq, info->platform_data); | ||
415 | |||
416 | if (err && err != -ENOIOCTLCMD) { | ||
417 | v4l2_device_unregister_subdev(sd); | ||
418 | sd = NULL; | ||
419 | } | ||
420 | } | ||
421 | |||
422 | error: | 410 | error: |
423 | /* If we have a client but no subdev, then something went wrong and | 411 | /* If we have a client but no subdev, then something went wrong and |
424 | we must unregister the client. */ | 412 | we must unregister the client. */ |
@@ -428,9 +416,8 @@ error: | |||
428 | } | 416 | } |
429 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); | 417 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); |
430 | 418 | ||
431 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | 419 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, |
432 | struct i2c_adapter *adapter, const char *client_type, | 420 | struct i2c_adapter *adapter, const char *client_type, |
433 | int irq, void *platform_data, | ||
434 | u8 addr, const unsigned short *probe_addrs) | 421 | u8 addr, const unsigned short *probe_addrs) |
435 | { | 422 | { |
436 | struct i2c_board_info info; | 423 | struct i2c_board_info info; |
@@ -440,12 +427,10 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | |||
440 | memset(&info, 0, sizeof(info)); | 427 | memset(&info, 0, sizeof(info)); |
441 | strlcpy(info.type, client_type, sizeof(info.type)); | 428 | strlcpy(info.type, client_type, sizeof(info.type)); |
442 | info.addr = addr; | 429 | info.addr = addr; |
443 | info.irq = irq; | ||
444 | info.platform_data = platform_data; | ||
445 | 430 | ||
446 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); | 431 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); |
447 | } | 432 | } |
448 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); | 433 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); |
449 | 434 | ||
450 | /* Return i2c client address of v4l2_subdev. */ | 435 | /* Return i2c client address of v4l2_subdev. */ |
451 | unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd) | 436 | unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd) |