The patch number 10119 was added via Devin Heitmueller 
<[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [email protected]

------

From: Devin Heitmueller  <[email protected]>
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.

Priority: high

Signed-off-by: Devin Heitmueller <[email protected]>


---

 linux/drivers/media/video/em28xx/em28xx-cards.c |   24 ++++++++--------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff -r b261a248dee7 -r e134e56200b7 
linux/drivers/media/video/em28xx/em28xx-cards.c
--- a/linux/drivers/media/video/em28xx/em28xx-cards.c   Thu Nov 13 12:20:26 
2008 +0900
+++ b/linux/drivers/media/video/em28xx/em28xx-cards.c   Mon Dec 29 20:27:30 
2008 -0500
@@ -1472,6 +1472,17 @@ static void inline em28xx_set_model(stru
 static void inline em28xx_set_model(struct em28xx *dev)
 {
        memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
+
+       /* Those are the default values for the majority of boards
+          Use those values if not specified otherwise at boards entry
+        */
+       if (!dev->board.xclk)
+               dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
+                                 EM28XX_XCLK_FREQUENCY_12MHZ;
+
+       if (!dev->board.i2c_speed)
+               dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
+                                      EM28XX_I2C_FREQ_100_KHZ;
 }
 
 /* Since em28xx_pre_card_setup() requires a proper dev->model,
@@ -1533,17 +1544,8 @@ void em28xx_pre_card_setup(struct em28xx
        if (rc >= 0)
                dev->reg_gpo = rc;
 
-       /* Those are the default values for the majority of boards
-          Use those values if not specified otherwise at boards entry
-        */
-       if (!dev->board.xclk)
-               dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
-                                 EM28XX_XCLK_FREQUENCY_12MHZ;
-
-       if (!dev->board.i2c_speed)
-               dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
-                                      EM28XX_I2C_FREQ_100_KHZ;
-
+       /* Set the initial XCLK and I2C clock values based on the board
+          definition */
        em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
        em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
        msleep(50);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/e134e56200b7b16818bd308b50d669f390c6daba

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to