static void hp680bl_send_intensity(struct backlight_device *bd) { unsigned long flags; u16 v; int intensity = bd->props.brightness; if (bd->props.power != FB_BLANK_UNBLANK) intensity = 0; if (bd->props.fb_blank != FB_BLANK_UNBLANK) intensity = 0; if (hp680bl_suspended) intensity = 0; spin_lock_irqsave(&bl_lock, flags); if (intensity && current_intensity == 0) { sh_dac_enable(DAC_LCD_BRIGHTNESS); v = inw(HD64461_GPBDR); v &= ~HD64461_GPBDR_LCDOFF; outw(v, HD64461_GPBDR); sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS); } else if (intensity == 0 && current_intensity != 0) { sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS); sh_dac_disable(DAC_LCD_BRIGHTNESS); v = inw(HD64461_GPBDR); v |= HD64461_GPBDR_LCDOFF; outw(v, HD64461_GPBDR); } else if (intensity) { sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS); } spin_unlock_irqrestore(&bl_lock, flags); current_intensity = intensity; }
static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle) { struct snd_sh_dac *chip = container_of(handle, struct snd_sh_dac, hrtimer); struct snd_pcm_runtime *runtime = chip->substream->runtime; ssize_t b_ps = frames_to_bytes(runtime, runtime->period_size); if (!chip->empty) { sh_dac_output(*chip->buffer_begin, chip->pdata->channel); chip->buffer_begin++; chip->processed++; if (chip->processed >= b_ps) { chip->processed -= b_ps; snd_pcm_period_elapsed(chip->substream); } if (chip->buffer_begin == (chip->data_buffer + chip->buffer_size - 1)) chip->buffer_begin = chip->data_buffer; if (chip->buffer_begin == chip->buffer_end) chip->empty = 1; } if (!chip->empty) hrtimer_start(&chip->hrtimer, chip->wakeups_per_second, HRTIMER_MODE_REL); return HRTIMER_NORESTART; }
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 void dac_audio_stop(struct dac_audio_pdata *pdata) { u16 v; u8 v8; /* HP Jornada 680/690 speaker off */ v = inw(HD64461_GPADR); v |= HD64461_GPADR_SPEAKER; outw(v, HD64461_GPADR); /* HP Palmtop 620lx/660lx speaker off */ v8 = inb(PKDR); v8 |= PKDR_SPEAKER; outb(v8, PKDR); sh_dac_output(0, pdata->channel); sh_dac_disable(pdata->channel); }
static void __init hp6xx_setup(char **cmdline_p) { u8 v8; u16 v; v = inw(HD64461_STBCR); v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST | HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST | HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST | HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST| HD64461_STBCR_SAFECKE_IST; #ifndef CONFIG_HD64461_ENABLER v |= HD64461_STBCR_SPC1ST; #endif outw(v, HD64461_STBCR); v = inw(HD64461_GPADR); v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0; outw(v, HD64461_GPADR); outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR); #ifndef CONFIG_HD64461_ENABLER outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR); #endif sh_dac_output(0, DAC_SPEAKER_VOLUME); sh_dac_disable(DAC_SPEAKER_VOLUME); v8 = __raw_readb(DACR); v8 &= ~DACR_DAE; __raw_writeb(v8,DACR); v8 = __raw_readb(SCPDR); v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y; v8 &= ~SCPDR_TS_SCAN_ENABLE; __raw_writeb(v8, SCPDR); v = __raw_readw(SCPCR); v &= ~SCPCR_TS_MASK; v |= SCPCR_TS_ENABLE; __raw_writew(v, SCPCR); }
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; }