Lines Matching refs:chip

20 	struct snd_pdacf *chip = private_data;  in pdacf_ak4117_read()  local
25 spin_lock_irqsave(&chip->ak4117_lock, flags); in pdacf_ak4117_read()
27 while (pdacf_reg_read(chip, PDAUDIOCF_REG_SCR) & PDAUDIOCF_AK_SBP) { in pdacf_ak4117_read()
30 spin_unlock_irqrestore(&chip->ak4117_lock, flags); in pdacf_ak4117_read()
31 dev_err(chip->card->dev, "AK4117 ready timeout (read)\n"); in pdacf_ak4117_read()
35 pdacf_reg_write(chip, PDAUDIOCF_REG_AK_IFR, (u16)reg << 8); in pdacf_ak4117_read()
37 while (pdacf_reg_read(chip, PDAUDIOCF_REG_SCR) & PDAUDIOCF_AK_SBP) { in pdacf_ak4117_read()
40 spin_unlock_irqrestore(&chip->ak4117_lock, flags); in pdacf_ak4117_read()
41 dev_err(chip->card->dev, "AK4117 read timeout (read2)\n"); in pdacf_ak4117_read()
45 res = (unsigned char)pdacf_reg_read(chip, PDAUDIOCF_REG_AK_IFR); in pdacf_ak4117_read()
46 spin_unlock_irqrestore(&chip->ak4117_lock, flags); in pdacf_ak4117_read()
52 struct snd_pdacf *chip = private_data; in pdacf_ak4117_write() local
56 spin_lock_irqsave(&chip->ak4117_lock, flags); in pdacf_ak4117_write()
58 while (inw(chip->port + PDAUDIOCF_REG_SCR) & PDAUDIOCF_AK_SBP) { in pdacf_ak4117_write()
61 spin_unlock_irqrestore(&chip->ak4117_lock, flags); in pdacf_ak4117_write()
62 dev_err(chip->card->dev, "AK4117 ready timeout (write)\n"); in pdacf_ak4117_write()
66 outw((u16)reg << 8 | val | (1<<13), chip->port + PDAUDIOCF_REG_AK_IFR); in pdacf_ak4117_write()
67 spin_unlock_irqrestore(&chip->ak4117_lock, flags); in pdacf_ak4117_write()
71 void pdacf_dump(struct snd_pdacf *chip)
73 dev_dbg(chip->card->dev, "PDAUDIOCF DUMP (0x%lx):\n", chip->port);
74 dev_dbg(chip->card->dev, "WPD : 0x%x\n",
75 inw(chip->port + PDAUDIOCF_REG_WDP));
76 dev_dbg(chip->card->dev, "RDP : 0x%x\n",
77 inw(chip->port + PDAUDIOCF_REG_RDP));
78 dev_dbg(chip->card->dev, "TCR : 0x%x\n",
79 inw(chip->port + PDAUDIOCF_REG_TCR));
80 dev_dbg(chip->card->dev, "SCR : 0x%x\n",
81 inw(chip->port + PDAUDIOCF_REG_SCR));
82 dev_dbg(chip->card->dev, "ISR : 0x%x\n",
83 inw(chip->port + PDAUDIOCF_REG_ISR));
84 dev_dbg(chip->card->dev, "IER : 0x%x\n",
85 inw(chip->port + PDAUDIOCF_REG_IER));
86 dev_dbg(chip->card->dev, "AK_IFR : 0x%x\n",
87 inw(chip->port + PDAUDIOCF_REG_AK_IFR));
91 static int pdacf_reset(struct snd_pdacf *chip, int powerdown) in pdacf_reset() argument
95 val = pdacf_reg_read(chip, PDAUDIOCF_REG_SCR); in pdacf_reset()
98 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in pdacf_reset()
101 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in pdacf_reset()
104 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in pdacf_reset()
108 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in pdacf_reset()
114 void pdacf_reinit(struct snd_pdacf *chip, int resume) in pdacf_reinit() argument
116 pdacf_reset(chip, 0); in pdacf_reinit()
118 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, chip->suspend_reg_scr); in pdacf_reinit()
119 snd_ak4117_reinit(chip->ak4117); in pdacf_reinit()
120 pdacf_reg_write(chip, PDAUDIOCF_REG_TCR, chip->regmap[PDAUDIOCF_REG_TCR>>1]); in pdacf_reinit()
121 pdacf_reg_write(chip, PDAUDIOCF_REG_IER, chip->regmap[PDAUDIOCF_REG_IER>>1]); in pdacf_reinit()
127 struct snd_pdacf *chip = entry->private_data; in pdacf_proc_read() local
131 tmp = pdacf_reg_read(chip, PDAUDIOCF_REG_SCR); in pdacf_proc_read()
136 static void pdacf_proc_init(struct snd_pdacf *chip) in pdacf_proc_init() argument
138 snd_card_ro_proc_new(chip->card, "pdaudiocf", chip, pdacf_proc_read); in pdacf_proc_init()
143 struct snd_pdacf *chip; in snd_pdacf_create() local
145 chip = kzalloc(sizeof(*chip), GFP_KERNEL); in snd_pdacf_create()
146 if (chip == NULL) in snd_pdacf_create()
148 chip->card = card; in snd_pdacf_create()
149 mutex_init(&chip->reg_lock); in snd_pdacf_create()
150 spin_lock_init(&chip->ak4117_lock); in snd_pdacf_create()
151 card->private_data = chip; in snd_pdacf_create()
153 pdacf_proc_init(chip); in snd_pdacf_create()
154 return chip; in snd_pdacf_create()
159 struct snd_pdacf *chip = ak4117->change_callback_private; in snd_pdacf_ak4117_change() local
164 mutex_lock(&chip->reg_lock); in snd_pdacf_ak4117_change()
165 val = chip->regmap[PDAUDIOCF_REG_SCR>>1]; in snd_pdacf_ak4117_change()
170 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in snd_pdacf_ak4117_change()
171 mutex_unlock(&chip->reg_lock); in snd_pdacf_ak4117_change()
174 int snd_pdacf_ak4117_create(struct snd_pdacf *chip) in snd_pdacf_ak4117_create() argument
190 err = pdacf_reset(chip, 0); in snd_pdacf_ak4117_create()
193 …err = snd_ak4117_create(chip->card, pdacf_ak4117_read, pdacf_ak4117_write, pgm, chip, &chip->ak411… in snd_pdacf_ak4117_create()
197 val = pdacf_reg_read(chip, PDAUDIOCF_REG_TCR); in snd_pdacf_ak4117_create()
204 pdacf_reg_write(chip, PDAUDIOCF_REG_TCR, val); in snd_pdacf_ak4117_create()
207 val = pdacf_reg_read(chip, PDAUDIOCF_REG_SCR); in snd_pdacf_ak4117_create()
211 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in snd_pdacf_ak4117_create()
214 val = pdacf_reg_read(chip, PDAUDIOCF_REG_IER); in snd_pdacf_ak4117_create()
219 pdacf_reg_write(chip, PDAUDIOCF_REG_IER, val); in snd_pdacf_ak4117_create()
221 chip->ak4117->change_callback_private = chip; in snd_pdacf_ak4117_create()
222 chip->ak4117->change_callback = snd_pdacf_ak4117_change; in snd_pdacf_ak4117_create()
225 snd_pdacf_ak4117_change(chip->ak4117, AK4117_UNLCK, 0); in snd_pdacf_ak4117_create()
230 void snd_pdacf_powerdown(struct snd_pdacf *chip) in snd_pdacf_powerdown() argument
234 val = pdacf_reg_read(chip, PDAUDIOCF_REG_SCR); in snd_pdacf_powerdown()
235 chip->suspend_reg_scr = val; in snd_pdacf_powerdown()
237 pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val); in snd_pdacf_powerdown()
239 val = inw(chip->port + PDAUDIOCF_REG_IER); in snd_pdacf_powerdown()
241 outw(val, chip->port + PDAUDIOCF_REG_IER); in snd_pdacf_powerdown()
242 pdacf_reset(chip, 1); in snd_pdacf_powerdown()
247 int snd_pdacf_suspend(struct snd_pdacf *chip) in snd_pdacf_suspend() argument
251 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); in snd_pdacf_suspend()
253 val = inw(chip->port + PDAUDIOCF_REG_IER); in snd_pdacf_suspend()
255 outw(val, chip->port + PDAUDIOCF_REG_IER); in snd_pdacf_suspend()
256 chip->chip_status |= PDAUDIOCF_STAT_IS_SUSPENDED; /* ignore interrupts from now */ in snd_pdacf_suspend()
257 snd_pdacf_powerdown(chip); in snd_pdacf_suspend()
261 static inline int check_signal(struct snd_pdacf *chip) in check_signal() argument
263 return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0; in check_signal()
266 int snd_pdacf_resume(struct snd_pdacf *chip) in snd_pdacf_resume() argument
270 pdacf_reinit(chip, 1); in snd_pdacf_resume()
273 (snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip))) in snd_pdacf_resume()
275 chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED; in snd_pdacf_resume()
276 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); in snd_pdacf_resume()