Lines Matching refs:mgr
36 #define PCXHR_INPB(mgr, x) inb((mgr)->port[PCXHR_DSP] + (x)) argument
37 #define PCXHR_OUTPB(mgr, x, data) outb((data), (mgr)->port[PCXHR_DSP] + (x)) argument
206 static void hr222_config_akm(struct pcxhr_mgr *mgr, unsigned short data) in hr222_config_akm() argument
210 PCXHR_INPB(mgr, PCXHR_XLX_HIFREQ); in hr222_config_akm()
213 PCXHR_OUTPB(mgr, PCXHR_XLX_DATA, in hr222_config_akm()
218 PCXHR_INPB(mgr, PCXHR_XLX_RUER); in hr222_config_akm()
222 static int hr222_set_hw_playback_level(struct pcxhr_mgr *mgr, in hr222_set_hw_playback_level() argument
239 hr222_config_akm(mgr, cmd); in hr222_set_hw_playback_level()
244 static int hr222_set_hw_capture_level(struct pcxhr_mgr *mgr, in hr222_set_hw_capture_level() argument
251 if (!mgr->capture_chips) in hr222_set_hw_capture_level()
259 PCXHR_INPB(mgr, PCXHR_XLX_DATA); /* activate input codec */ in hr222_set_hw_capture_level()
262 PCXHR_OUTPB(mgr, PCXHR_XLX_DATA, in hr222_set_hw_capture_level()
265 PCXHR_INPB(mgr, PCXHR_XLX_RUER); /* close input level codec */ in hr222_set_hw_capture_level()
269 static void hr222_micro_boost(struct pcxhr_mgr *mgr, int level);
271 int hr222_sub_init(struct pcxhr_mgr *mgr) in hr222_sub_init() argument
275 mgr->board_has_analog = 1; /* analog always available */ in hr222_sub_init()
276 mgr->xlx_cfg = PCXHR_CFG_SYNCDSP_MASK; in hr222_sub_init()
278 reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS); in hr222_sub_init()
280 mgr->board_has_mic = 1; /* microphone available */ in hr222_sub_init()
281 dev_dbg(&mgr->pci->dev, in hr222_sub_init()
282 "MIC input available = %d\n", mgr->board_has_mic); in hr222_sub_init()
285 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, in hr222_sub_init()
288 mgr->dsp_reset = PCXHR_DSP_RESET_DSP | in hr222_sub_init()
291 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset); in hr222_sub_init()
296 hr222_config_akm(mgr, AKM_POWER_CONTROL_CMD); in hr222_sub_init()
297 hr222_config_akm(mgr, AKM_CLOCK_INF_55K_CMD); in hr222_sub_init()
298 hr222_config_akm(mgr, AKM_UNMUTE_CMD); in hr222_sub_init()
299 hr222_config_akm(mgr, AKM_RESET_OFF_CMD); in hr222_sub_init()
302 hr222_micro_boost(mgr, 0); in hr222_sub_init()
338 int hr222_sub_set_clock(struct pcxhr_mgr *mgr, in hr222_sub_set_clock() argument
346 switch (mgr->use_clock_type) { in hr222_sub_set_clock()
352 mgr->xlx_cfg &= ~(PCXHR_CFG_CLOCKIN_SEL_MASK | in hr222_sub_set_clock()
356 mgr->xlx_cfg |= PCXHR_CFG_CLOCKIN_SEL_MASK; in hr222_sub_set_clock()
357 mgr->xlx_cfg &= ~PCXHR_CFG_CLOCK_UER1_SEL_MASK; in hr222_sub_set_clock()
360 if (!mgr->board_has_aes1) in hr222_sub_set_clock()
363 mgr->xlx_cfg |= (PCXHR_CFG_CLOCKIN_SEL_MASK | in hr222_sub_set_clock()
369 hr222_config_akm(mgr, AKM_MUTE_CMD); in hr222_sub_set_clock()
371 if (mgr->use_clock_type == HR22_CLOCK_TYPE_INTERNAL) { in hr222_sub_set_clock()
372 PCXHR_OUTPB(mgr, PCXHR_XLX_HIFREQ, pllreg >> 8); in hr222_sub_set_clock()
373 PCXHR_OUTPB(mgr, PCXHR_XLX_LOFREQ, pllreg & 0xff); in hr222_sub_set_clock()
377 PCXHR_OUTPB(mgr, PCXHR_XLX_CFG, mgr->xlx_cfg); in hr222_sub_set_clock()
381 if (mgr->codec_speed != speed) { in hr222_sub_set_clock()
382 mgr->codec_speed = speed; in hr222_sub_set_clock()
384 hr222_config_akm(mgr, AKM_CLOCK_INF_55K_CMD); in hr222_sub_set_clock()
386 hr222_config_akm(mgr, AKM_CLOCK_SUP_55K_CMD); in hr222_sub_set_clock()
389 mgr->sample_rate_real = realfreq; in hr222_sub_set_clock()
390 mgr->cur_clock_type = mgr->use_clock_type; in hr222_sub_set_clock()
395 hr222_config_akm(mgr, AKM_UNMUTE_CMD); in hr222_sub_set_clock()
397 dev_dbg(&mgr->pci->dev, "set_clock to %dHz (realfreq=%d pllreg=%x)\n", in hr222_sub_set_clock()
402 int hr222_get_external_clock(struct pcxhr_mgr *mgr, in hr222_get_external_clock() argument
416 } else if (clock_type == HR22_CLOCK_TYPE_AES_1 && mgr->board_has_aes1) { in hr222_get_external_clock()
423 dev_dbg(&mgr->pci->dev, in hr222_get_external_clock()
429 if ((PCXHR_INPB(mgr, PCXHR_XLX_CSUER) & mask) != mask) { in hr222_get_external_clock()
430 dev_dbg(&mgr->pci->dev, in hr222_get_external_clock()
436 PCXHR_OUTPB(mgr, PCXHR_XLX_STATUS, reg); /* calculate freq */ in hr222_get_external_clock()
441 if (mgr->last_reg_stat != reg) { in hr222_get_external_clock()
443 mgr->last_reg_stat = reg; in hr222_get_external_clock()
446 PCXHR_OUTPB(mgr, PCXHR_XLX_STATUS, reg); /* save */ in hr222_get_external_clock()
449 ticks = (unsigned int)PCXHR_INPB(mgr, PCXHR_XLX_CFG); in hr222_get_external_clock()
451 ticks |= (unsigned int)PCXHR_INPB(mgr, PCXHR_DSP_RESET); in hr222_get_external_clock()
489 dev_dbg(&mgr->pci->dev, "External clock is at %d Hz (measured %d Hz)\n", in hr222_get_external_clock()
496 int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value) in hr222_read_gpio() argument
499 unsigned char reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS); in hr222_read_gpio()
503 *value = (int)(mgr->dsp_reset & PCXHR_DSP_RESET_GPO_MASK) >> in hr222_read_gpio()
510 int hr222_write_gpo(struct pcxhr_mgr *mgr, int value) in hr222_write_gpo() argument
512 unsigned char reg = mgr->dsp_reset & ~PCXHR_DSP_RESET_GPO_MASK; in hr222_write_gpo()
517 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, reg); in hr222_write_gpo()
518 mgr->dsp_reset = reg; in hr222_write_gpo()
522 int hr222_manage_timecode(struct pcxhr_mgr *mgr, int enable) in hr222_manage_timecode() argument
525 mgr->dsp_reset |= PCXHR_DSP_RESET_SMPTE; in hr222_manage_timecode()
527 mgr->dsp_reset &= ~PCXHR_DSP_RESET_SMPTE; in hr222_manage_timecode()
529 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset); in hr222_manage_timecode()
553 return hr222_set_hw_capture_level(chip->mgr, in hr222_update_analog_audio_level()
561 return hr222_set_hw_playback_level(chip->mgr, channel, vol); in hr222_update_analog_audio_level()
577 chip->mgr->xlx_cfg &= ~(PCXHR_CFG_SRC_MASK | in hr222_set_audio_source()
582 chip->mgr->xlx_cfg |= PCXHR_CFG_SRC_MASK; in hr222_set_audio_source()
589 chip->mgr->xlx_cfg |= PCXHR_CFG_DATAIN_SEL_MASK; in hr222_set_audio_source()
590 if (chip->mgr->board_has_aes1) { in hr222_set_audio_source()
592 chip->mgr->xlx_cfg |= PCXHR_CFG_DATA_UER1_SEL_MASK; in hr222_set_audio_source()
618 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_CFG, chip->mgr->xlx_cfg); in hr222_set_audio_source()
628 unsigned char mask = chip->mgr->board_has_aes1 ? in hr222_iec958_capture_byte()
632 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_RUER, idx++); /* idx < 192 */ in hr222_iec958_capture_byte()
634 if (PCXHR_INPB(chip->mgr, PCXHR_XLX_CSUER) & mask) in hr222_iec958_capture_byte()
654 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_RUER, idx); in hr222_iec958_update_byte()
656 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_CSUER, new_bits&0x01 ? in hr222_iec958_update_byte()
667 static void hr222_micro_boost(struct pcxhr_mgr *mgr, int level) in hr222_micro_boost() argument
674 mgr->xlx_selmic &= ~PCXHR_SELMIC_PREAMPLI_MASK; in hr222_micro_boost()
675 mgr->xlx_selmic |= boost_mask; in hr222_micro_boost()
677 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic); in hr222_micro_boost()
679 dev_dbg(&mgr->pci->dev, "hr222_micro_boost : set %x\n", boost_mask); in hr222_micro_boost()
682 static void hr222_phantom_power(struct pcxhr_mgr *mgr, int power) in hr222_phantom_power() argument
685 mgr->xlx_selmic |= PCXHR_SELMIC_PHANTOM_ALIM; in hr222_phantom_power()
687 mgr->xlx_selmic &= ~PCXHR_SELMIC_PHANTOM_ALIM; in hr222_phantom_power()
689 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic); in hr222_phantom_power()
691 dev_dbg(&mgr->pci->dev, "hr222_phantom_power : set %d\n", power); in hr222_phantom_power()
713 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_vol_get()
715 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_vol_get()
724 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_vol_put()
730 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_vol_put()
763 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_boost_get()
765 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_boost_get()
774 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_boost_put()
778 hr222_micro_boost(chip->mgr, chip->mic_boost); in hr222_mic_boost_put()
780 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_boost_put()
803 mutex_lock(&chip->mgr->mixer_mutex); in hr222_phantom_power_get()
805 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_phantom_power_get()
815 mutex_lock(&chip->mgr->mixer_mutex); in hr222_phantom_power_put()
818 hr222_phantom_power(chip->mgr, power); in hr222_phantom_power_put()
822 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_phantom_power_put()
838 if (!chip->mgr->board_has_mic) in hr222_add_mic_controls()