diff options
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 56ead3d37926..904e9a5a9065 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1598,14 +1598,29 @@ static u32 get_cx2388x_ident(struct i2c_client *client) | |||
1598 | /* Come out of digital power down */ | 1598 | /* Come out of digital power down */ |
1599 | cx25840_write(client, 0x000, 0); | 1599 | cx25840_write(client, 0x000, 0); |
1600 | 1600 | ||
1601 | /* Detecting whether the part is cx23885/7/8 is more | ||
1602 | * difficult than it needs to be. No ID register. Instead we | ||
1603 | * probe certain registers indicated in the datasheets to look | ||
1604 | * for specific defaults that differ between the silicon designs. */ | ||
1605 | |||
1606 | /* It's either 885/7 if the IR Tx Clk Divider register exists */ | ||
1601 | if (cx25840_read4(client, 0x204) & 0xffff) { | 1607 | if (cx25840_read4(client, 0x204) & 0xffff) { |
1602 | /* IR Tx Clk Divider register exists; chip must be a CX23885 */ | 1608 | /* CX23885 returns bogus repetitive byte values for the DIF, |
1603 | ret = V4L2_IDENT_CX23885_AV; | 1609 | * which doesn't exist for it. (Ex. 8a8a8a8a or 31313131) */ |
1610 | ret = cx25840_read4(client, 0x300); | ||
1611 | if (((ret & 0xffff0000) >> 16) == (ret & 0xffff)) { | ||
1612 | /* No DIF */ | ||
1613 | ret = V4L2_IDENT_CX23885_AV; | ||
1614 | } else { | ||
1615 | /* CX23887 has a broken DIF, but the registers | ||
1616 | * appear valid (but unsed), good enough to detect. */ | ||
1617 | ret = V4L2_IDENT_CX23887_AV; | ||
1618 | } | ||
1604 | } else if (cx25840_read4(client, 0x300) & 0x0fffffff) { | 1619 | } else if (cx25840_read4(client, 0x300) & 0x0fffffff) { |
1605 | /* DIF PLL Freq Word reg exists; chip must be a CX23888 */ | 1620 | /* DIF PLL Freq Word reg exists; chip must be a CX23888 */ |
1606 | ret = V4L2_IDENT_CX23888_AV; | 1621 | ret = V4L2_IDENT_CX23888_AV; |
1607 | } else { | 1622 | } else { |
1608 | /* A CX23887 A/V core has neither IR nor DIF */ | 1623 | v4l_err(client, "Unable to detect h/w, assuming cx23887\n"); |
1609 | ret = V4L2_IDENT_CX23887_AV; | 1624 | ret = V4L2_IDENT_CX23887_AV; |
1610 | } | 1625 | } |
1611 | 1626 | ||