X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=sound%2Fpci%2Fac97%2Fac97_patch.h;h=47bf8dfe82768fe1c0b9338f7a9f10dd2cc2124e;hb=cd32b1616bc79b2f2ce1b1c6164beecfecc2259c;hp=94340daaaf1f7a64835c2923b0780230fd01a260;hpb=9468482bd4c3b89abe04a770848d5eaa1ea830b0;p=karo-tx-linux.git diff --git a/sound/pci/ac97/ac97_patch.h b/sound/pci/ac97/ac97_patch.h index 94340daaaf1f..47bf8dfe8276 100644 --- a/sound/pci/ac97/ac97_patch.h +++ b/sound/pci/ac97/ac97_patch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) by Jaroslav Kysela + * Copyright (c) by Jaroslav Kysela * Universal interface for Audio Codec '97 * * For more details look to AC '97 component specification revision 2.2 @@ -22,43 +22,74 @@ * */ -int patch_yamaha_ymf753(struct snd_ac97 * ac97); -int patch_wolfson00(struct snd_ac97 * ac97); -int patch_wolfson03(struct snd_ac97 * ac97); -int patch_wolfson04(struct snd_ac97 * ac97); -int patch_wolfson05(struct snd_ac97 * ac97); -int patch_wolfson11(struct snd_ac97 * ac97); -int patch_wolfson13(struct snd_ac97 * ac97); -int patch_tritech_tr28028(struct snd_ac97 * ac97); -int patch_sigmatel_stac9700(struct snd_ac97 * ac97); -int patch_sigmatel_stac9708(struct snd_ac97 * ac97); -int patch_sigmatel_stac9721(struct snd_ac97 * ac97); -int patch_sigmatel_stac9744(struct snd_ac97 * ac97); -int patch_sigmatel_stac9756(struct snd_ac97 * ac97); -int patch_sigmatel_stac9758(struct snd_ac97 * ac97); -int patch_cirrus_cs4299(struct snd_ac97 * ac97); -int patch_cirrus_spdif(struct snd_ac97 * ac97); -int patch_conexant(struct snd_ac97 * ac97); -int patch_ad1819(struct snd_ac97 * ac97); -int patch_ad1881(struct snd_ac97 * ac97); -int patch_ad1885(struct snd_ac97 * ac97); -int patch_ad1886(struct snd_ac97 * ac97); -int patch_ad1888(struct snd_ac97 * ac97); -int patch_ad1980(struct snd_ac97 * ac97); -int patch_ad1981a(struct snd_ac97 * ac97); -int patch_ad1981b(struct snd_ac97 * ac97); -int patch_ad1985(struct snd_ac97 * ac97); -int patch_ad1986(struct snd_ac97 * ac97); -int patch_alc650(struct snd_ac97 * ac97); -int patch_alc655(struct snd_ac97 * ac97); -int patch_alc850(struct snd_ac97 * ac97); -int patch_cm9738(struct snd_ac97 * ac97); -int patch_cm9739(struct snd_ac97 * ac97); -int patch_cm9761(struct snd_ac97 * ac97); -int patch_cm9780(struct snd_ac97 * ac97); -int patch_vt1616(struct snd_ac97 * ac97); -int patch_vt1617a(struct snd_ac97 * ac97); -int patch_it2646(struct snd_ac97 * ac97); -int patch_ucb1400(struct snd_ac97 * ac97); -int mpatch_si3036(struct snd_ac97 * ac97); -int patch_lm4550(struct snd_ac97 * ac97); +#define AC97_SINGLE_VALUE(reg,shift,mask,invert) \ + ((reg) | ((shift) << 8) | ((shift) << 12) | ((mask) << 16) | \ + ((invert) << 24)) +#define AC97_PAGE_SINGLE_VALUE(reg,shift,mask,invert,page) \ + (AC97_SINGLE_VALUE(reg,shift,mask,invert) | (1<<25) | ((page) << 26)) +#define AC97_SINGLE(xname, reg, shift, mask, invert) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_ac97_info_volsw, \ + .get = snd_ac97_get_volsw, .put = snd_ac97_put_volsw, \ + .private_value = AC97_SINGLE_VALUE(reg, shift, mask, invert) } +#define AC97_PAGE_SINGLE(xname, reg, shift, mask, invert, page) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_ac97_info_volsw, \ + .get = snd_ac97_get_volsw, .put = snd_ac97_put_volsw, \ + .private_value = AC97_PAGE_SINGLE_VALUE(reg, shift, mask, invert, page) } +#define AC97_DOUBLE(xname, reg, shift_left, shift_right, mask, invert) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ + .info = snd_ac97_info_volsw, \ + .get = snd_ac97_get_volsw, .put = snd_ac97_put_volsw, \ + .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) | ((mask) << 16) | ((invert) << 24) } + +/* enum control */ +struct ac97_enum { + unsigned char reg; + unsigned char shift_l; + unsigned char shift_r; + unsigned short mask; + const char **texts; +}; + +#define AC97_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ +{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ + .mask = xmask, .texts = xtexts } +#define AC97_ENUM_SINGLE(xreg, xshift, xmask, xtexts) \ + AC97_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xtexts) +#define AC97_ENUM(xname, xenum) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_ac97_info_enum_double, \ + .get = snd_ac97_get_enum_double, .put = snd_ac97_put_enum_double, \ + .private_value = (unsigned long)&xenum } + +/* ac97_codec.c */ +static const struct snd_kcontrol_new snd_ac97_controls_3d[]; +static const struct snd_kcontrol_new snd_ac97_controls_spdif[]; +static struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, + struct snd_ac97 * ac97); +static int snd_ac97_info_volsw(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo); +static int snd_ac97_get_volsw(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); +static int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); +static int snd_ac97_try_bit(struct snd_ac97 * ac97, int reg, int bit); +static int snd_ac97_remove_ctl(struct snd_ac97 *ac97, const char *name, + const char *suffix); +static int snd_ac97_rename_ctl(struct snd_ac97 *ac97, const char *src, + const char *dst, const char *suffix); +static int snd_ac97_swap_ctl(struct snd_ac97 *ac97, const char *s1, + const char *s2, const char *suffix); +static void snd_ac97_rename_vol_ctl(struct snd_ac97 *ac97, const char *src, + const char *dst); +#ifdef CONFIG_PM +static void snd_ac97_restore_status(struct snd_ac97 *ac97); +static void snd_ac97_restore_iec958(struct snd_ac97 *ac97); +#endif +static int snd_ac97_info_enum_double(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo); +static int snd_ac97_get_enum_double(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); +static int snd_ac97_put_enum_double(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol);