Lines Matching refs:chip

20 static int vx_modify_board_clock(struct vx_core *chip, int sync)
28 return vx_send_msg(chip, &rmh);
34 static int vx_modify_board_inputs(struct vx_core *chip)
40 return vx_send_msg(chip, &rmh);
48 static int vx_read_one_cbit(struct vx_core *chip, int index)
52 mutex_lock(&chip->lock);
53 if (chip->type >= VX_TYPE_VXPOCKET) {
54 vx_outb(chip, CSUER, 1); /* read */
55 vx_outb(chip, RUER, index & XX_UER_CBITS_OFFSET_MASK);
56 val = (vx_inb(chip, RUER) >> 7) & 0x01;
58 vx_outl(chip, CSUER, 1); /* read */
59 vx_outl(chip, RUER, index & XX_UER_CBITS_OFFSET_MASK);
60 val = (vx_inl(chip, RUER) >> 7) & 0x01;
62 mutex_unlock(&chip->lock);
71 static void vx_write_one_cbit(struct vx_core *chip, int index, int val)
74 mutex_lock(&chip->lock);
75 if (vx_is_pcmcia(chip)) {
76 vx_outb(chip, CSUER, 0); /* write */
77 vx_outb(chip, RUER, (val << 7) | (index & XX_UER_CBITS_OFFSET_MASK));
79 vx_outl(chip, CSUER, 0); /* write */
80 vx_outl(chip, RUER, (val << 7) | (index & XX_UER_CBITS_OFFSET_MASK));
82 mutex_unlock(&chip->lock);
92 static int vx_read_uer_status(struct vx_core *chip, unsigned int *mode)
100 if (vx_is_pcmcia(chip))
101 val = vx_inb(chip, CSUER);
103 val = vx_inl(chip, CSUER);
122 *mode = vx_read_one_cbit(chip, 0) ?
148 static int vx_calc_clock_from_freq(struct vx_core *chip, int freq)
177 static void vx_change_clock_source(struct vx_core *chip, int source)
180 vx_toggle_dac_mute(chip, 1);
181 mutex_lock(&chip->lock);
182 chip->ops->set_clock_source(chip, source);
183 chip->clock_source = source;
184 mutex_unlock(&chip->lock);
186 vx_toggle_dac_mute(chip, 0);
193 void vx_set_internal_clock(struct vx_core *chip, unsigned int freq)
198 clock = vx_calc_clock_from_freq(chip, freq);
200 mutex_lock(&chip->lock);
201 if (vx_is_pcmcia(chip)) {
202 vx_outb(chip, HIFREQ, (clock >> 8) & 0x0f);
203 vx_outb(chip, LOFREQ, clock & 0xff);
205 vx_outl(chip, HIFREQ, (clock >> 8) & 0x0f);
206 vx_outl(chip, LOFREQ, clock & 0xff);
208 mutex_unlock(&chip->lock);
216 void vx_set_iec958_status(struct vx_core *chip, unsigned int bits)
220 if (chip->chip_status & VX_STAT_IS_STALE)
224 vx_write_one_cbit(chip, i, bits & (1 << i));
231 int vx_set_clock(struct vx_core *chip, unsigned int freq)
235 if (chip->chip_status & VX_STAT_IS_STALE)
239 vx_sync_audio_source(chip);
241 if (chip->clock_mode == VX_CLOCK_MODE_EXTERNAL ||
242 (chip->clock_mode == VX_CLOCK_MODE_AUTO &&
243 chip->audio_source == VX_AUDIO_SRC_DIGITAL)) {
244 if (chip->clock_source != UER_SYNC) {
245 vx_change_clock_source(chip, UER_SYNC);
249 } else if (chip->clock_mode == VX_CLOCK_MODE_INTERNAL ||
250 (chip->clock_mode == VX_CLOCK_MODE_AUTO &&
251 chip->audio_source != VX_AUDIO_SRC_DIGITAL)) {
252 if (chip->clock_source != INTERNAL_QUARTZ) {
253 vx_change_clock_source(chip, INTERNAL_QUARTZ);
256 if (chip->freq == freq)
258 vx_set_internal_clock(chip, freq);
260 vx_modify_board_inputs(chip);
262 if (chip->freq == freq)
264 chip->freq = freq;
265 vx_modify_board_clock(chip, 1);
273 int vx_change_frequency(struct vx_core *chip)
277 if (chip->chip_status & VX_STAT_IS_STALE)
280 if (chip->clock_source == INTERNAL_QUARTZ)
285 freq = vx_read_uer_status(chip, &chip->uer_detected);
293 chip->freq_detected = freq;