Lines Matching refs:chip
46 void snd_pmac_beep_stop(struct snd_pmac *chip) in snd_pmac_beep_stop() argument
48 struct pmac_beep *beep = chip->beep; in snd_pmac_beep_stop()
51 snd_pmac_beep_dma_stop(chip); in snd_pmac_beep_stop()
102 struct snd_pmac *chip; in snd_pmac_beep_event() local
120 chip = input_get_drvdata(dev); in snd_pmac_beep_event()
121 if (! chip || (beep = chip->beep) == NULL) in snd_pmac_beep_event()
125 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_beep_event()
127 snd_pmac_beep_stop(chip); in snd_pmac_beep_event()
128 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_beep_event()
132 beep_speed = snd_pmac_rate_index(chip, &chip->playback, BEEP_SRATE); in snd_pmac_beep_event()
133 srate = chip->freq_table[beep_speed]; in snd_pmac_beep_event()
138 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_beep_event()
139 if (chip->playback.running || chip->capture.running || beep->running) { in snd_pmac_beep_event()
140 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_beep_event()
144 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_beep_event()
164 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_beep_event()
165 snd_pmac_beep_dma_start(chip, beep->nsamples * 4, beep->addr, beep_speed); in snd_pmac_beep_event()
166 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_beep_event()
187 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_get_beep() local
188 if (snd_BUG_ON(!chip->beep)) in snd_pmac_get_beep()
190 ucontrol->value.integer.value[0] = chip->beep->volume; in snd_pmac_get_beep()
197 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_put_beep() local
199 if (snd_BUG_ON(!chip->beep)) in snd_pmac_put_beep()
201 oval = chip->beep->volume; in snd_pmac_put_beep()
205 chip->beep->volume = nval; in snd_pmac_put_beep()
206 return oval != chip->beep->volume; in snd_pmac_put_beep()
218 int snd_pmac_attach_beep(struct snd_pmac *chip) in snd_pmac_attach_beep() argument
229 dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, in snd_pmac_attach_beep()
246 input_dev->dev.parent = &chip->pdev->dev; in snd_pmac_attach_beep()
247 input_set_drvdata(input_dev, chip); in snd_pmac_attach_beep()
254 beep_ctl = snd_ctl_new1(&snd_pmac_beep_mixer, chip); in snd_pmac_attach_beep()
255 err = snd_ctl_add(chip->card, beep_ctl); in snd_pmac_attach_beep()
259 chip->beep = beep; in snd_pmac_attach_beep()
267 fail2: snd_ctl_remove(chip->card, beep_ctl); in snd_pmac_attach_beep()
270 dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, in snd_pmac_attach_beep()
276 void snd_pmac_detach_beep(struct snd_pmac *chip) in snd_pmac_detach_beep() argument
278 if (chip->beep) { in snd_pmac_detach_beep()
279 input_unregister_device(chip->beep->dev); in snd_pmac_detach_beep()
280 dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, in snd_pmac_detach_beep()
281 chip->beep->buf, chip->beep->addr); in snd_pmac_detach_beep()
282 kfree(chip->beep); in snd_pmac_detach_beep()
283 chip->beep = NULL; in snd_pmac_detach_beep()