diff options
author | Daniel Glöckner <daniel-gl@gmx.net> | 2012-06-09 20:43:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-18 19:46:39 -0400 |
commit | 3322a59e095d648883fe68909df1b8f13ab096a9 (patch) | |
tree | 0670f0597c709a8fae93e9b0cd9a1f025a7947cf | |
parent | f3647b14ffa2e8d42860bacda3a9b52366726c8a (diff) |
[media] tvaudio: use V4L2_TUNER_SUB_* for bitfields
The V4L2_TUNER_MODE_* constants are not suited for use in bitfields.
Signed-off-by: Daniel Glöckner <daniel-gl@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/tvaudio.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 0e77d4936a73..58a0e9c2fd4b 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -315,13 +315,13 @@ static int chip_thread(void *data) | |||
315 | 315 | ||
316 | chip->prevmode = mode; | 316 | chip->prevmode = mode; |
317 | 317 | ||
318 | if (mode & V4L2_TUNER_MODE_STEREO) | 318 | if (mode & V4L2_TUNER_SUB_STEREO) |
319 | desc->setmode(chip, V4L2_TUNER_MODE_STEREO); | 319 | desc->setmode(chip, V4L2_TUNER_MODE_STEREO); |
320 | if (mode & V4L2_TUNER_MODE_LANG1_LANG2) | 320 | if (mode & V4L2_TUNER_SUB_LANG1_LANG2) |
321 | desc->setmode(chip, V4L2_TUNER_MODE_STEREO); | 321 | desc->setmode(chip, V4L2_TUNER_MODE_STEREO); |
322 | else if (mode & V4L2_TUNER_MODE_LANG1) | 322 | else if (mode & V4L2_SUB_MODE_LANG1) |
323 | desc->setmode(chip, V4L2_TUNER_MODE_LANG1); | 323 | desc->setmode(chip, V4L2_TUNER_MODE_LANG1); |
324 | else if (mode & V4L2_TUNER_MODE_LANG2) | 324 | else if (mode & V4L2_SUB_MODE_LANG2) |
325 | desc->setmode(chip, V4L2_TUNER_MODE_LANG2); | 325 | desc->setmode(chip, V4L2_TUNER_MODE_LANG2); |
326 | else | 326 | else |
327 | desc->setmode(chip, V4L2_TUNER_MODE_MONO); | 327 | desc->setmode(chip, V4L2_TUNER_MODE_MONO); |
@@ -363,11 +363,11 @@ static int tda9840_getmode(struct CHIPSTATE *chip) | |||
363 | int val, mode; | 363 | int val, mode; |
364 | 364 | ||
365 | val = chip_read(chip); | 365 | val = chip_read(chip); |
366 | mode = V4L2_TUNER_MODE_MONO; | 366 | mode = V4L2_TUNER_SUB_MONO; |
367 | if (val & TDA9840_DS_DUAL) | 367 | if (val & TDA9840_DS_DUAL) |
368 | mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; | 368 | mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
369 | if (val & TDA9840_ST_STEREO) | 369 | if (val & TDA9840_ST_STEREO) |
370 | mode |= V4L2_TUNER_MODE_STEREO; | 370 | mode |= V4L2_TUNER_SUB_STEREO; |
371 | 371 | ||
372 | v4l2_dbg(1, debug, sd, "tda9840_getmode(): raw chip read: %d, return: %d\n", | 372 | v4l2_dbg(1, debug, sd, "tda9840_getmode(): raw chip read: %d, return: %d\n", |
373 | val, mode); | 373 | val, mode); |
@@ -514,13 +514,17 @@ static int tda9855_treble(int val) { return (val/0x1c71+0x3)<<1; } | |||
514 | 514 | ||
515 | static int tda985x_getmode(struct CHIPSTATE *chip) | 515 | static int tda985x_getmode(struct CHIPSTATE *chip) |
516 | { | 516 | { |
517 | int mode; | 517 | int mode, val; |
518 | 518 | ||
519 | mode = ((TDA985x_STP | TDA985x_SAPP) & | ||
520 | chip_read(chip)) >> 4; | ||
521 | /* Add mono mode regardless of SAP and stereo */ | 519 | /* Add mono mode regardless of SAP and stereo */ |
522 | /* Allows forced mono */ | 520 | /* Allows forced mono */ |
523 | return mode | V4L2_TUNER_MODE_MONO; | 521 | mode = V4L2_TUNER_SUB_MONO; |
522 | val = chip_read(chip); | ||
523 | if (val & TDA985x_STP) | ||
524 | mode |= V4L2_TUNER_SUB_STEREO; | ||
525 | if (val & TDA985x_SAPP) | ||
526 | mode |= V4L2_TUNER_SUB_SAP; | ||
527 | return mode; | ||
524 | } | 528 | } |
525 | 529 | ||
526 | static void tda985x_setmode(struct CHIPSTATE *chip, int mode) | 530 | static void tda985x_setmode(struct CHIPSTATE *chip, int mode) |
@@ -670,11 +674,11 @@ static int tda9873_getmode(struct CHIPSTATE *chip) | |||
670 | int val,mode; | 674 | int val,mode; |
671 | 675 | ||
672 | val = chip_read(chip); | 676 | val = chip_read(chip); |
673 | mode = V4L2_TUNER_MODE_MONO; | 677 | mode = V4L2_TUNER_SUB_MONO; |
674 | if (val & TDA9873_STEREO) | 678 | if (val & TDA9873_STEREO) |
675 | mode |= V4L2_TUNER_MODE_STEREO; | 679 | mode |= V4L2_TUNER_SUB_STEREO; |
676 | if (val & TDA9873_DUAL) | 680 | if (val & TDA9873_DUAL) |
677 | mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; | 681 | mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
678 | v4l2_dbg(1, debug, sd, "tda9873_getmode(): raw chip read: %d, return: %d\n", | 682 | v4l2_dbg(1, debug, sd, "tda9873_getmode(): raw chip read: %d, return: %d\n", |
679 | val, mode); | 683 | val, mode); |
680 | return mode; | 684 | return mode; |
@@ -865,7 +869,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) | |||
865 | int dsr,nsr,mode; | 869 | int dsr,nsr,mode; |
866 | int necr; /* just for debugging */ | 870 | int necr; /* just for debugging */ |
867 | 871 | ||
868 | mode = V4L2_TUNER_MODE_MONO; | 872 | mode = V4L2_TUNER_SUB_MONO; |
869 | 873 | ||
870 | if(-1 == (dsr = chip_read2(chip,TDA9874A_DSR))) | 874 | if(-1 == (dsr = chip_read2(chip,TDA9874A_DSR))) |
871 | return mode; | 875 | return mode; |
@@ -888,14 +892,14 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) | |||
888 | * external 4052 multiplexer in audio_hook(). | 892 | * external 4052 multiplexer in audio_hook(). |
889 | */ | 893 | */ |
890 | if(nsr & 0x02) /* NSR.S/MB=1 */ | 894 | if(nsr & 0x02) /* NSR.S/MB=1 */ |
891 | mode |= V4L2_TUNER_MODE_STEREO; | 895 | mode |= V4L2_TUNER_SUB_STEREO; |
892 | if(nsr & 0x01) /* NSR.D/SB=1 */ | 896 | if(nsr & 0x01) /* NSR.D/SB=1 */ |
893 | mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; | 897 | mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
894 | } else { | 898 | } else { |
895 | if(dsr & 0x02) /* DSR.IDSTE=1 */ | 899 | if(dsr & 0x02) /* DSR.IDSTE=1 */ |
896 | mode |= V4L2_TUNER_MODE_STEREO; | 900 | mode |= V4L2_TUNER_SUB_STEREO; |
897 | if(dsr & 0x04) /* DSR.IDDUA=1 */ | 901 | if(dsr & 0x04) /* DSR.IDDUA=1 */ |
898 | mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; | 902 | mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
899 | } | 903 | } |
900 | 904 | ||
901 | v4l2_dbg(1, debug, sd, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", | 905 | v4l2_dbg(1, debug, sd, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", |
@@ -1306,11 +1310,11 @@ static int ta8874z_getmode(struct CHIPSTATE *chip) | |||
1306 | int val, mode; | 1310 | int val, mode; |
1307 | 1311 | ||
1308 | val = chip_read(chip); | 1312 | val = chip_read(chip); |
1309 | mode = V4L2_TUNER_MODE_MONO; | 1313 | mode = V4L2_TUNER_SUB_MONO; |
1310 | if (val & TA8874Z_B1){ | 1314 | if (val & TA8874Z_B1){ |
1311 | mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; | 1315 | mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
1312 | }else if (!(val & TA8874Z_B0)){ | 1316 | }else if (!(val & TA8874Z_B0)){ |
1313 | mode |= V4L2_TUNER_MODE_STEREO; | 1317 | mode |= V4L2_TUNER_SUB_STEREO; |
1314 | } | 1318 | } |
1315 | /* v4l_dbg(1, debug, chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ | 1319 | /* v4l_dbg(1, debug, chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ |
1316 | return mode; | 1320 | return mode; |
@@ -1829,7 +1833,6 @@ static int tvaudio_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
1829 | { | 1833 | { |
1830 | struct CHIPSTATE *chip = to_state(sd); | 1834 | struct CHIPSTATE *chip = to_state(sd); |
1831 | struct CHIPDESC *desc = chip->desc; | 1835 | struct CHIPDESC *desc = chip->desc; |
1832 | int mode = V4L2_TUNER_MODE_MONO; | ||
1833 | 1836 | ||
1834 | if (!desc->getmode) | 1837 | if (!desc->getmode) |
1835 | return 0; | 1838 | return 0; |
@@ -1837,22 +1840,10 @@ static int tvaudio_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
1837 | return 0; | 1840 | return 0; |
1838 | 1841 | ||
1839 | vt->audmode = chip->audmode; | 1842 | vt->audmode = chip->audmode; |
1840 | vt->rxsubchans = 0; | 1843 | vt->rxsubchans = desc->getmode(chip); |
1841 | vt->capability = V4L2_TUNER_CAP_STEREO | | 1844 | vt->capability = V4L2_TUNER_CAP_STEREO | |
1842 | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; | 1845 | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; |
1843 | 1846 | ||
1844 | mode = desc->getmode(chip); | ||
1845 | |||
1846 | if (mode & V4L2_TUNER_MODE_MONO) | ||
1847 | vt->rxsubchans |= V4L2_TUNER_SUB_MONO; | ||
1848 | if (mode & V4L2_TUNER_MODE_STEREO) | ||
1849 | vt->rxsubchans |= V4L2_TUNER_SUB_STEREO; | ||
1850 | /* Note: for SAP it should be mono/lang2 or stereo/lang2. | ||
1851 | When this module is converted fully to v4l2, then this | ||
1852 | should change for those chips that can detect SAP. */ | ||
1853 | if (mode & V4L2_TUNER_MODE_LANG1) | ||
1854 | vt->rxsubchans = V4L2_TUNER_SUB_LANG1 | | ||
1855 | V4L2_TUNER_SUB_LANG2; | ||
1856 | return 0; | 1847 | return 0; |
1857 | } | 1848 | } |
1858 | 1849 | ||