Commit e2f87260 authored by Andreas Mohr's avatar Andreas Mohr Committed by Jaroslav Kysela

[ALSA] azt3328.c: use kernel coding style

Scope braces were not done the One True Kernel Way.
Signed-off-by: default avatarAndreas Mohr <andi@lisas.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 13769e3f
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* in the first place >:-P}), * in the first place >:-P}),
* I was forced to base this driver on reverse engineering * I was forced to base this driver on reverse engineering
* (3 weeks' worth of evenings filled with driver work). * (3 weeks' worth of evenings filled with driver work).
* (and no, I did NOT go the easy way: to pick up a PCI128 for 9 Euros) * (and no, I did NOT go the easy way: to pick up a SB PCI128 for 9 Euros)
* *
* The AZF3328 chip (note: AZF3328, *not* AZT3328, that's just the driver name * The AZF3328 chip (note: AZF3328, *not* AZT3328, that's just the driver name
* for compatibility reasons) has the following features: * for compatibility reasons) has the following features:
...@@ -339,10 +339,8 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip, int reg ...@@ -339,10 +339,8 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip, int reg
else else
dst_vol_left &= ~0x80; dst_vol_left &= ~0x80;
do do {
{ if (!left_done) {
if (!left_done)
{
if (curr_vol_left > dst_vol_left) if (curr_vol_left > dst_vol_left)
curr_vol_left--; curr_vol_left--;
else else
...@@ -352,8 +350,7 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip, int reg ...@@ -352,8 +350,7 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip, int reg
left_done = 1; left_done = 1;
outb(curr_vol_left, portbase + 1); outb(curr_vol_left, portbase + 1);
} }
if (!right_done) if (!right_done) {
{
if (curr_vol_right > dst_vol_right) if (curr_vol_right > dst_vol_right)
curr_vol_right--; curr_vol_right--;
else else
...@@ -368,8 +365,7 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip, int reg ...@@ -368,8 +365,7 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip, int reg
} }
if (delay) if (delay)
mdelay(delay); mdelay(delay);
} } while ((!left_done) || (!right_done));
while ((!left_done) || (!right_done));
snd_azf3328_dbgcallleave(); snd_azf3328_dbgcallleave();
} }
...@@ -556,8 +552,7 @@ snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol, ...@@ -556,8 +552,7 @@ snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol,
uinfo->value.enumerated.items = reg.enum_c; uinfo->value.enumerated.items = reg.enum_c;
if (uinfo->value.enumerated.item > reg.enum_c - 1U) if (uinfo->value.enumerated.item > reg.enum_c - 1U)
uinfo->value.enumerated.item = reg.enum_c - 1U; uinfo->value.enumerated.item = reg.enum_c - 1U;
if (reg.reg == IDX_MIXER_ADVCTL2) if (reg.reg == IDX_MIXER_ADVCTL2) {
{
switch(reg.lchan_shift) { switch(reg.lchan_shift) {
case 8: /* modem out sel */ case 8: /* modem out sel */
strcpy(uinfo->value.enumerated.name, texts1[uinfo->value.enumerated.item]); strcpy(uinfo->value.enumerated.name, texts1[uinfo->value.enumerated.item]);
...@@ -569,8 +564,7 @@ snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol, ...@@ -569,8 +564,7 @@ snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol,
strcpy(uinfo->value.enumerated.name, texts4[uinfo->value.enumerated.item]); strcpy(uinfo->value.enumerated.name, texts4[uinfo->value.enumerated.item]);
break; break;
} }
} } else
else
strcpy(uinfo->value.enumerated.name, texts3[uinfo->value.enumerated.item] strcpy(uinfo->value.enumerated.name, texts3[uinfo->value.enumerated.item]
); );
return 0; return 0;
...@@ -586,12 +580,10 @@ snd_azf3328_get_mixer_enum(struct snd_kcontrol *kcontrol, ...@@ -586,12 +580,10 @@ snd_azf3328_get_mixer_enum(struct snd_kcontrol *kcontrol,
snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value); snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value);
val = snd_azf3328_mixer_inw(chip, reg.reg); val = snd_azf3328_mixer_inw(chip, reg.reg);
if (reg.reg == IDX_MIXER_REC_SELECT) if (reg.reg == IDX_MIXER_REC_SELECT) {
{
ucontrol->value.enumerated.item[0] = (val >> 8) & (reg.enum_c - 1); ucontrol->value.enumerated.item[0] = (val >> 8) & (reg.enum_c - 1);
ucontrol->value.enumerated.item[1] = (val >> 0) & (reg.enum_c - 1); ucontrol->value.enumerated.item[1] = (val >> 0) & (reg.enum_c - 1);
} } else
else
ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1); ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1);
snd_azf3328_dbgmixer("get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n", snd_azf3328_dbgmixer("get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n",
...@@ -611,16 +603,13 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol, ...@@ -611,16 +603,13 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol,
snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value); snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value);
oreg = snd_azf3328_mixer_inw(chip, reg.reg); oreg = snd_azf3328_mixer_inw(chip, reg.reg);
val = oreg; val = oreg;
if (reg.reg == IDX_MIXER_REC_SELECT) if (reg.reg == IDX_MIXER_REC_SELECT) {
{
if (ucontrol->value.enumerated.item[0] > reg.enum_c - 1U || if (ucontrol->value.enumerated.item[0] > reg.enum_c - 1U ||
ucontrol->value.enumerated.item[1] > reg.enum_c - 1U) ucontrol->value.enumerated.item[1] > reg.enum_c - 1U)
return -EINVAL; return -EINVAL;
val = (ucontrol->value.enumerated.item[0] << 8) | val = (ucontrol->value.enumerated.item[0] << 8) |
(ucontrol->value.enumerated.item[1] << 0); (ucontrol->value.enumerated.item[1] << 0);
} } else {
else
{
if (ucontrol->value.enumerated.item[0] > reg.enum_c - 1U) if (ucontrol->value.enumerated.item[0] > reg.enum_c - 1U)
return -EINVAL; return -EINVAL;
val &= ~((reg.enum_c - 1) << reg.lchan_shift); val &= ~((reg.enum_c - 1) << reg.lchan_shift);
...@@ -846,22 +835,18 @@ snd_azf3328_setdmaa(struct snd_azf3328 *chip, ...@@ -846,22 +835,18 @@ snd_azf3328_setdmaa(struct snd_azf3328 *chip,
unsigned int is_running; unsigned int is_running;
snd_azf3328_dbgcallenter(); snd_azf3328_dbgcallenter();
if (do_recording) if (do_recording) {
{
/* access capture registers, i.e. skip playback reg section */ /* access capture registers, i.e. skip playback reg section */
portbase = chip->codec_port + 0x20; portbase = chip->codec_port + 0x20;
is_running = chip->is_recording; is_running = chip->is_recording;
} } else {
else
{
/* access the playback register section */ /* access the playback register section */
portbase = chip->codec_port + 0x00; portbase = chip->codec_port + 0x00;
is_running = chip->is_playing; is_running = chip->is_playing;
} }
/* AZF3328 uses a two buffer pointer DMA playback approach */ /* AZF3328 uses a two buffer pointer DMA playback approach */
if (!is_running) if (!is_running) {
{
unsigned long addr_area2; unsigned long addr_area2;
unsigned long count_areas, count_tmp; /* width 32bit -- overflow!! */ unsigned long count_areas, count_tmp; /* width 32bit -- overflow!! */
count_areas = size/2; count_areas = size/2;
...@@ -1224,8 +1209,7 @@ snd_azf3328_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1224,8 +1209,7 @@ snd_azf3328_interrupt(int irq, void *dev_id, struct pt_regs *regs)
snd_azf3328_codec_inw(chip, IDX_IO_PLAY_IRQTYPE), snd_azf3328_codec_inw(chip, IDX_IO_PLAY_IRQTYPE),
status); status);
if (status & IRQ_TIMER) if (status & IRQ_TIMER) {
{
/* snd_azf3328_dbgplay("timer %ld\n", inl(chip->codec_port+IDX_IO_TIMER_VALUE) & TIMER_VALUE_MASK); */ /* snd_azf3328_dbgplay("timer %ld\n", inl(chip->codec_port+IDX_IO_TIMER_VALUE) & TIMER_VALUE_MASK); */
if (chip->timer) if (chip->timer)
snd_timer_interrupt(chip->timer, chip->timer->sticks); snd_timer_interrupt(chip->timer, chip->timer->sticks);
...@@ -1235,50 +1219,43 @@ snd_azf3328_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1235,50 +1219,43 @@ snd_azf3328_interrupt(int irq, void *dev_id, struct pt_regs *regs)
spin_unlock(&chip->reg_lock); spin_unlock(&chip->reg_lock);
snd_azf3328_dbgplay("azt3328: timer IRQ\n"); snd_azf3328_dbgplay("azt3328: timer IRQ\n");
} }
if (status & IRQ_PLAYBACK) if (status & IRQ_PLAYBACK) {
{
spin_lock(&chip->reg_lock); spin_lock(&chip->reg_lock);
which = snd_azf3328_codec_inb(chip, IDX_IO_PLAY_IRQTYPE); which = snd_azf3328_codec_inb(chip, IDX_IO_PLAY_IRQTYPE);
/* ack all IRQ types immediately */ /* ack all IRQ types immediately */
snd_azf3328_codec_outb(chip, IDX_IO_PLAY_IRQTYPE, which); snd_azf3328_codec_outb(chip, IDX_IO_PLAY_IRQTYPE, which);
spin_unlock(&chip->reg_lock); spin_unlock(&chip->reg_lock);
if (chip->pcm && chip->playback_substream) if (chip->pcm && chip->playback_substream) {
{
snd_pcm_period_elapsed(chip->playback_substream); snd_pcm_period_elapsed(chip->playback_substream);
snd_azf3328_dbgplay("PLAY period done (#%x), @ %x\n", snd_azf3328_dbgplay("PLAY period done (#%x), @ %x\n",
which, which,
inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS)); inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS));
} } else
else
snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n"); snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n");
if (which & IRQ_PLAY_SOMETHING) if (which & IRQ_PLAY_SOMETHING)
snd_azf3328_dbgplay("azt3328: unknown play IRQ type occurred, please report!\n"); snd_azf3328_dbgplay("azt3328: unknown play IRQ type occurred, please report!\n");
} }
if (status & IRQ_RECORDING) if (status & IRQ_RECORDING) {
{
spin_lock(&chip->reg_lock); spin_lock(&chip->reg_lock);
which = snd_azf3328_codec_inb(chip, IDX_IO_REC_IRQTYPE); which = snd_azf3328_codec_inb(chip, IDX_IO_REC_IRQTYPE);
/* ack all IRQ types immediately */ /* ack all IRQ types immediately */
snd_azf3328_codec_outb(chip, IDX_IO_REC_IRQTYPE, which); snd_azf3328_codec_outb(chip, IDX_IO_REC_IRQTYPE, which);
spin_unlock(&chip->reg_lock); spin_unlock(&chip->reg_lock);
if (chip->pcm && chip->capture_substream) if (chip->pcm && chip->capture_substream) {
{
snd_pcm_period_elapsed(chip->capture_substream); snd_pcm_period_elapsed(chip->capture_substream);
snd_azf3328_dbgplay("REC period done (#%x), @ %x\n", snd_azf3328_dbgplay("REC period done (#%x), @ %x\n",
which, which,
inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS)); inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS));
} } else
else
snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n"); snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n");
if (which & IRQ_REC_SOMETHING) if (which & IRQ_REC_SOMETHING)
snd_azf3328_dbgplay("azt3328: unknown rec IRQ type occurred, please report!\n"); snd_azf3328_dbgplay("azt3328: unknown rec IRQ type occurred, please report!\n");
} }
/* MPU401 has less critical IRQ requirements /* MPU401 has less critical IRQ requirements
* than timer and playback/recording, right? */ * than timer and playback/recording, right? */
if (status & IRQ_MPU401) if (status & IRQ_MPU401) {
{
snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs); snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs);
/* hmm, do we have to ack the IRQ here somehow? /* hmm, do we have to ack the IRQ here somehow?
...@@ -1572,8 +1549,7 @@ snd_azf3328_timer_start(struct snd_timer *timer) ...@@ -1572,8 +1549,7 @@ snd_azf3328_timer_start(struct snd_timer *timer)
snd_azf3328_dbgcallenter(); snd_azf3328_dbgcallenter();
chip = snd_timer_chip(timer); chip = snd_timer_chip(timer);
delay = ((timer->sticks * seqtimer_scaling) - 1) & TIMER_VALUE_MASK; delay = ((timer->sticks * seqtimer_scaling) - 1) & TIMER_VALUE_MASK;
if (delay < 49) if (delay < 49) {
{
/* uhoh, that's not good, since user-space won't know about /* uhoh, that's not good, since user-space won't know about
* this timing tweak * this timing tweak
* (we need to do it to avoid a lockup, though) */ * (we need to do it to avoid a lockup, though) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment