Lines Matching refs:chip

54 static void dac_audio_start_timer(struct snd_sh_dac *chip)
56 hrtimer_start(&chip->hrtimer, chip->wakeups_per_second,
60 static void dac_audio_stop_timer(struct snd_sh_dac *chip)
62 hrtimer_cancel(&chip->hrtimer);
65 static void dac_audio_reset(struct snd_sh_dac *chip)
67 dac_audio_stop_timer(chip);
68 chip->buffer_begin = chip->buffer_end = chip->data_buffer;
69 chip->processed = 0;
70 chip->empty = 1;
73 static void dac_audio_set_rate(struct snd_sh_dac *chip)
75 chip->wakeups_per_second = 1000000000 / chip->rate;
101 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
106 chip->substream = substream;
107 chip->buffer_begin = chip->buffer_end = chip->data_buffer;
108 chip->processed = 0;
109 chip->empty = 1;
111 chip->pdata->start(chip->pdata);
118 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
120 chip->substream = NULL;
122 dac_audio_stop_timer(chip);
123 chip->pdata->stop(chip->pdata);
130 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
131 struct snd_pcm_runtime *runtime = chip->substream->runtime;
133 chip->buffer_size = runtime->buffer_size;
134 memset(chip->data_buffer, 0, chip->pdata->buffer_size);
141 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
145 dac_audio_start_timer(chip);
148 chip->buffer_begin = chip->buffer_end = chip->data_buffer;
149 chip->processed = 0;
150 chip->empty = 1;
151 dac_audio_stop_timer(chip);
165 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
167 if (copy_from_user_toio(chip->data_buffer + pos, src, count))
169 chip->buffer_end = chip->data_buffer + pos + count;
171 if (chip->empty) {
172 chip->empty = 0;
173 dac_audio_start_timer(chip);
184 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
186 memcpy_toio(chip->data_buffer + pos, src, count);
187 chip->buffer_end = chip->data_buffer + pos + count;
189 if (chip->empty) {
190 chip->empty = 0;
191 dac_audio_start_timer(chip);
202 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
204 memset_io(chip->data_buffer + pos, 0, count);
205 chip->buffer_end = chip->data_buffer + pos + count;
207 if (chip->empty) {
208 chip->empty = 0;
209 dac_audio_start_timer(chip);
218 struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
219 int pointer = chip->buffer_begin - chip->data_buffer;
237 static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
243 err = snd_pcm_new(chip->card, "SH_DAC PCM", device, 1, 0, &pcm);
247 pcm->private_data = chip;
268 static int snd_sh_dac_free(struct snd_sh_dac *chip)
271 kfree(chip->data_buffer);
272 kfree(chip);
279 struct snd_sh_dac *chip = device->device_data;
281 return snd_sh_dac_free(chip);
286 struct snd_sh_dac *chip = container_of(handle, struct snd_sh_dac,
288 struct snd_pcm_runtime *runtime = chip->substream->runtime;
291 if (!chip->empty) {
292 sh_dac_output(*chip->buffer_begin, chip->pdata->channel);
293 chip->buffer_begin++;
295 chip->processed++;
296 if (chip->processed >= b_ps) {
297 chip->processed -= b_ps;
298 snd_pcm_period_elapsed(chip->substream);
301 if (chip->buffer_begin == (chip->data_buffer +
302 chip->buffer_size - 1))
303 chip->buffer_begin = chip->data_buffer;
305 if (chip->buffer_begin == chip->buffer_end)
306 chip->empty = 1;
310 if (!chip->empty)
311 hrtimer_start(&chip->hrtimer, chip->wakeups_per_second,
317 /* create -- chip-specific constructor for the cards components */
322 struct snd_sh_dac *chip;
331 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
332 if (chip == NULL)
335 chip->card = card;
337 hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
338 chip->hrtimer.function = sh_dac_audio_timer;
340 dac_audio_reset(chip);
341 chip->rate = 8000;
342 dac_audio_set_rate(chip);
344 chip->pdata = devptr->dev.platform_data;
346 chip->data_buffer = kmalloc(chip->pdata->buffer_size, GFP_KERNEL);
347 if (chip->data_buffer == NULL) {
348 kfree(chip);
352 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
354 snd_sh_dac_free(chip);
358 *rchip = chip;
366 struct snd_sh_dac *chip;
376 err = snd_sh_dac_create(card, devptr, &chip);
380 err = snd_sh_dac_pcm(chip, 0);