Misc cleanups wrt firmware loading
cover Misc cleanups wrt firmware loading
Hi,
this is a series of clean up patches wrt firmware loading in various driver codes. Most of them are simply to concentrate on the standard f/w loading and drop the obsoleted code, and improvements of f/w caching. Also a few emu1010 fw loading code fixes are included.
Takashi
PATCH 1/8 ALSA: mixart: hard dependency on the standard fw loader
It makes no longer sense to keep the old hwdep user-space firmware loading, which has been deprecated since ages ago.
Just add a hard dependency on CONFIG_FW_LOADER and drop the useless code.
--- sound/pci/Kconfig | 1 + sound/pci/mixart/mixart_hwdep.c | 76 ----------------------------------------- 2 files changed, 1 insertion(+), 76 deletions(-)
sound/pci/Kconfig +1 -0
@@ -707,6 +707,7 @@ config SND_MAESTRO3_INPUT config SND_MIXART tristate "Digigram miXart" + select FW_LOADER select SND_HWDEP select SND_PCM help
sound/pci/mixart/mixart_hwdep.c +0 -76
85 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH 2/8 ALSA: pcxhr: hard dependency on the standard fw loader
In reply to Takashi IwaiLike the previous commit for mixart, drop the home-baked fw loader code.
--- sound/pci/Kconfig | 1 + sound/pci/pcxhr/pcxhr_hwdep.c | 86 ------------------------------------------- 2 files changed, 1 insertion(+), 86 deletions(-)
sound/pci/Kconfig +1 -0
@@ -728,6 +728,7 @@ config SND_NM256 config SND_PCXHR tristate "Digigram PCXHR" + select FW_LOADER select SND_PCM select SND_HWDEP help
sound/pci/pcxhr/pcxhr_hwdep.c +0 -86
101 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH 3/8 ALSA: vx: hard dependency on the standard fw loader
In reply to Takashi IwaiYet again like previous two commits, drop the old hwdep user-space firmware code from vx driver (snd-vxpocket and snd-vx222).
--- include/sound/vx_core.h | 6 -- sound/drivers/Kconfig | 1 + sound/drivers/vx/vx_hwdep.c | 139 -------------------------------------------- 3 files changed, 1 insertion(+), 145 deletions(-)
include/sound/vx_core.h +0 -6
@@ -27,12 +27,6 @@#include <sound/hwdep.h> #include <linux/interrupt.h> -#if defined(CONFIG_FW_LOADER ) || defined(CONFIG_FW_LOADER_MODULE ) -#if !defined(CONFIG_USE_VXLOADER ) && !defined(CONFIG_SND_VX_LIB )/* built-in kernel */ -#define SND_VX_FW_LOADER /* use the standard firmware loader */ -#endif -#endif -struct firmware ;struct device ;
sound/drivers/Kconfig +1 -0
@@ -14,6 +14,7 @@ config SND_OPL4_LIB config SND_VX_LIB tristate + select FW_LOADER select SND_HWDEP select SND_PCM
sound/drivers/vx/vx_hwdep.c +0 -139
150 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH 4/8 ALSA: hda - Don't release firmware when CONFIG_PM is set
In reply to Takashi IwaiThe new firmware code tries to re-read the formerly read firmware files before suspend. Thus it's wiser to keep the "patch" firmware in the driver for avoiding this unnecessary re-reading.
Of course, this will consume a bit of memory for unused stuff, but the patch fw is supposed to be fairly small, so it's more benefit in the end.
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -3507,8 +3507,10 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) chip->fw->data);if (err <0 ) goto out_free; +#ifndef CONFIG_PM release_firmware (chip->fw);/* no longer needed */ chip->fw =NULL ; +#endif }#endif if ((probe_only[dev] &1 ) ==0 ) {
Signature · 1 line
1.8.0
PATCH 5/8 ALSA: ymfpci: Use kmalloc for register buffer for PM
In reply to Takashi IwaiTh buffer to save registers for PM is enough small for kmalloc(), not necessary to use vmalloc().
--- sound/pci/ymfpci/ymfpci_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/pci/ymfpci/ymfpci_main.c +3 -3
@@ -25,7 +25,6 @@#include <linux/pci.h> #include <linux/sched.h> #include <linux/slab.h> -#include <linux/vmalloc.h> #include <linux/mutex.h> #include <linux/module.h>
@@ -2261,7 +2260,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip)#endif #ifdef CONFIG_PM_SLEEP -vfree (chip->saved_regs); +kfree (chip->saved_regs);#endif if (chip->irq >=0 )free_irq (chip->irq, chip);
@@ -2471,7 +2470,8 @@ int __devinit snd_ymfpci_create(struct snd_card *card, }#ifdef CONFIG_PM_SLEEP - chip->saved_regs =vmalloc (YDSXGR_NUM_SAVED_REGS *sizeof (u32)); + chip->saved_regs =kmalloc (YDSXGR_NUM_SAVED_REGS *sizeof (u32), +GFP_KERNEL );if (chip->saved_regs ==NULL ) {snd_ymfpci_free (chip);return -ENOMEM ;
Signature · 1 line
1.8.0
PATCH 6/8 ALSA: hdsp: improve firmware caching
In reply to Takashi IwaiAs the recent firmware code tries to reread and cache the firmware by itself, it's even better to keep the struct firmware data instead of keeping a local copy. Also, it makes little sense to disable the fw loader for this driver, so added the explicit dependency, too.
Last, but not least, allocate the firmware data loaded via ioctl in vmalloc'ed buffer instead, as the firmware size isn't that small.
--- sound/pci/Kconfig | 1 + sound/pci/rme9652/hdsp.c | 62 ++++++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 28 deletions(-)
sound/pci/Kconfig +1 -0
@@ -572,6 +572,7 @@ source "sound/pci/hda/Kconfig" config SND_HDSP tristate "RME Hammerfall DSP Audio" + select FW_LOADER select SND_HWDEP select SND_RAWMIDI select SND_PCM
sound/pci/rme9652/hdsp.c +34 -28
166 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH 7/8 ALSA: emu10k1: cache emu1010 firmware
In reply to Takashi IwaiInstead of calling request_firmware() at each time, keep the obtained firmware internally and reuse it.
--- include/sound/emu10k1.h | 3 ++ sound/pci/emu10k1/emu10k1_main.c | 88 ++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 52 deletions(-)
include/sound/emu10k1.h +3 -0
@@ -32,6 +32,7 @@#include <sound/timer.h> #include <linux/interrupt.h> #include <linux/mutex.h> +#include <linux/firmware.h> #include <asm/io.h> #include <uapi/sound/emu10k1.h>
@@ -1785,6 +1786,8 @@ struct snd_emu10k1 {unsigned int efx_voices_mask[2 ];unsigned int next_free_voice; +const struct firmware *firmware; +#ifdef CONFIG_PM_SLEEP unsigned int *saved_ptr;unsigned int *saved_gpr;
sound/pci/emu10k1/emu10k1_main.c +36 -52
131 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH 8/8 ALSA: emu10k1: don't update firmware during suspend/resume
In reply to Takashi IwaiAdd a flag to suppress the update in emu1010_firmware_thread() during suspend/resume.
--- include/sound/emu10k1.h | 1 + sound/pci/emu10k1/emu10k1.c | 4 ++++ sound/pci/emu10k1/emu10k1_main.c | 2 ++ 3 files changed, 7 insertions(+)
include/sound/emu10k1.h +1 -0
@@ -1796,6 +1796,7 @@ struct snd_emu10k1 {unsigned int *saved_icode;unsigned int *p16v_saved;unsigned int saved_a_iocfg, saved_hcfg; +bool suspend;#endif };
sound/pci/emu10k1/emu10k1.c +4 -0
@@ -215,6 +215,8 @@ static int snd_emu10k1_suspend(struct device *dev)snd_power_change_state (card, SNDRV_CTL_POWER_D3hot); + emu->suspend =1 ; +snd_pcm_suspend_all (emu->pcm);snd_pcm_suspend_all (emu->pcm_mic);snd_pcm_suspend_all (emu->pcm_efx);
@@ -260,6 +262,8 @@ static int snd_emu10k1_resume(struct device *dev)if (emu->card_capabilities->ca0151_chip)snd_p16v_resume (emu); + emu->suspend =0 ; +snd_power_change_state (card,SNDRV_CTL_POWER_D0 );return 0 ; }
sound/pci/emu10k1/emu10k1_main.c +2 -0
@@ -714,6 +714,8 @@ static int emu1010_firmware_thread(void *data)msleep_interruptible (1000 );if (kthread_should_stop ())break ; +if (emu->suspend) +continue ;snd_emu1010_fpga_read (emu,EMU_HANA_IRQ_STATUS , &tmp);/* IRQ Status */ snd_emu1010_fpga_read (emu,EMU_HANA_OPTION_CARDS , ®);/* OPTIONS: Which cards are attached to the EMU */ if (reg &EMU_HANA_OPTION_DOCK_OFFLINE ) {
Signature · 1 line
1.8.0