• Home
  • Raw
  • Download

Lines Matching refs:hw

26 	struct hw hw;  member
35 static u32 hw_read_20kx(struct hw *hw, u32 reg);
36 static void hw_write_20kx(struct hw *hw, u32 reg, u32 data);
359 static int src_commit_write(struct hw *hw, unsigned int idx, void *blk) in src_commit_write() argument
367 hw_write_20kx(hw, SRC_UPZ+idx*0x100+i*0x4, 0); in src_commit_write()
370 hw_write_20kx(hw, SRC_DN0Z+idx*0x100+i*0x4, 0); in src_commit_write()
373 hw_write_20kx(hw, SRC_DN1Z+idx*0x100+i*0x4, 0); in src_commit_write()
383 hw_write_20kx(hw, MIXER_PRING_LO_HI+4*pm_idx, ctl->mpr); in src_commit_write()
384 hw_write_20kx(hw, MIXER_PMOPLO+8*pm_idx, 0x3); in src_commit_write()
385 hw_write_20kx(hw, MIXER_PMOPHI+8*pm_idx, 0x0); in src_commit_write()
389 hw_write_20kx(hw, SRC_SA+idx*0x100, ctl->sa); in src_commit_write()
393 hw_write_20kx(hw, SRC_LA+idx*0x100, ctl->la); in src_commit_write()
397 hw_write_20kx(hw, SRC_CA+idx*0x100, ctl->ca); in src_commit_write()
402 hw_write_20kx(hw, SRC_CF+idx*0x100, 0x0); in src_commit_write()
405 hw_write_20kx(hw, SRC_CCR+idx*0x100, ctl->ccr); in src_commit_write()
409 hw_write_20kx(hw, SRC_CTL+idx*0x100, ctl->ctl); in src_commit_write()
416 static int src_get_ca(struct hw *hw, unsigned int idx, void *blk) in src_get_ca() argument
420 ctl->ca = hw_read_20kx(hw, SRC_CA+idx*0x100); in src_get_ca()
458 static int src_mgr_commit_write(struct hw *hw, void *blk) in src_mgr_commit_write() argument
466 ret = hw_read_20kx(hw, SRC_ENBSTAT); in src_mgr_commit_write()
468 hw_write_20kx(hw, SRC_ENBSA, ctl->enbsa); in src_mgr_commit_write()
473 hw_write_20kx(hw, SRC_ENB+(i*0x100), ctl->enb[i]); in src_mgr_commit_write()
557 static int srcimp_mgr_commit_write(struct hw *hw, void *blk) in srcimp_mgr_commit_write() argument
562 hw_write_20kx(hw, SRC_IMAP+ctl->srcimap.idx*0x100, in srcimp_mgr_commit_write()
665 static int amixer_commit_write(struct hw *hw, unsigned int idx, void *blk) in amixer_commit_write() argument
670 hw_write_20kx(hw, MIXER_AMOPLO+idx*8, ctl->amoplo); in amixer_commit_write()
672 hw_write_20kx(hw, MIXER_AMOPHI+idx*8, ctl->amophi); in amixer_commit_write()
868 static int dai_commit_write(struct hw *hw, unsigned int idx, void *blk) in dai_commit_write() argument
873 hw_write_20kx(hw, AUDIO_IO_RX_SRT_CTL+0x40*idx, ctl->srt); in dai_commit_write()
908 static int dao_commit_write(struct hw *hw, unsigned int idx, void *blk) in dao_commit_write() argument
915 hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_L+0x40*idx, in dao_commit_write()
1051 static int daio_mgr_commit_write(struct hw *hw, void *blk) in daio_mgr_commit_write() argument
1060 hw_write_20kx(hw, (AUDIO_IO_TX_CTL+(0x40*i)), data); in daio_mgr_commit_write()
1066 hw_write_20kx(hw, (AUDIO_IO_RX_CTL+(0x40*i)), data); in daio_mgr_commit_write()
1072 hw_write_20kx(hw, AUDIO_IO_AIM+ctl->daoimap.idx*4, in daio_mgr_commit_write()
1080 static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk) in daio_mgr_get_ctrl_blk() argument
1091 blk->txctl[i] = hw_read_20kx(hw, AUDIO_IO_TX_CTL+(0x40*i)); in daio_mgr_get_ctrl_blk()
1092 blk->rxctl[i] = hw_read_20kx(hw, AUDIO_IO_RX_CTL+(0x40*i)); in daio_mgr_get_ctrl_blk()
1108 static int set_timer_irq(struct hw *hw, int enable) in set_timer_irq() argument
1110 hw_write_20kx(hw, GIE, enable ? IT_INT : 0); in set_timer_irq()
1114 static int set_timer_tick(struct hw *hw, unsigned int ticks) in set_timer_tick() argument
1118 hw_write_20kx(hw, TIMR, ticks); in set_timer_tick()
1122 static unsigned int get_wc(struct hw *hw) in get_wc() argument
1124 return hw_read_20kx(hw, WC); in get_wc()
1146 static int hw_daio_init(struct hw *hw, const struct daio_conf *info) in hw_daio_init() argument
1154 hw_write_20kx(hw, AUDIO_IO_MCLK, 0x01010101); in hw_daio_init()
1155 hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x01010101); in hw_daio_init()
1156 hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); in hw_daio_init()
1158 if (hw->model != CTSB1270) { in hw_daio_init()
1159 hw_write_20kx(hw, AUDIO_IO_MCLK, 0x11111111); in hw_daio_init()
1162 hw_write_20kx(hw, AUDIO_IO_MCLK, 0x11011111); in hw_daio_init()
1173 hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x11111111); in hw_daio_init()
1174 hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); in hw_daio_init()
1175 } else if ((4 == info->msr) && (hw->model == CTSB1270)) { in hw_daio_init()
1176 hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21011111); in hw_daio_init()
1177 hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121); in hw_daio_init()
1178 hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); in hw_daio_init()
1180 dev_alert(hw->card->dev, in hw_daio_init()
1195 hw_write_20kx(hw, (AUDIO_IO_TX_CTL+(0x40*i)), data); in hw_daio_init()
1196 hw_write_20kx(hw, (AUDIO_IO_RX_CTL+(0x40*i)), data); in hw_daio_init()
1208 hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_L+(0x40*i), in hw_daio_init()
1211 hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_H+(0x40*i), 0x0B); in hw_daio_init()
1216 hw_write_20kx(hw, AUDIO_IO_RX_CTL+(0x40*i), data); in hw_daio_init()
1224 hw_write_20kx(hw, AUDIO_IO_TX_CTL+(0x40*i), data); in hw_daio_init()
1232 static int hw_trn_init(struct hw *hw, const struct trn_conf *info) in hw_trn_init() argument
1240 dev_alert(hw->card->dev, in hw_trn_init()
1252 hw_write_20kx(hw, VMEM_PTPAL+(16*i), ptp_phys_low); in hw_trn_init()
1253 hw_write_20kx(hw, VMEM_PTPAH+(16*i), ptp_phys_high); in hw_trn_init()
1256 hw_write_20kx(hw, VMEM_CTL, vmctl); in hw_trn_init()
1258 hw_write_20kx(hw, TRANSPORT_CTL, 0x03); in hw_trn_init()
1259 hw_write_20kx(hw, TRANSPORT_INT, 0x200c01); in hw_trn_init()
1261 data = hw_read_20kx(hw, TRANSPORT_ENB); in hw_trn_init()
1262 hw_write_20kx(hw, TRANSPORT_ENB, (data | 0x03)); in hw_trn_init()
1301 static int hw_pll_init(struct hw *hw, unsigned int rsr) in hw_pll_init() argument
1309 hw_write_20kx(hw, PLL_ENB, pllenb); in hw_pll_init()
1314 hw_write_20kx(hw, PLL_CTL, pllctl); in hw_pll_init()
1317 pllctl = hw_read_20kx(hw, PLL_CTL); in hw_pll_init()
1319 hw_write_20kx(hw, PLL_CTL, pllctl); in hw_pll_init()
1323 pllstat = hw_read_20kx(hw, PLL_STAT); in hw_pll_init()
1346 dev_alert(hw->card->dev, in hw_pll_init()
1354 static int hw_auto_init(struct hw *hw) in hw_auto_init() argument
1359 gctl = hw_read_20kx(hw, GLOBAL_CNTL_GCTL); in hw_auto_init()
1361 hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); in hw_auto_init()
1363 hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); in hw_auto_init()
1366 gctl = hw_read_20kx(hw, GLOBAL_CNTL_GCTL); in hw_auto_init()
1371 dev_alert(hw->card->dev, "Card Auto-init failed!!!\n"); in hw_auto_init()
1439 static int hw20k2_i2c_unlock_full_access(struct hw *hw) in hw20k2_i2c_unlock_full_access() argument
1444 hw_write_20kx(hw, I2C_IF_WLOCK, in hw20k2_i2c_unlock_full_access()
1446 hw_write_20kx(hw, I2C_IF_WLOCK, in hw20k2_i2c_unlock_full_access()
1449 if (hw_read_20kx(hw, I2C_IF_WLOCK) == STATE_UNLOCKED) in hw20k2_i2c_unlock_full_access()
1455 static int hw20k2_i2c_lock_chip(struct hw *hw) in hw20k2_i2c_lock_chip() argument
1458 hw_write_20kx(hw, I2C_IF_WLOCK, STATE_LOCKED); in hw20k2_i2c_lock_chip()
1459 hw_write_20kx(hw, I2C_IF_WLOCK, STATE_LOCKED); in hw20k2_i2c_lock_chip()
1460 if (hw_read_20kx(hw, I2C_IF_WLOCK) == STATE_LOCKED) in hw20k2_i2c_lock_chip()
1466 static int hw20k2_i2c_init(struct hw *hw, u8 dev_id, u8 addr_size, u8 data_size) in hw20k2_i2c_init() argument
1468 struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; in hw20k2_i2c_init()
1473 err = hw20k2_i2c_unlock_full_access(hw); in hw20k2_i2c_init()
1484 hw_write_20kx(hw, I2C_IF_ADDRESS, i2c_addr); in hw20k2_i2c_init()
1486 i2c_status = hw_read_20kx(hw, I2C_IF_STATUS); in hw20k2_i2c_init()
1490 hw_write_20kx(hw, I2C_IF_STATUS, i2c_status); in hw20k2_i2c_init()
1495 static int hw20k2_i2c_uninit(struct hw *hw) in hw20k2_i2c_uninit() argument
1503 hw_write_20kx(hw, I2C_IF_ADDRESS, i2c_addr); in hw20k2_i2c_uninit()
1505 i2c_status = hw_read_20kx(hw, I2C_IF_STATUS); in hw20k2_i2c_uninit()
1509 hw_write_20kx(hw, I2C_IF_STATUS, i2c_status); in hw20k2_i2c_uninit()
1511 return hw20k2_i2c_lock_chip(hw); in hw20k2_i2c_uninit()
1514 static int hw20k2_i2c_wait_data_ready(struct hw *hw) in hw20k2_i2c_wait_data_ready() argument
1520 ret = hw_read_20kx(hw, I2C_IF_STATUS); in hw20k2_i2c_wait_data_ready()
1526 static int hw20k2_i2c_read(struct hw *hw, u16 addr, u32 *datap) in hw20k2_i2c_read() argument
1528 struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; in hw20k2_i2c_read()
1531 i2c_status = hw_read_20kx(hw, I2C_IF_STATUS); in hw20k2_i2c_read()
1534 hw_write_20kx(hw, I2C_IF_STATUS, i2c_status); in hw20k2_i2c_read()
1535 if (!hw20k2_i2c_wait_data_ready(hw)) in hw20k2_i2c_read()
1538 hw_write_20kx(hw, I2C_IF_WDATA, addr); in hw20k2_i2c_read()
1539 if (!hw20k2_i2c_wait_data_ready(hw)) in hw20k2_i2c_read()
1543 hw_write_20kx(hw, I2C_IF_RDATA, 0); in hw20k2_i2c_read()
1544 if (!hw20k2_i2c_wait_data_ready(hw)) in hw20k2_i2c_read()
1547 *datap = hw_read_20kx(hw, I2C_IF_RDATA); in hw20k2_i2c_read()
1552 static int hw20k2_i2c_write(struct hw *hw, u16 addr, u32 data) in hw20k2_i2c_write() argument
1554 struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; in hw20k2_i2c_write()
1558 i2c_status = hw_read_20kx(hw, I2C_IF_STATUS); in hw20k2_i2c_write()
1564 hw_write_20kx(hw, I2C_IF_STATUS, i2c_status); in hw20k2_i2c_write()
1565 hw20k2_i2c_wait_data_ready(hw); in hw20k2_i2c_write()
1567 hw_write_20kx(hw, I2C_IF_WDATA, 0); in hw20k2_i2c_write()
1568 hw20k2_i2c_wait_data_ready(hw); in hw20k2_i2c_write()
1571 hw_write_20kx(hw, I2C_IF_WDATA, i2c_data); in hw20k2_i2c_write()
1572 hw20k2_i2c_wait_data_ready(hw); in hw20k2_i2c_write()
1577 static void hw_dac_stop(struct hw *hw) in hw_dac_stop() argument
1580 data = hw_read_20kx(hw, GPIO_DATA); in hw_dac_stop()
1582 hw_write_20kx(hw, GPIO_DATA, data); in hw_dac_stop()
1586 static void hw_dac_start(struct hw *hw) in hw_dac_start() argument
1589 data = hw_read_20kx(hw, GPIO_DATA); in hw_dac_start()
1591 hw_write_20kx(hw, GPIO_DATA, data); in hw_dac_start()
1595 static void hw_dac_reset(struct hw *hw) in hw_dac_reset() argument
1597 hw_dac_stop(hw); in hw_dac_reset()
1598 hw_dac_start(hw); in hw_dac_reset()
1601 static int hw_dac_init(struct hw *hw, const struct dac_conf *info) in hw_dac_init() argument
1627 if (hw->model == CTSB1270) { in hw_dac_init()
1628 hw_dac_stop(hw); in hw_dac_init()
1629 data = hw_read_20kx(hw, GPIO_DATA); in hw_dac_init()
1637 hw_write_20kx(hw, GPIO_DATA, data); in hw_dac_init()
1638 hw_dac_start(hw); in hw_dac_init()
1643 data = hw_read_20kx(hw, GPIO_CTRL); in hw_dac_init()
1645 hw_write_20kx(hw, GPIO_CTRL, data); in hw_dac_init()
1647 err = hw20k2_i2c_init(hw, 0x18, 1, 1); in hw_dac_init()
1654 hw_dac_reset(hw); in hw_dac_init()
1655 hw_dac_reset(hw); in hw_dac_init()
1657 if (hw20k2_i2c_read(hw, CS4382_MC1, &cs_read.mode_control_1)) in hw_dac_init()
1660 if (hw20k2_i2c_read(hw, CS4382_MC2, &cs_read.mode_control_2)) in hw_dac_init()
1663 if (hw20k2_i2c_read(hw, CS4382_MC3, &cs_read.mode_control_3)) in hw_dac_init()
1666 if (hw20k2_i2c_read(hw, CS4382_FC, &cs_read.filter_control)) in hw_dac_init()
1669 if (hw20k2_i2c_read(hw, CS4382_IC, &cs_read.invert_control)) in hw_dac_init()
1672 if (hw20k2_i2c_read(hw, CS4382_XC1, &cs_read.mix_control_P1)) in hw_dac_init()
1675 if (hw20k2_i2c_read(hw, CS4382_VCA1, &cs_read.vol_control_A1)) in hw_dac_init()
1678 if (hw20k2_i2c_read(hw, CS4382_VCB1, &cs_read.vol_control_B1)) in hw_dac_init()
1681 if (hw20k2_i2c_read(hw, CS4382_XC2, &cs_read.mix_control_P2)) in hw_dac_init()
1684 if (hw20k2_i2c_read(hw, CS4382_VCA2, &cs_read.vol_control_A2)) in hw_dac_init()
1687 if (hw20k2_i2c_read(hw, CS4382_VCB2, &cs_read.vol_control_B2)) in hw_dac_init()
1690 if (hw20k2_i2c_read(hw, CS4382_XC3, &cs_read.mix_control_P3)) in hw_dac_init()
1693 if (hw20k2_i2c_read(hw, CS4382_VCA3, &cs_read.vol_control_A3)) in hw_dac_init()
1696 if (hw20k2_i2c_read(hw, CS4382_VCB3, &cs_read.vol_control_B3)) in hw_dac_init()
1699 if (hw20k2_i2c_read(hw, CS4382_XC4, &cs_read.mix_control_P4)) in hw_dac_init()
1702 if (hw20k2_i2c_read(hw, CS4382_VCA4, &cs_read.vol_control_A4)) in hw_dac_init()
1705 if (hw20k2_i2c_read(hw, CS4382_VCB4, &cs_read.vol_control_B4)) in hw_dac_init()
1719 hw20k2_i2c_write(hw, CS4382_MC1, 0x80); in hw_dac_init()
1720 hw20k2_i2c_write(hw, CS4382_MC2, 0x10); in hw_dac_init()
1722 hw20k2_i2c_write(hw, CS4382_XC1, 0x24); in hw_dac_init()
1723 hw20k2_i2c_write(hw, CS4382_XC2, 0x24); in hw_dac_init()
1724 hw20k2_i2c_write(hw, CS4382_XC3, 0x24); in hw_dac_init()
1725 hw20k2_i2c_write(hw, CS4382_XC4, 0x24); in hw_dac_init()
1727 hw20k2_i2c_write(hw, CS4382_XC1, 0x25); in hw_dac_init()
1728 hw20k2_i2c_write(hw, CS4382_XC2, 0x25); in hw_dac_init()
1729 hw20k2_i2c_write(hw, CS4382_XC3, 0x25); in hw_dac_init()
1730 hw20k2_i2c_write(hw, CS4382_XC4, 0x25); in hw_dac_init()
1732 hw20k2_i2c_write(hw, CS4382_XC1, 0x26); in hw_dac_init()
1733 hw20k2_i2c_write(hw, CS4382_XC2, 0x26); in hw_dac_init()
1734 hw20k2_i2c_write(hw, CS4382_XC3, 0x26); in hw_dac_init()
1735 hw20k2_i2c_write(hw, CS4382_XC4, 0x26); in hw_dac_init()
1741 hw20k2_i2c_uninit(hw); in hw_dac_init()
1756 static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) in hw_is_adc_input_selected() argument
1759 if (hw->model == CTSB1270) { in hw_is_adc_input_selected()
1764 data = hw_read_20kx(hw, GPIO_DATA); in hw_is_adc_input_selected()
1781 static void hw_wm8775_input_select(struct hw *hw, u8 input, s8 gain_in_db) in hw_wm8775_input_select() argument
1790 hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, adcmc), in hw_wm8775_input_select()
1800 hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, gain), in hw_wm8775_input_select()
1803 hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, gain), in hw_wm8775_input_select()
1807 static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) in hw_adc_input_select() argument
1810 data = hw_read_20kx(hw, GPIO_DATA); in hw_adc_input_select()
1814 hw_write_20kx(hw, GPIO_DATA, data); in hw_adc_input_select()
1815 hw_wm8775_input_select(hw, 0, 20); /* Mic, 20dB */ in hw_adc_input_select()
1819 hw_write_20kx(hw, GPIO_DATA, data); in hw_adc_input_select()
1820 hw_wm8775_input_select(hw, 1, 0); /* Line-in, 0dB */ in hw_adc_input_select()
1829 static int hw_adc_init(struct hw *hw, const struct adc_conf *info) in hw_adc_init() argument
1835 data = hw_read_20kx(hw, GPIO_CTRL); in hw_adc_init()
1837 hw_write_20kx(hw, GPIO_CTRL, data); in hw_adc_init()
1840 err = hw20k2_i2c_init(hw, 0x1A, 1, 1); in hw_adc_init()
1842 dev_alert(hw->card->dev, "Failure to acquire I2C!!!\n"); in hw_adc_init()
1847 data = hw_read_20kx(hw, GPIO_DATA); in hw_adc_init()
1849 hw_write_20kx(hw, GPIO_DATA, data); in hw_adc_init()
1851 if (hw->model == CTSB1270) { in hw_adc_init()
1860 hw_write_20kx(hw, GPIO_DATA, data); in hw_adc_init()
1866 hw_write_20kx(hw, GPIO_DATA, data); in hw_adc_init()
1872 hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_IC, 0x26), in hw_adc_init()
1878 hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x02), in hw_adc_init()
1882 hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x0A), in hw_adc_init()
1885 dev_alert(hw->card->dev, in hw_adc_init()
1892 if (hw->model != CTSB1270) { in hw_adc_init()
1894 ctl = hw_read_20kx(hw, GPIO_CTRL); in hw_adc_init()
1896 hw_write_20kx(hw, GPIO_CTRL, ctl); in hw_adc_init()
1897 hw_adc_input_select(hw, ADC_LINEIN); in hw_adc_init()
1899 hw_wm8775_input_select(hw, 0, 0); in hw_adc_init()
1904 hw20k2_i2c_uninit(hw); in hw_adc_init()
1908 static struct capabilities hw_capabilities(struct hw *hw) in hw_capabilities() argument
1913 cap.dedicated_mic = hw->model == CTSB1270; in hw_capabilities()
1914 cap.output_switch = hw->model == CTSB1270; in hw_capabilities()
1915 cap.mic_source_switch = hw->model == CTSB1270; in hw_capabilities()
1920 static int hw_output_switch_get(struct hw *hw) in hw_output_switch_get() argument
1922 u32 data = hw_read_20kx(hw, GPIO_EXT_DATA); in hw_output_switch_get()
1936 static int hw_output_switch_put(struct hw *hw, int position) in hw_output_switch_put() argument
1940 if (position == hw_output_switch_get(hw)) in hw_output_switch_put()
1944 data = hw_read_20kx(hw, GPIO_DATA); in hw_output_switch_put()
1946 hw_write_20kx(hw, GPIO_DATA, data); in hw_output_switch_put()
1948 data = hw_read_20kx(hw, GPIO_EXT_DATA) & ~0x30; in hw_output_switch_put()
1958 hw_write_20kx(hw, GPIO_EXT_DATA, data); in hw_output_switch_put()
1961 data = hw_read_20kx(hw, GPIO_DATA); in hw_output_switch_put()
1963 hw_write_20kx(hw, GPIO_DATA, data); in hw_output_switch_put()
1968 static int hw_mic_source_switch_get(struct hw *hw) in hw_mic_source_switch_get() argument
1970 struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; in hw_mic_source_switch_get()
1975 static int hw_mic_source_switch_put(struct hw *hw, int position) in hw_mic_source_switch_put() argument
1977 struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; in hw_mic_source_switch_put()
1984 hw_wm8775_input_select(hw, 0, 0); /* Mic, 0dB */ in hw_mic_source_switch_put()
1987 hw_wm8775_input_select(hw, 1, 0); /* FP Mic, 0dB */ in hw_mic_source_switch_put()
1990 hw_wm8775_input_select(hw, 3, 0); /* Aux Ext, 0dB */ in hw_mic_source_switch_put()
2003 struct hw *hw = dev_id; in ct_20k2_interrupt() local
2006 status = hw_read_20kx(hw, GIP); in ct_20k2_interrupt()
2010 if (hw->irq_callback) in ct_20k2_interrupt()
2011 hw->irq_callback(hw->irq_callback_data, status); in ct_20k2_interrupt()
2013 hw_write_20kx(hw, GIP, status); in ct_20k2_interrupt()
2017 static int hw_card_start(struct hw *hw) in hw_card_start() argument
2020 struct pci_dev *pci = hw->pci; in hw_card_start()
2032 if (!hw->io_base) { in hw_card_start()
2037 hw->io_base = pci_resource_start(hw->pci, 2); in hw_card_start()
2038 hw->mem_base = ioremap(hw->io_base, in hw_card_start()
2039 pci_resource_len(hw->pci, 2)); in hw_card_start()
2040 if (!hw->mem_base) { in hw_card_start()
2047 gctl = hw_read_20kx(hw, GLOBAL_CNTL_GCTL); in hw_card_start()
2049 hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); in hw_card_start()
2051 if (hw->irq < 0) { in hw_card_start()
2053 KBUILD_MODNAME, hw); in hw_card_start()
2055 dev_err(hw->card->dev, in hw_card_start()
2059 hw->irq = pci->irq; in hw_card_start()
2060 hw->card->sync_irq = hw->irq; in hw_card_start()
2072 hw->io_base = 0; in hw_card_start()
2078 static int hw_card_stop(struct hw *hw) in hw_card_stop() argument
2083 hw_write_20kx(hw, TRANSPORT_CTL, 0x00); in hw_card_stop()
2086 data = hw_read_20kx(hw, PLL_ENB); in hw_card_stop()
2087 hw_write_20kx(hw, PLL_ENB, (data & (~0x07))); in hw_card_stop()
2093 static int hw_card_shutdown(struct hw *hw) in hw_card_shutdown() argument
2095 if (hw->irq >= 0) in hw_card_shutdown()
2096 free_irq(hw->irq, hw); in hw_card_shutdown()
2098 hw->irq = -1; in hw_card_shutdown()
2099 iounmap(hw->mem_base); in hw_card_shutdown()
2100 hw->mem_base = NULL; in hw_card_shutdown()
2102 if (hw->io_base) in hw_card_shutdown()
2103 pci_release_regions(hw->pci); in hw_card_shutdown()
2105 hw->io_base = 0; in hw_card_shutdown()
2107 pci_disable_device(hw->pci); in hw_card_shutdown()
2112 static int hw_card_init(struct hw *hw, struct card_conf *info) in hw_card_init() argument
2124 err = hw_card_start(hw); in hw_card_init()
2129 err = hw_pll_init(hw, info->rsr); in hw_card_init()
2134 err = hw_auto_init(hw); in hw_card_init()
2138 gctl = hw_read_20kx(hw, GLOBAL_CNTL_GCTL); in hw_card_init()
2143 hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); in hw_card_init()
2146 hw_write_20kx(hw, GIE, 0); in hw_card_init()
2148 hw_write_20kx(hw, SRC_IP, 0); in hw_card_init()
2150 if (hw->model != CTSB1270) { in hw_card_init()
2156 hw_write_20kx(hw, GPIO_CTRL, 0xD802); in hw_card_init()
2158 hw_write_20kx(hw, GPIO_CTRL, 0x9E5F); in hw_card_init()
2161 hw_write_20kx(hw, MIXER_AR_ENABLE, 0x01); in hw_card_init()
2164 err = hw_trn_init(hw, &trn_info); in hw_card_init()
2169 err = hw_daio_init(hw, &daio_info); in hw_card_init()
2174 err = hw_dac_init(hw, &dac_info); in hw_card_init()
2181 err = hw_adc_init(hw, &adc_info); in hw_card_init()
2185 data = hw_read_20kx(hw, SRC_MCTL); in hw_card_init()
2187 hw_write_20kx(hw, SRC_MCTL, data); in hw_card_init()
2193 static int hw_suspend(struct hw *hw) in hw_suspend() argument
2195 hw_card_stop(hw); in hw_suspend()
2199 static int hw_resume(struct hw *hw, struct card_conf *info) in hw_resume() argument
2202 return hw_card_init(hw, info); in hw_resume()
2206 static u32 hw_read_20kx(struct hw *hw, u32 reg) in hw_read_20kx() argument
2208 return readl(hw->mem_base + reg); in hw_read_20kx()
2211 static void hw_write_20kx(struct hw *hw, u32 reg, u32 data) in hw_write_20kx() argument
2213 writel(data, hw->mem_base + reg); in hw_write_20kx()
2216 static const struct hw ct20k2_preset = {
2324 int create_20k2_hw_obj(struct hw **rhw) in create_20k2_hw_obj()
2333 hw20k2->hw = ct20k2_preset; in create_20k2_hw_obj()
2334 *rhw = &hw20k2->hw; in create_20k2_hw_obj()
2339 int destroy_20k2_hw_obj(struct hw *hw) in destroy_20k2_hw_obj() argument
2341 if (hw->io_base) in destroy_20k2_hw_obj()
2342 hw_card_shutdown(hw); in destroy_20k2_hw_obj()
2344 kfree(hw); in destroy_20k2_hw_obj()