Lines Matching refs:chip

28 u8 oxygen_read8(struct oxygen *chip, unsigned int reg)  in oxygen_read8()  argument
30 return inb(chip->addr + reg); in oxygen_read8()
34 u16 oxygen_read16(struct oxygen *chip, unsigned int reg) in oxygen_read16() argument
36 return inw(chip->addr + reg); in oxygen_read16()
40 u32 oxygen_read32(struct oxygen *chip, unsigned int reg) in oxygen_read32() argument
42 return inl(chip->addr + reg); in oxygen_read32()
46 void oxygen_write8(struct oxygen *chip, unsigned int reg, u8 value) in oxygen_write8() argument
48 outb(value, chip->addr + reg); in oxygen_write8()
49 chip->saved_registers._8[reg] = value; in oxygen_write8()
53 void oxygen_write16(struct oxygen *chip, unsigned int reg, u16 value) in oxygen_write16() argument
55 outw(value, chip->addr + reg); in oxygen_write16()
56 chip->saved_registers._16[reg / 2] = cpu_to_le16(value); in oxygen_write16()
60 void oxygen_write32(struct oxygen *chip, unsigned int reg, u32 value) in oxygen_write32() argument
62 outl(value, chip->addr + reg); in oxygen_write32()
63 chip->saved_registers._32[reg / 4] = cpu_to_le32(value); in oxygen_write32()
67 void oxygen_write8_masked(struct oxygen *chip, unsigned int reg, in oxygen_write8_masked() argument
70 u8 tmp = inb(chip->addr + reg); in oxygen_write8_masked()
73 outb(tmp, chip->addr + reg); in oxygen_write8_masked()
74 chip->saved_registers._8[reg] = tmp; in oxygen_write8_masked()
78 void oxygen_write16_masked(struct oxygen *chip, unsigned int reg, in oxygen_write16_masked() argument
81 u16 tmp = inw(chip->addr + reg); in oxygen_write16_masked()
84 outw(tmp, chip->addr + reg); in oxygen_write16_masked()
85 chip->saved_registers._16[reg / 2] = cpu_to_le16(tmp); in oxygen_write16_masked()
89 void oxygen_write32_masked(struct oxygen *chip, unsigned int reg, in oxygen_write32_masked() argument
92 u32 tmp = inl(chip->addr + reg); in oxygen_write32_masked()
95 outl(tmp, chip->addr + reg); in oxygen_write32_masked()
96 chip->saved_registers._32[reg / 4] = cpu_to_le32(tmp); in oxygen_write32_masked()
100 static int oxygen_ac97_wait(struct oxygen *chip, unsigned int mask) in oxygen_ac97_wait() argument
108 wait_event_timeout(chip->ac97_waitqueue, in oxygen_ac97_wait()
109 ({ status |= oxygen_read8(chip, OXYGEN_AC97_INTERRUPT_STATUS); in oxygen_ac97_wait()
116 status |= oxygen_read8(chip, OXYGEN_AC97_INTERRUPT_STATUS); in oxygen_ac97_wait()
129 void oxygen_write_ac97(struct oxygen *chip, unsigned int codec, in oxygen_write_ac97() argument
142 oxygen_write32(chip, OXYGEN_AC97_REGS, reg); in oxygen_write_ac97()
144 if (oxygen_ac97_wait(chip, OXYGEN_AC97_INT_WRITE_DONE) >= 0 && in oxygen_write_ac97()
146 chip->saved_ac97_registers[codec][index / 2] = data; in oxygen_write_ac97()
150 dev_err(chip->card->dev, "AC'97 write timeout\n"); in oxygen_write_ac97()
154 u16 oxygen_read_ac97(struct oxygen *chip, unsigned int codec, in oxygen_read_ac97() argument
166 oxygen_write32(chip, OXYGEN_AC97_REGS, reg); in oxygen_read_ac97()
168 if (oxygen_ac97_wait(chip, OXYGEN_AC97_INT_READ_DONE) >= 0) { in oxygen_read_ac97()
169 u16 value = oxygen_read16(chip, OXYGEN_AC97_REGS); in oxygen_read_ac97()
182 dev_err(chip->card->dev, "AC'97 read timeout on codec %u\n", codec); in oxygen_read_ac97()
187 void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec, in oxygen_write_ac97_masked() argument
190 u16 value = oxygen_read_ac97(chip, codec, index); in oxygen_write_ac97_masked()
193 oxygen_write_ac97(chip, codec, index, value); in oxygen_write_ac97_masked()
197 static int oxygen_wait_spi(struct oxygen *chip) in oxygen_wait_spi() argument
207 if ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & in oxygen_wait_spi()
211 dev_err(chip->card->dev, "oxygen: SPI wait timeout\n"); in oxygen_wait_spi()
215 int oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data) in oxygen_write_spi() argument
221 oxygen_write8(chip, OXYGEN_SPI_DATA1, data); in oxygen_write_spi()
222 oxygen_write8(chip, OXYGEN_SPI_DATA2, data >> 8); in oxygen_write_spi()
224 oxygen_write8(chip, OXYGEN_SPI_DATA3, data >> 16); in oxygen_write_spi()
225 oxygen_write8(chip, OXYGEN_SPI_CONTROL, control); in oxygen_write_spi()
226 return oxygen_wait_spi(chip); in oxygen_write_spi()
230 void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data) in oxygen_write_i2c() argument
235 oxygen_write8(chip, OXYGEN_2WIRE_MAP, map); in oxygen_write_i2c()
236 oxygen_write8(chip, OXYGEN_2WIRE_DATA, data); in oxygen_write_i2c()
237 oxygen_write8(chip, OXYGEN_2WIRE_CONTROL, in oxygen_write_i2c()
242 static void _write_uart(struct oxygen *chip, unsigned int port, u8 data) in _write_uart() argument
244 if (oxygen_read8(chip, OXYGEN_MPU401 + 1) & MPU401_TX_FULL) in _write_uart()
246 oxygen_write8(chip, OXYGEN_MPU401 + port, data); in _write_uart()
249 void oxygen_reset_uart(struct oxygen *chip) in oxygen_reset_uart() argument
251 _write_uart(chip, 1, MPU401_RESET); in oxygen_reset_uart()
253 _write_uart(chip, 1, MPU401_ENTER_UART); in oxygen_reset_uart()
257 void oxygen_write_uart(struct oxygen *chip, u8 data) in oxygen_write_uart() argument
259 _write_uart(chip, 0, data); in oxygen_write_uart()
263 u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index) in oxygen_read_eeprom() argument
267 oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, in oxygen_read_eeprom()
271 if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) in oxygen_read_eeprom()
275 return oxygen_read16(chip, OXYGEN_EEPROM_DATA); in oxygen_read_eeprom()
278 void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value) in oxygen_write_eeprom() argument
282 oxygen_write16(chip, OXYGEN_EEPROM_DATA, value); in oxygen_write_eeprom()
283 oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, in oxygen_write_eeprom()
287 if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) in oxygen_write_eeprom()
291 dev_err(chip->card->dev, "EEPROM write timeout\n"); in oxygen_write_eeprom()