32 #include <linux/kernel.h>
33 #include <linux/slab.h>
34 #include <linux/videodev2.h>
35 #include <linux/i2c.h>
46 static int au8522_analog_debug;
52 "Analog debugging messages [0=Off (default) 1=On]");
97 #define NUM_FILTER_COEF (sizeof(filter_coef)\
98 / sizeof(struct au8522_register_config))
107 {0x060b, {0x21, 0x0b} },
108 {0x060c, {0xad, 0xad} },
109 {0x060d, {0x70, 0xf0} },
110 {0x060e, {0xea, 0xe9} },
111 {0x060f, {0xdd, 0xdd} },
112 {0x0610, {0x08, 0x64} },
113 {0x0611, {0x60, 0x60} },
114 {0x0612, {0xf8, 0xb2} },
115 {0x0613, {0x01, 0x02} },
116 {0x0614, {0xe4, 0xb4} },
117 {0x0615, {0x19, 0x02} },
118 {0x0616, {0xae, 0x2e} },
119 {0x0617, {0xee, 0xc5} },
120 {0x0618, {0x56, 0x56} },
121 {0x0619, {0x30, 0x58} },
122 {0x061a, {0xf9, 0xf8} },
123 {0x061b, {0x24, 0x64} },
124 {0x061c, {0x07, 0x07} },
125 {0x061d, {0x30, 0x30} },
126 {0x061e, {0xa9, 0xed} },
127 {0x061f, {0x09, 0x0b} },
128 {0x0620, {0x42, 0xc2} },
129 {0x0621, {0x1d, 0x2a} },
130 {0x0622, {0xd6, 0x56} },
131 {0x0623, {0x95, 0x8b} },
132 {0x0624, {0x2b, 0x2b} },
133 {0x0625, {0x30, 0x24} },
134 {0x0626, {0x3e, 0x3e} },
135 {0x0627, {0x62, 0xe2} },
136 {0x0628, {0xe9, 0xf5} },
137 {0x0629, {0x99, 0x19} },
138 {0x062a, {0xd4, 0x11} },
139 {0x062b, {0x03, 0x04} },
140 {0x062c, {0xb5, 0x85} },
141 {0x062d, {0x1e, 0x20} },
142 {0x062e, {0x2a, 0xea} },
143 {0x062f, {0xd7, 0xd2} },
144 {0x0630, {0x15, 0x15} },
145 {0x0631, {0xa3, 0xa9} },
146 {0x0632, {0x1f, 0x1f} },
147 {0x0633, {0xf9, 0xd1} },
148 {0x0634, {0xc0, 0xc3} },
149 {0x0635, {0x4d, 0x8d} },
150 {0x0636, {0x21, 0x31} },
151 {0x0637, {0x83, 0x83} },
152 {0x0638, {0x08, 0x8c} },
153 {0x0639, {0x19, 0x19} },
154 {0x063a, {0x45, 0xa5} },
155 {0x063b, {0xef, 0xec} },
156 {0x063c, {0x8a, 0x8a} },
157 {0x063d, {0xf4, 0xf6} },
158 {0x063e, {0x8f, 0x8f} },
159 {0x063f, {0x44, 0x0c} },
160 {0x0640, {0xef, 0xf0} },
161 {0x0641, {0x66, 0x66} },
162 {0x0642, {0xcc, 0xd2} },
163 {0x0643, {0x41, 0x41} },
164 {0x0644, {0x63, 0x93} },
165 {0x0645, {0x8e, 0x8e} },
166 {0x0646, {0xa2, 0x42} },
167 {0x0647, {0x7b, 0x7b} },
168 {0x0648, {0x04, 0x04} },
169 {0x0649, {0x00, 0x00} },
170 {0x064a, {0x40, 0x40} },
171 {0x064b, {0x8c, 0x98} },
172 {0x064c, {0x00, 0x00} },
173 {0x064d, {0x63, 0xc3} },
174 {0x064e, {0x04, 0x04} },
175 {0x064f, {0x20, 0x20} },
176 {0x0650, {0x00, 0x00} },
177 {0x0651, {0x40, 0x40} },
178 {0x0652, {0x01, 0x01} },
180 #define NUM_LPFILTER_COEF (sizeof(lpfilter_coef)\
181 / sizeof(struct au8522_register_config))
210 for (i = 0x30; i < 0x60; i++)
227 int filter_coef_type;
245 if (input_mode == 0x23) {
330 filter_coef_type = 5;
332 filter_coef_type = 5;
338 filter_coef[i].
reg_val[filter_coef_type]);
354 static void au8522_setup_cvbs_mode(
struct au8522_state *state)
375 static void au8522_setup_cvbs_tuner_mode(
struct au8522_state *state)
395 setup_decoder_defaults(state,
402 static void au8522_setup_svideo_mode(
struct au8522_state *state)
417 setup_decoder_defaults(state,
426 static void disable_audio_input(
struct au8522_state *state)
440 static void set_audio_input(
struct au8522_state *state,
int aud_input)
448 disable_audio_input(state);
570 #ifdef CONFIG_VIDEO_ADV_DEBUG
571 static int au8522_g_register(
struct v4l2_subdev *sd,
585 static int au8522_s_register(
struct v4l2_subdev *sd,
588 struct i2c_client *client = v4l2_get_subdevdata(sd);
655 static int au8522_s_video_routing(
struct v4l2_subdev *sd,
663 au8522_setup_cvbs_mode(state);
665 au8522_setup_svideo_mode(state);
667 au8522_setup_cvbs_tuner_mode(state);
675 static int au8522_s_audio_routing(
struct v4l2_subdev *sd,
679 set_audio_input(state, input);
691 if (lock_status == 0xa2)
706 static int au8522_g_chip_ident(
struct v4l2_subdev *sd,
710 struct i2c_client *client = v4l2_get_subdevdata(sd);
715 static int au8522_log_status(
struct v4l2_subdev *sd)
724 .log_status = au8522_log_status,
725 .g_chip_ident = au8522_g_chip_ident,
726 .g_ctrl = au8522_g_ctrl,
727 .s_ctrl = au8522_s_ctrl,
728 .queryctrl = au8522_queryctrl,
729 .reset = au8522_reset,
730 #ifdef CONFIG_VIDEO_ADV_DEBUG
731 .g_register = au8522_g_register,
732 .s_register = au8522_s_register,
737 .g_tuner = au8522_g_tuner,
741 .s_routing = au8522_s_audio_routing,
745 .s_routing = au8522_s_video_routing,
746 .s_stream = au8522_s_stream,
750 .core = &au8522_core_ops,
751 .tuner = &au8522_tuner_ops,
752 .audio = &au8522_audio_ops,
753 .video = &au8522_video_ops,
758 static int au8522_probe(
struct i2c_client *client,
767 if (!i2c_check_functionality(client->
adapter,
789 if (demod_config ==
NULL) {
796 state->
config = demod_config;
814 static int au8522_remove(
struct i2c_client *client)
816 struct v4l2_subdev *sd = i2c_get_clientdata(client);
834 .probe = au8522_probe,
835 .remove = au8522_remove,
836 .id_table = au8522_id,