aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-04-02 07:21:02 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:57:34 -0400
commit2eb606db1134ce860cc0cbf8b533b6315d182e21 (patch)
tree1b0d026b77bc7d1cb9f3d9f60dd4fb7ac655333f
parent0ead09180a0620eaef761da84259262bfcf21090 (diff)
V4L/DVB (3709): Improve line-in handling
- improve handling of the EXTERN input: don't start an unnecessary carrier scan - improve the LOG_STATUS output - ensure that a carrier scan is started again when switching back to the tuner. - set correct prescale for L-NICAM Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/msp3400-driver.c23
-rw-r--r--drivers/media/video/msp3400-kthreads.c40
2 files changed, 45 insertions, 18 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index b806999d6e0f..5e55f71572f3 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -674,22 +674,31 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
674 int sc1_out = rt->output & 0xf; 674 int sc1_out = rt->output & 0xf;
675 int sc2_out = (rt->output >> 4) & 0xf; 675 int sc2_out = (rt->output >> 4) & 0xf;
676 u16 val, reg; 676 u16 val, reg;
677 int i;
678 int extern_input = 1;
677 679
678 if (state->routing.input == rt->input && 680 if (state->routing.input == rt->input &&
679 state->routing.output == rt->output) 681 state->routing.output == rt->output)
680 break; 682 break;
681 state->routing = *rt; 683 state->routing = *rt;
684 /* check if the tuner input is used */
685 for (i = 0; i < 5; i++) {
686 if (((rt->input >> (4 + i * 4)) & 0xf) == 0)
687 extern_input = 0;
688 }
689 if (extern_input)
690 state->mode = MSP_MODE_EXTERN;
691 else
692 state->mode = MSP_MODE_AM_DETECT;
682 msp_set_scart(client, sc_in, 0); 693 msp_set_scart(client, sc_in, 0);
683 msp_set_scart(client, sc1_out, 1); 694 msp_set_scart(client, sc1_out, 1);
684 msp_set_scart(client, sc2_out, 2); 695 msp_set_scart(client, sc2_out, 2);
685 msp_set_audmode(client); 696 msp_set_audmode(client);
686 reg = (state->opmode == OPMODE_AUTOSELECT) ? 0x30 : 0xbb; 697 reg = (state->opmode == OPMODE_AUTOSELECT) ? 0x30 : 0xbb;
687 val = msp_read_dem(client, reg); 698 val = msp_read_dem(client, reg);
688 if (tuner != ((val >> 8) & 1)) { 699 msp_write_dem(client, reg, (val & ~0x100) | (tuner << 8));
689 msp_write_dem(client, reg, (val & ~0x100) | (tuner << 8)); 700 /* wake thread when a new input is chosen */
690 /* wake thread when a new tuner input is chosen */ 701 msp_wake_thread(client);
691 msp_wake_thread(client);
692 }
693 break; 702 break;
694 } 703 }
695 704
@@ -794,7 +803,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
794 case MSP_MODE_EXTERN: p = "External input"; break; 803 case MSP_MODE_EXTERN: p = "External input"; break;
795 default: p = "unknown"; break; 804 default: p = "unknown"; break;
796 } 805 }
797 if (state->opmode == OPMODE_MANUAL) { 806 if (state->mode == MSP_MODE_EXTERN) {
807 v4l_info(client, "Mode: %s\n", p);
808 } else if (state->opmode == OPMODE_MANUAL) {
798 v4l_info(client, "Mode: %s (%s%s)\n", p, 809 v4l_info(client, "Mode: %s (%s%s)\n", p,
799 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", 810 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
800 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); 811 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index 633a10213789..f2fd9195b3ac 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -244,19 +244,21 @@ static void msp3400c_set_audmode(struct i2c_client *client)
244 the hardware does not support SAP. So the rxsubchans combination 244 the hardware does not support SAP. So the rxsubchans combination
245 of STEREO | LANG2 does not occur. */ 245 of STEREO | LANG2 does not occur. */
246 246
247 /* switch to mono if only mono is available */ 247 if (state->mode != MSP_MODE_EXTERN) {
248 if (state->rxsubchans == V4L2_TUNER_SUB_MONO) 248 /* switch to mono if only mono is available */
249 audmode = V4L2_TUNER_MODE_MONO; 249 if (state->rxsubchans == V4L2_TUNER_SUB_MONO)
250 /* if bilingual */ 250 audmode = V4L2_TUNER_MODE_MONO;
251 else if (state->rxsubchans & V4L2_TUNER_SUB_LANG2) { 251 /* if bilingual */
252 /* and mono or stereo, then fallback to lang1 */ 252 else if (state->rxsubchans & V4L2_TUNER_SUB_LANG2) {
253 if (audmode == V4L2_TUNER_MODE_MONO || 253 /* and mono or stereo, then fallback to lang1 */
254 audmode == V4L2_TUNER_MODE_STEREO) 254 if (audmode == V4L2_TUNER_MODE_MONO ||
255 audmode = V4L2_TUNER_MODE_LANG1; 255 audmode == V4L2_TUNER_MODE_STEREO)
256 audmode = V4L2_TUNER_MODE_LANG1;
257 }
258 /* if stereo, and audmode is not mono, then switch to stereo */
259 else if (audmode != V4L2_TUNER_MODE_MONO)
260 audmode = V4L2_TUNER_MODE_STEREO;
256 } 261 }
257 /* if stereo, and audmode is not mono, then switch to stereo */
258 else if (audmode != V4L2_TUNER_MODE_MONO)
259 audmode = V4L2_TUNER_MODE_STEREO;
260 262
261 /* switch demodulator */ 263 /* switch demodulator */
262 switch (state->mode) { 264 switch (state->mode) {
@@ -481,6 +483,7 @@ int msp3400c_thread(void *data)
481 /* no carrier scan, just unmute */ 483 /* no carrier scan, just unmute */
482 v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); 484 v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
483 state->scan_in_progress = 0; 485 state->scan_in_progress = 0;
486 state->rxsubchans = V4L2_TUNER_SUB_STEREO;
484 msp_set_audio(client); 487 msp_set_audio(client);
485 continue; 488 continue;
486 } 489 }
@@ -947,6 +950,14 @@ int msp34xxg_thread(void *data)
947 if (kthread_should_stop()) 950 if (kthread_should_stop())
948 break; 951 break;
949 952
953 if (state->mode == MSP_MODE_EXTERN) {
954 /* no carrier scan needed, just unmute */
955 v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
956 state->scan_in_progress = 0;
957 msp_set_audio(client);
958 continue;
959 }
960
950 /* setup the chip*/ 961 /* setup the chip*/
951 msp34xxg_reset(client); 962 msp34xxg_reset(client);
952 state->std = state->radio ? 0x40 : msp_standard; 963 state->std = state->radio ? 0x40 : msp_standard;
@@ -978,6 +989,11 @@ int msp34xxg_thread(void *data)
978 v4l_dbg(1, msp_debug, client, "detected standard: %s (0x%04x)\n", 989 v4l_dbg(1, msp_debug, client, "detected standard: %s (0x%04x)\n",
979 msp_standard_std_name(state->std), state->std); 990 msp_standard_std_name(state->std), state->std);
980 991
992 if (state->std == 9) {
993 /* AM NICAM mode */
994 msp_write_dsp(client, 0x0e, 0x7c00);
995 }
996
981 /* unmute: dispatch sound to scart output, set scart volume */ 997 /* unmute: dispatch sound to scart output, set scart volume */
982 msp_set_audio(client); 998 msp_set_audio(client);
983 999