• Home
  • Raw
  • Download

Lines Matching refs:hw

31 	struct hw hw;  member
36 static u32 hw_read_20kx(struct hw *hw, u32 reg);
37 static void hw_write_20kx(struct hw *hw, u32 reg, u32 data);
38 static u32 hw_read_pci(struct hw *hw, u32 reg);
39 static void hw_write_pci(struct hw *hw, u32 reg, u32 data);
363 static int src_commit_write(struct hw *hw, unsigned int idx, void *blk) in src_commit_write() argument
371 hw_write_20kx(hw, SRCUPZ+idx*0x100+i*0x4, 0); in src_commit_write()
374 hw_write_20kx(hw, SRCDN0Z+idx*0x100+i*0x4, 0); in src_commit_write()
377 hw_write_20kx(hw, SRCDN1Z+idx*0x100+i*0x4, 0); in src_commit_write()
387 hw_write_20kx(hw, PRING_LO_HI+4*pm_idx, ctl->mpr); in src_commit_write()
388 hw_write_20kx(hw, PMOPLO+8*pm_idx, 0x3); in src_commit_write()
389 hw_write_20kx(hw, PMOPHI+8*pm_idx, 0x0); in src_commit_write()
393 hw_write_20kx(hw, SRCSA+idx*0x100, ctl->sa); in src_commit_write()
397 hw_write_20kx(hw, SRCLA+idx*0x100, ctl->la); in src_commit_write()
401 hw_write_20kx(hw, SRCCA+idx*0x100, ctl->ca); in src_commit_write()
406 hw_write_20kx(hw, SRCCF+idx*0x100, 0x0); in src_commit_write()
409 hw_write_20kx(hw, SRCCCR+idx*0x100, ctl->ccr); in src_commit_write()
413 hw_write_20kx(hw, SRCCTL+idx*0x100, ctl->ctl); in src_commit_write()
420 static int src_get_ca(struct hw *hw, unsigned int idx, void *blk) in src_get_ca() argument
424 ctl->ca = hw_read_20kx(hw, SRCCA+idx*0x100); in src_get_ca()
462 static int src_mgr_commit_write(struct hw *hw, void *blk) in src_mgr_commit_write() argument
470 ret = hw_read_20kx(hw, SRCENBSTAT); in src_mgr_commit_write()
472 hw_write_20kx(hw, SRCENBS, ctl->enbsa); in src_mgr_commit_write()
477 hw_write_20kx(hw, SRCENB+(i*0x100), ctl->enb[i]); in src_mgr_commit_write()
563 static int srcimp_mgr_commit_write(struct hw *hw, void *blk) in srcimp_mgr_commit_write() argument
568 hw_write_20kx(hw, SRCIMAP+ctl->srcimap.idx*0x100, in srcimp_mgr_commit_write()
667 static int amixer_commit_write(struct hw *hw, unsigned int idx, void *blk) in amixer_commit_write() argument
672 hw_write_20kx(hw, AMOPLO+idx*8, ctl->amoplo); in amixer_commit_write()
674 hw_write_20kx(hw, AMOPHI+idx*8, ctl->amophi); in amixer_commit_write()
882 static int dai_commit_write(struct hw *hw, unsigned int idx, void *blk) in dai_commit_write() argument
889 hw_write_20kx(hw, SRTSCTL+0x4*idx, ctl->srtctl); in dai_commit_write()
892 hw_write_20kx(hw, SRTICTL, ctl->srtctl); in dai_commit_write()
928 static int dao_commit_write(struct hw *hw, unsigned int idx, void *blk) in dao_commit_write() argument
935 hw_write_20kx(hw, SPOS+0x4*idx, ctl->spos); in dao_commit_write()
1102 static int daio_mgr_commit_write(struct hw *hw, void *blk) in daio_mgr_commit_write() argument
1115 hw_write_20kx(hw, I2SCTL, ctl->i2sctl); in daio_mgr_commit_write()
1123 hw_write_20kx(hw, SPOCTL, ctl->spoctl); in daio_mgr_commit_write()
1131 hw_write_20kx(hw, SPICTL, ctl->spictl); in daio_mgr_commit_write()
1135 hw_write_20kx(hw, DAOIMAP+ctl->daoimap.idx*4, in daio_mgr_commit_write()
1143 static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk) in daio_mgr_get_ctrl_blk() argument
1152 blk->i2sctl = hw_read_20kx(hw, I2SCTL); in daio_mgr_get_ctrl_blk()
1153 blk->spoctl = hw_read_20kx(hw, SPOCTL); in daio_mgr_get_ctrl_blk()
1154 blk->spictl = hw_read_20kx(hw, SPICTL); in daio_mgr_get_ctrl_blk()
1169 static int set_timer_irq(struct hw *hw, int enable) in set_timer_irq() argument
1171 hw_write_20kx(hw, GIE, enable ? IT_INT : 0); in set_timer_irq()
1175 static int set_timer_tick(struct hw *hw, unsigned int ticks) in set_timer_tick() argument
1179 hw_write_20kx(hw, TIMR, ticks); in set_timer_tick()
1183 static unsigned int get_wc(struct hw *hw) in get_wc() argument
1185 return hw_read_20kx(hw, WC); in get_wc()
1207 static int hw_daio_init(struct hw *hw, const struct daio_conf *info) in hw_daio_init() argument
1222 hw_write_20kx(hw, SPOCTL, 0x0); in hw_daio_init()
1243 hw_write_20kx(hw, I2SCTL, i2sorg); in hw_daio_init()
1244 hw_write_20kx(hw, SPOCTL, spdorg); in hw_daio_init()
1248 hw_write_20kx(hw, SPICTL, 0x0); in hw_daio_init()
1251 hw_write_20kx(hw, SPICTL, spdorg); in hw_daio_init()
1258 static int hw_trn_init(struct hw *hw, const struct trn_conf *info) in hw_trn_init() argument
1265 dev_err(hw->card->dev, in hw_trn_init()
1280 hw_write_20kx(hw, PTPALX, ptp_phys_low); in hw_trn_init()
1281 hw_write_20kx(hw, PTPAHX, ptp_phys_high); in hw_trn_init()
1282 hw_write_20kx(hw, TRNCTL, trnctl); in hw_trn_init()
1283 hw_write_20kx(hw, TRNIS, 0x200c01); /* really needed? */ in hw_trn_init()
1311 static int hw_pll_init(struct hw *hw, unsigned int rsr) in hw_pll_init() argument
1318 if (hw_read_20kx(hw, PLLCTL) == pllctl) in hw_pll_init()
1321 hw_write_20kx(hw, PLLCTL, pllctl); in hw_pll_init()
1325 dev_alert(hw->card->dev, "PLL initialization failed!!!\n"); in hw_pll_init()
1332 static int hw_auto_init(struct hw *hw) in hw_auto_init() argument
1337 gctl = hw_read_20kx(hw, GCTL); in hw_auto_init()
1339 hw_write_20kx(hw, GCTL, gctl); in hw_auto_init()
1341 hw_write_20kx(hw, GCTL, gctl); in hw_auto_init()
1344 gctl = hw_read_20kx(hw, GCTL); in hw_auto_init()
1349 dev_alert(hw->card->dev, "Card Auto-init failed!!!\n"); in hw_auto_init()
1356 static int i2c_unlock(struct hw *hw) in i2c_unlock() argument
1358 if ((hw_read_pci(hw, 0xcc) & 0xff) == 0xaa) in i2c_unlock()
1361 hw_write_pci(hw, 0xcc, 0x8c); in i2c_unlock()
1362 hw_write_pci(hw, 0xcc, 0x0e); in i2c_unlock()
1363 if ((hw_read_pci(hw, 0xcc) & 0xff) == 0xaa) in i2c_unlock()
1366 hw_write_pci(hw, 0xcc, 0xee); in i2c_unlock()
1367 hw_write_pci(hw, 0xcc, 0xaa); in i2c_unlock()
1368 if ((hw_read_pci(hw, 0xcc) & 0xff) == 0xaa) in i2c_unlock()
1374 static void i2c_lock(struct hw *hw) in i2c_lock() argument
1376 if ((hw_read_pci(hw, 0xcc) & 0xff) == 0xaa) in i2c_lock()
1377 hw_write_pci(hw, 0xcc, 0x00); in i2c_lock()
1380 static void i2c_write(struct hw *hw, u32 device, u32 addr, u32 data) in i2c_write() argument
1385 ret = hw_read_pci(hw, 0xEC); in i2c_write()
1387 hw_write_pci(hw, 0xE0, device); in i2c_write()
1388 hw_write_pci(hw, 0xE4, (data << 8) | (addr & 0xff)); in i2c_write()
1393 static int hw_reset_dac(struct hw *hw) in hw_reset_dac() argument
1399 if (i2c_unlock(hw)) in hw_reset_dac()
1403 ret = hw_read_pci(hw, 0xEC); in hw_reset_dac()
1405 hw_write_pci(hw, 0xEC, 0x05); /* write to i2c status control */ in hw_reset_dac()
1411 gpioorg = (u16)hw_read_20kx(hw, GPIO); in hw_reset_dac()
1413 hw_write_20kx(hw, GPIO, gpioorg); in hw_reset_dac()
1415 hw_write_20kx(hw, GPIO, gpioorg | 0x2); in hw_reset_dac()
1418 i2c_write(hw, 0x00180080, 0x01, 0x80); in hw_reset_dac()
1419 i2c_write(hw, 0x00180080, 0x02, 0x10); in hw_reset_dac()
1421 i2c_lock(hw); in hw_reset_dac()
1426 static int hw_dac_init(struct hw *hw, const struct dac_conf *info) in hw_dac_init() argument
1432 if (hw->model == CTSB055X) { in hw_dac_init()
1434 gpioorg = (u16)hw_read_20kx(hw, GPIO); in hw_dac_init()
1437 hw_write_20kx(hw, GPIO, gpioorg); in hw_dac_init()
1442 gpioorg = (u16)hw_read_20kx(hw, GPIO); in hw_dac_init()
1444 hw_write_20kx(hw, GPIO, gpioorg); in hw_dac_init()
1446 hw_reset_dac(hw); in hw_dac_init()
1448 if (i2c_unlock(hw)) in hw_dac_init()
1451 hw_write_pci(hw, 0xEC, 0x05); /* write to i2c status control */ in hw_dac_init()
1453 ret = hw_read_pci(hw, 0xEC); in hw_dac_init()
1471 i2c_write(hw, 0x00180080, 0x06, data); in hw_dac_init()
1472 i2c_write(hw, 0x00180080, 0x09, data); in hw_dac_init()
1473 i2c_write(hw, 0x00180080, 0x0c, data); in hw_dac_init()
1474 i2c_write(hw, 0x00180080, 0x0f, data); in hw_dac_init()
1476 i2c_lock(hw); in hw_dac_init()
1479 gpioorg = (u16)hw_read_20kx(hw, GPIO); in hw_dac_init()
1481 hw_write_20kx(hw, GPIO, gpioorg); in hw_dac_init()
1488 static int is_adc_input_selected_SB055x(struct hw *hw, enum ADCSRC type) in is_adc_input_selected_SB055x() argument
1493 static int is_adc_input_selected_SBx(struct hw *hw, enum ADCSRC type) in is_adc_input_selected_SBx() argument
1497 data = hw_read_20kx(hw, GPIO); in is_adc_input_selected_SBx()
1514 static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type) in is_adc_input_selected_hendrix() argument
1518 data = hw_read_20kx(hw, GPIO); in is_adc_input_selected_hendrix()
1532 static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) in hw_is_adc_input_selected() argument
1534 switch (hw->model) { in hw_is_adc_input_selected()
1536 return is_adc_input_selected_SB055x(hw, type); in hw_is_adc_input_selected()
1538 return is_adc_input_selected_hendrix(hw, type); in hw_is_adc_input_selected()
1540 return is_adc_input_selected_hendrix(hw, type); in hw_is_adc_input_selected()
1542 return is_adc_input_selected_SBx(hw, type); in hw_is_adc_input_selected()
1547 adc_input_select_SB055x(struct hw *hw, enum ADCSRC type, unsigned char boost) in adc_input_select_SB055x() argument
1560 data = hw_read_20kx(hw, GPIO); in adc_input_select_SB055x()
1580 hw_write_20kx(hw, GPIO, data); in adc_input_select_SB055x()
1587 adc_input_select_SBx(struct hw *hw, enum ADCSRC type, unsigned char boost) in adc_input_select_SBx() argument
1593 if (i2c_unlock(hw)) in adc_input_select_SBx()
1597 ret = hw_read_pci(hw, 0xEC); in adc_input_select_SBx()
1600 hw_write_pci(hw, 0xEC, 0x05); in adc_input_select_SBx()
1602 data = hw_read_20kx(hw, GPIO); in adc_input_select_SBx()
1618 i2c_lock(hw); in adc_input_select_SBx()
1621 hw_write_20kx(hw, GPIO, data); in adc_input_select_SBx()
1622 i2c_write(hw, 0x001a0080, 0x2a, i2c_data); in adc_input_select_SBx()
1624 i2c_write(hw, 0x001a0080, 0x1c, 0xe7); /* +12dB boost */ in adc_input_select_SBx()
1625 i2c_write(hw, 0x001a0080, 0x1e, 0xe7); /* +12dB boost */ in adc_input_select_SBx()
1627 i2c_write(hw, 0x001a0080, 0x1c, 0xcf); /* No boost */ in adc_input_select_SBx()
1628 i2c_write(hw, 0x001a0080, 0x1e, 0xcf); /* No boost */ in adc_input_select_SBx()
1631 i2c_lock(hw); in adc_input_select_SBx()
1637 adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost) in adc_input_select_hendrix() argument
1643 if (i2c_unlock(hw)) in adc_input_select_hendrix()
1647 ret = hw_read_pci(hw, 0xEC); in adc_input_select_hendrix()
1650 hw_write_pci(hw, 0xEC, 0x05); in adc_input_select_hendrix()
1652 data = hw_read_20kx(hw, GPIO); in adc_input_select_hendrix()
1663 i2c_lock(hw); in adc_input_select_hendrix()
1666 hw_write_20kx(hw, GPIO, data); in adc_input_select_hendrix()
1667 i2c_write(hw, 0x001a0080, 0x2a, i2c_data); in adc_input_select_hendrix()
1669 i2c_write(hw, 0x001a0080, 0x1c, 0xe7); /* +12dB boost */ in adc_input_select_hendrix()
1670 i2c_write(hw, 0x001a0080, 0x1e, 0xe7); /* +12dB boost */ in adc_input_select_hendrix()
1672 i2c_write(hw, 0x001a0080, 0x1c, 0xcf); /* No boost */ in adc_input_select_hendrix()
1673 i2c_write(hw, 0x001a0080, 0x1e, 0xcf); /* No boost */ in adc_input_select_hendrix()
1676 i2c_lock(hw); in adc_input_select_hendrix()
1681 static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) in hw_adc_input_select() argument
1685 switch (hw->model) { in hw_adc_input_select()
1687 return adc_input_select_SB055x(hw, type, state); in hw_adc_input_select()
1689 return adc_input_select_hendrix(hw, type, state); in hw_adc_input_select()
1691 return adc_input_select_hendrix(hw, type, state); in hw_adc_input_select()
1693 return adc_input_select_SBx(hw, type, state); in hw_adc_input_select()
1697 static int adc_init_SB055x(struct hw *hw, int input, int mic20db) in adc_init_SB055x() argument
1699 return adc_input_select_SB055x(hw, input, mic20db); in adc_init_SB055x()
1702 static int adc_init_SBx(struct hw *hw, int input, int mic20db) in adc_init_SBx() argument
1733 if (i2c_unlock(hw)) in adc_init_SBx()
1737 ret = hw_read_pci(hw, 0xEC); in adc_init_SBx()
1739 hw_write_pci(hw, 0xEC, 0x05); /* write to i2c status control */ in adc_init_SBx()
1741 i2c_write(hw, 0x001a0080, 0x0e, 0x08); in adc_init_SBx()
1742 i2c_write(hw, 0x001a0080, 0x18, 0x0a); in adc_init_SBx()
1743 i2c_write(hw, 0x001a0080, 0x28, 0x86); in adc_init_SBx()
1744 i2c_write(hw, 0x001a0080, 0x2a, adcdata); in adc_init_SBx()
1747 i2c_write(hw, 0x001a0080, 0x1c, 0xf7); in adc_init_SBx()
1748 i2c_write(hw, 0x001a0080, 0x1e, 0xf7); in adc_init_SBx()
1750 i2c_write(hw, 0x001a0080, 0x1c, 0xcf); in adc_init_SBx()
1751 i2c_write(hw, 0x001a0080, 0x1e, 0xcf); in adc_init_SBx()
1754 if (!(hw_read_20kx(hw, ID0) & 0x100)) in adc_init_SBx()
1755 i2c_write(hw, 0x001a0080, 0x16, 0x26); in adc_init_SBx()
1757 i2c_lock(hw); in adc_init_SBx()
1759 gpioorg = (u16)hw_read_20kx(hw, GPIO); in adc_init_SBx()
1762 hw_write_20kx(hw, GPIO, gpioorg); in adc_init_SBx()
1767 static int hw_adc_init(struct hw *hw, const struct adc_conf *info) in hw_adc_init() argument
1769 if (hw->model == CTSB055X) in hw_adc_init()
1770 return adc_init_SB055x(hw, info->input, info->mic20db); in hw_adc_init()
1772 return adc_init_SBx(hw, info->input, info->mic20db); in hw_adc_init()
1775 static struct capabilities hw_capabilities(struct hw *hw) in hw_capabilities() argument
1780 cap.digit_io_switch = !(hw->model == CTSB073X || hw->model == CTUAA); in hw_capabilities()
1883 struct hw *hw = dev_id; in ct_20k1_interrupt() local
1886 status = hw_read_20kx(hw, GIP); in ct_20k1_interrupt()
1890 if (hw->irq_callback) in ct_20k1_interrupt()
1891 hw->irq_callback(hw->irq_callback_data, status); in ct_20k1_interrupt()
1893 hw_write_20kx(hw, GIP, status); in ct_20k1_interrupt()
1897 static int hw_card_start(struct hw *hw) in hw_card_start() argument
1900 struct pci_dev *pci = hw->pci; in hw_card_start()
1915 if (!hw->io_base) { in hw_card_start()
1920 if (hw->model == CTUAA) in hw_card_start()
1921 hw->io_base = pci_resource_start(pci, 5); in hw_card_start()
1923 hw->io_base = pci_resource_start(pci, 0); in hw_card_start()
1928 if (hw->model == CTUAA) { in hw_card_start()
1935 if (hw->irq < 0) { in hw_card_start()
1937 KBUILD_MODNAME, hw); in hw_card_start()
1939 dev_err(hw->card->dev, in hw_card_start()
1943 hw->irq = pci->irq; in hw_card_start()
1952 hw->io_base = 0; in hw_card_start()
1958 static int hw_card_stop(struct hw *hw) in hw_card_stop() argument
1963 hw_write_20kx(hw, TRNCTL, 0x00); in hw_card_stop()
1966 data = hw_read_20kx(hw, PLLCTL); in hw_card_stop()
1967 hw_write_20kx(hw, PLLCTL, (data & (~(0x0F<<12)))); in hw_card_stop()
1970 if (hw->irq >= 0) in hw_card_stop()
1971 synchronize_irq(hw->irq); in hw_card_stop()
1975 static int hw_card_shutdown(struct hw *hw) in hw_card_shutdown() argument
1977 if (hw->irq >= 0) in hw_card_shutdown()
1978 free_irq(hw->irq, hw); in hw_card_shutdown()
1980 hw->irq = -1; in hw_card_shutdown()
1981 iounmap(hw->mem_base); in hw_card_shutdown()
1982 hw->mem_base = NULL; in hw_card_shutdown()
1984 if (hw->io_base) in hw_card_shutdown()
1985 pci_release_regions(hw->pci); in hw_card_shutdown()
1987 hw->io_base = 0; in hw_card_shutdown()
1989 pci_disable_device(hw->pci); in hw_card_shutdown()
1994 static int hw_card_init(struct hw *hw, struct card_conf *info) in hw_card_init() argument
2005 err = hw_card_start(hw); in hw_card_init()
2010 err = hw_pll_init(hw, info->rsr); in hw_card_init()
2015 err = hw_auto_init(hw); in hw_card_init()
2020 gctl = hw_read_20kx(hw, GCTL); in hw_card_init()
2026 hw_write_20kx(hw, GCTL, gctl); in hw_card_init()
2030 hw_write_20kx(hw, GIE, 0); in hw_card_init()
2032 hw_write_20kx(hw, SRCIP, 0); in hw_card_init()
2036 switch (hw->model) { in hw_card_init()
2038 hw_write_20kx(hw, GPIOCTL, 0x13fe); in hw_card_init()
2041 hw_write_20kx(hw, GPIOCTL, 0x00e6); in hw_card_init()
2044 hw_write_20kx(hw, GPIOCTL, 0x00c2); in hw_card_init()
2047 hw_write_20kx(hw, GPIOCTL, 0x01e6); in hw_card_init()
2052 err = hw_trn_init(hw, &trn_info); in hw_card_init()
2057 err = hw_daio_init(hw, &daio_info); in hw_card_init()
2062 err = hw_dac_init(hw, &dac_info); in hw_card_init()
2069 err = hw_adc_init(hw, &adc_info); in hw_card_init()
2073 data = hw_read_20kx(hw, SRCMCTL); in hw_card_init()
2075 hw_write_20kx(hw, SRCMCTL, data); in hw_card_init()
2081 static int hw_suspend(struct hw *hw) in hw_suspend() argument
2083 struct pci_dev *pci = hw->pci; in hw_suspend()
2085 hw_card_stop(hw); in hw_suspend()
2087 if (hw->model == CTUAA) { in hw_suspend()
2095 static int hw_resume(struct hw *hw, struct card_conf *info) in hw_resume() argument
2098 return hw_card_init(hw, info); in hw_resume()
2102 static u32 hw_read_20kx(struct hw *hw, u32 reg) in hw_read_20kx() argument
2108 &container_of(hw, struct hw20k1, hw)->reg_20k1_lock, flags); in hw_read_20kx()
2109 outl(reg, hw->io_base + 0x0); in hw_read_20kx()
2110 value = inl(hw->io_base + 0x4); in hw_read_20kx()
2112 &container_of(hw, struct hw20k1, hw)->reg_20k1_lock, flags); in hw_read_20kx()
2117 static void hw_write_20kx(struct hw *hw, u32 reg, u32 data) in hw_write_20kx() argument
2122 &container_of(hw, struct hw20k1, hw)->reg_20k1_lock, flags); in hw_write_20kx()
2123 outl(reg, hw->io_base + 0x0); in hw_write_20kx()
2124 outl(data, hw->io_base + 0x4); in hw_write_20kx()
2126 &container_of(hw, struct hw20k1, hw)->reg_20k1_lock, flags); in hw_write_20kx()
2130 static u32 hw_read_pci(struct hw *hw, u32 reg) in hw_read_pci() argument
2136 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); in hw_read_pci()
2137 outl(reg, hw->io_base + 0x10); in hw_read_pci()
2138 value = inl(hw->io_base + 0x14); in hw_read_pci()
2140 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); in hw_read_pci()
2145 static void hw_write_pci(struct hw *hw, u32 reg, u32 data) in hw_write_pci() argument
2150 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); in hw_write_pci()
2151 outl(reg, hw->io_base + 0x10); in hw_write_pci()
2152 outl(data, hw->io_base + 0x14); in hw_write_pci()
2154 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); in hw_write_pci()
2157 static const struct hw ct20k1_preset = {
2261 int create_20k1_hw_obj(struct hw **rhw) in create_20k1_hw_obj()
2273 hw20k1->hw = ct20k1_preset; in create_20k1_hw_obj()
2275 *rhw = &hw20k1->hw; in create_20k1_hw_obj()
2280 int destroy_20k1_hw_obj(struct hw *hw) in destroy_20k1_hw_obj() argument
2282 if (hw->io_base) in destroy_20k1_hw_obj()
2283 hw_card_shutdown(hw); in destroy_20k1_hw_obj()
2285 kfree(container_of(hw, struct hw20k1, hw)); in destroy_20k1_hw_obj()