Commit a2875a92 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: dice: purge transaction initialization at timeout of Dice notification

In previous commit, card registration is processed under situation
with few bus reset. There's no need to add a workaround of transaction
re-initialization at timeout.

This commit purges the re-initialization.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b59fb190
...@@ -65,16 +65,15 @@ static unsigned int get_clock_info(struct snd_dice *dice, __be32 *info) ...@@ -65,16 +65,15 @@ static unsigned int get_clock_info(struct snd_dice *dice, __be32 *info)
static int set_clock_info(struct snd_dice *dice, static int set_clock_info(struct snd_dice *dice,
unsigned int rate, unsigned int source) unsigned int rate, unsigned int source)
{ {
unsigned int retries = 3;
unsigned int i; unsigned int i;
__be32 info; __be32 info;
u32 mask; u32 mask;
u32 clock; u32 clock;
int err; int err;
retry:
err = get_clock_info(dice, &info); err = get_clock_info(dice, &info);
if (err < 0) if (err < 0)
goto end; return err;
clock = be32_to_cpu(info); clock = be32_to_cpu(info);
if (source != UINT_MAX) { if (source != UINT_MAX) {
...@@ -87,10 +86,8 @@ static int set_clock_info(struct snd_dice *dice, ...@@ -87,10 +86,8 @@ static int set_clock_info(struct snd_dice *dice,
if (snd_dice_rates[i] == rate) if (snd_dice_rates[i] == rate)
break; break;
} }
if (i == ARRAY_SIZE(snd_dice_rates)) { if (i == ARRAY_SIZE(snd_dice_rates))
err = -EINVAL; return -EINVAL;
goto end;
}
mask = CLOCK_RATE_MASK; mask = CLOCK_RATE_MASK;
clock &= ~mask; clock &= ~mask;
...@@ -104,25 +101,13 @@ static int set_clock_info(struct snd_dice *dice, ...@@ -104,25 +101,13 @@ static int set_clock_info(struct snd_dice *dice,
err = snd_dice_transaction_write_global(dice, GLOBAL_CLOCK_SELECT, err = snd_dice_transaction_write_global(dice, GLOBAL_CLOCK_SELECT,
&info, 4); &info, 4);
if (err < 0) if (err < 0)
goto end; return err;
/* Timeout means it's invalid request, probably bus reset occurred. */
if (wait_for_completion_timeout(&dice->clock_accepted, if (wait_for_completion_timeout(&dice->clock_accepted,
msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0) { msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0)
if (retries-- == 0) { return -ETIMEDOUT;
err = -ETIMEDOUT;
goto end;
}
err = snd_dice_transaction_reinit(dice);
if (err < 0)
goto end;
msleep(500); /* arbitrary */ return 0;
goto retry;
}
end:
return err;
} }
int snd_dice_transaction_get_clock_source(struct snd_dice *dice, int snd_dice_transaction_get_clock_source(struct snd_dice *dice,
......
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