diff options
Diffstat (limited to 'sound/ppc')
-rw-r--r-- | sound/ppc/Kconfig | 1 | ||||
-rw-r--r-- | sound/ppc/awacs.c | 175 | ||||
-rw-r--r-- | sound/ppc/beep.c | 34 | ||||
-rw-r--r-- | sound/ppc/burgundy.c | 75 | ||||
-rw-r--r-- | sound/ppc/daca.c | 72 | ||||
-rw-r--r-- | sound/ppc/keywest.c | 6 | ||||
-rw-r--r-- | sound/ppc/pmac.c | 271 | ||||
-rw-r--r-- | sound/ppc/pmac.h | 98 | ||||
-rw-r--r-- | sound/ppc/powermac.c | 71 | ||||
-rw-r--r-- | sound/ppc/toonie.c | 32 | ||||
-rw-r--r-- | sound/ppc/tumbler.c | 244 |
11 files changed, 557 insertions, 522 deletions
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig index 206b933..a3fb149 100644 --- a/sound/ppc/Kconfig +++ b/sound/ppc/Kconfig @@ -13,7 +13,6 @@ config SND_POWERMAC tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" depends on SND && I2C && INPUT && PPC_PMAC select SND_PCM - select SND_GENERIC_DRIVER help Say Y here to include support for the integrated sound device. diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 758ca1b..82d791b 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -35,18 +35,18 @@ #endif #ifdef PMAC_AMP_AVAIL -typedef struct awacs_amp { +struct awacs_amp { unsigned char amp_master; unsigned char amp_vol[2][2]; unsigned char amp_tone[2]; -} awacs_amp_t; +}; #define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA) #endif /* PMAC_AMP_AVAIL */ -static void snd_pmac_screamer_wait(pmac_t *chip) +static void snd_pmac_screamer_wait(struct snd_pmac *chip) { long timeout = 2000; while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) { @@ -62,7 +62,7 @@ static void snd_pmac_screamer_wait(pmac_t *chip) * write AWACS register */ static void -snd_pmac_awacs_write(pmac_t *chip, int val) +snd_pmac_awacs_write(struct snd_pmac *chip, int val) { long timeout = 5000000; @@ -78,21 +78,21 @@ snd_pmac_awacs_write(pmac_t *chip, int val) } static void -snd_pmac_awacs_write_reg(pmac_t *chip, int reg, int val) +snd_pmac_awacs_write_reg(struct snd_pmac *chip, int reg, int val) { snd_pmac_awacs_write(chip, val | (reg << 12)); chip->awacs_reg[reg] = val; } static void -snd_pmac_awacs_write_noreg(pmac_t *chip, int reg, int val) +snd_pmac_awacs_write_noreg(struct snd_pmac *chip, int reg, int val) { snd_pmac_awacs_write(chip, val | (reg << 12)); } #ifdef CONFIG_PM /* Recalibrate chip */ -static void screamer_recalibrate(pmac_t *chip) +static void screamer_recalibrate(struct snd_pmac *chip) { if (chip->model != PMAC_SCREAMER) return; @@ -105,7 +105,8 @@ static void screamer_recalibrate(pmac_t *chip) /* delay for broken crystal part */ msleep(750); snd_pmac_awacs_write_noreg(chip, 1, - chip->awacs_reg[1] | MASK_RECALIBRATE | MASK_CMUTE | MASK_AMUTE); + chip->awacs_reg[1] | MASK_RECALIBRATE | + MASK_CMUTE | MASK_AMUTE); snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); snd_pmac_awacs_write_noreg(chip, 6, chip->awacs_reg[6]); } @@ -118,7 +119,7 @@ static void screamer_recalibrate(pmac_t *chip) /* * additional callback to set the pcm format */ -static void snd_pmac_awacs_set_format(pmac_t *chip) +static void snd_pmac_awacs_set_format(struct snd_pmac *chip) { chip->awacs_reg[1] &= ~MASK_SAMPLERATE; chip->awacs_reg[1] |= chip->rate_index << 3; @@ -132,7 +133,8 @@ static void snd_pmac_awacs_set_format(pmac_t *chip) /* * volumes: 0-15 stereo */ -static int snd_pmac_awacs_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_awacs_info_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -141,9 +143,10 @@ static int snd_pmac_awacs_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf return 0; } -static int snd_pmac_awacs_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_get_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int reg = kcontrol->private_value & 0xff; int lshift = (kcontrol->private_value >> 8) & 0xff; int inverted = (kcontrol->private_value >> 16) & 1; @@ -163,9 +166,10 @@ static int snd_pmac_awacs_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu return 0; } -static int snd_pmac_awacs_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_put_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int reg = kcontrol->private_value & 0xff; int lshift = (kcontrol->private_value >> 8) & 0xff; int inverted = (kcontrol->private_value >> 16) & 1; @@ -203,9 +207,10 @@ static int snd_pmac_awacs_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu /* * mute master/ogain for AWACS: mono */ -static int snd_pmac_awacs_get_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_get_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; int invert = (kcontrol->private_value >> 16) & 1; @@ -221,9 +226,10 @@ static int snd_pmac_awacs_get_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu return 0; } -static int snd_pmac_awacs_put_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_put_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; int invert = (kcontrol->private_value >> 16) & 1; @@ -268,7 +274,7 @@ static void awacs_set_cuda(int reg, int val) /* * level = 0 - 14, 7 = 0 dB */ -static void awacs_amp_set_tone(awacs_amp_t *amp, int bass, int treble) +static void awacs_amp_set_tone(struct awacs_amp *amp, int bass, int treble) { amp->amp_tone[0] = bass; amp->amp_tone[1] = treble; @@ -282,7 +288,8 @@ static void awacs_amp_set_tone(awacs_amp_t *amp, int bass, int treble) /* * vol = 0 - 31 (attenuation), 32 = mute bit, stereo */ -static int awacs_amp_set_vol(awacs_amp_t *amp, int index, int lvol, int rvol, int do_check) +static int awacs_amp_set_vol(struct awacs_amp *amp, int index, int lvol, int rvol, + int do_check) { if (do_check && amp->amp_vol[index][0] == lvol && amp->amp_vol[index][1] == rvol) @@ -297,7 +304,7 @@ static int awacs_amp_set_vol(awacs_amp_t *amp, int index, int lvol, int rvol, in /* * 0 = -79 dB, 79 = 0 dB, 99 = +20 dB */ -static void awacs_amp_set_master(awacs_amp_t *amp, int vol) +static void awacs_amp_set_master(struct awacs_amp *amp, int vol) { amp->amp_master = vol; if (vol <= 79) @@ -307,9 +314,9 @@ static void awacs_amp_set_master(awacs_amp_t *amp, int vol) awacs_set_cuda(1, vol); } -static void awacs_amp_free(pmac_t *chip) +static void awacs_amp_free(struct snd_pmac *chip) { - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return); kfree(amp); chip->mixer_data = NULL; @@ -320,7 +327,8 @@ static void awacs_amp_free(pmac_t *chip) /* * mixer controls */ -static int snd_pmac_awacs_info_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_awacs_info_volume_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -329,11 +337,12 @@ static int snd_pmac_awacs_info_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem return 0; } -static int snd_pmac_awacs_get_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_get_volume_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL); ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31); @@ -341,12 +350,13 @@ static int snd_pmac_awacs_get_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ return 0; } -static int snd_pmac_awacs_put_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_put_volume_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; int vol[2]; - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL); @@ -355,11 +365,12 @@ static int snd_pmac_awacs_put_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); } -static int snd_pmac_awacs_get_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_get_switch_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL); ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) ? 0 : 1; @@ -367,12 +378,13 @@ static int snd_pmac_awacs_get_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ return 0; } -static int snd_pmac_awacs_put_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_put_switch_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; int vol[2]; - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL); @@ -381,7 +393,8 @@ static int snd_pmac_awacs_put_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); } -static int snd_pmac_awacs_info_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_awacs_info_tone_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -390,22 +403,24 @@ static int snd_pmac_awacs_info_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_i return 0; } -static int snd_pmac_awacs_get_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_get_tone_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL); ucontrol->value.integer.value[0] = amp->amp_tone[index]; return 0; } -static int snd_pmac_awacs_put_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_put_tone_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int index = kcontrol->private_value; - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL); if (ucontrol->value.integer.value[0] != amp->amp_tone[index]) { @@ -416,7 +431,8 @@ static int snd_pmac_awacs_put_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_va return 0; } -static int snd_pmac_awacs_info_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_awacs_info_master_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -425,19 +441,21 @@ static int snd_pmac_awacs_info_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem return 0; } -static int snd_pmac_awacs_get_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_get_master_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - awacs_amp_t *amp = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); ucontrol->value.integer.value[0] = amp->amp_master; return 0; } -static int snd_pmac_awacs_put_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - awacs_amp_t *amp = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct awacs_amp *amp = chip->mixer_data; snd_assert(amp, return -EINVAL); if (ucontrol->value.integer.value[0] != amp->amp_master) { amp->amp_master = ucontrol->value.integer.value[0]; @@ -450,7 +468,7 @@ static int snd_pmac_awacs_put_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ #define AMP_CH_SPK 0 #define AMP_CH_HD 1 -static snd_kcontrol_new_t snd_pmac_awacs_amp_vol[] __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __initdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PC Speaker Playback Volume", .info = snd_pmac_awacs_info_volume_amp, @@ -487,7 +505,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_vol[] __initdata = { }, }; -static snd_kcontrol_new_t snd_pmac_awacs_amp_hp_sw __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Headphone Playback Switch", .info = snd_pmac_boolean_stereo_info, @@ -496,7 +514,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_hp_sw __initdata = { .private_value = AMP_CH_HD, }; -static snd_kcontrol_new_t snd_pmac_awacs_amp_spk_sw __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PC Speaker Playback Switch", .info = snd_pmac_boolean_stereo_info, @@ -511,7 +529,8 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_spk_sw __initdata = { /* * mic boost for screamer */ -static int snd_pmac_screamer_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_screamer_mic_boost_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -520,9 +539,10 @@ static int snd_pmac_screamer_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_el return 0; } -static int snd_pmac_screamer_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_screamer_mic_boost_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int val; unsigned long flags; @@ -538,9 +558,10 @@ static int snd_pmac_screamer_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_ele return 0; } -static int snd_pmac_screamer_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_screamer_mic_boost_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int changed = 0; int val0, val6; unsigned long flags; @@ -568,7 +589,7 @@ static int snd_pmac_screamer_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_ele /* * lists of mixer elements */ -static snd_kcontrol_new_t snd_pmac_awacs_mixers[] __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_mixers[] __initdata = { AWACS_VOLUME("Master Playback Volume", 2, 6, 1), AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), AWACS_VOLUME("Capture Volume", 0, 4, 0), @@ -578,24 +599,24 @@ static snd_kcontrol_new_t snd_pmac_awacs_mixers[] __initdata = { /* FIXME: is this correct order? * screamer (powerbook G3 pismo) seems to have different bits... */ -static snd_kcontrol_new_t snd_pmac_awacs_mixers2[] __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] __initdata = { AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0), AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0), }; -static snd_kcontrol_new_t snd_pmac_screamer_mixers2[] __initdata = { +static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] __initdata = { AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), }; -static snd_kcontrol_new_t snd_pmac_awacs_master_sw __initdata = +static struct snd_kcontrol_new snd_pmac_awacs_master_sw __initdata = AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); -static snd_kcontrol_new_t snd_pmac_awacs_mic_boost[] __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] __initdata = { AWACS_SWITCH("Mic Boost", 0, SHIFT_GAINLINE, 0), }; -static snd_kcontrol_new_t snd_pmac_screamer_mic_boost[] __initdata = { +static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] __initdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Boost", .info = snd_pmac_screamer_mic_boost_info, @@ -604,17 +625,17 @@ static snd_kcontrol_new_t snd_pmac_screamer_mic_boost[] __initdata = { }, }; -static snd_kcontrol_new_t snd_pmac_awacs_speaker_vol[] __initdata = { +static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __initdata = { AWACS_VOLUME("PC Speaker Playback Volume", 4, 6, 1), }; -static snd_kcontrol_new_t snd_pmac_awacs_speaker_sw __initdata = +static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); /* * add new mixer elements to the card */ -static int build_mixers(pmac_t *chip, int nums, snd_kcontrol_new_t *mixers) +static int build_mixers(struct snd_pmac *chip, int nums, struct snd_kcontrol_new *mixers) { int i, err; @@ -629,7 +650,7 @@ static int build_mixers(pmac_t *chip, int nums, snd_kcontrol_new_t *mixers) /* * restore all registers */ -static void awacs_restore_all_regs(pmac_t *chip) +static void awacs_restore_all_regs(struct snd_pmac *chip) { snd_pmac_awacs_write_noreg(chip, 0, chip->awacs_reg[0]); snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); @@ -643,13 +664,13 @@ static void awacs_restore_all_regs(pmac_t *chip) } #ifdef CONFIG_PM -static void snd_pmac_awacs_suspend(pmac_t *chip) +static void snd_pmac_awacs_suspend(struct snd_pmac *chip) { snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1] | MASK_AMUTE | MASK_CMUTE)); } -static void snd_pmac_awacs_resume(pmac_t *chip) +static void snd_pmac_awacs_resume(struct snd_pmac *chip) { if (machine_is_compatible("PowerBook3,1") || machine_is_compatible("PowerBook3,2")) { @@ -668,7 +689,7 @@ static void snd_pmac_awacs_resume(pmac_t *chip) screamer_recalibrate(chip); #ifdef PMAC_AMP_AVAIL if (chip->mixer_data) { - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; awacs_amp_set_vol(amp, 0, amp->amp_vol[0][0], amp->amp_vol[0][1], 0); awacs_amp_set_vol(amp, 1, amp->amp_vol[1][0], amp->amp_vol[1][1], 0); awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]); @@ -682,13 +703,13 @@ static void snd_pmac_awacs_resume(pmac_t *chip) /* * auto-mute stuffs */ -static int snd_pmac_awacs_detect_headphone(pmac_t *chip) +static int snd_pmac_awacs_detect_headphone(struct snd_pmac *chip) { return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; } #ifdef PMAC_AMP_AVAIL -static int toggle_amp_mute(awacs_amp_t *amp, int index, int mute) +static int toggle_amp_mute(struct awacs_amp *amp, int index, int mute) { int vol[2]; vol[0] = amp->amp_vol[index][0] & 31; @@ -701,12 +722,12 @@ static int toggle_amp_mute(awacs_amp_t *amp, int index, int mute) } #endif -static void snd_pmac_awacs_update_automute(pmac_t *chip, int do_notify) +static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify) { if (chip->auto_mute) { #ifdef PMAC_AMP_AVAIL if (chip->mixer_data) { - awacs_amp_t *amp = chip->mixer_data; + struct awacs_amp *amp = chip->mixer_data; int changed; if (snd_pmac_awacs_detect_headphone(chip)) { changed = toggle_amp_mute(amp, AMP_CH_HD, 0); @@ -746,7 +767,7 @@ static void snd_pmac_awacs_update_automute(pmac_t *chip, int do_notify) * initialize chip */ int __init -snd_pmac_awacs_init(pmac_t *chip) +snd_pmac_awacs_init(struct snd_pmac *chip) { int err, vol; @@ -780,7 +801,7 @@ snd_pmac_awacs_init(pmac_t *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()) { - awacs_amp_t *amp = kmalloc(sizeof(*amp), GFP_KERNEL); + struct awacs_amp *amp = kmalloc(sizeof(*amp), GFP_KERNEL); if (! amp) return -ENOMEM; chip->mixer_data = amp; diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index d4ec6cc..5fec1e5 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c @@ -30,7 +30,7 @@ #include <sound/control.h> #include "pmac.h" -struct snd_pmac_beep { +struct pmac_beep { int running; /* boolean */ int volume; /* mixer volume: 0-100 */ int volume_play; /* currently playing volume */ @@ -44,9 +44,9 @@ struct snd_pmac_beep { /* * stop beep if running */ -void snd_pmac_beep_stop(pmac_t *chip) +void snd_pmac_beep_stop(struct snd_pmac *chip) { - pmac_beep_t *beep = chip->beep; + struct pmac_beep *beep = chip->beep; if (beep && beep->running) { beep->running = 0; snd_pmac_beep_dma_stop(chip); @@ -97,10 +97,11 @@ static short beep_wform[256] = { #define BEEP_BUFLEN 512 #define BEEP_VOLUME 15 /* 0 - 100 */ -static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigned int code, int hz) +static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, + unsigned int code, int hz) { - pmac_t *chip; - pmac_beep_t *beep; + struct snd_pmac *chip; + struct pmac_beep *beep; unsigned long flags; int beep_speed = 0; int srate; @@ -171,7 +172,8 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigne * beep volume mixer */ -static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_info_beep(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -180,17 +182,19 @@ static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin return 0; } -static int snd_pmac_get_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_get_beep(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); snd_assert(chip->beep, return -ENXIO); ucontrol->value.integer.value[0] = chip->beep->volume; return 0; } -static int snd_pmac_put_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int oval; snd_assert(chip->beep, return -ENXIO); oval = chip->beep->volume; @@ -198,7 +202,7 @@ static int snd_pmac_put_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return oval != chip->beep->volume; } -static snd_kcontrol_new_t snd_pmac_beep_mixer = { +static struct snd_kcontrol_new snd_pmac_beep_mixer = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Beep Playback Volume", .info = snd_pmac_info_beep, @@ -207,9 +211,9 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = { }; /* Initialize beep stuff */ -int __init snd_pmac_attach_beep(pmac_t *chip) +int __init snd_pmac_attach_beep(struct snd_pmac *chip) { - pmac_beep_t *beep; + struct pmac_beep *beep; struct input_dev *input_dev; void *dmabuf; int err = -ENOMEM; @@ -255,7 +259,7 @@ int __init snd_pmac_attach_beep(pmac_t *chip) return err; } -void snd_pmac_detach_beep(pmac_t *chip) +void snd_pmac_detach_beep(struct snd_pmac *chip) { if (chip->beep) { input_unregister_device(chip->beep->dev); diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index edbc048..e02263f 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c @@ -31,7 +31,7 @@ /* Waits for busy flag to clear */ static inline void -snd_pmac_burgundy_busy_wait(pmac_t *chip) +snd_pmac_burgundy_busy_wait(struct snd_pmac *chip) { int timeout = 50; while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) @@ -41,7 +41,7 @@ snd_pmac_burgundy_busy_wait(pmac_t *chip) } static inline void -snd_pmac_burgundy_extend_wait(pmac_t *chip) +snd_pmac_burgundy_extend_wait(struct snd_pmac *chip) { int timeout; timeout = 50; @@ -57,7 +57,7 @@ snd_pmac_burgundy_extend_wait(pmac_t *chip) } static void -snd_pmac_burgundy_wcw(pmac_t *chip, unsigned addr, unsigned val) +snd_pmac_burgundy_wcw(struct snd_pmac *chip, unsigned addr, unsigned val) { out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff)); snd_pmac_burgundy_busy_wait(chip); @@ -70,7 +70,7 @@ snd_pmac_burgundy_wcw(pmac_t *chip, unsigned addr, unsigned val) } static unsigned -snd_pmac_burgundy_rcw(pmac_t *chip, unsigned addr) +snd_pmac_burgundy_rcw(struct snd_pmac *chip, unsigned addr) { unsigned val = 0; unsigned long flags; @@ -103,14 +103,14 @@ snd_pmac_burgundy_rcw(pmac_t *chip, unsigned addr) } static void -snd_pmac_burgundy_wcb(pmac_t *chip, unsigned int addr, unsigned int val) +snd_pmac_burgundy_wcb(struct snd_pmac *chip, unsigned int addr, unsigned int val) { out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff)); snd_pmac_burgundy_busy_wait(chip); } static unsigned -snd_pmac_burgundy_rcb(pmac_t *chip, unsigned int addr) +snd_pmac_burgundy_rcb(struct snd_pmac *chip, unsigned int addr) { unsigned val = 0; unsigned long flags; @@ -131,7 +131,8 @@ snd_pmac_burgundy_rcb(pmac_t *chip, unsigned int addr) * Burgundy volume: 0 - 100, stereo */ static void -snd_pmac_burgundy_write_volume(pmac_t *chip, unsigned int address, long *volume, int shift) +snd_pmac_burgundy_write_volume(struct snd_pmac *chip, unsigned int address, + long *volume, int shift) { int hardvolume, lvolume, rvolume; @@ -146,7 +147,8 @@ snd_pmac_burgundy_write_volume(pmac_t *chip, unsigned int address, long *volume, } static void -snd_pmac_burgundy_read_volume(pmac_t *chip, unsigned int address, long *volume, int shift) +snd_pmac_burgundy_read_volume(struct snd_pmac *chip, unsigned int address, + long *volume, int shift) { int wvolume; @@ -171,7 +173,8 @@ snd_pmac_burgundy_read_volume(pmac_t *chip, unsigned int address, long *volume, #define BASE2ADDR(base) ((base) << 12) #define ADDR2BASE(addr) ((addr) >> 12) -static int snd_pmac_burgundy_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_burgundy_info_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -180,23 +183,27 @@ static int snd_pmac_burgundy_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_ return 0; } -static int snd_pmac_burgundy_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_burgundy_get_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); int shift = (kcontrol->private_value >> 8) & 0xff; - snd_pmac_burgundy_read_volume(chip, addr, ucontrol->value.integer.value, shift); + snd_pmac_burgundy_read_volume(chip, addr, ucontrol->value.integer.value, + shift); return 0; } -static int snd_pmac_burgundy_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_burgundy_put_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); int shift = (kcontrol->private_value >> 8) & 0xff; long nvoices[2]; - snd_pmac_burgundy_write_volume(chip, addr, ucontrol->value.integer.value, shift); + snd_pmac_burgundy_write_volume(chip, addr, ucontrol->value.integer.value, + shift); snd_pmac_burgundy_read_volume(chip, addr, nvoices, shift); return (nvoices[0] != ucontrol->value.integer.value[0] || nvoices[1] != ucontrol->value.integer.value[1]); @@ -211,7 +218,8 @@ static int snd_pmac_burgundy_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_v /* lineout/speaker */ -static int snd_pmac_burgundy_info_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_burgundy_info_switch_out(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { int stereo = (kcontrol->private_value >> 24) & 1; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; @@ -221,9 +229,10 @@ static int snd_pmac_burgundy_info_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_e return 0; } -static int snd_pmac_burgundy_get_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_burgundy_get_switch_out(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int lmask = kcontrol->private_value & 0xff; int rmask = (kcontrol->private_value >> 8) & 0xff; int stereo = (kcontrol->private_value >> 24) & 1; @@ -234,9 +243,10 @@ static int snd_pmac_burgundy_get_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_el return 0; } -static int snd_pmac_burgundy_put_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_burgundy_put_switch_out(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); int lmask = kcontrol->private_value & 0xff; int rmask = (kcontrol->private_value >> 8) & 0xff; int stereo = (kcontrol->private_value >> 24) & 1; @@ -259,7 +269,8 @@ static int snd_pmac_burgundy_put_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_el .private_value = ((lmask) | ((rmask) << 8) | ((stereo) << 24)) } /* line/speaker output volume */ -static int snd_pmac_burgundy_info_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_pmac_burgundy_info_volume_out(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { int stereo = (kcontrol->private_value >> 24) & 1; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; @@ -269,9 +280,10 @@ static int snd_pmac_burgundy_info_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_e return 0; } -static int snd_pmac_burgundy_get_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_burgundy_get_volume_out(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); int stereo = (kcontrol->private_value >> 24) & 1; int oval; @@ -283,9 +295,10 @@ static int snd_pmac_burgundy_get_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el return 0; } -static int snd_pmac_burgundy_put_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_pmac_burgundy_put_volume_out(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); int stereo = (kcontrol->private_value >> 24) & 1; int oval, val; @@ -308,7 +321,7 @@ static int snd_pmac_burgundy_put_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el .put = snd_pmac_burgundy_put_volume_out,\ .private_value = (ADDR2BASE(addr) | ((stereo) << 24)) } -static snd_kcontrol_new_t snd_pmac_burgundy_mixers[] __initdata = { +static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] __initdata = { BURGUNDY_VOLUME("Master Playback Volume", 0, MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8), BURGUNDY_VOLUME("Line Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLLINE, 16), BURGUNDY_VOLUME("CD Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLCD, 16), @@ -317,9 +330,9 @@ static snd_kcontrol_new_t snd_pmac_burgundy_mixers[] __initdata = { /*BURGUNDY_OUTPUT_VOLUME("PCM Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1),*/ BURGUNDY_OUTPUT_VOLUME("Headphone Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1), }; -static snd_kcontrol_new_t snd_pmac_burgundy_master_sw __initdata = +static struct snd_kcontrol_new snd_pmac_burgundy_master_sw __initdata = BURGUNDY_OUTPUT_SWITCH("Headphone Playback Switch", 0, BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); -static snd_kcontrol_new_t snd_pmac_burgundy_speaker_sw __initdata = +static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw __initdata = BURGUNDY_OUTPUT_SWITCH("PC Speaker Playback Switch", 0, BURGUNDY_OUTPUT_INTERN, 0, 0); @@ -327,12 +340,12 @@ BURGUNDY_OUTPUT_SWITCH("PC Speaker Playback Switch", 0, BURGUNDY_OUTPUT_INTERN, /* * auto-mute stuffs */ -static int snd_pmac_burgundy_detect_headphone(pmac_t *chip) +static int snd_pmac_burgundy_detect_headphone(struct snd_pmac *chip) { return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; } -static void snd_pmac_burgundy_update_automute(pmac_t *chip, int do_notify) +static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify) { if (chip->auto_mute) { int reg, oreg; @@ -361,7 +374,7 @@ static void snd_pmac_burgundy_update_automute(pmac_t *chip, int do_notify) /* * initialize burgundy */ -int __init snd_pmac_burgundy_init(pmac_t *chip) +int __init snd_pmac_burgundy_init(struct snd_pmac *chip) { int i, err; diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index a737f29..08cde51 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c @@ -40,18 +40,18 @@ #define DACA_VOL_MAX 0x38 -typedef struct pmac_daca_t { - pmac_keywest_t i2c; +struct pmac_daca { + struct pmac_keywest i2c; int left_vol, right_vol; unsigned int deemphasis : 1; unsigned int amp_on : 1; -} pmac_daca_t; +}; /* * initialize / detect DACA */ -static int daca_init_client(pmac_keywest_t *i2c) +static int daca_init_client(struct pmac_keywest *i2c) { unsigned short wdata = 0x00; /* SR: no swap, 1bit delay, 32-48kHz */ @@ -66,7 +66,7 @@ static int daca_init_client(pmac_keywest_t *i2c) /* * update volume */ -static int daca_set_volume(pmac_daca_t *mix) +static int daca_set_volume(struct pmac_daca *mix) { unsigned char data[2]; @@ -92,7 +92,8 @@ static int daca_set_volume(pmac_daca_t *mix) /* deemphasis switch */ -static int daca_info_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int daca_info_deemphasis(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -101,20 +102,22 @@ static int daca_info_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u return 0; } -static int daca_get_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int daca_get_deemphasis(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_daca_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_daca *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->deemphasis ? 1 : 0; return 0; } -static int daca_put_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int daca_put_deemphasis(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_daca_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_daca *mix; int change; if (! (mix = chip->mixer_data)) @@ -128,7 +131,8 @@ static int daca_put_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u } /* output volume */ -static int daca_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int daca_info_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -137,10 +141,11 @@ static int daca_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo return 0; } -static int daca_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int daca_get_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_daca_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_daca *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->left_vol; @@ -148,10 +153,11 @@ static int daca_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont return 0; } -static int daca_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int daca_put_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_daca_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_daca *mix; int change; if (! (mix = chip->mixer_data)) @@ -169,20 +175,22 @@ static int daca_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont /* amplifier switch */ #define daca_info_amp daca_info_deemphasis -static int daca_get_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int daca_get_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_daca_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_daca *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->amp_on ? 1 : 0; return 0; } -static int daca_put_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int daca_put_amp(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_daca_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_daca *mix; int change; if (! (mix = chip->mixer_data)) @@ -196,7 +204,7 @@ static int daca_put_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol return change; } -static snd_kcontrol_new_t daca_mixers[] = { +static struct snd_kcontrol_new daca_mixers[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Deemphasis Switch", .info = daca_info_deemphasis, @@ -219,9 +227,9 @@ static snd_kcontrol_new_t daca_mixers[] = { #ifdef CONFIG_PM -static void daca_resume(pmac_t *chip) +static void daca_resume(struct snd_pmac *chip) { - pmac_daca_t *mix = chip->mixer_data; + struct pmac_daca *mix = chip->mixer_data; i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_SR, 0x08); i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG, mix->amp_on ? 0x05 : 0x04); @@ -230,9 +238,9 @@ static void daca_resume(pmac_t *chip) #endif /* CONFIG_PM */ -static void daca_cleanup(pmac_t *chip) +static void daca_cleanup(struct snd_pmac *chip) { - pmac_daca_t *mix = chip->mixer_data; + struct pmac_daca *mix = chip->mixer_data; if (! mix) return; snd_pmac_keywest_cleanup(&mix->i2c); @@ -241,10 +249,10 @@ static void daca_cleanup(pmac_t *chip) } /* exported */ -int __init snd_pmac_daca_init(pmac_t *chip) +int __init snd_pmac_daca_init(struct snd_pmac *chip) { int i, err; - pmac_daca_t *mix; + struct pmac_daca *mix; #ifdef CONFIG_KMOD if (current->fs->root) diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index df073a0..097fbcf 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -32,7 +32,7 @@ * we have to keep a static variable here since i2c attach_adapter * callback cannot pass a private data. */ -static pmac_keywest_t *keywest_ctx; +static struct pmac_keywest *keywest_ctx; #define I2C_DRIVERID_KEYWEST 0xFEBA @@ -106,7 +106,7 @@ static int keywest_detach_client(struct i2c_client *client) } /* exported */ -void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c) +void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c) { if (keywest_ctx && keywest_ctx == i2c) { i2c_del_driver(&keywest_driver); @@ -126,7 +126,7 @@ int __init snd_pmac_tumbler_post_init(void) } /* exported */ -int __init snd_pmac_keywest_init(pmac_keywest_t *i2c) +int __init snd_pmac_keywest_init(struct pmac_keywest *i2c) { int err; diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index db2f1815..9b2b00f 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -36,14 +36,6 @@ #include <asm/pci-bridge.h> -#ifdef CONFIG_PM -static int snd_pmac_register_sleep_notifier(pmac_t *chip); -static int snd_pmac_unregister_sleep_notifier(pmac_t *chip); -static int snd_pmac_suspend(snd_card_t *card, pm_message_t state); -static int snd_pmac_resume(snd_card_t *card); -#endif - - /* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */ static int awacs_freqs[8] = { 44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350 @@ -56,7 +48,7 @@ static int tumbler_freqs[1] = { /* * allocate DBDMA command arrays */ -static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size) +static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, int size) { unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1); @@ -72,7 +64,7 @@ static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size) return 0; } -static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec) +static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) { if (rec) { unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); @@ -90,7 +82,7 @@ static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec) * look up frequency table */ -unsigned int snd_pmac_rate_index(pmac_t *chip, pmac_stream_t *rec, unsigned int rate) +unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate) { int i, ok, found; @@ -119,8 +111,8 @@ static inline int another_stream(int stream) /* * allocate buffers */ -static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, - snd_pcm_hw_params_t *hw_params) +static int snd_pmac_pcm_hw_params(struct snd_pcm_substream *subs, + struct snd_pcm_hw_params *hw_params) { return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params)); } @@ -128,7 +120,7 @@ static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, /* * release buffers */ -static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs) +static int snd_pmac_pcm_hw_free(struct snd_pcm_substream *subs) { snd_pcm_lib_free_pages(subs); return 0; @@ -137,7 +129,7 @@ static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs) /* * get a stream of the opposite direction */ -static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream) +static struct pmac_stream *snd_pmac_get_stream(struct snd_pmac *chip, int stream) { switch (stream) { case SNDRV_PCM_STREAM_PLAYBACK: @@ -154,7 +146,7 @@ static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream) * wait while run status is on */ static inline void -snd_pmac_wait_ack(pmac_stream_t *rec) +snd_pmac_wait_ack(struct pmac_stream *rec) { int timeout = 50000; while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0) @@ -165,7 +157,7 @@ snd_pmac_wait_ack(pmac_stream_t *rec) * set the format and rate to the chip. * call the lowlevel function if defined (e.g. for AWACS). */ -static void snd_pmac_pcm_set_format(pmac_t *chip) +static void snd_pmac_pcm_set_format(struct snd_pmac *chip) { /* set up frequency and format */ out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); @@ -177,7 +169,7 @@ static void snd_pmac_pcm_set_format(pmac_t *chip) /* * stop the DMA transfer */ -static inline void snd_pmac_dma_stop(pmac_stream_t *rec) +static inline void snd_pmac_dma_stop(struct pmac_stream *rec) { out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16); snd_pmac_wait_ack(rec); @@ -186,7 +178,7 @@ static inline void snd_pmac_dma_stop(pmac_stream_t *rec) /* * set the command pointer address */ -static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cmd) +static inline void snd_pmac_dma_set_command(struct pmac_stream *rec, struct pmac_dbdma *cmd) { out_le32(&rec->dma->cmdptr, cmd->addr); } @@ -194,7 +186,7 @@ static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cm /* * start the DMA */ -static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status) +static inline void snd_pmac_dma_run(struct pmac_stream *rec, int status) { out_le32(&rec->dma->control, status | (status << 16)); } @@ -203,14 +195,14 @@ static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status) /* * prepare playback/capture stream */ -static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) +static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, struct snd_pcm_substream *subs) { int i; volatile struct dbdma_cmd __iomem *cp; - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; int rate_index; long offset; - pmac_stream_t *astr; + struct pmac_stream *astr; rec->dma_size = snd_pcm_lib_buffer_bytes(subs); rec->period_size = snd_pcm_lib_period_bytes(subs); @@ -267,8 +259,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr /* * PCM trigger/stop */ -static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, - snd_pcm_substream_t *subs, int cmd) +static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec, + struct snd_pcm_substream *subs, int cmd) { volatile struct dbdma_cmd __iomem *cp; int i, command; @@ -314,8 +306,9 @@ static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, * return the current pointer */ inline -static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, - snd_pcm_substream_t *subs) +static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip, + struct pmac_stream *rec, + struct snd_pcm_substream *subs) { int count = 0; @@ -338,22 +331,22 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, * playback */ -static int snd_pmac_playback_prepare(snd_pcm_substream_t *subs) +static int snd_pmac_playback_prepare(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_prepare(chip, &chip->playback, subs); } -static int snd_pmac_playback_trigger(snd_pcm_substream_t *subs, +static int snd_pmac_playback_trigger(struct snd_pcm_substream *subs, int cmd) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd); } -static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs) +static snd_pcm_uframes_t snd_pmac_playback_pointer(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_pointer(chip, &chip->playback, subs); } @@ -362,22 +355,22 @@ static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs) * capture */ -static int snd_pmac_capture_prepare(snd_pcm_substream_t *subs) +static int snd_pmac_capture_prepare(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_prepare(chip, &chip->capture, subs); } -static int snd_pmac_capture_trigger(snd_pcm_substream_t *subs, +static int snd_pmac_capture_trigger(struct snd_pcm_substream *subs, int cmd) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd); } -static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs) +static snd_pcm_uframes_t snd_pmac_capture_pointer(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_pointer(chip, &chip->capture, subs); } @@ -385,7 +378,7 @@ static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs) /* * update playback/capture pointer from interrupts */ -static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec) +static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) { volatile struct dbdma_cmd __iomem *cp; int c; @@ -421,7 +414,7 @@ static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec) * hw info */ -static snd_pcm_hardware_t snd_pmac_playback = +static struct snd_pcm_hardware snd_pmac_playback = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | @@ -440,7 +433,7 @@ static snd_pcm_hardware_t snd_pmac_playback = .periods_max = PMAC_MAX_FRAGS, }; -static snd_pcm_hardware_t snd_pmac_capture = +static struct snd_pcm_hardware snd_pmac_capture = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | @@ -461,11 +454,11 @@ static snd_pcm_hardware_t snd_pmac_capture = #if 0 // NYI -static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, - snd_pcm_hw_rule_t *rule) +static int snd_pmac_hw_rule_rate(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) { - pmac_t *chip = rule->private; - pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); + struct snd_pmac *chip = rule->private; + struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]); int i, freq_table[8], num_freqs; if (! rec) @@ -480,11 +473,11 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, num_freqs, freq_table, 0); } -static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, - snd_pcm_hw_rule_t *rule) +static int snd_pmac_hw_rule_format(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) { - pmac_t *chip = rule->private; - pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); + struct snd_pmac *chip = rule->private; + struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]); if (! rec) return -EINVAL; @@ -493,9 +486,10 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, } #endif // NYI -static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) +static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec, + struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; int i, j, fflags; static int typical_freqs[] = { 44100, @@ -565,9 +559,10 @@ static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream return 0; } -static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) +static int snd_pmac_pcm_close(struct snd_pmac *chip, struct pmac_stream *rec, + struct snd_pcm_substream *subs) { - pmac_stream_t *astr; + struct pmac_stream *astr; snd_pmac_dma_stop(rec); @@ -582,32 +577,32 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea return 0; } -static int snd_pmac_playback_open(snd_pcm_substream_t *subs) +static int snd_pmac_playback_open(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); subs->runtime->hw = snd_pmac_playback; return snd_pmac_pcm_open(chip, &chip->playback, subs); } -static int snd_pmac_capture_open(snd_pcm_substream_t *subs) +static int snd_pmac_capture_open(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); subs->runtime->hw = snd_pmac_capture; return snd_pmac_pcm_open(chip, &chip->capture, subs); } -static int snd_pmac_playback_close(snd_pcm_substream_t *subs) +static int snd_pmac_playback_close(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_close(chip, &chip->playback, subs); } -static int snd_pmac_capture_close(snd_pcm_substream_t *subs) +static int snd_pmac_capture_close(struct snd_pcm_substream *subs) { - pmac_t *chip = snd_pcm_substream_chip(subs); + struct snd_pmac *chip = snd_pcm_substream_chip(subs); return snd_pmac_pcm_close(chip, &chip->capture, subs); } @@ -615,7 +610,7 @@ static int snd_pmac_capture_close(snd_pcm_substream_t *subs) /* */ -static snd_pcm_ops_t snd_pmac_playback_ops = { +static struct snd_pcm_ops snd_pmac_playback_ops = { .open = snd_pmac_playback_open, .close = snd_pmac_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -626,7 +621,7 @@ static snd_pcm_ops_t snd_pmac_playback_ops = { .pointer = snd_pmac_playback_pointer, }; -static snd_pcm_ops_t snd_pmac_capture_ops = { +static struct snd_pcm_ops snd_pmac_capture_ops = { .open = snd_pmac_capture_open, .close = snd_pmac_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -637,14 +632,9 @@ static snd_pcm_ops_t snd_pmac_capture_ops = { .pointer = snd_pmac_capture_pointer, }; -static void pmac_pcm_free(snd_pcm_t *pcm) +int __init snd_pmac_pcm_new(struct snd_pmac *chip) { - snd_pcm_lib_preallocate_free_for_all(pcm); -} - -int __init snd_pmac_pcm_new(pmac_t *chip) -{ - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; int num_captures = 1; @@ -659,7 +649,6 @@ int __init snd_pmac_pcm_new(pmac_t *chip) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_pmac_capture_ops); pcm->private_data = chip; - pcm->private_free = pmac_pcm_free; pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; strcpy(pcm->name, chip->card->shortname); chip->pcm = pcm; @@ -682,7 +671,7 @@ int __init snd_pmac_pcm_new(pmac_t *chip) } -static void snd_pmac_dbdma_reset(pmac_t *chip) +static void snd_pmac_dbdma_reset(struct snd_pmac *chip) { out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); snd_pmac_wait_ack(&chip->playback); @@ -694,9 +683,9 @@ static void snd_pmac_dbdma_reset(pmac_t *chip) /* * handling beep */ -void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int speed) +void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed) { - pmac_stream_t *rec = &chip->playback; + struct pmac_stream *rec = &chip->playback; snd_pmac_dma_stop(rec); st_le16(&chip->extra_dma.cmds->req_count, bytes); @@ -712,7 +701,7 @@ void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int sp snd_pmac_dma_run(rec, RUN); } -void snd_pmac_beep_dma_stop(pmac_t *chip) +void snd_pmac_beep_dma_stop(struct snd_pmac *chip) { snd_pmac_dma_stop(&chip->playback); st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); @@ -726,7 +715,7 @@ void snd_pmac_beep_dma_stop(pmac_t *chip) static irqreturn_t snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) { - pmac_t *chip = devid; + struct snd_pmac *chip = devid; snd_pmac_pcm_update(chip, &chip->playback); return IRQ_HANDLED; } @@ -735,7 +724,7 @@ snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) static irqreturn_t snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) { - pmac_t *chip = devid; + struct snd_pmac *chip = devid; snd_pmac_pcm_update(chip, &chip->capture); return IRQ_HANDLED; } @@ -744,7 +733,7 @@ snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) static irqreturn_t snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) { - pmac_t *chip = devid; + struct snd_pmac *chip = devid; int ctrl = in_le32(&chip->awacs->control); /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/ @@ -767,7 +756,7 @@ snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) /* * a wrapper to feature call for compatibility */ -static void snd_pmac_sound_feature(pmac_t *chip, int enable) +static void snd_pmac_sound_feature(struct snd_pmac *chip, int enable) { if (ppc_md.feature_call) ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); @@ -777,7 +766,7 @@ static void snd_pmac_sound_feature(pmac_t *chip, int enable) * release resources */ -static int snd_pmac_free(pmac_t *chip) +static int snd_pmac_free(struct snd_pmac *chip) { /* stop sounds */ if (chip->initialized) { @@ -787,9 +776,6 @@ static int snd_pmac_free(pmac_t *chip) } snd_pmac_sound_feature(chip, 0); -#ifdef CONFIG_PM - snd_pmac_unregister_sleep_notifier(chip); -#endif /* clean up mixer if any */ if (chip->mixer_free) @@ -842,9 +828,9 @@ static int snd_pmac_free(pmac_t *chip) /* * free the device */ -static int snd_pmac_dev_free(snd_device_t *device) +static int snd_pmac_dev_free(struct snd_device *device) { - pmac_t *chip = device->device_data; + struct snd_pmac *chip = device->device_data; return snd_pmac_free(chip); } @@ -853,7 +839,7 @@ static int snd_pmac_dev_free(snd_device_t *device) * check the machine support byteswap (little-endian) */ -static void __init detect_byte_swap(pmac_t *chip) +static void __init detect_byte_swap(struct snd_pmac *chip) { struct device_node *mio; @@ -879,7 +865,7 @@ static void __init detect_byte_swap(pmac_t *chip) /* * detect a sound chip */ -static int __init snd_pmac_detect(pmac_t *chip) +static int __init snd_pmac_detect(struct snd_pmac *chip) { struct device_node *sound = NULL; unsigned int *prop, l; @@ -987,11 +973,11 @@ static int __init snd_pmac_detect(pmac_t *chip) * single frequency until proper i2s control is implemented */ switch(layout_id) { - case 0x48: - case 0x46: - case 0x33: - case 0x29: case 0x24: + case 0x29: + case 0x33: + case 0x46: + case 0x48: case 0x50: case 0x5c: chip->num_freqs = ARRAY_SIZE(tumbler_freqs); @@ -1067,8 +1053,8 @@ static int __init snd_pmac_detect(pmac_t *chip) /* * exported - boolean info callbacks for ease of programming */ -int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 2; @@ -1077,8 +1063,8 @@ int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, return 0; } -int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -1091,16 +1077,18 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, /* * auto-mute */ -static int pmac_auto_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int pmac_auto_mute_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); ucontrol->value.integer.value[0] = chip->auto_mute; return 0; } -static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int pmac_auto_mute_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); if (ucontrol->value.integer.value[0] != chip->auto_mute) { chip->auto_mute = ucontrol->value.integer.value[0]; if (chip->update_automute) @@ -1110,9 +1098,10 @@ static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc return 0; } -static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int pmac_hp_detect_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); if (chip->detect_headphone) ucontrol->value.integer.value[0] = chip->detect_headphone(chip); else @@ -1120,7 +1109,7 @@ static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc return 0; } -static snd_kcontrol_new_t auto_mute_controls[] __initdata = { +static struct snd_kcontrol_new auto_mute_controls[] __initdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Auto Mute Switch", .info = snd_pmac_boolean_mono_info, @@ -1135,7 +1124,7 @@ static snd_kcontrol_new_t auto_mute_controls[] __initdata = { }, }; -int __init snd_pmac_add_automute(pmac_t *chip) +int __init snd_pmac_add_automute(struct snd_pmac *chip) { int err; chip->auto_mute = 1; @@ -1152,13 +1141,13 @@ int __init snd_pmac_add_automute(pmac_t *chip) /* * create and detect a pmac chip record */ -int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) +int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) { - pmac_t *chip; + struct snd_pmac *chip; struct device_node *np; int i, err; unsigned long ctrl_addr, txdma_addr, rxdma_addr; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_pmac_dev_free, }; @@ -1298,12 +1287,6 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) /* Reset dbdma channels */ snd_pmac_dbdma_reset(chip); -#ifdef CONFIG_PM - /* add sleep notifier */ - if (! snd_pmac_register_sleep_notifier(chip)) - snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip); -#endif - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) goto __error; @@ -1328,11 +1311,11 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) * Save state when going to sleep, restore it afterwards. */ -static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) +void snd_pmac_suspend(struct snd_pmac *chip) { - pmac_t *chip = card->pm_private_data; unsigned long flags; + snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); if (chip->suspend) chip->suspend(chip); snd_pcm_suspend_all(chip->pcm); @@ -1346,22 +1329,18 @@ static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) if (chip->rx_irq >= 0) disable_irq(chip->rx_irq); snd_pmac_sound_feature(chip, 0); - return 0; } -static int snd_pmac_resume(snd_card_t *card) +void snd_pmac_resume(struct snd_pmac *chip) { - pmac_t *chip = card->pm_private_data; - snd_pmac_sound_feature(chip, 1); if (chip->resume) chip->resume(chip); /* enable CD sound input */ - if (chip->macio_base && chip->is_pbook_G3) { + if (chip->macio_base && chip->is_pbook_G3) out_8(chip->macio_base + 0x37, 3); - } else if (chip->is_pbook_3400) { + else if (chip->is_pbook_3400) in_8(chip->latch_base + 0x190); - } snd_pmac_pcm_set_format(chip); @@ -1372,53 +1351,7 @@ static int snd_pmac_resume(snd_card_t *card) if (chip->rx_irq >= 0) enable_irq(chip->rx_irq); - return 0; -} - -/* the chip is stored statically by snd_pmac_register_sleep_notifier - * because we can't have any private data for notify callback. - */ -static pmac_t *sleeping_pmac = NULL; - -static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when) -{ - pmac_t *chip; - - chip = sleeping_pmac; - if (! chip) - return 0; - - switch (when) { - case PBOOK_SLEEP_NOW: - snd_pmac_suspend(chip->card, PMSG_SUSPEND); - break; - case PBOOK_WAKE: - snd_pmac_resume(chip->card); - break; - } - return PBOOK_SLEEP_OK; -} - -static struct pmu_sleep_notifier snd_pmac_sleep_notifier = { - snd_pmac_sleep_notify, SLEEP_LEVEL_SOUND, -}; - -static int __init snd_pmac_register_sleep_notifier(pmac_t *chip) -{ - /* should be protected here.. */ - snd_assert(! sleeping_pmac, return -EBUSY); - sleeping_pmac = chip; - pmu_register_sleep_notifier(&snd_pmac_sleep_notifier); - return 0; -} - -static int snd_pmac_unregister_sleep_notifier(pmac_t *chip) -{ - /* should be protected here.. */ - snd_assert(sleeping_pmac == chip, return -ENODEV); - pmu_unregister_sleep_notifier(&snd_pmac_sleep_notifier); - sleeping_pmac = NULL; - return 0; + snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); } #endif /* CONFIG_PM */ diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h index bfff788..086da7a 100644 --- a/sound/ppc/pmac.h +++ b/sound/ppc/pmac.h @@ -47,18 +47,9 @@ #define PMAC_SUPPORT_AUTOMUTE /* - * typedefs - */ -typedef struct snd_pmac pmac_t; -typedef struct snd_pmac_stream pmac_stream_t; -typedef struct snd_pmac_beep pmac_beep_t; -typedef struct snd_pmac_dbdma pmac_dbdma_t; - - -/* * DBDMA space */ -struct snd_pmac_dbdma { +struct pmac_dbdma { dma_addr_t dma_base; dma_addr_t addr; struct dbdma_cmd __iomem *cmds; @@ -69,7 +60,7 @@ struct snd_pmac_dbdma { /* * playback/capture stream */ -struct snd_pmac_stream { +struct pmac_stream { int running; /* boolean */ int stream; /* PLAYBACK/CAPTURE */ @@ -79,10 +70,10 @@ struct snd_pmac_stream { int buffer_size; /* in kbytes */ int nperiods, cur_period; - pmac_dbdma_t cmd; + struct pmac_dbdma cmd; volatile struct dbdma_regs __iomem *dma; - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; unsigned int cur_freqs; /* currently available frequencies */ unsigned int cur_formats; /* currently available formats */ @@ -98,7 +89,7 @@ enum snd_pmac_model { }; struct snd_pmac { - snd_card_t *card; + struct snd_card *card; /* h/w info */ struct device_node *node; @@ -140,75 +131,80 @@ struct snd_pmac { unsigned char __iomem *latch_base; unsigned char __iomem *macio_base; - pmac_stream_t playback; - pmac_stream_t capture; + struct pmac_stream playback; + struct pmac_stream capture; - pmac_dbdma_t extra_dma; + struct pmac_dbdma extra_dma; int irq, tx_irq, rx_irq; - snd_pcm_t *pcm; + struct snd_pcm *pcm; - pmac_beep_t *beep; + struct pmac_beep *beep; unsigned int control_mask; /* control mask */ /* mixer stuffs */ void *mixer_data; - void (*mixer_free)(pmac_t *); - snd_kcontrol_t *master_sw_ctl; - snd_kcontrol_t *speaker_sw_ctl; - snd_kcontrol_t *drc_sw_ctl; /* only used for tumbler -ReneR */ - snd_kcontrol_t *hp_detect_ctl; - snd_kcontrol_t *lineout_sw_ctl; + void (*mixer_free)(struct snd_pmac *); + struct snd_kcontrol *master_sw_ctl; + struct snd_kcontrol *speaker_sw_ctl; + struct snd_kcontrol *drc_sw_ctl; /* only used for tumbler -ReneR */ + struct snd_kcontrol *hp_detect_ctl; + struct snd_kcontrol *lineout_sw_ctl; /* lowlevel callbacks */ - void (*set_format)(pmac_t *chip); - void (*update_automute)(pmac_t *chip, int do_notify); - int (*detect_headphone)(pmac_t *chip); + void (*set_format)(struct snd_pmac *chip); + void (*update_automute)(struct snd_pmac *chip, int do_notify); + int (*detect_headphone)(struct snd_pmac *chip); #ifdef CONFIG_PM - void (*suspend)(pmac_t *chip); - void (*resume)(pmac_t *chip); + void (*suspend)(struct snd_pmac *chip); + void (*resume)(struct snd_pmac *chip); #endif }; /* exported functions */ -int snd_pmac_new(snd_card_t *card, pmac_t **chip_return); -int snd_pmac_pcm_new(pmac_t *chip); -int snd_pmac_attach_beep(pmac_t *chip); -void snd_pmac_detach_beep(pmac_t *chip); -void snd_pmac_beep_stop(pmac_t *chip); -unsigned int snd_pmac_rate_index(pmac_t *chip, pmac_stream_t *rec, unsigned int rate); +int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return); +int snd_pmac_pcm_new(struct snd_pmac *chip); +int snd_pmac_attach_beep(struct snd_pmac *chip); +void snd_pmac_detach_beep(struct snd_pmac *chip); +void snd_pmac_beep_stop(struct snd_pmac *chip); +unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate); -void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int speed); -void snd_pmac_beep_dma_stop(pmac_t *chip); +void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed); +void snd_pmac_beep_dma_stop(struct snd_pmac *chip); + +#ifdef CONFIG_PM +void snd_pmac_suspend(struct snd_pmac *chip); +void snd_pmac_resume(struct snd_pmac *chip); +#endif /* initialize mixer */ -int snd_pmac_awacs_init(pmac_t *chip); -int snd_pmac_burgundy_init(pmac_t *chip); -int snd_pmac_daca_init(pmac_t *chip); -int snd_pmac_tumbler_init(pmac_t *chip); +int snd_pmac_awacs_init(struct snd_pmac *chip); +int snd_pmac_burgundy_init(struct snd_pmac *chip); +int snd_pmac_daca_init(struct snd_pmac *chip); +int snd_pmac_tumbler_init(struct snd_pmac *chip); int snd_pmac_tumbler_post_init(void); -int snd_pmac_toonie_init(pmac_t *chip); +int snd_pmac_toonie_init(struct snd_pmac *chip); /* i2c functions */ -typedef struct snd_pmac_keywest { +struct pmac_keywest { int addr; struct i2c_client *client; int id; - int (*init_client)(struct snd_pmac_keywest *i2c); + int (*init_client)(struct pmac_keywest *i2c); char *name; -} pmac_keywest_t; +}; -int snd_pmac_keywest_init(pmac_keywest_t *i2c); -void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c); +int snd_pmac_keywest_init(struct pmac_keywest *i2c); +void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c); /* misc */ -int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo); -int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo); +int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); +int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); -int snd_pmac_add_automute(pmac_t *chip); +int snd_pmac_add_automute(struct snd_pmac *chip); #endif /* __PMAC_H */ diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index a6d8cbf..f4902a2 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -20,6 +20,8 @@ #include <sound/driver.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/moduleparam.h> #include <sound/core.h> #include <sound/initval.h> @@ -44,20 +46,16 @@ MODULE_PARM_DESC(id, "ID string for " CHIP_NAME " soundchip."); module_param(enable_beep, bool, 0444); MODULE_PARM_DESC(enable_beep, "Enable beep using PCM."); +static struct platform_device *device; -/* - * card entry - */ - -static snd_card_t *snd_pmac_card = NULL; /* */ -static int __init snd_pmac_probe(void) +static int __init snd_pmac_probe(struct platform_device *devptr) { - snd_card_t *card; - pmac_t *chip; + struct snd_card *card; + struct snd_pmac *chip; char *name_ext; int err; @@ -67,6 +65,7 @@ static int __init snd_pmac_probe(void) if ((err = snd_pmac_new(card, &chip)) < 0) goto __error; + card->private_data = chip; switch (chip->model) { case PMAC_BURGUNDY: @@ -131,13 +130,12 @@ static int __init snd_pmac_probe(void) if (enable_beep) snd_pmac_attach_beep(chip); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto __error; + snd_card_set_dev(card, &devptr->dev); if ((err = snd_card_register(card)) < 0) goto __error; - snd_pmac_card = card; + platform_set_drvdata(devptr, card); return 0; __error: @@ -146,23 +144,62 @@ __error: } -/* - * MODULE stuff - */ +static int __devexit snd_pmac_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#ifdef CONFIG_PM +static int snd_pmac_driver_suspend(struct platform_device *devptr, pm_message_t state) +{ + struct snd_card *card = platform_get_drvdata(devptr); + snd_pmac_suspend(card->private_data); + return 0; +} + +static int snd_pmac_driver_resume(struct platform_device *devptr) +{ + struct snd_card *card = platform_get_drvdata(devptr); + snd_pmac_resume(card->private_data); + return 0; +} +#endif + +#define SND_PMAC_DRIVER "snd_powermac" + +static struct platform_driver snd_pmac_driver = { + .probe = snd_pmac_probe, + .remove = __devexit_p(snd_pmac_remove), +#ifdef CONFIG_PM + .suspend = snd_pmac_driver_suspend, + .resume = snd_pmac_driver_resume, +#endif + .driver = { + .name = SND_PMAC_DRIVER + }, +}; static int __init alsa_card_pmac_init(void) { int err; - if ((err = snd_pmac_probe()) < 0) + + 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)) { + platform_driver_unregister(&snd_pmac_driver); + return PTR_ERR(device); + } return 0; } static void __exit alsa_card_pmac_exit(void) { - if (snd_pmac_card) - snd_card_free(snd_pmac_card); + platform_device_unregister(device); + platform_driver_unregister(&snd_pmac_driver); } module_init(alsa_card_pmac_init) diff --git a/sound/ppc/toonie.c b/sound/ppc/toonie.c index 082bc4b..053b8f2 100644 --- a/sound/ppc/toonie.c +++ b/sound/ppc/toonie.c @@ -101,10 +101,10 @@ static int read_audio_gpio(struct pmac_gpio *gp) enum { TOONIE_MUTE_HP, TOONIE_MUTE_AMP }; -static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int toonie_get_mute_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); struct pmac_toonie *mix = chip->mixer_data; struct pmac_gpio *gp; @@ -124,10 +124,10 @@ static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol, return 0; } -static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int toonie_put_mute_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); struct pmac_toonie *mix = chip->mixer_data; struct pmac_gpio *gp; int val; @@ -156,7 +156,7 @@ static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol, return 0; } -static snd_kcontrol_new_t toonie_hp_sw __initdata = { +static struct snd_kcontrol_new toonie_hp_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Headphone Playback Switch", .info = snd_pmac_boolean_mono_info, @@ -164,7 +164,7 @@ static snd_kcontrol_new_t toonie_hp_sw __initdata = { .put = toonie_put_mute_switch, .private_value = TOONIE_MUTE_HP, }; -static snd_kcontrol_new_t toonie_speaker_sw __initdata = { +static struct snd_kcontrol_new toonie_speaker_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PC Speaker Playback Switch", .info = snd_pmac_boolean_mono_info, @@ -176,7 +176,7 @@ static snd_kcontrol_new_t toonie_speaker_sw __initdata = { /* * auto-mute stuffs */ -static int toonie_detect_headphone(pmac_t *chip) +static int toonie_detect_headphone(struct snd_pmac *chip) { struct pmac_toonie *mix = chip->mixer_data; int detect = 0; @@ -186,8 +186,8 @@ static int toonie_detect_headphone(pmac_t *chip) return detect; } -static void toonie_check_mute(pmac_t *chip, struct pmac_gpio *gp, int val, - int do_notify, snd_kcontrol_t *sw) +static void toonie_check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val, + int do_notify, struct snd_kcontrol *sw) { if (check_audio_gpio(gp) != val) { write_audio_gpio(gp, val); @@ -199,7 +199,7 @@ static void toonie_check_mute(pmac_t *chip, struct pmac_gpio *gp, int val, static void toonie_detect_handler(void *self) { - pmac_t *chip = (pmac_t*) self; + struct snd_pmac *chip = (struct snd_pmac *) self; struct pmac_toonie *mix; int headphone; @@ -232,7 +232,7 @@ static void toonie_detect_handler(void *self) } } -static void toonie_update_automute(pmac_t *chip, int do_notify) +static void toonie_update_automute(struct snd_pmac *chip, int do_notify) { if (chip->auto_mute) { struct pmac_toonie *mix; @@ -246,7 +246,7 @@ static void toonie_update_automute(pmac_t *chip, int do_notify) /* interrupt - headphone plug changed */ static irqreturn_t toonie_hp_intr(int irq, void *devid, struct pt_regs *regs) { - pmac_t *chip = devid; + struct snd_pmac *chip = devid; if (chip->update_automute && chip->initialized) { chip->update_automute(chip, 1); @@ -325,7 +325,7 @@ static int find_audio_gpio(const char *name, const char *platform, return (np->n_intrs > 0) ? np->intrs[0].line : 0; } -static void toonie_cleanup(pmac_t *chip) +static void toonie_cleanup(struct snd_pmac *chip) { struct pmac_toonie *mix = chip->mixer_data; if (! mix) @@ -336,7 +336,7 @@ static void toonie_cleanup(pmac_t *chip) chip->mixer_data = NULL; } -int snd_pmac_toonie_init(pmac_t *chip) +int snd_pmac_toonie_init(struct snd_pmac *chip) { struct pmac_toonie *mix; diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index d74bfab..15c63cb 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -82,21 +82,21 @@ enum { VOL_IDX_LAST_MIX }; -typedef struct pmac_gpio { +struct pmac_gpio { unsigned int addr; u8 active_val; u8 inactive_val; u8 active_state; -} pmac_gpio_t; - -typedef struct pmac_tumbler_t { - pmac_keywest_t i2c; - pmac_gpio_t audio_reset; - pmac_gpio_t amp_mute; - pmac_gpio_t line_mute; - pmac_gpio_t line_detect; - pmac_gpio_t hp_mute; - pmac_gpio_t hp_detect; +}; + +struct pmac_tumbler { + struct pmac_keywest i2c; + struct pmac_gpio audio_reset; + struct pmac_gpio amp_mute; + struct pmac_gpio line_mute; + struct pmac_gpio line_detect; + struct pmac_gpio hp_mute; + struct pmac_gpio hp_detect; int headphone_irq; int lineout_irq; unsigned int save_master_vol[2]; @@ -112,13 +112,13 @@ typedef struct pmac_tumbler_t { int auto_mute_notify; int reset_on_sleep; u8 acs; -} pmac_tumbler_t; +}; /* */ -static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs) +static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs) { while (*regs > 0) { int err, count = 10; @@ -138,7 +138,7 @@ static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs) } -static int tumbler_init_client(pmac_keywest_t *i2c) +static int tumbler_init_client(struct pmac_keywest *i2c) { static unsigned int regs[] = { /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ @@ -149,7 +149,7 @@ static int tumbler_init_client(pmac_keywest_t *i2c) return send_init_client(i2c, regs); } -static int snapper_init_client(pmac_keywest_t *i2c) +static int snapper_init_client(struct pmac_keywest *i2c) { static unsigned int regs[] = { /* normal operation, SCLK=64fps, i2s output, 16bit width */ @@ -173,7 +173,7 @@ static int snapper_init_client(pmac_keywest_t *i2c) pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, (gp)->addr, 0) #define tumbler_gpio_free(gp) /* NOP */ -static void write_audio_gpio(pmac_gpio_t *gp, int active) +static void write_audio_gpio(struct pmac_gpio *gp, int active) { if (! gp->addr) return; @@ -182,7 +182,7 @@ static void write_audio_gpio(pmac_gpio_t *gp, int active) DBG("(I) gpio %x write %d\n", gp->addr, active); } -static int check_audio_gpio(pmac_gpio_t *gp) +static int check_audio_gpio(struct pmac_gpio *gp) { int ret; @@ -194,7 +194,7 @@ static int check_audio_gpio(pmac_gpio_t *gp) return (ret & 0xd) == (gp->active_val & 0xd); } -static int read_audio_gpio(pmac_gpio_t *gp) +static int read_audio_gpio(struct pmac_gpio *gp) { int ret; if (! gp->addr) @@ -206,7 +206,7 @@ static int read_audio_gpio(pmac_gpio_t *gp) /* * update master volume */ -static int tumbler_set_master_volume(pmac_tumbler_t *mix) +static int tumbler_set_master_volume(struct pmac_tumbler *mix) { unsigned char block[6]; unsigned int left_vol, right_vol; @@ -249,7 +249,8 @@ static int tumbler_set_master_volume(pmac_tumbler_t *mix) /* output volume */ -static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int tumbler_info_master_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -258,20 +259,22 @@ static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf return 0; } -static int tumbler_get_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_get_master_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix = chip->mixer_data; snd_assert(mix, return -ENODEV); ucontrol->value.integer.value[0] = mix->master_vol[0]; ucontrol->value.integer.value[1] = mix->master_vol[1]; return 0; } -static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_put_master_volume(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix = chip->mixer_data; int change; snd_assert(mix, return -ENODEV); @@ -286,20 +289,22 @@ static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu } /* output switch */ -static int tumbler_get_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_get_master_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix = chip->mixer_data; snd_assert(mix, return -ENODEV); ucontrol->value.integer.value[0] = mix->master_switch[0]; ucontrol->value.integer.value[1] = mix->master_switch[1]; return 0; } -static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_put_master_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix = chip->mixer_data; int change; snd_assert(mix, return -ENODEV); @@ -320,7 +325,7 @@ static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu #define TAS3001_DRC_MAX 0x5f -static int tumbler_set_drc(pmac_tumbler_t *mix) +static int tumbler_set_drc(struct pmac_tumbler *mix) { unsigned char val[2]; @@ -354,7 +359,7 @@ static int tumbler_set_drc(pmac_tumbler_t *mix) #define TAS3004_DRC_MAX 0xef -static int snapper_set_drc(pmac_tumbler_t *mix) +static int snapper_set_drc(struct pmac_tumbler *mix) { unsigned char val[6]; @@ -384,9 +389,10 @@ static int snapper_set_drc(pmac_tumbler_t *mix) return 0; } -static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int tumbler_info_drc_value(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; uinfo->value.integer.min = 0; @@ -395,20 +401,22 @@ static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int tumbler_get_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_get_drc_value(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->drc_range; return 0; } -static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_put_drc_value(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; int change; if (! (mix = chip->mixer_data)) @@ -424,20 +432,22 @@ static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t return change; } -static int tumbler_get_drc_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_get_drc_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->drc_enable; return 0; } -static int tumbler_put_drc_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_put_drc_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; int change; if (! (mix = chip->mixer_data)) @@ -466,7 +476,8 @@ struct tumbler_mono_vol { unsigned int *table; }; -static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol *info) +static int tumbler_set_mono_volume(struct pmac_tumbler *mix, + struct tumbler_mono_vol *info) { unsigned char block[4]; unsigned int vol; @@ -489,7 +500,8 @@ static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol return 0; } -static int tumbler_info_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int tumbler_info_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; @@ -500,22 +512,24 @@ static int tumbler_info_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf return 0; } -static int tumbler_get_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_get_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->mono_vol[info->index]; return 0; } -static int tumbler_put_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_put_mono(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; int change; if (! (mix = chip->mixer_data)) @@ -594,7 +608,7 @@ static struct tumbler_mono_vol snapper_treble_vol_info = { * snapper mixer volumes */ -static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg) +static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int reg) { int i, j, vol; unsigned char block[9]; @@ -618,7 +632,7 @@ static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg) return 0; } -static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx) +static int snapper_set_mix_vol(struct pmac_tumbler *mix, int idx) { if (! mix->i2c.client) return -ENODEV; @@ -628,7 +642,8 @@ static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx) return 0; } -static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snapper_info_mix(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -637,11 +652,12 @@ static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo return 0; } -static int snapper_get_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snapper_get_mix(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { int idx = (int)kcontrol->private_value; - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; if (! (mix = chip->mixer_data)) return -ENODEV; ucontrol->value.integer.value[0] = mix->mix_vol[idx][0]; @@ -649,11 +665,12 @@ static int snapper_get_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont return 0; } -static int snapper_put_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snapper_put_mix(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { int idx = (int)kcontrol->private_value; - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; int change; if (! (mix = chip->mixer_data)) @@ -676,11 +693,12 @@ static int snapper_put_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont enum { TUMBLER_MUTE_HP, TUMBLER_MUTE_AMP, TUMBLER_MUTE_LINE }; -static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_get_mute_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; - pmac_gpio_t *gp; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; + struct pmac_gpio *gp; if (! (mix = chip->mixer_data)) return -ENODEV; switch(kcontrol->private_value) { @@ -699,11 +717,12 @@ static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ return 0; } -static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int tumbler_put_mute_switch(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix; - pmac_gpio_t *gp; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix; + struct pmac_gpio *gp; int val; #ifdef PMAC_SUPPORT_AUTOMUTE if (chip->update_automute && chip->auto_mute) @@ -731,7 +750,7 @@ static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ return 0; } -static int snapper_set_capture_source(pmac_tumbler_t *mix) +static int snapper_set_capture_source(struct pmac_tumbler *mix) { if (! mix->i2c.client) return -ENODEV; @@ -742,7 +761,8 @@ static int snapper_set_capture_source(pmac_tumbler_t *mix) return i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS, mix->acs); } -static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snapper_info_capture_source(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { static char *texts[2] = { "Line", "Mic" @@ -756,20 +776,22 @@ static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_in return 0; } -static int snapper_get_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snapper_get_capture_source(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix = chip->mixer_data; snd_assert(mix, return -ENODEV); ucontrol->value.integer.value[0] = mix->capture_source; return 0; } -static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snapper_put_capture_source(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - pmac_t *chip = snd_kcontrol_chip(kcontrol); - pmac_tumbler_t *mix = chip->mixer_data; + struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); + struct pmac_tumbler *mix = chip->mixer_data; int change; snd_assert(mix, return -ENODEV); @@ -794,7 +816,7 @@ static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_val /* */ -static snd_kcontrol_new_t tumbler_mixers[] __initdata = { +static struct snd_kcontrol_new tumbler_mixers[] __initdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Master Playback Volume", .info = tumbler_info_master_volume, @@ -818,7 +840,7 @@ static snd_kcontrol_new_t tumbler_mixers[] __initdata = { }, }; -static snd_kcontrol_new_t snapper_mixers[] __initdata = { +static struct snd_kcontrol_new snapper_mixers[] __initdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Master Playback Volume", .info = tumbler_info_master_volume, @@ -850,7 +872,7 @@ static snd_kcontrol_new_t snapper_mixers[] __initdata = { }, }; -static snd_kcontrol_new_t tumbler_hp_sw __initdata = { +static struct snd_kcontrol_new tumbler_hp_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Headphone Playback Switch", .info = snd_pmac_boolean_mono_info, @@ -858,7 +880,7 @@ static snd_kcontrol_new_t tumbler_hp_sw __initdata = { .put = tumbler_put_mute_switch, .private_value = TUMBLER_MUTE_HP, }; -static snd_kcontrol_new_t tumbler_speaker_sw __initdata = { +static struct snd_kcontrol_new tumbler_speaker_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PC Speaker Playback Switch", .info = snd_pmac_boolean_mono_info, @@ -866,7 +888,7 @@ static snd_kcontrol_new_t tumbler_speaker_sw __initdata = { .put = tumbler_put_mute_switch, .private_value = TUMBLER_MUTE_AMP, }; -static snd_kcontrol_new_t tumbler_lineout_sw __initdata = { +static struct snd_kcontrol_new tumbler_lineout_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Line Out Playback Switch", .info = snd_pmac_boolean_mono_info, @@ -874,7 +896,7 @@ static snd_kcontrol_new_t tumbler_lineout_sw __initdata = { .put = tumbler_put_mute_switch, .private_value = TUMBLER_MUTE_LINE, }; -static snd_kcontrol_new_t tumbler_drc_sw __initdata = { +static struct snd_kcontrol_new tumbler_drc_sw __initdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "DRC Switch", .info = snd_pmac_boolean_mono_info, @@ -887,9 +909,9 @@ static snd_kcontrol_new_t tumbler_drc_sw __initdata = { /* * auto-mute stuffs */ -static int tumbler_detect_headphone(pmac_t *chip) +static int tumbler_detect_headphone(struct snd_pmac *chip) { - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; int detect = 0; if (mix->hp_detect.addr) @@ -897,9 +919,9 @@ static int tumbler_detect_headphone(pmac_t *chip) return detect; } -static int tumbler_detect_lineout(pmac_t *chip) +static int tumbler_detect_lineout(struct snd_pmac *chip) { - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; int detect = 0; if (mix->line_detect.addr) @@ -907,7 +929,8 @@ static int tumbler_detect_lineout(pmac_t *chip) return detect; } -static void check_mute(pmac_t *chip, pmac_gpio_t *gp, int val, int do_notify, snd_kcontrol_t *sw) +static void check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val, int do_notify, + struct snd_kcontrol *sw) { if (check_audio_gpio(gp) != val) { write_audio_gpio(gp, val); @@ -921,8 +944,8 @@ static struct work_struct device_change; static void device_change_handler(void *self) { - pmac_t *chip = (pmac_t*) self; - pmac_tumbler_t *mix; + struct snd_pmac *chip = self; + struct pmac_tumbler *mix; int headphone, lineout; if (!chip) @@ -979,10 +1002,10 @@ static void device_change_handler(void *self) tumbler_set_master_volume(mix); } -static void tumbler_update_automute(pmac_t *chip, int do_notify) +static void tumbler_update_automute(struct snd_pmac *chip, int do_notify) { if (chip->auto_mute) { - pmac_tumbler_t *mix; + struct pmac_tumbler *mix; mix = chip->mixer_data; snd_assert(mix, return); mix->auto_mute_notify = do_notify; @@ -995,7 +1018,7 @@ static void tumbler_update_automute(pmac_t *chip, int do_notify) /* interrupt - headphone plug changed */ static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs) { - pmac_t *chip = devid; + struct snd_pmac *chip = devid; if (chip->update_automute && chip->initialized) { chip->update_automute(chip, 1); return IRQ_HANDLED; @@ -1035,7 +1058,8 @@ static struct device_node *find_compatible_audio_device(const char *name) } /* find an audio device and get its address */ -static long tumbler_find_device(const char *device, const char *platform, pmac_gpio_t *gp, int is_compatible) +static long tumbler_find_device(const char *device, const char *platform, + struct pmac_gpio *gp, int is_compatible) { struct device_node *node; u32 *base, addr; @@ -1101,9 +1125,9 @@ static long tumbler_find_device(const char *device, const char *platform, pmac_g } /* reset audio */ -static void tumbler_reset_audio(pmac_t *chip) +static void tumbler_reset_audio(struct snd_pmac *chip) { - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; if (mix->anded_reset) { DBG("(I) codec anded reset !\n"); @@ -1130,9 +1154,9 @@ static void tumbler_reset_audio(pmac_t *chip) #ifdef CONFIG_PM /* suspend mixer */ -static void tumbler_suspend(pmac_t *chip) +static void tumbler_suspend(struct snd_pmac *chip) { - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; if (mix->headphone_irq >= 0) disable_irq(mix->headphone_irq); @@ -1160,9 +1184,9 @@ static void tumbler_suspend(pmac_t *chip) } /* resume mixer */ -static void tumbler_resume(pmac_t *chip) +static void tumbler_resume(struct snd_pmac *chip) { - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; snd_assert(mix, return); @@ -1208,10 +1232,10 @@ static void tumbler_resume(pmac_t *chip) #endif /* initialize tumbler */ -static int __init tumbler_init(pmac_t *chip) +static int __init tumbler_init(struct snd_pmac *chip) { int irq; - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; snd_assert(mix, return -EINVAL); if (tumbler_find_device("audio-hw-reset", @@ -1259,9 +1283,9 @@ static int __init tumbler_init(pmac_t *chip) return 0; } -static void tumbler_cleanup(pmac_t *chip) +static void tumbler_cleanup(struct snd_pmac *chip) { - pmac_tumbler_t *mix = chip->mixer_data; + struct pmac_tumbler *mix = chip->mixer_data; if (! mix) return; @@ -1279,10 +1303,10 @@ static void tumbler_cleanup(pmac_t *chip) } /* exported */ -int __init snd_pmac_tumbler_init(pmac_t *chip) +int __init snd_pmac_tumbler_init(struct snd_pmac *chip) { int i, err; - pmac_tumbler_t *mix; + struct pmac_tumbler *mix; u32 *paddr; struct device_node *tas_node, *np; char *chipname; |