Symbol: isight
sound/firewire/isight.c
101
isight->period_counter += count;
sound/firewire/isight.c
102
if (isight->period_counter >= runtime->period_size) {
sound/firewire/isight.c
103
isight->period_counter -= runtime->period_size;
sound/firewire/isight.c
104
snd_pcm_period_elapsed(isight->pcm);
sound/firewire/isight.c
108
static void isight_samples(struct isight *isight,
sound/firewire/isight.c
114
if (!READ_ONCE(isight->pcm_running))
sound/firewire/isight.c
117
runtime = isight->pcm->runtime;
sound/firewire/isight.c
118
if (isight->buffer_pointer + count <= runtime->buffer_size) {
sound/firewire/isight.c
119
memcpy(runtime->dma_area + isight->buffer_pointer * 4,
sound/firewire/isight.c
122
count1 = runtime->buffer_size - isight->buffer_pointer;
sound/firewire/isight.c
123
memcpy(runtime->dma_area + isight->buffer_pointer * 4,
sound/firewire/isight.c
129
isight_update_pointers(isight, count);
sound/firewire/isight.c
132
static void isight_pcm_abort(struct isight *isight)
sound/firewire/isight.c
134
if (READ_ONCE(isight->pcm_active))
sound/firewire/isight.c
135
snd_pcm_stop_xrun(isight->pcm);
sound/firewire/isight.c
138
static void isight_dropped_samples(struct isight *isight, unsigned int total)
sound/firewire/isight.c
144
if (!READ_ONCE(isight->pcm_running))
sound/firewire/isight.c
147
runtime = isight->pcm->runtime;
sound/firewire/isight.c
148
dropped = total - isight->total_samples;
sound/firewire/isight.c
150
if (isight->buffer_pointer + dropped <= runtime->buffer_size) {
sound/firewire/isight.c
151
memset(runtime->dma_area + isight->buffer_pointer * 4,
sound/firewire/isight.c
154
count1 = runtime->buffer_size - isight->buffer_pointer;
sound/firewire/isight.c
155
memset(runtime->dma_area + isight->buffer_pointer * 4,
sound/firewire/isight.c
159
isight_update_pointers(isight, dropped);
sound/firewire/isight.c
161
isight_pcm_abort(isight);
sound/firewire/isight.c
168
struct isight *isight = data;
sound/firewire/isight.c
173
if (isight->packet_index < 0)
sound/firewire/isight.c
175
index = isight->packet_index;
sound/firewire/isight.c
176
payload = isight->buffer.packets[index].buffer;
sound/firewire/isight.c
184
if (unlikely(total != isight->total_samples)) {
sound/firewire/isight.c
185
if (!isight->first_packet)
sound/firewire/isight.c
186
isight_dropped_samples(isight, total);
sound/firewire/isight.c
187
isight->first_packet = false;
sound/firewire/isight.c
188
isight->total_samples = total;
sound/firewire/isight.c
191
isight_samples(isight, payload->samples, count);
sound/firewire/isight.c
192
isight->total_samples += count;
sound/firewire/isight.c
196
err = fw_iso_context_queue(isight->context, &audio_packet,
sound/firewire/isight.c
197
&isight->buffer.iso_buffer,
sound/firewire/isight.c
198
isight->buffer.packets[index].offset);
sound/firewire/isight.c
200
dev_err(&isight->unit->device, "queueing error: %d\n", err);
sound/firewire/isight.c
201
isight_pcm_abort(isight);
sound/firewire/isight.c
202
isight->packet_index = -1;
sound/firewire/isight.c
205
fw_iso_context_queue_flush(isight->context);
sound/firewire/isight.c
209
isight->packet_index = index;
sound/firewire/isight.c
212
static int isight_connect(struct isight *isight)
sound/firewire/isight.c
218
ch = fw_iso_resources_allocate(&isight->resources,
sound/firewire/isight.c
220
isight->device->max_speed);
sound/firewire/isight.c
226
value = cpu_to_be32(ch | (isight->device->max_speed << SPEED_SHIFT));
sound/firewire/isight.c
227
err = snd_fw_transaction(isight->unit, TCODE_WRITE_QUADLET_REQUEST,
sound/firewire/isight.c
228
isight->audio_base + REG_ISO_TX_CONFIG,
sound/firewire/isight.c
230
isight->resources.generation);
sound/firewire/isight.c
232
fw_iso_resources_free(&isight->resources);
sound/firewire/isight.c
241
fw_iso_resources_free(&isight->resources);
sound/firewire/isight.c
266
struct isight *isight = substream->private_data;
sound/firewire/isight.c
270
return iso_packets_buffer_init(&isight->buffer, isight->unit,
sound/firewire/isight.c
278
struct isight *isight = substream->private_data;
sound/firewire/isight.c
280
iso_packets_buffer_destroy(&isight->buffer, isight->unit);
sound/firewire/isight.c
288
struct isight *isight = substream->private_data;
sound/firewire/isight.c
290
WRITE_ONCE(isight->pcm_active, true);
sound/firewire/isight.c
295
static int reg_read(struct isight *isight, int offset, __be32 *value)
sound/firewire/isight.c
297
return snd_fw_transaction(isight->unit, TCODE_READ_QUADLET_REQUEST,
sound/firewire/isight.c
298
isight->audio_base + offset, value, 4, 0);
sound/firewire/isight.c
301
static int reg_write(struct isight *isight, int offset, __be32 value)
sound/firewire/isight.c
303
return snd_fw_transaction(isight->unit, TCODE_WRITE_QUADLET_REQUEST,
sound/firewire/isight.c
304
isight->audio_base + offset, &value, 4, 0);
sound/firewire/isight.c
307
static void isight_stop_streaming(struct isight *isight)
sound/firewire/isight.c
311
if (!isight->context)
sound/firewire/isight.c
314
fw_iso_context_stop(isight->context);
sound/firewire/isight.c
315
fw_iso_context_destroy(isight->context);
sound/firewire/isight.c
316
isight->context = NULL;
sound/firewire/isight.c
317
fw_iso_resources_free(&isight->resources);
sound/firewire/isight.c
319
snd_fw_transaction(isight->unit, TCODE_WRITE_QUADLET_REQUEST,
sound/firewire/isight.c
320
isight->audio_base + REG_AUDIO_ENABLE,
sound/firewire/isight.c
326
struct isight *isight = substream->private_data;
sound/firewire/isight.c
328
WRITE_ONCE(isight->pcm_active, false);
sound/firewire/isight.c
330
guard(mutex)(&isight->mutex);
sound/firewire/isight.c
331
isight_stop_streaming(isight);
sound/firewire/isight.c
336
static int isight_start_streaming(struct isight *isight)
sound/firewire/isight.c
341
if (isight->context) {
sound/firewire/isight.c
342
if (isight->packet_index < 0)
sound/firewire/isight.c
343
isight_stop_streaming(isight);
sound/firewire/isight.c
348
err = reg_write(isight, REG_SAMPLE_RATE, cpu_to_be32(RATE_48000));
sound/firewire/isight.c
352
err = isight_connect(isight);
sound/firewire/isight.c
356
err = reg_write(isight, REG_AUDIO_ENABLE, cpu_to_be32(AUDIO_ENABLE));
sound/firewire/isight.c
360
isight->context = fw_iso_context_create(isight->device->card,
sound/firewire/isight.c
362
isight->resources.channel,
sound/firewire/isight.c
363
isight->device->max_speed,
sound/firewire/isight.c
364
4, isight_packet, isight);
sound/firewire/isight.c
365
if (IS_ERR(isight->context)) {
sound/firewire/isight.c
366
err = PTR_ERR(isight->context);
sound/firewire/isight.c
367
isight->context = NULL;
sound/firewire/isight.c
372
err = fw_iso_context_queue(isight->context, &audio_packet,
sound/firewire/isight.c
373
&isight->buffer.iso_buffer,
sound/firewire/isight.c
374
isight->buffer.packets[i].offset);
sound/firewire/isight.c
379
isight->first_packet = true;
sound/firewire/isight.c
380
isight->packet_index = 0;
sound/firewire/isight.c
382
err = fw_iso_context_start(isight->context, -1, 0,
sound/firewire/isight.c
390
fw_iso_context_destroy(isight->context);
sound/firewire/isight.c
391
isight->context = NULL;
sound/firewire/isight.c
393
fw_iso_resources_free(&isight->resources);
sound/firewire/isight.c
394
reg_write(isight, REG_AUDIO_ENABLE, 0);
sound/firewire/isight.c
401
struct isight *isight = substream->private_data;
sound/firewire/isight.c
403
isight->buffer_pointer = 0;
sound/firewire/isight.c
404
isight->period_counter = 0;
sound/firewire/isight.c
406
guard(mutex)(&isight->mutex);
sound/firewire/isight.c
407
return isight_start_streaming(isight);
sound/firewire/isight.c
412
struct isight *isight = substream->private_data;
sound/firewire/isight.c
416
WRITE_ONCE(isight->pcm_running, true);
sound/firewire/isight.c
419
WRITE_ONCE(isight->pcm_running, false);
sound/firewire/isight.c
429
struct isight *isight = substream->private_data;
sound/firewire/isight.c
431
return READ_ONCE(isight->buffer_pointer);
sound/firewire/isight.c
434
static int isight_create_pcm(struct isight *isight)
sound/firewire/isight.c
448
err = snd_pcm_new(isight->card, "iSight", 0, 0, 1, &pcm);
sound/firewire/isight.c
451
pcm->private_data = isight;
sound/firewire/isight.c
454
isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
sound/firewire/isight.c
455
isight->pcm->ops = &ops;
sound/firewire/isight.c
464
struct isight *isight = ctl->private_data;
sound/firewire/isight.c
468
info->value.integer.min = isight->gain_min;
sound/firewire/isight.c
469
info->value.integer.max = isight->gain_max;
sound/firewire/isight.c
477
struct isight *isight = ctl->private_data;
sound/firewire/isight.c
481
err = reg_read(isight, REG_GAIN, &gain);
sound/firewire/isight.c
493
struct isight *isight = ctl->private_data;
sound/firewire/isight.c
495
if (value->value.integer.value[0] < isight->gain_min ||
sound/firewire/isight.c
496
value->value.integer.value[0] > isight->gain_max)
sound/firewire/isight.c
499
return reg_write(isight, REG_GAIN,
sound/firewire/isight.c
506
struct isight *isight = ctl->private_data;
sound/firewire/isight.c
510
err = reg_read(isight, REG_MUTE, &mute);
sound/firewire/isight.c
522
struct isight *isight = ctl->private_data;
sound/firewire/isight.c
524
return reg_write(isight, REG_MUTE,
sound/firewire/isight.c
528
static int isight_create_mixer(struct isight *isight)
sound/firewire/isight.c
550
err = reg_read(isight, REG_GAIN_RAW_START, &value);
sound/firewire/isight.c
553
isight->gain_min = be32_to_cpu(value);
sound/firewire/isight.c
555
err = reg_read(isight, REG_GAIN_RAW_END, &value);
sound/firewire/isight.c
558
isight->gain_max = be32_to_cpu(value);
sound/firewire/isight.c
560
isight->gain_tlv[SNDRV_CTL_TLVO_TYPE] = SNDRV_CTL_TLVT_DB_MINMAX;
sound/firewire/isight.c
561
isight->gain_tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(unsigned int);
sound/firewire/isight.c
563
err = reg_read(isight, REG_GAIN_DB_START, &value);
sound/firewire/isight.c
566
isight->gain_tlv[SNDRV_CTL_TLVO_DB_MINMAX_MIN] =
sound/firewire/isight.c
569
err = reg_read(isight, REG_GAIN_DB_END, &value);
sound/firewire/isight.c
572
isight->gain_tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX] =
sound/firewire/isight.c
575
ctl = snd_ctl_new1(&gain_control, isight);
sound/firewire/isight.c
577
ctl->tlv.p = isight->gain_tlv;
sound/firewire/isight.c
578
err = snd_ctl_add(isight->card, ctl);
sound/firewire/isight.c
582
err = snd_ctl_add(isight->card, snd_ctl_new1(&mute_control, isight));
sound/firewire/isight.c
591
struct isight *isight = card->private_data;
sound/firewire/isight.c
593
fw_iso_resources_destroy(&isight->resources);
sound/firewire/isight.c
613
struct isight *isight;
sound/firewire/isight.c
617
sizeof(*isight), &card);
sound/firewire/isight.c
621
isight = card->private_data;
sound/firewire/isight.c
622
isight->card = card;
sound/firewire/isight.c
623
mutex_init(&isight->mutex);
sound/firewire/isight.c
624
isight->unit = fw_unit_get(unit);
sound/firewire/isight.c
625
isight->device = fw_dev;
sound/firewire/isight.c
626
isight->audio_base = get_unit_base(unit);
sound/firewire/isight.c
627
if (!isight->audio_base) {
sound/firewire/isight.c
632
fw_iso_resources_init(&isight->resources, unit);
sound/firewire/isight.c
644
err = isight_create_pcm(isight);
sound/firewire/isight.c
648
err = isight_create_mixer(isight);
sound/firewire/isight.c
656
dev_set_drvdata(&unit->device, isight);
sound/firewire/isight.c
662
mutex_destroy(&isight->mutex);
sound/firewire/isight.c
663
fw_unit_put(isight->unit);
sound/firewire/isight.c
670
struct isight *isight = dev_get_drvdata(&unit->device);
sound/firewire/isight.c
672
if (fw_iso_resources_update(&isight->resources) < 0) {
sound/firewire/isight.c
673
isight_pcm_abort(isight);
sound/firewire/isight.c
675
guard(mutex)(&isight->mutex);
sound/firewire/isight.c
676
isight_stop_streaming(isight);
sound/firewire/isight.c
682
struct isight *isight = dev_get_drvdata(&unit->device);
sound/firewire/isight.c
684
isight_pcm_abort(isight);
sound/firewire/isight.c
686
snd_card_disconnect(isight->card);
sound/firewire/isight.c
688
scoped_guard(mutex, &isight->mutex) {
sound/firewire/isight.c
689
isight_stop_streaming(isight);
sound/firewire/isight.c
693
snd_card_free(isight->card);
sound/firewire/isight.c
695
mutex_destroy(&isight->mutex);
sound/firewire/isight.c
696
fw_unit_put(isight->unit);
sound/firewire/isight.c
88
static void isight_update_pointers(struct isight *isight, unsigned int count)
sound/firewire/isight.c
90
struct snd_pcm_runtime *runtime = isight->pcm->runtime;
sound/firewire/isight.c
95
ptr = isight->buffer_pointer;
sound/firewire/isight.c
99
WRITE_ONCE(isight->buffer_pointer, ptr);