diff options
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/ctxfi/ctatc.c | 22 | ||||
-rw-r--r-- | sound/pci/ctxfi/ctatc.h | 4 | ||||
-rw-r--r-- | sound/pci/ctxfi/cttimer.c | 18 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 2 | ||||
-rw-r--r-- | sound/pci/intel8x0.c | 24 |
5 files changed, 35 insertions, 35 deletions
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 80fb2baed7a7..b0adc8094009 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -259,7 +259,6 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
259 | int n_amixer = apcm->substream->runtime->channels, i = 0; | 259 | int n_amixer = apcm->substream->runtime->channels, i = 0; |
260 | int device = apcm->substream->pcm->device; | 260 | int device = apcm->substream->pcm->device; |
261 | unsigned int pitch; | 261 | unsigned int pitch; |
262 | unsigned long flags; | ||
263 | 262 | ||
264 | if (NULL != apcm->src) { | 263 | if (NULL != apcm->src) { |
265 | /* Prepared pcm playback */ | 264 | /* Prepared pcm playback */ |
@@ -311,10 +310,10 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
311 | src = apcm->src; | 310 | src = apcm->src; |
312 | for (i = 0; i < n_amixer; i++) { | 311 | for (i = 0; i < n_amixer; i++) { |
313 | amixer = apcm->amixers[i]; | 312 | amixer = apcm->amixers[i]; |
314 | spin_lock_irqsave(&atc->atc_lock, flags); | 313 | mutex_lock(&atc->atc_mutex); |
315 | amixer->ops->setup(amixer, &src->rsc, | 314 | amixer->ops->setup(amixer, &src->rsc, |
316 | INIT_VOL, atc->pcm[i+device*2]); | 315 | INIT_VOL, atc->pcm[i+device*2]); |
317 | spin_unlock_irqrestore(&atc->atc_lock, flags); | 316 | mutex_unlock(&atc->atc_mutex); |
318 | src = src->ops->next_interleave(src); | 317 | src = src->ops->next_interleave(src); |
319 | if (NULL == src) | 318 | if (NULL == src) |
320 | src = apcm->src; | 319 | src = apcm->src; |
@@ -865,7 +864,6 @@ static int | |||
865 | spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm) | 864 | spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm) |
866 | { | 865 | { |
867 | struct dao *dao = container_of(atc->daios[SPDIFOO], struct dao, daio); | 866 | struct dao *dao = container_of(atc->daios[SPDIFOO], struct dao, daio); |
868 | unsigned long flags; | ||
869 | unsigned int rate = apcm->substream->runtime->rate; | 867 | unsigned int rate = apcm->substream->runtime->rate; |
870 | unsigned int status; | 868 | unsigned int status; |
871 | int err; | 869 | int err; |
@@ -885,7 +883,7 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
885 | return -ENOENT; | 883 | return -ENOENT; |
886 | } | 884 | } |
887 | 885 | ||
888 | spin_lock_irqsave(&atc->atc_lock, flags); | 886 | mutex_lock(&atc->atc_mutex); |
889 | dao->ops->get_spos(dao, &status); | 887 | dao->ops->get_spos(dao, &status); |
890 | if (((status >> 24) & IEC958_AES3_CON_FS) != iec958_con_fs) { | 888 | if (((status >> 24) & IEC958_AES3_CON_FS) != iec958_con_fs) { |
891 | status &= ((~IEC958_AES3_CON_FS) << 24); | 889 | status &= ((~IEC958_AES3_CON_FS) << 24); |
@@ -895,7 +893,7 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
895 | } | 893 | } |
896 | if ((rate != atc->pll_rate) && (32000 != rate)) | 894 | if ((rate != atc->pll_rate) && (32000 != rate)) |
897 | err = atc_pll_init(atc, rate); | 895 | err = atc_pll_init(atc, rate); |
898 | spin_unlock_irqrestore(&atc->atc_lock, flags); | 896 | mutex_unlock(&atc->atc_mutex); |
899 | 897 | ||
900 | return err; | 898 | return err; |
901 | } | 899 | } |
@@ -908,7 +906,6 @@ spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
908 | struct dao *dao; | 906 | struct dao *dao; |
909 | int err; | 907 | int err; |
910 | int i; | 908 | int i; |
911 | unsigned long flags; | ||
912 | 909 | ||
913 | if (NULL != apcm->src) | 910 | if (NULL != apcm->src) |
914 | return 0; | 911 | return 0; |
@@ -934,13 +931,13 @@ spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
934 | src = apcm->src; | 931 | src = apcm->src; |
935 | } | 932 | } |
936 | /* Connect to SPDIFOO */ | 933 | /* Connect to SPDIFOO */ |
937 | spin_lock_irqsave(&atc->atc_lock, flags); | 934 | mutex_lock(&atc->atc_mutex); |
938 | dao = container_of(atc->daios[SPDIFOO], struct dao, daio); | 935 | dao = container_of(atc->daios[SPDIFOO], struct dao, daio); |
939 | amixer = apcm->amixers[0]; | 936 | amixer = apcm->amixers[0]; |
940 | dao->ops->set_left_input(dao, &amixer->rsc); | 937 | dao->ops->set_left_input(dao, &amixer->rsc); |
941 | amixer = apcm->amixers[1]; | 938 | amixer = apcm->amixers[1]; |
942 | dao->ops->set_right_input(dao, &amixer->rsc); | 939 | dao->ops->set_right_input(dao, &amixer->rsc); |
943 | spin_unlock_irqrestore(&atc->atc_lock, flags); | 940 | mutex_unlock(&atc->atc_mutex); |
944 | 941 | ||
945 | ct_timer_prepare(apcm->timer); | 942 | ct_timer_prepare(apcm->timer); |
946 | 943 | ||
@@ -1088,7 +1085,6 @@ static int atc_spdif_out_set_status(struct ct_atc *atc, unsigned int status) | |||
1088 | 1085 | ||
1089 | static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state) | 1086 | static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state) |
1090 | { | 1087 | { |
1091 | unsigned long flags; | ||
1092 | struct dao_desc da_dsc = {0}; | 1088 | struct dao_desc da_dsc = {0}; |
1093 | struct dao *dao; | 1089 | struct dao *dao; |
1094 | int err; | 1090 | int err; |
@@ -1096,7 +1092,7 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state) | |||
1096 | struct rsc *rscs[2] = {NULL}; | 1092 | struct rsc *rscs[2] = {NULL}; |
1097 | unsigned int spos = 0; | 1093 | unsigned int spos = 0; |
1098 | 1094 | ||
1099 | spin_lock_irqsave(&atc->atc_lock, flags); | 1095 | mutex_lock(&atc->atc_mutex); |
1100 | dao = container_of(atc->daios[SPDIFOO], struct dao, daio); | 1096 | dao = container_of(atc->daios[SPDIFOO], struct dao, daio); |
1101 | da_dsc.msr = state ? 1 : atc->msr; | 1097 | da_dsc.msr = state ? 1 : atc->msr; |
1102 | da_dsc.passthru = state ? 1 : 0; | 1098 | da_dsc.passthru = state ? 1 : 0; |
@@ -1114,7 +1110,7 @@ static int atc_spdif_out_passthru(struct ct_atc *atc, unsigned char state) | |||
1114 | } | 1110 | } |
1115 | dao->ops->set_spos(dao, spos); | 1111 | dao->ops->set_spos(dao, spos); |
1116 | dao->ops->commit_write(dao); | 1112 | dao->ops->commit_write(dao); |
1117 | spin_unlock_irqrestore(&atc->atc_lock, flags); | 1113 | mutex_unlock(&atc->atc_mutex); |
1118 | 1114 | ||
1119 | return err; | 1115 | return err; |
1120 | } | 1116 | } |
@@ -1572,7 +1568,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, | |||
1572 | atc->msr = msr; | 1568 | atc->msr = msr; |
1573 | atc->chip_type = chip_type; | 1569 | atc->chip_type = chip_type; |
1574 | 1570 | ||
1575 | spin_lock_init(&atc->atc_lock); | 1571 | mutex_init(&atc->atc_mutex); |
1576 | 1572 | ||
1577 | /* Find card model */ | 1573 | /* Find card model */ |
1578 | err = atc_identify_card(atc); | 1574 | err = atc_identify_card(atc); |
diff --git a/sound/pci/ctxfi/ctatc.h b/sound/pci/ctxfi/ctatc.h index a03347232e84..9fe620ea5f3f 100644 --- a/sound/pci/ctxfi/ctatc.h +++ b/sound/pci/ctxfi/ctatc.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define CTATC_H | 19 | #define CTATC_H |
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/spinlock_types.h> | 22 | #include <linux/mutex.h> |
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
25 | #include <sound/core.h> | 25 | #include <sound/core.h> |
@@ -90,7 +90,7 @@ struct ct_atc { | |||
90 | void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); | 90 | void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); |
91 | unsigned long (*get_ptp_phys)(struct ct_atc *atc, int index); | 91 | unsigned long (*get_ptp_phys)(struct ct_atc *atc, int index); |
92 | 92 | ||
93 | spinlock_t atc_lock; | 93 | struct mutex atc_mutex; |
94 | 94 | ||
95 | int (*pcm_playback_prepare)(struct ct_atc *atc, | 95 | int (*pcm_playback_prepare)(struct ct_atc *atc, |
96 | struct ct_atc_pcm *apcm); | 96 | struct ct_atc_pcm *apcm); |
diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c index 779c6c3591a5..93b0aedc36d4 100644 --- a/sound/pci/ctxfi/cttimer.c +++ b/sound/pci/ctxfi/cttimer.c | |||
@@ -180,7 +180,7 @@ static inline unsigned int ct_xfitimer_get_wc(struct ct_timer *atimer) | |||
180 | * | 180 | * |
181 | * call this inside the lock and irq disabled | 181 | * call this inside the lock and irq disabled |
182 | */ | 182 | */ |
183 | static int ct_xfitimer_reprogram(struct ct_timer *atimer) | 183 | static int ct_xfitimer_reprogram(struct ct_timer *atimer, int can_update) |
184 | { | 184 | { |
185 | struct ct_timer_instance *ti; | 185 | struct ct_timer_instance *ti; |
186 | unsigned int min_intr = (unsigned int)-1; | 186 | unsigned int min_intr = (unsigned int)-1; |
@@ -216,6 +216,8 @@ static int ct_xfitimer_reprogram(struct ct_timer *atimer) | |||
216 | ti->frag_count = div_u64((u64)pos * CT_TIMER_FREQ + | 216 | ti->frag_count = div_u64((u64)pos * CT_TIMER_FREQ + |
217 | rate - 1, rate); | 217 | rate - 1, rate); |
218 | } | 218 | } |
219 | if (ti->need_update && !can_update) | ||
220 | min_intr = 0; /* pending to the next irq */ | ||
219 | if (ti->frag_count < min_intr) | 221 | if (ti->frag_count < min_intr) |
220 | min_intr = ti->frag_count; | 222 | min_intr = ti->frag_count; |
221 | } | 223 | } |
@@ -235,7 +237,7 @@ static void ct_xfitimer_check_period(struct ct_timer *atimer) | |||
235 | 237 | ||
236 | spin_lock_irqsave(&atimer->list_lock, flags); | 238 | spin_lock_irqsave(&atimer->list_lock, flags); |
237 | list_for_each_entry(ti, &atimer->instance_head, instance_list) { | 239 | list_for_each_entry(ti, &atimer->instance_head, instance_list) { |
238 | if (ti->need_update) { | 240 | if (ti->running && ti->need_update) { |
239 | ti->need_update = 0; | 241 | ti->need_update = 0; |
240 | ti->apcm->interrupt(ti->apcm); | 242 | ti->apcm->interrupt(ti->apcm); |
241 | } | 243 | } |
@@ -252,7 +254,7 @@ static void ct_xfitimer_callback(struct ct_timer *atimer) | |||
252 | spin_lock_irqsave(&atimer->lock, flags); | 254 | spin_lock_irqsave(&atimer->lock, flags); |
253 | atimer->irq_handling = 1; | 255 | atimer->irq_handling = 1; |
254 | do { | 256 | do { |
255 | update = ct_xfitimer_reprogram(atimer); | 257 | update = ct_xfitimer_reprogram(atimer, 1); |
256 | spin_unlock(&atimer->lock); | 258 | spin_unlock(&atimer->lock); |
257 | if (update) | 259 | if (update) |
258 | ct_xfitimer_check_period(atimer); | 260 | ct_xfitimer_check_period(atimer); |
@@ -265,6 +267,7 @@ static void ct_xfitimer_callback(struct ct_timer *atimer) | |||
265 | static void ct_xfitimer_prepare(struct ct_timer_instance *ti) | 267 | static void ct_xfitimer_prepare(struct ct_timer_instance *ti) |
266 | { | 268 | { |
267 | ti->frag_count = ti->substream->runtime->period_size; | 269 | ti->frag_count = ti->substream->runtime->period_size; |
270 | ti->running = 0; | ||
268 | ti->need_update = 0; | 271 | ti->need_update = 0; |
269 | } | 272 | } |
270 | 273 | ||
@@ -273,7 +276,6 @@ static void ct_xfitimer_prepare(struct ct_timer_instance *ti) | |||
273 | static void ct_xfitimer_update(struct ct_timer *atimer) | 276 | static void ct_xfitimer_update(struct ct_timer *atimer) |
274 | { | 277 | { |
275 | unsigned long flags; | 278 | unsigned long flags; |
276 | int update; | ||
277 | 279 | ||
278 | spin_lock_irqsave(&atimer->lock, flags); | 280 | spin_lock_irqsave(&atimer->lock, flags); |
279 | if (atimer->irq_handling) { | 281 | if (atimer->irq_handling) { |
@@ -284,10 +286,8 @@ static void ct_xfitimer_update(struct ct_timer *atimer) | |||
284 | } | 286 | } |
285 | 287 | ||
286 | ct_xfitimer_irq_stop(atimer); | 288 | ct_xfitimer_irq_stop(atimer); |
287 | update = ct_xfitimer_reprogram(atimer); | 289 | ct_xfitimer_reprogram(atimer, 0); |
288 | spin_unlock_irqrestore(&atimer->lock, flags); | 290 | spin_unlock_irqrestore(&atimer->lock, flags); |
289 | if (update) | ||
290 | ct_xfitimer_check_period(atimer); | ||
291 | } | 291 | } |
292 | 292 | ||
293 | static void ct_xfitimer_start(struct ct_timer_instance *ti) | 293 | static void ct_xfitimer_start(struct ct_timer_instance *ti) |
@@ -298,6 +298,8 @@ static void ct_xfitimer_start(struct ct_timer_instance *ti) | |||
298 | spin_lock_irqsave(&atimer->lock, flags); | 298 | spin_lock_irqsave(&atimer->lock, flags); |
299 | if (list_empty(&ti->running_list)) | 299 | if (list_empty(&ti->running_list)) |
300 | atimer->wc = ct_xfitimer_get_wc(atimer); | 300 | atimer->wc = ct_xfitimer_get_wc(atimer); |
301 | ti->running = 1; | ||
302 | ti->need_update = 0; | ||
301 | list_add(&ti->running_list, &atimer->running_head); | 303 | list_add(&ti->running_list, &atimer->running_head); |
302 | spin_unlock_irqrestore(&atimer->lock, flags); | 304 | spin_unlock_irqrestore(&atimer->lock, flags); |
303 | ct_xfitimer_update(atimer); | 305 | ct_xfitimer_update(atimer); |
@@ -310,7 +312,7 @@ static void ct_xfitimer_stop(struct ct_timer_instance *ti) | |||
310 | 312 | ||
311 | spin_lock_irqsave(&atimer->lock, flags); | 313 | spin_lock_irqsave(&atimer->lock, flags); |
312 | list_del_init(&ti->running_list); | 314 | list_del_init(&ti->running_list); |
313 | ti->need_update = 0; | 315 | ti->running = 0; |
314 | spin_unlock_irqrestore(&atimer->lock, flags); | 316 | spin_unlock_irqrestore(&atimer->lock, flags); |
315 | ct_xfitimer_update(atimer); | 317 | ct_xfitimer_update(atimer); |
316 | } | 318 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 337d2a59c67e..d22b26068014 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -9014,6 +9014,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
9014 | ALC888_ACER_ASPIRE_4930G), | 9014 | ALC888_ACER_ASPIRE_4930G), |
9015 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | 9015 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
9016 | ALC888_ACER_ASPIRE_8930G), | 9016 | ALC888_ACER_ASPIRE_8930G), |
9017 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | ||
9018 | ALC888_ACER_ASPIRE_8930G), | ||
9017 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), | 9019 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
9018 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), | 9020 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
9019 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | 9021 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 173bebf9f51d..8aa5687f392a 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -356,8 +356,6 @@ struct ichdev { | |||
356 | unsigned int position; | 356 | unsigned int position; |
357 | unsigned int pos_shift; | 357 | unsigned int pos_shift; |
358 | unsigned int last_pos; | 358 | unsigned int last_pos; |
359 | unsigned long last_pos_jiffies; | ||
360 | unsigned int jiffy_to_bytes; | ||
361 | int frags; | 359 | int frags; |
362 | int lvi; | 360 | int lvi; |
363 | int lvi_frag; | 361 | int lvi_frag; |
@@ -844,7 +842,6 @@ static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd | |||
844 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 842 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
845 | val = ICH_IOCE | ICH_STARTBM; | 843 | val = ICH_IOCE | ICH_STARTBM; |
846 | ichdev->last_pos = ichdev->position; | 844 | ichdev->last_pos = ichdev->position; |
847 | ichdev->last_pos_jiffies = jiffies; | ||
848 | break; | 845 | break; |
849 | case SNDRV_PCM_TRIGGER_SUSPEND: | 846 | case SNDRV_PCM_TRIGGER_SUSPEND: |
850 | ichdev->suspended = 1; | 847 | ichdev->suspended = 1; |
@@ -1048,7 +1045,6 @@ static int snd_intel8x0_pcm_prepare(struct snd_pcm_substream *substream) | |||
1048 | ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; | 1045 | ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; |
1049 | } | 1046 | } |
1050 | snd_intel8x0_setup_periods(chip, ichdev); | 1047 | snd_intel8x0_setup_periods(chip, ichdev); |
1051 | ichdev->jiffy_to_bytes = (runtime->rate * 4 * ichdev->pos_shift) / HZ; | ||
1052 | return 0; | 1048 | return 0; |
1053 | } | 1049 | } |
1054 | 1050 | ||
@@ -1073,19 +1069,23 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs | |||
1073 | ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) | 1069 | ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) |
1074 | break; | 1070 | break; |
1075 | } while (timeout--); | 1071 | } while (timeout--); |
1072 | ptr = ichdev->last_pos; | ||
1076 | if (ptr1 != 0) { | 1073 | if (ptr1 != 0) { |
1077 | ptr1 <<= ichdev->pos_shift; | 1074 | ptr1 <<= ichdev->pos_shift; |
1078 | ptr = ichdev->fragsize1 - ptr1; | 1075 | ptr = ichdev->fragsize1 - ptr1; |
1079 | ptr += position; | 1076 | ptr += position; |
1080 | ichdev->last_pos = ptr; | 1077 | if (ptr < ichdev->last_pos) { |
1081 | ichdev->last_pos_jiffies = jiffies; | 1078 | unsigned int pos_base, last_base; |
1082 | } else { | 1079 | pos_base = position / ichdev->fragsize1; |
1083 | ptr1 = jiffies - ichdev->last_pos_jiffies; | 1080 | last_base = ichdev->last_pos / ichdev->fragsize1; |
1084 | if (ptr1) | 1081 | /* another sanity check; ptr1 can go back to full |
1085 | ptr1 -= 1; | 1082 | * before the base position is updated |
1086 | ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes; | 1083 | */ |
1087 | ptr %= ichdev->size; | 1084 | if (pos_base == last_base) |
1085 | ptr = ichdev->last_pos; | ||
1086 | } | ||
1088 | } | 1087 | } |
1088 | ichdev->last_pos = ptr; | ||
1089 | spin_unlock(&chip->reg_lock); | 1089 | spin_unlock(&chip->reg_lock); |
1090 | if (ptr >= ichdev->size) | 1090 | if (ptr >= ichdev->size) |
1091 | return 0; | 1091 | return 0; |