aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2008-12-29 20:27:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:35 -0500
commited14e1c2f419a380c7a1a3483ac2443d20a24355 (patch)
tree293192d47aa8d96ee69e5c8c77399443ecf967fc /drivers/media/video
parent60b4bde48b36c0315ef41fd38c339b9c7e68c46f (diff)
V4L/DVB (10119): em28xx: fix corrupted XCLK value
Correct problem introduced during the board refactoring where the XCLK frequency would get zero'd out. The sequence of events was as follows: em28xx_pre_card_setup() called em28xx_set_model() em28xx_set_model() would memcpy to dev->board configuration em28xx_pre_card_setup() would set the dev->board.xclk if not set em28xx_pre_card_setup() would set the XCLK register based on dev->board.xclk ... em28xx_card_setup() would call em28xx_set_model() em28xx_set_model() would memcpy to dev->board configuration (clearing out value of dev->board.xclk set in em28xx_pre_card_setup) ... em28xx_audio_analog_set() sets the XCLK register based on dev->board.xclk (which now contains zero) The change sets the default XCLK and I2C Clock fields in the board definition inside of em28xx_set_model() so that subsequent calls do not cause the values to be overwritten. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 11ce63578e9b..c427c0eeba1d 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1403,6 +1403,17 @@ EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1403static void inline em28xx_set_model(struct em28xx *dev) 1403static void inline em28xx_set_model(struct em28xx *dev)
1404{ 1404{
1405 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board)); 1405 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
1406
1407 /* Those are the default values for the majority of boards
1408 Use those values if not specified otherwise at boards entry
1409 */
1410 if (!dev->board.xclk)
1411 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
1412 EM28XX_XCLK_FREQUENCY_12MHZ;
1413
1414 if (!dev->board.i2c_speed)
1415 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1416 EM28XX_I2C_FREQ_100_KHZ;
1406} 1417}
1407 1418
1408/* Since em28xx_pre_card_setup() requires a proper dev->model, 1419/* Since em28xx_pre_card_setup() requires a proper dev->model,
@@ -1464,17 +1475,8 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1464 if (rc >= 0) 1475 if (rc >= 0)
1465 dev->reg_gpo = rc; 1476 dev->reg_gpo = rc;
1466 1477
1467 /* Those are the default values for the majority of boards 1478 /* Set the initial XCLK and I2C clock values based on the board
1468 Use those values if not specified otherwise at boards entry 1479 definition */
1469 */
1470 if (!dev->board.xclk)
1471 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
1472 EM28XX_XCLK_FREQUENCY_12MHZ;
1473
1474 if (!dev->board.i2c_speed)
1475 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1476 EM28XX_I2C_FREQ_100_KHZ;
1477
1478 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f); 1480 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
1479 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed); 1481 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
1480 msleep(50); 1482 msleep(50);