diff options
Diffstat (limited to 'sound')
89 files changed, 1007 insertions, 421 deletions
diff --git a/sound/aoa/Makefile b/sound/aoa/Makefile index d8de3e7df48..a8c037f908f 100644 --- a/sound/aoa/Makefile +++ b/sound/aoa/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_SND_AOA) += core/ -obj-$(CONFIG_SND_AOA) += codecs/ -obj-$(CONFIG_SND_AOA) += fabrics/ obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/ +obj-$(CONFIG_SND_AOA) += fabrics/ +obj-$(CONFIG_SND_AOA) += codecs/ diff --git a/sound/aoa/codecs/snd-aoa-codec-tas-basstreble.h b/sound/aoa/codecs/snd-aoa-codec-tas-basstreble.h new file mode 100644 index 00000000000..69b61136fd5 --- /dev/null +++ b/sound/aoa/codecs/snd-aoa-codec-tas-basstreble.h @@ -0,0 +1,134 @@ +/* + * This file is only included exactly once! + * + * The tables here are derived from the tas3004 datasheet, + * modulo typo corrections and some smoothing... + */ + +#define TAS3004_TREBLE_MIN 0 +#define TAS3004_TREBLE_MAX 72 +#define TAS3004_BASS_MIN 0 +#define TAS3004_BASS_MAX 72 +#define TAS3004_TREBLE_ZERO 36 +#define TAS3004_BASS_ZERO 36 + +static u8 tas3004_treble_table[] = { + 150, /* -18 dB */ + 149, + 148, + 147, + 146, + 145, + 144, + 143, + 142, + 141, + 140, + 139, + 138, + 137, + 136, + 135, + 134, + 133, + 132, + 131, + 130, + 129, + 128, + 127, + 126, + 125, + 124, + 123, + 122, + 121, + 120, + 119, + 118, + 117, + 116, + 115, + 114, /* 0 dB */ + 113, + 112, + 111, + 109, + 108, + 107, + 105, + 104, + 103, + 101, + 99, + 98, + 96, + 93, + 91, + 89, + 86, + 83, + 81, + 77, + 74, + 71, + 67, + 63, + 59, + 54, + 49, + 44, + 38, + 32, + 26, + 19, + 10, + 4, + 2, + 1, /* +18 dB */ +}; + +static inline u8 tas3004_treble(int idx) +{ + return tas3004_treble_table[idx]; +} + +/* I only save the difference here to the treble table + * so that the binary is smaller... + * I have also ignored completely differences of + * +/- 1 + */ +static s8 tas3004_bass_diff_to_treble[] = { + 2, /* 7 dB, offset 50 */ + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 3, + 4, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 14, + 13, + 8, + 1, /* 18 dB */ +}; + +static inline u8 tas3004_bass(int idx) +{ + u8 result = tas3004_treble_table[idx]; + + if (idx >= 50) + result += tas3004_bass_diff_to_treble[idx-50]; + return result; +} diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c index 2e39ff6ee34..16c0b6b0a80 100644 --- a/sound/aoa/codecs/snd-aoa-codec-tas.c +++ b/sound/aoa/codecs/snd-aoa-codec-tas.c @@ -72,22 +72,29 @@ MODULE_DESCRIPTION("tas codec driver for snd-aoa"); #include "snd-aoa-codec-tas.h" #include "snd-aoa-codec-tas-gain-table.h" +#include "snd-aoa-codec-tas-basstreble.h" #include "../aoa.h" #include "../soundbus/soundbus.h" - #define PFX "snd-aoa-codec-tas: " + struct tas { struct aoa_codec codec; struct i2c_client i2c; - u32 muted_l:1, muted_r:1, - controls_created:1; + u32 mute_l:1, mute_r:1 , + controls_created:1 , + drc_enabled:1, + hw_enabled:1; u8 cached_volume_l, cached_volume_r; u8 mixer_l[3], mixer_r[3]; + u8 bass, treble; u8 acr; + int drc_range; }; +static int tas_reset_init(struct tas *tas); + static struct tas *codec_to_tas(struct aoa_codec *codec) { return container_of(codec, struct tas, codec); @@ -101,6 +108,44 @@ static inline int tas_write_reg(struct tas *tas, u8 reg, u8 len, u8 *data) return i2c_smbus_write_i2c_block_data(&tas->i2c, reg, len, data); } +static void tas3004_set_drc(struct tas *tas) +{ + unsigned char val[6]; + + if (tas->drc_enabled) + val[0] = 0x50; /* 3:1 above threshold */ + else + val[0] = 0x51; /* disabled */ + val[1] = 0x02; /* 1:1 below threshold */ + if (tas->drc_range > 0xef) + val[2] = 0xef; + else if (tas->drc_range < 0) + val[2] = 0x00; + else + val[2] = tas->drc_range; + val[3] = 0xb0; + val[4] = 0x60; + val[5] = 0xa0; + + tas_write_reg(tas, TAS_REG_DRC, 6, val); +} + +static void tas_set_treble(struct tas *tas) +{ + u8 tmp; + + tmp = tas3004_treble(tas->treble); + tas_write_reg(tas, TAS_REG_TREBLE, 1, &tmp); +} + +static void tas_set_bass(struct tas *tas) +{ + u8 tmp; + + tmp = tas3004_bass(tas->bass); + tas_write_reg(tas, TAS_REG_BASS, 1, &tmp); +} + static void tas_set_volume(struct tas *tas) { u8 block[6]; @@ -113,8 +158,8 @@ static void tas_set_volume(struct tas *tas) if (left > 177) left = 177; if (right > 177) right = 177; - if (tas->muted_l) left = 0; - if (tas->muted_r) right = 0; + if (tas->mute_l) left = 0; + if (tas->mute_r) right = 0; /* analysing the volume and mixer tables shows * that they are similar enough when we shift @@ -202,7 +247,8 @@ static int tas_snd_vol_put(struct snd_kcontrol *kcontrol, tas->cached_volume_l = ucontrol->value.integer.value[0]; tas->cached_volume_r = ucontrol->value.integer.value[1]; - tas_set_volume(tas); + if (tas->hw_enabled) + tas_set_volume(tas); return 1; } @@ -230,8 +276,8 @@ static int tas_snd_mute_get(struct snd_kcontrol *kcontrol, { struct tas *tas = snd_kcontrol_chip(kcontrol); - ucontrol->value.integer.value[0] = !tas->muted_l; - ucontrol->value.integer.value[1] = !tas->muted_r; + ucontrol->value.integer.value[0] = !tas->mute_l; + ucontrol->value.integer.value[1] = !tas->mute_r; return 0; } @@ -240,13 +286,14 @@ static int tas_snd_mute_put(struct snd_kcontrol *kcontrol, { struct tas *tas = snd_kcontrol_chip(kcontrol); - if (tas->muted_l == !ucontrol->value.integer.value[0] - && tas->muted_r == !ucontrol->value.integer.value[1]) + if (tas->mute_l == !ucontrol->value.integer.value[0] + && tas->mute_r == !ucontrol->value.integer.value[1]) return 0; - tas->muted_l = !ucontrol->value.integer.value[0]; - tas->muted_r = !ucontrol->value.integer.value[1]; - tas_set_volume(tas); + tas->mute_l = !ucontrol->value.integer.value[0]; + tas->mute_r = !ucontrol->value.integer.value[1]; + if (tas->hw_enabled) + tas_set_volume(tas); return 1; } @@ -294,7 +341,8 @@ static int tas_snd_mixer_put(struct snd_kcontrol *kcontrol, tas->mixer_l[idx] = ucontrol->value.integer.value[0]; tas->mixer_r[idx] = ucontrol->value.integer.value[1]; - tas_set_mixer(tas); + if (tas->hw_enabled) + tas_set_mixer(tas); return 1; } @@ -309,9 +357,93 @@ static struct snd_kcontrol_new n##_control = { \ .private_value = idx, \ } -MIXER_CONTROL(pcm1, "PCM1", 0); +MIXER_CONTROL(pcm1, "PCM", 0); MIXER_CONTROL(monitor, "Monitor", 2); +static int tas_snd_drc_range_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 1; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = TAS3004_DRC_MAX; + return 0; +} + +static int tas_snd_drc_range_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = tas->drc_range; + return 0; +} + +static int tas_snd_drc_range_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + if (tas->drc_range == ucontrol->value.integer.value[0]) + return 0; + + tas->drc_range = ucontrol->value.integer.value[0]; + if (tas->hw_enabled) + tas3004_set_drc(tas); + return 1; +} + +static struct snd_kcontrol_new drc_range_control = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "DRC Range", + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = tas_snd_drc_range_info, + .get = tas_snd_drc_range_get, + .put = tas_snd_drc_range_put, +}; + +static int tas_snd_drc_switch_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + uinfo->count = 1; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; +} + +static int tas_snd_drc_switch_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = tas->drc_enabled; + return 0; +} + +static int tas_snd_drc_switch_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + if (tas->drc_enabled == ucontrol->value.integer.value[0]) + return 0; + + tas->drc_enabled = ucontrol->value.integer.value[0]; + if (tas->hw_enabled) + tas3004_set_drc(tas); + return 1; +} + +static struct snd_kcontrol_new drc_switch_control = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "DRC Range Switch", + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = tas_snd_drc_switch_info, + .get = tas_snd_drc_switch_get, + .put = tas_snd_drc_switch_put, +}; + static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { @@ -346,7 +478,8 @@ static int tas_snd_capture_source_put(struct snd_kcontrol *kcontrol, tas->acr |= TAS_ACR_INPUT_B; if (oldacr == tas->acr) return 0; - tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr); + if (tas->hw_enabled) + tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr); return 1; } @@ -370,6 +503,89 @@ static struct snd_kcontrol_new capture_source_control = { .put = tas_snd_capture_source_put, }; +static int tas_snd_treble_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 1; + uinfo->value.integer.min = TAS3004_TREBLE_MIN; + uinfo->value.integer.max = TAS3004_TREBLE_MAX; + return 0; +} + +static int tas_snd_treble_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = tas->treble; + return 0; +} + +static int tas_snd_treble_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + if (tas->treble == ucontrol->value.integer.value[0]) + return 0; + + tas->treble = ucontrol->value.integer.value[0]; + if (tas->hw_enabled) + tas_set_treble(tas); + return 1; +} + +static struct snd_kcontrol_new treble_control = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Treble", + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = tas_snd_treble_info, + .get = tas_snd_treble_get, + .put = tas_snd_treble_put, +}; + +static int tas_snd_bass_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 1; + uinfo->value.integer.min = TAS3004_BASS_MIN; + uinfo->value.integer.max = TAS3004_BASS_MAX; + return 0; +} + +static int tas_snd_bass_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = tas->bass; + return 0; +} + +static int tas_snd_bass_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct tas *tas = snd_kcontrol_chip(kcontrol); + + if (tas->bass == ucontrol->value.integer.value[0]) + return 0; + + tas->bass = ucontrol->value.integer.value[0]; + if (tas->hw_enabled) + tas_set_bass(tas); + return 1; +} + +static struct snd_kcontrol_new bass_control = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Bass", + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = tas_snd_bass_info, + .get = tas_snd_bass_get, + .put = tas_snd_bass_put, +}; static struct transfer_info tas_transfers[] = { { @@ -399,26 +615,67 @@ static int tas_usable(struct codec_info_item *cii, static int tas_reset_init(struct tas *tas) { u8 tmp; + + tas->codec.gpio->methods->all_amps_off(tas->codec.gpio); + msleep(5); tas->codec.gpio->methods->set_hw_reset(tas->codec.gpio, 0); - msleep(1); + msleep(5); tas->codec.gpio->methods->set_hw_reset(tas->codec.gpio, 1); - msleep(1); + msleep(20); tas->codec.gpio->methods->set_hw_reset(tas->codec.gpio, 0); - msleep(1); - - tas->acr &= ~TAS_ACR_ANALOG_PDOWN; - tas->acr |= TAS_ACR_B_MONAUREAL | TAS_ACR_B_MON_SEL_RIGHT; - if (tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr)) - return -ENODEV; + msleep(10); + tas->codec.gpio->methods->all_amps_restore(tas->codec.gpio); tmp = TAS_MCS_SCLK64 | TAS_MCS_SPORT_MODE_I2S | TAS_MCS_SPORT_WL_24BIT; if (tas_write_reg(tas, TAS_REG_MCS, 1, &tmp)) return -ENODEV; + tas->acr |= TAS_ACR_ANALOG_PDOWN | TAS_ACR_B_MONAUREAL | + TAS_ACR_B_MON_SEL_RIGHT; + if (tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr)) + return -ENODEV; + tmp = 0; if (tas_write_reg(tas, TAS_REG_MCS2, 1, &tmp)) return -ENODEV; + tas3004_set_drc(tas); + + /* Set treble & bass to 0dB */ + tas->treble = TAS3004_TREBLE_ZERO; + tas->bass = TAS3004_BASS_ZERO; + tas_set_treble(tas); + tas_set_bass(tas); + + tas->acr &= ~TAS_ACR_ANALOG_PDOWN; + if (tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr)) + return -ENODEV; + + return 0; +} + +static int tas_switch_clock(struct codec_info_item *cii, enum clock_switch clock) +{ + struct tas *tas = cii->codec_data; + + switch(clock) { + case CLOCK_SWITCH_PREPARE_SLAVE: + /* Clocks are going away, mute mute mute */ + tas->codec.gpio->methods->all_amps_off(tas->codec.gpio); + tas->hw_enabled = 0; + break; + case CLOCK_SWITCH_SLAVE: + /* Clocks are back, re-init the codec */ + tas_reset_init(tas); + tas_set_volume(tas); + tas_set_mixer(tas); + tas->hw_enabled = 1; + tas->codec.gpio->methods->all_amps_restore(tas->codec.gpio); + break; + default: + /* doesn't happen as of now */ + return -EINVAL; + } return 0; } @@ -427,6 +684,7 @@ static int tas_reset_init(struct tas *tas) * our i2c device is suspended, and then take note of that! */ static int tas_suspend(struct tas *tas) { + tas->hw_enabled = 0; tas->acr |= TAS_ACR_ANALOG_PDOWN; tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr); return 0; @@ -438,6 +696,7 @@ static int tas_resume(struct tas *tas) tas_reset_init(tas); tas_set_volume(tas); tas_set_mixer(tas); + tas->hw_enabled = 1; return 0; } @@ -463,6 +722,7 @@ static struct codec_info tas_codec_info = { .bus_factor = 64, .owner = THIS_MODULE, .usable = tas_usable, + .switch_clock = tas_switch_clock, #ifdef CONFIG_PM .suspend = _tas_suspend, .resume = _tas_resume, @@ -483,6 +743,7 @@ static int tas_init_codec(struct aoa_codec *codec) printk(KERN_ERR PFX "tas failed to initialise\n"); return -ENXIO; } + tas->hw_enabled = 1; if (tas->codec.soundbus_dev->attach_codec(tas->codec.soundbus_dev, aoa_get_card(), @@ -515,6 +776,22 @@ static int tas_init_codec(struct aoa_codec *codec) if (err) goto error; + err = aoa_snd_ctl_add(snd_ctl_new1(&drc_range_control, tas)); + if (err) + goto error; + + err = aoa_snd_ctl_add(snd_ctl_new1(&drc_switch_control, tas)); + if (err) + goto error; + + err = aoa_snd_ctl_add(snd_ctl_new1(&treble_control, tas)); + if (err) + goto error; + + err = aoa_snd_ctl_add(snd_ctl_new1(&bass_control, tas)); + if (err) + goto error; + return 0; error: tas->codec.soundbus_dev->detach_codec(tas->codec.soundbus_dev, tas); @@ -548,6 +825,8 @@ static int tas_create(struct i2c_adapter *adapter, tas->i2c.driver = &tas_driver; tas->i2c.adapter = adapter; tas->i2c.addr = addr; + /* seems that half is a saner default */ + tas->drc_range = TAS3004_DRC_MAX / 2; strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE-1); if (i2c_attach_client(&tas->i2c)) { @@ -564,7 +843,9 @@ static int tas_create(struct i2c_adapter *adapter, if (aoa_codec_register(&tas->codec)) { goto detach; } - printk(KERN_DEBUG "snd-aoa-codec-tas: created and attached tas instance\n"); + printk(KERN_DEBUG + "snd-aoa-codec-tas: tas found, addr 0x%02x on %s\n", + addr, node->full_name); return 0; detach: i2c_detach_client(&tas->i2c); diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.h b/sound/aoa/codecs/snd-aoa-codec-tas.h index daf81f45d83..ae177e3466e 100644 --- a/sound/aoa/codecs/snd-aoa-codec-tas.h +++ b/sound/aoa/codecs/snd-aoa-codec-tas.h @@ -44,4 +44,12 @@ #define TAS_REG_LEFT_BIQUAD6 0x10 #define TAS_REG_RIGHT_BIQUAD6 0x19 +#define TAS_REG_LEFT_LOUDNESS 0x21 +#define TAS_REG_RIGHT_LOUDNESS 0x22 +#define TAS_REG_LEFT_LOUDNESS_GAIN 0x23 +#define TAS_REG_RIGHT_LOUDNESS_GAIN 0x24 + +#define TAS3001_DRC_MAX 0x5f +#define TAS3004_DRC_MAX 0xef + #endif /* __SND_AOA_CODECTASH */ diff --git a/sound/aoa/codecs/snd-aoa-codec-toonie.c b/sound/aoa/codecs/snd-aoa-codec-toonie.c index bcc555647e7..3c7d1d8a9a6 100644 --- a/sound/aoa/codecs/snd-aoa-codec-toonie.c +++ b/sound/aoa/codecs/snd-aoa-codec-toonie.c @@ -51,6 +51,13 @@ static struct transfer_info toonie_transfers[] = { {} }; +static int toonie_usable(struct codec_info_item *cii, + struct transfer_info *ti, + struct transfer_info *out) +{ + return 1; +} + #ifdef CONFIG_PM static int toonie_suspend(struct codec_info_item *cii, pm_message_t state) { @@ -69,6 +76,7 @@ static struct codec_info toonie_codec_info = { .sysclock_factor = 256, .bus_factor = 64, .owner = THIS_MODULE, + .usable = toonie_usable, #ifdef CONFIG_PM .suspend = toonie_suspend, .resume = toonie_resume, @@ -79,19 +87,20 @@ static int toonie_init_codec(struct aoa_codec *codec) { struct toonie *toonie = codec_to_toonie(codec); + /* nothing connected? what a joke! */ + if (toonie->codec.connected != 1) + return -ENOTCONN; + if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) { printk(KERN_ERR PFX "failed to create toonie snd device!\n"); return -ENODEV; } - /* nothing connected? what a joke! */ - if (toonie->codec.connected != 1) - return -ENOTCONN; - if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev, aoa_get_card(), &toonie_codec_info, toonie)) { printk(KERN_ERR PFX "error creating toonie pcm\n"); + snd_device_free(aoa_get_card(), toonie); return -ENODEV; } diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index 7ae0c0bdfad..f69d33357a2 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c @@ -112,7 +112,10 @@ static struct device_node *get_gpio(char *name, static void get_irq(struct device_node * np, int *irqptr) { - *irqptr = irq_of_parse_and_map(np, 0); + if (np) + *irqptr = irq_of_parse_and_map(np, 0); + else + *irqptr = NO_IRQ; } /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ @@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_runtime *rt, return -EINVAL; } - if (irq == -1) + if (irq == NO_IRQ) return -ENODEV; mutex_lock(¬if->mutex); diff --git a/sound/aoa/core/snd-aoa-gpio-pmf.c b/sound/aoa/core/snd-aoa-gpio-pmf.c index 0e9b9bb2a6d..2836c321839 100644 --- a/sound/aoa/core/snd-aoa-gpio-pmf.c +++ b/sound/aoa/core/snd-aoa-gpio-pmf.c @@ -14,9 +14,13 @@ static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\ { \ struct pmf_args args = { .count = 1, .u[0].v = !on }; \ - \ + int rc; \ + \ if (unlikely(!rt)) return; \ - pmf_call_function(rt->node, #name "-mute", &args); \ + rc = pmf_call_function(rt->node, #name "-mute", &args); \ + if (rc && rc != -ENODEV) \ + printk(KERN_WARNING "pmf_gpio_set_" #name \ + " failed, rc: %d\n", rc); \ rt->implementation_private &= ~(1<<bit); \ rt->implementation_private |= (!!on << bit); \ } \ @@ -33,9 +37,13 @@ PMF_GPIO(lineout, 2); static void pmf_gpio_set_hw_reset(struct gpio_runtime *rt, int on) { struct pmf_args args = { .count = 1, .u[0].v = !!on }; + int rc; if (unlikely(!rt)) return; - pmf_call_function(rt->node, "hw-reset", &args); + rc = pmf_call_function(rt->node, "hw-reset", &args); + if (rc) + printk(KERN_WARNING "pmf_gpio_set_hw_reset" + " failed, rc: %d\n", rc); } static void pmf_gpio_all_amps_off(struct gpio_runtime *rt) diff --git a/sound/aoa/fabrics/snd-aoa-fabric-layout.c b/sound/aoa/fabrics/snd-aoa-fabric-layout.c index cbc8a3b5cea..172eb95476c 100644 --- a/sound/aoa/fabrics/snd-aoa-fabric-layout.c +++ b/sound/aoa/fabrics/snd-aoa-fabric-layout.c @@ -77,24 +77,39 @@ struct layout { int pcmid; }; +MODULE_ALIAS("sound-layout-36"); MODULE_ALIAS("sound-layout-41"); MODULE_ALIAS("sound-layout-45"); +MODULE_ALIAS("sound-layout-47"); +MODULE_ALIAS("sound-layout-48"); +MODULE_ALIAS("sound-layout-49"); +MODULE_ALIAS("sound-layout-50"); MODULE_ALIAS("sound-layout-51"); +MODULE_ALIAS("sound-layout-56"); +MODULE_ALIAS("sound-layout-57"); MODULE_ALIAS("sound-layout-58"); MODULE_ALIAS("sound-layout-60"); MODULE_ALIAS("sound-layout-61"); +MODULE_ALIAS("sound-layout-62"); MODULE_ALIAS("sound-layout-64"); MODULE_ALIAS("sound-layout-65"); +MODULE_ALIAS("sound-layout-66"); +MODULE_ALIAS("sound-layout-67"); MODULE_ALIAS("sound-layout-68"); MODULE_ALIAS("sound-layout-69"); MODULE_ALIAS("sound-layout-70"); MODULE_ALIAS("sound-layout-72"); +MODULE_ALIAS("sound-layout-76"); MODULE_ALIAS("sound-layout-80"); MODULE_ALIAS("sound-layout-82"); MODULE_ALIAS("sound-layout-84"); MODULE_ALIAS("sound-layout-86"); +MODULE_ALIAS("sound-layout-90"); MODULE_ALIAS("sound-layout-92"); +MODULE_ALIAS("sound-layout-94"); MODULE_ALIAS("sound-layout-96"); +MODULE_ALIAS("sound-layout-98"); +MODULE_ALIAS("sound-layout-100"); /* onyx with all but microphone connected */ static struct codec_connection onyx_connections_nomic[] = { @@ -950,11 +965,12 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) layout_id = (unsigned int *) get_property(sound, "layout-id", NULL); if (!layout_id) goto outnodev; - printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d ", *layout_id); + printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n", + *layout_id); layout = find_layout_by_id(*layout_id); if (!layout) { - printk("(no idea how to handle)\n"); + printk(KERN_ERR "snd-aoa-fabric-layout: unknown layout\n"); goto outnodev; } @@ -972,15 +988,17 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) case 51: /* PowerBook5,4 */ case 58: /* Mac Mini */ ldev->gpio.methods = ftr_gpio_methods; + printk(KERN_DEBUG + "snd-aoa-fabric-layout: Using direct GPIOs\n"); break; default: ldev->gpio.methods = pmf_gpio_methods; + printk(KERN_DEBUG + "snd-aoa-fabric-layout: Using PMF GPIOs\n"); } ldev->selfptr_headphone.ptr = ldev; ldev->selfptr_lineout.ptr = ldev; sdev->ofdev.dev.driver_data = ldev; - - printk("(using)\n"); list_add(&ldev->list, &layouts_list); layouts_list_items++; diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c index abe84a76c83..47b3e3768df 100644 --- a/sound/aoa/soundbus/core.c +++ b/sound/aoa/soundbus/core.c @@ -194,16 +194,6 @@ static struct bus_type soundbus_bus_type = { .dev_attrs = soundbus_dev_attrs, }; -static int __init soundbus_init(void) -{ - return bus_register(&soundbus_bus_type); -} - -static void __exit soundbus_exit(void) -{ - bus_unregister(&soundbus_bus_type); -} - int soundbus_add_one(struct soundbus_dev *dev) { static int devcount; @@ -246,5 +236,15 @@ void soundbus_unregister_driver(struct soundbus_driver *drv) } EXPORT_SYMBOL_GPL(soundbus_unregister_driver); -module_init(soundbus_init); +static int __init soundbus_init(void) +{ + return bus_register(&soundbus_bus_type); +} + +static void __exit soundbus_exit(void) +{ + bus_unregister(&soundbus_bus_type); +} + +subsys_initcall(soundbus_init); module_exit(soundbus_exit); diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-control.c b/sound/aoa/soundbus/i2sbus/i2sbus-control.c index f50407952d3..87beb4ad4d6 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-control.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-control.c @@ -6,12 +6,16 @@ * GPL v2, can be found in COPYING. */ -#include <asm/io.h> +#include <linux/kernel.h> #include <linux/delay.h> + +#include <asm/io.h> #include <asm/prom.h> #include <asm/macio.h> #include <asm/pmac_feature.h> #include <asm/pmac_pfunc.h> +#include <asm/keylargo.h> + #include "i2sbus.h" int i2sbus_control_init(struct macio_dev* dev, struct i2sbus_control **c) @@ -22,26 +26,12 @@ int i2sbus_control_init(struct macio_dev* dev, struct i2sbus_control **c) INIT_LIST_HEAD(&(*c)->list); - if (of_address_to_resource(dev->ofdev.node, 0, &(*c)->rsrc)) - goto err; - /* we really should be using feature calls instead of mapping - * these registers. It's safe for now since no one else is - * touching them... */ - (*c)->controlregs = ioremap((*c)->rsrc.start, - sizeof(struct i2s_control_regs)); - if (!(*c)->controlregs) - goto err; - + (*c)->macio = dev->bus->chip; return 0; - err: - kfree(*c); - *c = NULL; - return -ENODEV; } void i2sbus_control_destroy(struct i2sbus_control *c) { - iounmap(c->controlregs); kfree(c); } @@ -93,19 +83,22 @@ int i2sbus_control_enable(struct i2sbus_control *c, struct i2sbus_dev *i2sdev) { struct pmf_args args = { .count = 0 }; - int cc; + struct macio_chip *macio = c->macio; if (i2sdev->enable) return pmf_call_one(i2sdev->enable, &args); + if (macio == NULL || macio->base == NULL) + return -ENODEV; + switch (i2sdev->bus_number) { case 0: - cc = in_le32(&c->controlregs->cell_control); - out_le32(&c->controlregs->cell_control, cc | CTRL_CLOCK_INTF_0_ENABLE); + /* these need to be locked or done through + * newly created feature calls! */ + MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_ENABLE); break; case 1: - cc = in_le32(&c->controlregs->cell_control); - out_le32(&c->controlregs->cell_control, cc | CTRL_CLOCK_INTF_1_ENABLE); + MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_ENABLE); break; default: return -ENODEV; @@ -118,7 +111,7 @@ int i2sbus_control_cell(struct i2sbus_control *c, int enable) { struct pmf_args args = { .count = 0 }; - int cc; + struct macio_chip *macio = c->macio; switch (enable) { case 0: @@ -133,18 +126,22 @@ int i2sbus_control_cell(struct i2sbus_control *c, printk(KERN_ERR "i2sbus: INVALID CELL ENABLE VALUE\n"); return -ENODEV; } + + if (macio == NULL || macio->base == NULL) + return -ENODEV; + switch (i2sdev->bus_number) { case 0: - cc = in_le32(&c->controlregs->cell_control); - cc &= ~CTRL_CLOCK_CELL_0_ENABLE; - cc |= enable * CTRL_CLOCK_CELL_0_ENABLE; - out_le32(&c->controlregs->cell_control, cc); + if (enable) + MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE); + else + MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE); break; case 1: - cc = in_le32(&c->controlregs->cell_control); - cc &= ~CTRL_CLOCK_CELL_1_ENABLE; - cc |= enable * CTRL_CLOCK_CELL_1_ENABLE; - out_le32(&c->controlregs->cell_control, cc); + if (enable) + MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_CELL_ENABLE); + else + MACIO_BIC(KEYLARGO_FCR1, KL1_I2S1_CELL_ENABLE); break; default: return -ENODEV; @@ -157,7 +154,7 @@ int i2sbus_control_clock(struct i2sbus_control *c, int enable) { struct pmf_args args = { .count = 0 }; - int cc; + struct macio_chip *macio = c->macio; switch (enable) { case 0: @@ -172,18 +169,22 @@ int i2sbus_control_clock(struct i2sbus_control *c, printk(KERN_ERR "i2sbus: INVALID CLOCK ENABLE VALUE\n"); return -ENODEV; } + + if (macio == NULL || macio->base == NULL) + return -ENODEV; + switch (i2sdev->bus_number) { case 0: - cc = in_le32(&c->controlregs->cell_control); - cc &= ~CTRL_CLOCK_CLOCK_0_ENABLE; - cc |= enable * CTRL_CLOCK_CLOCK_0_ENABLE; - out_le32(&c->controlregs->cell_control, cc); + if (enable) + MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT); + else + MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT); break; case 1: - cc = in_le32(&c->controlregs->cell_control); - cc &= ~CTRL_CLOCK_CLOCK_1_ENABLE; - cc |= enable * CTRL_CLOCK_CLOCK_1_ENABLE; - out_le32(&c->controlregs->cell_control, cc); + if (enable) + MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_CLK_ENABLE_BIT); + else + MACIO_BIC(KEYLARGO_FCR1, KL1_I2S1_CLK_ENABLE_BIT); break; default: return -ENODEV; diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-control.h b/sound/aoa/soundbus/i2sbus/i2sbus-control.h deleted file mode 100644 index bb05550f730..00000000000 --- a/sound/aoa/soundbus/i2sbus/i2sbus-control.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * i2sbus driver -- bus register definitions - * - * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> - * - * GPL v2, can be found in COPYING. - */ -#ifndef __I2SBUS_CONTROLREGS_H -#define __I2SBUS_CONTROLREGS_H - -/* i2s control registers, at least what we know about them */ - -#define __PAD(m,n) u8 __pad##m[n] -#define _PAD(line, n) __PAD(line, n) -#define PAD(n) _PAD(__LINE__, (n)) -struct i2s_control_regs { - PAD(0x38); - __le32 fcr0; /* 0x38 (unknown) */ - __le32 cell_control; /* 0x3c (fcr1) */ - __le32 fcr2; /* 0x40 (unknown) */ - __le32 fcr3; /* 0x44 (fcr3) */ - __le32 clock_control; /* 0x48 (unknown) */ - PAD(4); - /* total size: 0x50 bytes */ -} __attribute__((__packed__)); - -#define CTRL_CLOCK_CELL_0_ENABLE (1<<10) -#define CTRL_CLOCK_CLOCK_0_ENABLE (1<<12) -#define CTRL_CLOCK_SWRESET_0 (1<<11) -#define CTRL_CLOCK_INTF_0_ENABLE (1<<13) - -#define CTRL_CLOCK_CELL_1_ENABLE (1<<17) -#define CTRL_CLOCK_CLOCK_1_ENABLE (1<<18) -#define CTRL_CLOCK_SWRESET_1 (1<<19) -#define CTRL_CLOCK_INTF_1_ENABLE (1<<20) - -#endif /* __I2SBUS_CONTROLREGS_H */ diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/sound/aoa/soundbus/i2sbus/i2sbus-core.c index 01c0724335a..23190aa6bc7 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-core.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c @@ -7,13 +7,16 @@ */ #include <linux/module.h> -#include <asm/macio.h> -#include <asm/dbdma.h> #include <linux/pci.h> #include <linux/interrupt.h> +#include <linux/dma-mapping.h> + #include <sound/driver.h> #include <sound/core.h> -#include <linux/dma-mapping.h> + +#include <asm/macio.h> +#include <asm/dbdma.h> + #include "../soundbus.h" #include "i2sbus.h" @@ -24,6 +27,11 @@ MODULE_DESCRIPTION("Apple Soundbus: I2S support"); * string that macio puts into the relevant device */ MODULE_ALIAS("of:Ni2sTi2sC"); +static int force; +module_param(force, int, 0444); +MODULE_PARM_DESC(force, "Force loading i2sbus even when" + " no layout-id property is present"); + static struct of_device_id i2sbus_match[] = { { .name = "i2s" }, { } @@ -73,12 +81,12 @@ static void i2sbus_release_dev(struct device *dev) if (i2sdev->intfregs) iounmap(i2sdev->intfregs); if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma); if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma); - for (i=0;i<3;i++) + for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) if (i2sdev->allocated_resource[i]) release_and_free_resource(i2sdev->allocated_resource[i]); free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring); free_dbdma_descriptor_ring(i2sdev, &i2sdev->in.dbdma_ring); - for (i=0;i<3;i++) + for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) free_irq(i2sdev->interrupts[i], i2sdev); i2sbus_control_remove_dev(i2sdev->control, i2sdev); mutex_destroy(&i2sdev->lock); @@ -101,10 +109,49 @@ static irqreturn_t i2sbus_bus_intr(int irq, void *devid, struct pt_regs *regs) return IRQ_HANDLED; } -static int force; -module_param(force, int, 0444); -MODULE_PARM_DESC(force, "Force loading i2sbus even when" - " no layout-id property is present"); + +/* + * XXX FIXME: We test the layout_id's here to get the proper way of + * mapping in various registers, thanks to bugs in Apple device-trees. + * We could instead key off the machine model and the name of the i2s + * node (i2s-a). This we'll do when we move it all to macio_asic.c + * and have that export items for each sub-node too. + */ +static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index, + int layout, struct resource *res) +{ + struct device_node *parent; + int pindex, rc = -ENXIO; + u32 *reg; + + /* Machines with layout 76 and 36 (K2 based) have a weird device + * tree what we need to special case. + * Normal machines just fetch the resource from the i2s-X node. + * Darwin further divides normal machines into old and new layouts + * with a subtely different code path but that doesn't seem necessary + * in practice, they just bloated it. In addition, even on our K2 + * case the i2s-modem node, if we ever want to handle it, uses the + * normal layout + */ + if (layout != 76 && layout != 36) + return of_address_to_resource(np, index, res); + + parent = of_get_parent(np); + pindex = (index == aoa_resource_i2smmio) ? 0 : 1; + rc = of_address_to_resource(parent, pindex, res); + if (rc) + goto bail; + reg = (u32 *)get_property(np, "reg", NULL); + if (reg == NULL) { + rc = -ENXIO; + goto bail; + } + res->start += reg[index * 2]; + res->end = res->start + reg[index * 2 + 1] - 1; + bail: + of_node_put(parent); + return rc; +} /* FIXME: look at device node refcounting */ static int i2sbus_add_dev(struct macio_dev *macio, @@ -113,7 +160,8 @@ static int i2sbus_add_dev(struct macio_dev *macio, { struct i2sbus_dev *dev; struct device_node *child = NULL, *sound = NULL; - int i; + struct resource *r; + int i, layout = 0, rlen; static const char *rnames[] = { "i2sbus: %s (control)", "i2sbus: %s (tx)", "i2sbus: %s (rx)" }; @@ -129,9 +177,6 @@ static int i2sbus_add_dev(struct macio_dev *macio, if (strncmp(np->name, "i2s-", 4)) return 0; - if (macio_irq_count(macio) != 3) - return 0; - dev = kzalloc(sizeof(struct i2sbus_dev), GFP_KERNEL); if (!dev) return 0; @@ -147,8 +192,9 @@ static int i2sbus_add_dev(struct macio_dev *macio, u32 *layout_id; layout_id = (u32*) get_property(sound, "layout-id", NULL); if (layout_id) { + layout = *layout_id; snprintf(dev->sound.modalias, 32, - "sound-layout-%d", *layout_id); + "sound-layout-%d", layout); force = 1; } } @@ -178,23 +224,32 @@ static int i2sbus_add_dev(struct macio_dev *macio, dev->bus_number = np->name[4] - 'a'; INIT_LIST_HEAD(&dev->sound.codec_list); - for (i=0;i<3;i++) { + for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) { dev->interrupts[i] = -1; - snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i], np->name); + snprintf(dev->rnames[i], sizeof(dev->rnames[i]), + rnames[i], np->name); } - for (i=0;i<3;i++) { - if (request_irq(macio_irq(macio, i), ints[i], 0, - dev->rnames[i], dev)) + for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) { + int irq = irq_of_parse_and_map(np, i); + if (request_irq(irq, ints[i], 0, dev->rnames[i], dev)) goto err; - dev->interrupts[i] = macio_irq(macio, i); + dev->interrupts[i] = irq; } - for (i=0;i<3;i++) { - if (of_address_to_resource(np, i, &dev->resources[i])) + + /* Resource handling is problematic as some device-trees contain + * useless crap (ugh ugh ugh). We work around that here by calling + * specific functions for calculating the appropriate resources. + * + * This will all be moved to macio_asic.c at one point + */ + for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) { + if (i2sbus_get_and_fixup_rsrc(np,i,layout,&dev->resources[i])) goto err; - /* if only we could use our resource dev->resources[i]... + /* If only we could use our resource dev->resources[i]... * but request_resource doesn't know about parents and - * contained resources... */ + * contained resources... + */ dev->allocated_resource[i] = request_mem_region(dev->resources[i].start, dev->resources[i].end - @@ -205,13 +260,25 @@ static int i2sbus_add_dev(struct macio_dev *macio, goto err; } } - /* should do sanity checking here about length of them */ - dev->intfregs = ioremap(dev->resources[0].start, - dev->resources[0].end-dev->resources[0].start+1); - dev->out.dbdma = ioremap(dev->resources[1].start, - dev->resources[1].end-dev->resources[1].start+1); - dev->in.dbdma = ioremap(dev->resources[2].start, - dev->resources[2].end-dev->resources[2].start+1); + + r = &dev->resources[aoa_resource_i2smmio]; + rlen = r->end - r->start + 1; + if (rlen < sizeof(struct i2s_interface_regs)) + goto err; + dev->intfregs = ioremap(r->start, rlen); + + r = &dev->resources[aoa_resource_txdbdma]; + rlen = r->end - r->start + 1; + if (rlen < sizeof(struct dbdma_regs)) + goto err; + dev->out.dbdma = ioremap(r->start, rlen); + + r = &dev->resources[aoa_resource_rxdbdma]; + rlen = r->end - r->start + 1; + if (rlen < sizeof(struct dbdma_regs)) + goto err; + dev->in.dbdma = ioremap(r->start, rlen); + if (!dev->intfregs || !dev->out.dbdma || !dev->in.dbdma) goto err; diff --git a/sound/aoa/soundbus/i2sbus/i2sbus.h b/sound/aoa/soundbus/i2sbus/i2sbus.h index cfa5162e3b0..0c69d209be5 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus.h +++ b/sound/aoa/soundbus/i2sbus/i2sbus.h @@ -7,20 +7,22 @@ */ #ifndef __I2SBUS_H #define __I2SBUS_H -#include <asm/dbdma.h> #include <linux/interrupt.h> -#include <sound/pcm.h> #include <linux/spinlock.h> #include <linux/mutex.h> + +#include <sound/pcm.h> + #include <asm/prom.h> +#include <asm/pmac_feature.h> +#include <asm/dbdma.h> + #include "i2sbus-interface.h" -#include "i2sbus-control.h" #include "../soundbus.h" struct i2sbus_control { - volatile struct i2s_control_regs __iomem *controlregs; - struct resource rsrc; struct list_head list; + struct macio_chip *macio; }; #define MAX_DBDMA_COMMANDS 32 @@ -45,6 +47,12 @@ struct pcm_info { volatile struct dbdma_regs __iomem *dbdma; }; +enum { + aoa_resource_i2smmio = 0, + aoa_resource_txdbdma, + aoa_resource_rxdbdma, +}; + struct i2sbus_dev { struct soundbus_dev sound; struct macio_dev *macio; diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 71b5080fa66..75a9505c744 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -988,13 +988,12 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { struct snd_ctl_elem_info *uinfo; - uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); if (! uinfo) { up_read(&mixer->card->controls_rwsem); return -ENOMEM; } - memset(uinfo, 0, sizeof(*uinfo)); if (kctl->info(kctl, uinfo)) { up_read(&mixer->card->controls_rwsem); return 0; diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index f5ff4f4a16e..472fce0ee0e 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2228,6 +2228,8 @@ static int snd_pcm_oss_open_file(struct file *file, for (idx = 0; idx < 2; idx++) { if (setup[idx].disable) continue; + if (! pcm->streams[idx].substream_count) + continue; /* no matching substream */ if (idx == SNDRV_PCM_STREAM_PLAYBACK) { if (! (f_mode & FMODE_WRITE)) continue; diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 4260de90f36..102ff548ce6 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c @@ -372,10 +372,9 @@ static struct ops_list * create_driver(char *id) { struct ops_list *ops; - ops = kmalloc(sizeof(*ops), GFP_KERNEL); + ops = kzalloc(sizeof(*ops), GFP_KERNEL); if (ops == NULL) return ops; - memset(ops, 0, sizeof(*ops)); /* set up driver entry */ strlcpy(ops->id, id, sizeof(ops->id)); diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index 6e4d4ab3463..c30669f14ac 100644 --- a/sound/core/sgbuf.c +++ b/sound/core/sgbuf.c @@ -68,21 +68,18 @@ void *snd_malloc_sgbuf_pages(struct device *device, dmab->area = NULL; dmab->addr = 0; - dmab->private_data = sgbuf = kmalloc(sizeof(*sgbuf), GFP_KERNEL); + dmab->private_data = sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL); if (! sgbuf) return NULL; - memset(sgbuf, 0, sizeof(*sgbuf)); sgbuf->dev = device; pages = snd_sgbuf_aligned_pages(size); sgbuf->tblsize = sgbuf_align_table(pages); - sgbuf->table = kmalloc(sizeof(*sgbuf->table) * sgbuf->tblsize, GFP_KERNEL); + sgbuf->table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->table), GFP_KERNEL); if (! sgbuf->table) goto _failed; - memset(sgbuf->table, 0, sizeof(*sgbuf->table) * sgbuf->tblsize); - sgbuf->page_table = kmalloc(sizeof(*sgbuf->page_table) * sgbuf->tblsize, GFP_KERNEL); + sgbuf->page_table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->page_table), GFP_KERNEL); if (! sgbuf->page_table) goto _failed; - memset(sgbuf->page_table, 0, sizeof(*sgbuf->page_table) * sgbuf->tblsize); /* allocate each page */ for (i = 0; i < pages; i++) { diff --git a/sound/core/sound.c b/sound/core/sound.c index 264f2efd1af..7edd1fc58b1 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -244,7 +244,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, struct device *device = NULL; snd_assert(name, return -EINVAL); - preg = kmalloc(sizeof(struct snd_minor) + strlen(name) + 1, GFP_KERNEL); + preg = kmalloc(sizeof *preg, GFP_KERNEL); if (preg == NULL) return -ENOMEM; preg->type = type; @@ -252,7 +252,6 @@ int snd_register_device(int type, struct snd_card *card, int dev, preg->device = dev; preg->f_ops = f_ops; preg->private_data = private_data; - strcpy(preg->name, name); mutex_lock(&sound_mutex); #ifdef CONFIG_SND_DYNAMIC_MINORS minor = snd_find_free_minor(); diff --git a/sound/core/timer.c b/sound/core/timer.c index 78199f58b93..0a984e881c1 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -628,8 +628,9 @@ static void snd_timer_tasklet(unsigned long arg) struct snd_timer_instance *ti; struct list_head *p; unsigned long resolution, ticks; + unsigned long flags; - spin_lock(&timer->lock); + spin_lock_irqsave(&timer->lock, flags); /* now process all callbacks */ while (!list_empty(&timer->sack_list_head)) { p = timer->sack_list_head.next; /* get first item */ @@ -649,7 +650,7 @@ static void snd_timer_tasklet(unsigned long arg) spin_lock(&timer->lock); ti->flags &= ~SNDRV_TIMER_IFLG_CALLBACK; } - spin_unlock(&timer->lock); + spin_unlock_irqrestore(&timer->lock, flags); } /* diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index c4af84995d0..7e65a103fbb 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c @@ -1252,18 +1252,15 @@ static int vx_init_audio_io(struct vx_core *chip) chip->audio_info = rmh.Stat[1]; /* allocate pipes */ - chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL); + chip->playback_pipes = kcalloc(chip->audio_outs, sizeof(struct vx_pipe *), GFP_KERNEL); if (!chip->playback_pipes) return -ENOMEM; - chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL); + chip->capture_pipes = kcalloc(chip->audio_ins, sizeof(struct vx_pipe *), GFP_KERNEL); if (!chip->capture_pipes) { kfree(chip->playback_pipes); return -ENOMEM; } - memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs); - memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins); - preferred = chip->ibl.size; chip->ibl.size = 0; vx_set_ibl(chip, &chip->ibl); /* query the info */ diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index cb89f7eb923..64388cb8d6e 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c @@ -76,23 +76,28 @@ int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, buf[0] = reg & 0x7f; buf[1] = val; if ((err = snd_i2c_sendbytes(device, buf, 2)) != 2) { - snd_printk(KERN_ERR "unable to send bytes 0x%02x:0x%02x to CS8427 (%i)\n", buf[0], buf[1], err); + snd_printk(KERN_ERR "unable to send bytes 0x%02x:0x%02x " + "to CS8427 (%i)\n", buf[0], buf[1], err); return err < 0 ? err : -EIO; } return 0; } +EXPORT_SYMBOL(snd_cs8427_reg_write); + static int snd_cs8427_reg_read(struct snd_i2c_device *device, unsigned char reg) { int err; unsigned char buf; if ((err = snd_i2c_sendbytes(device, ®, 1)) != 1) { - snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg); + snd_printk(KERN_ERR "unable to send register 0x%x byte " + "to CS8427\n", reg); return err < 0 ? err : -EIO; } if ((err = snd_i2c_readbytes(device, &buf, 1)) != 1) { - snd_printk(KERN_ERR "unable to read register 0x%x byte from CS8427\n", reg); + snd_printk(KERN_ERR "unable to read register 0x%x byte " + "from CS8427\n", reg); return err < 0 ? err : -EIO; } return buf; @@ -121,7 +126,8 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device, int count) { struct cs8427 *chip = device->private_data; - char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status; + char *hw_data = udata ? + chip->playback.hw_udata : chip->playback.hw_status; char data[32]; int err, idx; @@ -134,11 +140,11 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device, memset(data, 0, sizeof(data)); if (memcmp(hw_data, data, count) == 0) { chip->regmap[CS8427_REG_UDATABUF] &= ~CS8427_UBMMASK; - chip->regmap[CS8427_REG_UDATABUF] |= CS8427_UBMZEROS | CS8427_EFTUI; - if ((err = snd_cs8427_reg_write(device, CS8427_REG_UDATABUF, - chip->regmap[CS8427_REG_UDATABUF])) < 0) - return err; - return 0; + chip->regmap[CS8427_REG_UDATABUF] |= CS8427_UBMZEROS | + CS8427_EFTUI; + err = snd_cs8427_reg_write(device, CS8427_REG_UDATABUF, + chip->regmap[CS8427_REG_UDATABUF]); + return err < 0 ? err : 0; } } data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF; @@ -161,24 +167,32 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, { static unsigned char initvals1[] = { CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC, - /* CS8427_REG_CONTROL1: RMCK to OMCK, valid PCM audio, disable mutes, TCBL=output */ + /* CS8427_REG_CONTROL1: RMCK to OMCK, valid PCM audio, disable mutes, + TCBL=output */ CS8427_SWCLK | CS8427_TCBLDIR, - /* CS8427_REG_CONTROL2: hold last valid audio sample, RMCK=256*Fs, normal stereo operation */ + /* CS8427_REG_CONTROL2: hold last valid audio sample, RMCK=256*Fs, + normal stereo operation */ 0x00, - /* CS8427_REG_DATAFLOW: output drivers normal operation, Tx<=serial, Rx=>serial */ + /* CS8427_REG_DATAFLOW: output drivers normal operation, Tx<=serial, + Rx=>serial */ CS8427_TXDSERIAL | CS8427_SPDAES3RECEIVER, - /* CS8427_REG_CLOCKSOURCE: Run off, CMCK=256*Fs, output time base = OMCK, input time base = - recovered input clock, recovered input clock source is ILRCK changed to AES3INPUT (workaround, see snd_cs8427_reset) */ + /* CS8427_REG_CLOCKSOURCE: Run off, CMCK=256*Fs, + output time base = OMCK, input time base = recovered input clock, + recovered input clock source is ILRCK changed to AES3INPUT + (workaround, see snd_cs8427_reset) */ CS8427_RXDILRCK, - /* CS8427_REG_SERIALINPUT: Serial audio input port data format = I2S, 24-bit, 64*Fsi */ + /* CS8427_REG_SERIALINPUT: Serial audio input port data format = I2S, + 24-bit, 64*Fsi */ CS8427_SIDEL | CS8427_SILRPOL, - /* CS8427_REG_SERIALOUTPUT: Serial audio output port data format = I2S, 24-bit, 64*Fsi */ + /* CS8427_REG_SERIALOUTPUT: Serial audio output port data format + = I2S, 24-bit, 64*Fsi */ CS8427_SODEL | CS8427_SOLRPOL, }; static unsigned char initvals2[] = { CS8427_REG_RECVERRMASK | CS8427_REG_AUTOINC, - /* CS8427_REG_RECVERRMASK: unmask the input PLL clock, V, confidence, biphase, parity status bits */ - /* CS8427_UNLOCK | CS8427_V | CS8427_CONF | CS8427_BIP | CS8427_PAR, */ + /* CS8427_REG_RECVERRMASK: unmask the input PLL clock, V, confidence, + biphase, parity status bits */ + /* CS8427_UNLOCK | CS8427_V | CS8427_CONF | CS8427_BIP | CS8427_PAR,*/ 0xff, /* set everything */ /* CS8427_REG_CSDATABUF: Registers 32-55 window to CS buffer @@ -201,7 +215,8 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, struct snd_i2c_device *device; unsigned char buf[24]; - if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), + if ((err = snd_i2c_device_create(bus, "CS8427", + CS8427_ADDR | (addr & 7), &device)) < 0) return err; chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); @@ -212,8 +227,8 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, device->private_free = snd_cs8427_free; snd_i2c_lock(bus); - if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != - CS8427_VER8427A) { + err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER); + if (err != CS8427_VER8427A) { snd_i2c_unlock(bus); snd_printk(KERN_ERR "unable to find CS8427 signature " "(expected 0x%x, read 0x%x),\n", @@ -222,7 +237,8 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, return -EFAULT; } /* turn off run bit while making changes to configuration */ - if ((err = snd_cs8427_reg_write(device, CS8427_REG_CLOCKSOURCE, 0x00)) < 0) + err = snd_cs8427_reg_write(device, CS8427_REG_CLOCKSOURCE, 0x00); + if (err < 0) goto __fail; /* send initial values */ memcpy(chip->regmap + (initvals1[0] & 0x7f), initvals1 + 1, 6); @@ -282,6 +298,8 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, return err < 0 ? err : -EIO; } +EXPORT_SYMBOL(snd_cs8427_create); + /* * Reset the chip using run bit, also lock PLL using ILRCK and * put back AES3INPUT. This workaround is described in latest @@ -296,7 +314,8 @@ static void snd_cs8427_reset(struct snd_i2c_device *cs8427) snd_assert(cs8427, return); chip = cs8427->private_data; snd_i2c_lock(cs8427->bus); - if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) == CS8427_RXDAES3INPUT) /* AES3 bit is set */ + if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) == + CS8427_RXDAES3INPUT) /* AES3 bit is set */ aes3input = 1; chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~(CS8427_RUN | CS8427_RXDMASK); snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, @@ -367,12 +386,15 @@ static int snd_cs8427_qsubcode_get(struct snd_kcontrol *kcontrol, snd_i2c_lock(device->bus); if ((err = snd_i2c_sendbytes(device, ®, 1)) != 1) { - snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg); + snd_printk(KERN_ERR "unable to send register 0x%x byte " + "to CS8427\n", reg); snd_i2c_unlock(device->bus); return err < 0 ? err : -EIO; } - if ((err = snd_i2c_readbytes(device, ucontrol->value.bytes.data, 10)) != 10) { - snd_printk(KERN_ERR "unable to read Q-subcode bytes from CS8427\n"); + err = snd_i2c_readbytes(device, ucontrol->value.bytes.data, 10); + if (err != 10) { + snd_printk(KERN_ERR "unable to read Q-subcode bytes " + "from CS8427\n"); snd_i2c_unlock(device->bus); return err < 0 ? err : -EIO; } @@ -380,7 +402,8 @@ static int snd_cs8427_qsubcode_get(struct snd_kcontrol *kcontrol, return 0; } -static int snd_cs8427_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) +static int snd_cs8427_spdif_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->count = 1; @@ -413,7 +436,8 @@ static int snd_cs8427_spdif_put(struct snd_kcontrol *kcontrol, snd_i2c_lock(device->bus); change = memcmp(ucontrol->value.iec958.status, status, 24) != 0; memcpy(status, ucontrol->value.iec958.status, 24); - if (change && (kcontrol->private_value ? runtime != NULL : runtime == NULL)) { + if (change && (kcontrol->private_value ? + runtime != NULL : runtime == NULL)) { err = snd_cs8427_send_corudata(device, 0, status, 24); if (err < 0) change = err; @@ -442,7 +466,8 @@ static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .info = snd_cs8427_in_status_info, .name = "IEC958 CS8427 Input Status", - .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .access = (SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE), .get = snd_cs8427_in_status_get, .private_value = 15, }, @@ -450,7 +475,8 @@ static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .info = snd_cs8427_in_status_info, .name = "IEC958 CS8427 Error Status", - .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .access = (SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE), .get = snd_cs8427_in_status_get, .private_value = 16, }, @@ -470,7 +496,8 @@ static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = { .private_value = 0 }, { - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, + .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_INACTIVE), .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM), .info = snd_cs8427_spdif_info, @@ -482,7 +509,8 @@ static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .info = snd_cs8427_qsubcode_info, .name = "IEC958 Q-subcode Capture Default", - .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .access = (SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE), .get = snd_cs8427_qsubcode_get }}; @@ -505,7 +533,8 @@ int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427, err = snd_ctl_add(cs8427->bus->card, kctl); if (err < 0) return err; - if (!strcmp(kctl->id.name, SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM))) + if (! strcmp(kctl->id.name, + SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM))) chip->playback.pcm_ctl = kctl; } @@ -515,6 +544,8 @@ int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427, return 0; } +EXPORT_SYMBOL(snd_cs8427_iec958_build); + int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active) { struct cs8427 *chip; @@ -522,13 +553,17 @@ int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active) snd_assert(cs8427, return -ENXIO); chip = cs8427->private_data; if (active) - memcpy(chip->playback.pcm_status, chip->playback.def_status, 24); + memcpy(chip->playback.pcm_status, + chip->playback.def_status, 24); chip->playback.pcm_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; - snd_ctl_notify(cs8427->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | - SNDRV_CTL_EVENT_MASK_INFO, &chip->playback.pcm_ctl->id); + snd_ctl_notify(cs8427->bus->card, + SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO, + &chip->playback.pcm_ctl->id); return 0; } +EXPORT_SYMBOL(snd_cs8427_iec958_active); + int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate) { struct cs8427 *chip; @@ -568,6 +603,8 @@ int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate) return err < 0 ? err : 0; } +EXPORT_SYMBOL(snd_cs8427_iec958_pcm); + static int __init alsa_cs8427_module_init(void) { return 0; @@ -579,10 +616,3 @@ static void __exit alsa_cs8427_module_exit(void) module_init(alsa_cs8427_module_init) module_exit(alsa_cs8427_module_exit) - -EXPORT_SYMBOL(snd_cs8427_create); -EXPORT_SYMBOL(snd_cs8427_reset); -EXPORT_SYMBOL(snd_cs8427_reg_write); -EXPORT_SYMBOL(snd_cs8427_iec958_build); -EXPORT_SYMBOL(snd_cs8427_iec958_active); -EXPORT_SYMBOL(snd_cs8427_iec958_pcm); diff --git a/sound/isa/cs423x/Makefile b/sound/isa/cs423x/Makefile index d2afaea30cb..2fb4f7409d7 100644 --- a/sound/isa/cs423x/Makefile +++ b/sound/isa/cs423x/Makefile @@ -11,6 +11,7 @@ snd-cs4236-objs := cs4236.o # Toplevel Module Dependency obj-$(CONFIG_SND_AZT2320) += snd-cs4231-lib.o +obj-$(CONFIG_SND_MIRO) += snd-cs4231-lib.o obj-$(CONFIG_SND_OPL3SA2) += snd-cs4231-lib.o obj-$(CONFIG_SND_CS4231) += snd-cs4231.o snd-cs4231-lib.o obj-$(CONFIG_SND_CS4232) += snd-cs4232.o snd-cs4231-lib.o diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 22cdddbfd82..532c56e35ca 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -87,7 +87,7 @@ MODULE_PARM_DESC(channels, "GF1 channels for GUS Extreme driver."); module_param_array(pcm_channels, int, NULL, 0444); MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver."); -struct platform_device *devices[SNDRV_CARDS]; +static struct platform_device *devices[SNDRV_CARDS]; #define PFX "gusextreme: " diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 180661c5ffd..4f0846feb73 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -34,7 +34,7 @@ /* weird stuff, derived from port I/O tracing with dosemu */ -static unsigned char page_zero[] __initdata = { +static unsigned char page_zero[] __devinitdata = { 0x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x02, 0x76, 0x00, 0x60, 0x00, 0x80, 0x02, 0x00, 0x00, @@ -61,7 +61,7 @@ static unsigned char page_zero[] __initdata = { 0x1d, 0x02, 0xdf }; -static unsigned char page_one[] __initdata = { +static unsigned char page_one[] __devinitdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00, 0x02, 0x20, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, @@ -88,7 +88,7 @@ static unsigned char page_one[] __initdata = { 0x60, 0x00, 0x1b }; -static unsigned char page_two[] __initdata = { +static unsigned char page_two[] __devinitdata = { 0xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4, 0x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -103,7 +103,7 @@ static unsigned char page_two[] __initdata = { 0x46, 0x05, 0x46, 0x07, 0x46, 0x07, 0x44 }; -static unsigned char page_three[] __initdata = { +static unsigned char page_three[] __devinitdata = { 0x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -118,7 +118,7 @@ static unsigned char page_three[] __initdata = { 0x02, 0x00, 0x42, 0x00, 0xc0, 0x00, 0x40 }; -static unsigned char page_four[] __initdata = { +static unsigned char page_four[] __devinitdata = { 0x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -133,7 +133,7 @@ static unsigned char page_four[] __initdata = { 0x02, 0x62, 0x02, 0x20, 0x01, 0x21, 0x01 }; -static unsigned char page_six[] __initdata = { +static unsigned char page_six[] __devinitdata = { 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x00, @@ -154,7 +154,7 @@ static unsigned char page_six[] __initdata = { 0x80, 0x00, 0x7e, 0x80, 0x80 }; -static unsigned char page_seven[] __initdata = { +static unsigned char page_seven[] __devinitdata = { 0x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0f, @@ -181,7 +181,7 @@ static unsigned char page_seven[] __initdata = { 0x00, 0x02, 0x00 }; -static unsigned char page_zero_v2[] __initdata = { +static unsigned char page_zero_v2[] __devinitdata = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -193,7 +193,7 @@ static unsigned char page_zero_v2[] __initdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char page_one_v2[] __initdata = { +static unsigned char page_one_v2[] __devinitdata = { 0x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -205,21 +205,21 @@ static unsigned char page_one_v2[] __initdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char page_two_v2[] __initdata = { +static unsigned char page_two_v2[] __devinitdata = { 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char page_three_v2[] __initdata = { +static unsigned char page_three_v2[] __devinitdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char page_four_v2[] __initdata = { +static unsigned char page_four_v2[] __devinitdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -227,7 +227,7 @@ static unsigned char page_four_v2[] __initdata = { 0x00, 0x00, 0x00, 0x00 }; -static unsigned char page_seven_v2[] __initdata = { +static unsigned char page_seven_v2[] __devinitdata = { 0x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -239,7 +239,7 @@ static unsigned char page_seven_v2[] __initdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char mod_v2[] __initdata = { +static unsigned char mod_v2[] __devinitdata = { 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, 0x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05, 0x02, 0x00, 0x01, 0x06, 0x02, 0x00, 0x01, 0x07, 0x02, 0x00, 0xb0, @@ -269,7 +269,7 @@ static unsigned char mod_v2[] __initdata = { 0x02, 0x01, 0x01, 0x04, 0x02, 0x01, 0x01, 0x05, 0x02, 0x01, 0x01, 0x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01 }; -static unsigned char coefficients[] __initdata = { +static unsigned char coefficients[] __devinitdata = { 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03, 0x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x07, 0x41, 0x00, 0x00, 0x01, @@ -305,14 +305,14 @@ static unsigned char coefficients[] __initdata = { 0x06, 0x6c, 0x4c, 0x6c, 0x06, 0x50, 0x52, 0xe2, 0x06, 0x42, 0x02, 0xba }; -static unsigned char coefficients2[] __initdata = { +static unsigned char coefficients2[] __devinitdata = { 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f, 0xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d, 0x04, 0xcc, 0x07, 0x7c, 0x00, 0x00, 0x07, 0x7e, 0x00, 0x00, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x47, 0x00, 0x00, 0x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00 }; -static unsigned char coefficients3[] __initdata = { +static unsigned char coefficients3[] __devinitdata = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00, 0x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xf5, 0x00, 0xf5, 0x01, 0x1e, 0x01, 0x1e, 0x01, @@ -563,7 +563,7 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file, */ -int __init +int __devinit snd_wavefront_fx_start (snd_wavefront_t *dev) { diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c index 15888ba2169..cb346009432 100644 --- a/sound/isa/wavefront/wavefront_midi.c +++ b/sound/isa/wavefront/wavefront_midi.c @@ -474,7 +474,7 @@ snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *card) spin_unlock_irqrestore (&card->wavefront.midi.virtual, flags); } -int __init +int __devinit snd_wavefront_midi_start (snd_wavefront_card_t *card) { diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 68aa091e896..bed329edbdd 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -1738,7 +1738,7 @@ snd_wavefront_internal_interrupt (snd_wavefront_card_t *card) 7 Unused */ -static int __init +static int __devinit snd_wavefront_interrupt_bits (int irq) { @@ -1766,7 +1766,7 @@ snd_wavefront_interrupt_bits (int irq) return bits; } -static void __init +static void __devinit wavefront_should_cause_interrupt (snd_wavefront_t *dev, int val, int port, int timeout) @@ -1787,7 +1787,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev, } } -static int __init +static int __devinit wavefront_reset_to_cleanliness (snd_wavefront_t *dev) { @@ -1946,7 +1946,7 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev) #include <asm/uaccess.h> -static int __init +static int __devinit wavefront_download_firmware (snd_wavefront_t *dev, char *path) { @@ -2047,7 +2047,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path) } -static int __init +static int __devinit wavefront_do_reset (snd_wavefront_t *dev) { @@ -2136,7 +2136,7 @@ wavefront_do_reset (snd_wavefront_t *dev) return 1; } -int __init +int __devinit snd_wavefront_start (snd_wavefront_t *dev) { @@ -2178,7 +2178,7 @@ snd_wavefront_start (snd_wavefront_t *dev) return (0); } -int __init +int __devinit snd_wavefront_detect (snd_wavefront_card_t *card) { diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index f4980ca5c05..1b7c3dfc2b4 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig @@ -31,7 +31,7 @@ config SOUND_EMU10K1 For more information on this driver and the degree of support for the different card models please check: - <http://sourceforge.net/projects/emu10k1/> + <http://sourceforge.net/projects/emu10k1/> It is now possible to load dsp microcode patches into the EMU10K1 chip. These patches are used to implement real time sound @@ -140,7 +140,7 @@ config SOUND_TRIDENT system support" and "Sysctl support", and after the /proc file system has been mounted, executing the command - command what is enabled + command what is enabled echo 0>/proc/ALi5451 pcm out is also set to S/PDIF out. (Default). @@ -838,7 +838,7 @@ config SOUND_WAVEARTIST config SOUND_TVMIXER tristate "TV card (bt848) mixer support" - depends on SOUND_PRIME && I2C + depends on SOUND_PRIME && I2C && VIDEO_V4L1 help Support for audio mixer facilities on the BT848 TV frame-grabber card. diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 23e54cedfd4..e49c0fe21b0 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -16,16 +16,16 @@ config SND_AD1889 will be called snd-ad1889. config SND_ALS300 - tristate "Avance Logic ALS300/ALS300+" - depends on SND - select SND_PCM - select SND_AC97_CODEC - select SND_OPL3_LIB - help - Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+ + tristate "Avance Logic ALS300/ALS300+" + depends on SND + select SND_PCM + select SND_AC97_CODEC + select SND_OPL3_LIB + help + Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+ - To compile this driver as a module, choose M here: the module - will be called snd-als300 + To compile this driver as a module, choose M here: the module + will be called snd-als300 config SND_ALS4000 tristate "Avance Logic ALS4000" @@ -78,49 +78,49 @@ config SND_ATIIXP_MODEM will be called snd-atiixp-modem. config SND_AU8810 - tristate "Aureal Advantage" - depends on SND + tristate "Aureal Advantage" + depends on SND select SND_MPU401_UART select SND_AC97_CODEC - help + help Say Y here to include support for Aureal Advantage soundcards. Supported features: Hardware Mixer, SRC, EQ and SPDIF output. - 3D support code is in place, but not yet useable. For more info, - email the ALSA developer list, or <mjander@users.sourceforge.net>. + 3D support code is in place, but not yet useable. For more info, + email the ALSA developer list, or <mjander@users.sourceforge.net>. To compile this driver as a module, choose M here: the module will be called snd-au8810. - + config SND_AU8820 - tristate "Aureal Vortex" - depends on SND + tristate "Aureal Vortex" + depends on SND select SND_MPU401_UART select SND_AC97_CODEC - help + help Say Y here to include support for Aureal Vortex soundcards. - Supported features: Hardware Mixer and SRC. For more info, email - the ALSA developer list, or <mjander@users.sourceforge.net>. + Supported features: Hardware Mixer and SRC. For more info, email + the ALSA developer list, or <mjander@users.sourceforge.net>. To compile this driver as a module, choose M here: the module will be called snd-au8820. - + config SND_AU8830 - tristate "Aureal Vortex 2" - depends on SND + tristate "Aureal Vortex 2" + depends on SND select SND_MPU401_UART select SND_AC97_CODEC - help + help Say Y here to include support for Aureal Vortex 2 soundcards. - Supported features: Hardware Mixer, SRC, EQ and SPDIF output. - 3D support code is in place, but not yet useable. For more info, - email the ALSA developer list, or <mjander@users.sourceforge.net>. + Supported features: Hardware Mixer, SRC, EQ and SPDIF output. + 3D support code is in place, but not yet useable. For more info, + email the ALSA developer list, or <mjander@users.sourceforge.net>. To compile this driver as a module, choose M here: the module will be called snd-au8830. - + config SND_AZT3328 tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)" depends on SND && EXPERIMENTAL @@ -135,10 +135,10 @@ config SND_AZT3328 will be called snd-azt3328. config SND_BT87X - tristate "Bt87x Audio Capture" - depends on SND + tristate "Bt87x Audio Capture" + depends on SND select SND_PCM - help + help If you want to record audio from TV cards based on Brooktree Bt878/Bt879 chips, say Y here and read <file:Documentation/sound/alsa/Bt87x.txt>. @@ -209,7 +209,7 @@ config SND_CS46XX config SND_CS46XX_NEW_DSP bool "Cirrus Logic (Sound Fusion) New DSP support" depends on SND_CS46XX - default y + default y help Say Y here to use a new DSP image for SPDIF and dual codecs. @@ -225,7 +225,7 @@ config SND_CS5535AUDIO referred to as NS CS5535 IO or AMD CS5535 IO companion in various literature. This driver also supports the CS5536 audio device. However, for both chips, on certain boards, you may - need to use ac97_quirk=hp_only if your board has physically + need to use ac97_quirk=hp_only if your board has physically mapped headphone out to master output. If that works for you, send lspci -vvv output to the mailing list so that your board can be identified in the quirks list. @@ -460,17 +460,21 @@ config SND_FM801 To compile this driver as a module, choose M here: the module will be called snd-fm801. -config SND_FM801_TEA575X - tristate "ForteMedia FM801 + TEA5757 tuner" +config SND_FM801_TEA575X_BOOL + bool "ForteMedia FM801 + TEA5757 tuner" depends on SND_FM801 - select VIDEO_DEV help Say Y here to include support for soundcards based on the ForteMedia FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media - Forte SF256-PCS-02). + Forte SF256-PCS-02) into the snd-fm801 driver. - To compile this driver as a module, choose M here: the module - will be called snd-fm801-tea575x. + This will enable support for the old V4L1 API. + +config SND_FM801_TEA575X + tristate + depends on SND_FM801_TEA575X_BOOL + default SND_FM801 + select VIDEO_V4L1 config SND_HDA_INTEL tristate "Intel HD Audio" diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index f7aef8c9cf4..0786d0edaca 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -241,14 +241,14 @@ ad1889_channel_reset(struct snd_ad1889 *chip, unsigned int channel) } } -static inline u16 +static u16 snd_ad1889_ac97_read(struct snd_ac97 *ac97, unsigned short reg) { struct snd_ad1889 *chip = ac97->private_data; return ad1889_readw(chip, AD_AC97_BASE + reg); } -static inline void +static void snd_ad1889_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { struct snd_ad1889 *chip = ac97->private_data; @@ -873,7 +873,7 @@ skip_hw: return 0; } -static inline int +static int snd_ad1889_dev_free(struct snd_device *device) { struct snd_ad1889 *chip = device->device_data; @@ -1051,7 +1051,7 @@ snd_ad1889_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } -static struct pci_device_id snd_ad1889_ids[] __devinitdata = { +static struct pci_device_id snd_ad1889_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) }, { 0, }, }; diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index e0a815e53d1..74668398eac 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -279,7 +279,7 @@ struct snd_ali { #endif }; -static struct pci_device_id snd_ali_ids[] __devinitdata = { +static struct pci_device_id snd_ali_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5451), 0, 0, 0}, {0, } }; diff --git a/sound/pci/als300.c b/sound/pci/als300.c index a9c38963188..96cfb8ae505 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -146,7 +146,7 @@ struct snd_als300_substream_data { int block_counter_register; }; -static struct pci_device_id snd_als300_ids[] __devinitdata = { +static struct pci_device_id snd_als300_ids[] = { { 0x4005, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALS300 }, { 0x4005, 0x0308, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALS300_PLUS }, { 0, } diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index a9f08066459..9e596f750cb 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -116,7 +116,7 @@ struct snd_card_als4000 { #endif }; -static struct pci_device_id snd_als4000_ids[] __devinitdata = { +static struct pci_device_id snd_als4000_ids[] = { { 0x4005, 0x4000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* ALS4000 */ { 0, } }; diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 9fbb065a810..347e25ff073 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -284,7 +284,7 @@ struct atiixp { /* */ -static struct pci_device_id snd_atiixp_ids[] __devinitdata = { +static struct pci_device_id snd_atiixp_ids[] = { { 0x1002, 0x4341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ { 0x1002, 0x4361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB300 */ { 0x1002, 0x4370, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB400 */ diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 7dcf4941dce..a89d67c4598 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -262,7 +262,7 @@ struct atiixp_modem { /* */ -static struct pci_device_id snd_atiixp_ids[] __devinitdata = { +static struct pci_device_id snd_atiixp_ids[] = { { 0x1002, 0x434d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ { 0x1002, 0x4378, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB400 */ { 0, } diff --git a/sound/pci/au88x0/au8810.c b/sound/pci/au88x0/au8810.c index bd3352998ad..fce22c7af0e 100644 --- a/sound/pci/au88x0/au8810.c +++ b/sound/pci/au88x0/au8810.c @@ -1,6 +1,6 @@ #include "au8810.h" #include "au88x0.h" -static struct pci_device_id snd_vortex_ids[] __devinitdata = { +static struct pci_device_id snd_vortex_ids[] = { {PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_ADVANTAGE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1,}, {0,} diff --git a/sound/pci/au88x0/au8820.c b/sound/pci/au88x0/au8820.c index 7e3fd8372d8..d1fbcce0725 100644 --- a/sound/pci/au88x0/au8820.c +++ b/sound/pci/au88x0/au8820.c @@ -1,6 +1,6 @@ #include "au8820.h" #include "au88x0.h" -static struct pci_device_id snd_vortex_ids[] __devinitdata = { +static struct pci_device_id snd_vortex_ids[] = { {PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, {0,} diff --git a/sound/pci/au88x0/au8830.c b/sound/pci/au88x0/au8830.c index b840f6608a6..d4f2717c14f 100644 --- a/sound/pci/au88x0/au8830.c +++ b/sound/pci/au88x0/au8830.c @@ -1,6 +1,6 @@ #include "au8830.h" #include "au88x0.h" -static struct pci_device_id snd_vortex_ids[] __devinitdata = { +static struct pci_device_id snd_vortex_ids[] = { {PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, {0,} diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h index f078b716d2b..b1cfc3c79d0 100644 --- a/sound/pci/au88x0/au88x0.h +++ b/sound/pci/au88x0/au88x0.h @@ -270,7 +270,8 @@ static void vortex_mix_setvolumebyte(vortex_t * vortex, unsigned char mix, /* A3D functions. */ #ifndef CHIP_AU8820 -static void vortex_Vort3D(vortex_t * v, int en); +static void vortex_Vort3D_enable(vortex_t * v); +static void vortex_Vort3D_disable(vortex_t * v); static void vortex_Vort3D_connect(vortex_t * vortex, int en); static void vortex_Vort3D_InitializeSource(a3dsrc_t * a, int en); #endif diff --git a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c index d215f393ea6..649849e540d 100644 --- a/sound/pci/au88x0/au88x0_a3d.c +++ b/sound/pci/au88x0/au88x0_a3d.c @@ -593,24 +593,23 @@ static int Vort3DRend_Initialize(vortex_t * v, unsigned short mode) static int vortex_a3d_register_controls(vortex_t * vortex); static void vortex_a3d_unregister_controls(vortex_t * vortex); /* A3D base support init/shudown */ -static void vortex_Vort3D(vortex_t * v, int en) +static void __devinit vortex_Vort3D_enable(vortex_t * v) { int i; - if (en) { - Vort3DRend_Initialize(v, XT_HEADPHONE); - for (i = 0; i < NR_A3D; i++) { - vortex_A3dSourceHw_Initialize(v, i % 4, i >> 2); - a3dsrc_ZeroStateA3D(&(v->a3d[0])); - } - } else { - vortex_XtalkHw_Disable(v); + + Vort3DRend_Initialize(v, XT_HEADPHONE); + for (i = 0; i < NR_A3D; i++) { + vortex_A3dSourceHw_Initialize(v, i % 4, i >> 2); + a3dsrc_ZeroStateA3D(&(v->a3d[0])); } /* Register ALSA controls */ - if (en) { - vortex_a3d_register_controls(v); - } else { - vortex_a3d_unregister_controls(v); - } + vortex_a3d_register_controls(v); +} + +static void vortex_Vort3D_disable(vortex_t * v) +{ + vortex_XtalkHw_Disable(v); + vortex_a3d_unregister_controls(v); } /* Make A3D subsystem connections. */ @@ -855,7 +854,7 @@ static struct snd_kcontrol_new vortex_a3d_kcontrol __devinitdata = { }; /* Control (un)registration. */ -static int vortex_a3d_register_controls(vortex_t * vortex) +static int __devinit vortex_a3d_register_controls(vortex_t * vortex) { struct snd_kcontrol *kcontrol; int err, i; diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index 4347e6abc1d..5299cce583d 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -2690,7 +2690,7 @@ static int __devinit vortex_core_init(vortex_t * vortex) #ifndef CHIP_AU8820 vortex_eq_init(vortex); vortex_spdif_init(vortex, 48000, 1); - vortex_Vort3D(vortex, 1); + vortex_Vort3D_enable(vortex); #endif #ifndef CHIP_AU8810 vortex_wt_init(vortex); @@ -2718,7 +2718,7 @@ static int vortex_core_shutdown(vortex_t * vortex) printk(KERN_INFO "Vortex: shutdown..."); #ifndef CHIP_AU8820 vortex_eq_free(vortex); - vortex_Vort3D(vortex, 0); + vortex_Vort3D_disable(vortex); #endif //vortex_disable_timer_int(vortex); vortex_disable_int(vortex); diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 15447a3216d..bac8e9cfd92 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -238,7 +238,7 @@ struct snd_azf3328 { #endif }; -static const struct pci_device_id snd_azf3328_ids[] __devinitdata = { +static const struct pci_device_id snd_azf3328_ids[] = { { 0x122D, 0x50DC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* PCI168/3328 */ { 0x122D, 0x80DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 3328 */ { 0, } diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 4d4277d045a..97a280a246c 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -774,7 +774,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card, .driver_data = rate } /* driver_data is the default digital_rate value for that device */ -static struct pci_device_id snd_bt87x_ids[] __devinitdata = { +static struct pci_device_id snd_bt87x_ids[] = { /* Hauppauge WinTV series */ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, 32000), /* Hauppauge WinTV series */ diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index a30c019bab6..12bbbb6afd2 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -1602,7 +1602,7 @@ static void __devexit snd_ca0106_remove(struct pci_dev *pci) } // PCI IDs -static struct pci_device_id snd_ca0106_ids[] __devinitdata = { +static struct pci_device_id snd_ca0106_ids[] = { { 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Audigy LS or Live 24bit */ { 0, } }; diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 03766ad7499..876b64464b6 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -2609,7 +2609,7 @@ static inline void snd_cmipci_proc_init(struct cmipci *cm) {} #endif -static struct pci_device_id snd_cmipci_ids[] __devinitdata = { +static struct pci_device_id snd_cmipci_ids[] = { {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index d1802487f5b..9631456ec3d 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -494,7 +494,7 @@ struct cs4281 { static irqreturn_t snd_cs4281_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static struct pci_device_id snd_cs4281_ids[] __devinitdata = { +static struct pci_device_id snd_cs4281_ids[] = { { 0x1013, 0x6005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4281 */ { 0, } }; diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 772dc52bfeb..8b6cd144d10 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c @@ -65,7 +65,7 @@ MODULE_PARM_DESC(thinkpad, "Force to enable Thinkpad's CLKRUN control."); module_param_array(mmap_valid, bool, NULL, 0444); MODULE_PARM_DESC(mmap_valid, "Support OSS mmap."); -static struct pci_device_id snd_cs46xx_ids[] __devinitdata = { +static struct pci_device_id snd_cs46xx_ids[] = { { 0x1013, 0x6001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4280 */ { 0x1013, 0x6003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4612 */ { 0x1013, 0x6004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4615 */ diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 894545ea41f..4851847180d 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2317,7 +2317,7 @@ static struct snd_kcontrol_new snd_cs46xx_front_dup_ctl = { #ifdef CONFIG_SND_CS46XX_NEW_DSP /* Only available on the Hercules Game Theater XP soundcard */ -static struct snd_kcontrol_new snd_hercules_controls[] __devinitdata = { +static struct snd_kcontrol_new snd_hercules_controls[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Optical/Coaxial SPDIF Input Switch", @@ -3458,6 +3458,9 @@ static void hercules_mixer_init (struct snd_cs46xx *chip) snd_printdd ("initializing Hercules mixer\n"); #ifdef CONFIG_SND_CS46XX_NEW_DSP + if (chip->in_suspend) + return; + for (idx = 0 ; idx < ARRAY_SIZE(snd_hercules_controls); idx++) { struct snd_kcontrol *kctl; @@ -3669,6 +3672,7 @@ int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state) int amp_saved; snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + chip->in_suspend = 1; snd_pcm_suspend_all(chip->pcm); // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); @@ -3722,6 +3726,7 @@ int snd_cs46xx_resume(struct pci_dev *pci) else chip->active_ctrl(chip, -1); /* disable CLKRUN */ chip->amplifier = amp_saved; + chip->in_suspend = 0; snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; } diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index c12b24c679f..64c7826e8b8 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c @@ -67,7 +67,7 @@ MODULE_PARM_DESC(id, "ID string for " DRIVER_NAME); module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME); -static struct pci_device_id snd_cs5535audio_ids[] __devinitdata = { +static struct pci_device_id snd_cs5535audio_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) }, {} diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 27a8dbe6f6a..c3dafa29054 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -236,9 +236,9 @@ static int pcm_open(struct snd_pcm_substream *substream, chip = snd_pcm_substream_chip(substream); runtime = substream->runtime; - if (!(pipe = kmalloc(sizeof(struct audiopipe), GFP_KERNEL))) + pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL); + if (!pipe) return -ENOMEM; - memset(pipe, 0, sizeof(struct audiopipe)); pipe->index = -1; /* Not configured yet */ /* Set up hw capabilities and contraints */ diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 549673ea14a..289bcd99c19 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c @@ -77,7 +77,7 @@ MODULE_PARM_DESC(subsystem, "Force card subsystem model."); /* * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 */ -static struct pci_device_id snd_emu10k1_ids[] __devinitdata = { +static struct pci_device_id snd_emu10k1_ids[] = { { 0x1102, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* EMU10K1 */ { 0x1102, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, /* Audigy */ { 0x1102, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, /* Audigy 2 Value SB0400 */ diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index d6f135fe295..79f24cdf5fb 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -531,7 +531,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); } -static int __devinit snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) +static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) { unsigned int hc_value; @@ -571,7 +571,7 @@ static int __devinit snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) return 0; } -static int __devinit snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) +static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) { unsigned long special_port; unsigned int value; @@ -633,7 +633,7 @@ static int snd_emu1212m_fpga_netlist_write(struct snd_emu10k1 * emu, int reg, in return 0; } -static int __devinit snd_emu10k1_emu1212m_init(struct snd_emu10k1 * emu) +static int snd_emu10k1_emu1212m_init(struct snd_emu10k1 * emu) { unsigned int i; int tmp; @@ -936,6 +936,17 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0151_chip = 1, .spk71 = 1, .spdif_bug = 1} , + /* Dell OEM/Creative Labs Audigy 2 ZS */ + /* See ALSA bug#1365 */ + {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102, + .driver = "Audigy2", .name = "Audigy 2 ZS [SB0353]", + .id = "Audigy2", + .emu10k2_chip = 1, + .ca0102_chip = 1, + .ca0151_chip = 1, + .spk71 = 1, + .spdif_bug = 1, + .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, .driver = "Audigy2", .name = "Audigy 2 Platinum [SB0240P]", .id = "Audigy2", @@ -1430,6 +1441,10 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu) { if (emu->card_capabilities->ecard) snd_emu10k1_ecard_init(emu); + else if (emu->card_capabilities->ca_cardbus_chip) + snd_emu10k1_cardbus_init(emu); + else if (emu->card_capabilities->emu1212m) + snd_emu10k1_emu1212m_init(emu); else snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); snd_emu10k1_init(emu, emu->enable_ir, 1); diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 2167279429b..bda8bdf5993 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -1286,7 +1286,7 @@ static void snd_emu10k1x_midi_interrupt(struct emu10k1x *emu, unsigned int statu do_emu10k1x_midi_interrupt(emu, &emu->midi, status); } -static void snd_emu10k1x_midi_cmd(struct emu10k1x * emu, +static int snd_emu10k1x_midi_cmd(struct emu10k1x * emu, struct emu10k1x_midi *midi, unsigned char cmd, int ack) { unsigned long flags; @@ -1312,11 +1312,14 @@ static void snd_emu10k1x_midi_cmd(struct emu10k1x * emu, ok = 1; } spin_unlock_irqrestore(&midi->input_lock, flags); - if (!ok) + if (!ok) { snd_printk(KERN_ERR "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n", cmd, emu->port, mpu401_read_stat(emu, midi), mpu401_read_data(emu, midi)); + return 1; + } + return 0; } static int snd_emu10k1x_midi_input_open(struct snd_rawmidi_substream *substream) @@ -1332,12 +1335,17 @@ static int snd_emu10k1x_midi_input_open(struct snd_rawmidi_substream *substream) midi->substream_input = substream; if (!(midi->midi_mode & EMU10K1X_MIDI_MODE_OUTPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 1); - snd_emu10k1x_midi_cmd(emu, midi, MPU401_ENTER_UART, 1); + if (snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 1)) + goto error_out; + if (snd_emu10k1x_midi_cmd(emu, midi, MPU401_ENTER_UART, 1)) + goto error_out; } else { spin_unlock_irqrestore(&midi->open_lock, flags); } return 0; + +error_out: + return -EIO; } static int snd_emu10k1x_midi_output_open(struct snd_rawmidi_substream *substream) @@ -1353,12 +1361,17 @@ static int snd_emu10k1x_midi_output_open(struct snd_rawmidi_substream *substream midi->substream_output = substream; if (!(midi->midi_mode & EMU10K1X_MIDI_MODE_INPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 1); - snd_emu10k1x_midi_cmd(emu, midi, MPU401_ENTER_UART, 1); + if (snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 1)) + goto error_out; + if (snd_emu10k1x_midi_cmd(emu, midi, MPU401_ENTER_UART, 1)) + goto error_out; } else { spin_unlock_irqrestore(&midi->open_lock, flags); } return 0; + +error_out: + return -EIO; } static int snd_emu10k1x_midi_input_close(struct snd_rawmidi_substream *substream) @@ -1366,6 +1379,7 @@ static int snd_emu10k1x_midi_input_close(struct snd_rawmidi_substream *substream struct emu10k1x *emu; struct emu10k1x_midi *midi = substream->rmidi->private_data; unsigned long flags; + int err = 0; emu = midi->emu; snd_assert(emu, return -ENXIO); @@ -1375,11 +1389,11 @@ static int snd_emu10k1x_midi_input_close(struct snd_rawmidi_substream *substream midi->substream_input = NULL; if (!(midi->midi_mode & EMU10K1X_MIDI_MODE_OUTPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 0); + err = snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 0); } else { spin_unlock_irqrestore(&midi->open_lock, flags); } - return 0; + return err; } static int snd_emu10k1x_midi_output_close(struct snd_rawmidi_substream *substream) @@ -1387,6 +1401,7 @@ static int snd_emu10k1x_midi_output_close(struct snd_rawmidi_substream *substrea struct emu10k1x *emu; struct emu10k1x_midi *midi = substream->rmidi->private_data; unsigned long flags; + int err = 0; emu = midi->emu; snd_assert(emu, return -ENXIO); @@ -1396,11 +1411,11 @@ static int snd_emu10k1x_midi_output_close(struct snd_rawmidi_substream *substrea midi->substream_output = NULL; if (!(midi->midi_mode & EMU10K1X_MIDI_MODE_INPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 0); + err = snd_emu10k1x_midi_cmd(emu, midi, MPU401_RESET, 0); } else { spin_unlock_irqrestore(&midi->open_lock, flags); } - return 0; + return err; } static void snd_emu10k1x_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) @@ -1594,7 +1609,7 @@ static void __devexit snd_emu10k1x_remove(struct pci_dev *pci) } // PCI IDs -static struct pci_device_id snd_emu10k1x_ids[] __devinitdata = { +static struct pci_device_id snd_emu10k1x_ids[] = { { 0x1102, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Dell OEM version (EMU10K1) */ { 0, } }; diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c index d96eb455103..950c6bcd6b7 100644 --- a/sound/pci/emu10k1/emumpu401.c +++ b/sound/pci/emu10k1/emumpu401.c @@ -116,7 +116,7 @@ static void snd_emu10k1_midi_interrupt2(struct snd_emu10k1 *emu, unsigned int st do_emu10k1_midi_interrupt(emu, &emu->midi2, status); } -static void snd_emu10k1_midi_cmd(struct snd_emu10k1 * emu, struct snd_emu10k1_midi *midi, unsigned char cmd, int ack) +static int snd_emu10k1_midi_cmd(struct snd_emu10k1 * emu, struct snd_emu10k1_midi *midi, unsigned char cmd, int ack) { unsigned long flags; int timeout, ok; @@ -141,11 +141,14 @@ static void snd_emu10k1_midi_cmd(struct snd_emu10k1 * emu, struct snd_emu10k1_mi ok = 1; } spin_unlock_irqrestore(&midi->input_lock, flags); - if (!ok) + if (!ok) { snd_printk(KERN_ERR "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n", cmd, emu->port, mpu401_read_stat(emu, midi), mpu401_read_data(emu, midi)); + return 1; + } + return 0; } static int snd_emu10k1_midi_input_open(struct snd_rawmidi_substream *substream) @@ -161,12 +164,17 @@ static int snd_emu10k1_midi_input_open(struct snd_rawmidi_substream *substream) midi->substream_input = substream; if (!(midi->midi_mode & EMU10K1_MIDI_MODE_OUTPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 1); - snd_emu10k1_midi_cmd(emu, midi, MPU401_ENTER_UART, 1); + if (snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 1)) + goto error_out; + if (snd_emu10k1_midi_cmd(emu, midi, MPU401_ENTER_UART, 1)) + goto error_out; } else { spin_unlock_irqrestore(&midi->open_lock, flags); } return 0; + +error_out: + return -EIO; } static int snd_emu10k1_midi_output_open(struct snd_rawmidi_substream *substream) @@ -182,12 +190,17 @@ static int snd_emu10k1_midi_output_open(struct snd_rawmidi_substream *substream) midi->substream_output = substream; if (!(midi->midi_mode & EMU10K1_MIDI_MODE_INPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 1); - snd_emu10k1_midi_cmd(emu, midi, MPU401_ENTER_UART, 1); + if (snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 1)) + goto error_out; + if (snd_emu10k1_midi_cmd(emu, midi, MPU401_ENTER_UART, 1)) + goto error_out; } else { spin_unlock_irqrestore(&midi->open_lock, flags); } return 0; + +error_out: + return -EIO; } static int snd_emu10k1_midi_input_close(struct snd_rawmidi_substream *substream) @@ -195,6 +208,7 @@ static int snd_emu10k1_midi_input_close(struct snd_rawmidi_substream *substream) struct snd_emu10k1 *emu; struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; unsigned long flags; + int err = 0; emu = midi->emu; snd_assert(emu, return -ENXIO); @@ -204,11 +218,11 @@ static int snd_emu10k1_midi_input_close(struct snd_rawmidi_substream *substream) midi->substream_input = NULL; if (!(midi->midi_mode & EMU10K1_MIDI_MODE_OUTPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 0); + err = snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 0); } else { spin_unlock_irqrestore(&midi->open_lock, flags); } - return 0; + return err; } static int snd_emu10k1_midi_output_close(struct snd_rawmidi_substream *substream) @@ -216,6 +230,7 @@ static int snd_emu10k1_midi_output_close(struct snd_rawmidi_substream *substream struct snd_emu10k1 *emu; struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; unsigned long flags; + int err = 0; emu = midi->emu; snd_assert(emu, return -ENXIO); @@ -225,11 +240,11 @@ static int snd_emu10k1_midi_output_close(struct snd_rawmidi_substream *substream midi->substream_output = NULL; if (!(midi->midi_mode & EMU10K1_MIDI_MODE_INPUT)) { spin_unlock_irqrestore(&midi->open_lock, flags); - snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 0); + err = snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 0); } else { spin_unlock_irqrestore(&midi->open_lock, flags); } - return 0; + return err; } static void snd_emu10k1_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) diff --git a/sound/pci/emu10k1/irq.c b/sound/pci/emu10k1/irq.c index a8b31286b6d..1076af4c366 100644 --- a/sound/pci/emu10k1/irq.c +++ b/sound/pci/emu10k1/irq.c @@ -37,9 +37,13 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs) int handled = 0; while ((status = inl(emu->port + IPR)) != 0) { - //printk("emu10k1 irq - status = 0x%x\n", status); + //snd_printk(KERN_INFO "emu10k1 irq - status = 0x%x\n", status); orig_status = status; handled = 1; + if ((status & 0xffffffff) == 0xffffffff) { + snd_printk(KERN_INFO "snd-emu10k1: Suspected sound card removal\n"); + break; + } if (status & IPR_PCIERROR) { snd_printk(KERN_ERR "interrupt: PCI error\n"); snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE); diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 7a985c86800..a8a601fc781 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -446,7 +446,7 @@ struct ensoniq { static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static struct pci_device_id snd_audiopci_ids[] __devinitdata = { +static struct pci_device_id snd_audiopci_ids[] = { #ifdef CHIP1370 { 0x1274, 0x5000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* ES1370 */ #endif diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 1113b10259c..cc0f34f6818 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -242,7 +242,7 @@ struct es1938 { static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static struct pci_device_id snd_es1938_ids[] __devinitdata = { +static struct pci_device_id snd_es1938_ids[] = { { 0x125d, 0x1969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Solo-1 */ { 0, } }; diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index a491c8f8a6a..3c5ab7c2e72 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -592,7 +592,7 @@ struct es1968 { static irqreturn_t snd_es1968_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static struct pci_device_id snd_es1968_ids[] __devinitdata = { +static struct pci_device_id snd_es1968_ids[] = { /* Maestro 1 */ { 0x1285, 0x0100, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, TYPE_MAESTRO }, /* Maestro 2 */ diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 3aed27eace2..13868c98512 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -35,7 +35,7 @@ #include <asm/io.h> -#if (defined(CONFIG_SND_FM801_TEA575X) || defined(CONFIG_SND_FM801_TEA575X_MODULE)) && (defined(CONFIG_VIDEO_DEV) || defined(CONFIG_VIDEO_DEV_MODULE)) +#ifdef CONFIG_SND_FM801_TEA575X_BOOL #include <sound/tea575x-tuner.h> #define TEA575X_RADIO 1 #endif @@ -199,7 +199,7 @@ struct fm801 { #endif }; -static struct pci_device_id snd_fm801_ids[] __devinitdata = { +static struct pci_device_id snd_fm801_ids[] = { { 0x1319, 0x0801, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0, }, /* FM801 */ { 0x5213, 0x0510, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0, }, /* Gallant Odyssey Sound 4 */ { 0, } diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 025af7c0c6e..79d63c99f09 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1629,7 +1629,7 @@ static void __devexit azx_remove(struct pci_dev *pci) } /* PCI IDs */ -static struct pci_device_id azx_ids[] __devinitdata = { +static struct pci_device_id azx_ids[] = { { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */ { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */ { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */ diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 33b7d580646..6823f2bc10b 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -1545,6 +1545,9 @@ enum { /* reivision id to check workarounds */ #define AD1988A_REV2 0x100200 +#define is_rev2(codec) \ + ((codec)->vendor_id == 0x11d41988 && \ + (codec)->revision_id == AD1988A_REV2) /* * mixers @@ -1636,6 +1639,7 @@ static struct snd_kcontrol_new ad1988_6stack_mixers1[] = { HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Side Playback Volume", 0x0a, 0x0, HDA_OUTPUT), + { } /* end */ }; static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = { @@ -1644,6 +1648,7 @@ static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = { HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0a, 2, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Side Playback Volume", 0x06, 0x0, HDA_OUTPUT), + { } /* end */ }; static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { @@ -1682,6 +1687,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers1[] = { HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT), + { } /* end */ }; static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = { @@ -1689,6 +1695,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = { HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x06, 2, 0x0, HDA_OUTPUT), + { } /* end */ }; static struct snd_kcontrol_new ad1988_3stack_mixers2[] = { @@ -2195,7 +2202,7 @@ static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx) /* A B C D E F G H */ 0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06 }; - if (codec->revision_id == AD1988A_REV2) + if (is_rev2(codec)) return idx_to_dac_rev2[idx]; else return idx_to_dac[idx]; @@ -2564,7 +2571,7 @@ static int patch_ad1988(struct hda_codec *codec) mutex_init(&spec->amp_mutex); codec->spec = spec; - if (codec->revision_id == AD1988A_REV2) + if (is_rev2(codec)) snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); board_config = snd_hda_check_board_config(codec, ad1988_cfg_tbl); @@ -2590,13 +2597,13 @@ static int patch_ad1988(struct hda_codec *codec) case AD1988_6STACK_DIG: spec->multiout.max_channels = 8; spec->multiout.num_dacs = 4; - if (codec->revision_id == AD1988A_REV2) + if (is_rev2(codec)) spec->multiout.dac_nids = ad1988_6stack_dac_nids_rev2; else spec->multiout.dac_nids = ad1988_6stack_dac_nids; spec->input_mux = &ad1988_6stack_capture_source; spec->num_mixers = 2; - if (codec->revision_id == AD1988A_REV2) + if (is_rev2(codec)) spec->mixers[0] = ad1988_6stack_mixers1_rev2; else spec->mixers[0] = ad1988_6stack_mixers1; @@ -2612,7 +2619,7 @@ static int patch_ad1988(struct hda_codec *codec) case AD1988_3STACK_DIG: spec->multiout.max_channels = 6; spec->multiout.num_dacs = 3; - if (codec->revision_id == AD1988A_REV2) + if (is_rev2(codec)) spec->multiout.dac_nids = ad1988_3stack_dac_nids_rev2; else spec->multiout.dac_nids = ad1988_3stack_dac_nids; @@ -2620,7 +2627,7 @@ static int patch_ad1988(struct hda_codec *codec) spec->channel_mode = ad1988_3stack_modes; spec->num_channel_mode = ARRAY_SIZE(ad1988_3stack_modes); spec->num_mixers = 2; - if (codec->revision_id == AD1988A_REV2) + if (is_rev2(codec)) spec->mixers[0] = ad1988_3stack_mixers1_rev2; else spec->mixers[0] = ad1988_3stack_mixers1; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index fb4bed0759d..ea99083a102 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -351,6 +351,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { [STAC_REF] = ref922x_pin_configs, [STAC_D945GTP3] = d945gtp3_pin_configs, [STAC_D945GTP5] = d945gtp5_pin_configs, + [STAC_MACMINI] = d945gtp5_pin_configs, [STAC_D965_2112] = d965_2112_pin_configs, }; diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index ca74f5b85f4..9492f3d2455 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -2131,7 +2131,7 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { .build_controls = aureon_add_controls, .eeprom_size = sizeof(aureon71_eeprom), .eeprom_data = aureon71_eeprom, - .driver = "Aureon71Universe", + .driver = "Aureon71Univ", /* keep in 15 letters */ }, { .subvendor = VT1724_SUBDEVICE_PRODIGY71, diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 89a06dec436..bf20858d9f1 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -106,7 +106,7 @@ module_param_array(dxr_enable, int, NULL, 0444); MODULE_PARM_DESC(dxr_enable, "Enable DXR support for Terratec DMX6FIRE."); -static struct pci_device_id snd_ice1712_ids[] __devinitdata = { +static struct pci_device_id snd_ice1712_ids[] = { { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ { 0, } }; diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index ad69ed7c1b8..71d6aedc074 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -86,7 +86,7 @@ MODULE_PARM_DESC(model, "Use the given board model."); /* Both VT1720 and VT1724 have the same PCI IDs */ -static struct pci_device_id snd_vt1724_ids[] __devinitdata = { +static struct pci_device_id snd_vt1724_ids[] = { { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_VT1724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { 0, } }; diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5634bc34925..6874263f168 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -413,7 +413,7 @@ struct intel8x0 { u32 int_sta_mask; /* interrupt status mask */ }; -static struct pci_device_id snd_intel8x0_ids[] __devinitdata = { +static struct pci_device_id snd_intel8x0_ids[] = { { 0x8086, 0x2415, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801AA */ { 0x8086, 0x2425, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82901AB */ { 0x8086, 0x2445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */ @@ -1956,6 +1956,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .type = AC97_TUNE_HP_ONLY }, { + .subvendor = 0x10f1, + .subdevice = 0x2895, + .name = "Tyan Thunder K8WE", + .type = AC97_TUNE_HP_ONLY + }, + { .subvendor = 0x110a, .subdevice = 0x0056, .name = "Fujitsu-Siemens Scenic", /* AD1981? */ diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index f28e273ae27..91850281f89 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -224,7 +224,7 @@ struct intel8x0m { unsigned int pcm_pos_shift; }; -static struct pci_device_id snd_intel8x0m_ids[] __devinitdata = { +static struct pci_device_id snd_intel8x0m_ids[] = { { 0x8086, 0x2416, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801AA */ { 0x8086, 0x2426, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82901AB */ { 0x8086, 0x2446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */ diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 2b4ce002794..cfea51f4478 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -424,7 +424,7 @@ module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable Korg 1212 soundcard."); MODULE_AUTHOR("Haroldo Gamal <gamal@alternex.com.br>"); -static struct pci_device_id snd_korg1212_ids[] __devinitdata = { +static struct pci_device_id snd_korg1212_ids[] = { { .vendor = 0x10b5, .device = 0x906d, diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 828eab59253..45214b3b81b 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -869,7 +869,7 @@ struct snd_m3 { /* * pci ids */ -static struct pci_device_id snd_m3_ids[] __devinitdata = { +static struct pci_device_id snd_m3_ids[] = { {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO, PCI_ANY_ID, PCI_ANY_ID, @@ -2137,7 +2137,7 @@ static int __devinit snd_m3_mixer(struct snd_m3 *chip) * DSP Code images */ -static const u16 assp_kernel_image[] __devinitdata = { +static const u16 assp_kernel_image[] = { 0x7980, 0x0030, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x00FB, 0x7980, 0x00DD, 0x7980, 0x03B4, 0x7980, 0x0332, 0x7980, 0x0287, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x031A, 0x7980, 0x03B4, 0x7980, 0x022F, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, @@ -2224,7 +2224,7 @@ static const u16 assp_kernel_image[] __devinitdata = { * Mini sample rate converter code image * that is to be loaded at 0x400 on the DSP. */ -static const u16 assp_minisrc_image[] __devinitdata = { +static const u16 assp_minisrc_image[] = { 0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0412, 0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0403, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41, @@ -2267,12 +2267,12 @@ static const u16 assp_minisrc_image[] __devinitdata = { */ #define MINISRC_LPF_LEN 10 -static const u16 minisrc_lpf[MINISRC_LPF_LEN] __devinitdata = { +static const u16 minisrc_lpf[MINISRC_LPF_LEN] = { 0X0743, 0X1104, 0X0A4C, 0XF88D, 0X242C, 0X1023, 0X1AA9, 0X0B60, 0XEFDD, 0X186F }; -static void __devinit snd_m3_assp_init(struct snd_m3 *chip) +static void snd_m3_assp_init(struct snd_m3 *chip) { unsigned int i; diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index a4aaa7b9a23..cc43ecd6790 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -61,7 +61,7 @@ MODULE_PARM_DESC(enable, "Enable Digigram " CARD_NAME " soundcard."); /* */ -static struct pci_device_id snd_mixart_ids[] __devinitdata = { +static struct pci_device_id snd_mixart_ids[] = { { 0x1057, 0x0003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* MC8240 */ { 0, } }; diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 56d7282e665..101eee0aa01 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -263,7 +263,7 @@ struct nm256 { /* * PCI ids */ -static struct pci_device_id snd_nm256_ids[] __devinitdata = { +static struct pci_device_id snd_nm256_ids[] = { {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index ae980e11827..533c672ae8f 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -73,7 +73,7 @@ enum { PCI_ID_LAST }; -static struct pci_device_id pcxhr_ids[] __devinitdata = { +static struct pci_device_id pcxhr_ids[] = { { 0x10b5, 0x9656, 0x1369, 0xb001, 0, 0, PCI_ID_VX882HR, }, /* VX882HR */ { 0x10b5, 0x9656, 0x1369, 0xb101, 0, 0, PCI_ID_PCX882HR, }, /* PCX882HR */ { 0x10b5, 0x9656, 0x1369, 0xb201, 0, 0, PCI_ID_VX881HR, }, /* VX881HR */ diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 5501a08ca23..f435fcd6dca 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -506,7 +506,7 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip); /* */ -static struct pci_device_id snd_riptide_ids[] __devinitdata = { +static struct pci_device_id snd_riptide_ids[] = { { .vendor = 0x127a,.device = 0x4310, .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 2e24b68d07a..2a71499242f 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -227,7 +227,7 @@ struct rme32 { struct snd_kcontrol *spdif_ctl; }; -static struct pci_device_id snd_rme32_ids[] __devinitdata = { +static struct pci_device_id snd_rme32_ids[] = { {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_8, diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index fde0f3e2053..f8de7c99701 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -232,7 +232,7 @@ struct rme96 { struct snd_kcontrol *spdif_ctl; }; -static struct pci_device_id snd_rme96_ids[] __devinitdata = { +static struct pci_device_id snd_rme96_ids[] = { { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8, diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 99cf86244ac..e5a52da77b8 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -568,7 +568,7 @@ static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_d } -static struct pci_device_id snd_hdsp_ids[] __devinitdata = { +static struct pci_device_id snd_hdsp_ids[] = { { .vendor = PCI_VENDOR_ID_XILINX, .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, @@ -1356,7 +1356,7 @@ static struct snd_rawmidi_ops snd_hdsp_midi_input = .trigger = snd_hdsp_midi_input_trigger, }; -static int __devinit snd_hdsp_create_midi (struct snd_card *card, struct hdsp *hdsp, int id) +static int snd_hdsp_create_midi (struct snd_card *card, struct hdsp *hdsp, int id) { char buf[32]; diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 9534e183413..fc15f61ad5d 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -315,7 +315,7 @@ static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_d } -static struct pci_device_id snd_rme9652_ids[] __devinitdata = { +static struct pci_device_id snd_rme9652_ids[] = { { .vendor = 0x10ee, .device = 0x3fc4, diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index c4303418668..e5d4def1aa6 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -243,7 +243,7 @@ struct sonicvibes { #endif }; -static struct pci_device_id snd_sonic_ids[] __devinitdata = { +static struct pci_device_id snd_sonic_ids[] = { { 0x5333, 0xca00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, { 0, } }; diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 5629b7eba96..9145f7c57fb 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c @@ -63,7 +63,7 @@ MODULE_PARM_DESC(pcm_channels, "Number of hardware channels assigned for PCM."); module_param_array(wavetable_size, int, NULL, 0444); MODULE_PARM_DESC(wavetable_size, "Maximum memory size in kB for wavetable synth."); -static struct pci_device_id snd_trident_ids[] __devinitdata = { +static struct pci_device_id snd_trident_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_TRIDENT, PCI_DEVICE_ID_TRIDENT_4DWAVE_DX), PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, {PCI_DEVICE(PCI_VENDOR_ID_TRIDENT, PCI_DEVICE_ID_TRIDENT_4DWAVE_NX), diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 37bd5eb7a38..08da9234efb 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -396,7 +396,7 @@ struct via82xx { #endif }; -static struct pci_device_id snd_via82xx_ids[] __devinitdata = { +static struct pci_device_id snd_via82xx_ids[] = { /* 0x1106, 0x3058 */ { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA686, }, /* 686A */ /* 0x1106, 0x3059 */ diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index c1ede6c2a6d..016f9dac253 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -261,7 +261,7 @@ struct via82xx_modem { struct snd_info_entry *proc_entry; }; -static struct pci_device_id snd_via82xx_modem_ids[] __devinitdata = { +static struct pci_device_id snd_via82xx_modem_ids[] = { { 0x1106, 0x3068, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA82XX_MODEM, }, { 0, } }; diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index 7deda25f7ad..9c03c6b4e49 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c @@ -60,7 +60,7 @@ enum { VX_PCI_VX222_NEW }; -static struct pci_device_id snd_vx222_ids[] __devinitdata = { +static struct pci_device_id snd_vx222_ids[] = { { 0x10b5, 0x9050, 0x1369, PCI_ANY_ID, 0, 0, VX_PCI_VX222_OLD, }, /* PLX */ { 0x10b5, 0x9030, 0x1369, PCI_ANY_ID, 0, 0, VX_PCI_VX222_NEW, }, /* PLX */ { 0, } diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 26aa775b7b6..186453f7abe 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c @@ -70,7 +70,7 @@ MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch"); module_param_array(rear_swap, bool, NULL, 0444); MODULE_PARM_DESC(rear_swap, "Swap rear channels (must be enabled for correct IEC958 (S/PDIF)) output"); -static struct pci_device_id snd_ymfpci_ids[] __devinitdata = { +static struct pci_device_id snd_ymfpci_ids[] = { { 0x1073, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724 */ { 0x1073, 0x000d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724F */ { 0x1073, 0x000a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF740 */ diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index adfdce7499d..1c09e5f49da 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -241,12 +241,13 @@ static int pdacf_config(struct pcmcia_device *link) CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse)); link->conf.ConfigBase = parse->config.base; link->conf.ConfigIndex = 0x5; - kfree(parse); CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); + kfree(parse); + if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) goto failed; @@ -254,6 +255,7 @@ static int pdacf_config(struct pcmcia_device *link) return 0; cs_failed: + kfree(parse); cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 82d791be749..05dabe45465 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -801,11 +801,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip) chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; #ifdef PMAC_AMP_AVAIL if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { - struct awacs_amp *amp = kmalloc(sizeof(*amp), GFP_KERNEL); + struct awacs_amp *amp = kzalloc(sizeof(*amp), GFP_KERNEL); if (! amp) return -ENOMEM; chip->mixer_data = amp; - memset(amp, 0, sizeof(*amp)); chip->mixer_free = awacs_amp_free; awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ awacs_amp_set_vol(amp, 1, 63, 63, 0); diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index 46eebf5610e..57202b0f033 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c @@ -258,10 +258,9 @@ int __init snd_pmac_daca_init(struct snd_pmac *chip) request_module("i2c-powermac"); #endif /* CONFIG_KMOD */ - mix = kmalloc(sizeof(*mix), GFP_KERNEL); + mix = kzalloc(sizeof(*mix), GFP_KERNEL); if (! mix) return -ENOMEM; - memset(mix, 0, sizeof(*mix)); chip->mixer_data = mix; chip->mixer_free = daca_cleanup; mix->amp_on = 1; /* default on */ diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index fb05938dcbd..59482a4cd44 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -64,11 +64,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) if (strncmp(i2c_device_name(adapter), "mac-io", 6)) return 0; /* ignored */ - new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (! new_client) return -ENOMEM; - memset(new_client, 0, sizeof(*new_client)); new_client->addr = keywest_ctx->addr; i2c_set_clientdata(new_client, keywest_ctx); new_client->adapter = adapter; diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index fa9a44ab487..2264574fa06 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -181,21 +181,14 @@ static int __init alsa_card_pmac_init(void) if ((err = platform_driver_register(&snd_pmac_driver)) < 0) return err; device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0); - if (!IS_ERR(device)) { - if (platform_get_drvdata(device)) - return 0; - platform_device_unregister(device); - err = -ENODEV; - } else - err = PTR_ERR(device); - platform_driver_unregister(&snd_pmac_driver); - return err; + return 0; } static void __exit alsa_card_pmac_exit(void) { - platform_device_unregister(device); + if (!IS_ERR(device)) + platform_device_unregister(device); platform_driver_unregister(&snd_pmac_driver); } diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 692c6117767..84f6b19c07c 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -1316,10 +1316,9 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) request_module("i2c-powermac"); #endif /* CONFIG_KMOD */ - mix = kmalloc(sizeof(*mix), GFP_KERNEL); + mix = kzalloc(sizeof(*mix), GFP_KERNEL); if (! mix) return -ENOMEM; - memset(mix, 0, sizeof(*mix)); mix->headphone_irq = -1; chip->mixer_data = mix; diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index d32d83d970c..1b7f499c549 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -2260,10 +2260,9 @@ static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct aud } /* create a new pcm */ - as = kmalloc(sizeof(*as), GFP_KERNEL); + as = kzalloc(sizeof(*as), GFP_KERNEL); if (! as) return -ENOMEM; - memset(as, 0, sizeof(*as)); as->pcm_index = chip->pcm_devs; as->chip = chip; as->fmt_type = fp->fmt_type; @@ -2633,13 +2632,12 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) csep = NULL; } - fp = kmalloc(sizeof(*fp), GFP_KERNEL); + fp = kzalloc(sizeof(*fp), GFP_KERNEL); if (! fp) { snd_printk(KERN_ERR "cannot malloc\n"); return -ENOMEM; } - memset(fp, 0, sizeof(*fp)); fp->iface = iface_no; fp->altsetting = altno; fp->altset_idx = i; |