Skip to content

Commit fbeac84

Browse files
takaswietiwai
authored andcommitted
ALSA: dice: old firmware optimization for Dice notification
As long as I tested, Dice-based models produced by TC Electronic with factory-configured settings transfer no notification within ensure_phase_lock(). On the other hand, with upgraded firmwares, it starts to transfer the notification. This seems to be a quirk of earlier firmwares. This commit ensures phase lock by reading a register after waiting for the notification. Even if it's timed-out, ensure_phase_lock() return success as long as the register has expected clock status. Signed-off-by: Takashi Sakamoto <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent aec045b commit fbeac84

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

sound/firewire/dice/dice-stream.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const unsigned int snd_dice_rates[SND_DICE_RATES_COUNT] = {
3131
*/
3232
static int ensure_phase_lock(struct snd_dice *dice)
3333
{
34-
__be32 reg;
34+
__be32 reg, nominal;
3535
int err;
3636

3737
err = snd_dice_transaction_read_global(dice, GLOBAL_CLOCK_SELECT,
@@ -48,8 +48,19 @@ static int ensure_phase_lock(struct snd_dice *dice)
4848
return err;
4949

5050
if (wait_for_completion_timeout(&dice->clock_accepted,
51-
msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0)
52-
return -ETIMEDOUT;
51+
msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0) {
52+
/*
53+
* Old versions of Dice firmware transfer no notification when
54+
* the same clock status as current one is set. In this case,
55+
* just check current clock status.
56+
*/
57+
err = snd_dice_transaction_read_global(dice, GLOBAL_STATUS,
58+
&nominal, sizeof(nominal));
59+
if (err < 0)
60+
return err;
61+
if (!(be32_to_cpu(nominal) & STATUS_SOURCE_LOCKED))
62+
return -ETIMEDOUT;
63+
}
5364

5465
return 0;
5566
}

0 commit comments

Comments
 (0)