• Home
  • Raw
  • Download

Lines Matching +full:free +full:- +full:running

6  *   This program is free software; you can redistribute it and/or modify
8 * the Free Software Foundation; either version 2 of the License, or
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/dma-mapping.h>
33 int running; /* boolean */ member
34 int volume; /* mixer volume: 0-100 */
44 * stop beep if running
48 struct pmac_beep *beep = chip->beep; in snd_pmac_beep_stop()
49 if (beep && beep->running) { in snd_pmac_beep_stop()
50 beep->running = 0; in snd_pmac_beep_stop()
56 * Stuff for outputting a beep. The values range from -327 to +327
74 58, 45, 32, 18, 3, -11, -26, -41,
75 -55, -68, -79, -88, -95, -100, -102, -102,
76 -99, -93, -85, -75, -62, -48, -33, -16,
79 55, 41, 26, 11, -3, -18, -32, -45,
80 -58, -68, -78, -86, -92, -97, -101, -103,
81 -105, -105, -105, -104, -104, -103, -103, -103,
82 -103, -105, -107, -110, -113, -117, -122, -128,
83 -133, -139, -144, -150, -155, -159, -163, -167,
84 -169, -170, -171, -171, -171, -169, -168, -166,
85 -164, -162, -161, -160, -159, -159, -160, -161,
86 -163, -166, -170, -174, -179, -183, -188, -193,
87 -197, -201, -204, -207, -209, -209, -209, -208,
88 -206, -203, -200, -196, -192, -189, -186, -183,
89 -182, -182, -183, -186, -190, -196, -204, -213,
90 -224, -236, -249, -262, -275, -288, -299, -310,
91 -318, -324, -327, -327, -323, -316, -304, -288,
92 -269, -245, -218, -187, -153, -117, -79, -40,
97 #define BEEP_VOLUME 15 /* 0 - 100 */
112 return -1; in snd_pmac_beep_event()
117 default: return -1; in snd_pmac_beep_event()
121 if (! chip || (beep = chip->beep) == NULL) in snd_pmac_beep_event()
122 return -1; in snd_pmac_beep_event()
125 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_beep_event()
126 if (beep->running) 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()
143 beep->running = 1; in snd_pmac_beep_event()
144 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_beep_event()
146 if (hz == beep->hz && beep->volume == beep->volume_play) { in snd_pmac_beep_event()
147 nsamples = beep->nsamples; in snd_pmac_beep_event()
154 p = beep->buf; in snd_pmac_beep_event()
156 p[0] = p[1] = beep_wform[j >> 8] * beep->volume; in snd_pmac_beep_event()
159 beep->hz = hz; in snd_pmac_beep_event()
160 beep->volume_play = beep->volume; in snd_pmac_beep_event()
161 beep->nsamples = nsamples; 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()
177 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_pmac_info_beep()
178 uinfo->count = 1; in snd_pmac_info_beep()
179 uinfo->value.integer.min = 0; in snd_pmac_info_beep()
180 uinfo->value.integer.max = 100; in snd_pmac_info_beep()
188 if (snd_BUG_ON(!chip->beep)) in snd_pmac_get_beep()
189 return -ENXIO; in snd_pmac_get_beep()
190 ucontrol->value.integer.value[0] = chip->beep->volume; in snd_pmac_get_beep()
199 if (snd_BUG_ON(!chip->beep)) in snd_pmac_put_beep()
200 return -ENXIO; in snd_pmac_put_beep()
201 oval = chip->beep->volume; in snd_pmac_put_beep()
202 nval = ucontrol->value.integer.value[0]; in snd_pmac_put_beep()
204 return -EINVAL; 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()
224 int err = -ENOMEM; in snd_pmac_attach_beep()
228 return -ENOMEM; in snd_pmac_attach_beep()
229 dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, in snd_pmac_attach_beep()
230 &beep->addr, GFP_KERNEL); in snd_pmac_attach_beep()
236 input_dev->name = "PowerMac Beep"; in snd_pmac_attach_beep()
237 input_dev->phys = "powermac/beep"; in snd_pmac_attach_beep()
238 input_dev->id.bustype = BUS_ADB; in snd_pmac_attach_beep()
239 input_dev->id.vendor = 0x001f; in snd_pmac_attach_beep()
240 input_dev->id.product = 0x0001; in snd_pmac_attach_beep()
241 input_dev->id.version = 0x0100; in snd_pmac_attach_beep()
243 input_dev->evbit[0] = BIT_MASK(EV_SND); in snd_pmac_attach_beep()
244 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); in snd_pmac_attach_beep()
245 input_dev->event = snd_pmac_beep_event; in snd_pmac_attach_beep()
246 input_dev->dev.parent = &chip->pdev->dev; in snd_pmac_attach_beep()
249 beep->dev = input_dev; in snd_pmac_attach_beep()
250 beep->buf = dmabuf; in snd_pmac_attach_beep()
251 beep->volume = BEEP_VOLUME; in snd_pmac_attach_beep()
252 beep->running = 0; 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()
261 err = input_register_device(beep->dev); 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()
271 dmabuf, beep->addr); in snd_pmac_attach_beep()
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()