aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-07-14 05:33:51 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 15:43:06 -0400
commit19697b546c9bc5b3c44070be1cfc7ce54a97c0d9 (patch)
treeec683c44cbc2c1b26c53fa44507a251de7b3a8cd /drivers/media
parent35680baa6822df98a6ed602e2380aa0a04e18b07 (diff)
V4L/DVB: gspca - sonixj: Do the audio input work for webcams with a microphone
The bit 0x04 of the bridge register 02 (GPIO) is used for audio connection in webcams containing the bridge SN9C105. This patch sets it correctly, according to the presence of an audio device. Tested-by: Kyle Baker <kyleabaker@gmail.com> Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/sonixj.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index d5fe1f6f4264..ee17b034bf6b 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -391,7 +391,7 @@ static const u8 sn_gc0307[0x1c] = {
391 391
392static const u8 sn_hv7131[0x1c] = { 392static const u8 sn_hv7131[0x1c] = {
393/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ 393/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
394 0x00, 0x03, 0x64, 0x00, 0x1a, 0x20, 0x20, 0x20, 394 0x00, 0x03, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20,
395/* reg8 reg9 rega regb regc regd rege regf */ 395/* reg8 reg9 rega regb regc regd rege regf */
396 0x81, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 396 0x81, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ 397/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
@@ -402,7 +402,7 @@ static const u8 sn_hv7131[0x1c] = {
402 402
403static const u8 sn_mi0360[0x1c] = { 403static const u8 sn_mi0360[0x1c] = {
404/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ 404/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
405 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 405 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20,
406/* reg8 reg9 rega regb regc regd rege regf */ 406/* reg8 reg9 rega regb regc regd rege regf */
407 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 407 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ 408/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
@@ -1643,6 +1643,7 @@ static void bridge_init(struct gspca_dev *gspca_dev,
1643 const u8 *sn9c1xx) 1643 const u8 *sn9c1xx)
1644{ 1644{
1645 struct sd *sd = (struct sd *) gspca_dev; 1645 struct sd *sd = (struct sd *) gspca_dev;
1646 u8 reg0102[2];
1646 const u8 *reg9a; 1647 const u8 *reg9a;
1647 static const u8 reg9a_def[] = 1648 static const u8 reg9a_def[] =
1648 {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; 1649 {0x00, 0x40, 0x20, 0x00, 0x00, 0x00};
@@ -1655,7 +1656,11 @@ static void bridge_init(struct gspca_dev *gspca_dev,
1655 reg_w1(gspca_dev, 0x01, sn9c1xx[1]); 1656 reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
1656 1657
1657 /* configure gpio */ 1658 /* configure gpio */
1658 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); 1659 reg0102[0] = sn9c1xx[1];
1660 reg0102[1] = sn9c1xx[2];
1661 if (gspca_dev->audio)
1662 reg0102[1] |= 0x04; /* keep the audio connection */
1663 reg_w(gspca_dev, 0x01, reg0102, 2);
1659 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); 1664 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
1660 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); 1665 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5);
1661 switch (sd->sensor) { 1666 switch (sd->sensor) {
@@ -1736,13 +1741,12 @@ static void bridge_init(struct gspca_dev *gspca_dev,
1736 reg_w1(gspca_dev, 0x01, 0x40); 1741 reg_w1(gspca_dev, 0x01, 0x40);
1737 break; 1742 break;
1738 case SENSOR_PO2030N: 1743 case SENSOR_PO2030N:
1744 case SENSOR_OV7660:
1739 reg_w1(gspca_dev, 0x01, 0x63); 1745 reg_w1(gspca_dev, 0x01, 0x63);
1740 reg_w1(gspca_dev, 0x17, 0x20); 1746 reg_w1(gspca_dev, 0x17, 0x20);
1741 reg_w1(gspca_dev, 0x01, 0x62); 1747 reg_w1(gspca_dev, 0x01, 0x62);
1742 reg_w1(gspca_dev, 0x01, 0x42); 1748 reg_w1(gspca_dev, 0x01, 0x42);
1743 break; 1749 break;
1744 case SENSOR_OV7660:
1745 /* fall thru */
1746 case SENSOR_SP80708: 1750 case SENSOR_SP80708:
1747 reg_w1(gspca_dev, 0x01, 0x63); 1751 reg_w1(gspca_dev, 0x01, 0x63);
1748 reg_w1(gspca_dev, 0x17, 0x20); 1752 reg_w1(gspca_dev, 0x17, 0x20);
@@ -1815,7 +1819,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
1815{ 1819{
1816 struct sd *sd = (struct sd *) gspca_dev; 1820 struct sd *sd = (struct sd *) gspca_dev;
1817 const u8 *sn9c1xx; 1821 const u8 *sn9c1xx;
1818 u8 regGpio[] = { 0x29, 0x74 }; 1822 u8 regGpio[] = { 0x29, 0x74 }; /* with audio */
1819 u8 regF1; 1823 u8 regF1;
1820 1824
1821 /* setup a selector by bridge */ 1825 /* setup a selector by bridge */
@@ -1855,7 +1859,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
1855 po2030n_probe(gspca_dev); 1859 po2030n_probe(gspca_dev);
1856 break; 1860 break;
1857 } 1861 }
1858 regGpio[1] = 0x70; 1862 regGpio[1] = 0x70; /* no audio */
1859 reg_w(gspca_dev, 0x01, regGpio, 2); 1863 reg_w(gspca_dev, 0x01, regGpio, 2);
1860 break; 1864 break;
1861 default: 1865 default:
@@ -2273,7 +2277,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2273{ 2277{
2274 struct sd *sd = (struct sd *) gspca_dev; 2278 struct sd *sd = (struct sd *) gspca_dev;
2275 int i; 2279 int i;
2276 u8 reg1, reg2, reg17; 2280 u8 reg1, reg17;
2277 const u8 *sn9c1xx; 2281 const u8 *sn9c1xx;
2278 const u8 (*init)[8]; 2282 const u8 (*init)[8];
2279 int mode; 2283 int mode;
@@ -2303,23 +2307,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
2303 /* initialize the sensor */ 2307 /* initialize the sensor */
2304 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); 2308 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]);
2305 2309
2306 switch (sd->sensor) {
2307 case SENSOR_ADCM1700:
2308 reg2 = 0x60;
2309 break;
2310 case SENSOR_OM6802:
2311 reg2 = 0x71;
2312 break;
2313 case SENSOR_SP80708:
2314 reg2 = 0x62;
2315 break;
2316 default:
2317 reg2 = 0x40;
2318 break;
2319 }
2320 reg_w1(gspca_dev, 0x02, reg2);
2321 reg_w1(gspca_dev, 0x02, reg2);
2322
2323 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); 2310 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
2324 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); 2311 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
2325 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); 2312 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);