diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-02-28 11:16:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-12 00:41:42 -0500 |
commit | 074f6db61f962e302c83092ac2ee5692f9351454 (patch) | |
tree | 4456c8b67102e8976765de5616809edeb1115818 /sound/pci | |
parent | 5ac9276dd15f6aeb55e8eb0ecf6e15759ae1f501 (diff) |
ALSA: ctxfi: Fallback DMA mask to 32bit
commit 15c75b09f8d190f89ab4db463b87d411ca349dfe upstream.
Currently ctxfi driver tries to set only the 64bit DMA mask on 64bit
architectures, and bails out if it fails. This causes a problem on
some platforms since the 64bit DMA isn't always guaranteed. We should
fall back to the default 32bit DMA when 64bit DMA fails.
Fixes: 6d74b86d3c0f ("ALSA: ctxfi - Allow 64bit DMA")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/ctxfi/cthw20k1.c | 19 | ||||
-rw-r--r-- | sound/pci/ctxfi/cthw20k2.c | 19 |
2 files changed, 12 insertions, 26 deletions
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index 9667cbfb0ca2..ab4cdab5cfa5 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c | |||
@@ -27,12 +27,6 @@ | |||
27 | #include "cthw20k1.h" | 27 | #include "cthw20k1.h" |
28 | #include "ct20k1reg.h" | 28 | #include "ct20k1reg.h" |
29 | 29 | ||
30 | #if BITS_PER_LONG == 32 | ||
31 | #define CT_XFI_DMA_MASK DMA_BIT_MASK(32) /* 32 bit PTE */ | ||
32 | #else | ||
33 | #define CT_XFI_DMA_MASK DMA_BIT_MASK(64) /* 64 bit PTE */ | ||
34 | #endif | ||
35 | |||
36 | struct hw20k1 { | 30 | struct hw20k1 { |
37 | struct hw hw; | 31 | struct hw hw; |
38 | spinlock_t reg_20k1_lock; | 32 | spinlock_t reg_20k1_lock; |
@@ -1904,19 +1898,18 @@ static int hw_card_start(struct hw *hw) | |||
1904 | { | 1898 | { |
1905 | int err; | 1899 | int err; |
1906 | struct pci_dev *pci = hw->pci; | 1900 | struct pci_dev *pci = hw->pci; |
1901 | const unsigned int dma_bits = BITS_PER_LONG; | ||
1907 | 1902 | ||
1908 | err = pci_enable_device(pci); | 1903 | err = pci_enable_device(pci); |
1909 | if (err < 0) | 1904 | if (err < 0) |
1910 | return err; | 1905 | return err; |
1911 | 1906 | ||
1912 | /* Set DMA transfer mask */ | 1907 | /* Set DMA transfer mask */ |
1913 | if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || | 1908 | if (dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) { |
1914 | dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { | 1909 | dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits)); |
1915 | dev_err(hw->card->dev, | 1910 | } else { |
1916 | "architecture does not support PCI busmaster DMA with mask 0x%llx\n", | 1911 | dma_set_mask(&pci->dev, DMA_BIT_MASK(32)); |
1917 | CT_XFI_DMA_MASK); | 1912 | dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)); |
1918 | err = -ENXIO; | ||
1919 | goto error1; | ||
1920 | } | 1913 | } |
1921 | 1914 | ||
1922 | if (!hw->io_base) { | 1915 | if (!hw->io_base) { |
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 6414ecf93efa..18ee7768b7c4 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c | |||
@@ -26,12 +26,6 @@ | |||
26 | #include "cthw20k2.h" | 26 | #include "cthw20k2.h" |
27 | #include "ct20k2reg.h" | 27 | #include "ct20k2reg.h" |
28 | 28 | ||
29 | #if BITS_PER_LONG == 32 | ||
30 | #define CT_XFI_DMA_MASK DMA_BIT_MASK(32) /* 32 bit PTE */ | ||
31 | #else | ||
32 | #define CT_XFI_DMA_MASK DMA_BIT_MASK(64) /* 64 bit PTE */ | ||
33 | #endif | ||
34 | |||
35 | struct hw20k2 { | 29 | struct hw20k2 { |
36 | struct hw hw; | 30 | struct hw hw; |
37 | /* for i2c */ | 31 | /* for i2c */ |
@@ -2029,19 +2023,18 @@ static int hw_card_start(struct hw *hw) | |||
2029 | int err = 0; | 2023 | int err = 0; |
2030 | struct pci_dev *pci = hw->pci; | 2024 | struct pci_dev *pci = hw->pci; |
2031 | unsigned int gctl; | 2025 | unsigned int gctl; |
2026 | const unsigned int dma_bits = BITS_PER_LONG; | ||
2032 | 2027 | ||
2033 | err = pci_enable_device(pci); | 2028 | err = pci_enable_device(pci); |
2034 | if (err < 0) | 2029 | if (err < 0) |
2035 | return err; | 2030 | return err; |
2036 | 2031 | ||
2037 | /* Set DMA transfer mask */ | 2032 | /* Set DMA transfer mask */ |
2038 | if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || | 2033 | if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) { |
2039 | dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { | 2034 | dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits)); |
2040 | dev_err(hw->card->dev, | 2035 | } else { |
2041 | "architecture does not support PCI busmaster DMA with mask 0x%llx\n", | 2036 | dma_set_mask(&pci->dev, DMA_BIT_MASK(32)); |
2042 | CT_XFI_DMA_MASK); | 2037 | dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)); |
2043 | err = -ENXIO; | ||
2044 | goto error1; | ||
2045 | } | 2038 | } |
2046 | 2039 | ||
2047 | if (!hw->io_base) { | 2040 | if (!hw->io_base) { |