diff options
26 files changed, 126 insertions, 69 deletions
diff --git a/include/sound/designware_i2s.h b/include/sound/designware_i2s.h index 26f406e0f673..3a8fca9409a7 100644 --- a/include/sound/designware_i2s.h +++ b/include/sound/designware_i2s.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (ST) 2012 Rajeev Kumar (rajeev-dlh.kumar@st.com) | 2 | * Copyright (ST) 2012 Rajeev Kumar (rajeevkumar.linux@gmail.com) |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 0de95ccb92cf..5bd134651f5e 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
@@ -41,7 +41,8 @@ | |||
41 | 41 | ||
42 | #define EMUPAGESIZE 4096 | 42 | #define EMUPAGESIZE 4096 |
43 | #define MAXREQVOICES 8 | 43 | #define MAXREQVOICES 8 |
44 | #define MAXPAGES 8192 | 44 | #define MAXPAGES0 4096 /* 32 bit mode */ |
45 | #define MAXPAGES1 8192 /* 31 bit mode */ | ||
45 | #define RESERVED 0 | 46 | #define RESERVED 0 |
46 | #define NUM_MIDI 16 | 47 | #define NUM_MIDI 16 |
47 | #define NUM_G 64 /* use all channels */ | 48 | #define NUM_G 64 /* use all channels */ |
@@ -50,8 +51,7 @@ | |||
50 | 51 | ||
51 | /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ | 52 | /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ |
52 | #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ | 53 | #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ |
53 | #define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */ | 54 | #define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit mode */ |
54 | /* See ALSA bug #1276 - rlrevell */ | ||
55 | 55 | ||
56 | #define TMEMSIZE 256*1024 | 56 | #define TMEMSIZE 256*1024 |
57 | #define TMEMSIZEREG 4 | 57 | #define TMEMSIZEREG 4 |
@@ -466,8 +466,11 @@ | |||
466 | 466 | ||
467 | #define MAPB 0x0d /* Cache map B */ | 467 | #define MAPB 0x0d /* Cache map B */ |
468 | 468 | ||
469 | #define MAP_PTE_MASK 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ | 469 | #define MAP_PTE_MASK0 0xfffff000 /* The 20 MSBs of the PTE indexed by the PTI */ |
470 | #define MAP_PTI_MASK 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ | 470 | #define MAP_PTI_MASK0 0x00000fff /* The 12 bit index to one of the 4096 PTE dwords */ |
471 | |||
472 | #define MAP_PTE_MASK1 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ | ||
473 | #define MAP_PTI_MASK1 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ | ||
471 | 474 | ||
472 | /* 0x0e, 0x0f: Not used */ | 475 | /* 0x0e, 0x0f: Not used */ |
473 | 476 | ||
@@ -1704,6 +1707,7 @@ struct snd_emu10k1 { | |||
1704 | unsigned short model; /* subsystem id */ | 1707 | unsigned short model; /* subsystem id */ |
1705 | unsigned int card_type; /* EMU10K1_CARD_* */ | 1708 | unsigned int card_type; /* EMU10K1_CARD_* */ |
1706 | unsigned int ecard_ctrl; /* ecard control bits */ | 1709 | unsigned int ecard_ctrl; /* ecard control bits */ |
1710 | unsigned int address_mode; /* address mode */ | ||
1707 | unsigned long dma_mask; /* PCI DMA mask */ | 1711 | unsigned long dma_mask; /* PCI DMA mask */ |
1708 | unsigned int delay_pcm_irq; /* in samples */ | 1712 | unsigned int delay_pcm_irq; /* in samples */ |
1709 | int max_cache_pages; /* max memory size / PAGE_SIZE */ | 1713 | int max_cache_pages; /* max memory size / PAGE_SIZE */ |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 0bc83647d3fa..1065095c6973 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -287,7 +287,7 @@ struct device; | |||
287 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | 287 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ |
288 | .tlv.p = (tlv_array), \ | 288 | .tlv.p = (tlv_array), \ |
289 | .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ | 289 | .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ |
290 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } | 290 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) } |
291 | #define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \ | 291 | #define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \ |
292 | SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array) | 292 | SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array) |
293 | #define SOC_DAPM_ENUM(xname, xenum) \ | 293 | #define SOC_DAPM_ENUM(xname, xenum) \ |
diff --git a/include/sound/soc.h b/include/sound/soc.h index fcb312b3f258..f6226914acfe 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -387,8 +387,20 @@ int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, | |||
387 | int snd_soc_register_card(struct snd_soc_card *card); | 387 | int snd_soc_register_card(struct snd_soc_card *card); |
388 | int snd_soc_unregister_card(struct snd_soc_card *card); | 388 | int snd_soc_unregister_card(struct snd_soc_card *card); |
389 | int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card); | 389 | int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card); |
390 | #ifdef CONFIG_PM_SLEEP | ||
390 | int snd_soc_suspend(struct device *dev); | 391 | int snd_soc_suspend(struct device *dev); |
391 | int snd_soc_resume(struct device *dev); | 392 | int snd_soc_resume(struct device *dev); |
393 | #else | ||
394 | static inline int snd_soc_suspend(struct device *dev) | ||
395 | { | ||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static inline int snd_soc_resume(struct device *dev) | ||
400 | { | ||
401 | return 0; | ||
402 | } | ||
403 | #endif | ||
392 | int snd_soc_poweroff(struct device *dev); | 404 | int snd_soc_poweroff(struct device *dev); |
393 | int snd_soc_register_platform(struct device *dev, | 405 | int snd_soc_register_platform(struct device *dev, |
394 | const struct snd_soc_platform_driver *platform_drv); | 406 | const struct snd_soc_platform_driver *platform_drv); |
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h index 65aca51fe255..e290de4e7e82 100644 --- a/include/sound/spear_dma.h +++ b/include/sound/spear_dma.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/spear_dma.h | 2 | * linux/spear_dma.h |
3 | * | 3 | * |
4 | * Copyright (ST) 2012 Rajeev Kumar (rajeev-dlh.kumar@st.com) | 4 | * Copyright (ST) 2012 Rajeev Kumar (rajeevkumar.linux@gmail.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 37d0220a094c..db7a2e5e4a14 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -183,8 +183,10 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci, | |||
183 | } | 183 | } |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | strcpy(card->driver, emu->card_capabilities->driver); | 186 | strlcpy(card->driver, emu->card_capabilities->driver, |
187 | strcpy(card->shortname, emu->card_capabilities->name); | 187 | sizeof(card->driver)); |
188 | strlcpy(card->shortname, emu->card_capabilities->name, | ||
189 | sizeof(card->shortname)); | ||
188 | snprintf(card->longname, sizeof(card->longname), | 190 | snprintf(card->longname, sizeof(card->longname), |
189 | "%s (rev.%d, serial:0x%x) at 0x%lx, irq %i", | 191 | "%s (rev.%d, serial:0x%x) at 0x%lx, irq %i", |
190 | card->shortname, emu->revision, emu->serial, emu->port, emu->irq); | 192 | card->shortname, emu->revision, emu->serial, emu->port, emu->irq); |
diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index 874cd76c7b7f..d2c7ea3a7610 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c | |||
@@ -415,7 +415,7 @@ start_voice(struct snd_emux_voice *vp) | |||
415 | snd_emu10k1_ptr_write(hw, Z2, ch, 0); | 415 | snd_emu10k1_ptr_write(hw, Z2, ch, 0); |
416 | 416 | ||
417 | /* invalidate maps */ | 417 | /* invalidate maps */ |
418 | temp = (hw->silent_page.addr << 1) | MAP_PTI_MASK; | 418 | temp = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); |
419 | snd_emu10k1_ptr_write(hw, MAPA, ch, temp); | 419 | snd_emu10k1_ptr_write(hw, MAPA, ch, temp); |
420 | snd_emu10k1_ptr_write(hw, MAPB, ch, temp); | 420 | snd_emu10k1_ptr_write(hw, MAPB, ch, temp); |
421 | #if 0 | 421 | #if 0 |
@@ -436,7 +436,7 @@ start_voice(struct snd_emux_voice *vp) | |||
436 | snd_emu10k1_ptr_write(hw, CDF, ch, sample); | 436 | snd_emu10k1_ptr_write(hw, CDF, ch, sample); |
437 | 437 | ||
438 | /* invalidate maps */ | 438 | /* invalidate maps */ |
439 | temp = ((unsigned int)hw->silent_page.addr << 1) | MAP_PTI_MASK; | 439 | temp = ((unsigned int)hw->silent_page.addr << hw_address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); |
440 | snd_emu10k1_ptr_write(hw, MAPA, ch, temp); | 440 | snd_emu10k1_ptr_write(hw, MAPA, ch, temp); |
441 | snd_emu10k1_ptr_write(hw, MAPB, ch, temp); | 441 | snd_emu10k1_ptr_write(hw, MAPB, ch, temp); |
442 | 442 | ||
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 54079f5d5673..a4548147c621 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -282,7 +282,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
282 | snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ | 282 | snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ |
283 | snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */ | 283 | snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */ |
284 | 284 | ||
285 | silent_page = (emu->silent_page.addr << 1) | MAP_PTI_MASK; | 285 | silent_page = (emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); |
286 | for (ch = 0; ch < NUM_G; ch++) { | 286 | for (ch = 0; ch < NUM_G; ch++) { |
287 | snd_emu10k1_ptr_write(emu, MAPA, ch, silent_page); | 287 | snd_emu10k1_ptr_write(emu, MAPA, ch, silent_page); |
288 | snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page); | 288 | snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page); |
@@ -348,6 +348,11 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
348 | outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); | 348 | outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); |
349 | } | 349 | } |
350 | 350 | ||
351 | if (emu->address_mode == 0) { | ||
352 | /* use 16M in 4G */ | ||
353 | outl(inl(emu->port + HCFG) | HCFG_EXPANDED_MEM, emu->port + HCFG); | ||
354 | } | ||
355 | |||
351 | return 0; | 356 | return 0; |
352 | } | 357 | } |
353 | 358 | ||
@@ -1446,7 +1451,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
1446 | * | 1451 | * |
1447 | */ | 1452 | */ |
1448 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, | 1453 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, |
1449 | .driver = "Audigy2", .name = "SB Audigy 2 ZS Notebook [SB0530]", | 1454 | .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", |
1450 | .id = "Audigy2", | 1455 | .id = "Audigy2", |
1451 | .emu10k2_chip = 1, | 1456 | .emu10k2_chip = 1, |
1452 | .ca0108_chip = 1, | 1457 | .ca0108_chip = 1, |
@@ -1596,7 +1601,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
1596 | .adc_1361t = 1, /* 24 bit capture instead of 16bit */ | 1601 | .adc_1361t = 1, /* 24 bit capture instead of 16bit */ |
1597 | .ac97_chip = 1} , | 1602 | .ac97_chip = 1} , |
1598 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102, | 1603 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102, |
1599 | .driver = "Audigy2", .name = "SB Audigy 2 Platinum EX [SB0280]", | 1604 | .driver = "Audigy2", .name = "Audigy 2 Platinum EX [SB0280]", |
1600 | .id = "Audigy2", | 1605 | .id = "Audigy2", |
1601 | .emu10k2_chip = 1, | 1606 | .emu10k2_chip = 1, |
1602 | .ca0102_chip = 1, | 1607 | .ca0102_chip = 1, |
@@ -1902,8 +1907,10 @@ int snd_emu10k1_create(struct snd_card *card, | |||
1902 | 1907 | ||
1903 | is_audigy = emu->audigy = c->emu10k2_chip; | 1908 | is_audigy = emu->audigy = c->emu10k2_chip; |
1904 | 1909 | ||
1910 | /* set addressing mode */ | ||
1911 | emu->address_mode = is_audigy ? 0 : 1; | ||
1905 | /* set the DMA transfer mask */ | 1912 | /* set the DMA transfer mask */ |
1906 | emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK; | 1913 | emu->dma_mask = emu->address_mode ? EMU10K1_DMA_MASK : AUDIGY_DMA_MASK; |
1907 | if (pci_set_dma_mask(pci, emu->dma_mask) < 0 || | 1914 | if (pci_set_dma_mask(pci, emu->dma_mask) < 0 || |
1908 | pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) { | 1915 | pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) { |
1909 | dev_err(card->dev, | 1916 | dev_err(card->dev, |
@@ -1928,7 +1935,7 @@ int snd_emu10k1_create(struct snd_card *card, | |||
1928 | 1935 | ||
1929 | emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; | 1936 | emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; |
1930 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), | 1937 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), |
1931 | 32 * 1024, &emu->ptb_pages) < 0) { | 1938 | (emu->address_mode ? 32 : 16) * 1024, &emu->ptb_pages) < 0) { |
1932 | err = -ENOMEM; | 1939 | err = -ENOMEM; |
1933 | goto error; | 1940 | goto error; |
1934 | } | 1941 | } |
@@ -2027,8 +2034,8 @@ int snd_emu10k1_create(struct snd_card *card, | |||
2027 | 2034 | ||
2028 | /* Clear silent pages and set up pointers */ | 2035 | /* Clear silent pages and set up pointers */ |
2029 | memset(emu->silent_page.area, 0, PAGE_SIZE); | 2036 | memset(emu->silent_page.area, 0, PAGE_SIZE); |
2030 | silent_page = emu->silent_page.addr << 1; | 2037 | silent_page = emu->silent_page.addr << emu->address_mode; |
2031 | for (idx = 0; idx < MAXPAGES; idx++) | 2038 | for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++) |
2032 | ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx); | 2039 | ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx); |
2033 | 2040 | ||
2034 | /* set up voice indices */ | 2041 | /* set up voice indices */ |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 0dc07385af0e..14a305bd8a98 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -380,7 +380,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, | |||
380 | snd_emu10k1_ptr_write(emu, Z1, voice, 0); | 380 | snd_emu10k1_ptr_write(emu, Z1, voice, 0); |
381 | snd_emu10k1_ptr_write(emu, Z2, voice, 0); | 381 | snd_emu10k1_ptr_write(emu, Z2, voice, 0); |
382 | /* invalidate maps */ | 382 | /* invalidate maps */ |
383 | silent_page = ((unsigned int)emu->silent_page.addr << 1) | MAP_PTI_MASK; | 383 | silent_page = ((unsigned int)emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); |
384 | snd_emu10k1_ptr_write(emu, MAPA, voice, silent_page); | 384 | snd_emu10k1_ptr_write(emu, MAPA, voice, silent_page); |
385 | snd_emu10k1_ptr_write(emu, MAPB, voice, silent_page); | 385 | snd_emu10k1_ptr_write(emu, MAPB, voice, silent_page); |
386 | /* modulation envelope */ | 386 | /* modulation envelope */ |
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index c68e6dd2fa67..4f1f69be1865 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c | |||
@@ -34,10 +34,11 @@ | |||
34 | * aligned pages in others | 34 | * aligned pages in others |
35 | */ | 35 | */ |
36 | #define __set_ptb_entry(emu,page,addr) \ | 36 | #define __set_ptb_entry(emu,page,addr) \ |
37 | (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << 1) | (page))) | 37 | (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << (emu->address_mode)) | (page))) |
38 | 38 | ||
39 | #define UNIT_PAGES (PAGE_SIZE / EMUPAGESIZE) | 39 | #define UNIT_PAGES (PAGE_SIZE / EMUPAGESIZE) |
40 | #define MAX_ALIGN_PAGES (MAXPAGES / UNIT_PAGES) | 40 | #define MAX_ALIGN_PAGES0 (MAXPAGES0 / UNIT_PAGES) |
41 | #define MAX_ALIGN_PAGES1 (MAXPAGES1 / UNIT_PAGES) | ||
41 | /* get aligned page from offset address */ | 42 | /* get aligned page from offset address */ |
42 | #define get_aligned_page(offset) ((offset) >> PAGE_SHIFT) | 43 | #define get_aligned_page(offset) ((offset) >> PAGE_SHIFT) |
43 | /* get offset address from aligned page */ | 44 | /* get offset address from aligned page */ |
@@ -124,7 +125,7 @@ static int search_empty_map_area(struct snd_emu10k1 *emu, int npages, struct lis | |||
124 | } | 125 | } |
125 | page = blk->mapped_page + blk->pages; | 126 | page = blk->mapped_page + blk->pages; |
126 | } | 127 | } |
127 | size = MAX_ALIGN_PAGES - page; | 128 | size = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0) - page; |
128 | if (size >= max_size) { | 129 | if (size >= max_size) { |
129 | *nextp = pos; | 130 | *nextp = pos; |
130 | return page; | 131 | return page; |
@@ -181,7 +182,7 @@ static int unmap_memblk(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) | |||
181 | q = get_emu10k1_memblk(p, mapped_link); | 182 | q = get_emu10k1_memblk(p, mapped_link); |
182 | end_page = q->mapped_page; | 183 | end_page = q->mapped_page; |
183 | } else | 184 | } else |
184 | end_page = MAX_ALIGN_PAGES; | 185 | end_page = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0); |
185 | 186 | ||
186 | /* remove links */ | 187 | /* remove links */ |
187 | list_del(&blk->mapped_link); | 188 | list_del(&blk->mapped_link); |
@@ -307,7 +308,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst | |||
307 | if (snd_BUG_ON(!emu)) | 308 | if (snd_BUG_ON(!emu)) |
308 | return NULL; | 309 | return NULL; |
309 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || | 310 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || |
310 | runtime->dma_bytes >= MAXPAGES * EMUPAGESIZE)) | 311 | runtime->dma_bytes >= (emu->address_mode ? MAXPAGES1 : MAXPAGES0) * EMUPAGESIZE)) |
311 | return NULL; | 312 | return NULL; |
312 | hdr = emu->memhdr; | 313 | hdr = emu->memhdr; |
313 | if (snd_BUG_ON(!hdr)) | 314 | if (snd_BUG_ON(!hdr)) |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 873ed1bce12b..b49feff0a319 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -873,14 +873,15 @@ struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec *codec, | |||
873 | struct hda_pcm *pcm; | 873 | struct hda_pcm *pcm; |
874 | va_list args; | 874 | va_list args; |
875 | 875 | ||
876 | va_start(args, fmt); | ||
877 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); | 876 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); |
878 | if (!pcm) | 877 | if (!pcm) |
879 | return NULL; | 878 | return NULL; |
880 | 879 | ||
881 | pcm->codec = codec; | 880 | pcm->codec = codec; |
882 | kref_init(&pcm->kref); | 881 | kref_init(&pcm->kref); |
882 | va_start(args, fmt); | ||
883 | pcm->name = kvasprintf(GFP_KERNEL, fmt, args); | 883 | pcm->name = kvasprintf(GFP_KERNEL, fmt, args); |
884 | va_end(args); | ||
884 | if (!pcm->name) { | 885 | if (!pcm->name) { |
885 | kfree(pcm); | 886 | kfree(pcm); |
886 | return NULL; | 887 | return NULL; |
@@ -2082,6 +2083,16 @@ static struct snd_kcontrol_new vmaster_mute_mode = { | |||
2082 | .put = vmaster_mute_mode_put, | 2083 | .put = vmaster_mute_mode_put, |
2083 | }; | 2084 | }; |
2084 | 2085 | ||
2086 | /* meta hook to call each driver's vmaster hook */ | ||
2087 | static void vmaster_hook(void *private_data, int enabled) | ||
2088 | { | ||
2089 | struct hda_vmaster_mute_hook *hook = private_data; | ||
2090 | |||
2091 | if (hook->mute_mode != HDA_VMUTE_FOLLOW_MASTER) | ||
2092 | enabled = hook->mute_mode; | ||
2093 | hook->hook(hook->codec, enabled); | ||
2094 | } | ||
2095 | |||
2085 | /** | 2096 | /** |
2086 | * snd_hda_add_vmaster_hook - Add a vmaster hook for mute-LED | 2097 | * snd_hda_add_vmaster_hook - Add a vmaster hook for mute-LED |
2087 | * @codec: the HDA codec | 2098 | * @codec: the HDA codec |
@@ -2100,9 +2111,9 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec, | |||
2100 | 2111 | ||
2101 | if (!hook->hook || !hook->sw_kctl) | 2112 | if (!hook->hook || !hook->sw_kctl) |
2102 | return 0; | 2113 | return 0; |
2103 | snd_ctl_add_vmaster_hook(hook->sw_kctl, hook->hook, codec); | ||
2104 | hook->codec = codec; | 2114 | hook->codec = codec; |
2105 | hook->mute_mode = HDA_VMUTE_FOLLOW_MASTER; | 2115 | hook->mute_mode = HDA_VMUTE_FOLLOW_MASTER; |
2116 | snd_ctl_add_vmaster_hook(hook->sw_kctl, vmaster_hook, hook); | ||
2106 | if (!expose_enum_ctl) | 2117 | if (!expose_enum_ctl) |
2107 | return 0; | 2118 | return 0; |
2108 | kctl = snd_ctl_new1(&vmaster_mute_mode, hook); | 2119 | kctl = snd_ctl_new1(&vmaster_mute_mode, hook); |
@@ -2128,14 +2139,7 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook) | |||
2128 | */ | 2139 | */ |
2129 | if (hook->codec->bus->shutdown) | 2140 | if (hook->codec->bus->shutdown) |
2130 | return; | 2141 | return; |
2131 | switch (hook->mute_mode) { | 2142 | snd_ctl_sync_vmaster_hook(hook->sw_kctl); |
2132 | case HDA_VMUTE_FOLLOW_MASTER: | ||
2133 | snd_ctl_sync_vmaster_hook(hook->sw_kctl); | ||
2134 | break; | ||
2135 | default: | ||
2136 | hook->hook(hook->codec, hook->mute_mode); | ||
2137 | break; | ||
2138 | } | ||
2139 | } | 2143 | } |
2140 | EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook); | 2144 | EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook); |
2141 | 2145 | ||
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 3d2597b7037b..788f969b1a68 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -3259,7 +3259,8 @@ static int create_input_ctls(struct hda_codec *codec) | |||
3259 | val = PIN_IN; | 3259 | val = PIN_IN; |
3260 | if (cfg->inputs[i].type == AUTO_PIN_MIC) | 3260 | if (cfg->inputs[i].type == AUTO_PIN_MIC) |
3261 | val |= snd_hda_get_default_vref(codec, pin); | 3261 | val |= snd_hda_get_default_vref(codec, pin); |
3262 | if (pin != spec->hp_mic_pin) | 3262 | if (pin != spec->hp_mic_pin && |
3263 | !snd_hda_codec_get_pin_target(codec, pin)) | ||
3263 | set_pin_target(codec, pin, val, false); | 3264 | set_pin_target(codec, pin, val, false); |
3264 | 3265 | ||
3265 | if (mixer) { | 3266 | if (mixer) { |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 06199e4e930f..e2afd53cc14c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4190,11 +4190,18 @@ static void alc_shutup_dell_xps13(struct hda_codec *codec) | |||
4190 | static void alc_fixup_dell_xps13(struct hda_codec *codec, | 4190 | static void alc_fixup_dell_xps13(struct hda_codec *codec, |
4191 | const struct hda_fixup *fix, int action) | 4191 | const struct hda_fixup *fix, int action) |
4192 | { | 4192 | { |
4193 | if (action == HDA_FIXUP_ACT_PROBE) { | 4193 | struct alc_spec *spec = codec->spec; |
4194 | struct alc_spec *spec = codec->spec; | 4194 | struct hda_input_mux *imux = &spec->gen.input_mux; |
4195 | struct hda_input_mux *imux = &spec->gen.input_mux; | 4195 | int i; |
4196 | int i; | ||
4197 | 4196 | ||
4197 | switch (action) { | ||
4198 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
4199 | /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise | ||
4200 | * it causes a click noise at start up | ||
4201 | */ | ||
4202 | snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); | ||
4203 | break; | ||
4204 | case HDA_FIXUP_ACT_PROBE: | ||
4198 | spec->shutup = alc_shutup_dell_xps13; | 4205 | spec->shutup = alc_shutup_dell_xps13; |
4199 | 4206 | ||
4200 | /* Make the internal mic the default input source. */ | 4207 | /* Make the internal mic the default input source. */ |
@@ -4204,6 +4211,7 @@ static void alc_fixup_dell_xps13(struct hda_codec *codec, | |||
4204 | break; | 4211 | break; |
4205 | } | 4212 | } |
4206 | } | 4213 | } |
4214 | break; | ||
4207 | } | 4215 | } |
4208 | } | 4216 | } |
4209 | 4217 | ||
diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c index 0a4ad5feb82e..d51703e30523 100644 --- a/sound/pci/hda/thinkpad_helper.c +++ b/sound/pci/hda/thinkpad_helper.c | |||
@@ -72,6 +72,7 @@ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, | |||
72 | if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { | 72 | if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { |
73 | old_vmaster_hook = spec->vmaster_mute.hook; | 73 | old_vmaster_hook = spec->vmaster_mute.hook; |
74 | spec->vmaster_mute.hook = update_tpacpi_mute_led; | 74 | spec->vmaster_mute.hook = update_tpacpi_mute_led; |
75 | spec->vmaster_mute_enum = 1; | ||
75 | removefunc = false; | 76 | removefunc = false; |
76 | } | 77 | } |
77 | if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { | 78 | if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 69528ae5410c..be4d741c45ba 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/spi/spi.h> | 19 | #include <linux/spi/spi.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/acpi.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
@@ -2656,6 +2657,15 @@ static const struct i2c_device_id rt5645_i2c_id[] = { | |||
2656 | }; | 2657 | }; |
2657 | MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id); | 2658 | MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id); |
2658 | 2659 | ||
2660 | #ifdef CONFIG_ACPI | ||
2661 | static struct acpi_device_id rt5645_acpi_match[] = { | ||
2662 | { "10EC5645", 0 }, | ||
2663 | { "10EC5650", 0 }, | ||
2664 | {}, | ||
2665 | }; | ||
2666 | MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); | ||
2667 | #endif | ||
2668 | |||
2659 | static int rt5645_i2c_probe(struct i2c_client *i2c, | 2669 | static int rt5645_i2c_probe(struct i2c_client *i2c, |
2660 | const struct i2c_device_id *id) | 2670 | const struct i2c_device_id *id) |
2661 | { | 2671 | { |
@@ -2770,7 +2780,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
2770 | 2780 | ||
2771 | case RT5645_DMIC_DATA_GPIO12: | 2781 | case RT5645_DMIC_DATA_GPIO12: |
2772 | regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, | 2782 | regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, |
2773 | RT5645_DMIC_1_DP_MASK, RT5645_DMIC_2_DP_GPIO12); | 2783 | RT5645_DMIC_2_DP_MASK, RT5645_DMIC_2_DP_GPIO12); |
2774 | regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, | 2784 | regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, |
2775 | RT5645_GP12_PIN_MASK, | 2785 | RT5645_GP12_PIN_MASK, |
2776 | RT5645_GP12_PIN_DMIC2_SDA); | 2786 | RT5645_GP12_PIN_DMIC2_SDA); |
@@ -2872,6 +2882,7 @@ static struct i2c_driver rt5645_i2c_driver = { | |||
2872 | .driver = { | 2882 | .driver = { |
2873 | .name = "rt5645", | 2883 | .name = "rt5645", |
2874 | .owner = THIS_MODULE, | 2884 | .owner = THIS_MODULE, |
2885 | .acpi_match_table = ACPI_PTR(rt5645_acpi_match), | ||
2875 | }, | 2886 | }, |
2876 | .probe = rt5645_i2c_probe, | 2887 | .probe = rt5645_i2c_probe, |
2877 | .remove = rt5645_i2c_remove, | 2888 | .remove = rt5645_i2c_remove, |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index af182586712d..169aa471ffbd 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -62,6 +62,9 @@ static const struct reg_default init_list[] = { | |||
62 | {RT5677_PR_BASE + 0x1e, 0x0000}, | 62 | {RT5677_PR_BASE + 0x1e, 0x0000}, |
63 | {RT5677_PR_BASE + 0x12, 0x0eaa}, | 63 | {RT5677_PR_BASE + 0x12, 0x0eaa}, |
64 | {RT5677_PR_BASE + 0x14, 0x018a}, | 64 | {RT5677_PR_BASE + 0x14, 0x018a}, |
65 | {RT5677_PR_BASE + 0x15, 0x0490}, | ||
66 | {RT5677_PR_BASE + 0x38, 0x0f71}, | ||
67 | {RT5677_PR_BASE + 0x39, 0x0f71}, | ||
65 | }; | 68 | }; |
66 | #define RT5677_INIT_REG_LEN ARRAY_SIZE(init_list) | 69 | #define RT5677_INIT_REG_LEN ARRAY_SIZE(init_list) |
67 | 70 | ||
@@ -914,7 +917,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
914 | { | 917 | { |
915 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 918 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
916 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 919 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
917 | int idx = rl6231_calc_dmic_clk(rt5677->sysclk); | 920 | int idx = rl6231_calc_dmic_clk(rt5677->lrck[RT5677_AIF1] << 8); |
918 | 921 | ||
919 | if (idx < 0) | 922 | if (idx < 0) |
920 | dev_err(codec->dev, "Failed to set DMIC clock\n"); | 923 | dev_err(codec->dev, "Failed to set DMIC clock\n"); |
diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c index 16f1b71edb55..aab0af681e8c 100644 --- a/sound/soc/codecs/tfa9879.c +++ b/sound/soc/codecs/tfa9879.c | |||
@@ -280,8 +280,8 @@ static int tfa9879_i2c_probe(struct i2c_client *i2c, | |||
280 | int i; | 280 | int i; |
281 | 281 | ||
282 | tfa9879 = devm_kzalloc(&i2c->dev, sizeof(*tfa9879), GFP_KERNEL); | 282 | tfa9879 = devm_kzalloc(&i2c->dev, sizeof(*tfa9879), GFP_KERNEL); |
283 | if (IS_ERR(tfa9879)) | 283 | if (!tfa9879) |
284 | return PTR_ERR(tfa9879); | 284 | return -ENOMEM; |
285 | 285 | ||
286 | i2c_set_clientdata(i2c, tfa9879); | 286 | i2c_set_clientdata(i2c, tfa9879); |
287 | 287 | ||
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index e8bb8eef1d16..0d48804218b1 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -1357,7 +1357,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | ssi_private->irq = platform_get_irq(pdev, 0); | 1359 | ssi_private->irq = platform_get_irq(pdev, 0); |
1360 | if (!ssi_private->irq) { | 1360 | if (ssi_private->irq < 0) { |
1361 | dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); | 1361 | dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); |
1362 | return ssi_private->irq; | 1362 | return ssi_private->irq; |
1363 | } | 1363 | } |
diff --git a/sound/soc/intel/Makefile b/sound/soc/intel/Makefile index cd9aee9871a3..3853ec2ddbc7 100644 --- a/sound/soc/intel/Makefile +++ b/sound/soc/intel/Makefile | |||
@@ -4,7 +4,7 @@ obj-$(CONFIG_SND_SOC_INTEL_SST) += common/ | |||
4 | # Platform Support | 4 | # Platform Support |
5 | obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += haswell/ | 5 | obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += haswell/ |
6 | obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += baytrail/ | 6 | obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += baytrail/ |
7 | obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += atom/ | 7 | obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += atom/ |
8 | 8 | ||
9 | # Machine support | 9 | # Machine support |
10 | obj-$(CONFIG_SND_SOC_INTEL_SST) += boards/ | 10 | obj-$(CONFIG_SND_SOC_INTEL_SST) += boards/ |
diff --git a/sound/soc/intel/baytrail/sst-baytrail-ipc.c b/sound/soc/intel/baytrail/sst-baytrail-ipc.c index 1efb33b36303..a839dbfa5218 100644 --- a/sound/soc/intel/baytrail/sst-baytrail-ipc.c +++ b/sound/soc/intel/baytrail/sst-baytrail-ipc.c | |||
@@ -759,7 +759,6 @@ fw_err: | |||
759 | dsp_new_err: | 759 | dsp_new_err: |
760 | sst_ipc_fini(ipc); | 760 | sst_ipc_fini(ipc); |
761 | ipc_init_err: | 761 | ipc_init_err: |
762 | kfree(byt); | ||
763 | 762 | ||
764 | return err; | 763 | return err; |
765 | } | 764 | } |
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c index 344a1e9bbce5..324eceb07b25 100644 --- a/sound/soc/intel/haswell/sst-haswell-ipc.c +++ b/sound/soc/intel/haswell/sst-haswell-ipc.c | |||
@@ -2201,7 +2201,6 @@ dma_err: | |||
2201 | dsp_new_err: | 2201 | dsp_new_err: |
2202 | sst_ipc_fini(ipc); | 2202 | sst_ipc_fini(ipc); |
2203 | ipc_init_err: | 2203 | ipc_init_err: |
2204 | kfree(hsw); | ||
2205 | return ret; | 2204 | return ret; |
2206 | } | 2205 | } |
2207 | EXPORT_SYMBOL_GPL(sst_hsw_dsp_init); | 2206 | EXPORT_SYMBOL_GPL(sst_hsw_dsp_init); |
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 6698d058de29..dc790abaa331 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c | |||
@@ -194,7 +194,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, | |||
194 | int cmd, struct snd_soc_dai *dai) | 194 | int cmd, struct snd_soc_dai *dai) |
195 | { | 195 | { |
196 | struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); | 196 | struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); |
197 | int ret; | 197 | int ret = -EINVAL; |
198 | 198 | ||
199 | switch (cmd) { | 199 | switch (cmd) { |
200 | case SNDRV_PCM_TRIGGER_START: | 200 | case SNDRV_PCM_TRIGGER_START: |
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index 326d3c3804e3..5bf723689692 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c | |||
@@ -461,8 +461,8 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) | |||
461 | return -ENOENT; | 461 | return -ENOENT; |
462 | } | 462 | } |
463 | s3c24xx_i2s.regs = devm_ioremap_resource(&pdev->dev, res); | 463 | s3c24xx_i2s.regs = devm_ioremap_resource(&pdev->dev, res); |
464 | if (s3c24xx_i2s.regs == NULL) | 464 | if (IS_ERR(s3c24xx_i2s.regs)) |
465 | return -ENXIO; | 465 | return PTR_ERR(s3c24xx_i2s.regs); |
466 | 466 | ||
467 | s3c24xx_i2s_pcm_stereo_out.dma_addr = res->start + S3C2410_IISFIFO; | 467 | s3c24xx_i2s_pcm_stereo_out.dma_addr = res->start + S3C2410_IISFIFO; |
468 | s3c24xx_i2s_pcm_stereo_in.dma_addr = res->start + S3C2410_IISFIFO; | 468 | s3c24xx_i2s_pcm_stereo_in.dma_addr = res->start + S3C2410_IISFIFO; |
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index ac3756f6af60..144308f15fb3 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c | |||
@@ -156,6 +156,7 @@ static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id, | |||
156 | (void *)id); | 156 | (void *)id); |
157 | } | 157 | } |
158 | if (IS_ERR_OR_NULL(dmaen->chan)) { | 158 | if (IS_ERR_OR_NULL(dmaen->chan)) { |
159 | dmaen->chan = NULL; | ||
159 | dev_err(dev, "can't get dma channel\n"); | 160 | dev_err(dev, "can't get dma channel\n"); |
160 | goto rsnd_dma_channel_err; | 161 | goto rsnd_dma_channel_err; |
161 | } | 162 | } |
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c index ab37add269ae..82e350e9501c 100644 --- a/sound/synth/emux/emux_oss.c +++ b/sound/synth/emux/emux_oss.c | |||
@@ -118,12 +118,8 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
118 | if (snd_BUG_ON(!arg || !emu)) | 118 | if (snd_BUG_ON(!arg || !emu)) |
119 | return -ENXIO; | 119 | return -ENXIO; |
120 | 120 | ||
121 | mutex_lock(&emu->register_mutex); | 121 | if (!snd_emux_inc_count(emu)) |
122 | |||
123 | if (!snd_emux_inc_count(emu)) { | ||
124 | mutex_unlock(&emu->register_mutex); | ||
125 | return -EFAULT; | 122 | return -EFAULT; |
126 | } | ||
127 | 123 | ||
128 | memset(&callback, 0, sizeof(callback)); | 124 | memset(&callback, 0, sizeof(callback)); |
129 | callback.owner = THIS_MODULE; | 125 | callback.owner = THIS_MODULE; |
@@ -135,7 +131,6 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
135 | if (p == NULL) { | 131 | if (p == NULL) { |
136 | snd_printk(KERN_ERR "can't create port\n"); | 132 | snd_printk(KERN_ERR "can't create port\n"); |
137 | snd_emux_dec_count(emu); | 133 | snd_emux_dec_count(emu); |
138 | mutex_unlock(&emu->register_mutex); | ||
139 | return -ENOMEM; | 134 | return -ENOMEM; |
140 | } | 135 | } |
141 | 136 | ||
@@ -148,8 +143,6 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
148 | reset_port_mode(p, arg->seq_mode); | 143 | reset_port_mode(p, arg->seq_mode); |
149 | 144 | ||
150 | snd_emux_reset_port(p); | 145 | snd_emux_reset_port(p); |
151 | |||
152 | mutex_unlock(&emu->register_mutex); | ||
153 | return 0; | 146 | return 0; |
154 | } | 147 | } |
155 | 148 | ||
@@ -195,13 +188,11 @@ snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg) | |||
195 | if (snd_BUG_ON(!emu)) | 188 | if (snd_BUG_ON(!emu)) |
196 | return -ENXIO; | 189 | return -ENXIO; |
197 | 190 | ||
198 | mutex_lock(&emu->register_mutex); | ||
199 | snd_emux_sounds_off_all(p); | 191 | snd_emux_sounds_off_all(p); |
200 | snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port)); | 192 | snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port)); |
201 | snd_seq_event_port_detach(p->chset.client, p->chset.port); | 193 | snd_seq_event_port_detach(p->chset.client, p->chset.port); |
202 | snd_emux_dec_count(emu); | 194 | snd_emux_dec_count(emu); |
203 | 195 | ||
204 | mutex_unlock(&emu->register_mutex); | ||
205 | return 0; | 196 | return 0; |
206 | } | 197 | } |
207 | 198 | ||
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 7778b8e19782..a0209204ae48 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c | |||
@@ -124,12 +124,10 @@ snd_emux_detach_seq(struct snd_emux *emu) | |||
124 | if (emu->voices) | 124 | if (emu->voices) |
125 | snd_emux_terminate_all(emu); | 125 | snd_emux_terminate_all(emu); |
126 | 126 | ||
127 | mutex_lock(&emu->register_mutex); | ||
128 | if (emu->client >= 0) { | 127 | if (emu->client >= 0) { |
129 | snd_seq_delete_kernel_client(emu->client); | 128 | snd_seq_delete_kernel_client(emu->client); |
130 | emu->client = -1; | 129 | emu->client = -1; |
131 | } | 130 | } |
132 | mutex_unlock(&emu->register_mutex); | ||
133 | } | 131 | } |
134 | 132 | ||
135 | 133 | ||
@@ -269,8 +267,8 @@ snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data, | |||
269 | /* | 267 | /* |
270 | * increment usage count | 268 | * increment usage count |
271 | */ | 269 | */ |
272 | int | 270 | static int |
273 | snd_emux_inc_count(struct snd_emux *emu) | 271 | __snd_emux_inc_count(struct snd_emux *emu) |
274 | { | 272 | { |
275 | emu->used++; | 273 | emu->used++; |
276 | if (!try_module_get(emu->ops.owner)) | 274 | if (!try_module_get(emu->ops.owner)) |
@@ -284,12 +282,21 @@ snd_emux_inc_count(struct snd_emux *emu) | |||
284 | return 1; | 282 | return 1; |
285 | } | 283 | } |
286 | 284 | ||
285 | int snd_emux_inc_count(struct snd_emux *emu) | ||
286 | { | ||
287 | int ret; | ||
288 | |||
289 | mutex_lock(&emu->register_mutex); | ||
290 | ret = __snd_emux_inc_count(emu); | ||
291 | mutex_unlock(&emu->register_mutex); | ||
292 | return ret; | ||
293 | } | ||
287 | 294 | ||
288 | /* | 295 | /* |
289 | * decrease usage count | 296 | * decrease usage count |
290 | */ | 297 | */ |
291 | void | 298 | static void |
292 | snd_emux_dec_count(struct snd_emux *emu) | 299 | __snd_emux_dec_count(struct snd_emux *emu) |
293 | { | 300 | { |
294 | module_put(emu->card->module); | 301 | module_put(emu->card->module); |
295 | emu->used--; | 302 | emu->used--; |
@@ -298,6 +305,12 @@ snd_emux_dec_count(struct snd_emux *emu) | |||
298 | module_put(emu->ops.owner); | 305 | module_put(emu->ops.owner); |
299 | } | 306 | } |
300 | 307 | ||
308 | void snd_emux_dec_count(struct snd_emux *emu) | ||
309 | { | ||
310 | mutex_lock(&emu->register_mutex); | ||
311 | __snd_emux_dec_count(emu); | ||
312 | mutex_unlock(&emu->register_mutex); | ||
313 | } | ||
301 | 314 | ||
302 | /* | 315 | /* |
303 | * Routine that is called upon a first use of a particular port | 316 | * Routine that is called upon a first use of a particular port |
@@ -317,7 +330,7 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info) | |||
317 | 330 | ||
318 | mutex_lock(&emu->register_mutex); | 331 | mutex_lock(&emu->register_mutex); |
319 | snd_emux_init_port(p); | 332 | snd_emux_init_port(p); |
320 | snd_emux_inc_count(emu); | 333 | __snd_emux_inc_count(emu); |
321 | mutex_unlock(&emu->register_mutex); | 334 | mutex_unlock(&emu->register_mutex); |
322 | return 0; | 335 | return 0; |
323 | } | 336 | } |
@@ -340,7 +353,7 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info) | |||
340 | 353 | ||
341 | mutex_lock(&emu->register_mutex); | 354 | mutex_lock(&emu->register_mutex); |
342 | snd_emux_sounds_off_all(p); | 355 | snd_emux_sounds_off_all(p); |
343 | snd_emux_dec_count(emu); | 356 | __snd_emux_dec_count(emu); |
344 | mutex_unlock(&emu->register_mutex); | 357 | mutex_unlock(&emu->register_mutex); |
345 | return 0; | 358 | return 0; |
346 | } | 359 | } |