diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-09-13 10:44:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:01:22 -0500 |
commit | 1a39275a3f2fc6fbdb876f5121d67d4b13310c5b (patch) | |
tree | 996db4b5b9bdcad690bf8b620ad1bc7c3eeaad52 | |
parent | e8e6b99184aa8cf72c5a28bf2a64f6d81473b1ca (diff) |
V4L/DVB (6459): cx25840: convert to bus-based I2C API
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 466 |
1 files changed, 203 insertions, 263 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 15f191e170d2..1556e2fad4c1 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <media/v4l2-common.h> | 38 | #include <media/v4l2-common.h> |
39 | #include <media/v4l2-chip-ident.h> | 39 | #include <media/v4l2-chip-ident.h> |
40 | #include <media/v4l2-i2c-drv-legacy.h> | ||
40 | #include <media/cx25840.h> | 41 | #include <media/cx25840.h> |
41 | 42 | ||
42 | #include "cx25840-core.h" | 43 | #include "cx25840-core.h" |
@@ -122,8 +123,6 @@ int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned and_mask, | |||
122 | 123 | ||
123 | static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input, | 124 | static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input, |
124 | enum cx25840_audio_input aud_input); | 125 | enum cx25840_audio_input aud_input); |
125 | static void log_audio_status(struct i2c_client *client); | ||
126 | static void log_video_status(struct i2c_client *client); | ||
127 | 126 | ||
128 | /* ----------------------------------------------------------------------- */ | 127 | /* ----------------------------------------------------------------------- */ |
129 | 128 | ||
@@ -641,6 +640,200 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) | |||
641 | 640 | ||
642 | /* ----------------------------------------------------------------------- */ | 641 | /* ----------------------------------------------------------------------- */ |
643 | 642 | ||
643 | static void log_video_status(struct i2c_client *client) | ||
644 | { | ||
645 | static const char *const fmt_strs[] = { | ||
646 | "0x0", | ||
647 | "NTSC-M", "NTSC-J", "NTSC-4.43", | ||
648 | "PAL-BDGHI", "PAL-M", "PAL-N", "PAL-Nc", "PAL-60", | ||
649 | "0x9", "0xA", "0xB", | ||
650 | "SECAM", | ||
651 | "0xD", "0xE", "0xF" | ||
652 | }; | ||
653 | |||
654 | struct cx25840_state *state = i2c_get_clientdata(client); | ||
655 | u8 vidfmt_sel = cx25840_read(client, 0x400) & 0xf; | ||
656 | u8 gen_stat1 = cx25840_read(client, 0x40d); | ||
657 | u8 gen_stat2 = cx25840_read(client, 0x40e); | ||
658 | int vid_input = state->vid_input; | ||
659 | |||
660 | v4l_info(client, "Video signal: %spresent\n", | ||
661 | (gen_stat2 & 0x20) ? "" : "not "); | ||
662 | v4l_info(client, "Detected format: %s\n", | ||
663 | fmt_strs[gen_stat1 & 0xf]); | ||
664 | |||
665 | v4l_info(client, "Specified standard: %s\n", | ||
666 | vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection"); | ||
667 | |||
668 | if (vid_input >= CX25840_COMPOSITE1 && | ||
669 | vid_input <= CX25840_COMPOSITE8) { | ||
670 | v4l_info(client, "Specified video input: Composite %d\n", | ||
671 | vid_input - CX25840_COMPOSITE1 + 1); | ||
672 | } else { | ||
673 | v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n", | ||
674 | (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8); | ||
675 | } | ||
676 | |||
677 | v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq); | ||
678 | } | ||
679 | |||
680 | /* ----------------------------------------------------------------------- */ | ||
681 | |||
682 | static void log_audio_status(struct i2c_client *client) | ||
683 | { | ||
684 | struct cx25840_state *state = i2c_get_clientdata(client); | ||
685 | u8 download_ctl = cx25840_read(client, 0x803); | ||
686 | u8 mod_det_stat0 = cx25840_read(client, 0x804); | ||
687 | u8 mod_det_stat1 = cx25840_read(client, 0x805); | ||
688 | u8 audio_config = cx25840_read(client, 0x808); | ||
689 | u8 pref_mode = cx25840_read(client, 0x809); | ||
690 | u8 afc0 = cx25840_read(client, 0x80b); | ||
691 | u8 mute_ctl = cx25840_read(client, 0x8d3); | ||
692 | int aud_input = state->aud_input; | ||
693 | char *p; | ||
694 | |||
695 | switch (mod_det_stat0) { | ||
696 | case 0x00: p = "mono"; break; | ||
697 | case 0x01: p = "stereo"; break; | ||
698 | case 0x02: p = "dual"; break; | ||
699 | case 0x04: p = "tri"; break; | ||
700 | case 0x10: p = "mono with SAP"; break; | ||
701 | case 0x11: p = "stereo with SAP"; break; | ||
702 | case 0x12: p = "dual with SAP"; break; | ||
703 | case 0x14: p = "tri with SAP"; break; | ||
704 | case 0xfe: p = "forced mode"; break; | ||
705 | default: p = "not defined"; | ||
706 | } | ||
707 | v4l_info(client, "Detected audio mode: %s\n", p); | ||
708 | |||
709 | switch (mod_det_stat1) { | ||
710 | case 0x00: p = "not defined"; break; | ||
711 | case 0x01: p = "EIAJ"; break; | ||
712 | case 0x02: p = "A2-M"; break; | ||
713 | case 0x03: p = "A2-BG"; break; | ||
714 | case 0x04: p = "A2-DK1"; break; | ||
715 | case 0x05: p = "A2-DK2"; break; | ||
716 | case 0x06: p = "A2-DK3"; break; | ||
717 | case 0x07: p = "A1 (6.0 MHz FM Mono)"; break; | ||
718 | case 0x08: p = "AM-L"; break; | ||
719 | case 0x09: p = "NICAM-BG"; break; | ||
720 | case 0x0a: p = "NICAM-DK"; break; | ||
721 | case 0x0b: p = "NICAM-I"; break; | ||
722 | case 0x0c: p = "NICAM-L"; break; | ||
723 | case 0x0d: p = "BTSC/EIAJ/A2-M Mono (4.5 MHz FMMono)"; break; | ||
724 | case 0x0e: p = "IF FM Radio"; break; | ||
725 | case 0x0f: p = "BTSC"; break; | ||
726 | case 0x10: p = "high-deviation FM"; break; | ||
727 | case 0x11: p = "very high-deviation FM"; break; | ||
728 | case 0xfd: p = "unknown audio standard"; break; | ||
729 | case 0xfe: p = "forced audio standard"; break; | ||
730 | case 0xff: p = "no detected audio standard"; break; | ||
731 | default: p = "not defined"; | ||
732 | } | ||
733 | v4l_info(client, "Detected audio standard: %s\n", p); | ||
734 | v4l_info(client, "Audio muted: %s\n", | ||
735 | (state->unmute_volume >= 0) ? "yes" : "no"); | ||
736 | v4l_info(client, "Audio microcontroller: %s\n", | ||
737 | (download_ctl & 0x10) ? | ||
738 | ((mute_ctl & 0x2) ? "detecting" : "running") : "stopped"); | ||
739 | |||
740 | switch (audio_config >> 4) { | ||
741 | case 0x00: p = "undefined"; break; | ||
742 | case 0x01: p = "BTSC"; break; | ||
743 | case 0x02: p = "EIAJ"; break; | ||
744 | case 0x03: p = "A2-M"; break; | ||
745 | case 0x04: p = "A2-BG"; break; | ||
746 | case 0x05: p = "A2-DK1"; break; | ||
747 | case 0x06: p = "A2-DK2"; break; | ||
748 | case 0x07: p = "A2-DK3"; break; | ||
749 | case 0x08: p = "A1 (6.0 MHz FM Mono)"; break; | ||
750 | case 0x09: p = "AM-L"; break; | ||
751 | case 0x0a: p = "NICAM-BG"; break; | ||
752 | case 0x0b: p = "NICAM-DK"; break; | ||
753 | case 0x0c: p = "NICAM-I"; break; | ||
754 | case 0x0d: p = "NICAM-L"; break; | ||
755 | case 0x0e: p = "FM radio"; break; | ||
756 | case 0x0f: p = "automatic detection"; break; | ||
757 | default: p = "undefined"; | ||
758 | } | ||
759 | v4l_info(client, "Configured audio standard: %s\n", p); | ||
760 | |||
761 | if ((audio_config >> 4) < 0xF) { | ||
762 | switch (audio_config & 0xF) { | ||
763 | case 0x00: p = "MONO1 (LANGUAGE A/Mono L+R channel for BTSC, EIAJ, A2)"; break; | ||
764 | case 0x01: p = "MONO2 (LANGUAGE B)"; break; | ||
765 | case 0x02: p = "MONO3 (STEREO forced MONO)"; break; | ||
766 | case 0x03: p = "MONO4 (NICAM ANALOG-Language C/Analog Fallback)"; break; | ||
767 | case 0x04: p = "STEREO"; break; | ||
768 | case 0x05: p = "DUAL1 (AB)"; break; | ||
769 | case 0x06: p = "DUAL2 (AC) (FM)"; break; | ||
770 | case 0x07: p = "DUAL3 (BC) (FM)"; break; | ||
771 | case 0x08: p = "DUAL4 (AC) (AM)"; break; | ||
772 | case 0x09: p = "DUAL5 (BC) (AM)"; break; | ||
773 | case 0x0a: p = "SAP"; break; | ||
774 | default: p = "undefined"; | ||
775 | } | ||
776 | v4l_info(client, "Configured audio mode: %s\n", p); | ||
777 | } else { | ||
778 | switch (audio_config & 0xF) { | ||
779 | case 0x00: p = "BG"; break; | ||
780 | case 0x01: p = "DK1"; break; | ||
781 | case 0x02: p = "DK2"; break; | ||
782 | case 0x03: p = "DK3"; break; | ||
783 | case 0x04: p = "I"; break; | ||
784 | case 0x05: p = "L"; break; | ||
785 | case 0x06: p = "BTSC"; break; | ||
786 | case 0x07: p = "EIAJ"; break; | ||
787 | case 0x08: p = "A2-M"; break; | ||
788 | case 0x09: p = "FM Radio"; break; | ||
789 | case 0x0f: p = "automatic standard and mode detection"; break; | ||
790 | default: p = "undefined"; | ||
791 | } | ||
792 | v4l_info(client, "Configured audio system: %s\n", p); | ||
793 | } | ||
794 | |||
795 | if (aud_input) { | ||
796 | v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input); | ||
797 | } else { | ||
798 | v4l_info(client, "Specified audio input: External\n"); | ||
799 | } | ||
800 | |||
801 | switch (pref_mode & 0xf) { | ||
802 | case 0: p = "mono/language A"; break; | ||
803 | case 1: p = "language B"; break; | ||
804 | case 2: p = "language C"; break; | ||
805 | case 3: p = "analog fallback"; break; | ||
806 | case 4: p = "stereo"; break; | ||
807 | case 5: p = "language AC"; break; | ||
808 | case 6: p = "language BC"; break; | ||
809 | case 7: p = "language AB"; break; | ||
810 | default: p = "undefined"; | ||
811 | } | ||
812 | v4l_info(client, "Preferred audio mode: %s\n", p); | ||
813 | |||
814 | if ((audio_config & 0xf) == 0xf) { | ||
815 | switch ((afc0 >> 3) & 0x3) { | ||
816 | case 0: p = "system DK"; break; | ||
817 | case 1: p = "system L"; break; | ||
818 | case 2: p = "autodetect"; break; | ||
819 | default: p = "undefined"; | ||
820 | } | ||
821 | v4l_info(client, "Selected 65 MHz format: %s\n", p); | ||
822 | |||
823 | switch (afc0 & 0x7) { | ||
824 | case 0: p = "chroma"; break; | ||
825 | case 1: p = "BTSC"; break; | ||
826 | case 2: p = "EIAJ"; break; | ||
827 | case 3: p = "A2-M"; break; | ||
828 | case 4: p = "autodetect"; break; | ||
829 | default: p = "undefined"; | ||
830 | } | ||
831 | v4l_info(client, "Selected 45 MHz format: %s\n", p); | ||
832 | } | ||
833 | } | ||
834 | |||
835 | /* ----------------------------------------------------------------------- */ | ||
836 | |||
644 | static int cx25840_command(struct i2c_client *client, unsigned int cmd, | 837 | static int cx25840_command(struct i2c_client *client, unsigned int cmd, |
645 | void *arg) | 838 | void *arg) |
646 | { | 839 | { |
@@ -879,31 +1072,12 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
879 | 1072 | ||
880 | /* ----------------------------------------------------------------------- */ | 1073 | /* ----------------------------------------------------------------------- */ |
881 | 1074 | ||
882 | static struct i2c_driver i2c_driver_cx25840; | 1075 | static int cx25840_probe(struct i2c_client *client) |
883 | |||
884 | static int cx25840_detect_client(struct i2c_adapter *adapter, int address, | ||
885 | int kind) | ||
886 | { | 1076 | { |
887 | struct i2c_client *client; | ||
888 | struct cx25840_state *state; | 1077 | struct cx25840_state *state; |
889 | u32 id; | 1078 | u32 id; |
890 | u16 device_id; | 1079 | u16 device_id; |
891 | 1080 | ||
892 | /* Check if the adapter supports the needed features | ||
893 | * Not until kernel version 2.6.11 did the bit-algo | ||
894 | * correctly report that it would do an I2C-level xfer */ | ||
895 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) | ||
896 | return 0; | ||
897 | |||
898 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
899 | if (client == 0) | ||
900 | return -ENOMEM; | ||
901 | |||
902 | client->addr = address; | ||
903 | client->adapter = adapter; | ||
904 | client->driver = &i2c_driver_cx25840; | ||
905 | snprintf(client->name, sizeof(client->name) - 1, "cx25840"); | ||
906 | |||
907 | v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1); | 1081 | v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1); |
908 | 1082 | ||
909 | device_id = cx25840_read(client, 0x101) << 8; | 1083 | device_id = cx25840_read(client, 0x101) << 8; |
@@ -919,13 +1093,11 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, | |||
919 | } | 1093 | } |
920 | else { | 1094 | else { |
921 | v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n"); | 1095 | v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n"); |
922 | kfree(client); | ||
923 | return 0; | 1096 | return 0; |
924 | } | 1097 | } |
925 | 1098 | ||
926 | state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL); | 1099 | state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL); |
927 | if (state == NULL) { | 1100 | if (state == NULL) { |
928 | kfree(client); | ||
929 | return -ENOMEM; | 1101 | return -ENOMEM; |
930 | } | 1102 | } |
931 | 1103 | ||
@@ -948,251 +1120,19 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, | |||
948 | state->vbi_line_offset = 8; | 1120 | state->vbi_line_offset = 8; |
949 | state->id = id; | 1121 | state->id = id; |
950 | state->rev = device_id; | 1122 | state->rev = device_id; |
951 | |||
952 | i2c_attach_client(client); | ||
953 | |||
954 | return 0; | 1123 | return 0; |
955 | } | 1124 | } |
956 | 1125 | ||
957 | static int cx25840_attach_adapter(struct i2c_adapter *adapter) | 1126 | static int cx25840_remove(struct i2c_client *client) |
958 | { | 1127 | { |
959 | if (adapter->class & I2C_CLASS_TV_ANALOG) | 1128 | kfree(i2c_get_clientdata(client)); |
960 | return i2c_probe(adapter, &addr_data, &cx25840_detect_client); | ||
961 | return 0; | 1129 | return 0; |
962 | } | 1130 | } |
963 | 1131 | ||
964 | static int cx25840_detach_client(struct i2c_client *client) | 1132 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
965 | { | 1133 | .name = "cx25840", |
966 | struct cx25840_state *state = i2c_get_clientdata(client); | 1134 | .driverid = I2C_DRIVERID_CX25840, |
967 | int err; | ||
968 | |||
969 | err = i2c_detach_client(client); | ||
970 | if (err) { | ||
971 | return err; | ||
972 | } | ||
973 | |||
974 | kfree(state); | ||
975 | kfree(client); | ||
976 | |||
977 | return 0; | ||
978 | } | ||
979 | |||
980 | /* ----------------------------------------------------------------------- */ | ||
981 | |||
982 | static struct i2c_driver i2c_driver_cx25840 = { | ||
983 | .driver = { | ||
984 | .name = "cx25840", | ||
985 | }, | ||
986 | .id = I2C_DRIVERID_CX25840, | ||
987 | .attach_adapter = cx25840_attach_adapter, | ||
988 | .detach_client = cx25840_detach_client, | ||
989 | .command = cx25840_command, | 1135 | .command = cx25840_command, |
1136 | .probe = cx25840_probe, | ||
1137 | .remove = cx25840_remove, | ||
990 | }; | 1138 | }; |
991 | |||
992 | |||
993 | static int __init m__init(void) | ||
994 | { | ||
995 | return i2c_add_driver(&i2c_driver_cx25840); | ||
996 | } | ||
997 | |||
998 | static void __exit m__exit(void) | ||
999 | { | ||
1000 | i2c_del_driver(&i2c_driver_cx25840); | ||
1001 | } | ||
1002 | |||
1003 | module_init(m__init); | ||
1004 | module_exit(m__exit); | ||
1005 | |||
1006 | /* ----------------------------------------------------------------------- */ | ||
1007 | |||
1008 | static void log_video_status(struct i2c_client *client) | ||
1009 | { | ||
1010 | static const char *const fmt_strs[] = { | ||
1011 | "0x0", | ||
1012 | "NTSC-M", "NTSC-J", "NTSC-4.43", | ||
1013 | "PAL-BDGHI", "PAL-M", "PAL-N", "PAL-Nc", "PAL-60", | ||
1014 | "0x9", "0xA", "0xB", | ||
1015 | "SECAM", | ||
1016 | "0xD", "0xE", "0xF" | ||
1017 | }; | ||
1018 | |||
1019 | struct cx25840_state *state = i2c_get_clientdata(client); | ||
1020 | u8 vidfmt_sel = cx25840_read(client, 0x400) & 0xf; | ||
1021 | u8 gen_stat1 = cx25840_read(client, 0x40d); | ||
1022 | u8 gen_stat2 = cx25840_read(client, 0x40e); | ||
1023 | int vid_input = state->vid_input; | ||
1024 | |||
1025 | v4l_info(client, "Video signal: %spresent\n", | ||
1026 | (gen_stat2 & 0x20) ? "" : "not "); | ||
1027 | v4l_info(client, "Detected format: %s\n", | ||
1028 | fmt_strs[gen_stat1 & 0xf]); | ||
1029 | |||
1030 | v4l_info(client, "Specified standard: %s\n", | ||
1031 | vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection"); | ||
1032 | |||
1033 | if (vid_input >= CX25840_COMPOSITE1 && | ||
1034 | vid_input <= CX25840_COMPOSITE8) { | ||
1035 | v4l_info(client, "Specified video input: Composite %d\n", | ||
1036 | vid_input - CX25840_COMPOSITE1 + 1); | ||
1037 | } else { | ||
1038 | v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n", | ||
1039 | (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8); | ||
1040 | } | ||
1041 | |||
1042 | v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq); | ||
1043 | } | ||
1044 | |||
1045 | /* ----------------------------------------------------------------------- */ | ||
1046 | |||
1047 | static void log_audio_status(struct i2c_client *client) | ||
1048 | { | ||
1049 | struct cx25840_state *state = i2c_get_clientdata(client); | ||
1050 | u8 download_ctl = cx25840_read(client, 0x803); | ||
1051 | u8 mod_det_stat0 = cx25840_read(client, 0x804); | ||
1052 | u8 mod_det_stat1 = cx25840_read(client, 0x805); | ||
1053 | u8 audio_config = cx25840_read(client, 0x808); | ||
1054 | u8 pref_mode = cx25840_read(client, 0x809); | ||
1055 | u8 afc0 = cx25840_read(client, 0x80b); | ||
1056 | u8 mute_ctl = cx25840_read(client, 0x8d3); | ||
1057 | int aud_input = state->aud_input; | ||
1058 | char *p; | ||
1059 | |||
1060 | switch (mod_det_stat0) { | ||
1061 | case 0x00: p = "mono"; break; | ||
1062 | case 0x01: p = "stereo"; break; | ||
1063 | case 0x02: p = "dual"; break; | ||
1064 | case 0x04: p = "tri"; break; | ||
1065 | case 0x10: p = "mono with SAP"; break; | ||
1066 | case 0x11: p = "stereo with SAP"; break; | ||
1067 | case 0x12: p = "dual with SAP"; break; | ||
1068 | case 0x14: p = "tri with SAP"; break; | ||
1069 | case 0xfe: p = "forced mode"; break; | ||
1070 | default: p = "not defined"; | ||
1071 | } | ||
1072 | v4l_info(client, "Detected audio mode: %s\n", p); | ||
1073 | |||
1074 | switch (mod_det_stat1) { | ||
1075 | case 0x00: p = "not defined"; break; | ||
1076 | case 0x01: p = "EIAJ"; break; | ||
1077 | case 0x02: p = "A2-M"; break; | ||
1078 | case 0x03: p = "A2-BG"; break; | ||
1079 | case 0x04: p = "A2-DK1"; break; | ||
1080 | case 0x05: p = "A2-DK2"; break; | ||
1081 | case 0x06: p = "A2-DK3"; break; | ||
1082 | case 0x07: p = "A1 (6.0 MHz FM Mono)"; break; | ||
1083 | case 0x08: p = "AM-L"; break; | ||
1084 | case 0x09: p = "NICAM-BG"; break; | ||
1085 | case 0x0a: p = "NICAM-DK"; break; | ||
1086 | case 0x0b: p = "NICAM-I"; break; | ||
1087 | case 0x0c: p = "NICAM-L"; break; | ||
1088 | case 0x0d: p = "BTSC/EIAJ/A2-M Mono (4.5 MHz FMMono)"; break; | ||
1089 | case 0x0e: p = "IF FM Radio"; break; | ||
1090 | case 0x0f: p = "BTSC"; break; | ||
1091 | case 0x10: p = "high-deviation FM"; break; | ||
1092 | case 0x11: p = "very high-deviation FM"; break; | ||
1093 | case 0xfd: p = "unknown audio standard"; break; | ||
1094 | case 0xfe: p = "forced audio standard"; break; | ||
1095 | case 0xff: p = "no detected audio standard"; break; | ||
1096 | default: p = "not defined"; | ||
1097 | } | ||
1098 | v4l_info(client, "Detected audio standard: %s\n", p); | ||
1099 | v4l_info(client, "Audio muted: %s\n", | ||
1100 | (state->unmute_volume >= 0) ? "yes" : "no"); | ||
1101 | v4l_info(client, "Audio microcontroller: %s\n", | ||
1102 | (download_ctl & 0x10) ? | ||
1103 | ((mute_ctl & 0x2) ? "detecting" : "running") : "stopped"); | ||
1104 | |||
1105 | switch (audio_config >> 4) { | ||
1106 | case 0x00: p = "undefined"; break; | ||
1107 | case 0x01: p = "BTSC"; break; | ||
1108 | case 0x02: p = "EIAJ"; break; | ||
1109 | case 0x03: p = "A2-M"; break; | ||
1110 | case 0x04: p = "A2-BG"; break; | ||
1111 | case 0x05: p = "A2-DK1"; break; | ||
1112 | case 0x06: p = "A2-DK2"; break; | ||
1113 | case 0x07: p = "A2-DK3"; break; | ||
1114 | case 0x08: p = "A1 (6.0 MHz FM Mono)"; break; | ||
1115 | case 0x09: p = "AM-L"; break; | ||
1116 | case 0x0a: p = "NICAM-BG"; break; | ||
1117 | case 0x0b: p = "NICAM-DK"; break; | ||
1118 | case 0x0c: p = "NICAM-I"; break; | ||
1119 | case 0x0d: p = "NICAM-L"; break; | ||
1120 | case 0x0e: p = "FM radio"; break; | ||
1121 | case 0x0f: p = "automatic detection"; break; | ||
1122 | default: p = "undefined"; | ||
1123 | } | ||
1124 | v4l_info(client, "Configured audio standard: %s\n", p); | ||
1125 | |||
1126 | if ((audio_config >> 4) < 0xF) { | ||
1127 | switch (audio_config & 0xF) { | ||
1128 | case 0x00: p = "MONO1 (LANGUAGE A/Mono L+R channel for BTSC, EIAJ, A2)"; break; | ||
1129 | case 0x01: p = "MONO2 (LANGUAGE B)"; break; | ||
1130 | case 0x02: p = "MONO3 (STEREO forced MONO)"; break; | ||
1131 | case 0x03: p = "MONO4 (NICAM ANALOG-Language C/Analog Fallback)"; break; | ||
1132 | case 0x04: p = "STEREO"; break; | ||
1133 | case 0x05: p = "DUAL1 (AB)"; break; | ||
1134 | case 0x06: p = "DUAL2 (AC) (FM)"; break; | ||
1135 | case 0x07: p = "DUAL3 (BC) (FM)"; break; | ||
1136 | case 0x08: p = "DUAL4 (AC) (AM)"; break; | ||
1137 | case 0x09: p = "DUAL5 (BC) (AM)"; break; | ||
1138 | case 0x0a: p = "SAP"; break; | ||
1139 | default: p = "undefined"; | ||
1140 | } | ||
1141 | v4l_info(client, "Configured audio mode: %s\n", p); | ||
1142 | } else { | ||
1143 | switch (audio_config & 0xF) { | ||
1144 | case 0x00: p = "BG"; break; | ||
1145 | case 0x01: p = "DK1"; break; | ||
1146 | case 0x02: p = "DK2"; break; | ||
1147 | case 0x03: p = "DK3"; break; | ||
1148 | case 0x04: p = "I"; break; | ||
1149 | case 0x05: p = "L"; break; | ||
1150 | case 0x06: p = "BTSC"; break; | ||
1151 | case 0x07: p = "EIAJ"; break; | ||
1152 | case 0x08: p = "A2-M"; break; | ||
1153 | case 0x09: p = "FM Radio"; break; | ||
1154 | case 0x0f: p = "automatic standard and mode detection"; break; | ||
1155 | default: p = "undefined"; | ||
1156 | } | ||
1157 | v4l_info(client, "Configured audio system: %s\n", p); | ||
1158 | } | ||
1159 | |||
1160 | if (aud_input) { | ||
1161 | v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input); | ||
1162 | } else { | ||
1163 | v4l_info(client, "Specified audio input: External\n"); | ||
1164 | } | ||
1165 | |||
1166 | switch (pref_mode & 0xf) { | ||
1167 | case 0: p = "mono/language A"; break; | ||
1168 | case 1: p = "language B"; break; | ||
1169 | case 2: p = "language C"; break; | ||
1170 | case 3: p = "analog fallback"; break; | ||
1171 | case 4: p = "stereo"; break; | ||
1172 | case 5: p = "language AC"; break; | ||
1173 | case 6: p = "language BC"; break; | ||
1174 | case 7: p = "language AB"; break; | ||
1175 | default: p = "undefined"; | ||
1176 | } | ||
1177 | v4l_info(client, "Preferred audio mode: %s\n", p); | ||
1178 | |||
1179 | if ((audio_config & 0xf) == 0xf) { | ||
1180 | switch ((afc0 >> 3) & 0x3) { | ||
1181 | case 0: p = "system DK"; break; | ||
1182 | case 1: p = "system L"; break; | ||
1183 | case 2: p = "autodetect"; break; | ||
1184 | default: p = "undefined"; | ||
1185 | } | ||
1186 | v4l_info(client, "Selected 65 MHz format: %s\n", p); | ||
1187 | |||
1188 | switch (afc0 & 0x7) { | ||
1189 | case 0: p = "chroma"; break; | ||
1190 | case 1: p = "BTSC"; break; | ||
1191 | case 2: p = "EIAJ"; break; | ||
1192 | case 3: p = "A2-M"; break; | ||
1193 | case 4: p = "autodetect"; break; | ||
1194 | default: p = "undefined"; | ||
1195 | } | ||
1196 | v4l_info(client, "Selected 45 MHz format: %s\n", p); | ||
1197 | } | ||
1198 | } | ||