aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-05 10:34:10 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-05 10:44:24 -0400
commit2a36f67f8c81f0babda0e811c760b7bfa971010b (patch)
treeef95d02a3b468132f83f0a63077b4f33d3cff2a7 /sound
parent775ffa1d3e5a550dd2c9d947d773021c61531b36 (diff)
ALSA: ctxfi - Clean up / optimize
- Use static tables instead of assigining each funciton pointer - Add __devinit* to appropriate places; pcm, mixer and timer cannot be marked because they are kept in the function table that lives long - Move create_alsa_devs function out of struct ct_atc to mark it __devinit Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ctxfi/ctatc.c82
-rw-r--r--sound/pci/ctxfi/ctatc.h3
-rw-r--r--sound/pci/ctxfi/cthardware.c4
-rw-r--r--sound/pci/ctxfi/cthw20k1.c205
-rw-r--r--sound/pci/ctxfi/cthw20k2.c195
-rw-r--r--sound/pci/ctxfi/xfi.c2
6 files changed, 243 insertions, 248 deletions
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index 10b741977dd7..9b1324544db0 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -1202,7 +1202,7 @@ static int atc_dev_free(struct snd_device *dev)
1202 return ct_atc_destroy(atc); 1202 return ct_atc_destroy(atc);
1203} 1203}
1204 1204
1205static int atc_identify_card(struct ct_atc *atc) 1205static int __devinit atc_identify_card(struct ct_atc *atc)
1206{ 1206{
1207 u16 subsys; 1207 u16 subsys;
1208 u8 revision; 1208 u8 revision;
@@ -1243,7 +1243,7 @@ static int atc_identify_card(struct ct_atc *atc)
1243 return 0; 1243 return 0;
1244} 1244}
1245 1245
1246static int ct_create_alsa_devs(struct ct_atc *atc) 1246int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc)
1247{ 1247{
1248 enum CTALSADEVS i; 1248 enum CTALSADEVS i;
1249 struct hw *hw = atc->hw; 1249 struct hw *hw = atc->hw;
@@ -1277,7 +1277,7 @@ static int ct_create_alsa_devs(struct ct_atc *atc)
1277 return 0; 1277 return 0;
1278} 1278}
1279 1279
1280static int atc_create_hw_devs(struct ct_atc *atc) 1280static int __devinit atc_create_hw_devs(struct ct_atc *atc)
1281{ 1281{
1282 struct hw *hw = NULL; 1282 struct hw *hw = NULL;
1283 struct card_conf info = {0}; 1283 struct card_conf info = {0};
@@ -1313,7 +1313,7 @@ static int atc_create_hw_devs(struct ct_atc *atc)
1313 return 0; 1313 return 0;
1314} 1314}
1315 1315
1316static int atc_get_resources(struct ct_atc *atc) 1316static int __devinit atc_get_resources(struct ct_atc *atc)
1317{ 1317{
1318 struct daio_desc da_desc = {0}; 1318 struct daio_desc da_desc = {0};
1319 struct daio_mgr *daio_mgr = NULL; 1319 struct daio_mgr *daio_mgr = NULL;
@@ -1423,7 +1423,7 @@ static int atc_get_resources(struct ct_atc *atc)
1423 return 0; 1423 return 0;
1424} 1424}
1425 1425
1426static void 1426static void __devinit
1427atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai, 1427atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai,
1428 struct src **srcs, struct srcimp **srcimps) 1428 struct src **srcs, struct srcimp **srcimps)
1429{ 1429{
@@ -1462,7 +1462,7 @@ atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai,
1462 src_mgr->commit_write(src_mgr); /* Synchronously enable SRCs */ 1462 src_mgr->commit_write(src_mgr); /* Synchronously enable SRCs */
1463} 1463}
1464 1464
1465static void atc_connect_resources(struct ct_atc *atc) 1465static void __devinit atc_connect_resources(struct ct_atc *atc)
1466{ 1466{
1467 struct dai *dai = NULL; 1467 struct dai *dai = NULL;
1468 struct dao *dao = NULL; 1468 struct dao *dao = NULL;
@@ -1508,37 +1508,35 @@ static void atc_connect_resources(struct ct_atc *atc)
1508 } 1508 }
1509} 1509}
1510 1510
1511static void atc_set_ops(struct ct_atc *atc) 1511static struct ct_atc atc_preset __devinitdata = {
1512{ 1512 .map_audio_buffer = ct_map_audio_buffer,
1513 /* Set operations */ 1513 .unmap_audio_buffer = ct_unmap_audio_buffer,
1514 atc->map_audio_buffer = ct_map_audio_buffer; 1514 .pcm_playback_prepare = atc_pcm_playback_prepare,
1515 atc->unmap_audio_buffer = ct_unmap_audio_buffer; 1515 .pcm_release_resources = atc_pcm_release_resources,
1516 atc->pcm_playback_prepare = atc_pcm_playback_prepare; 1516 .pcm_playback_start = atc_pcm_playback_start,
1517 atc->pcm_release_resources = atc_pcm_release_resources; 1517 .pcm_playback_stop = atc_pcm_stop,
1518 atc->pcm_playback_start = atc_pcm_playback_start; 1518 .pcm_playback_position = atc_pcm_playback_position,
1519 atc->pcm_playback_stop = atc_pcm_stop; 1519 .pcm_capture_prepare = atc_pcm_capture_prepare,
1520 atc->pcm_playback_position = atc_pcm_playback_position; 1520 .pcm_capture_start = atc_pcm_capture_start,
1521 atc->pcm_capture_prepare = atc_pcm_capture_prepare; 1521 .pcm_capture_stop = atc_pcm_stop,
1522 atc->pcm_capture_start = atc_pcm_capture_start; 1522 .pcm_capture_position = atc_pcm_capture_position,
1523 atc->pcm_capture_stop = atc_pcm_stop; 1523 .spdif_passthru_playback_prepare = spdif_passthru_playback_prepare,
1524 atc->pcm_capture_position = atc_pcm_capture_position; 1524 .get_ptp_phys = atc_get_ptp_phys,
1525 atc->spdif_passthru_playback_prepare = spdif_passthru_playback_prepare; 1525 .select_line_in = atc_select_line_in,
1526 atc->get_ptp_phys = atc_get_ptp_phys; 1526 .select_mic_in = atc_select_mic_in,
1527 atc->select_line_in = atc_select_line_in; 1527 .select_digit_io = atc_select_digit_io,
1528 atc->select_mic_in = atc_select_mic_in; 1528 .line_front_unmute = atc_line_front_unmute,
1529 atc->select_digit_io = atc_select_digit_io; 1529 .line_surround_unmute = atc_line_surround_unmute,
1530 atc->line_front_unmute = atc_line_front_unmute; 1530 .line_clfe_unmute = atc_line_clfe_unmute,
1531 atc->line_surround_unmute = atc_line_surround_unmute; 1531 .line_rear_unmute = atc_line_rear_unmute,
1532 atc->line_clfe_unmute = atc_line_clfe_unmute; 1532 .line_in_unmute = atc_line_in_unmute,
1533 atc->line_rear_unmute = atc_line_rear_unmute; 1533 .spdif_out_unmute = atc_spdif_out_unmute,
1534 atc->line_in_unmute = atc_line_in_unmute; 1534 .spdif_in_unmute = atc_spdif_in_unmute,
1535 atc->spdif_out_unmute = atc_spdif_out_unmute; 1535 .spdif_out_get_status = atc_spdif_out_get_status,
1536 atc->spdif_in_unmute = atc_spdif_in_unmute; 1536 .spdif_out_set_status = atc_spdif_out_set_status,
1537 atc->spdif_out_get_status = atc_spdif_out_get_status; 1537 .spdif_out_passthru = atc_spdif_out_passthru,
1538 atc->spdif_out_set_status = atc_spdif_out_set_status; 1538 .have_digit_io_switch = atc_have_digit_io_switch,
1539 atc->spdif_out_passthru = atc_spdif_out_passthru; 1539};
1540 atc->have_digit_io_switch = atc_have_digit_io_switch;
1541}
1542 1540
1543/** 1541/**
1544 * ct_atc_create - create and initialize a hardware manager 1542 * ct_atc_create - create and initialize a hardware manager
@@ -1552,7 +1550,7 @@ static void atc_set_ops(struct ct_atc *atc)
1552 * Returns 0 if suceeds, or negative error code if fails. 1550 * Returns 0 if suceeds, or negative error code if fails.
1553 */ 1551 */
1554 1552
1555int ct_atc_create(struct snd_card *card, struct pci_dev *pci, 1553int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1556 unsigned int rsr, unsigned int msr, struct ct_atc **ratc) 1554 unsigned int rsr, unsigned int msr, struct ct_atc **ratc)
1557{ 1555{
1558 struct ct_atc *atc = NULL; 1556 struct ct_atc *atc = NULL;
@@ -1567,14 +1565,14 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1567 if (NULL == atc) 1565 if (NULL == atc)
1568 return -ENOMEM; 1566 return -ENOMEM;
1569 1567
1568 /* Set operations */
1569 *atc = atc_preset;
1570
1570 atc->card = card; 1571 atc->card = card;
1571 atc->pci = pci; 1572 atc->pci = pci;
1572 atc->rsr = rsr; 1573 atc->rsr = rsr;
1573 atc->msr = msr; 1574 atc->msr = msr;
1574 1575
1575 /* Set operations */
1576 atc_set_ops(atc);
1577
1578 spin_lock_init(&atc->atc_lock); 1576 spin_lock_init(&atc->atc_lock);
1579 1577
1580 /* Find card model */ 1578 /* Find card model */
@@ -1606,8 +1604,6 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1606 if (!atc->timer) 1604 if (!atc->timer)
1607 goto error1; 1605 goto error1;
1608 1606
1609 atc->create_alsa_devs = ct_create_alsa_devs;
1610
1611 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, atc, &ops); 1607 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, atc, &ops);
1612 if (err < 0) 1608 if (err < 0)
1613 goto error1; 1609 goto error1;
diff --git a/sound/pci/ctxfi/ctatc.h b/sound/pci/ctxfi/ctatc.h
index a3f9b1bc7dcc..04459aa0d4d9 100644
--- a/sound/pci/ctxfi/ctatc.h
+++ b/sound/pci/ctxfi/ctatc.h
@@ -91,8 +91,6 @@ struct ct_atc {
91 91
92 const struct ct_atc_chip_details *chip_details; 92 const struct ct_atc_chip_details *chip_details;
93 enum CTCARDS model; 93 enum CTCARDS model;
94 /* Create all alsa devices */
95 int (*create_alsa_devs)(struct ct_atc *atc);
96 94
97 struct ct_vm *vm; /* device virtual memory manager for this card */ 95 struct ct_vm *vm; /* device virtual memory manager for this card */
98 int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); 96 int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
@@ -151,5 +149,6 @@ struct ct_atc {
151int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, 149int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
152 unsigned int rsr, unsigned int msr, 150 unsigned int rsr, unsigned int msr,
153 struct ct_atc **ratc); 151 struct ct_atc **ratc);
152int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc);
154 153
155#endif /* CTATC_H */ 154#endif /* CTATC_H */
diff --git a/sound/pci/ctxfi/cthardware.c b/sound/pci/ctxfi/cthardware.c
index 8e58860f641c..53d1acadc0e8 100644
--- a/sound/pci/ctxfi/cthardware.c
+++ b/sound/pci/ctxfi/cthardware.c
@@ -20,7 +20,7 @@
20#include "cthw20k2.h" 20#include "cthw20k2.h"
21#include <linux/bug.h> 21#include <linux/bug.h>
22 22
23static enum CHIPTYP get_chip_type(struct hw *hw) 23static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw)
24{ 24{
25 enum CHIPTYP type = ATCNONE; 25 enum CHIPTYP type = ATCNONE;
26 26
@@ -39,7 +39,7 @@ static enum CHIPTYP get_chip_type(struct hw *hw)
39 return type; 39 return type;
40} 40}
41 41
42int create_hw_obj(struct pci_dev *pci, struct hw **rhw) 42int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
43{ 43{
44 int err = 0; 44 int err = 0;
45 45
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index 550b30a2bcf1..df565c11fcca 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -2138,9 +2138,107 @@ static void hw_write_pci(struct hw *hw, u32 reg, u32 data)
2138 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); 2138 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags);
2139} 2139}
2140 2140
2141int create_20k1_hw_obj(struct hw **rhw) 2141static struct hw ct20k1_preset __devinitdata = {
2142 .irq = -1,
2143
2144 .card_init = hw_card_init,
2145 .card_stop = hw_card_stop,
2146 .pll_init = hw_pll_init,
2147 .is_adc_source_selected = hw_is_adc_input_selected,
2148 .select_adc_source = hw_adc_input_select,
2149 .have_digit_io_switch = hw_have_digit_io_switch,
2150
2151 .src_rsc_get_ctrl_blk = src_get_rsc_ctrl_blk,
2152 .src_rsc_put_ctrl_blk = src_put_rsc_ctrl_blk,
2153 .src_mgr_get_ctrl_blk = src_mgr_get_ctrl_blk,
2154 .src_mgr_put_ctrl_blk = src_mgr_put_ctrl_blk,
2155 .src_set_state = src_set_state,
2156 .src_set_bm = src_set_bm,
2157 .src_set_rsr = src_set_rsr,
2158 .src_set_sf = src_set_sf,
2159 .src_set_wr = src_set_wr,
2160 .src_set_pm = src_set_pm,
2161 .src_set_rom = src_set_rom,
2162 .src_set_vo = src_set_vo,
2163 .src_set_st = src_set_st,
2164 .src_set_ie = src_set_ie,
2165 .src_set_ilsz = src_set_ilsz,
2166 .src_set_bp = src_set_bp,
2167 .src_set_cisz = src_set_cisz,
2168 .src_set_ca = src_set_ca,
2169 .src_set_sa = src_set_sa,
2170 .src_set_la = src_set_la,
2171 .src_set_pitch = src_set_pitch,
2172 .src_set_dirty = src_set_dirty,
2173 .src_set_clear_zbufs = src_set_clear_zbufs,
2174 .src_set_dirty_all = src_set_dirty_all,
2175 .src_commit_write = src_commit_write,
2176 .src_get_ca = src_get_ca,
2177 .src_get_dirty = src_get_dirty,
2178 .src_dirty_conj_mask = src_dirty_conj_mask,
2179 .src_mgr_enbs_src = src_mgr_enbs_src,
2180 .src_mgr_enb_src = src_mgr_enb_src,
2181 .src_mgr_dsb_src = src_mgr_dsb_src,
2182 .src_mgr_commit_write = src_mgr_commit_write,
2183
2184 .srcimp_mgr_get_ctrl_blk = srcimp_mgr_get_ctrl_blk,
2185 .srcimp_mgr_put_ctrl_blk = srcimp_mgr_put_ctrl_blk,
2186 .srcimp_mgr_set_imaparc = srcimp_mgr_set_imaparc,
2187 .srcimp_mgr_set_imapuser = srcimp_mgr_set_imapuser,
2188 .srcimp_mgr_set_imapnxt = srcimp_mgr_set_imapnxt,
2189 .srcimp_mgr_set_imapaddr = srcimp_mgr_set_imapaddr,
2190 .srcimp_mgr_commit_write = srcimp_mgr_commit_write,
2191
2192 .amixer_rsc_get_ctrl_blk = amixer_rsc_get_ctrl_blk,
2193 .amixer_rsc_put_ctrl_blk = amixer_rsc_put_ctrl_blk,
2194 .amixer_mgr_get_ctrl_blk = amixer_mgr_get_ctrl_blk,
2195 .amixer_mgr_put_ctrl_blk = amixer_mgr_put_ctrl_blk,
2196 .amixer_set_mode = amixer_set_mode,
2197 .amixer_set_iv = amixer_set_iv,
2198 .amixer_set_x = amixer_set_x,
2199 .amixer_set_y = amixer_set_y,
2200 .amixer_set_sadr = amixer_set_sadr,
2201 .amixer_set_se = amixer_set_se,
2202 .amixer_set_dirty = amixer_set_dirty,
2203 .amixer_set_dirty_all = amixer_set_dirty_all,
2204 .amixer_commit_write = amixer_commit_write,
2205 .amixer_get_y = amixer_get_y,
2206 .amixer_get_dirty = amixer_get_dirty,
2207
2208 .dai_get_ctrl_blk = dai_get_ctrl_blk,
2209 .dai_put_ctrl_blk = dai_put_ctrl_blk,
2210 .dai_srt_set_srco = dai_srt_set_srcr,
2211 .dai_srt_set_srcm = dai_srt_set_srcl,
2212 .dai_srt_set_rsr = dai_srt_set_rsr,
2213 .dai_srt_set_drat = dai_srt_set_drat,
2214 .dai_srt_set_ec = dai_srt_set_ec,
2215 .dai_srt_set_et = dai_srt_set_et,
2216 .dai_commit_write = dai_commit_write,
2217
2218 .dao_get_ctrl_blk = dao_get_ctrl_blk,
2219 .dao_put_ctrl_blk = dao_put_ctrl_blk,
2220 .dao_set_spos = dao_set_spos,
2221 .dao_commit_write = dao_commit_write,
2222 .dao_get_spos = dao_get_spos,
2223
2224 .daio_mgr_get_ctrl_blk = daio_mgr_get_ctrl_blk,
2225 .daio_mgr_put_ctrl_blk = daio_mgr_put_ctrl_blk,
2226 .daio_mgr_enb_dai = daio_mgr_enb_dai,
2227 .daio_mgr_dsb_dai = daio_mgr_dsb_dai,
2228 .daio_mgr_enb_dao = daio_mgr_enb_dao,
2229 .daio_mgr_dsb_dao = daio_mgr_dsb_dao,
2230 .daio_mgr_dao_init = daio_mgr_dao_init,
2231 .daio_mgr_set_imaparc = daio_mgr_set_imaparc,
2232 .daio_mgr_set_imapnxt = daio_mgr_set_imapnxt,
2233 .daio_mgr_set_imapaddr = daio_mgr_set_imapaddr,
2234 .daio_mgr_commit_write = daio_mgr_commit_write,
2235
2236 .set_timer_irq = set_timer_irq,
2237 .set_timer_tick = set_timer_tick,
2238};
2239
2240int __devinit create_20k1_hw_obj(struct hw **rhw)
2142{ 2241{
2143 struct hw *hw;
2144 struct hw20k1 *hw20k1; 2242 struct hw20k1 *hw20k1;
2145 2243
2146 *rhw = NULL; 2244 *rhw = NULL;
@@ -2151,108 +2249,9 @@ int create_20k1_hw_obj(struct hw **rhw)
2151 spin_lock_init(&hw20k1->reg_20k1_lock); 2249 spin_lock_init(&hw20k1->reg_20k1_lock);
2152 spin_lock_init(&hw20k1->reg_pci_lock); 2250 spin_lock_init(&hw20k1->reg_pci_lock);
2153 2251
2154 hw = &hw20k1->hw; 2252 hw20k1->hw = ct20k1_preset;
2155 2253
2156 hw->io_base = 0; 2254 *rhw = &hw20k1->hw;
2157 hw->mem_base = (unsigned long)NULL;
2158 hw->irq = -1;
2159
2160 hw->card_init = hw_card_init;
2161 hw->card_stop = hw_card_stop;
2162 hw->pll_init = hw_pll_init;
2163 hw->is_adc_source_selected = hw_is_adc_input_selected;
2164 hw->select_adc_source = hw_adc_input_select;
2165 hw->have_digit_io_switch = hw_have_digit_io_switch;
2166
2167 hw->src_rsc_get_ctrl_blk = src_get_rsc_ctrl_blk;
2168 hw->src_rsc_put_ctrl_blk = src_put_rsc_ctrl_blk;
2169 hw->src_mgr_get_ctrl_blk = src_mgr_get_ctrl_blk;
2170 hw->src_mgr_put_ctrl_blk = src_mgr_put_ctrl_blk;
2171 hw->src_set_state = src_set_state;
2172 hw->src_set_bm = src_set_bm;
2173 hw->src_set_rsr = src_set_rsr;
2174 hw->src_set_sf = src_set_sf;
2175 hw->src_set_wr = src_set_wr;
2176 hw->src_set_pm = src_set_pm;
2177 hw->src_set_rom = src_set_rom;
2178 hw->src_set_vo = src_set_vo;
2179 hw->src_set_st = src_set_st;
2180 hw->src_set_ie = src_set_ie;
2181 hw->src_set_ilsz = src_set_ilsz;
2182 hw->src_set_bp = src_set_bp;
2183 hw->src_set_cisz = src_set_cisz;
2184 hw->src_set_ca = src_set_ca;
2185 hw->src_set_sa = src_set_sa;
2186 hw->src_set_la = src_set_la;
2187 hw->src_set_pitch = src_set_pitch;
2188 hw->src_set_dirty = src_set_dirty;
2189 hw->src_set_clear_zbufs = src_set_clear_zbufs;
2190 hw->src_set_dirty_all = src_set_dirty_all;
2191 hw->src_commit_write = src_commit_write;
2192 hw->src_get_ca = src_get_ca;
2193 hw->src_get_dirty = src_get_dirty;
2194 hw->src_dirty_conj_mask = src_dirty_conj_mask;
2195 hw->src_mgr_enbs_src = src_mgr_enbs_src;
2196 hw->src_mgr_enb_src = src_mgr_enb_src;
2197 hw->src_mgr_dsb_src = src_mgr_dsb_src;
2198 hw->src_mgr_commit_write = src_mgr_commit_write;
2199
2200 hw->srcimp_mgr_get_ctrl_blk = srcimp_mgr_get_ctrl_blk;
2201 hw->srcimp_mgr_put_ctrl_blk = srcimp_mgr_put_ctrl_blk;
2202 hw->srcimp_mgr_set_imaparc = srcimp_mgr_set_imaparc;
2203 hw->srcimp_mgr_set_imapuser = srcimp_mgr_set_imapuser;
2204 hw->srcimp_mgr_set_imapnxt = srcimp_mgr_set_imapnxt;
2205 hw->srcimp_mgr_set_imapaddr = srcimp_mgr_set_imapaddr;
2206 hw->srcimp_mgr_commit_write = srcimp_mgr_commit_write;
2207
2208 hw->amixer_rsc_get_ctrl_blk = amixer_rsc_get_ctrl_blk;
2209 hw->amixer_rsc_put_ctrl_blk = amixer_rsc_put_ctrl_blk;
2210 hw->amixer_mgr_get_ctrl_blk = amixer_mgr_get_ctrl_blk;
2211 hw->amixer_mgr_put_ctrl_blk = amixer_mgr_put_ctrl_blk;
2212 hw->amixer_set_mode = amixer_set_mode;
2213 hw->amixer_set_iv = amixer_set_iv;
2214 hw->amixer_set_x = amixer_set_x;
2215 hw->amixer_set_y = amixer_set_y;
2216 hw->amixer_set_sadr = amixer_set_sadr;
2217 hw->amixer_set_se = amixer_set_se;
2218 hw->amixer_set_dirty = amixer_set_dirty;
2219 hw->amixer_set_dirty_all = amixer_set_dirty_all;
2220 hw->amixer_commit_write = amixer_commit_write;
2221 hw->amixer_get_y = amixer_get_y;
2222 hw->amixer_get_dirty = amixer_get_dirty;
2223
2224 hw->dai_get_ctrl_blk = dai_get_ctrl_blk;
2225 hw->dai_put_ctrl_blk = dai_put_ctrl_blk;
2226 hw->dai_srt_set_srco = dai_srt_set_srcr;
2227 hw->dai_srt_set_srcm = dai_srt_set_srcl;
2228 hw->dai_srt_set_rsr = dai_srt_set_rsr;
2229 hw->dai_srt_set_drat = dai_srt_set_drat;
2230 hw->dai_srt_set_ec = dai_srt_set_ec;
2231 hw->dai_srt_set_et = dai_srt_set_et;
2232 hw->dai_commit_write = dai_commit_write;
2233
2234 hw->dao_get_ctrl_blk = dao_get_ctrl_blk;
2235 hw->dao_put_ctrl_blk = dao_put_ctrl_blk;
2236 hw->dao_set_spos = dao_set_spos;
2237 hw->dao_commit_write = dao_commit_write;
2238 hw->dao_get_spos = dao_get_spos;
2239
2240 hw->daio_mgr_get_ctrl_blk = daio_mgr_get_ctrl_blk;
2241 hw->daio_mgr_put_ctrl_blk = daio_mgr_put_ctrl_blk;
2242 hw->daio_mgr_enb_dai = daio_mgr_enb_dai;
2243 hw->daio_mgr_dsb_dai = daio_mgr_dsb_dai;
2244 hw->daio_mgr_enb_dao = daio_mgr_enb_dao;
2245 hw->daio_mgr_dsb_dao = daio_mgr_dsb_dao;
2246 hw->daio_mgr_dao_init = daio_mgr_dao_init;
2247 hw->daio_mgr_set_imaparc = daio_mgr_set_imaparc;
2248 hw->daio_mgr_set_imapnxt = daio_mgr_set_imapnxt;
2249 hw->daio_mgr_set_imapaddr = daio_mgr_set_imapaddr;
2250 hw->daio_mgr_commit_write = daio_mgr_commit_write;
2251
2252 hw->set_timer_irq = set_timer_irq;
2253 hw->set_timer_tick = set_timer_tick;
2254
2255 *rhw = hw;
2256 2255
2257 return 0; 2256 return 0;
2258} 2257}
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index 349728765f2c..041199fbae16 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -2006,7 +2006,103 @@ static void hw_write_20kx(struct hw *hw, u32 reg, u32 data)
2006 writel(data, (void *)(hw->mem_base + reg)); 2006 writel(data, (void *)(hw->mem_base + reg));
2007} 2007}
2008 2008
2009int create_20k2_hw_obj(struct hw **rhw) 2009static struct hw ct20k2_preset __devinitdata = {
2010 .irq = -1,
2011
2012 .card_init = hw_card_init,
2013 .card_stop = hw_card_stop,
2014 .pll_init = hw_pll_init,
2015 .is_adc_source_selected = hw_is_adc_input_selected,
2016 .select_adc_source = hw_adc_input_select,
2017 .have_digit_io_switch = hw_have_digit_io_switch,
2018
2019 .src_rsc_get_ctrl_blk = src_get_rsc_ctrl_blk,
2020 .src_rsc_put_ctrl_blk = src_put_rsc_ctrl_blk,
2021 .src_mgr_get_ctrl_blk = src_mgr_get_ctrl_blk,
2022 .src_mgr_put_ctrl_blk = src_mgr_put_ctrl_blk,
2023 .src_set_state = src_set_state,
2024 .src_set_bm = src_set_bm,
2025 .src_set_rsr = src_set_rsr,
2026 .src_set_sf = src_set_sf,
2027 .src_set_wr = src_set_wr,
2028 .src_set_pm = src_set_pm,
2029 .src_set_rom = src_set_rom,
2030 .src_set_vo = src_set_vo,
2031 .src_set_st = src_set_st,
2032 .src_set_ie = src_set_ie,
2033 .src_set_ilsz = src_set_ilsz,
2034 .src_set_bp = src_set_bp,
2035 .src_set_cisz = src_set_cisz,
2036 .src_set_ca = src_set_ca,
2037 .src_set_sa = src_set_sa,
2038 .src_set_la = src_set_la,
2039 .src_set_pitch = src_set_pitch,
2040 .src_set_dirty = src_set_dirty,
2041 .src_set_clear_zbufs = src_set_clear_zbufs,
2042 .src_set_dirty_all = src_set_dirty_all,
2043 .src_commit_write = src_commit_write,
2044 .src_get_ca = src_get_ca,
2045 .src_get_dirty = src_get_dirty,
2046 .src_dirty_conj_mask = src_dirty_conj_mask,
2047 .src_mgr_enbs_src = src_mgr_enbs_src,
2048 .src_mgr_enb_src = src_mgr_enb_src,
2049 .src_mgr_dsb_src = src_mgr_dsb_src,
2050 .src_mgr_commit_write = src_mgr_commit_write,
2051
2052 .srcimp_mgr_get_ctrl_blk = srcimp_mgr_get_ctrl_blk,
2053 .srcimp_mgr_put_ctrl_blk = srcimp_mgr_put_ctrl_blk,
2054 .srcimp_mgr_set_imaparc = srcimp_mgr_set_imaparc,
2055 .srcimp_mgr_set_imapuser = srcimp_mgr_set_imapuser,
2056 .srcimp_mgr_set_imapnxt = srcimp_mgr_set_imapnxt,
2057 .srcimp_mgr_set_imapaddr = srcimp_mgr_set_imapaddr,
2058 .srcimp_mgr_commit_write = srcimp_mgr_commit_write,
2059
2060 .amixer_rsc_get_ctrl_blk = amixer_rsc_get_ctrl_blk,
2061 .amixer_rsc_put_ctrl_blk = amixer_rsc_put_ctrl_blk,
2062 .amixer_mgr_get_ctrl_blk = amixer_mgr_get_ctrl_blk,
2063 .amixer_mgr_put_ctrl_blk = amixer_mgr_put_ctrl_blk,
2064 .amixer_set_mode = amixer_set_mode,
2065 .amixer_set_iv = amixer_set_iv,
2066 .amixer_set_x = amixer_set_x,
2067 .amixer_set_y = amixer_set_y,
2068 .amixer_set_sadr = amixer_set_sadr,
2069 .amixer_set_se = amixer_set_se,
2070 .amixer_set_dirty = amixer_set_dirty,
2071 .amixer_set_dirty_all = amixer_set_dirty_all,
2072 .amixer_commit_write = amixer_commit_write,
2073 .amixer_get_y = amixer_get_y,
2074 .amixer_get_dirty = amixer_get_dirty,
2075
2076 .dai_get_ctrl_blk = dai_get_ctrl_blk,
2077 .dai_put_ctrl_blk = dai_put_ctrl_blk,
2078 .dai_srt_set_srco = dai_srt_set_srco,
2079 .dai_srt_set_srcm = dai_srt_set_srcm,
2080 .dai_srt_set_rsr = dai_srt_set_rsr,
2081 .dai_srt_set_drat = dai_srt_set_drat,
2082 .dai_srt_set_ec = dai_srt_set_ec,
2083 .dai_srt_set_et = dai_srt_set_et,
2084 .dai_commit_write = dai_commit_write,
2085
2086 .dao_get_ctrl_blk = dao_get_ctrl_blk,
2087 .dao_put_ctrl_blk = dao_put_ctrl_blk,
2088 .dao_set_spos = dao_set_spos,
2089 .dao_commit_write = dao_commit_write,
2090 .dao_get_spos = dao_get_spos,
2091
2092 .daio_mgr_get_ctrl_blk = daio_mgr_get_ctrl_blk,
2093 .daio_mgr_put_ctrl_blk = daio_mgr_put_ctrl_blk,
2094 .daio_mgr_enb_dai = daio_mgr_enb_dai,
2095 .daio_mgr_dsb_dai = daio_mgr_dsb_dai,
2096 .daio_mgr_enb_dao = daio_mgr_enb_dao,
2097 .daio_mgr_dsb_dao = daio_mgr_dsb_dao,
2098 .daio_mgr_dao_init = daio_mgr_dao_init,
2099 .daio_mgr_set_imaparc = daio_mgr_set_imaparc,
2100 .daio_mgr_set_imapnxt = daio_mgr_set_imapnxt,
2101 .daio_mgr_set_imapaddr = daio_mgr_set_imapaddr,
2102 .daio_mgr_commit_write = daio_mgr_commit_write,
2103};
2104
2105int __devinit create_20k2_hw_obj(struct hw **rhw)
2010{ 2106{
2011 struct hw *hw; 2107 struct hw *hw;
2012 2108
@@ -2015,102 +2111,7 @@ int create_20k2_hw_obj(struct hw **rhw)
2015 if (NULL == hw) 2111 if (NULL == hw)
2016 return -ENOMEM; 2112 return -ENOMEM;
2017 2113
2018 hw->io_base = 0; 2114 *hw = ct20k2_preset;
2019 hw->mem_base = (unsigned long)NULL;
2020 hw->irq = -1;
2021
2022 hw->card_init = hw_card_init;
2023 hw->card_stop = hw_card_stop;
2024 hw->pll_init = hw_pll_init;
2025 hw->is_adc_source_selected = hw_is_adc_input_selected;
2026 hw->select_adc_source = hw_adc_input_select;
2027 hw->have_digit_io_switch = hw_have_digit_io_switch;
2028
2029 hw->src_rsc_get_ctrl_blk = src_get_rsc_ctrl_blk;
2030 hw->src_rsc_put_ctrl_blk = src_put_rsc_ctrl_blk;
2031 hw->src_mgr_get_ctrl_blk = src_mgr_get_ctrl_blk;
2032 hw->src_mgr_put_ctrl_blk = src_mgr_put_ctrl_blk;
2033 hw->src_set_state = src_set_state;
2034 hw->src_set_bm = src_set_bm;
2035 hw->src_set_rsr = src_set_rsr;
2036 hw->src_set_sf = src_set_sf;
2037 hw->src_set_wr = src_set_wr;
2038 hw->src_set_pm = src_set_pm;
2039 hw->src_set_rom = src_set_rom;
2040 hw->src_set_vo = src_set_vo;
2041 hw->src_set_st = src_set_st;
2042 hw->src_set_ie = src_set_ie;
2043 hw->src_set_ilsz = src_set_ilsz;
2044 hw->src_set_bp = src_set_bp;
2045 hw->src_set_cisz = src_set_cisz;
2046 hw->src_set_ca = src_set_ca;
2047 hw->src_set_sa = src_set_sa;
2048 hw->src_set_la = src_set_la;
2049 hw->src_set_pitch = src_set_pitch;
2050 hw->src_set_dirty = src_set_dirty;
2051 hw->src_set_clear_zbufs = src_set_clear_zbufs;
2052 hw->src_set_dirty_all = src_set_dirty_all;
2053 hw->src_commit_write = src_commit_write;
2054 hw->src_get_ca = src_get_ca;
2055 hw->src_get_dirty = src_get_dirty;
2056 hw->src_dirty_conj_mask = src_dirty_conj_mask;
2057 hw->src_mgr_enbs_src = src_mgr_enbs_src;
2058 hw->src_mgr_enb_src = src_mgr_enb_src;
2059 hw->src_mgr_dsb_src = src_mgr_dsb_src;
2060 hw->src_mgr_commit_write = src_mgr_commit_write;
2061
2062 hw->srcimp_mgr_get_ctrl_blk = srcimp_mgr_get_ctrl_blk;
2063 hw->srcimp_mgr_put_ctrl_blk = srcimp_mgr_put_ctrl_blk;
2064 hw->srcimp_mgr_set_imaparc = srcimp_mgr_set_imaparc;
2065 hw->srcimp_mgr_set_imapuser = srcimp_mgr_set_imapuser;
2066 hw->srcimp_mgr_set_imapnxt = srcimp_mgr_set_imapnxt;
2067 hw->srcimp_mgr_set_imapaddr = srcimp_mgr_set_imapaddr;
2068 hw->srcimp_mgr_commit_write = srcimp_mgr_commit_write;
2069
2070 hw->amixer_rsc_get_ctrl_blk = amixer_rsc_get_ctrl_blk;
2071 hw->amixer_rsc_put_ctrl_blk = amixer_rsc_put_ctrl_blk;
2072 hw->amixer_mgr_get_ctrl_blk = amixer_mgr_get_ctrl_blk;
2073 hw->amixer_mgr_put_ctrl_blk = amixer_mgr_put_ctrl_blk;
2074 hw->amixer_set_mode = amixer_set_mode;
2075 hw->amixer_set_iv = amixer_set_iv;
2076 hw->amixer_set_x = amixer_set_x;
2077 hw->amixer_set_y = amixer_set_y;
2078 hw->amixer_set_sadr = amixer_set_sadr;
2079 hw->amixer_set_se = amixer_set_se;
2080 hw->amixer_set_dirty = amixer_set_dirty;
2081 hw->amixer_set_dirty_all = amixer_set_dirty_all;
2082 hw->amixer_commit_write = amixer_commit_write;
2083 hw->amixer_get_y = amixer_get_y;
2084 hw->amixer_get_dirty = amixer_get_dirty;
2085
2086 hw->dai_get_ctrl_blk = dai_get_ctrl_blk;
2087 hw->dai_put_ctrl_blk = dai_put_ctrl_blk;
2088 hw->dai_srt_set_srco = dai_srt_set_srco;
2089 hw->dai_srt_set_srcm = dai_srt_set_srcm;
2090 hw->dai_srt_set_rsr = dai_srt_set_rsr;
2091 hw->dai_srt_set_drat = dai_srt_set_drat;
2092 hw->dai_srt_set_ec = dai_srt_set_ec;
2093 hw->dai_srt_set_et = dai_srt_set_et;
2094 hw->dai_commit_write = dai_commit_write;
2095
2096 hw->dao_get_ctrl_blk = dao_get_ctrl_blk;
2097 hw->dao_put_ctrl_blk = dao_put_ctrl_blk;
2098 hw->dao_set_spos = dao_set_spos;
2099 hw->dao_commit_write = dao_commit_write;
2100 hw->dao_get_spos = dao_get_spos;
2101
2102 hw->daio_mgr_get_ctrl_blk = daio_mgr_get_ctrl_blk;
2103 hw->daio_mgr_put_ctrl_blk = daio_mgr_put_ctrl_blk;
2104 hw->daio_mgr_enb_dai = daio_mgr_enb_dai;
2105 hw->daio_mgr_dsb_dai = daio_mgr_dsb_dai;
2106 hw->daio_mgr_enb_dao = daio_mgr_enb_dao;
2107 hw->daio_mgr_dsb_dao = daio_mgr_dsb_dao;
2108 hw->daio_mgr_dao_init = daio_mgr_dao_init;
2109 hw->daio_mgr_set_imaparc = daio_mgr_set_imaparc;
2110 hw->daio_mgr_set_imapnxt = daio_mgr_set_imapnxt;
2111 hw->daio_mgr_set_imapaddr = daio_mgr_set_imapaddr;
2112 hw->daio_mgr_commit_write = daio_mgr_commit_write;
2113
2114 *rhw = hw; 2115 *rhw = hw;
2115 2116
2116 return 0; 2117 return 0;
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c
index bf232e7299ac..279dac6c34dd 100644
--- a/sound/pci/ctxfi/xfi.c
+++ b/sound/pci/ctxfi/xfi.c
@@ -86,7 +86,7 @@ ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
86 card->private_data = atc; 86 card->private_data = atc;
87 87
88 /* Create alsa devices supported by this card */ 88 /* Create alsa devices supported by this card */
89 err = atc->create_alsa_devs(atc); 89 err = ct_atc_create_alsa_devs(atc);
90 if (err < 0) 90 if (err < 0)
91 goto error; 91 goto error;
92 92