diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2013-03-27 17:06:28 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-29 06:31:38 -0300 |
commit | 2d466e1136161527708321b73ded9c0ac4cae668 (patch) | |
tree | ece0e3a2c7d72aa74b46d5a1ca2a051d05599d0b /drivers | |
parent | 72cc9ba39a046132a638888eaa5a14baf55621b2 (diff) |
[media] em28xx: fix and separate the board hints for sensor devices
The current board hint code is mixed together with the sensor detection and
initialization code. It actually selects a board depending on the detected
sensor type only, with the result that 3 of the 6 webcam boards are currently
dead.
Separate it and move it to em28xx_hint_board() which already contains the board
hints for analog capturing+TV and DVB devices.
This way, we have all board hints at a common place which makes it easier
to extend the code and reduces the risk of regressions.
It also makes it possible again to use the boards EM2750_BOARD_DLCW_130,
EM2820_BOARD_VIDEOLOGY_20K14XUSB and EM2860_BOARD_NETGMBH_CAM (using the module
parameter "card").
NOTE: the current board hint logic for webcams is preserved. Not more not less.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-cards.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 096206334134..c1397db7c145 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2333,9 +2333,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) switch (version) { case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */ case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */ - dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; - em28xx_set_model(dev); - sensor_name = "mt9v011"; dev->em28xx_sensor = EM28XX_MT9V011; dev->sensor_xres = 640; @@ -2359,9 +2356,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) break; case 0x143a: /* MT9M111 as found in the ECS G200 */ - dev->model = EM2750_BOARD_UNKNOWN; - em28xx_set_model(dev); - sensor_name = "mt9m111"; dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ; dev->em28xx_sensor = EM28XX_MT9M111; @@ -2375,9 +2369,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) break; case 0x8431: - dev->model = EM2750_BOARD_UNKNOWN; - em28xx_set_model(dev); - sensor_name = "mt9m001"; dev->em28xx_sensor = EM28XX_MT9M001; em28xx_initialize_mt9m001(dev); @@ -2394,11 +2385,7 @@ static int em28xx_hint_sensor(struct em28xx *dev) return -EINVAL; } - /* Setup webcam defaults */ - em28xx_pre_card_setup(dev); - - em28xx_errdev("Sensor is %s, using model %s entry.\n", - sensor_name, em28xx_boards[dev->model].name); + em28xx_info("sensor %s detected\n", sensor_name); return 0; } @@ -2628,6 +2615,18 @@ static int em28xx_hint_board(struct em28xx *dev) { int i; + if (dev->board.is_webcam) { + if (dev->em28xx_sensor == EM28XX_MT9V011) { + dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; + } else if (dev->em28xx_sensor == EM28XX_MT9M001 || + dev->em28xx_sensor == EM28XX_MT9M111) { + dev->model = EM2750_BOARD_UNKNOWN; + } + /* FIXME: IMPROVE ! */ + + return 0; + } + /* HINT method: EEPROM * * This method works only for boards with eeprom. @@ -2719,10 +2718,10 @@ static void em28xx_card_setup(struct em28xx *dev) dev->progressive = 1; } - if (!dev->board.is_webcam) { - switch (dev->model) { - case EM2820_BOARD_UNKNOWN: - case EM2800_BOARD_UNKNOWN: + switch (dev->model) { + case EM2750_BOARD_UNKNOWN: + case EM2820_BOARD_UNKNOWN: + case EM2800_BOARD_UNKNOWN: /* * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD. * @@ -2743,9 +2742,8 @@ static void em28xx_card_setup(struct em28xx *dev) em28xx_pre_card_setup(dev); } break; - default: - em28xx_set_model(dev); - } + default: + em28xx_set_model(dev); } em28xx_info("Identified as %s (card=%d)\n", |