Commit f48f606d authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] snd-hda-intel: Improve azx_position_ok()

Add back the zero return value (activate workqueue) when
bdl_pos_adj is nonzero for position check.

Do the position related check only for first next period
using wallclk counter.

Return -1 value (ignore interrupt) when period_bytes
variable is zero.
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent e5463720
...@@ -1890,9 +1890,8 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) ...@@ -1890,9 +1890,8 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
unsigned int pos; unsigned int pos;
int stream; int stream;
wallclk = azx_readl(chip, WALLCLK); wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk;
if ((wallclk - azx_dev->start_wallclk) < if (wallclk < (azx_dev->period_wallclk * 2) / 3)
(azx_dev->period_wallclk * 2) / 3)
return -1; /* bogus (too early) interrupt */ return -1; /* bogus (too early) interrupt */
stream = azx_dev->substream->stream; stream = azx_dev->substream->stream;
...@@ -1910,9 +1909,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) ...@@ -1910,9 +1909,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
if (WARN_ONCE(!azx_dev->period_bytes, if (WARN_ONCE(!azx_dev->period_bytes,
"hda-intel: zero azx_dev->period_bytes")) "hda-intel: zero azx_dev->period_bytes"))
return 0; /* this shouldn't happen! */ return -1; /* this shouldn't happen! */
if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) if (wallclk <= azx_dev->period_wallclk &&
return 0; /* NG - it's below the period boundary */ pos % azx_dev->period_bytes > azx_dev->period_bytes / 2)
/* NG - it's below the first next period boundary */
return bdl_pos_adj[chip->dev_index] ? 0 : -1;
azx_dev->start_wallclk = wallclk; azx_dev->start_wallclk = wallclk;
return 1; /* OK, it's fine */ return 1; /* OK, it's fine */
} }
......
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