提交 9cdc0115 编写于 作者: D Dylan Reid 提交者: Takashi Iwai

ALSA: hda - Keep pointer to bdl_pos_fix in chip struct

This will allow for a platform hda driver to use it as well.  It
removes the dependency on the module param from hda_intel, which will
allow for azx_setup_periods to be shared.
Signed-off-by: NDylan Reid <dgreid@chromium.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 40830813
...@@ -1147,7 +1147,7 @@ static int azx_setup_periods(struct azx *chip, ...@@ -1147,7 +1147,7 @@ static int azx_setup_periods(struct azx *chip,
{ {
u32 *bdl; u32 *bdl;
int i, ofs, periods, period_bytes; int i, ofs, periods, period_bytes;
int pos_adj; int pos_adj = 0;
/* reset BDL address */ /* reset BDL address */
azx_sd_writel(chip, azx_dev, SD_BDLPL, 0); azx_sd_writel(chip, azx_dev, SD_BDLPL, 0);
...@@ -1160,7 +1160,9 @@ static int azx_setup_periods(struct azx *chip, ...@@ -1160,7 +1160,9 @@ static int azx_setup_periods(struct azx *chip,
bdl = (u32 *)azx_dev->bdl.area; bdl = (u32 *)azx_dev->bdl.area;
ofs = 0; ofs = 0;
azx_dev->frags = 0; azx_dev->frags = 0;
pos_adj = bdl_pos_adj[chip->dev_index];
if (chip->bdl_pos_adj)
pos_adj = chip->bdl_pos_adj[chip->dev_index];
if (!azx_dev->no_period_wakeup && pos_adj > 0) { if (!azx_dev->no_period_wakeup && pos_adj > 0) {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int pos_align = pos_adj; int pos_align = pos_adj;
...@@ -1173,7 +1175,7 @@ static int azx_setup_periods(struct azx *chip, ...@@ -1173,7 +1175,7 @@ static int azx_setup_periods(struct azx *chip,
pos_adj = frames_to_bytes(runtime, pos_adj); pos_adj = frames_to_bytes(runtime, pos_adj);
if (pos_adj >= period_bytes) { if (pos_adj >= period_bytes) {
dev_warn(chip->card->dev,"Too big adjustment %d\n", dev_warn(chip->card->dev,"Too big adjustment %d\n",
bdl_pos_adj[chip->dev_index]); pos_adj);
pos_adj = 0; pos_adj = 0;
} else { } else {
ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream),
...@@ -1184,6 +1186,7 @@ static int azx_setup_periods(struct azx *chip, ...@@ -1184,6 +1186,7 @@ static int azx_setup_periods(struct azx *chip,
} }
} else } else
pos_adj = 0; pos_adj = 0;
for (i = 0; i < periods; i++) { for (i = 0; i < periods; i++) {
if (i == periods - 1 && pos_adj) if (i == periods - 1 && pos_adj)
ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream),
...@@ -2143,7 +2146,7 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) ...@@ -2143,7 +2146,7 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
if (wallclk < (azx_dev->period_wallclk * 5) / 4 && if (wallclk < (azx_dev->period_wallclk * 5) / 4 &&
pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) pos % azx_dev->period_bytes > azx_dev->period_bytes / 2)
/* NG - it's below the first next period boundary */ /* NG - it's below the first next period boundary */
return bdl_pos_adj[chip->dev_index] ? 0 : -1; return chip->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 */
} }
...@@ -3207,6 +3210,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, ...@@ -3207,6 +3210,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
break; break;
} }
} }
chip->bdl_pos_adj = bdl_pos_adj;
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) { if (err < 0) {
......
...@@ -357,6 +357,7 @@ struct azx { ...@@ -357,6 +357,7 @@ struct azx {
/* flags */ /* flags */
int position_fix[2]; /* for both playback/capture streams */ int position_fix[2]; /* for both playback/capture streams */
const int *bdl_pos_adj;
int poll_count; int poll_count;
unsigned int running:1; unsigned int running:1;
unsigned int initialized:1; unsigned int initialized:1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册