Lines Matching +full:switch +full:- +full:mode +full:- +full:frequency

1 // SPDX-License-Identifier: GPL-2.0-or-later
17 * vx_modify_board_clock - tell the board that its clock has been modified
32 * vx_modify_board_inputs - resync audio inputs
44 * vx_read_one_cbit - read one bit from UER config
52 mutex_lock(&chip->lock); in vx_read_one_cbit()
53 if (chip->type >= VX_TYPE_VXPOCKET) { in vx_read_one_cbit()
62 mutex_unlock(&chip->lock); in vx_read_one_cbit()
67 * vx_write_one_cbit - write one bit to UER config
74 mutex_lock(&chip->lock); in vx_write_one_cbit()
82 mutex_unlock(&chip->lock); in vx_write_one_cbit()
86 * vx_read_uer_status - read the current UER status
87 * @mode: pointer to store the UER mode, VX_UER_MODE_XXX
89 * returns the frequency of UER, or 0 if not sync,
92 static int vx_read_uer_status(struct vx_core *chip, unsigned int *mode) in vx_read_uer_status() argument
106 /* If clock is present, read frequency */ in vx_read_uer_status()
108 switch (val & VX_SUER_FREQ_MASK) { in vx_read_uer_status()
122 *mode = vx_read_one_cbit(chip, 0) ? in vx_read_uer_status()
125 *mode = VX_UER_MODE_NOT_PRESENT; in vx_read_uer_status()
132 * compute the sample clock value from frequency
136 * HexFreq = (dword) ((double) ((double) 28224000 / (double) Frequency))
137 * switch ( HexFreq & 0x00000F00 )
140 * case 0x00000300: HexFreq -= 0x00000201 ;
144 * case 0x00000700: HexFreq = (dword) (((double) 28224000 / (double) (Frequency*2)) - 1)
145 * default : HexFreq = (dword) ((double) 28224000 / (double) (Frequency*4)) - 0x000001FF
163 return hexfreq - 0x00000201; in vx_calc_clock_from_freq()
165 return (hexfreq / 2) - 1; in vx_calc_clock_from_freq()
174 * vx_change_clock_source - change the clock source
181 mutex_lock(&chip->lock); in vx_change_clock_source()
182 chip->ops->set_clock_source(chip, source); in vx_change_clock_source()
183 chip->clock_source = source; in vx_change_clock_source()
184 mutex_unlock(&chip->lock); in vx_change_clock_source()
199 dev_dbg(chip->card->dev, in vx_set_internal_clock()
201 mutex_lock(&chip->lock); in vx_set_internal_clock()
209 mutex_unlock(&chip->lock); in vx_set_internal_clock()
215 * @bits: 32-bit status bits
221 if (chip->chip_status & VX_STAT_IS_STALE) in vx_set_iec958_status()
230 * vx_set_clock - change the clock and audio source if necessary
236 if (chip->chip_status & VX_STAT_IS_STALE) in vx_set_clock()
242 if (chip->clock_mode == VX_CLOCK_MODE_EXTERNAL || in vx_set_clock()
243 (chip->clock_mode == VX_CLOCK_MODE_AUTO && in vx_set_clock()
244 chip->audio_source == VX_AUDIO_SRC_DIGITAL)) { in vx_set_clock()
245 if (chip->clock_source != UER_SYNC) { in vx_set_clock()
250 } else if (chip->clock_mode == VX_CLOCK_MODE_INTERNAL || in vx_set_clock()
251 (chip->clock_mode == VX_CLOCK_MODE_AUTO && in vx_set_clock()
252 chip->audio_source != VX_AUDIO_SRC_DIGITAL)) { in vx_set_clock()
253 if (chip->clock_source != INTERNAL_QUARTZ) { in vx_set_clock()
257 if (chip->freq == freq) in vx_set_clock()
263 if (chip->freq == freq) in vx_set_clock()
265 chip->freq = freq; in vx_set_clock()
272 * vx_change_frequency - called from interrupt handler
278 if (chip->chip_status & VX_STAT_IS_STALE) in vx_change_frequency()
281 if (chip->clock_source == INTERNAL_QUARTZ) in vx_change_frequency()
284 * Read the real UER board frequency in vx_change_frequency()
286 freq = vx_read_uer_status(chip, &chip->uer_detected); in vx_change_frequency()
290 * The frequency computed by the DSP is good and in vx_change_frequency()
294 chip->freq_detected = freq; in vx_change_frequency()