static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
int i;
- unsigned long flags;
const u32 *cache;
if (hdsp->fw_uploaded)
if (hdsp->state & HDSP_InitializationComplete) {
dev_info(hdsp->card->dev,
"firmware loaded from cache, restoring defaults\n");
- spin_lock_irqsave(&hdsp->lock, flags);
+ guard(spinlock_irqsave)(&hdsp->lock);
snd_hdsp_set_defaults(hdsp);
- spin_unlock_irqrestore(&hdsp->lock, flags);
}
hdsp->state |= HDSP_FirmwareLoaded;
static int snd_hdsp_use_is_exclusive(struct hdsp *hdsp)
{
- unsigned long flags;
int ret = 1;
- spin_lock_irqsave(&hdsp->lock, flags);
+ guard(spinlock_irqsave)(&hdsp->lock);
if ((hdsp->playback_pid != hdsp->capture_pid) &&
(hdsp->playback_pid >= 0) && (hdsp->capture_pid >= 0))
ret = 0;
- spin_unlock_irqrestore(&hdsp->lock, flags);
return ret;
}
{
int n;
- spin_lock_irq(&s->lock);
-
frames >>= 7;
n = 0;
while (frames) {
hdsp_compute_period_size(s);
- spin_unlock_irq(&s->lock);
-
return 0;
}
static int snd_hdsp_midi_output_write (struct hdsp_midi *hmidi)
{
- unsigned long flags;
int n_pending;
int to_write;
int i;
/* Output is not interrupt driven */
- spin_lock_irqsave (&hmidi->lock, flags);
+ guard(spinlock_irqsave)(&hmidi->lock);
if (hmidi->output) {
if (!snd_rawmidi_transmit_empty (hmidi->output)) {
n_pending = snd_hdsp_midi_output_possible(hmidi->hdsp, hmidi->id);
}
}
}
- spin_unlock_irqrestore (&hmidi->lock, flags);
return 0;
}
static int snd_hdsp_midi_input_read (struct hdsp_midi *hmidi)
{
unsigned char buf[128]; /* this buffer is designed to match the MIDI input FIFO size */
- unsigned long flags;
int n_pending;
int i;
- spin_lock_irqsave (&hmidi->lock, flags);
- n_pending = snd_hdsp_midi_input_available(hmidi->hdsp, hmidi->id);
- if (n_pending > 0) {
- if (hmidi->input) {
- if (n_pending > (int)sizeof (buf))
- n_pending = sizeof (buf);
- for (i = 0; i < n_pending; ++i)
- buf[i] = snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id);
- if (n_pending)
- snd_rawmidi_receive (hmidi->input, buf, n_pending);
- } else {
- /* flush the MIDI input FIFO */
- while (--n_pending)
- snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id);
+ scoped_guard(spinlock_irqsave, &hmidi->lock) {
+ n_pending = snd_hdsp_midi_input_available(hmidi->hdsp, hmidi->id);
+ if (n_pending > 0) {
+ if (hmidi->input) {
+ if (n_pending > (int)sizeof(buf))
+ n_pending = sizeof(buf);
+ for (i = 0; i < n_pending; ++i)
+ buf[i] = snd_hdsp_midi_read_byte(hmidi->hdsp, hmidi->id);
+ if (n_pending)
+ snd_rawmidi_receive(hmidi->input, buf, n_pending);
+ } else {
+ /* flush the MIDI input FIFO */
+ while (--n_pending)
+ snd_hdsp_midi_read_byte(hmidi->hdsp, hmidi->id);
+ }
}
+ hmidi->pending = 0;
+ if (hmidi->id)
+ hmidi->hdsp->control_register |= HDSP_Midi1InterruptEnable;
+ else
+ hmidi->hdsp->control_register |= HDSP_Midi0InterruptEnable;
+ hdsp_write(hmidi->hdsp, HDSP_controlRegister, hmidi->hdsp->control_register);
}
- hmidi->pending = 0;
- if (hmidi->id)
- hmidi->hdsp->control_register |= HDSP_Midi1InterruptEnable;
- else
- hmidi->hdsp->control_register |= HDSP_Midi0InterruptEnable;
- hdsp_write(hmidi->hdsp, HDSP_controlRegister, hmidi->hdsp->control_register);
- spin_unlock_irqrestore (&hmidi->lock, flags);
return snd_hdsp_midi_output_write (hmidi);
}
{
struct hdsp *hdsp;
struct hdsp_midi *hmidi;
- unsigned long flags;
u32 ie;
hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
hdsp = hmidi->hdsp;
ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable;
- spin_lock_irqsave (&hdsp->lock, flags);
+ guard(spinlock_irqsave)(&hdsp->lock);
if (up) {
if (!(hdsp->control_register & ie)) {
snd_hdsp_flush_midi_input (hdsp, hmidi->id);
}
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
- spin_unlock_irqrestore (&hdsp->lock, flags);
}
static void snd_hdsp_midi_output_timer(struct timer_list *t)
{
struct hdsp_midi *hmidi = timer_container_of(hmidi, t, timer);
- unsigned long flags;
snd_hdsp_midi_output_write(hmidi);
- spin_lock_irqsave (&hmidi->lock, flags);
+ guard(spinlock_irqsave)(&hmidi->lock);
/* this does not bump hmidi->istimer, because the
kernel automatically removed the timer when it
if (hmidi->istimer)
mod_timer(&hmidi->timer, 1 + jiffies);
-
- spin_unlock_irqrestore (&hmidi->lock, flags);
}
static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
{
struct hdsp_midi *hmidi;
- unsigned long flags;
hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
- spin_lock_irqsave (&hmidi->lock, flags);
- if (up) {
- if (!hmidi->istimer) {
- timer_setup(&hmidi->timer, snd_hdsp_midi_output_timer,
- 0);
- mod_timer(&hmidi->timer, 1 + jiffies);
- hmidi->istimer++;
+ scoped_guard(spinlock_irqsave, &hmidi->lock) {
+ if (up) {
+ if (!hmidi->istimer) {
+ timer_setup(&hmidi->timer, snd_hdsp_midi_output_timer,
+ 0);
+ mod_timer(&hmidi->timer, 1 + jiffies);
+ hmidi->istimer++;
+ }
+ } else {
+ if (hmidi->istimer && --hmidi->istimer <= 0)
+ timer_delete(&hmidi->timer);
}
- } else {
- if (hmidi->istimer && --hmidi->istimer <= 0)
- timer_delete(&hmidi->timer);
}
- spin_unlock_irqrestore (&hmidi->lock, flags);
if (up)
snd_hdsp_midi_output_write(hmidi);
}
struct hdsp_midi *hmidi;
hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
- spin_lock_irq (&hmidi->lock);
+ guard(spinlock_irq)(&hmidi->lock);
snd_hdsp_flush_midi_input (hmidi->hdsp, hmidi->id);
hmidi->input = substream;
- spin_unlock_irq (&hmidi->lock);
return 0;
}
struct hdsp_midi *hmidi;
hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
- spin_lock_irq (&hmidi->lock);
+ guard(spinlock_irq)(&hmidi->lock);
hmidi->output = substream;
- spin_unlock_irq (&hmidi->lock);
return 0;
}
snd_hdsp_midi_input_trigger (substream, 0);
hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
- spin_lock_irq (&hmidi->lock);
+ guard(spinlock_irq)(&hmidi->lock);
hmidi->input = NULL;
- spin_unlock_irq (&hmidi->lock);
return 0;
}
snd_hdsp_midi_output_trigger (substream, 0);
hmidi = (struct hdsp_midi *) substream->rmidi->private_data;
- spin_lock_irq (&hmidi->lock);
+ guard(spinlock_irq)(&hmidi->lock);
hmidi->output = NULL;
- spin_unlock_irq (&hmidi->lock);
return 0;
}
u32 val;
val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = val != hdsp->creg_spdif;
hdsp->creg_spdif = val;
- spin_unlock_irq(&hdsp->lock);
return change;
}
u32 val;
val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = val != hdsp->creg_spdif_stream;
hdsp->creg_spdif_stream = val;
hdsp->control_register &= ~(HDSP_SPDIFProfessional | HDSP_SPDIFNonAudio | HDSP_SPDIFEmphasis);
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register |= val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.enumerated.item[0] % ((hdsp->io_type == H9632) ? 4 : 3);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = val != hdsp_spdif_in(hdsp);
if (change)
hdsp_set_spdif_input(hdsp, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
u32 regmask = kcontrol->private_value;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
ucontrol->value.integer.value[0] = hdsp_toggle_setting(hdsp, regmask);
- spin_unlock_irq(&hdsp->lock);
return 0;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.integer.value[0] & 1;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = (int) val != hdsp_toggle_setting(hdsp, regmask);
if (change)
hdsp_set_toggle_setting(hdsp, regmask, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
if (val > 6)
val = 6;
}
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_clock_source(hdsp))
change = (hdsp_set_clock_source(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
val = ucontrol->value.enumerated.item[0];
if (val < 0) val = 0;
if (val > 2) val = 2;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_da_gain(hdsp))
change = (hdsp_set_da_gain(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
val = ucontrol->value.enumerated.item[0];
if (val < 0) val = 0;
if (val > 2) val = 2;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_ad_gain(hdsp))
change = (hdsp_set_ad_gain(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
val = ucontrol->value.enumerated.item[0];
if (val < 0) val = 0;
if (val > 2) val = 2;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_phone_gain(hdsp))
change = (hdsp_set_phone_gain(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
}
val = ucontrol->value.enumerated.item[0] % max;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = (int)val != hdsp_pref_sync_ref(hdsp);
hdsp_set_pref_sync_ref(hdsp, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
{
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
ucontrol->value.integer.value[0] = hdsp->precise_ptr;
- spin_unlock_irq(&hdsp->lock);
return 0;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.integer.value[0] & 1;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = (int)val != hdsp->precise_ptr;
hdsp_set_precise_pointer(hdsp, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
{
struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
ucontrol->value.integer.value[0] = hdsp->use_midi_work;
- spin_unlock_irq(&hdsp->lock);
return 0;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.integer.value[0] & 1;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = (int)val != hdsp->use_midi_work;
hdsp_set_use_midi_work(hdsp, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
else
addr = hdsp_input_to_output_key(hdsp,source, destination);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr);
- spin_unlock_irq(&hdsp->lock);
return 0;
}
gain = ucontrol->value.integer.value[2];
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = gain != hdsp_read_gain(hdsp, addr);
if (change)
hdsp_write_gain(hdsp, addr, gain);
- spin_unlock_irq(&hdsp->lock);
return change;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.integer.value[0];
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_dds_offset(hdsp))
change = (hdsp_set_dds_offset(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
val = 0;
if (val > 4)
val = 4;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_rpm_input12(hdsp))
change = (hdsp_set_rpm_input12(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
val = 0;
if (val > 4)
val = 4;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (val != hdsp_rpm_input34(hdsp))
change = (hdsp_set_rpm_input34(hdsp, val) == 0) ? 1 : 0;
else
change = 0;
- spin_unlock_irq(&hdsp->lock);
return change;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.integer.value[0] & 1;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = (int)val != hdsp_rpm_bypass(hdsp);
hdsp_set_rpm_bypass(hdsp, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
if (!snd_hdsp_use_is_exclusive(hdsp))
return -EBUSY;
val = ucontrol->value.integer.value[0] & 1;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
change = (int)val != hdsp_rpm_disconnect(hdsp);
hdsp_set_rpm_disconnect(hdsp, val);
- spin_unlock_irq(&hdsp->lock);
return change;
}
if (hdsp_check_for_firmware(hdsp, 1))
return -EIO;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) {
hdsp->control_register &= ~(HDSP_SPDIFProfessional | HDSP_SPDIFNonAudio | HDSP_SPDIFEmphasis);
*/
if (params_rate(params) != hdsp->system_sample_rate) {
- spin_unlock_irq(&hdsp->lock);
_snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
return -EBUSY;
}
if (params_period_size(params) != hdsp->period_bytes / 4) {
- spin_unlock_irq(&hdsp->lock);
_snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
return -EBUSY;
}
/* We're fine. */
- spin_unlock_irq(&hdsp->lock);
return 0;
- } else {
- spin_unlock_irq(&hdsp->lock);
}
/* how to make sure that the rate matches an externally-set one ?
*/
- spin_lock_irq(&hdsp->lock);
if (! hdsp->clock_source_locked) {
err = hdsp_set_rate(hdsp, params_rate(params), 0);
if (err < 0) {
- spin_unlock_irq(&hdsp->lock);
_snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
return err;
}
}
- spin_unlock_irq(&hdsp->lock);
err = hdsp_set_interrupt_interval(hdsp, params_period_size(params));
if (err < 0) {
if (hdsp_check_for_firmware(hdsp, 0)) /* no auto-loading in trigger */
return -EIO;
- spin_lock(&hdsp->lock);
+ guard(spinlock)(&hdsp->lock);
running = hdsp->running;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
break;
default:
snd_BUG();
- spin_unlock(&hdsp->lock);
return -EINVAL;
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
else if (hdsp->running && !running)
hdsp_stop_audio(hdsp);
hdsp->running = running;
- spin_unlock(&hdsp->lock);
return 0;
}
if (hdsp_check_for_firmware(hdsp, 1))
return -EIO;
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
if (!hdsp->running)
hdsp_reset_hw_pointer(hdsp);
- spin_unlock_irq(&hdsp->lock);
return result;
}
if (hdsp_check_for_firmware(hdsp, 1))
return -EIO;
- spin_lock_irq(&hdsp->lock);
+ scoped_guard(spinlock_irq, &hdsp->lock) {
+ snd_pcm_set_sync(substream);
- snd_pcm_set_sync(substream);
+ runtime->hw = snd_hdsp_playback_subinfo;
+ snd_pcm_set_runtime_buffer(substream, &hdsp->playback_dma_buf);
- runtime->hw = snd_hdsp_playback_subinfo;
- snd_pcm_set_runtime_buffer(substream, &hdsp->playback_dma_buf);
-
- hdsp->playback_pid = current->pid;
- hdsp->playback_substream = substream;
-
- spin_unlock_irq(&hdsp->lock);
+ hdsp->playback_pid = current->pid;
+ hdsp->playback_substream = substream;
+ }
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hdsp_hw_constraints_period_sizes);
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- spin_lock_irq(&hdsp->lock);
-
- hdsp->playback_pid = -1;
- hdsp->playback_substream = NULL;
-
- spin_unlock_irq(&hdsp->lock);
+ scoped_guard(spinlock_irq, &hdsp->lock) {
+ hdsp->playback_pid = -1;
+ hdsp->playback_substream = NULL;
+ }
if (RPM != hdsp->io_type) {
hdsp->spdif_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
if (hdsp_check_for_firmware(hdsp, 1))
return -EIO;
- spin_lock_irq(&hdsp->lock);
-
- snd_pcm_set_sync(substream);
+ scoped_guard(spinlock_irq, &hdsp->lock) {
+ snd_pcm_set_sync(substream);
- runtime->hw = snd_hdsp_capture_subinfo;
- snd_pcm_set_runtime_buffer(substream, &hdsp->capture_dma_buf);
+ runtime->hw = snd_hdsp_capture_subinfo;
+ snd_pcm_set_runtime_buffer(substream, &hdsp->capture_dma_buf);
- hdsp->capture_pid = current->pid;
- hdsp->capture_substream = substream;
-
- spin_unlock_irq(&hdsp->lock);
+ hdsp->capture_pid = current->pid;
+ hdsp->capture_substream = substream;
+ }
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hdsp_hw_constraints_period_sizes);
{
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
- spin_lock_irq(&hdsp->lock);
+ guard(spinlock_irq)(&hdsp->lock);
hdsp->capture_pid = -1;
hdsp->capture_substream = NULL;
- spin_unlock_irq(&hdsp->lock);
return 0;
}
}
case SNDRV_HDSP_IOCTL_GET_CONFIG_INFO: {
struct hdsp_config_info info;
- unsigned long flags;
int i;
err = hdsp_check_for_iobox(hdsp);
return err;
memset(&info, 0, sizeof(info));
- spin_lock_irqsave(&hdsp->lock, flags);
- info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp);
- info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp);
- if (hdsp->io_type != H9632)
- info.adatsync_sync_check = (unsigned char)hdsp_adatsync_sync_check(hdsp);
- info.spdif_sync_check = (unsigned char)hdsp_spdif_sync_check(hdsp);
- for (i = 0; i < ((hdsp->io_type != Multiface && hdsp->io_type != RPM && hdsp->io_type != H9632) ? 3 : 1); ++i)
- info.adat_sync_check[i] = (unsigned char)hdsp_adat_sync_check(hdsp, i);
- info.spdif_in = (unsigned char)hdsp_spdif_in(hdsp);
- info.spdif_out = (unsigned char)hdsp_toggle_setting(hdsp,
- HDSP_SPDIFOpticalOut);
- info.spdif_professional = (unsigned char)
- hdsp_toggle_setting(hdsp, HDSP_SPDIFProfessional);
- info.spdif_emphasis = (unsigned char)
- hdsp_toggle_setting(hdsp, HDSP_SPDIFEmphasis);
- info.spdif_nonaudio = (unsigned char)
- hdsp_toggle_setting(hdsp, HDSP_SPDIFNonAudio);
- info.spdif_sample_rate = hdsp_spdif_sample_rate(hdsp);
- info.system_sample_rate = hdsp->system_sample_rate;
- info.autosync_sample_rate = hdsp_external_sample_rate(hdsp);
- info.system_clock_mode = (unsigned char)hdsp_system_clock_mode(hdsp);
- info.clock_source = (unsigned char)hdsp_clock_source(hdsp);
- info.autosync_ref = (unsigned char)hdsp_autosync_ref(hdsp);
- info.line_out = (unsigned char)
- hdsp_toggle_setting(hdsp, HDSP_LineOut);
- if (hdsp->io_type == H9632) {
- info.da_gain = (unsigned char)hdsp_da_gain(hdsp);
- info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp);
- info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp);
- info.xlr_breakout_cable =
- (unsigned char)hdsp_toggle_setting(hdsp,
- HDSP_XLRBreakoutCable);
-
- } else if (hdsp->io_type == RPM) {
- info.da_gain = (unsigned char) hdsp_rpm_input12(hdsp);
- info.ad_gain = (unsigned char) hdsp_rpm_input34(hdsp);
+ scoped_guard(spinlock_irqsave, &hdsp->lock) {
+ info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp);
+ info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp);
+ if (hdsp->io_type != H9632)
+ info.adatsync_sync_check = (unsigned char)hdsp_adatsync_sync_check(hdsp);
+ info.spdif_sync_check = (unsigned char)hdsp_spdif_sync_check(hdsp);
+ for (i = 0; i < ((hdsp->io_type != Multiface && hdsp->io_type != RPM && hdsp->io_type != H9632) ? 3 : 1); ++i)
+ info.adat_sync_check[i] = (unsigned char)hdsp_adat_sync_check(hdsp, i);
+ info.spdif_in = (unsigned char)hdsp_spdif_in(hdsp);
+ info.spdif_out = (unsigned char)hdsp_toggle_setting(hdsp,
+ HDSP_SPDIFOpticalOut);
+ info.spdif_professional = (unsigned char)
+ hdsp_toggle_setting(hdsp, HDSP_SPDIFProfessional);
+ info.spdif_emphasis = (unsigned char)
+ hdsp_toggle_setting(hdsp, HDSP_SPDIFEmphasis);
+ info.spdif_nonaudio = (unsigned char)
+ hdsp_toggle_setting(hdsp, HDSP_SPDIFNonAudio);
+ info.spdif_sample_rate = hdsp_spdif_sample_rate(hdsp);
+ info.system_sample_rate = hdsp->system_sample_rate;
+ info.autosync_sample_rate = hdsp_external_sample_rate(hdsp);
+ info.system_clock_mode = (unsigned char)hdsp_system_clock_mode(hdsp);
+ info.clock_source = (unsigned char)hdsp_clock_source(hdsp);
+ info.autosync_ref = (unsigned char)hdsp_autosync_ref(hdsp);
+ info.line_out = (unsigned char)
+ hdsp_toggle_setting(hdsp, HDSP_LineOut);
+ if (hdsp->io_type == H9632) {
+ info.da_gain = (unsigned char)hdsp_da_gain(hdsp);
+ info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp);
+ info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp);
+ info.xlr_breakout_cable =
+ (unsigned char)hdsp_toggle_setting(hdsp,
+ HDSP_XLRBreakoutCable);
+
+ } else if (hdsp->io_type == RPM) {
+ info.da_gain = (unsigned char) hdsp_rpm_input12(hdsp);
+ info.ad_gain = (unsigned char) hdsp_rpm_input34(hdsp);
+ }
+ if (hdsp->io_type == H9632 || hdsp->io_type == H9652)
+ info.analog_extension_board =
+ (unsigned char)hdsp_toggle_setting(hdsp,
+ HDSP_AnalogExtensionBoard);
}
- if (hdsp->io_type == H9632 || hdsp->io_type == H9652)
- info.analog_extension_board =
- (unsigned char)hdsp_toggle_setting(hdsp,
- HDSP_AnalogExtensionBoard);
- spin_unlock_irqrestore(&hdsp->lock, flags);
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
break;