diff options
-rw-r--r-- | include/sound/ymfpci.h | 1 | ||||
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 20 |
2 files changed, 16 insertions, 5 deletions
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h index 05ead6698434..444cd6ba0ba7 100644 --- a/include/sound/ymfpci.h +++ b/include/sound/ymfpci.h | |||
@@ -331,6 +331,7 @@ struct snd_ymfpci { | |||
331 | struct snd_ac97 *ac97; | 331 | struct snd_ac97 *ac97; |
332 | struct snd_rawmidi *rawmidi; | 332 | struct snd_rawmidi *rawmidi; |
333 | struct snd_timer *timer; | 333 | struct snd_timer *timer; |
334 | unsigned int timer_ticks; | ||
334 | 335 | ||
335 | struct pci_dev *pci; | 336 | struct pci_dev *pci; |
336 | struct snd_card *card; | 337 | struct snd_card *card; |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 2f0925236a1b..5518371db13f 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -834,7 +834,7 @@ static irqreturn_t snd_ymfpci_interrupt(int irq, void *dev_id) | |||
834 | status = snd_ymfpci_readw(chip, YDSXGR_INTFLAG); | 834 | status = snd_ymfpci_readw(chip, YDSXGR_INTFLAG); |
835 | if (status & 1) { | 835 | if (status & 1) { |
836 | if (chip->timer) | 836 | if (chip->timer) |
837 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 837 | snd_timer_interrupt(chip->timer, chip->timer_ticks); |
838 | } | 838 | } |
839 | snd_ymfpci_writew(chip, YDSXGR_INTFLAG, status); | 839 | snd_ymfpci_writew(chip, YDSXGR_INTFLAG, status); |
840 | 840 | ||
@@ -1885,8 +1885,18 @@ static int snd_ymfpci_timer_start(struct snd_timer *timer) | |||
1885 | unsigned int count; | 1885 | unsigned int count; |
1886 | 1886 | ||
1887 | chip = snd_timer_chip(timer); | 1887 | chip = snd_timer_chip(timer); |
1888 | count = (timer->sticks << 1) - 1; | ||
1889 | spin_lock_irqsave(&chip->reg_lock, flags); | 1888 | spin_lock_irqsave(&chip->reg_lock, flags); |
1889 | if (timer->sticks > 1) { | ||
1890 | chip->timer_ticks = timer->sticks; | ||
1891 | count = timer->sticks - 1; | ||
1892 | } else { | ||
1893 | /* | ||
1894 | * Divisor 1 is not allowed; fake it by using divisor 2 and | ||
1895 | * counting two ticks for each interrupt. | ||
1896 | */ | ||
1897 | chip->timer_ticks = 2; | ||
1898 | count = 2 - 1; | ||
1899 | } | ||
1890 | snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count); | 1900 | snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count); |
1891 | snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03); | 1901 | snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03); |
1892 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1902 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -1909,14 +1919,14 @@ static int snd_ymfpci_timer_precise_resolution(struct snd_timer *timer, | |||
1909 | unsigned long *num, unsigned long *den) | 1919 | unsigned long *num, unsigned long *den) |
1910 | { | 1920 | { |
1911 | *num = 1; | 1921 | *num = 1; |
1912 | *den = 48000; | 1922 | *den = 96000; |
1913 | return 0; | 1923 | return 0; |
1914 | } | 1924 | } |
1915 | 1925 | ||
1916 | static struct snd_timer_hardware snd_ymfpci_timer_hw = { | 1926 | static struct snd_timer_hardware snd_ymfpci_timer_hw = { |
1917 | .flags = SNDRV_TIMER_HW_AUTO, | 1927 | .flags = SNDRV_TIMER_HW_AUTO, |
1918 | .resolution = 20833, /* 1/fs = 20.8333...us */ | 1928 | .resolution = 10417, /* 1 / 96 kHz = 10.41666...us */ |
1919 | .ticks = 0x8000, | 1929 | .ticks = 0x10000, |
1920 | .start = snd_ymfpci_timer_start, | 1930 | .start = snd_ymfpci_timer_start, |
1921 | .stop = snd_ymfpci_timer_stop, | 1931 | .stop = snd_ymfpci_timer_stop, |
1922 | .precise_resolution = snd_ymfpci_timer_precise_resolution, | 1932 | .precise_resolution = snd_ymfpci_timer_precise_resolution, |