Commit 2d466e11 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[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: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 72cc9ba3
...@@ -2333,9 +2333,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) ...@@ -2333,9 +2333,6 @@ static int em28xx_hint_sensor(struct em28xx *dev)
switch (version) { switch (version) {
case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */ case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
case 0x8243: /* mt9v011 rev B 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"; sensor_name = "mt9v011";
dev->em28xx_sensor = EM28XX_MT9V011; dev->em28xx_sensor = EM28XX_MT9V011;
dev->sensor_xres = 640; dev->sensor_xres = 640;
...@@ -2359,9 +2356,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) ...@@ -2359,9 +2356,6 @@ static int em28xx_hint_sensor(struct em28xx *dev)
break; break;
case 0x143a: /* MT9M111 as found in the ECS G200 */ case 0x143a: /* MT9M111 as found in the ECS G200 */
dev->model = EM2750_BOARD_UNKNOWN;
em28xx_set_model(dev);
sensor_name = "mt9m111"; sensor_name = "mt9m111";
dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ; dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ;
dev->em28xx_sensor = EM28XX_MT9M111; dev->em28xx_sensor = EM28XX_MT9M111;
...@@ -2375,9 +2369,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) ...@@ -2375,9 +2369,6 @@ static int em28xx_hint_sensor(struct em28xx *dev)
break; break;
case 0x8431: case 0x8431:
dev->model = EM2750_BOARD_UNKNOWN;
em28xx_set_model(dev);
sensor_name = "mt9m001"; sensor_name = "mt9m001";
dev->em28xx_sensor = EM28XX_MT9M001; dev->em28xx_sensor = EM28XX_MT9M001;
em28xx_initialize_mt9m001(dev); em28xx_initialize_mt9m001(dev);
...@@ -2394,11 +2385,7 @@ static int em28xx_hint_sensor(struct em28xx *dev) ...@@ -2394,11 +2385,7 @@ static int em28xx_hint_sensor(struct em28xx *dev)
return -EINVAL; return -EINVAL;
} }
/* Setup webcam defaults */ em28xx_info("sensor %s detected\n", sensor_name);
em28xx_pre_card_setup(dev);
em28xx_errdev("Sensor is %s, using model %s entry.\n",
sensor_name, em28xx_boards[dev->model].name);
return 0; return 0;
} }
...@@ -2628,6 +2615,18 @@ static int em28xx_hint_board(struct em28xx *dev) ...@@ -2628,6 +2615,18 @@ static int em28xx_hint_board(struct em28xx *dev)
{ {
int i; 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 /* HINT method: EEPROM
* *
* This method works only for boards with eeprom. * This method works only for boards with eeprom.
...@@ -2719,10 +2718,10 @@ static void em28xx_card_setup(struct em28xx *dev) ...@@ -2719,10 +2718,10 @@ static void em28xx_card_setup(struct em28xx *dev)
dev->progressive = 1; dev->progressive = 1;
} }
if (!dev->board.is_webcam) { switch (dev->model) {
switch (dev->model) { case EM2750_BOARD_UNKNOWN:
case EM2820_BOARD_UNKNOWN: case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN: case EM2800_BOARD_UNKNOWN:
/* /*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD. * 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) ...@@ -2743,9 +2742,8 @@ static void em28xx_card_setup(struct em28xx *dev)
em28xx_pre_card_setup(dev); em28xx_pre_card_setup(dev);
} }
break; break;
default: default:
em28xx_set_model(dev); em28xx_set_model(dev);
}
} }
em28xx_info("Identified as %s (card=%d)\n", em28xx_info("Identified as %s (card=%d)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment