diff options
-rw-r--r-- | drivers/media/video/saa7115.c | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 900c65772fa0..740210c6fedd 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -66,7 +66,7 @@ static unsigned short normal_i2c[] = { | |||
66 | 66 | ||
67 | I2C_CLIENT_INSMOD; | 67 | I2C_CLIENT_INSMOD; |
68 | 68 | ||
69 | struct saa7115_state { | 69 | struct saa711x_state { |
70 | v4l2_std_id std; | 70 | v4l2_std_id std; |
71 | int input; | 71 | int input; |
72 | int enable; | 72 | int enable; |
@@ -85,7 +85,7 @@ struct saa7115_state { | |||
85 | 85 | ||
86 | /* ----------------------------------------------------------------------- */ | 86 | /* ----------------------------------------------------------------------- */ |
87 | 87 | ||
88 | static inline int saa7115_write(struct i2c_client *client, u8 reg, u8 value) | 88 | static inline int saa711x_write(struct i2c_client *client, u8 reg, u8 value) |
89 | { | 89 | { |
90 | return i2c_smbus_write_byte_data(client, reg, value); | 90 | return i2c_smbus_write_byte_data(client, reg, value); |
91 | } | 91 | } |
@@ -127,9 +127,9 @@ static int saa711x_has_reg(const int id, const u8 reg) | |||
127 | return 1; | 127 | return 1; |
128 | } | 128 | } |
129 | 129 | ||
130 | static int saa7115_writeregs(struct i2c_client *client, const unsigned char *regs) | 130 | static int saa711x_writeregs(struct i2c_client *client, const unsigned char *regs) |
131 | { | 131 | { |
132 | struct saa7115_state *state = i2c_get_clientdata(client); | 132 | struct saa711x_state *state = i2c_get_clientdata(client); |
133 | unsigned char reg, data; | 133 | unsigned char reg, data; |
134 | 134 | ||
135 | while (*regs != 0x00) { | 135 | while (*regs != 0x00) { |
@@ -139,14 +139,14 @@ static int saa7115_writeregs(struct i2c_client *client, const unsigned char *reg | |||
139 | /* According with datasheets, reserved regs should be | 139 | /* According with datasheets, reserved regs should be |
140 | filled with 0 - seems better not to touch on they */ | 140 | filled with 0 - seems better not to touch on they */ |
141 | if (saa711x_has_reg(state->ident,reg)) { | 141 | if (saa711x_has_reg(state->ident,reg)) { |
142 | if (saa7115_write(client, reg, data) < 0) | 142 | if (saa711x_write(client, reg, data) < 0) |
143 | return -1; | 143 | return -1; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
148 | 148 | ||
149 | static inline int saa7115_read(struct i2c_client *client, u8 reg) | 149 | static inline int saa711x_read(struct i2c_client *client, u8 reg) |
150 | { | 150 | { |
151 | return i2c_smbus_read_byte_data(client, reg); | 151 | return i2c_smbus_read_byte_data(client, reg); |
152 | } | 152 | } |
@@ -672,7 +672,7 @@ static const unsigned char saa7115_init_misc[] = { | |||
672 | 0x00, 0x00 | 672 | 0x00, 0x00 |
673 | }; | 673 | }; |
674 | 674 | ||
675 | static int saa7115_odd_parity(u8 c) | 675 | static int saa711x_odd_parity(u8 c) |
676 | { | 676 | { |
677 | c ^= (c >> 4); | 677 | c ^= (c >> 4); |
678 | c ^= (c >> 2); | 678 | c ^= (c >> 2); |
@@ -681,7 +681,7 @@ static int saa7115_odd_parity(u8 c) | |||
681 | return c & 1; | 681 | return c & 1; |
682 | } | 682 | } |
683 | 683 | ||
684 | static int saa7115_decode_vps(u8 * dst, u8 * p) | 684 | static int saa711x_decode_vps(u8 * dst, u8 * p) |
685 | { | 685 | { |
686 | static const u8 biphase_tbl[] = { | 686 | static const u8 biphase_tbl[] = { |
687 | 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4, | 687 | 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4, |
@@ -728,7 +728,7 @@ static int saa7115_decode_vps(u8 * dst, u8 * p) | |||
728 | return err & 0xf0; | 728 | return err & 0xf0; |
729 | } | 729 | } |
730 | 730 | ||
731 | static int saa7115_decode_wss(u8 * p) | 731 | static int saa711x_decode_wss(u8 * p) |
732 | { | 732 | { |
733 | static const int wss_bits[8] = { | 733 | static const int wss_bits[8] = { |
734 | 0, 0, 0, 1, 0, 1, 1, 1 | 734 | 0, 0, 0, 1, 0, 1, 1, 1 |
@@ -755,9 +755,9 @@ static int saa7115_decode_wss(u8 * p) | |||
755 | return wss; | 755 | return wss; |
756 | } | 756 | } |
757 | 757 | ||
758 | static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq) | 758 | static int saa711x_set_audio_clock_freq(struct i2c_client *client, u32 freq) |
759 | { | 759 | { |
760 | struct saa7115_state *state = i2c_get_clientdata(client); | 760 | struct saa711x_state *state = i2c_get_clientdata(client); |
761 | u32 acpf; | 761 | u32 acpf; |
762 | u32 acni; | 762 | u32 acni; |
763 | u32 hz; | 763 | u32 hz; |
@@ -795,26 +795,26 @@ static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq) | |||
795 | if (state->apll) | 795 | if (state->apll) |
796 | acc |= 0x08; | 796 | acc |= 0x08; |
797 | 797 | ||
798 | saa7115_write(client, R_38_CLK_RATIO_AMXCLK_TO_ASCLK, 0x03); | 798 | saa711x_write(client, R_38_CLK_RATIO_AMXCLK_TO_ASCLK, 0x03); |
799 | saa7115_write(client, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10); | 799 | saa711x_write(client, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10); |
800 | saa7115_write(client, R_3A_AUD_CLK_GEN_BASIC_SETUP, acc); | 800 | saa711x_write(client, R_3A_AUD_CLK_GEN_BASIC_SETUP, acc); |
801 | 801 | ||
802 | saa7115_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD, acpf & 0xff); | 802 | saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD, acpf & 0xff); |
803 | saa7115_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+1, | 803 | saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+1, |
804 | (acpf >> 8) & 0xff); | 804 | (acpf >> 8) & 0xff); |
805 | saa7115_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+2, | 805 | saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+2, |
806 | (acpf >> 16) & 0x03); | 806 | (acpf >> 16) & 0x03); |
807 | 807 | ||
808 | saa7115_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC, acni & 0xff); | 808 | saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC, acni & 0xff); |
809 | saa7115_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+1, (acni >> 8) & 0xff); | 809 | saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+1, (acni >> 8) & 0xff); |
810 | saa7115_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+2, (acni >> 16) & 0x3f); | 810 | saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+2, (acni >> 16) & 0x3f); |
811 | state->audclk_freq = freq; | 811 | state->audclk_freq = freq; |
812 | return 0; | 812 | return 0; |
813 | } | 813 | } |
814 | 814 | ||
815 | static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) | 815 | static int saa711x_set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) |
816 | { | 816 | { |
817 | struct saa7115_state *state = i2c_get_clientdata(client); | 817 | struct saa711x_state *state = i2c_get_clientdata(client); |
818 | 818 | ||
819 | switch (ctrl->id) { | 819 | switch (ctrl->id) { |
820 | case V4L2_CID_BRIGHTNESS: | 820 | case V4L2_CID_BRIGHTNESS: |
@@ -824,7 +824,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
824 | } | 824 | } |
825 | 825 | ||
826 | state->bright = ctrl->value; | 826 | state->bright = ctrl->value; |
827 | saa7115_write(client, R_0A_LUMA_BRIGHT_CNTL, state->bright); | 827 | saa711x_write(client, R_0A_LUMA_BRIGHT_CNTL, state->bright); |
828 | break; | 828 | break; |
829 | 829 | ||
830 | case V4L2_CID_CONTRAST: | 830 | case V4L2_CID_CONTRAST: |
@@ -834,7 +834,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
834 | } | 834 | } |
835 | 835 | ||
836 | state->contrast = ctrl->value; | 836 | state->contrast = ctrl->value; |
837 | saa7115_write(client, R_0B_LUMA_CONTRAST_CNTL, state->contrast); | 837 | saa711x_write(client, R_0B_LUMA_CONTRAST_CNTL, state->contrast); |
838 | break; | 838 | break; |
839 | 839 | ||
840 | case V4L2_CID_SATURATION: | 840 | case V4L2_CID_SATURATION: |
@@ -844,7 +844,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
844 | } | 844 | } |
845 | 845 | ||
846 | state->sat = ctrl->value; | 846 | state->sat = ctrl->value; |
847 | saa7115_write(client, R_0C_CHROMA_SAT_CNTL, state->sat); | 847 | saa711x_write(client, R_0C_CHROMA_SAT_CNTL, state->sat); |
848 | break; | 848 | break; |
849 | 849 | ||
850 | case V4L2_CID_HUE: | 850 | case V4L2_CID_HUE: |
@@ -854,7 +854,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
854 | } | 854 | } |
855 | 855 | ||
856 | state->hue = ctrl->value; | 856 | state->hue = ctrl->value; |
857 | saa7115_write(client, R_0D_CHROMA_HUE_CNTL, state->hue); | 857 | saa711x_write(client, R_0D_CHROMA_HUE_CNTL, state->hue); |
858 | break; | 858 | break; |
859 | 859 | ||
860 | default: | 860 | default: |
@@ -864,9 +864,9 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
864 | return 0; | 864 | return 0; |
865 | } | 865 | } |
866 | 866 | ||
867 | static int saa7115_get_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) | 867 | static int saa711x_get_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) |
868 | { | 868 | { |
869 | struct saa7115_state *state = i2c_get_clientdata(client); | 869 | struct saa711x_state *state = i2c_get_clientdata(client); |
870 | 870 | ||
871 | switch (ctrl->id) { | 871 | switch (ctrl->id) { |
872 | case V4L2_CID_BRIGHTNESS: | 872 | case V4L2_CID_BRIGHTNESS: |
@@ -888,9 +888,9 @@ static int saa7115_get_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
888 | return 0; | 888 | return 0; |
889 | } | 889 | } |
890 | 890 | ||
891 | static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) | 891 | static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std) |
892 | { | 892 | { |
893 | struct saa7115_state *state = i2c_get_clientdata(client); | 893 | struct saa711x_state *state = i2c_get_clientdata(client); |
894 | 894 | ||
895 | /* Prevent unnecessary standard changes. During a standard | 895 | /* Prevent unnecessary standard changes. During a standard |
896 | change the I-Port is temporarily disabled. Any devices | 896 | change the I-Port is temporarily disabled. Any devices |
@@ -905,10 +905,10 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
905 | // This works for NTSC-M, SECAM-L and the 50Hz PAL variants. | 905 | // This works for NTSC-M, SECAM-L and the 50Hz PAL variants. |
906 | if (std & V4L2_STD_525_60) { | 906 | if (std & V4L2_STD_525_60) { |
907 | v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n"); | 907 | v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n"); |
908 | saa7115_writeregs(client, saa7115_cfg_60hz_video); | 908 | saa711x_writeregs(client, saa7115_cfg_60hz_video); |
909 | } else { | 909 | } else { |
910 | v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n"); | 910 | v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n"); |
911 | saa7115_writeregs(client, saa7115_cfg_50hz_video); | 911 | saa711x_writeregs(client, saa7115_cfg_50hz_video); |
912 | } | 912 | } |
913 | 913 | ||
914 | /* Register 0E - Bits D6-D4 on NO-AUTO mode | 914 | /* Register 0E - Bits D6-D4 on NO-AUTO mode |
@@ -922,7 +922,7 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
922 | */ | 922 | */ |
923 | if (state->ident == V4L2_IDENT_SAA7111 || | 923 | if (state->ident == V4L2_IDENT_SAA7111 || |
924 | state->ident == V4L2_IDENT_SAA7113) { | 924 | state->ident == V4L2_IDENT_SAA7113) { |
925 | u8 reg = saa7115_read(client, R_0E_CHROMA_CNTL_1) & 0x8f; | 925 | u8 reg = saa711x_read(client, R_0E_CHROMA_CNTL_1) & 0x8f; |
926 | 926 | ||
927 | if (std == V4L2_STD_PAL_M) { | 927 | if (std == V4L2_STD_PAL_M) { |
928 | reg |= 0x30; | 928 | reg |= 0x30; |
@@ -933,32 +933,32 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
933 | } else if (std == V4L2_STD_NTSC_M_JP) { | 933 | } else if (std == V4L2_STD_NTSC_M_JP) { |
934 | reg |= 0x40; | 934 | reg |= 0x40; |
935 | } | 935 | } |
936 | saa7115_write(client, R_0E_CHROMA_CNTL_1, reg); | 936 | saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); |
937 | } else { | 937 | } else { |
938 | /* restart task B if needed */ | 938 | /* restart task B if needed */ |
939 | int taskb = saa7115_read(client, R_80_GLOBAL_CNTL_1) & 0x10; | 939 | int taskb = saa711x_read(client, R_80_GLOBAL_CNTL_1) & 0x10; |
940 | 940 | ||
941 | if (taskb && state->ident == V4L2_IDENT_SAA7114) { | 941 | if (taskb && state->ident == V4L2_IDENT_SAA7114) { |
942 | saa7115_writeregs(client, saa7115_cfg_vbi_on); | 942 | saa711x_writeregs(client, saa7115_cfg_vbi_on); |
943 | } | 943 | } |
944 | 944 | ||
945 | /* switch audio mode too! */ | 945 | /* switch audio mode too! */ |
946 | saa7115_set_audio_clock_freq(client, state->audclk_freq); | 946 | saa711x_set_audio_clock_freq(client, state->audclk_freq); |
947 | } | 947 | } |
948 | 948 | ||
949 | state->std = std; | 949 | state->std = std; |
950 | } | 950 | } |
951 | 951 | ||
952 | static v4l2_std_id saa7115_get_v4lstd(struct i2c_client *client) | 952 | static v4l2_std_id saa711x_get_v4lstd(struct i2c_client *client) |
953 | { | 953 | { |
954 | struct saa7115_state *state = i2c_get_clientdata(client); | 954 | struct saa711x_state *state = i2c_get_clientdata(client); |
955 | 955 | ||
956 | return state->std; | 956 | return state->std; |
957 | } | 957 | } |
958 | 958 | ||
959 | static void saa7115_log_status(struct i2c_client *client) | 959 | static void saa711x_log_status(struct i2c_client *client) |
960 | { | 960 | { |
961 | struct saa7115_state *state = i2c_get_clientdata(client); | 961 | struct saa711x_state *state = i2c_get_clientdata(client); |
962 | int reg1e, reg1f; | 962 | int reg1e, reg1f; |
963 | int signalOk; | 963 | int signalOk; |
964 | int vcr; | 964 | int vcr; |
@@ -966,7 +966,7 @@ static void saa7115_log_status(struct i2c_client *client) | |||
966 | v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq); | 966 | v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq); |
967 | if (state->ident != V4L2_IDENT_SAA7115) { | 967 | if (state->ident != V4L2_IDENT_SAA7115) { |
968 | /* status for the saa7114 */ | 968 | /* status for the saa7114 */ |
969 | reg1f = saa7115_read(client, R_1F_STATUS_BYTE_2_VD_DEC); | 969 | reg1f = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC); |
970 | signalOk = (reg1f & 0xc1) == 0x81; | 970 | signalOk = (reg1f & 0xc1) == 0x81; |
971 | v4l_info(client, "Video signal: %s\n", signalOk ? "ok" : "bad"); | 971 | v4l_info(client, "Video signal: %s\n", signalOk ? "ok" : "bad"); |
972 | v4l_info(client, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); | 972 | v4l_info(client, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); |
@@ -974,8 +974,8 @@ static void saa7115_log_status(struct i2c_client *client) | |||
974 | } | 974 | } |
975 | 975 | ||
976 | /* status for the saa7115 */ | 976 | /* status for the saa7115 */ |
977 | reg1e = saa7115_read(client, R_1E_STATUS_BYTE_1_VD_DEC); | 977 | reg1e = saa711x_read(client, R_1E_STATUS_BYTE_1_VD_DEC); |
978 | reg1f = saa7115_read(client, R_1F_STATUS_BYTE_2_VD_DEC); | 978 | reg1f = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC); |
979 | 979 | ||
980 | signalOk = (reg1f & 0xc1) == 0x81 && (reg1e & 0xc0) == 0x80; | 980 | signalOk = (reg1f & 0xc1) == 0x81 && (reg1e & 0xc0) == 0x80; |
981 | vcr = !(reg1f & 0x10); | 981 | vcr = !(reg1f & 0x10); |
@@ -1005,9 +1005,9 @@ static void saa7115_log_status(struct i2c_client *client) | |||
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | /* setup the sliced VBI lcr registers according to the sliced VBI format */ | 1007 | /* setup the sliced VBI lcr registers according to the sliced VBI format */ |
1008 | static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_format *fmt) | 1008 | static void saa711x_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_format *fmt) |
1009 | { | 1009 | { |
1010 | struct saa7115_state *state = i2c_get_clientdata(client); | 1010 | struct saa711x_state *state = i2c_get_clientdata(client); |
1011 | int is_50hz = (state->std & V4L2_STD_625_50); | 1011 | int is_50hz = (state->std & V4L2_STD_625_50); |
1012 | u8 lcr[24]; | 1012 | u8 lcr[24]; |
1013 | int i, x; | 1013 | int i, x; |
@@ -1078,16 +1078,16 @@ static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_fo | |||
1078 | 1078 | ||
1079 | /* write the lcr registers */ | 1079 | /* write the lcr registers */ |
1080 | for (i = 2; i <= 23; i++) { | 1080 | for (i = 2; i <= 23; i++) { |
1081 | saa7115_write(client, i - 2 + R_41_LCR_BASE, lcr[i]); | 1081 | saa711x_write(client, i - 2 + R_41_LCR_BASE, lcr[i]); |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | /* enable/disable raw VBI capturing */ | 1084 | /* enable/disable raw VBI capturing */ |
1085 | saa7115_writeregs(client, fmt->service_set == 0 ? | 1085 | saa711x_writeregs(client, fmt->service_set == 0 ? |
1086 | saa7115_cfg_vbi_on : | 1086 | saa7115_cfg_vbi_on : |
1087 | saa7115_cfg_vbi_off); | 1087 | saa7115_cfg_vbi_off); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) | 1090 | static int saa711x_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) |
1091 | { | 1091 | { |
1092 | static u16 lcr2vbi[] = { | 1092 | static u16 lcr2vbi[] = { |
1093 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ | 1093 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ |
@@ -1103,10 +1103,10 @@ static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1103 | return -EINVAL; | 1103 | return -EINVAL; |
1104 | memset(sliced, 0, sizeof(*sliced)); | 1104 | memset(sliced, 0, sizeof(*sliced)); |
1105 | /* done if using raw VBI */ | 1105 | /* done if using raw VBI */ |
1106 | if (saa7115_read(client, R_80_GLOBAL_CNTL_1) & 0x10) | 1106 | if (saa711x_read(client, R_80_GLOBAL_CNTL_1) & 0x10) |
1107 | return 0; | 1107 | return 0; |
1108 | for (i = 2; i <= 23; i++) { | 1108 | for (i = 2; i <= 23; i++) { |
1109 | u8 v = saa7115_read(client, i - 2 + R_41_LCR_BASE); | 1109 | u8 v = saa711x_read(client, i - 2 + R_41_LCR_BASE); |
1110 | 1110 | ||
1111 | sliced->service_lines[0][i] = lcr2vbi[v >> 4]; | 1111 | sliced->service_lines[0][i] = lcr2vbi[v >> 4]; |
1112 | sliced->service_lines[1][i] = lcr2vbi[v & 0xf]; | 1112 | sliced->service_lines[1][i] = lcr2vbi[v & 0xf]; |
@@ -1116,9 +1116,9 @@ static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1116 | return 0; | 1116 | return 0; |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) | 1119 | static int saa711x_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) |
1120 | { | 1120 | { |
1121 | struct saa7115_state *state = i2c_get_clientdata(client); | 1121 | struct saa711x_state *state = i2c_get_clientdata(client); |
1122 | struct v4l2_pix_format *pix; | 1122 | struct v4l2_pix_format *pix; |
1123 | int HPSC, HFSC; | 1123 | int HPSC, HFSC; |
1124 | int VSCY; | 1124 | int VSCY; |
@@ -1126,7 +1126,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1126 | int Vsrc = is_50hz ? 576 : 480; | 1126 | int Vsrc = is_50hz ? 576 : 480; |
1127 | 1127 | ||
1128 | if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { | 1128 | if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { |
1129 | saa7115_set_lcr(client, &fmt->fmt.sliced); | 1129 | saa711x_set_lcr(client, &fmt->fmt.sliced); |
1130 | return 0; | 1130 | return 0; |
1131 | } | 1131 | } |
1132 | if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1132 | if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
@@ -1155,14 +1155,14 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1155 | /* width */ | 1155 | /* width */ |
1156 | 1156 | ||
1157 | if (!saa711x_has_reg(state->ident,R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH)) { | 1157 | if (!saa711x_has_reg(state->ident,R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH)) { |
1158 | saa7115_write(client, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, | 1158 | saa711x_write(client, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, |
1159 | (u8) (pix->width & 0xff)); | 1159 | (u8) (pix->width & 0xff)); |
1160 | saa7115_write(client, R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, | 1160 | saa711x_write(client, R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, |
1161 | (u8) ((pix->width >> 8) & 0xff)); | 1161 | (u8) ((pix->width >> 8) & 0xff)); |
1162 | /* height */ | 1162 | /* height */ |
1163 | saa7115_write(client, R_CE_B_VERT_OUTPUT_WINDOW_LENGTH, | 1163 | saa711x_write(client, R_CE_B_VERT_OUTPUT_WINDOW_LENGTH, |
1164 | (u8) (pix->height & 0xff)); | 1164 | (u8) (pix->height & 0xff)); |
1165 | saa7115_write(client, R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB, | 1165 | saa711x_write(client, R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB, |
1166 | (u8) ((pix->height >> 8) & 0xff)); | 1166 | (u8) ((pix->height >> 8) & 0xff)); |
1167 | } | 1167 | } |
1168 | 1168 | ||
@@ -1178,27 +1178,27 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1178 | v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); | 1178 | v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); |
1179 | /* FIXME hardcodes to "Task B" | 1179 | /* FIXME hardcodes to "Task B" |
1180 | * write H prescaler integer */ | 1180 | * write H prescaler integer */ |
1181 | saa7115_write(client, R_D0_B_HORIZ_PRESCALING, | 1181 | saa711x_write(client, R_D0_B_HORIZ_PRESCALING, |
1182 | (u8) (HPSC & 0x3f)); | 1182 | (u8) (HPSC & 0x3f)); |
1183 | 1183 | ||
1184 | /* write H fine-scaling (luminance) */ | 1184 | /* write H fine-scaling (luminance) */ |
1185 | saa7115_write(client, R_D8_B_HORIZ_LUMA_SCALING_INC, | 1185 | saa711x_write(client, R_D8_B_HORIZ_LUMA_SCALING_INC, |
1186 | (u8) (HFSC & 0xff)); | 1186 | (u8) (HFSC & 0xff)); |
1187 | saa7115_write(client, R_D9_B_HORIZ_LUMA_SCALING_INC_MSB, | 1187 | saa711x_write(client, R_D9_B_HORIZ_LUMA_SCALING_INC_MSB, |
1188 | (u8) ((HFSC >> 8) & 0xff)); | 1188 | (u8) ((HFSC >> 8) & 0xff)); |
1189 | /* write H fine-scaling (chrominance) | 1189 | /* write H fine-scaling (chrominance) |
1190 | * must be lum/2, so i'll just bitshift :) */ | 1190 | * must be lum/2, so i'll just bitshift :) */ |
1191 | saa7115_write(client, R_DC_B_HORIZ_CHROMA_SCALING, | 1191 | saa711x_write(client, R_DC_B_HORIZ_CHROMA_SCALING, |
1192 | (u8) ((HFSC >> 1) & 0xff)); | 1192 | (u8) ((HFSC >> 1) & 0xff)); |
1193 | saa7115_write(client, R_DD_B_HORIZ_CHROMA_SCALING_MSB, | 1193 | saa711x_write(client, R_DD_B_HORIZ_CHROMA_SCALING_MSB, |
1194 | (u8) ((HFSC >> 9) & 0xff)); | 1194 | (u8) ((HFSC >> 9) & 0xff)); |
1195 | } else { | 1195 | } else { |
1196 | if (is_50hz) { | 1196 | if (is_50hz) { |
1197 | v4l_dbg(1, debug, client, "Setting full 50hz width\n"); | 1197 | v4l_dbg(1, debug, client, "Setting full 50hz width\n"); |
1198 | saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x); | 1198 | saa711x_writeregs(client, saa7115_cfg_50hz_fullres_x); |
1199 | } else { | 1199 | } else { |
1200 | v4l_dbg(1, debug, client, "Setting full 60hz width\n"); | 1200 | v4l_dbg(1, debug, client, "Setting full 60hz width\n"); |
1201 | saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); | 1201 | saa711x_writeregs(client, saa7115_cfg_60hz_fullres_x); |
1202 | } | 1202 | } |
1203 | } | 1203 | } |
1204 | 1204 | ||
@@ -1207,32 +1207,32 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1207 | v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); | 1207 | v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); |
1208 | 1208 | ||
1209 | /* Correct Contrast and Luminance */ | 1209 | /* Correct Contrast and Luminance */ |
1210 | saa7115_write(client, R_D5_B_LUMA_CONTRAST_CNTL, | 1210 | saa711x_write(client, R_D5_B_LUMA_CONTRAST_CNTL, |
1211 | (u8) (64 * 1024 / VSCY)); | 1211 | (u8) (64 * 1024 / VSCY)); |
1212 | saa7115_write(client, R_D6_B_CHROMA_SATURATION_CNTL, | 1212 | saa711x_write(client, R_D6_B_CHROMA_SATURATION_CNTL, |
1213 | (u8) (64 * 1024 / VSCY)); | 1213 | (u8) (64 * 1024 / VSCY)); |
1214 | 1214 | ||
1215 | /* write V fine-scaling (luminance) */ | 1215 | /* write V fine-scaling (luminance) */ |
1216 | saa7115_write(client, R_E0_B_VERT_LUMA_SCALING_INC, | 1216 | saa711x_write(client, R_E0_B_VERT_LUMA_SCALING_INC, |
1217 | (u8) (VSCY & 0xff)); | 1217 | (u8) (VSCY & 0xff)); |
1218 | saa7115_write(client, R_E1_B_VERT_LUMA_SCALING_INC_MSB, | 1218 | saa711x_write(client, R_E1_B_VERT_LUMA_SCALING_INC_MSB, |
1219 | (u8) ((VSCY >> 8) & 0xff)); | 1219 | (u8) ((VSCY >> 8) & 0xff)); |
1220 | /* write V fine-scaling (chrominance) */ | 1220 | /* write V fine-scaling (chrominance) */ |
1221 | saa7115_write(client, R_E2_B_VERT_CHROMA_SCALING_INC, | 1221 | saa711x_write(client, R_E2_B_VERT_CHROMA_SCALING_INC, |
1222 | (u8) (VSCY & 0xff)); | 1222 | (u8) (VSCY & 0xff)); |
1223 | saa7115_write(client, R_E3_B_VERT_CHROMA_SCALING_INC_MSB, | 1223 | saa711x_write(client, R_E3_B_VERT_CHROMA_SCALING_INC_MSB, |
1224 | (u8) ((VSCY >> 8) & 0xff)); | 1224 | (u8) ((VSCY >> 8) & 0xff)); |
1225 | } else { | 1225 | } else { |
1226 | if (is_50hz) { | 1226 | if (is_50hz) { |
1227 | v4l_dbg(1, debug, client, "Setting full 50Hz height\n"); | 1227 | v4l_dbg(1, debug, client, "Setting full 50Hz height\n"); |
1228 | saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y); | 1228 | saa711x_writeregs(client, saa7115_cfg_50hz_fullres_y); |
1229 | } else { | 1229 | } else { |
1230 | v4l_dbg(1, debug, client, "Setting full 60hz height\n"); | 1230 | v4l_dbg(1, debug, client, "Setting full 60hz height\n"); |
1231 | saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y); | 1231 | saa711x_writeregs(client, saa7115_cfg_60hz_fullres_y); |
1232 | } | 1232 | } |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | saa7115_writeregs(client, saa7115_cfg_reset_scaler); | 1235 | saa711x_writeregs(client, saa7115_cfg_reset_scaler); |
1236 | 1236 | ||
1237 | return 0; | 1237 | return 0; |
1238 | } | 1238 | } |
@@ -1243,13 +1243,13 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt | |||
1243 | The current implementation uses SAV/EAV codes and not the ancillary data | 1243 | The current implementation uses SAV/EAV codes and not the ancillary data |
1244 | headers. The vbi->p pointer points to the R_5E_SDID byte right after the SAV | 1244 | headers. The vbi->p pointer points to the R_5E_SDID byte right after the SAV |
1245 | code. */ | 1245 | code. */ |
1246 | static void saa7115_decode_vbi_line(struct i2c_client *client, | 1246 | static void saa711x_decode_vbi_line(struct i2c_client *client, |
1247 | struct v4l2_decode_vbi_line *vbi) | 1247 | struct v4l2_decode_vbi_line *vbi) |
1248 | { | 1248 | { |
1249 | static const char vbi_no_data_pattern[] = { | 1249 | static const char vbi_no_data_pattern[] = { |
1250 | 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0 | 1250 | 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0 |
1251 | }; | 1251 | }; |
1252 | struct saa7115_state *state = i2c_get_clientdata(client); | 1252 | struct saa711x_state *state = i2c_get_clientdata(client); |
1253 | u8 *p = vbi->p; | 1253 | u8 *p = vbi->p; |
1254 | u32 wss; | 1254 | u32 wss; |
1255 | int id1, id2; /* the ID1 and ID2 bytes from the internal header */ | 1255 | int id1, id2; /* the ID1 and ID2 bytes from the internal header */ |
@@ -1284,12 +1284,12 @@ static void saa7115_decode_vbi_line(struct i2c_client *client, | |||
1284 | vbi->type = V4L2_SLICED_TELETEXT_B; | 1284 | vbi->type = V4L2_SLICED_TELETEXT_B; |
1285 | break; | 1285 | break; |
1286 | case 4: | 1286 | case 4: |
1287 | if (!saa7115_odd_parity(p[0]) || !saa7115_odd_parity(p[1])) | 1287 | if (!saa711x_odd_parity(p[0]) || !saa7115_odd_parity(p[1])) |
1288 | return; | 1288 | return; |
1289 | vbi->type = V4L2_SLICED_CAPTION_525; | 1289 | vbi->type = V4L2_SLICED_CAPTION_525; |
1290 | break; | 1290 | break; |
1291 | case 5: | 1291 | case 5: |
1292 | wss = saa7115_decode_wss(p); | 1292 | wss = saa711x_decode_wss(p); |
1293 | if (wss == -1) | 1293 | if (wss == -1) |
1294 | return; | 1294 | return; |
1295 | p[0] = wss & 0xff; | 1295 | p[0] = wss & 0xff; |
@@ -1297,7 +1297,7 @@ static void saa7115_decode_vbi_line(struct i2c_client *client, | |||
1297 | vbi->type = V4L2_SLICED_WSS_625; | 1297 | vbi->type = V4L2_SLICED_WSS_625; |
1298 | break; | 1298 | break; |
1299 | case 7: | 1299 | case 7: |
1300 | if (saa7115_decode_vps(p, p) != 0) | 1300 | if (saa711x_decode_vps(p, p) != 0) |
1301 | return; | 1301 | return; |
1302 | vbi->type = V4L2_SLICED_VPS; | 1302 | vbi->type = V4L2_SLICED_VPS; |
1303 | break; | 1303 | break; |
@@ -1308,21 +1308,21 @@ static void saa7115_decode_vbi_line(struct i2c_client *client, | |||
1308 | 1308 | ||
1309 | /* ============ SAA7115 AUDIO settings (end) ============= */ | 1309 | /* ============ SAA7115 AUDIO settings (end) ============= */ |
1310 | 1310 | ||
1311 | static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *arg) | 1311 | static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *arg) |
1312 | { | 1312 | { |
1313 | struct saa7115_state *state = i2c_get_clientdata(client); | 1313 | struct saa711x_state *state = i2c_get_clientdata(client); |
1314 | int *iarg = arg; | 1314 | int *iarg = arg; |
1315 | 1315 | ||
1316 | /* ioctls to allow direct access to the saa7115 registers for testing */ | 1316 | /* ioctls to allow direct access to the saa7115 registers for testing */ |
1317 | switch (cmd) { | 1317 | switch (cmd) { |
1318 | case VIDIOC_S_FMT: | 1318 | case VIDIOC_S_FMT: |
1319 | return saa7115_set_v4lfmt(client, (struct v4l2_format *)arg); | 1319 | return saa711x_set_v4lfmt(client, (struct v4l2_format *)arg); |
1320 | 1320 | ||
1321 | case VIDIOC_G_FMT: | 1321 | case VIDIOC_G_FMT: |
1322 | return saa7115_get_v4lfmt(client, (struct v4l2_format *)arg); | 1322 | return saa711x_get_v4lfmt(client, (struct v4l2_format *)arg); |
1323 | 1323 | ||
1324 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | 1324 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: |
1325 | return saa7115_set_audio_clock_freq(client, *(u32 *)arg); | 1325 | return saa711x_set_audio_clock_freq(client, *(u32 *)arg); |
1326 | 1326 | ||
1327 | case VIDIOC_G_TUNER: | 1327 | case VIDIOC_G_TUNER: |
1328 | { | 1328 | { |
@@ -1331,7 +1331,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1331 | 1331 | ||
1332 | if (state->radio) | 1332 | if (state->radio) |
1333 | break; | 1333 | break; |
1334 | status = saa7115_read(client, R_1F_STATUS_BYTE_2_VD_DEC); | 1334 | status = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC); |
1335 | 1335 | ||
1336 | v4l_dbg(1, debug, client, "status: 0x%02x\n", status); | 1336 | v4l_dbg(1, debug, client, "status: 0x%02x\n", status); |
1337 | vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0; | 1337 | vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0; |
@@ -1339,14 +1339,14 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | case VIDIOC_LOG_STATUS: | 1341 | case VIDIOC_LOG_STATUS: |
1342 | saa7115_log_status(client); | 1342 | saa711x_log_status(client); |
1343 | break; | 1343 | break; |
1344 | 1344 | ||
1345 | case VIDIOC_G_CTRL: | 1345 | case VIDIOC_G_CTRL: |
1346 | return saa7115_get_v4lctrl(client, (struct v4l2_control *)arg); | 1346 | return saa711x_get_v4lctrl(client, (struct v4l2_control *)arg); |
1347 | 1347 | ||
1348 | case VIDIOC_S_CTRL: | 1348 | case VIDIOC_S_CTRL: |
1349 | return saa7115_set_v4lctrl(client, (struct v4l2_control *)arg); | 1349 | return saa711x_set_v4lctrl(client, (struct v4l2_control *)arg); |
1350 | 1350 | ||
1351 | case VIDIOC_QUERYCTRL: | 1351 | case VIDIOC_QUERYCTRL: |
1352 | { | 1352 | { |
@@ -1364,12 +1364,12 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | case VIDIOC_G_STD: | 1366 | case VIDIOC_G_STD: |
1367 | *(v4l2_std_id *)arg = saa7115_get_v4lstd(client); | 1367 | *(v4l2_std_id *)arg = saa711x_get_v4lstd(client); |
1368 | break; | 1368 | break; |
1369 | 1369 | ||
1370 | case VIDIOC_S_STD: | 1370 | case VIDIOC_S_STD: |
1371 | state->radio = 0; | 1371 | state->radio = 0; |
1372 | saa7115_set_v4lstd(client, *(v4l2_std_id *)arg); | 1372 | saa711x_set_v4lstd(client, *(v4l2_std_id *)arg); |
1373 | break; | 1373 | break; |
1374 | 1374 | ||
1375 | case AUDC_SET_RADIO: | 1375 | case AUDC_SET_RADIO: |
@@ -1405,13 +1405,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1405 | state->input = route->input; | 1405 | state->input = route->input; |
1406 | 1406 | ||
1407 | /* select mode */ | 1407 | /* select mode */ |
1408 | saa7115_write(client, R_02_INPUT_CNTL_1, | 1408 | saa711x_write(client, R_02_INPUT_CNTL_1, |
1409 | (saa7115_read(client, R_02_INPUT_CNTL_1) & 0xf0) | | 1409 | (saa711x_read(client, R_02_INPUT_CNTL_1) & 0xf0) | |
1410 | state->input); | 1410 | state->input); |
1411 | 1411 | ||
1412 | /* bypass chrominance trap for S-Video modes */ | 1412 | /* bypass chrominance trap for S-Video modes */ |
1413 | saa7115_write(client, R_09_LUMA_CNTL, | 1413 | saa711x_write(client, R_09_LUMA_CNTL, |
1414 | (saa7115_read(client, R_09_LUMA_CNTL) & 0x7f) | | 1414 | (saa711x_read(client, R_09_LUMA_CNTL) & 0x7f) | |
1415 | (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); | 1415 | (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); |
1416 | break; | 1416 | break; |
1417 | } | 1417 | } |
@@ -1423,7 +1423,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1423 | 1423 | ||
1424 | if (state->enable != (cmd == VIDIOC_STREAMON)) { | 1424 | if (state->enable != (cmd == VIDIOC_STREAMON)) { |
1425 | state->enable = (cmd == VIDIOC_STREAMON); | 1425 | state->enable = (cmd == VIDIOC_STREAMON); |
1426 | saa7115_write(client, | 1426 | saa711x_write(client, |
1427 | R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, | 1427 | R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, |
1428 | state->enable); | 1428 | state->enable); |
1429 | } | 1429 | } |
@@ -1440,17 +1440,17 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1440 | state->cgcdiv = (freq->flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4; | 1440 | state->cgcdiv = (freq->flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4; |
1441 | state->ucgc = (freq->flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0; | 1441 | state->ucgc = (freq->flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0; |
1442 | state->apll = (freq->flags & SAA7115_FREQ_FL_APLL) ? 1 : 0; | 1442 | state->apll = (freq->flags & SAA7115_FREQ_FL_APLL) ? 1 : 0; |
1443 | saa7115_set_audio_clock_freq(client, state->audclk_freq); | 1443 | saa711x_set_audio_clock_freq(client, state->audclk_freq); |
1444 | break; | 1444 | break; |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | case VIDIOC_INT_DECODE_VBI_LINE: | 1447 | case VIDIOC_INT_DECODE_VBI_LINE: |
1448 | saa7115_decode_vbi_line(client, arg); | 1448 | saa711x_decode_vbi_line(client, arg); |
1449 | break; | 1449 | break; |
1450 | 1450 | ||
1451 | case VIDIOC_INT_RESET: | 1451 | case VIDIOC_INT_RESET: |
1452 | v4l_dbg(1, debug, client, "decoder RESET\n"); | 1452 | v4l_dbg(1, debug, client, "decoder RESET\n"); |
1453 | saa7115_writeregs(client, saa7115_cfg_reset_scaler); | 1453 | saa711x_writeregs(client, saa7115_cfg_reset_scaler); |
1454 | break; | 1454 | break; |
1455 | 1455 | ||
1456 | case VIDIOC_INT_G_VBI_DATA: | 1456 | case VIDIOC_INT_G_VBI_DATA: |
@@ -1459,25 +1459,25 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1459 | 1459 | ||
1460 | switch (data->id) { | 1460 | switch (data->id) { |
1461 | case V4L2_SLICED_WSS_625: | 1461 | case V4L2_SLICED_WSS_625: |
1462 | if (saa7115_read(client, 0x6b) & 0xc0) | 1462 | if (saa711x_read(client, 0x6b) & 0xc0) |
1463 | return -EIO; | 1463 | return -EIO; |
1464 | data->data[0] = saa7115_read(client, 0x6c); | 1464 | data->data[0] = saa711x_read(client, 0x6c); |
1465 | data->data[1] = saa7115_read(client, 0x6d); | 1465 | data->data[1] = saa711x_read(client, 0x6d); |
1466 | return 0; | 1466 | return 0; |
1467 | case V4L2_SLICED_CAPTION_525: | 1467 | case V4L2_SLICED_CAPTION_525: |
1468 | if (data->field == 0) { | 1468 | if (data->field == 0) { |
1469 | /* CC */ | 1469 | /* CC */ |
1470 | if (saa7115_read(client, 0x66) & 0xc0) | 1470 | if (saa711x_read(client, 0x66) & 0xc0) |
1471 | return -EIO; | 1471 | return -EIO; |
1472 | data->data[0] = saa7115_read(client, 0x67); | 1472 | data->data[0] = saa711x_read(client, 0x67); |
1473 | data->data[1] = saa7115_read(client, 0x68); | 1473 | data->data[1] = saa711x_read(client, 0x68); |
1474 | return 0; | 1474 | return 0; |
1475 | } | 1475 | } |
1476 | /* XDS */ | 1476 | /* XDS */ |
1477 | if (saa7115_read(client, 0x66) & 0x30) | 1477 | if (saa711x_read(client, 0x66) & 0x30) |
1478 | return -EIO; | 1478 | return -EIO; |
1479 | data->data[0] = saa7115_read(client, 0x69); | 1479 | data->data[0] = saa711x_read(client, 0x69); |
1480 | data->data[1] = saa7115_read(client, 0x6a); | 1480 | data->data[1] = saa711x_read(client, 0x6a); |
1481 | return 0; | 1481 | return 0; |
1482 | default: | 1482 | default: |
1483 | return -EINVAL; | 1483 | return -EINVAL; |
@@ -1492,7 +1492,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1492 | 1492 | ||
1493 | if (reg->i2c_id != I2C_DRIVERID_SAA711X) | 1493 | if (reg->i2c_id != I2C_DRIVERID_SAA711X) |
1494 | return -EINVAL; | 1494 | return -EINVAL; |
1495 | reg->val = saa7115_read(client, reg->reg & 0xff); | 1495 | reg->val = saa711x_read(client, reg->reg & 0xff); |
1496 | break; | 1496 | break; |
1497 | } | 1497 | } |
1498 | 1498 | ||
@@ -1504,7 +1504,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1504 | return -EINVAL; | 1504 | return -EINVAL; |
1505 | if (!capable(CAP_SYS_ADMIN)) | 1505 | if (!capable(CAP_SYS_ADMIN)) |
1506 | return -EPERM; | 1506 | return -EPERM; |
1507 | saa7115_write(client, reg->reg & 0xff, reg->val & 0xff); | 1507 | saa711x_write(client, reg->reg & 0xff, reg->val & 0xff); |
1508 | break; | 1508 | break; |
1509 | } | 1509 | } |
1510 | #endif | 1510 | #endif |
@@ -1522,12 +1522,12 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1522 | 1522 | ||
1523 | /* ----------------------------------------------------------------------- */ | 1523 | /* ----------------------------------------------------------------------- */ |
1524 | 1524 | ||
1525 | static struct i2c_driver i2c_driver_saa7115; | 1525 | static struct i2c_driver i2c_driver_saa711x; |
1526 | 1526 | ||
1527 | static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | 1527 | static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind) |
1528 | { | 1528 | { |
1529 | struct i2c_client *client; | 1529 | struct i2c_client *client; |
1530 | struct saa7115_state *state; | 1530 | struct saa711x_state *state; |
1531 | int i; | 1531 | int i; |
1532 | char name[17]; | 1532 | char name[17]; |
1533 | u8 chip_id; | 1533 | u8 chip_id; |
@@ -1541,21 +1541,21 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1541 | return -ENOMEM; | 1541 | return -ENOMEM; |
1542 | client->addr = address; | 1542 | client->addr = address; |
1543 | client->adapter = adapter; | 1543 | client->adapter = adapter; |
1544 | client->driver = &i2c_driver_saa7115; | 1544 | client->driver = &i2c_driver_saa711x; |
1545 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); | 1545 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); |
1546 | 1546 | ||
1547 | v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1); | 1547 | v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1); |
1548 | 1548 | ||
1549 | for (i=0;i<0x0f;i++) { | 1549 | for (i=0;i<0x0f;i++) { |
1550 | saa7115_write(client, 0, i); | 1550 | saa711x_write(client, 0, i); |
1551 | name[i] = (saa7115_read(client, 0) &0x0f) +'0'; | 1551 | name[i] = (saa711x_read(client, 0) &0x0f) +'0'; |
1552 | if (name[i]>'9') | 1552 | if (name[i]>'9') |
1553 | name[i]+='a'-'9'-1; | 1553 | name[i]+='a'-'9'-1; |
1554 | } | 1554 | } |
1555 | name[i]='\0'; | 1555 | name[i]='\0'; |
1556 | 1556 | ||
1557 | saa7115_write(client, 0, 5); | 1557 | saa711x_write(client, 0, 5); |
1558 | chip_id = saa7115_read(client, 0) & 0x0f; | 1558 | chip_id = saa711x_read(client, 0) & 0x0f; |
1559 | if (chip_id < 3 && chip_id > 5) { | 1559 | if (chip_id < 3 && chip_id > 5) { |
1560 | v4l_dbg(1, debug, client, "saa7115 not found\n"); | 1560 | v4l_dbg(1, debug, client, "saa7115 not found\n"); |
1561 | kfree(client); | 1561 | kfree(client); |
@@ -1564,7 +1564,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1564 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); | 1564 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); |
1565 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name); | 1565 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name); |
1566 | 1566 | ||
1567 | state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL); | 1567 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); |
1568 | i2c_set_clientdata(client, state); | 1568 | i2c_set_clientdata(client, state); |
1569 | if (state == NULL) { | 1569 | if (state == NULL) { |
1570 | kfree(client); | 1570 | kfree(client); |
@@ -1608,36 +1608,36 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1608 | if (state->ident == V4L2_IDENT_SAA7111 || | 1608 | if (state->ident == V4L2_IDENT_SAA7111 || |
1609 | state->ident == V4L2_IDENT_SAA7113) { | 1609 | state->ident == V4L2_IDENT_SAA7113) { |
1610 | state->crystal_freq = SAA7115_FREQ_24_576_MHZ; | 1610 | state->crystal_freq = SAA7115_FREQ_24_576_MHZ; |
1611 | saa7115_writeregs(client, saa7113_init_auto_input); | 1611 | saa711x_writeregs(client, saa7113_init_auto_input); |
1612 | } else { | 1612 | } else { |
1613 | state->crystal_freq = SAA7115_FREQ_32_11_MHZ; | 1613 | state->crystal_freq = SAA7115_FREQ_32_11_MHZ; |
1614 | saa7115_writeregs(client, saa7115_init_auto_input); | 1614 | saa711x_writeregs(client, saa7115_init_auto_input); |
1615 | } | 1615 | } |
1616 | saa7115_writeregs(client, saa7115_init_misc); | 1616 | saa711x_writeregs(client, saa7115_init_misc); |
1617 | saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); | 1617 | saa711x_writeregs(client, saa7115_cfg_60hz_fullres_x); |
1618 | saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y); | 1618 | saa711x_writeregs(client, saa7115_cfg_60hz_fullres_y); |
1619 | saa7115_writeregs(client, saa7115_cfg_60hz_video); | 1619 | saa711x_writeregs(client, saa7115_cfg_60hz_video); |
1620 | saa7115_set_audio_clock_freq(client, state->audclk_freq); | 1620 | saa711x_set_audio_clock_freq(client, state->audclk_freq); |
1621 | saa7115_writeregs(client, saa7115_cfg_reset_scaler); | 1621 | saa711x_writeregs(client, saa7115_cfg_reset_scaler); |
1622 | 1622 | ||
1623 | i2c_attach_client(client); | 1623 | i2c_attach_client(client); |
1624 | 1624 | ||
1625 | v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", | 1625 | v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", |
1626 | saa7115_read(client, R_1E_STATUS_BYTE_1_VD_DEC), saa7115_read(client, R_1F_STATUS_BYTE_2_VD_DEC)); | 1626 | saa711x_read(client, R_1E_STATUS_BYTE_1_VD_DEC), saa7115_read(client, R_1F_STATUS_BYTE_2_VD_DEC)); |
1627 | 1627 | ||
1628 | return 0; | 1628 | return 0; |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | static int saa7115_probe(struct i2c_adapter *adapter) | 1631 | static int saa711x_probe(struct i2c_adapter *adapter) |
1632 | { | 1632 | { |
1633 | if (adapter->class & I2C_CLASS_TV_ANALOG) | 1633 | if (adapter->class & I2C_CLASS_TV_ANALOG) |
1634 | return i2c_probe(adapter, &addr_data, &saa7115_attach); | 1634 | return i2c_probe(adapter, &addr_data, &saa711x_attach); |
1635 | return 0; | 1635 | return 0; |
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | static int saa7115_detach(struct i2c_client *client) | 1638 | static int saa711x_detach(struct i2c_client *client) |
1639 | { | 1639 | { |
1640 | struct saa7115_state *state = i2c_get_clientdata(client); | 1640 | struct saa711x_state *state = i2c_get_clientdata(client); |
1641 | int err; | 1641 | int err; |
1642 | 1642 | ||
1643 | err = i2c_detach_client(client); | 1643 | err = i2c_detach_client(client); |
@@ -1653,26 +1653,26 @@ static int saa7115_detach(struct i2c_client *client) | |||
1653 | /* ----------------------------------------------------------------------- */ | 1653 | /* ----------------------------------------------------------------------- */ |
1654 | 1654 | ||
1655 | /* i2c implementation */ | 1655 | /* i2c implementation */ |
1656 | static struct i2c_driver i2c_driver_saa7115 = { | 1656 | static struct i2c_driver i2c_driver_saa711x = { |
1657 | .driver = { | 1657 | .driver = { |
1658 | .name = "saa7115", | 1658 | .name = "saa7115", |
1659 | }, | 1659 | }, |
1660 | .id = I2C_DRIVERID_SAA711X, | 1660 | .id = I2C_DRIVERID_SAA711X, |
1661 | .attach_adapter = saa7115_probe, | 1661 | .attach_adapter = saa711x_probe, |
1662 | .detach_client = saa7115_detach, | 1662 | .detach_client = saa711x_detach, |
1663 | .command = saa7115_command, | 1663 | .command = saa711x_command, |
1664 | }; | 1664 | }; |
1665 | 1665 | ||
1666 | 1666 | ||
1667 | static int __init saa7115_init_module(void) | 1667 | static int __init saa711x_init_module(void) |
1668 | { | 1668 | { |
1669 | return i2c_add_driver(&i2c_driver_saa7115); | 1669 | return i2c_add_driver(&i2c_driver_saa711x); |
1670 | } | 1670 | } |
1671 | 1671 | ||
1672 | static void __exit saa7115_cleanup_module(void) | 1672 | static void __exit saa711x_cleanup_module(void) |
1673 | { | 1673 | { |
1674 | i2c_del_driver(&i2c_driver_saa7115); | 1674 | i2c_del_driver(&i2c_driver_saa711x); |
1675 | } | 1675 | } |
1676 | 1676 | ||
1677 | module_init(saa7115_init_module); | 1677 | module_init(saa711x_init_module); |
1678 | module_exit(saa7115_cleanup_module); | 1678 | module_exit(saa711x_cleanup_module); |