static int init_chip(void) { unsigned short val; static int initialized; if (initialized) return 0; pxa2xx_ac97_init(); /* * Check that the is codec connected to ac97 bus is WM9713L */ val = pxa2xx_ac97_read(0, AC97_VENDOR_ID1); if (val != WM9713L_VENDOR_ID_1) return -ENODEV; val = pxa2xx_ac97_read(0, AC97_VENDOR_ID2); if (val != WM9713L_VENDOR_ID_2) return -ENODEV; pxa2xx_ac97_write(0, AC97_POWERDOWN, 0x000); initialized = 1; return 0; }
static unsigned short ts_get_sample_1(unsigned short reg) { unsigned long wait; unsigned short v; pxa2xx_ac97_write(0, WM9713L_DIGITIZER_1_WM13, reg); wait = 0; do { v = pxa2xx_ac97_read(0, WM9713L_DIGITIZER_1_WM13); if ( !(v & 0x200 ) ) break; } while ( 100 > wait++ ); return pxa2xx_ac97_read(0, WM9713L_DIGITIZER_READ_BACK); }
static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97, unsigned short reg) { int ret; ret = pxa2xx_ac97_read(ac97->num, reg); if (ret < 0) return 0; else return (unsigned short)(ret & 0xffff); }
int snd_wm9713l_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) { int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; int mask = (kcontrol->private_value >> 16) & 0xff; int invert = (kcontrol->private_value >> 24) & 0x01; unsigned short val; val = pxa2xx_ac97_read(0, reg); ucontrol->value.integer.value[0] = (val >> shift) & mask; if (invert) ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; return 0; }
static int snd_wm9713l_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) { int reg = kcontrol->private_value & 0xff; int shift_left = (kcontrol->private_value >> 8) & 0x0f; int shift_right = (kcontrol->private_value >> 12) & 0x0f; int mask = (kcontrol->private_value >> 16) & 0xff; int invert = (kcontrol->private_value >> 24) & 0xff; unsigned short val; val = pxa2xx_ac97_read(0, reg); ucontrol->value.integer.value[0] = (val >> shift_left) & mask; ucontrol->value.integer.value[1] = (val >> shift_right) & mask; if (invert) { ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1]; } return 0; }
void pxa3xx_wm9713l_ts_irq_reset(void) { unsigned short v; v = pxa2xx_ac97_read(0, WM9713L_GPIO_PIN_STATUS); pxa2xx_ac97_write(0, WM9713L_GPIO_PIN_STATUS, v & ~((1<<13)|(1<<2))); }