diff options
author | Dylan Reid <dgreid@chromium.org> | 2014-02-28 18:41:14 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-03-01 05:20:51 -0500 |
commit | 9cdc0115e444108cfa7339386eee46ed2c84a2eb (patch) | |
tree | 295add5b1a186e2a738a107d66efdbb629f6887d /sound/pci/hda | |
parent | 408308133380fcd87a79520a2060850e68fdc2f3 (diff) |
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: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 12 | ||||
-rw-r--r-- | sound/pci/hda/hda_priv.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 45718fbb7de4..9fcd1d128464 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1147,7 +1147,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1147 | { | 1147 | { |
1148 | u32 *bdl; | 1148 | u32 *bdl; |
1149 | int i, ofs, periods, period_bytes; | 1149 | int i, ofs, periods, period_bytes; |
1150 | int pos_adj; | 1150 | int pos_adj = 0; |
1151 | 1151 | ||
1152 | /* reset BDL address */ | 1152 | /* reset BDL address */ |
1153 | azx_sd_writel(chip, azx_dev, SD_BDLPL, 0); | 1153 | azx_sd_writel(chip, azx_dev, SD_BDLPL, 0); |
@@ -1160,7 +1160,9 @@ static int azx_setup_periods(struct azx *chip, | |||
1160 | bdl = (u32 *)azx_dev->bdl.area; | 1160 | bdl = (u32 *)azx_dev->bdl.area; |
1161 | ofs = 0; | 1161 | ofs = 0; |
1162 | azx_dev->frags = 0; | 1162 | azx_dev->frags = 0; |
1163 | pos_adj = bdl_pos_adj[chip->dev_index]; | 1163 | |
1164 | if (chip->bdl_pos_adj) | ||
1165 | pos_adj = chip->bdl_pos_adj[chip->dev_index]; | ||
1164 | if (!azx_dev->no_period_wakeup && pos_adj > 0) { | 1166 | if (!azx_dev->no_period_wakeup && pos_adj > 0) { |
1165 | struct snd_pcm_runtime *runtime = substream->runtime; | 1167 | struct snd_pcm_runtime *runtime = substream->runtime; |
1166 | int pos_align = pos_adj; | 1168 | int pos_align = pos_adj; |
@@ -1173,7 +1175,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1173 | pos_adj = frames_to_bytes(runtime, pos_adj); | 1175 | pos_adj = frames_to_bytes(runtime, pos_adj); |
1174 | if (pos_adj >= period_bytes) { | 1176 | if (pos_adj >= period_bytes) { |
1175 | dev_warn(chip->card->dev,"Too big adjustment %d\n", | 1177 | dev_warn(chip->card->dev,"Too big adjustment %d\n", |
1176 | bdl_pos_adj[chip->dev_index]); | 1178 | pos_adj); |
1177 | pos_adj = 0; | 1179 | pos_adj = 0; |
1178 | } else { | 1180 | } else { |
1179 | ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), | 1181 | ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), |
@@ -1184,6 +1186,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1184 | } | 1186 | } |
1185 | } else | 1187 | } else |
1186 | pos_adj = 0; | 1188 | pos_adj = 0; |
1189 | |||
1187 | for (i = 0; i < periods; i++) { | 1190 | for (i = 0; i < periods; i++) { |
1188 | if (i == periods - 1 && pos_adj) | 1191 | if (i == periods - 1 && pos_adj) |
1189 | ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), | 1192 | 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 | if (wallclk < (azx_dev->period_wallclk * 5) / 4 && | 2146 | if (wallclk < (azx_dev->period_wallclk * 5) / 4 && |
2144 | pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) | 2147 | pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) |
2145 | /* NG - it's below the first next period boundary */ | 2148 | /* NG - it's below the first next period boundary */ |
2146 | return bdl_pos_adj[chip->dev_index] ? 0 : -1; | 2149 | return chip->bdl_pos_adj[chip->dev_index] ? 0 : -1; |
2147 | azx_dev->start_wallclk += wallclk; | 2150 | azx_dev->start_wallclk += wallclk; |
2148 | return 1; /* OK, it's fine */ | 2151 | return 1; /* OK, it's fine */ |
2149 | } | 2152 | } |
@@ -3207,6 +3210,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
3207 | break; | 3210 | break; |
3208 | } | 3211 | } |
3209 | } | 3212 | } |
3213 | chip->bdl_pos_adj = bdl_pos_adj; | ||
3210 | 3214 | ||
3211 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); | 3215 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
3212 | if (err < 0) { | 3216 | if (err < 0) { |
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 6d082d65baed..17afe90e90de 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h | |||
@@ -357,6 +357,7 @@ struct azx { | |||
357 | 357 | ||
358 | /* flags */ | 358 | /* flags */ |
359 | int position_fix[2]; /* for both playback/capture streams */ | 359 | int position_fix[2]; /* for both playback/capture streams */ |
360 | const int *bdl_pos_adj; | ||
360 | int poll_count; | 361 | int poll_count; |
361 | unsigned int running:1; | 362 | unsigned int running:1; |
362 | unsigned int initialized:1; | 363 | unsigned int initialized:1; |