Skip to content

Commit

Permalink
ALSA: dice: fix regression for Lexicon I-ONIX FW810S
Browse files Browse the repository at this point in the history
For Lexicon I-ONIX FW810S, the call of ioctl(2) with
SNDRV_PCM_IOCTL_HW_PARAMS can returns -ETIMEDOUT. This is a regression due
to the commit 41319eb ("ALSA: dice: wait just for
NOTIFY_CLOCK_ACCEPTED after GLOBAL_CLOCK_SELECT operation"). The device
does not emit NOTIFY_CLOCK_ACCEPTED notification when accepting
GLOBAL_CLOCK_SELECT operation with the same parameters as current ones.

This commit fixes the regression. When receiving no notification, return
-ETIMEDOUT as long as operating for any change.

Fixes: 41319eb ("ALSA: dice: wait just for NOTIFY_CLOCK_ACCEPTED after GLOBAL_CLOCK_SELECT operation")
Cc: <[email protected]>
Signed-off-by: Takashi Sakamoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed Nov 30, 2022
1 parent ecae4c8 commit 9b84f0f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sound/firewire/dice/dice-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int snd_dice_stream_get_rate_mode(struct snd_dice *dice, unsigned int rate,

static int select_clock(struct snd_dice *dice, unsigned int rate)
{
__be32 reg;
__be32 reg, new;
u32 data;
int i;
int err;
Expand All @@ -83,15 +83,17 @@ static int select_clock(struct snd_dice *dice, unsigned int rate)
if (completion_done(&dice->clock_accepted))
reinit_completion(&dice->clock_accepted);

reg = cpu_to_be32(data);
new = cpu_to_be32(data);
err = snd_dice_transaction_write_global(dice, GLOBAL_CLOCK_SELECT,
&reg, sizeof(reg));
&new, sizeof(new));
if (err < 0)
return err;

if (wait_for_completion_timeout(&dice->clock_accepted,
msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0)
return -ETIMEDOUT;
msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0) {
if (reg != new)
return -ETIMEDOUT;
}

return 0;
}
Expand Down

0 comments on commit 9b84f0f

Please sign in to comment.