aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/emu10k1_main.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-25 11:02:09 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-26 10:45:27 -0500
commit6f002b02166cc037025c0d1600a0e638a82145ac (patch)
treeedd3aacb99b3f744d67dc5703c63c8086ca2f2de /sound/pci/emu10k1/emu10k1_main.c
parent26bc6964f97b3a7d3c86fd4887cbfcb8e7c3d7ce (diff)
ALSA: emu10k1: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1/emu10k1_main.c')
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c73
1 files changed, 45 insertions, 28 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 75504da63613..229269788023 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
217 } 217 }
218 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ 218 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
219 /* Hacks for Alice3 to work independent of haP16V driver */ 219 /* Hacks for Alice3 to work independent of haP16V driver */
220 snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); 220 dev_info(emu->card->dev, "Audigy2 value: Special config.\n");
221 /* Setup SRCMulti_I2S SamplingRate */ 221 /* Setup SRCMulti_I2S SamplingRate */
222 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 222 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
223 tmp &= 0xfffff1ff; 223 tmp &= 0xfffff1ff;
@@ -723,7 +723,8 @@ static int emu1010_firmware_thread(void *data)
723 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { 723 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
724 /* Audio Dock attached */ 724 /* Audio Dock attached */
725 /* Return to Audio Dock programming mode */ 725 /* Return to Audio Dock programming mode */
726 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); 726 dev_info(emu->card->dev,
727 "emu1010: Loading Audio Dock Firmware\n");
727 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK); 728 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
728 729
729 if (!emu->dock_fw) { 730 if (!emu->dock_fw) {
@@ -756,19 +757,25 @@ static int emu1010_firmware_thread(void *data)
756 757
757 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); 758 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
758 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg); 759 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
759 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", reg); 760 dev_info(emu->card->dev,
761 "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n",
762 reg);
760 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ 763 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
761 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 764 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
762 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg); 765 dev_info(emu->card->dev,
766 "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg);
763 if ((reg & 0x1f) != 0x15) { 767 if ((reg & 0x1f) != 0x15) {
764 /* FPGA failed to be programmed */ 768 /* FPGA failed to be programmed */
765 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", reg); 769 dev_info(emu->card->dev,
770 "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n",
771 reg);
766 continue; 772 continue;
767 } 773 }
768 snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); 774 dev_info(emu->card->dev,
775 "emu1010: Audio Dock Firmware loaded\n");
769 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); 776 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
770 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); 777 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
771 snd_printk(KERN_INFO "Audio Dock ver: %u.%u\n", 778 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n",
772 tmp, tmp2); 779 tmp, tmp2);
773 /* Sync clocking between 1010 and Dock */ 780 /* Sync clocking between 1010 and Dock */
774 /* Allow DLL to settle */ 781 /* Allow DLL to settle */
@@ -777,7 +784,7 @@ static int emu1010_firmware_thread(void *data)
777 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 784 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
778 } 785 }
779 } 786 }
780 snd_printk(KERN_INFO "emu1010: firmware thread stopping\n"); 787 dev_info(emu->card->dev, "emu1010: firmware thread stopping\n");
781 return 0; 788 return 0;
782} 789}
783 790
@@ -818,7 +825,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
818 u32 tmp, tmp2, reg; 825 u32 tmp, tmp2, reg;
819 int err; 826 int err;
820 827
821 snd_printk(KERN_INFO "emu1010: Special config.\n"); 828 dev_info(emu->card->dev, "emu1010: Special config.\n");
822 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, 829 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
823 * Lock Sound Memory Cache, Lock Tank Memory Cache, 830 * Lock Sound Memory Cache, Lock Tank Memory Cache,
824 * Mute all codecs. 831 * Mute all codecs.
@@ -843,7 +850,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
843 850
844 /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ 851 /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
845 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 852 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
846 snd_printdd("reg1 = 0x%x\n", reg); 853 dev_dbg(emu->card->dev, "reg1 = 0x%x\n", reg);
847 if ((reg & 0x3f) == 0x15) { 854 if ((reg & 0x3f) == 0x15) {
848 /* FPGA netlist already present so clear it */ 855 /* FPGA netlist already present so clear it */
849 /* Return to programming mode */ 856 /* Return to programming mode */
@@ -851,13 +858,14 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
851 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02); 858 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
852 } 859 }
853 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 860 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
854 snd_printdd("reg2 = 0x%x\n", reg); 861 dev_dbg(emu->card->dev, "reg2 = 0x%x\n", reg);
855 if ((reg & 0x3f) == 0x15) { 862 if ((reg & 0x3f) == 0x15) {
856 /* FPGA failed to return to programming mode */ 863 /* FPGA failed to return to programming mode */
857 snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n"); 864 dev_info(emu->card->dev,
865 "emu1010: FPGA failed to return to programming mode\n");
858 return -ENODEV; 866 return -ENODEV;
859 } 867 }
860 snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg); 868 dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg);
861 869
862 if (!emu->firmware) { 870 if (!emu->firmware) {
863 const char *filename; 871 const char *filename;
@@ -880,16 +888,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
880 888
881 err = request_firmware(&emu->firmware, filename, &emu->pci->dev); 889 err = request_firmware(&emu->firmware, filename, &emu->pci->dev);
882 if (err != 0) { 890 if (err != 0) {
883 snd_printk(KERN_ERR "emu1010: firmware: %s not found. Err = %d\n", filename, err); 891 dev_info(emu->card->dev,
892 "emu1010: firmware: %s not found. Err = %d\n",
893 filename, err);
884 return err; 894 return err;
885 } 895 }
886 snd_printk(KERN_INFO "emu1010: firmware file = %s, size = 0x%zx\n", 896 dev_info(emu->card->dev,
897 "emu1010: firmware file = %s, size = 0x%zx\n",
887 filename, emu->firmware->size); 898 filename, emu->firmware->size);
888 } 899 }
889 900
890 err = snd_emu1010_load_firmware(emu, emu->firmware); 901 err = snd_emu1010_load_firmware(emu, emu->firmware);
891 if (err != 0) { 902 if (err != 0) {
892 snd_printk(KERN_INFO "emu1010: Loading Firmware failed\n"); 903 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n");
893 return err; 904 return err;
894 } 905 }
895 906
@@ -897,21 +908,23 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
897 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 908 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
898 if ((reg & 0x3f) != 0x15) { 909 if ((reg & 0x3f) != 0x15) {
899 /* FPGA failed to be programmed */ 910 /* FPGA failed to be programmed */
900 snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg); 911 dev_info(emu->card->dev,
912 "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n",
913 reg);
901 return -ENODEV; 914 return -ENODEV;
902 } 915 }
903 916
904 snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); 917 dev_info(emu->card->dev, "emu1010: Hana Firmware loaded\n");
905 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); 918 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
906 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); 919 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
907 snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2); 920 dev_info(emu->card->dev, "emu1010: Hana version: %u.%u\n", tmp, tmp2);
908 /* Enable 48Volt power to Audio Dock */ 921 /* Enable 48Volt power to Audio Dock */
909 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); 922 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
910 923
911 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 924 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
912 snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg); 925 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg);
913 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 926 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
914 snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg); 927 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg);
915 snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp); 928 snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp);
916 /* Optical -> ADAT I/O */ 929 /* Optical -> ADAT I/O */
917 /* 0 : SPDIF 930 /* 0 : SPDIF
@@ -950,7 +963,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
950 snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00); 963 snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00);
951 964
952 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 965 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
953 snd_printk(KERN_INFO "emu1010: Card options3 = 0x%x\n", reg); 966 dev_info(emu->card->dev, "emu1010: Card options3 = 0x%x\n", reg);
954 /* Default WCLK set to 48kHz. */ 967 /* Default WCLK set to 48kHz. */
955 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00); 968 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00);
956 /* Word Clock source, Internal 48kHz x1 */ 969 /* Word Clock source, Internal 48kHz x1 */
@@ -1808,7 +1821,9 @@ int snd_emu10k1_create(struct snd_card *card,
1808 emu->revision = pci->revision; 1821 emu->revision = pci->revision;
1809 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); 1822 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
1810 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); 1823 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
1811 snd_printdd("vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n", pci->vendor, pci->device, emu->serial, emu->model); 1824 dev_dbg(card->dev,
1825 "vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n",
1826 pci->vendor, pci->device, emu->serial, emu->model);
1812 1827
1813 for (c = emu_chip_details; c->vendor; c++) { 1828 for (c = emu_chip_details; c->vendor; c++) {
1814 if (c->vendor == pci->vendor && c->device == pci->device) { 1829 if (c->vendor == pci->vendor && c->device == pci->device) {
@@ -1827,21 +1842,21 @@ int snd_emu10k1_create(struct snd_card *card,
1827 } 1842 }
1828 } 1843 }
1829 if (c->vendor == 0) { 1844 if (c->vendor == 0) {
1830 snd_printk(KERN_ERR "emu10k1: Card not recognised\n"); 1845 dev_err(card->dev, "emu10k1: Card not recognised\n");
1831 kfree(emu); 1846 kfree(emu);
1832 pci_disable_device(pci); 1847 pci_disable_device(pci);
1833 return -ENOENT; 1848 return -ENOENT;
1834 } 1849 }
1835 emu->card_capabilities = c; 1850 emu->card_capabilities = c;
1836 if (c->subsystem && !subsystem) 1851 if (c->subsystem && !subsystem)
1837 snd_printdd("Sound card name = %s\n", c->name); 1852 dev_dbg(card->dev, "Sound card name = %s\n", c->name);
1838 else if (subsystem) 1853 else if (subsystem)
1839 snd_printdd("Sound card name = %s, " 1854 dev_dbg(card->dev, "Sound card name = %s, "
1840 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. " 1855 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. "
1841 "Forced to subsystem = 0x%x\n", c->name, 1856 "Forced to subsystem = 0x%x\n", c->name,
1842 pci->vendor, pci->device, emu->serial, c->subsystem); 1857 pci->vendor, pci->device, emu->serial, c->subsystem);
1843 else 1858 else
1844 snd_printdd("Sound card name = %s, " 1859 dev_dbg(card->dev, "Sound card name = %s, "
1845 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n", 1860 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n",
1846 c->name, pci->vendor, pci->device, 1861 c->name, pci->vendor, pci->device,
1847 emu->serial); 1862 emu->serial);
@@ -1869,7 +1884,9 @@ int snd_emu10k1_create(struct snd_card *card,
1869 emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK; 1884 emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK;
1870 if (pci_set_dma_mask(pci, emu->dma_mask) < 0 || 1885 if (pci_set_dma_mask(pci, emu->dma_mask) < 0 ||
1871 pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) { 1886 pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) {
1872 snd_printk(KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n", emu->dma_mask); 1887 dev_err(card->dev,
1888 "architecture does not support PCI busmaster DMA with mask 0x%lx\n",
1889 emu->dma_mask);
1873 kfree(emu); 1890 kfree(emu);
1874 pci_disable_device(pci); 1891 pci_disable_device(pci);
1875 return -ENXIO; 1892 return -ENXIO;