static void dac_audio_reset(struct snd_sh_dac *chip) { dac_audio_stop_timer(chip); chip->buffer_begin = chip->buffer_end = chip->data_buffer; chip->processed = 0; chip->empty = 1; }
static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream) { struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); chip->substream = NULL; dac_audio_stop_timer(chip); chip->pdata->stop(chip->pdata); return 0; }
static void dac_audio_stop(void) { #ifdef MACH_HP600 u16 v; #endif dac_audio_stop_timer(); #ifdef MACH_HP600 v = inw(HD64461_GPADR); v |= HD64461_GPADR_SPEAKER; outw(v, HD64461_GPADR); #endif sh_dac_disable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); }
static void dac_audio_stop(void) { dac_audio_stop_timer(); if (mach_is_hp6xx()) { u16 v = inw(HD64461_GPADR); v |= HD64461_GPADR_SPEAKER; outw(v, HD64461_GPADR); } sh_dac_output(0, CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); sh_dac_disable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); }
static int snd_sh_dac_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); switch (cmd) { case SNDRV_PCM_TRIGGER_START: dac_audio_start_timer(chip); break; case SNDRV_PCM_TRIGGER_STOP: chip->buffer_begin = chip->buffer_end = chip->data_buffer; chip->processed = 0; chip->empty = 1; dac_audio_stop_timer(chip); break; default: return -EINVAL; } return 0; }
static irqreturn_t timer1_interrupt(int irq, void *dev, struct pt_regs *regs) { unsigned long timer_status; timer_status = ctrl_inw(TMU1_TCR); timer_status &= ~0x100; ctrl_outw(timer_status, TMU1_TCR); if (!empty) { sh_dac_output(*buffer_begin, CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); buffer_begin++; if (buffer_begin == data_buffer + BUFFER_SIZE) buffer_begin = data_buffer; if (buffer_begin == buffer_end) { empty = 1; dac_audio_stop_timer(); } } return IRQ_HANDLED; }
static void dac_audio_reset(void) { dac_audio_stop_timer(); buffer_begin = buffer_end = data_buffer; empty = 1; }