diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-12-12 06:25:18 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:06 -0500 |
commit | d52c7385ec8d4d2081b0db47e309723ce3eae816 (patch) | |
tree | af05ca1d3a625a6cf6ec825b45d5e73e79503775 | |
parent | 35df38c015866b3c28bfb1914b14eba92086cdd1 (diff) |
V4L/DVB (6866): msp3400: CodingStyle cleanups
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.c | 167 | ||||
-rw-r--r-- | drivers/media/video/msp3400-kthreads.c | 166 |
2 files changed, 195 insertions, 138 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index f4c14604b0b..7a11f3159e3 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -42,7 +42,8 @@ | |||
42 | * | 42 | * |
43 | * You should have received a copy of the GNU General Public License | 43 | * You should have received a copy of the GNU General Public License |
44 | * along with this program; if not, write to the Free Software | 44 | * along with this program; if not, write to the Free Software |
45 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 45 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
46 | * 02110-1301, USA. | ||
46 | */ | 47 | */ |
47 | 48 | ||
48 | 49 | ||
@@ -72,7 +73,8 @@ int msp_debug; /* msp_debug output */ | |||
72 | int msp_once; /* no continous stereo monitoring */ | 73 | int msp_once; /* no continous stereo monitoring */ |
73 | int msp_amsound; /* hard-wire AM sound at 6.5 Hz (france), | 74 | int msp_amsound; /* hard-wire AM sound at 6.5 Hz (france), |
74 | the autoscan seems work well only with FM... */ | 75 | the autoscan seems work well only with FM... */ |
75 | int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */ | 76 | int msp_standard = 1; /* Override auto detect of audio msp_standard, |
77 | if needed. */ | ||
76 | int msp_dolby; | 78 | int msp_dolby; |
77 | 79 | ||
78 | int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual | 80 | int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual |
@@ -82,12 +84,12 @@ int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual | |||
82 | module_param(opmode, int, 0444); | 84 | module_param(opmode, int, 0444); |
83 | 85 | ||
84 | /* read-write */ | 86 | /* read-write */ |
85 | module_param_named(once,msp_once, bool, 0644); | 87 | module_param_named(once, msp_once, bool, 0644); |
86 | module_param_named(debug,msp_debug, int, 0644); | 88 | module_param_named(debug, msp_debug, int, 0644); |
87 | module_param_named(stereo_threshold,msp_stereo_thresh, int, 0644); | 89 | module_param_named(stereo_threshold, msp_stereo_thresh, int, 0644); |
88 | module_param_named(standard,msp_standard, int, 0644); | 90 | module_param_named(standard, msp_standard, int, 0644); |
89 | module_param_named(amsound,msp_amsound, bool, 0644); | 91 | module_param_named(amsound, msp_amsound, bool, 0644); |
90 | module_param_named(dolby,msp_dolby, bool, 0644); | 92 | module_param_named(dolby, msp_dolby, bool, 0644); |
91 | 93 | ||
92 | MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect"); | 94 | MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect"); |
93 | MODULE_PARM_DESC(once, "No continuous stereo monitoring"); | 95 | MODULE_PARM_DESC(once, "No continuous stereo monitoring"); |
@@ -161,12 +163,13 @@ static int msp_read(struct i2c_client *client, int dev, int addr) | |||
161 | schedule_timeout_interruptible(msecs_to_jiffies(10)); | 163 | schedule_timeout_interruptible(msecs_to_jiffies(10)); |
162 | } | 164 | } |
163 | if (err == 3) { | 165 | if (err == 3) { |
164 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); | 166 | v4l_warn(client, "resetting chip, sound will go off.\n"); |
165 | msp_reset(client); | 167 | msp_reset(client); |
166 | return -1; | 168 | return -1; |
167 | } | 169 | } |
168 | retval = read[0] << 8 | read[1]; | 170 | retval = read[0] << 8 | read[1]; |
169 | v4l_dbg(3, msp_debug, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval); | 171 | v4l_dbg(3, msp_debug, client, "msp_read(0x%x, 0x%x): 0x%x\n", |
172 | dev, addr, retval); | ||
170 | return retval; | 173 | return retval; |
171 | } | 174 | } |
172 | 175 | ||
@@ -191,7 +194,8 @@ static int msp_write(struct i2c_client *client, int dev, int addr, int val) | |||
191 | buffer[3] = val >> 8; | 194 | buffer[3] = val >> 8; |
192 | buffer[4] = val & 0xff; | 195 | buffer[4] = val & 0xff; |
193 | 196 | ||
194 | v4l_dbg(3, msp_debug, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); | 197 | v4l_dbg(3, msp_debug, client, "msp_write(0x%x, 0x%x, 0x%x)\n", |
198 | dev, addr, val); | ||
195 | for (err = 0; err < 3; err++) { | 199 | for (err = 0; err < 3; err++) { |
196 | if (i2c_master_send(client, buffer, 5) == 5) | 200 | if (i2c_master_send(client, buffer, 5) == 5) |
197 | break; | 201 | break; |
@@ -200,7 +204,7 @@ static int msp_write(struct i2c_client *client, int dev, int addr, int val) | |||
200 | schedule_timeout_interruptible(msecs_to_jiffies(10)); | 204 | schedule_timeout_interruptible(msecs_to_jiffies(10)); |
201 | } | 205 | } |
202 | if (err == 3) { | 206 | if (err == 3) { |
203 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); | 207 | v4l_warn(client, "resetting chip, sound will go off.\n"); |
204 | msp_reset(client); | 208 | msp_reset(client); |
205 | return -1; | 209 | return -1; |
206 | } | 210 | } |
@@ -274,7 +278,7 @@ void msp_set_scart(struct i2c_client *client, int in, int out) | |||
274 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ | 278 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ |
275 | 279 | ||
276 | v4l_dbg(1, msp_debug, client, "scart switch: %s => %d (ACB=0x%04x)\n", | 280 | v4l_dbg(1, msp_debug, client, "scart switch: %s => %d (ACB=0x%04x)\n", |
277 | scart_names[in], out, state->acb); | 281 | scart_names[in], out, state->acb); |
278 | msp_write_dsp(client, 0x13, state->acb); | 282 | msp_write_dsp(client, 0x13, state->acb); |
279 | 283 | ||
280 | /* Sets I2S speed 0 = 1.024 Mbps, 1 = 2.048 Mbps */ | 284 | /* Sets I2S speed 0 = 1.024 Mbps, 1 = 2.048 Mbps */ |
@@ -293,7 +297,8 @@ void msp_set_audio(struct i2c_client *client) | |||
293 | val = (state->volume * 0x7f / 65535) << 8; | 297 | val = (state->volume * 0x7f / 65535) << 8; |
294 | 298 | ||
295 | v4l_dbg(1, msp_debug, client, "mute=%s scanning=%s volume=%d\n", | 299 | v4l_dbg(1, msp_debug, client, "mute=%s scanning=%s volume=%d\n", |
296 | state->muted ? "on" : "off", state->scan_in_progress ? "yes" : "no", | 300 | state->muted ? "on" : "off", |
301 | state->scan_in_progress ? "yes" : "no", | ||
297 | state->volume); | 302 | state->volume); |
298 | 303 | ||
299 | msp_write_dsp(client, 0x0000, val); | 304 | msp_write_dsp(client, 0x0000, val); |
@@ -682,14 +687,14 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
682 | v4l_dbg(1, msp_debug, client, "Setting I2S speed to %d\n", *a); | 687 | v4l_dbg(1, msp_debug, client, "Setting I2S speed to %d\n", *a); |
683 | 688 | ||
684 | switch (*a) { | 689 | switch (*a) { |
685 | case 1024000: | 690 | case 1024000: |
686 | state->i2s_mode = 0; | 691 | state->i2s_mode = 0; |
687 | break; | 692 | break; |
688 | case 2048000: | 693 | case 2048000: |
689 | state->i2s_mode = 1; | 694 | state->i2s_mode = 1; |
690 | break; | 695 | break; |
691 | default: | 696 | default: |
692 | return -EINVAL; | 697 | return -EINVAL; |
693 | } | 698 | } |
694 | break; | 699 | break; |
695 | } | 700 | } |
@@ -699,22 +704,22 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
699 | struct v4l2_queryctrl *qc = arg; | 704 | struct v4l2_queryctrl *qc = arg; |
700 | 705 | ||
701 | switch (qc->id) { | 706 | switch (qc->id) { |
702 | case V4L2_CID_AUDIO_VOLUME: | 707 | case V4L2_CID_AUDIO_VOLUME: |
703 | case V4L2_CID_AUDIO_MUTE: | 708 | case V4L2_CID_AUDIO_MUTE: |
704 | return v4l2_ctrl_query_fill_std(qc); | 709 | return v4l2_ctrl_query_fill_std(qc); |
705 | default: | 710 | default: |
706 | break; | 711 | break; |
707 | } | 712 | } |
708 | if (!state->has_sound_processing) | 713 | if (!state->has_sound_processing) |
709 | return -EINVAL; | 714 | return -EINVAL; |
710 | switch (qc->id) { | 715 | switch (qc->id) { |
711 | case V4L2_CID_AUDIO_LOUDNESS: | 716 | case V4L2_CID_AUDIO_LOUDNESS: |
712 | case V4L2_CID_AUDIO_BALANCE: | 717 | case V4L2_CID_AUDIO_BALANCE: |
713 | case V4L2_CID_AUDIO_BASS: | 718 | case V4L2_CID_AUDIO_BASS: |
714 | case V4L2_CID_AUDIO_TREBLE: | 719 | case V4L2_CID_AUDIO_TREBLE: |
715 | return v4l2_ctrl_query_fill_std(qc); | 720 | return v4l2_ctrl_query_fill_std(qc); |
716 | default: | 721 | default: |
717 | return -EINVAL; | 722 | return -EINVAL; |
718 | } | 723 | } |
719 | } | 724 | } |
720 | 725 | ||
@@ -736,13 +741,14 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
736 | state->volume, state->muted ? " (muted)" : ""); | 741 | state->volume, state->muted ? " (muted)" : ""); |
737 | if (state->has_sound_processing) { | 742 | if (state->has_sound_processing) { |
738 | v4l_info(client, "Audio: balance %d bass %d treble %d loudness %s\n", | 743 | v4l_info(client, "Audio: balance %d bass %d treble %d loudness %s\n", |
739 | state->balance, state->bass, state->treble, | 744 | state->balance, state->bass, |
745 | state->treble, | ||
740 | state->loudness ? "on" : "off"); | 746 | state->loudness ? "on" : "off"); |
741 | } | 747 | } |
742 | switch (state->mode) { | 748 | switch (state->mode) { |
743 | case MSP_MODE_AM_DETECT: p = "AM (for carrier detect)"; break; | 749 | case MSP_MODE_AM_DETECT: p = "AM (for carrier detect)"; break; |
744 | case MSP_MODE_FM_RADIO: p = "FM Radio"; break; | 750 | case MSP_MODE_FM_RADIO: p = "FM Radio"; break; |
745 | case MSP_MODE_FM_TERRA: p = "Terrestial FM-mono + FM-stereo"; break; | 751 | case MSP_MODE_FM_TERRA: p = "Terrestial FM-mono/stereo"; break; |
746 | case MSP_MODE_FM_SAT: p = "Satellite FM-mono"; break; | 752 | case MSP_MODE_FM_SAT: p = "Satellite FM-mono"; break; |
747 | case MSP_MODE_FM_NICAM1: p = "NICAM/FM (B/G, D/K)"; break; | 753 | case MSP_MODE_FM_NICAM1: p = "NICAM/FM (B/G, D/K)"; break; |
748 | case MSP_MODE_FM_NICAM2: p = "NICAM/FM (I)"; break; | 754 | case MSP_MODE_FM_NICAM2: p = "NICAM/FM (I)"; break; |
@@ -773,7 +779,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
773 | } | 779 | } |
774 | 780 | ||
775 | case VIDIOC_G_CHIP_IDENT: | 781 | case VIDIOC_G_CHIP_IDENT: |
776 | return v4l2_chip_ident_i2c_client(client, arg, state->ident, (state->rev1 << 16) | state->rev2); | 782 | return v4l2_chip_ident_i2c_client(client, arg, state->ident, |
783 | (state->rev1 << 16) | state->rev2); | ||
777 | 784 | ||
778 | default: | 785 | default: |
779 | /* unknown */ | 786 | /* unknown */ |
@@ -816,9 +823,8 @@ static int msp_probe(struct i2c_client *client) | |||
816 | } | 823 | } |
817 | 824 | ||
818 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 825 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
819 | if (!state) { | 826 | if (!state) |
820 | return -ENOMEM; | 827 | return -ENOMEM; |
821 | } | ||
822 | 828 | ||
823 | i2c_set_clientdata(client, state); | 829 | i2c_set_clientdata(client, state); |
824 | 830 | ||
@@ -840,9 +846,11 @@ static int msp_probe(struct i2c_client *client) | |||
840 | state->rev1 = msp_read_dsp(client, 0x1e); | 846 | state->rev1 = msp_read_dsp(client, 0x1e); |
841 | if (state->rev1 != -1) | 847 | if (state->rev1 != -1) |
842 | state->rev2 = msp_read_dsp(client, 0x1f); | 848 | state->rev2 = msp_read_dsp(client, 0x1f); |
843 | v4l_dbg(1, msp_debug, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2); | 849 | v4l_dbg(1, msp_debug, client, "rev1=0x%04x, rev2=0x%04x\n", |
850 | state->rev1, state->rev2); | ||
844 | if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { | 851 | if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { |
845 | v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); | 852 | v4l_dbg(1, msp_debug, client, |
853 | "not an msp3400 (cannot read chip version)\n"); | ||
846 | kfree(state); | 854 | kfree(state); |
847 | return -ENODEV; | 855 | return -ENODEV; |
848 | } | 856 | } |
@@ -860,37 +868,55 @@ static int msp_probe(struct i2c_client *client) | |||
860 | msp_family, msp_product, | 868 | msp_family, msp_product, |
861 | msp_revision, msp_hard, msp_rom); | 869 | msp_revision, msp_hard, msp_rom); |
862 | /* Rev B=2, C=3, D=4, G=7 */ | 870 | /* Rev B=2, C=3, D=4, G=7 */ |
863 | state->ident = msp_family * 10000 + 4000 + msp_product * 10 + msp_revision - '@'; | 871 | state->ident = msp_family * 10000 + 4000 + msp_product * 10 + |
872 | msp_revision - '@'; | ||
864 | 873 | ||
865 | /* Has NICAM support: all mspx41x and mspx45x products have NICAM */ | 874 | /* Has NICAM support: all mspx41x and mspx45x products have NICAM */ |
866 | state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5; | 875 | state->has_nicam = |
876 | msp_prod_hi == 1 || msp_prod_hi == 5; | ||
867 | /* Has radio support: was added with revision G */ | 877 | /* Has radio support: was added with revision G */ |
868 | state->has_radio = msp_revision >= 'G'; | 878 | state->has_radio = |
879 | msp_revision >= 'G'; | ||
869 | /* Has headphones output: not for stripped down products */ | 880 | /* Has headphones output: not for stripped down products */ |
870 | state->has_headphones = msp_prod_lo < 5; | 881 | state->has_headphones = |
882 | msp_prod_lo < 5; | ||
871 | /* Has scart2 input: not in stripped down products of the '3' family */ | 883 | /* Has scart2 input: not in stripped down products of the '3' family */ |
872 | state->has_scart2 = msp_family >= 4 || msp_prod_lo < 7; | 884 | state->has_scart2 = |
885 | msp_family >= 4 || msp_prod_lo < 7; | ||
873 | /* Has scart3 input: not in stripped down products of the '3' family */ | 886 | /* Has scart3 input: not in stripped down products of the '3' family */ |
874 | state->has_scart3 = msp_family >= 4 || msp_prod_lo < 5; | 887 | state->has_scart3 = |
888 | msp_family >= 4 || msp_prod_lo < 5; | ||
875 | /* Has scart4 input: not in pre D revisions, not in stripped D revs */ | 889 | /* Has scart4 input: not in pre D revisions, not in stripped D revs */ |
876 | state->has_scart4 = msp_family >= 4 || (msp_revision >= 'D' && msp_prod_lo < 5); | 890 | state->has_scart4 = |
877 | /* Has scart2 output: not in stripped down products of the '3' family */ | 891 | msp_family >= 4 || (msp_revision >= 'D' && msp_prod_lo < 5); |
878 | state->has_scart2_out = msp_family >= 4 || msp_prod_lo < 5; | 892 | /* Has scart2 output: not in stripped down products of |
893 | * the '3' family */ | ||
894 | state->has_scart2_out = | ||
895 | msp_family >= 4 || msp_prod_lo < 5; | ||
879 | /* Has scart2 a volume control? Not in pre-D revisions. */ | 896 | /* Has scart2 a volume control? Not in pre-D revisions. */ |
880 | state->has_scart2_out_volume = msp_revision > 'C' && state->has_scart2_out; | 897 | state->has_scart2_out_volume = |
898 | msp_revision > 'C' && state->has_scart2_out; | ||
881 | /* Has a configurable i2s out? */ | 899 | /* Has a configurable i2s out? */ |
882 | state->has_i2s_conf = msp_revision >= 'G' && msp_prod_lo < 7; | 900 | state->has_i2s_conf = |
883 | /* Has subwoofer output: not in pre-D revs and not in stripped down products */ | 901 | msp_revision >= 'G' && msp_prod_lo < 7; |
884 | state->has_subwoofer = msp_revision >= 'D' && msp_prod_lo < 5; | 902 | /* Has subwoofer output: not in pre-D revs and not in stripped down |
885 | /* Has soundprocessing (bass/treble/balance/loudness/equalizer): not in | 903 | * products */ |
886 | stripped down products */ | 904 | state->has_subwoofer = |
887 | state->has_sound_processing = msp_prod_lo < 7; | 905 | msp_revision >= 'D' && msp_prod_lo < 5; |
906 | /* Has soundprocessing (bass/treble/balance/loudness/equalizer): | ||
907 | * not in stripped down products */ | ||
908 | state->has_sound_processing = | ||
909 | msp_prod_lo < 7; | ||
888 | /* Has Virtual Dolby Surround: only in msp34x1 */ | 910 | /* Has Virtual Dolby Surround: only in msp34x1 */ |
889 | state->has_virtual_dolby_surround = msp_revision == 'G' && msp_prod_lo == 1; | 911 | state->has_virtual_dolby_surround = |
912 | msp_revision == 'G' && msp_prod_lo == 1; | ||
890 | /* Has Virtual Dolby Surround & Dolby Pro Logic: only in msp34x2 */ | 913 | /* Has Virtual Dolby Surround & Dolby Pro Logic: only in msp34x2 */ |
891 | state->has_dolby_pro_logic = msp_revision == 'G' && msp_prod_lo == 2; | 914 | state->has_dolby_pro_logic = |
892 | /* The msp343xG supports BTSC only and cannot do Automatic Standard Detection. */ | 915 | msp_revision == 'G' && msp_prod_lo == 2; |
893 | state->force_btsc = msp_family == 3 && msp_revision == 'G' && msp_prod_hi == 3; | 916 | /* The msp343xG supports BTSC only and cannot do Automatic Standard |
917 | * Detection. */ | ||
918 | state->force_btsc = | ||
919 | msp_family == 3 && msp_revision == 'G' && msp_prod_hi == 3; | ||
894 | 920 | ||
895 | state->opmode = opmode; | 921 | state->opmode = opmode; |
896 | if (state->opmode == OPMODE_AUTO) { | 922 | if (state->opmode == OPMODE_AUTO) { |
@@ -905,32 +931,33 @@ static int msp_probe(struct i2c_client *client) | |||
905 | } | 931 | } |
906 | 932 | ||
907 | /* hello world :-) */ | 933 | /* hello world :-) */ |
908 | v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, client->addr << 1, client->adapter->name); | 934 | v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, |
935 | client->addr << 1, client->adapter->name); | ||
909 | v4l_info(client, "%s ", client->name); | 936 | v4l_info(client, "%s ", client->name); |
910 | if (state->has_nicam && state->has_radio) | 937 | if (state->has_nicam && state->has_radio) |
911 | printk("supports nicam and radio, "); | 938 | printk(KERN_CONT "supports nicam and radio, "); |
912 | else if (state->has_nicam) | 939 | else if (state->has_nicam) |
913 | printk("supports nicam, "); | 940 | printk(KERN_CONT "supports nicam, "); |
914 | else if (state->has_radio) | 941 | else if (state->has_radio) |
915 | printk("supports radio, "); | 942 | printk(KERN_CONT "supports radio, "); |
916 | printk("mode is "); | 943 | printk(KERN_CONT "mode is "); |
917 | 944 | ||
918 | /* version-specific initialization */ | 945 | /* version-specific initialization */ |
919 | switch (state->opmode) { | 946 | switch (state->opmode) { |
920 | case OPMODE_MANUAL: | 947 | case OPMODE_MANUAL: |
921 | printk("manual"); | 948 | printk(KERN_CONT "manual"); |
922 | thread_func = msp3400c_thread; | 949 | thread_func = msp3400c_thread; |
923 | break; | 950 | break; |
924 | case OPMODE_AUTODETECT: | 951 | case OPMODE_AUTODETECT: |
925 | printk("autodetect"); | 952 | printk(KERN_CONT "autodetect"); |
926 | thread_func = msp3410d_thread; | 953 | thread_func = msp3410d_thread; |
927 | break; | 954 | break; |
928 | case OPMODE_AUTOSELECT: | 955 | case OPMODE_AUTOSELECT: |
929 | printk("autodetect and autoselect"); | 956 | printk(KERN_CONT "autodetect and autoselect"); |
930 | thread_func = msp34xxg_thread; | 957 | thread_func = msp34xxg_thread; |
931 | break; | 958 | break; |
932 | } | 959 | } |
933 | printk("\n"); | 960 | printk(KERN_CONT "\n"); |
934 | 961 | ||
935 | /* startup control thread if needed */ | 962 | /* startup control thread if needed */ |
936 | if (thread_func) { | 963 | if (thread_func) { |
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index d5ee2629121..61ec794a737 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c | |||
@@ -15,7 +15,8 @@ | |||
15 | * | 15 | * |
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | * 02110-1301, USA. | ||
19 | */ | 20 | */ |
20 | 21 | ||
21 | 22 | ||
@@ -78,37 +79,37 @@ static struct msp3400c_init_data_dem { | |||
78 | {75, 19, 36, 35, 39, 40}, | 79 | {75, 19, 36, 35, 39, 40}, |
79 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), | 80 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), |
80 | 0x00d0, 0x0500, 0x0020, 0x3000 | 81 | 0x00d0, 0x0500, 0x0020, 0x3000 |
81 | },{ /* AM (for carrier detect / msp3410) */ | 82 | }, { /* AM (for carrier detect / msp3410) */ |
82 | {-1, -1, -8, 2, 59, 126}, | 83 | {-1, -1, -8, 2, 59, 126}, |
83 | {-1, -1, -8, 2, 59, 126}, | 84 | {-1, -1, -8, 2, 59, 126}, |
84 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), | 85 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), |
85 | 0x00d0, 0x0100, 0x0020, 0x3000 | 86 | 0x00d0, 0x0100, 0x0020, 0x3000 |
86 | },{ /* FM Radio */ | 87 | }, { /* FM Radio */ |
87 | {-8, -8, 4, 6, 78, 107}, | 88 | {-8, -8, 4, 6, 78, 107}, |
88 | {-8, -8, 4, 6, 78, 107}, | 89 | {-8, -8, 4, 6, 78, 107}, |
89 | MSP_CARRIER(10.7), MSP_CARRIER(10.7), | 90 | MSP_CARRIER(10.7), MSP_CARRIER(10.7), |
90 | 0x00d0, 0x0480, 0x0020, 0x3000 | 91 | 0x00d0, 0x0480, 0x0020, 0x3000 |
91 | },{ /* Terrestial FM-mono + FM-stereo */ | 92 | }, { /* Terrestial FM-mono + FM-stereo */ |
92 | {3, 18, 27, 48, 66, 72}, | 93 | {3, 18, 27, 48, 66, 72}, |
93 | {3, 18, 27, 48, 66, 72}, | 94 | {3, 18, 27, 48, 66, 72}, |
94 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), | 95 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), |
95 | 0x00d0, 0x0480, 0x0030, 0x3000 | 96 | 0x00d0, 0x0480, 0x0030, 0x3000 |
96 | },{ /* Sat FM-mono */ | 97 | }, { /* Sat FM-mono */ |
97 | { 1, 9, 14, 24, 33, 37}, | 98 | { 1, 9, 14, 24, 33, 37}, |
98 | { 3, 18, 27, 48, 66, 72}, | 99 | { 3, 18, 27, 48, 66, 72}, |
99 | MSP_CARRIER(6.5), MSP_CARRIER(6.5), | 100 | MSP_CARRIER(6.5), MSP_CARRIER(6.5), |
100 | 0x00c6, 0x0480, 0x0000, 0x3000 | 101 | 0x00c6, 0x0480, 0x0000, 0x3000 |
101 | },{ /* NICAM/FM -- B/G (5.5/5.85), D/K (6.5/5.85) */ | 102 | }, { /* NICAM/FM -- B/G (5.5/5.85), D/K (6.5/5.85) */ |
102 | {-2, -8, -10, 10, 50, 86}, | 103 | {-2, -8, -10, 10, 50, 86}, |
103 | {3, 18, 27, 48, 66, 72}, | 104 | {3, 18, 27, 48, 66, 72}, |
104 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), | 105 | MSP_CARRIER(5.5), MSP_CARRIER(5.5), |
105 | 0x00d0, 0x0040, 0x0120, 0x3000 | 106 | 0x00d0, 0x0040, 0x0120, 0x3000 |
106 | },{ /* NICAM/FM -- I (6.0/6.552) */ | 107 | }, { /* NICAM/FM -- I (6.0/6.552) */ |
107 | {2, 4, -6, -4, 40, 94}, | 108 | {2, 4, -6, -4, 40, 94}, |
108 | {3, 18, 27, 48, 66, 72}, | 109 | {3, 18, 27, 48, 66, 72}, |
109 | MSP_CARRIER(6.0), MSP_CARRIER(6.0), | 110 | MSP_CARRIER(6.0), MSP_CARRIER(6.0), |
110 | 0x00d0, 0x0040, 0x0120, 0x3000 | 111 | 0x00d0, 0x0040, 0x0120, 0x3000 |
111 | },{ /* NICAM/AM -- L (6.5/5.85) */ | 112 | }, { /* NICAM/AM -- L (6.5/5.85) */ |
112 | {-2, -8, -10, 10, 50, 86}, | 113 | {-2, -8, -10, 10, 50, 86}, |
113 | {-4, -12, -9, 23, 79, 126}, | 114 | {-4, -12, -9, 23, 79, 126}, |
114 | MSP_CARRIER(6.5), MSP_CARRIER(6.5), | 115 | MSP_CARRIER(6.5), MSP_CARRIER(6.5), |
@@ -224,7 +225,9 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) | |||
224 | nor do they support stereo BTSC. */ | 225 | nor do they support stereo BTSC. */ |
225 | static void msp3400c_set_audmode(struct i2c_client *client) | 226 | static void msp3400c_set_audmode(struct i2c_client *client) |
226 | { | 227 | { |
227 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1", "lang1+lang2" }; | 228 | static char *strmode[] = { |
229 | "mono", "stereo", "lang2", "lang1", "lang1+lang2" | ||
230 | }; | ||
228 | struct msp_state *state = i2c_get_clientdata(client); | 231 | struct msp_state *state = i2c_get_clientdata(client); |
229 | char *modestr = (state->audmode >= 0 && state->audmode < 5) ? | 232 | char *modestr = (state->audmode >= 0 && state->audmode < 5) ? |
230 | strmode[state->audmode] : "unknown"; | 233 | strmode[state->audmode] : "unknown"; |
@@ -298,19 +301,23 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
298 | case MSP_MODE_FM_NICAM1: | 301 | case MSP_MODE_FM_NICAM1: |
299 | case MSP_MODE_FM_NICAM2: | 302 | case MSP_MODE_FM_NICAM2: |
300 | case MSP_MODE_AM_NICAM: | 303 | case MSP_MODE_AM_NICAM: |
301 | v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr); | 304 | v4l_dbg(1, msp_debug, client, |
305 | "NICAM set_audmode: %s\n", modestr); | ||
302 | if (state->nicam_on) | 306 | if (state->nicam_on) |
303 | src = 0x0100; /* NICAM */ | 307 | src = 0x0100; /* NICAM */ |
304 | break; | 308 | break; |
305 | case MSP_MODE_BTSC: | 309 | case MSP_MODE_BTSC: |
306 | v4l_dbg(1, msp_debug, client, "BTSC set_audmode: %s\n",modestr); | 310 | v4l_dbg(1, msp_debug, client, |
311 | "BTSC set_audmode: %s\n", modestr); | ||
307 | break; | 312 | break; |
308 | case MSP_MODE_EXTERN: | 313 | case MSP_MODE_EXTERN: |
309 | v4l_dbg(1, msp_debug, client, "extern set_audmode: %s\n",modestr); | 314 | v4l_dbg(1, msp_debug, client, |
315 | "extern set_audmode: %s\n", modestr); | ||
310 | src = 0x0200; /* SCART */ | 316 | src = 0x0200; /* SCART */ |
311 | break; | 317 | break; |
312 | case MSP_MODE_FM_RADIO: | 318 | case MSP_MODE_FM_RADIO: |
313 | v4l_dbg(1, msp_debug, client, "FM-Radio set_audmode: %s\n",modestr); | 319 | v4l_dbg(1, msp_debug, client, |
320 | "FM-Radio set_audmode: %s\n", modestr); | ||
314 | break; | 321 | break; |
315 | default: | 322 | default: |
316 | v4l_dbg(1, msp_debug, client, "mono set_audmode\n"); | 323 | v4l_dbg(1, msp_debug, client, "mono set_audmode\n"); |
@@ -342,7 +349,8 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
342 | src |= 0x0010; | 349 | src |= 0x0010; |
343 | break; | 350 | break; |
344 | } | 351 | } |
345 | v4l_dbg(1, msp_debug, client, "set_audmode final source/matrix = 0x%x\n", src); | 352 | v4l_dbg(1, msp_debug, client, |
353 | "set_audmode final source/matrix = 0x%x\n", src); | ||
346 | 354 | ||
347 | msp_set_source(client, src); | 355 | msp_set_source(client, src); |
348 | } | 356 | } |
@@ -351,22 +359,26 @@ static void msp3400c_print_mode(struct i2c_client *client) | |||
351 | { | 359 | { |
352 | struct msp_state *state = i2c_get_clientdata(client); | 360 | struct msp_state *state = i2c_get_clientdata(client); |
353 | 361 | ||
354 | if (state->main == state->second) { | 362 | if (state->main == state->second) |
355 | v4l_dbg(1, msp_debug, client, "mono sound carrier: %d.%03d MHz\n", | 363 | v4l_dbg(1, msp_debug, client, |
356 | state->main / 910000, (state->main / 910) % 1000); | 364 | "mono sound carrier: %d.%03d MHz\n", |
357 | } else { | 365 | state->main / 910000, (state->main / 910) % 1000); |
358 | v4l_dbg(1, msp_debug, client, "main sound carrier: %d.%03d MHz\n", | 366 | else |
359 | state->main / 910000, (state->main / 910) % 1000); | 367 | v4l_dbg(1, msp_debug, client, |
360 | } | 368 | "main sound carrier: %d.%03d MHz\n", |
369 | state->main / 910000, (state->main / 910) % 1000); | ||
361 | if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2) | 370 | if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2) |
362 | v4l_dbg(1, msp_debug, client, "NICAM/FM carrier : %d.%03d MHz\n", | 371 | v4l_dbg(1, msp_debug, client, |
363 | state->second / 910000, (state->second/910) % 1000); | 372 | "NICAM/FM carrier : %d.%03d MHz\n", |
373 | state->second / 910000, (state->second/910) % 1000); | ||
364 | if (state->mode == MSP_MODE_AM_NICAM) | 374 | if (state->mode == MSP_MODE_AM_NICAM) |
365 | v4l_dbg(1, msp_debug, client, "NICAM/AM carrier : %d.%03d MHz\n", | 375 | v4l_dbg(1, msp_debug, client, |
366 | state->second / 910000, (state->second / 910) % 1000); | 376 | "NICAM/AM carrier : %d.%03d MHz\n", |
377 | state->second / 910000, (state->second / 910) % 1000); | ||
367 | if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) { | 378 | if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) { |
368 | v4l_dbg(1, msp_debug, client, "FM-stereo carrier : %d.%03d MHz\n", | 379 | v4l_dbg(1, msp_debug, client, |
369 | state->second / 910000, (state->second / 910) % 1000); | 380 | "FM-stereo carrier : %d.%03d MHz\n", |
381 | state->second / 910000, (state->second / 910) % 1000); | ||
370 | } | 382 | } |
371 | } | 383 | } |
372 | 384 | ||
@@ -385,7 +397,8 @@ static int msp3400c_detect_stereo(struct i2c_client *client) | |||
385 | val = msp_read_dsp(client, 0x18); | 397 | val = msp_read_dsp(client, 0x18); |
386 | if (val > 32767) | 398 | if (val > 32767) |
387 | val -= 65536; | 399 | val -= 65536; |
388 | v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val); | 400 | v4l_dbg(2, msp_debug, client, |
401 | "stereo detect register: %d\n", val); | ||
389 | if (val > 8192) { | 402 | if (val > 8192) { |
390 | rxsubchans = V4L2_TUNER_SUB_STEREO; | 403 | rxsubchans = V4L2_TUNER_SUB_STEREO; |
391 | } else if (val < -4096) { | 404 | } else if (val < -4096) { |
@@ -430,7 +443,8 @@ static int msp3400c_detect_stereo(struct i2c_client *client) | |||
430 | } | 443 | } |
431 | if (rxsubchans != state->rxsubchans) { | 444 | if (rxsubchans != state->rxsubchans) { |
432 | update = 1; | 445 | update = 1; |
433 | v4l_dbg(1, msp_debug, client, "watch: rxsubchans %02x => %02x\n", | 446 | v4l_dbg(1, msp_debug, client, |
447 | "watch: rxsubchans %02x => %02x\n", | ||
434 | state->rxsubchans, rxsubchans); | 448 | state->rxsubchans, rxsubchans); |
435 | state->rxsubchans = rxsubchans; | 449 | state->rxsubchans = rxsubchans; |
436 | } | 450 | } |
@@ -452,9 +466,8 @@ static void watch_stereo(struct i2c_client *client) | |||
452 | { | 466 | { |
453 | struct msp_state *state = i2c_get_clientdata(client); | 467 | struct msp_state *state = i2c_get_clientdata(client); |
454 | 468 | ||
455 | if (msp_detect_stereo(client)) { | 469 | if (msp_detect_stereo(client)) |
456 | msp_set_audmode(client); | 470 | msp_set_audmode(client); |
457 | } | ||
458 | 471 | ||
459 | if (msp_once) | 472 | if (msp_once) |
460 | state->watch_stereo = 0; | 473 | state->watch_stereo = 0; |
@@ -465,7 +478,7 @@ int msp3400c_thread(void *data) | |||
465 | struct i2c_client *client = data; | 478 | struct i2c_client *client = data; |
466 | struct msp_state *state = i2c_get_clientdata(client); | 479 | struct msp_state *state = i2c_get_clientdata(client); |
467 | struct msp3400c_carrier_detect *cd; | 480 | struct msp3400c_carrier_detect *cd; |
468 | int count, max1, max2, val1, val2, val, this; | 481 | int count, max1, max2, val1, val2, val, i; |
469 | 482 | ||
470 | 483 | ||
471 | v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n"); | 484 | v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n"); |
@@ -475,7 +488,7 @@ int msp3400c_thread(void *data) | |||
475 | msp_sleep(state, -1); | 488 | msp_sleep(state, -1); |
476 | v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n"); | 489 | v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n"); |
477 | 490 | ||
478 | restart: | 491 | restart: |
479 | v4l_dbg(2, msp_debug, client, "thread: restart scan\n"); | 492 | v4l_dbg(2, msp_debug, client, "thread: restart scan\n"); |
480 | state->restart = 0; | 493 | state->restart = 0; |
481 | if (kthread_should_stop()) | 494 | if (kthread_should_stop()) |
@@ -483,7 +496,8 @@ int msp3400c_thread(void *data) | |||
483 | 496 | ||
484 | if (state->radio || MSP_MODE_EXTERN == state->mode) { | 497 | if (state->radio || MSP_MODE_EXTERN == state->mode) { |
485 | /* no carrier scan, just unmute */ | 498 | /* no carrier scan, just unmute */ |
486 | v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); | 499 | v4l_dbg(1, msp_debug, client, |
500 | "thread: no carrier scan\n"); | ||
487 | state->scan_in_progress = 0; | 501 | state->scan_in_progress = 0; |
488 | msp_set_audio(client); | 502 | msp_set_audio(client); |
489 | continue; | 503 | continue; |
@@ -514,16 +528,17 @@ int msp3400c_thread(void *data) | |||
514 | v4l_dbg(1, msp_debug, client, "AM sound override\n"); | 528 | v4l_dbg(1, msp_debug, client, "AM sound override\n"); |
515 | } | 529 | } |
516 | 530 | ||
517 | for (this = 0; this < count; this++) { | 531 | for (i = 0; i < count; i++) { |
518 | msp3400c_set_carrier(client, cd[this].cdo, cd[this].cdo); | 532 | msp3400c_set_carrier(client, cd[i].cdo, cd[i].cdo); |
519 | if (msp_sleep(state,100)) | 533 | if (msp_sleep(state, 100)) |
520 | goto restart; | 534 | goto restart; |
521 | val = msp_read_dsp(client, 0x1b); | 535 | val = msp_read_dsp(client, 0x1b); |
522 | if (val > 32767) | 536 | if (val > 32767) |
523 | val -= 65536; | 537 | val -= 65536; |
524 | if (val1 < val) | 538 | if (val1 < val) |
525 | val1 = val, max1 = this; | 539 | val1 = val, max1 = i; |
526 | v4l_dbg(1, msp_debug, client, "carrier1 val: %5d / %s\n", val,cd[this].name); | 540 | v4l_dbg(1, msp_debug, client, |
541 | "carrier1 val: %5d / %s\n", val, cd[i].name); | ||
527 | } | 542 | } |
528 | 543 | ||
529 | /* carrier detect pass #2 -- second (stereo) carrier */ | 544 | /* carrier detect pass #2 -- second (stereo) carrier */ |
@@ -550,16 +565,17 @@ int msp3400c_thread(void *data) | |||
550 | count = 0; | 565 | count = 0; |
551 | max2 = 0; | 566 | max2 = 0; |
552 | } | 567 | } |
553 | for (this = 0; this < count; this++) { | 568 | for (i = 0; i < count; i++) { |
554 | msp3400c_set_carrier(client, cd[this].cdo, cd[this].cdo); | 569 | msp3400c_set_carrier(client, cd[i].cdo, cd[i].cdo); |
555 | if (msp_sleep(state,100)) | 570 | if (msp_sleep(state, 100)) |
556 | goto restart; | 571 | goto restart; |
557 | val = msp_read_dsp(client, 0x1b); | 572 | val = msp_read_dsp(client, 0x1b); |
558 | if (val > 32767) | 573 | if (val > 32767) |
559 | val -= 65536; | 574 | val -= 65536; |
560 | if (val2 < val) | 575 | if (val2 < val) |
561 | val2 = val, max2 = this; | 576 | val2 = val, max2 = i; |
562 | v4l_dbg(1, msp_debug, client, "carrier2 val: %5d / %s\n", val,cd[this].name); | 577 | v4l_dbg(1, msp_debug, client, |
578 | "carrier2 val: %5d / %s\n", val, cd[i].name); | ||
563 | } | 579 | } |
564 | 580 | ||
565 | /* program the msp3400 according to the results */ | 581 | /* program the msp3400 according to the results */ |
@@ -611,7 +627,7 @@ int msp3400c_thread(void *data) | |||
611 | break; | 627 | break; |
612 | case 0: /* 4.5 */ | 628 | case 0: /* 4.5 */ |
613 | default: | 629 | default: |
614 | no_second: | 630 | no_second: |
615 | state->second = msp3400c_carrier_detect_main[max1].cdo; | 631 | state->second = msp3400c_carrier_detect_main[max1].cdo; |
616 | msp3400c_set_mode(client, MSP_MODE_FM_TERRA); | 632 | msp3400c_set_mode(client, MSP_MODE_FM_TERRA); |
617 | break; | 633 | break; |
@@ -632,7 +648,8 @@ int msp3400c_thread(void *data) | |||
632 | while (state->watch_stereo) { | 648 | while (state->watch_stereo) { |
633 | if (msp_sleep(state, count ? 1000 : 5000)) | 649 | if (msp_sleep(state, count ? 1000 : 5000)) |
634 | goto restart; | 650 | goto restart; |
635 | if (count) count--; | 651 | if (count) |
652 | count--; | ||
636 | watch_stereo(client); | 653 | watch_stereo(client); |
637 | } | 654 | } |
638 | } | 655 | } |
@@ -651,10 +668,10 @@ int msp3410d_thread(void *data) | |||
651 | set_freezable(); | 668 | set_freezable(); |
652 | for (;;) { | 669 | for (;;) { |
653 | v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n"); | 670 | v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n"); |
654 | msp_sleep(state,-1); | 671 | msp_sleep(state, -1); |
655 | v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n"); | 672 | v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n"); |
656 | 673 | ||
657 | restart: | 674 | restart: |
658 | v4l_dbg(2, msp_debug, client, "thread: restart scan\n"); | 675 | v4l_dbg(2, msp_debug, client, "thread: restart scan\n"); |
659 | state->restart = 0; | 676 | state->restart = 0; |
660 | if (kthread_should_stop()) | 677 | if (kthread_should_stop()) |
@@ -662,7 +679,8 @@ int msp3410d_thread(void *data) | |||
662 | 679 | ||
663 | if (state->mode == MSP_MODE_EXTERN) { | 680 | if (state->mode == MSP_MODE_EXTERN) { |
664 | /* no carrier scan needed, just unmute */ | 681 | /* no carrier scan needed, just unmute */ |
665 | v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); | 682 | v4l_dbg(1, msp_debug, client, |
683 | "thread: no carrier scan\n"); | ||
666 | state->scan_in_progress = 0; | 684 | state->scan_in_progress = 0; |
667 | msp_set_audio(client); | 685 | msp_set_audio(client); |
668 | continue; | 686 | continue; |
@@ -673,7 +691,8 @@ int msp3410d_thread(void *data) | |||
673 | msp_set_audio(client); | 691 | msp_set_audio(client); |
674 | 692 | ||
675 | /* start autodetect. Note: autodetect is not supported for | 693 | /* start autodetect. Note: autodetect is not supported for |
676 | NTSC-M and radio, hence we force the standard in those cases. */ | 694 | NTSC-M and radio, hence we force the standard in those |
695 | cases. */ | ||
677 | if (state->radio) | 696 | if (state->radio) |
678 | std = 0x40; | 697 | std = 0x40; |
679 | else | 698 | else |
@@ -686,8 +705,9 @@ int msp3410d_thread(void *data) | |||
686 | goto restart; | 705 | goto restart; |
687 | 706 | ||
688 | if (msp_debug) | 707 | if (msp_debug) |
689 | v4l_dbg(2, msp_debug, client, "setting standard: %s (0x%04x)\n", | 708 | v4l_dbg(2, msp_debug, client, |
690 | msp_standard_std_name(std), std); | 709 | "setting standard: %s (0x%04x)\n", |
710 | msp_standard_std_name(std), std); | ||
691 | 711 | ||
692 | if (std != 1) { | 712 | if (std != 1) { |
693 | /* programmed some specific mode */ | 713 | /* programmed some specific mode */ |
@@ -703,7 +723,8 @@ int msp3410d_thread(void *data) | |||
703 | val = msp_read_dem(client, 0x7e); | 723 | val = msp_read_dem(client, 0x7e); |
704 | if (val < 0x07ff) | 724 | if (val < 0x07ff) |
705 | break; | 725 | break; |
706 | v4l_dbg(2, msp_debug, client, "detection still in progress\n"); | 726 | v4l_dbg(2, msp_debug, client, |
727 | "detection still in progress\n"); | ||
707 | } | 728 | } |
708 | } | 729 | } |
709 | for (i = 0; msp_stdlist[i].name != NULL; i++) | 730 | for (i = 0; msp_stdlist[i].name != NULL; i++) |
@@ -716,12 +737,13 @@ int msp3410d_thread(void *data) | |||
716 | state->std = val; | 737 | state->std = val; |
717 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 738 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
718 | 739 | ||
719 | if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) && | 740 | if (msp_amsound && !state->radio && |
720 | (val != 0x0009)) { | 741 | (state->v4l2_std & V4L2_STD_SECAM) && (val != 0x0009)) { |
721 | /* autodetection has failed, let backup */ | 742 | /* autodetection has failed, let backup */ |
722 | v4l_dbg(1, msp_debug, client, "autodetection failed," | 743 | v4l_dbg(1, msp_debug, client, "autodetection failed," |
723 | " switching to backup standard: %s (0x%04x)\n", | 744 | " switching to backup standard: %s (0x%04x)\n", |
724 | msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); | 745 | msp_stdlist[8].name ? |
746 | msp_stdlist[8].name : "unknown", val); | ||
725 | state->std = val = 0x0009; | 747 | state->std = val = 0x0009; |
726 | msp_write_dem(client, 0x20, val); | 748 | msp_write_dem(client, 0x20, val); |
727 | } | 749 | } |
@@ -786,7 +808,8 @@ int msp3410d_thread(void *data) | |||
786 | while (state->watch_stereo) { | 808 | while (state->watch_stereo) { |
787 | if (msp_sleep(state, count ? 1000 : 5000)) | 809 | if (msp_sleep(state, count ? 1000 : 5000)) |
788 | goto restart; | 810 | goto restart; |
789 | if (count) count--; | 811 | if (count) |
812 | count--; | ||
790 | watch_stereo(client); | 813 | watch_stereo(client); |
791 | } | 814 | } |
792 | } | 815 | } |
@@ -872,8 +895,8 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in) | |||
872 | else | 895 | else |
873 | source = (in << 8) | matrix; | 896 | source = (in << 8) | matrix; |
874 | 897 | ||
875 | v4l_dbg(1, msp_debug, client, "set source to %d (0x%x) for output %02x\n", | 898 | v4l_dbg(1, msp_debug, client, |
876 | in, source, reg); | 899 | "set source to %d (0x%x) for output %02x\n", in, source, reg); |
877 | msp_write_dsp(client, reg, source); | 900 | msp_write_dsp(client, reg, source); |
878 | } | 901 | } |
879 | 902 | ||
@@ -948,7 +971,7 @@ int msp34xxg_thread(void *data) | |||
948 | msp_sleep(state, -1); | 971 | msp_sleep(state, -1); |
949 | v4l_dbg(2, msp_debug, client, "msp34xxg thread: wakeup\n"); | 972 | v4l_dbg(2, msp_debug, client, "msp34xxg thread: wakeup\n"); |
950 | 973 | ||
951 | restart: | 974 | restart: |
952 | v4l_dbg(1, msp_debug, client, "thread: restart scan\n"); | 975 | v4l_dbg(1, msp_debug, client, "thread: restart scan\n"); |
953 | state->restart = 0; | 976 | state->restart = 0; |
954 | if (kthread_should_stop()) | 977 | if (kthread_should_stop()) |
@@ -956,7 +979,8 @@ int msp34xxg_thread(void *data) | |||
956 | 979 | ||
957 | if (state->mode == MSP_MODE_EXTERN) { | 980 | if (state->mode == MSP_MODE_EXTERN) { |
958 | /* no carrier scan needed, just unmute */ | 981 | /* no carrier scan needed, just unmute */ |
959 | v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); | 982 | v4l_dbg(1, msp_debug, client, |
983 | "thread: no carrier scan\n"); | ||
960 | state->scan_in_progress = 0; | 984 | state->scan_in_progress = 0; |
961 | msp_set_audio(client); | 985 | msp_set_audio(client); |
962 | continue; | 986 | continue; |
@@ -972,7 +996,8 @@ int msp34xxg_thread(void *data) | |||
972 | goto unmute; | 996 | goto unmute; |
973 | 997 | ||
974 | /* watch autodetect */ | 998 | /* watch autodetect */ |
975 | v4l_dbg(1, msp_debug, client, "started autodetect, waiting for result\n"); | 999 | v4l_dbg(1, msp_debug, client, |
1000 | "started autodetect, waiting for result\n"); | ||
976 | for (i = 0; i < 10; i++) { | 1001 | for (i = 0; i < 10; i++) { |
977 | if (msp_sleep(state, 100)) | 1002 | if (msp_sleep(state, 100)) |
978 | goto restart; | 1003 | goto restart; |
@@ -983,15 +1008,18 @@ int msp34xxg_thread(void *data) | |||
983 | state->std = val; | 1008 | state->std = val; |
984 | break; | 1009 | break; |
985 | } | 1010 | } |
986 | v4l_dbg(2, msp_debug, client, "detection still in progress\n"); | 1011 | v4l_dbg(2, msp_debug, client, |
1012 | "detection still in progress\n"); | ||
987 | } | 1013 | } |
988 | if (state->std == 1) { | 1014 | if (state->std == 1) { |
989 | v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); | 1015 | v4l_dbg(1, msp_debug, client, |
1016 | "detection still in progress after 10 tries. giving up.\n"); | ||
990 | continue; | 1017 | continue; |
991 | } | 1018 | } |
992 | 1019 | ||
993 | unmute: | 1020 | unmute: |
994 | v4l_dbg(1, msp_debug, client, "detected standard: %s (0x%04x)\n", | 1021 | v4l_dbg(1, msp_debug, client, |
1022 | "detected standard: %s (0x%04x)\n", | ||
995 | msp_standard_std_name(state->std), state->std); | 1023 | msp_standard_std_name(state->std), state->std); |
996 | 1024 | ||
997 | if (state->std == 9) { | 1025 | if (state->std == 9) { |
@@ -1046,9 +1074,11 @@ static int msp34xxg_detect_stereo(struct i2c_client *client) | |||
1046 | if (state->std == 0x20) | 1074 | if (state->std == 0x20) |
1047 | state->rxsubchans |= V4L2_TUNER_SUB_SAP; | 1075 | state->rxsubchans |= V4L2_TUNER_SUB_SAP; |
1048 | else | 1076 | else |
1049 | state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 1077 | state->rxsubchans = |
1078 | V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | ||
1050 | } | 1079 | } |
1051 | v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", | 1080 | v4l_dbg(1, msp_debug, client, |
1081 | "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", | ||
1052 | status, is_stereo, is_bilingual, state->rxsubchans); | 1082 | status, is_stereo, is_bilingual, state->rxsubchans); |
1053 | return (oldrx != state->rxsubchans); | 1083 | return (oldrx != state->rxsubchans); |
1054 | } | 1084 | } |