Commit 65b29f50 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: PowerMac

Remove xxx_t typedefs from the PowerMac driver.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent bbe85bbd
...@@ -35,18 +35,18 @@ ...@@ -35,18 +35,18 @@
#endif #endif
#ifdef PMAC_AMP_AVAIL #ifdef PMAC_AMP_AVAIL
typedef struct awacs_amp { struct awacs_amp {
unsigned char amp_master; unsigned char amp_master;
unsigned char amp_vol[2][2]; unsigned char amp_vol[2][2];
unsigned char amp_tone[2]; unsigned char amp_tone[2];
} awacs_amp_t; };
#define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA) #define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA)
#endif /* PMAC_AMP_AVAIL */ #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; long timeout = 2000;
while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) { while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) {
...@@ -62,7 +62,7 @@ static void snd_pmac_screamer_wait(pmac_t *chip) ...@@ -62,7 +62,7 @@ static void snd_pmac_screamer_wait(pmac_t *chip)
* write AWACS register * write AWACS register
*/ */
static void static void
snd_pmac_awacs_write(pmac_t *chip, int val) snd_pmac_awacs_write(struct snd_pmac *chip, int val)
{ {
long timeout = 5000000; long timeout = 5000000;
...@@ -78,21 +78,21 @@ snd_pmac_awacs_write(pmac_t *chip, int val) ...@@ -78,21 +78,21 @@ snd_pmac_awacs_write(pmac_t *chip, int val)
} }
static void 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)); snd_pmac_awacs_write(chip, val | (reg << 12));
chip->awacs_reg[reg] = val; chip->awacs_reg[reg] = val;
} }
static void 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)); snd_pmac_awacs_write(chip, val | (reg << 12));
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* Recalibrate chip */ /* Recalibrate chip */
static void screamer_recalibrate(pmac_t *chip) static void screamer_recalibrate(struct snd_pmac *chip)
{ {
if (chip->model != PMAC_SCREAMER) if (chip->model != PMAC_SCREAMER)
return; return;
...@@ -105,7 +105,8 @@ static void screamer_recalibrate(pmac_t *chip) ...@@ -105,7 +105,8 @@ static void screamer_recalibrate(pmac_t *chip)
/* delay for broken crystal part */ /* delay for broken crystal part */
msleep(750); msleep(750);
snd_pmac_awacs_write_noreg(chip, 1, 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, 1, chip->awacs_reg[1]);
snd_pmac_awacs_write_noreg(chip, 6, chip->awacs_reg[6]); snd_pmac_awacs_write_noreg(chip, 6, chip->awacs_reg[6]);
} }
...@@ -118,7 +119,7 @@ static void screamer_recalibrate(pmac_t *chip) ...@@ -118,7 +119,7 @@ static void screamer_recalibrate(pmac_t *chip)
/* /*
* additional callback to set the pcm format * 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] &= ~MASK_SAMPLERATE;
chip->awacs_reg[1] |= chip->rate_index << 3; chip->awacs_reg[1] |= chip->rate_index << 3;
...@@ -132,7 +133,8 @@ static void snd_pmac_awacs_set_format(pmac_t *chip) ...@@ -132,7 +133,8 @@ static void snd_pmac_awacs_set_format(pmac_t *chip)
/* /*
* volumes: 0-15 stereo * 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -141,9 +143,10 @@ static int snd_pmac_awacs_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf ...@@ -141,9 +143,10 @@ static int snd_pmac_awacs_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
return 0; 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 reg = kcontrol->private_value & 0xff;
int lshift = (kcontrol->private_value >> 8) & 0xff; int lshift = (kcontrol->private_value >> 8) & 0xff;
int inverted = (kcontrol->private_value >> 16) & 1; 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 ...@@ -163,9 +166,10 @@ static int snd_pmac_awacs_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu
return 0; 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 reg = kcontrol->private_value & 0xff;
int lshift = (kcontrol->private_value >> 8) & 0xff; int lshift = (kcontrol->private_value >> 8) & 0xff;
int inverted = (kcontrol->private_value >> 16) & 1; 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 ...@@ -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 * 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 reg = kcontrol->private_value & 0xff;
int shift = (kcontrol->private_value >> 8) & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff;
int invert = (kcontrol->private_value >> 16) & 1; 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 ...@@ -221,9 +226,10 @@ static int snd_pmac_awacs_get_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu
return 0; 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 reg = kcontrol->private_value & 0xff;
int shift = (kcontrol->private_value >> 8) & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff;
int invert = (kcontrol->private_value >> 16) & 1; int invert = (kcontrol->private_value >> 16) & 1;
...@@ -268,7 +274,7 @@ static void awacs_set_cuda(int reg, int val) ...@@ -268,7 +274,7 @@ static void awacs_set_cuda(int reg, int val)
/* /*
* level = 0 - 14, 7 = 0 dB * 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[0] = bass;
amp->amp_tone[1] = treble; amp->amp_tone[1] = treble;
...@@ -282,7 +288,8 @@ static void awacs_amp_set_tone(awacs_amp_t *amp, int bass, int 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 * 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 && if (do_check && amp->amp_vol[index][0] == lvol &&
amp->amp_vol[index][1] == rvol) 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 ...@@ -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 * 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; amp->amp_master = vol;
if (vol <= 79) if (vol <= 79)
...@@ -307,9 +314,9 @@ static void awacs_amp_set_master(awacs_amp_t *amp, int vol) ...@@ -307,9 +314,9 @@ static void awacs_amp_set_master(awacs_amp_t *amp, int vol)
awacs_set_cuda(1, 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); snd_assert(amp, return);
kfree(amp); kfree(amp);
chip->mixer_data = NULL; chip->mixer_data = NULL;
...@@ -320,7 +327,8 @@ static void awacs_amp_free(pmac_t *chip) ...@@ -320,7 +327,8 @@ static void awacs_amp_free(pmac_t *chip)
/* /*
* mixer controls * 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -329,11 +337,12 @@ static int snd_pmac_awacs_info_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem ...@@ -329,11 +337,12 @@ static int snd_pmac_awacs_info_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem
return 0; 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; 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(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL);
ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31); 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_ ...@@ -341,12 +350,13 @@ static int snd_pmac_awacs_get_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_
return 0; 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 index = kcontrol->private_value;
int vol[2]; int vol[2];
awacs_amp_t *amp = chip->mixer_data; struct awacs_amp *amp = chip->mixer_data;
snd_assert(amp, return -EINVAL); snd_assert(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, 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_ ...@@ -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); 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; 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(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL);
ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) ? 0 : 1; 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_ ...@@ -367,12 +378,13 @@ static int snd_pmac_awacs_get_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_
return 0; 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 index = kcontrol->private_value;
int vol[2]; int vol[2];
awacs_amp_t *amp = chip->mixer_data; struct awacs_amp *amp = chip->mixer_data;
snd_assert(amp, return -EINVAL); snd_assert(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, 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_ ...@@ -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); 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -390,22 +403,24 @@ static int snd_pmac_awacs_info_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_i ...@@ -390,22 +403,24 @@ static int snd_pmac_awacs_info_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_i
return 0; 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; 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(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL);
ucontrol->value.integer.value[0] = amp->amp_tone[index]; ucontrol->value.integer.value[0] = amp->amp_tone[index];
return 0; 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; 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(amp, return -EINVAL);
snd_assert(index >= 0 && index <= 1, return -EINVAL); snd_assert(index >= 0 && index <= 1, return -EINVAL);
if (ucontrol->value.integer.value[0] != amp->amp_tone[index]) { 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 ...@@ -416,7 +431,8 @@ static int snd_pmac_awacs_put_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_va
return 0; 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -425,19 +441,21 @@ static int snd_pmac_awacs_info_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem ...@@ -425,19 +441,21 @@ static int snd_pmac_awacs_info_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
awacs_amp_t *amp = chip->mixer_data; struct awacs_amp *amp = chip->mixer_data;
snd_assert(amp, return -EINVAL); snd_assert(amp, return -EINVAL);
ucontrol->value.integer.value[0] = amp->amp_master; ucontrol->value.integer.value[0] = amp->amp_master;
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
awacs_amp_t *amp = chip->mixer_data; struct awacs_amp *amp = chip->mixer_data;
snd_assert(amp, return -EINVAL); snd_assert(amp, return -EINVAL);
if (ucontrol->value.integer.value[0] != amp->amp_master) { if (ucontrol->value.integer.value[0] != amp->amp_master) {
amp->amp_master = ucontrol->value.integer.value[0]; 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_ ...@@ -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_SPK 0
#define AMP_CH_HD 1 #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, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PC Speaker Playback Volume", .name = "PC Speaker Playback Volume",
.info = snd_pmac_awacs_info_volume_amp, .info = snd_pmac_awacs_info_volume_amp,
...@@ -487,7 +505,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_vol[] __initdata = { ...@@ -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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Headphone Playback Switch", .name = "Headphone Playback Switch",
.info = snd_pmac_boolean_stereo_info, .info = snd_pmac_boolean_stereo_info,
...@@ -496,7 +514,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_hp_sw __initdata = { ...@@ -496,7 +514,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_hp_sw __initdata = {
.private_value = AMP_CH_HD, .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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PC Speaker Playback Switch", .name = "PC Speaker Playback Switch",
.info = snd_pmac_boolean_stereo_info, .info = snd_pmac_boolean_stereo_info,
...@@ -511,7 +529,8 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_spk_sw __initdata = { ...@@ -511,7 +529,8 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_spk_sw __initdata = {
/* /*
* mic boost for screamer * 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -520,9 +539,10 @@ static int snd_pmac_screamer_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_el ...@@ -520,9 +539,10 @@ static int snd_pmac_screamer_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_el
return 0; 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; int val;
unsigned long flags; unsigned long flags;
...@@ -538,9 +558,10 @@ static int snd_pmac_screamer_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_ele ...@@ -538,9 +558,10 @@ static int snd_pmac_screamer_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_ele
return 0; 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 changed = 0;
int val0, val6; int val0, val6;
unsigned long flags; unsigned long flags;
...@@ -568,7 +589,7 @@ static int snd_pmac_screamer_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_ele ...@@ -568,7 +589,7 @@ static int snd_pmac_screamer_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_ele
/* /*
* lists of mixer elements * 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_VOLUME("Master Playback Volume", 2, 6, 1),
AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0),
AWACS_VOLUME("Capture Volume", 0, 4, 0), AWACS_VOLUME("Capture Volume", 0, 4, 0),
...@@ -578,24 +599,24 @@ static snd_kcontrol_new_t snd_pmac_awacs_mixers[] __initdata = { ...@@ -578,24 +599,24 @@ static snd_kcontrol_new_t snd_pmac_awacs_mixers[] __initdata = {
/* FIXME: is this correct order? /* FIXME: is this correct order?
* screamer (powerbook G3 pismo) seems to have different bits... * 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("Line Capture Switch", 0, SHIFT_MUX_LINE, 0),
AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 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("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 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); 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), 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, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Boost", .name = "Mic Boost",
.info = snd_pmac_screamer_mic_boost_info, .info = snd_pmac_screamer_mic_boost_info,
...@@ -604,17 +625,17 @@ static snd_kcontrol_new_t snd_pmac_screamer_mic_boost[] __initdata = { ...@@ -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), 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); AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
/* /*
* add new mixer elements to the card * 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; int i, err;
...@@ -629,7 +650,7 @@ static int build_mixers(pmac_t *chip, int nums, snd_kcontrol_new_t *mixers) ...@@ -629,7 +650,7 @@ static int build_mixers(pmac_t *chip, int nums, snd_kcontrol_new_t *mixers)
/* /*
* restore all registers * 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, 0, chip->awacs_reg[0]);
snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]);
...@@ -643,13 +664,13 @@ static void awacs_restore_all_regs(pmac_t *chip) ...@@ -643,13 +664,13 @@ static void awacs_restore_all_regs(pmac_t *chip)
} }
#ifdef CONFIG_PM #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] snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1]
| MASK_AMUTE | MASK_CMUTE)); | 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") if (machine_is_compatible("PowerBook3,1")
|| machine_is_compatible("PowerBook3,2")) { || machine_is_compatible("PowerBook3,2")) {
...@@ -668,7 +689,7 @@ static void snd_pmac_awacs_resume(pmac_t *chip) ...@@ -668,7 +689,7 @@ static void snd_pmac_awacs_resume(pmac_t *chip)
screamer_recalibrate(chip); screamer_recalibrate(chip);
#ifdef PMAC_AMP_AVAIL #ifdef PMAC_AMP_AVAIL
if (chip->mixer_data) { 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, 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_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]); 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) ...@@ -682,13 +703,13 @@ static void snd_pmac_awacs_resume(pmac_t *chip)
/* /*
* auto-mute stuffs * 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; return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0;
} }
#ifdef PMAC_AMP_AVAIL #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]; int vol[2];
vol[0] = amp->amp_vol[index][0] & 31; 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) ...@@ -701,12 +722,12 @@ static int toggle_amp_mute(awacs_amp_t *amp, int index, int mute)
} }
#endif #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) { if (chip->auto_mute) {
#ifdef PMAC_AMP_AVAIL #ifdef PMAC_AMP_AVAIL
if (chip->mixer_data) { if (chip->mixer_data) {
awacs_amp_t *amp = chip->mixer_data; struct awacs_amp *amp = chip->mixer_data;
int changed; int changed;
if (snd_pmac_awacs_detect_headphone(chip)) { if (snd_pmac_awacs_detect_headphone(chip)) {
changed = toggle_amp_mute(amp, AMP_CH_HD, 0); 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) ...@@ -746,7 +767,7 @@ static void snd_pmac_awacs_update_automute(pmac_t *chip, int do_notify)
* initialize chip * initialize chip
*/ */
int __init int __init
snd_pmac_awacs_init(pmac_t *chip) snd_pmac_awacs_init(struct snd_pmac *chip)
{ {
int err, vol; int err, vol;
...@@ -780,7 +801,7 @@ snd_pmac_awacs_init(pmac_t *chip) ...@@ -780,7 +801,7 @@ snd_pmac_awacs_init(pmac_t *chip)
chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf;
#ifdef PMAC_AMP_AVAIL #ifdef PMAC_AMP_AVAIL
if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { 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) if (! amp)
return -ENOMEM; return -ENOMEM;
chip->mixer_data = amp; chip->mixer_data = amp;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <sound/control.h> #include <sound/control.h>
#include "pmac.h" #include "pmac.h"
struct snd_pmac_beep { struct pmac_beep {
int running; /* boolean */ int running; /* boolean */
int volume; /* mixer volume: 0-100 */ int volume; /* mixer volume: 0-100 */
int volume_play; /* currently playing volume */ int volume_play; /* currently playing volume */
...@@ -44,9 +44,9 @@ struct snd_pmac_beep { ...@@ -44,9 +44,9 @@ struct snd_pmac_beep {
/* /*
* stop beep if running * 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) { if (beep && beep->running) {
beep->running = 0; beep->running = 0;
snd_pmac_beep_dma_stop(chip); snd_pmac_beep_dma_stop(chip);
...@@ -97,10 +97,11 @@ static short beep_wform[256] = { ...@@ -97,10 +97,11 @@ static short beep_wform[256] = {
#define BEEP_BUFLEN 512 #define BEEP_BUFLEN 512
#define BEEP_VOLUME 15 /* 0 - 100 */ #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; struct snd_pmac *chip;
pmac_beep_t *beep; struct pmac_beep *beep;
unsigned long flags; unsigned long flags;
int beep_speed = 0; int beep_speed = 0;
int srate; int srate;
...@@ -171,7 +172,8 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigne ...@@ -171,7 +172,8 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigne
* beep volume mixer * 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -180,17 +182,19 @@ static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin ...@@ -180,17 +182,19 @@ static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin
return 0; 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); snd_assert(chip->beep, return -ENXIO);
ucontrol->value.integer.value[0] = chip->beep->volume; ucontrol->value.integer.value[0] = chip->beep->volume;
return 0; 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; int oval;
snd_assert(chip->beep, return -ENXIO); snd_assert(chip->beep, return -ENXIO);
oval = chip->beep->volume; oval = chip->beep->volume;
...@@ -198,7 +202,7 @@ static int snd_pmac_put_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco ...@@ -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; 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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Beep Playback Volume", .name = "Beep Playback Volume",
.info = snd_pmac_info_beep, .info = snd_pmac_info_beep,
...@@ -207,9 +211,9 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = { ...@@ -207,9 +211,9 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = {
}; };
/* Initialize beep stuff */ /* 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; struct input_dev *input_dev;
void *dmabuf; void *dmabuf;
int err = -ENOMEM; int err = -ENOMEM;
...@@ -255,7 +259,7 @@ int __init snd_pmac_attach_beep(pmac_t *chip) ...@@ -255,7 +259,7 @@ int __init snd_pmac_attach_beep(pmac_t *chip)
return err; return err;
} }
void snd_pmac_detach_beep(pmac_t *chip) void snd_pmac_detach_beep(struct snd_pmac *chip)
{ {
if (chip->beep) { if (chip->beep) {
input_unregister_device(chip->beep->dev); input_unregister_device(chip->beep->dev);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/* Waits for busy flag to clear */ /* Waits for busy flag to clear */
static inline void static inline void
snd_pmac_burgundy_busy_wait(pmac_t *chip) snd_pmac_burgundy_busy_wait(struct snd_pmac *chip)
{ {
int timeout = 50; int timeout = 50;
while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--)
...@@ -41,7 +41,7 @@ snd_pmac_burgundy_busy_wait(pmac_t *chip) ...@@ -41,7 +41,7 @@ snd_pmac_burgundy_busy_wait(pmac_t *chip)
} }
static inline void static inline void
snd_pmac_burgundy_extend_wait(pmac_t *chip) snd_pmac_burgundy_extend_wait(struct snd_pmac *chip)
{ {
int timeout; int timeout;
timeout = 50; timeout = 50;
...@@ -57,7 +57,7 @@ snd_pmac_burgundy_extend_wait(pmac_t *chip) ...@@ -57,7 +57,7 @@ snd_pmac_burgundy_extend_wait(pmac_t *chip)
} }
static void 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)); out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff));
snd_pmac_burgundy_busy_wait(chip); snd_pmac_burgundy_busy_wait(chip);
...@@ -70,7 +70,7 @@ snd_pmac_burgundy_wcw(pmac_t *chip, unsigned addr, unsigned val) ...@@ -70,7 +70,7 @@ snd_pmac_burgundy_wcw(pmac_t *chip, unsigned addr, unsigned val)
} }
static unsigned 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 val = 0;
unsigned long flags; unsigned long flags;
...@@ -103,14 +103,14 @@ snd_pmac_burgundy_rcw(pmac_t *chip, unsigned addr) ...@@ -103,14 +103,14 @@ snd_pmac_burgundy_rcw(pmac_t *chip, unsigned addr)
} }
static void 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)); out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff));
snd_pmac_burgundy_busy_wait(chip); snd_pmac_burgundy_busy_wait(chip);
} }
static unsigned 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 val = 0;
unsigned long flags; unsigned long flags;
...@@ -131,7 +131,8 @@ snd_pmac_burgundy_rcb(pmac_t *chip, unsigned int addr) ...@@ -131,7 +131,8 @@ snd_pmac_burgundy_rcb(pmac_t *chip, unsigned int addr)
* Burgundy volume: 0 - 100, stereo * Burgundy volume: 0 - 100, stereo
*/ */
static void 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; int hardvolume, lvolume, rvolume;
...@@ -146,7 +147,8 @@ snd_pmac_burgundy_write_volume(pmac_t *chip, unsigned int address, long *volume, ...@@ -146,7 +147,8 @@ snd_pmac_burgundy_write_volume(pmac_t *chip, unsigned int address, long *volume,
} }
static void 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; int wvolume;
...@@ -171,7 +173,8 @@ snd_pmac_burgundy_read_volume(pmac_t *chip, unsigned int address, long *volume, ...@@ -171,7 +173,8 @@ snd_pmac_burgundy_read_volume(pmac_t *chip, unsigned int address, long *volume,
#define BASE2ADDR(base) ((base) << 12) #define BASE2ADDR(base) ((base) << 12)
#define ADDR2BASE(addr) ((addr) >> 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -180,23 +183,27 @@ static int snd_pmac_burgundy_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_ ...@@ -180,23 +183,27 @@ static int snd_pmac_burgundy_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_
return 0; 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); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff);
int shift = (kcontrol->private_value >> 8) & 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; 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); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff);
int shift = (kcontrol->private_value >> 8) & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff;
long nvoices[2]; 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); snd_pmac_burgundy_read_volume(chip, addr, nvoices, shift);
return (nvoices[0] != ucontrol->value.integer.value[0] || return (nvoices[0] != ucontrol->value.integer.value[0] ||
nvoices[1] != ucontrol->value.integer.value[1]); 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 ...@@ -211,7 +218,8 @@ static int snd_pmac_burgundy_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_v
/* lineout/speaker */ /* 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; int stereo = (kcontrol->private_value >> 24) & 1;
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 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 ...@@ -221,9 +229,10 @@ static int snd_pmac_burgundy_info_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_e
return 0; 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 lmask = kcontrol->private_value & 0xff;
int rmask = (kcontrol->private_value >> 8) & 0xff; int rmask = (kcontrol->private_value >> 8) & 0xff;
int stereo = (kcontrol->private_value >> 24) & 1; 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 ...@@ -234,9 +243,10 @@ static int snd_pmac_burgundy_get_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_el
return 0; 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 lmask = kcontrol->private_value & 0xff;
int rmask = (kcontrol->private_value >> 8) & 0xff; int rmask = (kcontrol->private_value >> 8) & 0xff;
int stereo = (kcontrol->private_value >> 24) & 1; 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 ...@@ -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)) } .private_value = ((lmask) | ((rmask) << 8) | ((stereo) << 24)) }
/* line/speaker output volume */ /* 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; int stereo = (kcontrol->private_value >> 24) & 1;
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 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 ...@@ -269,9 +280,10 @@ static int snd_pmac_burgundy_info_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_e
return 0; 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); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff);
int stereo = (kcontrol->private_value >> 24) & 1; int stereo = (kcontrol->private_value >> 24) & 1;
int oval; int oval;
...@@ -283,9 +295,10 @@ static int snd_pmac_burgundy_get_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el ...@@ -283,9 +295,10 @@ static int snd_pmac_burgundy_get_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el
return 0; 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); unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff);
int stereo = (kcontrol->private_value >> 24) & 1; int stereo = (kcontrol->private_value >> 24) & 1;
int oval, val; int oval, val;
...@@ -308,7 +321,7 @@ static int snd_pmac_burgundy_put_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el ...@@ -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,\ .put = snd_pmac_burgundy_put_volume_out,\
.private_value = (ADDR2BASE(addr) | ((stereo) << 24)) } .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("Master Playback Volume", 0, MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8),
BURGUNDY_VOLUME("Line Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLLINE, 16), BURGUNDY_VOLUME("Line Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLLINE, 16),
BURGUNDY_VOLUME("CD Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLCD, 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 = { ...@@ -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("PCM Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1),*/
BURGUNDY_OUTPUT_VOLUME("Headphone Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENSPEAKER, 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); 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); 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, ...@@ -327,12 +340,12 @@ BURGUNDY_OUTPUT_SWITCH("PC Speaker Playback Switch", 0, BURGUNDY_OUTPUT_INTERN,
/* /*
* auto-mute stuffs * 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; 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) { if (chip->auto_mute) {
int reg, oreg; int reg, oreg;
...@@ -361,7 +374,7 @@ static void snd_pmac_burgundy_update_automute(pmac_t *chip, int do_notify) ...@@ -361,7 +374,7 @@ static void snd_pmac_burgundy_update_automute(pmac_t *chip, int do_notify)
/* /*
* initialize burgundy * initialize burgundy
*/ */
int __init snd_pmac_burgundy_init(pmac_t *chip) int __init snd_pmac_burgundy_init(struct snd_pmac *chip)
{ {
int i, err; int i, err;
......
...@@ -40,18 +40,18 @@ ...@@ -40,18 +40,18 @@
#define DACA_VOL_MAX 0x38 #define DACA_VOL_MAX 0x38
typedef struct pmac_daca_t { struct pmac_daca {
pmac_keywest_t i2c; struct pmac_keywest i2c;
int left_vol, right_vol; int left_vol, right_vol;
unsigned int deemphasis : 1; unsigned int deemphasis : 1;
unsigned int amp_on : 1; unsigned int amp_on : 1;
} pmac_daca_t; };
/* /*
* initialize / detect DACA * 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; unsigned short wdata = 0x00;
/* SR: no swap, 1bit delay, 32-48kHz */ /* SR: no swap, 1bit delay, 32-48kHz */
...@@ -66,7 +66,7 @@ static int daca_init_client(pmac_keywest_t *i2c) ...@@ -66,7 +66,7 @@ static int daca_init_client(pmac_keywest_t *i2c)
/* /*
* update volume * update volume
*/ */
static int daca_set_volume(pmac_daca_t *mix) static int daca_set_volume(struct pmac_daca *mix)
{ {
unsigned char data[2]; unsigned char data[2];
...@@ -92,7 +92,8 @@ static int daca_set_volume(pmac_daca_t *mix) ...@@ -92,7 +92,8 @@ static int daca_set_volume(pmac_daca_t *mix)
/* deemphasis switch */ /* 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->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1; uinfo->count = 1;
...@@ -101,20 +102,22 @@ static int daca_info_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u ...@@ -101,20 +102,22 @@ static int daca_info_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_daca_t *mix; struct pmac_daca *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->deemphasis ? 1 : 0; ucontrol->value.integer.value[0] = mix->deemphasis ? 1 : 0;
return 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_daca_t *mix; struct pmac_daca *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -128,7 +131,8 @@ static int daca_put_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u ...@@ -128,7 +131,8 @@ static int daca_put_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u
} }
/* output volume */ /* 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -137,10 +141,11 @@ static int daca_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo ...@@ -137,10 +141,11 @@ static int daca_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_daca_t *mix; struct pmac_daca *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->left_vol; 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 ...@@ -148,10 +153,11 @@ static int daca_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_daca_t *mix; struct pmac_daca *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -169,20 +175,22 @@ static int daca_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont ...@@ -169,20 +175,22 @@ static int daca_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont
/* amplifier switch */ /* amplifier switch */
#define daca_info_amp daca_info_deemphasis #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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_daca_t *mix; struct pmac_daca *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->amp_on ? 1 : 0; ucontrol->value.integer.value[0] = mix->amp_on ? 1 : 0;
return 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_daca_t *mix; struct pmac_daca *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -196,7 +204,7 @@ static int daca_put_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol ...@@ -196,7 +204,7 @@ static int daca_put_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol
return change; return change;
} }
static snd_kcontrol_new_t daca_mixers[] = { static struct snd_kcontrol_new daca_mixers[] = {
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Deemphasis Switch", .name = "Deemphasis Switch",
.info = daca_info_deemphasis, .info = daca_info_deemphasis,
...@@ -219,9 +227,9 @@ static snd_kcontrol_new_t daca_mixers[] = { ...@@ -219,9 +227,9 @@ static snd_kcontrol_new_t daca_mixers[] = {
#ifdef CONFIG_PM #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_SR, 0x08);
i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG, i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG,
mix->amp_on ? 0x05 : 0x04); mix->amp_on ? 0x05 : 0x04);
...@@ -230,9 +238,9 @@ static void daca_resume(pmac_t *chip) ...@@ -230,9 +238,9 @@ static void daca_resume(pmac_t *chip)
#endif /* CONFIG_PM */ #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) if (! mix)
return; return;
snd_pmac_keywest_cleanup(&mix->i2c); snd_pmac_keywest_cleanup(&mix->i2c);
...@@ -241,10 +249,10 @@ static void daca_cleanup(pmac_t *chip) ...@@ -241,10 +249,10 @@ static void daca_cleanup(pmac_t *chip)
} }
/* exported */ /* exported */
int __init snd_pmac_daca_init(pmac_t *chip) int __init snd_pmac_daca_init(struct snd_pmac *chip)
{ {
int i, err; int i, err;
pmac_daca_t *mix; struct pmac_daca *mix;
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (current->fs->root) if (current->fs->root)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* we have to keep a static variable here since i2c attach_adapter * we have to keep a static variable here since i2c attach_adapter
* callback cannot pass a private data. * callback cannot pass a private data.
*/ */
static pmac_keywest_t *keywest_ctx; static struct pmac_keywest *keywest_ctx;
#define I2C_DRIVERID_KEYWEST 0xFEBA #define I2C_DRIVERID_KEYWEST 0xFEBA
...@@ -106,7 +106,7 @@ static int keywest_detach_client(struct i2c_client *client) ...@@ -106,7 +106,7 @@ static int keywest_detach_client(struct i2c_client *client)
} }
/* exported */ /* 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) { if (keywest_ctx && keywest_ctx == i2c) {
i2c_del_driver(&keywest_driver); i2c_del_driver(&keywest_driver);
...@@ -126,7 +126,7 @@ int __init snd_pmac_tumbler_post_init(void) ...@@ -126,7 +126,7 @@ int __init snd_pmac_tumbler_post_init(void)
} }
/* exported */ /* exported */
int __init snd_pmac_keywest_init(pmac_keywest_t *i2c) int __init snd_pmac_keywest_init(struct pmac_keywest *i2c)
{ {
int err; int err;
......
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int snd_pmac_register_sleep_notifier(pmac_t *chip); static int snd_pmac_register_sleep_notifier(struct snd_pmac *chip);
static int snd_pmac_unregister_sleep_notifier(pmac_t *chip); static int snd_pmac_unregister_sleep_notifier(struct snd_pmac *chip);
static int snd_pmac_suspend(snd_card_t *card, pm_message_t state); static int snd_pmac_suspend(struct snd_card *card, pm_message_t state);
static int snd_pmac_resume(snd_card_t *card); static int snd_pmac_resume(struct snd_card *card);
#endif #endif
...@@ -56,7 +56,7 @@ static int tumbler_freqs[1] = { ...@@ -56,7 +56,7 @@ static int tumbler_freqs[1] = {
/* /*
* allocate DBDMA command arrays * 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); unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1);
...@@ -72,7 +72,7 @@ static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size) ...@@ -72,7 +72,7 @@ static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size)
return 0; 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) { if (rec) {
unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1);
...@@ -90,7 +90,7 @@ static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec) ...@@ -90,7 +90,7 @@ static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec)
* look up frequency table * 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; int i, ok, found;
...@@ -119,8 +119,8 @@ static inline int another_stream(int stream) ...@@ -119,8 +119,8 @@ static inline int another_stream(int stream)
/* /*
* allocate buffers * allocate buffers
*/ */
static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, static int snd_pmac_pcm_hw_params(struct snd_pcm_substream *subs,
snd_pcm_hw_params_t *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params)); return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params));
} }
...@@ -128,7 +128,7 @@ static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, ...@@ -128,7 +128,7 @@ static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs,
/* /*
* release buffers * 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); snd_pcm_lib_free_pages(subs);
return 0; return 0;
...@@ -137,7 +137,7 @@ static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs) ...@@ -137,7 +137,7 @@ static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs)
/* /*
* get a stream of the opposite direction * 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) { switch (stream) {
case SNDRV_PCM_STREAM_PLAYBACK: case SNDRV_PCM_STREAM_PLAYBACK:
...@@ -154,7 +154,7 @@ static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream) ...@@ -154,7 +154,7 @@ static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream)
* wait while run status is on * wait while run status is on
*/ */
static inline void static inline void
snd_pmac_wait_ack(pmac_stream_t *rec) snd_pmac_wait_ack(struct pmac_stream *rec)
{ {
int timeout = 50000; int timeout = 50000;
while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0) while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0)
...@@ -165,7 +165,7 @@ snd_pmac_wait_ack(pmac_stream_t *rec) ...@@ -165,7 +165,7 @@ snd_pmac_wait_ack(pmac_stream_t *rec)
* set the format and rate to the chip. * set the format and rate to the chip.
* call the lowlevel function if defined (e.g. for AWACS). * 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 */ /* set up frequency and format */
out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8));
...@@ -177,7 +177,7 @@ static void snd_pmac_pcm_set_format(pmac_t *chip) ...@@ -177,7 +177,7 @@ static void snd_pmac_pcm_set_format(pmac_t *chip)
/* /*
* stop the DMA transfer * 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); out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16);
snd_pmac_wait_ack(rec); snd_pmac_wait_ack(rec);
...@@ -186,7 +186,7 @@ static inline void snd_pmac_dma_stop(pmac_stream_t *rec) ...@@ -186,7 +186,7 @@ static inline void snd_pmac_dma_stop(pmac_stream_t *rec)
/* /*
* set the command pointer address * 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); out_le32(&rec->dma->cmdptr, cmd->addr);
} }
...@@ -194,7 +194,7 @@ static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cm ...@@ -194,7 +194,7 @@ static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cm
/* /*
* start the DMA * 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)); out_le32(&rec->dma->control, status | (status << 16));
} }
...@@ -203,14 +203,14 @@ static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status) ...@@ -203,14 +203,14 @@ static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status)
/* /*
* prepare playback/capture stream * 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; int i;
volatile struct dbdma_cmd __iomem *cp; volatile struct dbdma_cmd __iomem *cp;
snd_pcm_runtime_t *runtime = subs->runtime; struct snd_pcm_runtime *runtime = subs->runtime;
int rate_index; int rate_index;
long offset; long offset;
pmac_stream_t *astr; struct pmac_stream *astr;
rec->dma_size = snd_pcm_lib_buffer_bytes(subs); rec->dma_size = snd_pcm_lib_buffer_bytes(subs);
rec->period_size = snd_pcm_lib_period_bytes(subs); rec->period_size = snd_pcm_lib_period_bytes(subs);
...@@ -267,8 +267,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr ...@@ -267,8 +267,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr
/* /*
* PCM trigger/stop * PCM trigger/stop
*/ */
static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec,
snd_pcm_substream_t *subs, int cmd) struct snd_pcm_substream *subs, int cmd)
{ {
volatile struct dbdma_cmd __iomem *cp; volatile struct dbdma_cmd __iomem *cp;
int i, command; int i, command;
...@@ -314,8 +314,9 @@ static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, ...@@ -314,8 +314,9 @@ static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec,
* return the current pointer * return the current pointer
*/ */
inline inline
static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip,
snd_pcm_substream_t *subs) struct pmac_stream *rec,
struct snd_pcm_substream *subs)
{ {
int count = 0; int count = 0;
...@@ -338,22 +339,22 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, ...@@ -338,22 +339,22 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec,
* playback * 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); 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) 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); 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); return snd_pmac_pcm_pointer(chip, &chip->playback, subs);
} }
...@@ -362,22 +363,22 @@ static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs) ...@@ -362,22 +363,22 @@ static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs)
* capture * 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); 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) 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); 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); return snd_pmac_pcm_pointer(chip, &chip->capture, subs);
} }
...@@ -385,7 +386,7 @@ static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs) ...@@ -385,7 +386,7 @@ static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs)
/* /*
* update playback/capture pointer from interrupts * 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; volatile struct dbdma_cmd __iomem *cp;
int c; int c;
...@@ -421,7 +422,7 @@ static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec) ...@@ -421,7 +422,7 @@ static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec)
* hw info * hw info
*/ */
static snd_pcm_hardware_t snd_pmac_playback = static struct snd_pcm_hardware snd_pmac_playback =
{ {
.info = (SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP |
...@@ -440,7 +441,7 @@ static snd_pcm_hardware_t snd_pmac_playback = ...@@ -440,7 +441,7 @@ static snd_pcm_hardware_t snd_pmac_playback =
.periods_max = PMAC_MAX_FRAGS, .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 | .info = (SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP |
...@@ -461,11 +462,11 @@ static snd_pcm_hardware_t snd_pmac_capture = ...@@ -461,11 +462,11 @@ static snd_pcm_hardware_t snd_pmac_capture =
#if 0 // NYI #if 0 // NYI
static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, static int snd_pmac_hw_rule_rate(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
pmac_t *chip = rule->private; struct snd_pmac *chip = rule->private;
pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
int i, freq_table[8], num_freqs; int i, freq_table[8], num_freqs;
if (! rec) if (! rec)
...@@ -480,11 +481,11 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, ...@@ -480,11 +481,11 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params,
num_freqs, freq_table, 0); num_freqs, freq_table, 0);
} }
static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, static int snd_pmac_hw_rule_format(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
pmac_t *chip = rule->private; struct snd_pmac *chip = rule->private;
pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
if (! rec) if (! rec)
return -EINVAL; return -EINVAL;
...@@ -493,9 +494,10 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, ...@@ -493,9 +494,10 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params,
} }
#endif // NYI #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; int i, j, fflags;
static int typical_freqs[] = { static int typical_freqs[] = {
44100, 44100,
...@@ -565,9 +567,10 @@ static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream ...@@ -565,9 +567,10 @@ static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream
return 0; 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); snd_pmac_dma_stop(rec);
...@@ -582,32 +585,32 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea ...@@ -582,32 +585,32 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea
return 0; 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; subs->runtime->hw = snd_pmac_playback;
return snd_pmac_pcm_open(chip, &chip->playback, subs); 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; subs->runtime->hw = snd_pmac_capture;
return snd_pmac_pcm_open(chip, &chip->capture, subs); 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); 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); return snd_pmac_pcm_close(chip, &chip->capture, subs);
} }
...@@ -615,7 +618,7 @@ static int snd_pmac_capture_close(snd_pcm_substream_t *subs) ...@@ -615,7 +618,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, .open = snd_pmac_playback_open,
.close = snd_pmac_playback_close, .close = snd_pmac_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
...@@ -626,7 +629,7 @@ static snd_pcm_ops_t snd_pmac_playback_ops = { ...@@ -626,7 +629,7 @@ static snd_pcm_ops_t snd_pmac_playback_ops = {
.pointer = snd_pmac_playback_pointer, .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, .open = snd_pmac_capture_open,
.close = snd_pmac_capture_close, .close = snd_pmac_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
...@@ -637,9 +640,9 @@ static snd_pcm_ops_t snd_pmac_capture_ops = { ...@@ -637,9 +640,9 @@ static snd_pcm_ops_t snd_pmac_capture_ops = {
.pointer = snd_pmac_capture_pointer, .pointer = snd_pmac_capture_pointer,
}; };
int __init snd_pmac_pcm_new(pmac_t *chip) int __init snd_pmac_pcm_new(struct snd_pmac *chip)
{ {
snd_pcm_t *pcm; struct snd_pcm *pcm;
int err; int err;
int num_captures = 1; int num_captures = 1;
...@@ -676,7 +679,7 @@ int __init snd_pmac_pcm_new(pmac_t *chip) ...@@ -676,7 +679,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); out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16);
snd_pmac_wait_ack(&chip->playback); snd_pmac_wait_ack(&chip->playback);
...@@ -688,9 +691,9 @@ static void snd_pmac_dbdma_reset(pmac_t *chip) ...@@ -688,9 +691,9 @@ static void snd_pmac_dbdma_reset(pmac_t *chip)
/* /*
* handling beep * 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); snd_pmac_dma_stop(rec);
st_le16(&chip->extra_dma.cmds->req_count, bytes); st_le16(&chip->extra_dma.cmds->req_count, bytes);
...@@ -706,7 +709,7 @@ void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int sp ...@@ -706,7 +709,7 @@ void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int sp
snd_pmac_dma_run(rec, RUN); 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); snd_pmac_dma_stop(&chip->playback);
st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP);
...@@ -720,7 +723,7 @@ void snd_pmac_beep_dma_stop(pmac_t *chip) ...@@ -720,7 +723,7 @@ void snd_pmac_beep_dma_stop(pmac_t *chip)
static irqreturn_t static irqreturn_t
snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) 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); snd_pmac_pcm_update(chip, &chip->playback);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -729,7 +732,7 @@ snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) ...@@ -729,7 +732,7 @@ snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs)
static irqreturn_t static irqreturn_t
snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) 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); snd_pmac_pcm_update(chip, &chip->capture);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -738,7 +741,7 @@ snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) ...@@ -738,7 +741,7 @@ snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs)
static irqreturn_t static irqreturn_t
snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) 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); int ctrl = in_le32(&chip->awacs->control);
/*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/ /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/
...@@ -761,7 +764,7 @@ snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) ...@@ -761,7 +764,7 @@ snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs)
/* /*
* a wrapper to feature call for compatibility * 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) if (ppc_md.feature_call)
ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable);
...@@ -771,7 +774,7 @@ static void snd_pmac_sound_feature(pmac_t *chip, int enable) ...@@ -771,7 +774,7 @@ static void snd_pmac_sound_feature(pmac_t *chip, int enable)
* release resources * release resources
*/ */
static int snd_pmac_free(pmac_t *chip) static int snd_pmac_free(struct snd_pmac *chip)
{ {
/* stop sounds */ /* stop sounds */
if (chip->initialized) { if (chip->initialized) {
...@@ -836,9 +839,9 @@ static int snd_pmac_free(pmac_t *chip) ...@@ -836,9 +839,9 @@ static int snd_pmac_free(pmac_t *chip)
/* /*
* free the device * 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); return snd_pmac_free(chip);
} }
...@@ -847,7 +850,7 @@ static int snd_pmac_dev_free(snd_device_t *device) ...@@ -847,7 +850,7 @@ static int snd_pmac_dev_free(snd_device_t *device)
* check the machine support byteswap (little-endian) * 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; struct device_node *mio;
...@@ -873,7 +876,7 @@ static void __init detect_byte_swap(pmac_t *chip) ...@@ -873,7 +876,7 @@ static void __init detect_byte_swap(pmac_t *chip)
/* /*
* detect a sound 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; struct device_node *sound = NULL;
unsigned int *prop, l; unsigned int *prop, l;
...@@ -1061,8 +1064,8 @@ static int __init snd_pmac_detect(pmac_t *chip) ...@@ -1061,8 +1064,8 @@ static int __init snd_pmac_detect(pmac_t *chip)
/* /*
* exported - boolean info callbacks for ease of programming * exported - boolean info callbacks for ease of programming
*/ */
int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 2; uinfo->count = 2;
...@@ -1071,8 +1074,8 @@ int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, ...@@ -1071,8 +1074,8 @@ int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1; uinfo->count = 1;
...@@ -1085,16 +1088,18 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, ...@@ -1085,16 +1088,18 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol,
/* /*
* auto-mute * 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; ucontrol->value.integer.value[0] = chip->auto_mute;
return 0; 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) { if (ucontrol->value.integer.value[0] != chip->auto_mute) {
chip->auto_mute = ucontrol->value.integer.value[0]; chip->auto_mute = ucontrol->value.integer.value[0];
if (chip->update_automute) if (chip->update_automute)
...@@ -1104,9 +1109,10 @@ static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc ...@@ -1104,9 +1109,10 @@ static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
return 0; 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) if (chip->detect_headphone)
ucontrol->value.integer.value[0] = chip->detect_headphone(chip); ucontrol->value.integer.value[0] = chip->detect_headphone(chip);
else else
...@@ -1114,7 +1120,7 @@ static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc ...@@ -1114,7 +1120,7 @@ static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
return 0; 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, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Auto Mute Switch", .name = "Auto Mute Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -1129,7 +1135,7 @@ static snd_kcontrol_new_t auto_mute_controls[] __initdata = { ...@@ -1129,7 +1135,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; int err;
chip->auto_mute = 1; chip->auto_mute = 1;
...@@ -1146,13 +1152,13 @@ int __init snd_pmac_add_automute(pmac_t *chip) ...@@ -1146,13 +1152,13 @@ int __init snd_pmac_add_automute(pmac_t *chip)
/* /*
* create and detect a pmac chip record * 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; struct device_node *np;
int i, err; int i, err;
unsigned long ctrl_addr, txdma_addr, rxdma_addr; 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, .dev_free = snd_pmac_dev_free,
}; };
...@@ -1322,9 +1328,9 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) ...@@ -1322,9 +1328,9 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
* Save state when going to sleep, restore it afterwards. * Save state when going to sleep, restore it afterwards.
*/ */
static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) static int snd_pmac_suspend(struct snd_card *card, pm_message_t state)
{ {
pmac_t *chip = card->pm_private_data; struct snd_pmac *chip = card->pm_private_data;
unsigned long flags; unsigned long flags;
if (chip->suspend) if (chip->suspend)
...@@ -1343,9 +1349,9 @@ static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) ...@@ -1343,9 +1349,9 @@ static int snd_pmac_suspend(snd_card_t *card, pm_message_t state)
return 0; return 0;
} }
static int snd_pmac_resume(snd_card_t *card) static int snd_pmac_resume(struct snd_card *card)
{ {
pmac_t *chip = card->pm_private_data; struct snd_pmac *chip = card->pm_private_data;
snd_pmac_sound_feature(chip, 1); snd_pmac_sound_feature(chip, 1);
if (chip->resume) if (chip->resume)
...@@ -1372,11 +1378,11 @@ static int snd_pmac_resume(snd_card_t *card) ...@@ -1372,11 +1378,11 @@ static int snd_pmac_resume(snd_card_t *card)
/* the chip is stored statically by snd_pmac_register_sleep_notifier /* the chip is stored statically by snd_pmac_register_sleep_notifier
* because we can't have any private data for notify callback. * because we can't have any private data for notify callback.
*/ */
static pmac_t *sleeping_pmac = NULL; static struct snd_pmac *sleeping_pmac = NULL;
static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when) static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when)
{ {
pmac_t *chip; struct snd_pmac *chip;
chip = sleeping_pmac; chip = sleeping_pmac;
if (! chip) if (! chip)
...@@ -1397,7 +1403,7 @@ static struct pmu_sleep_notifier snd_pmac_sleep_notifier = { ...@@ -1397,7 +1403,7 @@ static struct pmu_sleep_notifier snd_pmac_sleep_notifier = {
snd_pmac_sleep_notify, SLEEP_LEVEL_SOUND, snd_pmac_sleep_notify, SLEEP_LEVEL_SOUND,
}; };
static int __init snd_pmac_register_sleep_notifier(pmac_t *chip) static int __init snd_pmac_register_sleep_notifier(struct snd_pmac *chip)
{ {
/* should be protected here.. */ /* should be protected here.. */
snd_assert(! sleeping_pmac, return -EBUSY); snd_assert(! sleeping_pmac, return -EBUSY);
...@@ -1406,7 +1412,7 @@ static int __init snd_pmac_register_sleep_notifier(pmac_t *chip) ...@@ -1406,7 +1412,7 @@ static int __init snd_pmac_register_sleep_notifier(pmac_t *chip)
return 0; return 0;
} }
static int snd_pmac_unregister_sleep_notifier(pmac_t *chip) static int snd_pmac_unregister_sleep_notifier(struct snd_pmac *chip)
{ {
/* should be protected here.. */ /* should be protected here.. */
snd_assert(sleeping_pmac == chip, return -ENODEV); snd_assert(sleeping_pmac == chip, return -ENODEV);
......
...@@ -46,19 +46,10 @@ ...@@ -46,19 +46,10 @@
#define PMAC_SUPPORT_AUTOMUTE #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 * DBDMA space
*/ */
struct snd_pmac_dbdma { struct pmac_dbdma {
dma_addr_t dma_base; dma_addr_t dma_base;
dma_addr_t addr; dma_addr_t addr;
struct dbdma_cmd __iomem *cmds; struct dbdma_cmd __iomem *cmds;
...@@ -69,7 +60,7 @@ struct snd_pmac_dbdma { ...@@ -69,7 +60,7 @@ struct snd_pmac_dbdma {
/* /*
* playback/capture stream * playback/capture stream
*/ */
struct snd_pmac_stream { struct pmac_stream {
int running; /* boolean */ int running; /* boolean */
int stream; /* PLAYBACK/CAPTURE */ int stream; /* PLAYBACK/CAPTURE */
...@@ -79,10 +70,10 @@ struct snd_pmac_stream { ...@@ -79,10 +70,10 @@ struct snd_pmac_stream {
int buffer_size; /* in kbytes */ int buffer_size; /* in kbytes */
int nperiods, cur_period; int nperiods, cur_period;
pmac_dbdma_t cmd; struct pmac_dbdma cmd;
volatile struct dbdma_regs __iomem *dma; 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_freqs; /* currently available frequencies */
unsigned int cur_formats; /* currently available formats */ unsigned int cur_formats; /* currently available formats */
...@@ -98,7 +89,7 @@ enum snd_pmac_model { ...@@ -98,7 +89,7 @@ enum snd_pmac_model {
}; };
struct snd_pmac { struct snd_pmac {
snd_card_t *card; struct snd_card *card;
/* h/w info */ /* h/w info */
struct device_node *node; struct device_node *node;
...@@ -140,75 +131,75 @@ struct snd_pmac { ...@@ -140,75 +131,75 @@ struct snd_pmac {
unsigned char __iomem *latch_base; unsigned char __iomem *latch_base;
unsigned char __iomem *macio_base; unsigned char __iomem *macio_base;
pmac_stream_t playback; struct pmac_stream playback;
pmac_stream_t capture; struct pmac_stream capture;
pmac_dbdma_t extra_dma; struct pmac_dbdma extra_dma;
int irq, tx_irq, rx_irq; 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 */ unsigned int control_mask; /* control mask */
/* mixer stuffs */ /* mixer stuffs */
void *mixer_data; void *mixer_data;
void (*mixer_free)(pmac_t *); void (*mixer_free)(struct snd_pmac *);
snd_kcontrol_t *master_sw_ctl; struct snd_kcontrol *master_sw_ctl;
snd_kcontrol_t *speaker_sw_ctl; struct snd_kcontrol *speaker_sw_ctl;
snd_kcontrol_t *drc_sw_ctl; /* only used for tumbler -ReneR */ struct snd_kcontrol *drc_sw_ctl; /* only used for tumbler -ReneR */
snd_kcontrol_t *hp_detect_ctl; struct snd_kcontrol *hp_detect_ctl;
snd_kcontrol_t *lineout_sw_ctl; struct snd_kcontrol *lineout_sw_ctl;
/* lowlevel callbacks */ /* lowlevel callbacks */
void (*set_format)(pmac_t *chip); void (*set_format)(struct snd_pmac *chip);
void (*update_automute)(pmac_t *chip, int do_notify); void (*update_automute)(struct snd_pmac *chip, int do_notify);
int (*detect_headphone)(pmac_t *chip); int (*detect_headphone)(struct snd_pmac *chip);
#ifdef CONFIG_PM #ifdef CONFIG_PM
void (*suspend)(pmac_t *chip); void (*suspend)(struct snd_pmac *chip);
void (*resume)(pmac_t *chip); void (*resume)(struct snd_pmac *chip);
#endif #endif
}; };
/* exported functions */ /* exported functions */
int snd_pmac_new(snd_card_t *card, pmac_t **chip_return); int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return);
int snd_pmac_pcm_new(pmac_t *chip); int snd_pmac_pcm_new(struct snd_pmac *chip);
int snd_pmac_attach_beep(pmac_t *chip); int snd_pmac_attach_beep(struct snd_pmac *chip);
void snd_pmac_detach_beep(pmac_t *chip); void snd_pmac_detach_beep(struct snd_pmac *chip);
void snd_pmac_beep_stop(pmac_t *chip); void snd_pmac_beep_stop(struct snd_pmac *chip);
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);
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);
void snd_pmac_beep_dma_stop(pmac_t *chip); void snd_pmac_beep_dma_stop(struct snd_pmac *chip);
/* initialize mixer */ /* initialize mixer */
int snd_pmac_awacs_init(pmac_t *chip); int snd_pmac_awacs_init(struct snd_pmac *chip);
int snd_pmac_burgundy_init(pmac_t *chip); int snd_pmac_burgundy_init(struct snd_pmac *chip);
int snd_pmac_daca_init(pmac_t *chip); int snd_pmac_daca_init(struct snd_pmac *chip);
int snd_pmac_tumbler_init(pmac_t *chip); int snd_pmac_tumbler_init(struct snd_pmac *chip);
int snd_pmac_tumbler_post_init(void); 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 */ /* i2c functions */
typedef struct snd_pmac_keywest { struct pmac_keywest {
int addr; int addr;
struct i2c_client *client; struct i2c_client *client;
int id; int id;
int (*init_client)(struct snd_pmac_keywest *i2c); int (*init_client)(struct pmac_keywest *i2c);
char *name; char *name;
} pmac_keywest_t; };
int snd_pmac_keywest_init(pmac_keywest_t *i2c); int snd_pmac_keywest_init(struct pmac_keywest *i2c);
void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c); void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c);
/* misc */ /* misc */
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);
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);
int snd_pmac_add_automute(pmac_t *chip); int snd_pmac_add_automute(struct snd_pmac *chip);
#endif /* __PMAC_H */ #endif /* __PMAC_H */
...@@ -49,15 +49,15 @@ MODULE_PARM_DESC(enable_beep, "Enable beep using PCM."); ...@@ -49,15 +49,15 @@ MODULE_PARM_DESC(enable_beep, "Enable beep using PCM.");
* card entry * card entry
*/ */
static snd_card_t *snd_pmac_card = NULL; static struct snd_card *snd_pmac_card = NULL;
/* /*
*/ */
static int __init snd_pmac_probe(void) static int __init snd_pmac_probe(void)
{ {
snd_card_t *card; struct snd_card *card;
pmac_t *chip; struct snd_pmac *chip;
char *name_ext; char *name_ext;
int err; int err;
......
...@@ -101,10 +101,10 @@ static int read_audio_gpio(struct pmac_gpio *gp) ...@@ -101,10 +101,10 @@ static int read_audio_gpio(struct pmac_gpio *gp)
enum { TOONIE_MUTE_HP, TOONIE_MUTE_AMP }; enum { TOONIE_MUTE_HP, TOONIE_MUTE_AMP };
static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol, static int toonie_get_mute_switch(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) 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_toonie *mix = chip->mixer_data;
struct pmac_gpio *gp; struct pmac_gpio *gp;
...@@ -124,10 +124,10 @@ static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol, ...@@ -124,10 +124,10 @@ static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol, static int toonie_put_mute_switch(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) 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_toonie *mix = chip->mixer_data;
struct pmac_gpio *gp; struct pmac_gpio *gp;
int val; int val;
...@@ -156,7 +156,7 @@ static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol, ...@@ -156,7 +156,7 @@ static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol,
return 0; 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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Headphone Playback Switch", .name = "Headphone Playback Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -164,7 +164,7 @@ static snd_kcontrol_new_t toonie_hp_sw __initdata = { ...@@ -164,7 +164,7 @@ static snd_kcontrol_new_t toonie_hp_sw __initdata = {
.put = toonie_put_mute_switch, .put = toonie_put_mute_switch,
.private_value = TOONIE_MUTE_HP, .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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PC Speaker Playback Switch", .name = "PC Speaker Playback Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -176,7 +176,7 @@ static snd_kcontrol_new_t toonie_speaker_sw __initdata = { ...@@ -176,7 +176,7 @@ static snd_kcontrol_new_t toonie_speaker_sw __initdata = {
/* /*
* auto-mute stuffs * 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; struct pmac_toonie *mix = chip->mixer_data;
int detect = 0; int detect = 0;
...@@ -186,8 +186,8 @@ static int toonie_detect_headphone(pmac_t *chip) ...@@ -186,8 +186,8 @@ static int toonie_detect_headphone(pmac_t *chip)
return detect; return detect;
} }
static void toonie_check_mute(pmac_t *chip, struct pmac_gpio *gp, int val, static void toonie_check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val,
int do_notify, snd_kcontrol_t *sw) int do_notify, struct snd_kcontrol *sw)
{ {
if (check_audio_gpio(gp) != val) { if (check_audio_gpio(gp) != val) {
write_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, ...@@ -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) 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; struct pmac_toonie *mix;
int headphone; int headphone;
...@@ -232,7 +232,7 @@ static void toonie_detect_handler(void *self) ...@@ -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) { if (chip->auto_mute) {
struct pmac_toonie *mix; struct pmac_toonie *mix;
...@@ -246,7 +246,7 @@ static void toonie_update_automute(pmac_t *chip, int do_notify) ...@@ -246,7 +246,7 @@ static void toonie_update_automute(pmac_t *chip, int do_notify)
/* interrupt - headphone plug changed */ /* interrupt - headphone plug changed */
static irqreturn_t toonie_hp_intr(int irq, void *devid, struct pt_regs *regs) 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) { if (chip->update_automute && chip->initialized) {
chip->update_automute(chip, 1); chip->update_automute(chip, 1);
...@@ -325,7 +325,7 @@ static int find_audio_gpio(const char *name, const char *platform, ...@@ -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; 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; struct pmac_toonie *mix = chip->mixer_data;
if (! mix) if (! mix)
...@@ -336,7 +336,7 @@ static void toonie_cleanup(pmac_t *chip) ...@@ -336,7 +336,7 @@ static void toonie_cleanup(pmac_t *chip)
chip->mixer_data = NULL; 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; struct pmac_toonie *mix;
......
...@@ -82,21 +82,21 @@ enum { ...@@ -82,21 +82,21 @@ enum {
VOL_IDX_LAST_MIX VOL_IDX_LAST_MIX
}; };
typedef struct pmac_gpio { struct pmac_gpio {
unsigned int addr; unsigned int addr;
u8 active_val; u8 active_val;
u8 inactive_val; u8 inactive_val;
u8 active_state; u8 active_state;
} pmac_gpio_t; };
typedef struct pmac_tumbler_t { struct pmac_tumbler {
pmac_keywest_t i2c; struct pmac_keywest i2c;
pmac_gpio_t audio_reset; struct pmac_gpio audio_reset;
pmac_gpio_t amp_mute; struct pmac_gpio amp_mute;
pmac_gpio_t line_mute; struct pmac_gpio line_mute;
pmac_gpio_t line_detect; struct pmac_gpio line_detect;
pmac_gpio_t hp_mute; struct pmac_gpio hp_mute;
pmac_gpio_t hp_detect; struct pmac_gpio hp_detect;
int headphone_irq; int headphone_irq;
int lineout_irq; int lineout_irq;
unsigned int save_master_vol[2]; unsigned int save_master_vol[2];
...@@ -112,13 +112,13 @@ typedef struct pmac_tumbler_t { ...@@ -112,13 +112,13 @@ typedef struct pmac_tumbler_t {
int auto_mute_notify; int auto_mute_notify;
int reset_on_sleep; int reset_on_sleep;
u8 acs; 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) { while (*regs > 0) {
int err, count = 10; int err, count = 10;
...@@ -138,7 +138,7 @@ static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs) ...@@ -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[] = { static unsigned int regs[] = {
/* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
...@@ -149,7 +149,7 @@ static int tumbler_init_client(pmac_keywest_t *i2c) ...@@ -149,7 +149,7 @@ static int tumbler_init_client(pmac_keywest_t *i2c)
return send_init_client(i2c, regs); 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[] = { static unsigned int regs[] = {
/* normal operation, SCLK=64fps, i2s output, 16bit width */ /* normal operation, SCLK=64fps, i2s output, 16bit width */
...@@ -173,7 +173,7 @@ static int snapper_init_client(pmac_keywest_t *i2c) ...@@ -173,7 +173,7 @@ static int snapper_init_client(pmac_keywest_t *i2c)
pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, (gp)->addr, 0) pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, (gp)->addr, 0)
#define tumbler_gpio_free(gp) /* NOP */ #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) if (! gp->addr)
return; return;
...@@ -182,7 +182,7 @@ static void write_audio_gpio(pmac_gpio_t *gp, int active) ...@@ -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); 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; int ret;
...@@ -194,7 +194,7 @@ static int check_audio_gpio(pmac_gpio_t *gp) ...@@ -194,7 +194,7 @@ static int check_audio_gpio(pmac_gpio_t *gp)
return (ret & 0xd) == (gp->active_val & 0xd); 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; int ret;
if (! gp->addr) if (! gp->addr)
...@@ -206,7 +206,7 @@ static int read_audio_gpio(pmac_gpio_t *gp) ...@@ -206,7 +206,7 @@ static int read_audio_gpio(pmac_gpio_t *gp)
/* /*
* update master volume * 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 char block[6];
unsigned int left_vol, right_vol; unsigned int left_vol, right_vol;
...@@ -249,7 +249,8 @@ static int tumbler_set_master_volume(pmac_tumbler_t *mix) ...@@ -249,7 +249,8 @@ static int tumbler_set_master_volume(pmac_tumbler_t *mix)
/* output volume */ /* 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -258,20 +259,22 @@ static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf ...@@ -258,20 +259,22 @@ static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
snd_assert(mix, return -ENODEV); snd_assert(mix, return -ENODEV);
ucontrol->value.integer.value[0] = mix->master_vol[0]; ucontrol->value.integer.value[0] = mix->master_vol[0];
ucontrol->value.integer.value[1] = mix->master_vol[1]; ucontrol->value.integer.value[1] = mix->master_vol[1];
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
int change; int change;
snd_assert(mix, return -ENODEV); snd_assert(mix, return -ENODEV);
...@@ -286,20 +289,22 @@ static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu ...@@ -286,20 +289,22 @@ static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu
} }
/* output switch */ /* 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
snd_assert(mix, return -ENODEV); snd_assert(mix, return -ENODEV);
ucontrol->value.integer.value[0] = mix->master_switch[0]; ucontrol->value.integer.value[0] = mix->master_switch[0];
ucontrol->value.integer.value[1] = mix->master_switch[1]; ucontrol->value.integer.value[1] = mix->master_switch[1];
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
int change; int change;
snd_assert(mix, return -ENODEV); snd_assert(mix, return -ENODEV);
...@@ -320,7 +325,7 @@ static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu ...@@ -320,7 +325,7 @@ static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu
#define TAS3001_DRC_MAX 0x5f #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]; unsigned char val[2];
...@@ -354,7 +359,7 @@ static int tumbler_set_drc(pmac_tumbler_t *mix) ...@@ -354,7 +359,7 @@ static int tumbler_set_drc(pmac_tumbler_t *mix)
#define TAS3004_DRC_MAX 0xef #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]; unsigned char val[6];
...@@ -384,9 +389,10 @@ static int snapper_set_drc(pmac_tumbler_t *mix) ...@@ -384,9 +389,10 @@ static int snapper_set_drc(pmac_tumbler_t *mix)
return 0; 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
uinfo->value.integer.min = 0; uinfo->value.integer.min = 0;
...@@ -395,20 +401,22 @@ static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -395,20 +401,22 @@ static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->drc_range; ucontrol->value.integer.value[0] = mix->drc_range;
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -424,20 +432,22 @@ static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t ...@@ -424,20 +432,22 @@ static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
return change; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->drc_enable; ucontrol->value.integer.value[0] = mix->drc_enable;
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -466,7 +476,8 @@ struct tumbler_mono_vol { ...@@ -466,7 +476,8 @@ struct tumbler_mono_vol {
unsigned int *table; 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 char block[4];
unsigned int vol; unsigned int vol;
...@@ -489,7 +500,8 @@ static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol ...@@ -489,7 +500,8 @@ static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol
return 0; 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; 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 ...@@ -500,22 +512,24 @@ static int tumbler_info_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf
return 0; 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; struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value;
pmac_t *chip = snd_kcontrol_chip(kcontrol); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->mono_vol[info->index]; ucontrol->value.integer.value[0] = mix->mono_vol[info->index];
return 0; 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; struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value;
pmac_t *chip = snd_kcontrol_chip(kcontrol); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -594,7 +608,7 @@ static struct tumbler_mono_vol snapper_treble_vol_info = { ...@@ -594,7 +608,7 @@ static struct tumbler_mono_vol snapper_treble_vol_info = {
* snapper mixer volumes * 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; int i, j, vol;
unsigned char block[9]; unsigned char block[9];
...@@ -618,7 +632,7 @@ static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg) ...@@ -618,7 +632,7 @@ static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg)
return 0; 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) if (! mix->i2c.client)
return -ENODEV; return -ENODEV;
...@@ -628,7 +642,8 @@ static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx) ...@@ -628,7 +642,8 @@ static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx)
return 0; 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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -637,11 +652,12 @@ static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo ...@@ -637,11 +652,12 @@ static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo
return 0; 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; int idx = (int)kcontrol->private_value;
pmac_t *chip = snd_kcontrol_chip(kcontrol); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
ucontrol->value.integer.value[0] = mix->mix_vol[idx][0]; 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 ...@@ -649,11 +665,12 @@ static int snapper_get_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont
return 0; 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; int idx = (int)kcontrol->private_value;
pmac_t *chip = snd_kcontrol_chip(kcontrol); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
int change; int change;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
...@@ -676,11 +693,12 @@ static int snapper_put_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont ...@@ -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 }; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
pmac_gpio_t *gp; struct pmac_gpio *gp;
if (! (mix = chip->mixer_data)) if (! (mix = chip->mixer_data))
return -ENODEV; return -ENODEV;
switch(kcontrol->private_value) { switch(kcontrol->private_value) {
...@@ -699,11 +717,12 @@ static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ ...@@ -699,11 +717,12 @@ static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
pmac_gpio_t *gp; struct pmac_gpio *gp;
int val; int val;
#ifdef PMAC_SUPPORT_AUTOMUTE #ifdef PMAC_SUPPORT_AUTOMUTE
if (chip->update_automute && chip->auto_mute) 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_ ...@@ -731,7 +750,7 @@ static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
return 0; 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) if (! mix->i2c.client)
return -ENODEV; return -ENODEV;
...@@ -742,7 +761,8 @@ static int snapper_set_capture_source(pmac_tumbler_t *mix) ...@@ -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); 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] = { static char *texts[2] = {
"Line", "Mic" "Line", "Mic"
...@@ -756,20 +776,22 @@ static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_in ...@@ -756,20 +776,22 @@ static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_in
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
snd_assert(mix, return -ENODEV); snd_assert(mix, return -ENODEV);
ucontrol->value.integer.value[0] = mix->capture_source; ucontrol->value.integer.value[0] = mix->capture_source;
return 0; 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); struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
int change; int change;
snd_assert(mix, return -ENODEV); snd_assert(mix, return -ENODEV);
...@@ -794,7 +816,7 @@ static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_val ...@@ -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, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume", .name = "Master Playback Volume",
.info = tumbler_info_master_volume, .info = tumbler_info_master_volume,
...@@ -818,7 +840,7 @@ static snd_kcontrol_new_t tumbler_mixers[] __initdata = { ...@@ -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, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume", .name = "Master Playback Volume",
.info = tumbler_info_master_volume, .info = tumbler_info_master_volume,
...@@ -850,7 +872,7 @@ static snd_kcontrol_new_t snapper_mixers[] __initdata = { ...@@ -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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Headphone Playback Switch", .name = "Headphone Playback Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -858,7 +880,7 @@ static snd_kcontrol_new_t tumbler_hp_sw __initdata = { ...@@ -858,7 +880,7 @@ static snd_kcontrol_new_t tumbler_hp_sw __initdata = {
.put = tumbler_put_mute_switch, .put = tumbler_put_mute_switch,
.private_value = TUMBLER_MUTE_HP, .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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PC Speaker Playback Switch", .name = "PC Speaker Playback Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -866,7 +888,7 @@ static snd_kcontrol_new_t tumbler_speaker_sw __initdata = { ...@@ -866,7 +888,7 @@ static snd_kcontrol_new_t tumbler_speaker_sw __initdata = {
.put = tumbler_put_mute_switch, .put = tumbler_put_mute_switch,
.private_value = TUMBLER_MUTE_AMP, .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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Line Out Playback Switch", .name = "Line Out Playback Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -874,7 +896,7 @@ static snd_kcontrol_new_t tumbler_lineout_sw __initdata = { ...@@ -874,7 +896,7 @@ static snd_kcontrol_new_t tumbler_lineout_sw __initdata = {
.put = tumbler_put_mute_switch, .put = tumbler_put_mute_switch,
.private_value = TUMBLER_MUTE_LINE, .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, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "DRC Switch", .name = "DRC Switch",
.info = snd_pmac_boolean_mono_info, .info = snd_pmac_boolean_mono_info,
...@@ -887,9 +909,9 @@ static snd_kcontrol_new_t tumbler_drc_sw __initdata = { ...@@ -887,9 +909,9 @@ static snd_kcontrol_new_t tumbler_drc_sw __initdata = {
/* /*
* auto-mute stuffs * 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; int detect = 0;
if (mix->hp_detect.addr) if (mix->hp_detect.addr)
...@@ -897,9 +919,9 @@ static int tumbler_detect_headphone(pmac_t *chip) ...@@ -897,9 +919,9 @@ static int tumbler_detect_headphone(pmac_t *chip)
return detect; 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; int detect = 0;
if (mix->line_detect.addr) if (mix->line_detect.addr)
...@@ -907,7 +929,8 @@ static int tumbler_detect_lineout(pmac_t *chip) ...@@ -907,7 +929,8 @@ static int tumbler_detect_lineout(pmac_t *chip)
return detect; 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) { if (check_audio_gpio(gp) != val) {
write_audio_gpio(gp, val); write_audio_gpio(gp, val);
...@@ -921,8 +944,8 @@ static struct work_struct device_change; ...@@ -921,8 +944,8 @@ static struct work_struct device_change;
static void device_change_handler(void *self) static void device_change_handler(void *self)
{ {
pmac_t *chip = (pmac_t*) self; struct snd_pmac *chip = self;
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
int headphone, lineout; int headphone, lineout;
if (!chip) if (!chip)
...@@ -979,10 +1002,10 @@ static void device_change_handler(void *self) ...@@ -979,10 +1002,10 @@ static void device_change_handler(void *self)
tumbler_set_master_volume(mix); 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) { if (chip->auto_mute) {
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
mix = chip->mixer_data; mix = chip->mixer_data;
snd_assert(mix, return); snd_assert(mix, return);
mix->auto_mute_notify = do_notify; mix->auto_mute_notify = do_notify;
...@@ -995,7 +1018,7 @@ static void tumbler_update_automute(pmac_t *chip, int do_notify) ...@@ -995,7 +1018,7 @@ static void tumbler_update_automute(pmac_t *chip, int do_notify)
/* interrupt - headphone plug changed */ /* interrupt - headphone plug changed */
static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs) 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) { if (chip->update_automute && chip->initialized) {
chip->update_automute(chip, 1); chip->update_automute(chip, 1);
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -1035,7 +1058,8 @@ static struct device_node *find_compatible_audio_device(const char *name) ...@@ -1035,7 +1058,8 @@ static struct device_node *find_compatible_audio_device(const char *name)
} }
/* find an audio device and get its address */ /* 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; struct device_node *node;
u32 *base, addr; u32 *base, addr;
...@@ -1101,9 +1125,9 @@ static long tumbler_find_device(const char *device, const char *platform, pmac_g ...@@ -1101,9 +1125,9 @@ static long tumbler_find_device(const char *device, const char *platform, pmac_g
} }
/* reset audio */ /* 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) { if (mix->anded_reset) {
DBG("(I) codec anded reset !\n"); DBG("(I) codec anded reset !\n");
...@@ -1130,9 +1154,9 @@ static void tumbler_reset_audio(pmac_t *chip) ...@@ -1130,9 +1154,9 @@ static void tumbler_reset_audio(pmac_t *chip)
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* suspend mixer */ /* 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) if (mix->headphone_irq >= 0)
disable_irq(mix->headphone_irq); disable_irq(mix->headphone_irq);
...@@ -1160,9 +1184,9 @@ static void tumbler_suspend(pmac_t *chip) ...@@ -1160,9 +1184,9 @@ static void tumbler_suspend(pmac_t *chip)
} }
/* resume mixer */ /* 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); snd_assert(mix, return);
...@@ -1208,10 +1232,10 @@ static void tumbler_resume(pmac_t *chip) ...@@ -1208,10 +1232,10 @@ static void tumbler_resume(pmac_t *chip)
#endif #endif
/* initialize tumbler */ /* initialize tumbler */
static int __init tumbler_init(pmac_t *chip) static int __init tumbler_init(struct snd_pmac *chip)
{ {
int irq; int irq;
pmac_tumbler_t *mix = chip->mixer_data; struct pmac_tumbler *mix = chip->mixer_data;
snd_assert(mix, return -EINVAL); snd_assert(mix, return -EINVAL);
if (tumbler_find_device("audio-hw-reset", if (tumbler_find_device("audio-hw-reset",
...@@ -1259,9 +1283,9 @@ static int __init tumbler_init(pmac_t *chip) ...@@ -1259,9 +1283,9 @@ static int __init tumbler_init(pmac_t *chip)
return 0; 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) if (! mix)
return; return;
...@@ -1279,10 +1303,10 @@ static void tumbler_cleanup(pmac_t *chip) ...@@ -1279,10 +1303,10 @@ static void tumbler_cleanup(pmac_t *chip)
} }
/* exported */ /* exported */
int __init snd_pmac_tumbler_init(pmac_t *chip) int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
{ {
int i, err; int i, err;
pmac_tumbler_t *mix; struct pmac_tumbler *mix;
u32 *paddr; u32 *paddr;
struct device_node *tas_node, *np; struct device_node *tas_node, *np;
char *chipname; char *chipname;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment