From 2eda344546caaf9168e778a4007f4609e95106e0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 11 Aug 2008 10:18:39 +0200 Subject: ALSA: hda - Add a new function to seek for a codec ID Gateway notebooks have their ID inside codec vendor ID, not at PCI ID. Due to that, model auto-detection were not possible with the standard seek method. This is what is found at lspci -vnn: 00:14.2 Audio device [0403]: ATI Technologies Inc SB450 HDA Audio [1002:437b] (rev 01) Subsystem: ATI Technologies Inc SB450 HDA Audio [1002:437b] Yet, autodetection is possible, since the codec properly reflects the vendor at the Subsystem ID: $ cat /proc/asound/card0/codec#0 |head -4 Codec: SigmaTel STAC9250 Address: 0 Vendor Id: 0x83847634 Subsystem Id: 0x107b0367 This patch adds a new autodetection function that seeks for codec subsystem ID. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ sound/pci/hda/hda_local.h | 3 +++ 2 files changed, 64 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 004344825e9e..9c1af0101dde 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2704,6 +2704,67 @@ int snd_hda_check_board_config(struct hda_codec *codec, } EXPORT_SYMBOL_HDA(snd_hda_check_board_config); +/** + * snd_hda_check_board_codec_sid_config - compare the current codec + subsystem ID with the + config table + + This is important for Gateway notebooks with SB450 HDA Audio + where the vendor ID of the PCI device is: + ATI Technologies Inc SB450 HDA Audio [1002:437b] + and the vendor/subvendor are found only at the codec. + + * @codec: the HDA codec + * @num_configs: number of config enums + * @models: array of model name strings + * @tbl: configuration table, terminated by null entries + * + * Compares the modelname or PCI subsystem id of the current codec with the + * given configuration table. If a matching entry is found, returns its + * config value (supposed to be 0 or positive). + * + * If no entries are matching, the function returns a negative value. + */ +int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, + int num_configs, const char **models, + const struct snd_pci_quirk *tbl) +{ + const struct snd_pci_quirk *q; + + /* Search for codec ID */ + for (q = tbl; q->subvendor; q++) { + unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); + + if (vendorid == codec->subsystem_id) + break; + } + + if (!q->subvendor) + return -1; + + tbl = q; + + if (tbl->value >= 0 && tbl->value < num_configs) { +#ifdef CONFIG_SND_DEBUG_DETECT + char tmp[10]; + const char *model = NULL; + if (models) + model = models[tbl->value]; + if (!model) { + sprintf(tmp, "#%d", tbl->value); + model = tmp; + } + snd_printdd(KERN_INFO "hda_codec: model '%s' is selected " + "for config %x:%x (%s)\n", + model, tbl->subvendor, tbl->subdevice, + (tbl->name ? tbl->name : "Unknown device")); +#endif + return tbl->value; + } + return -1; +} +EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config); + /** * snd_hda_add_new_ctls - create controls from the array * @codec: the HDA codec diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 6f2fe0f9fdd8..1dd8716c387f 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -296,6 +296,9 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen); int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, const char **modelnames, const struct snd_pci_quirk *pci_list); +int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, + int num_configs, const char **models, + const struct snd_pci_quirk *tbl); int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew); -- cgit v1.2.3 From 9cb36c2afc298a2f2085ae0071924b7e3f55e72d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 11 Aug 2008 10:18:39 +0200 Subject: ALSA: patch_sigmatel: Add missing Gateway entries and autodetection Gateway autodetection and entries are incomplete. This patch adds the entries found at the .INI file for their driver version 5.10.5082.0. It also uses the proper code to seek for notebook ID, since this is based on codec subsystem ID on those devices. This should provide a proper pinup for several gateways notebooks: Gateway M465-E Notebook [Part #1008637] Gateway M465-G Notebook [Part #1008667] Gateway NX260X Notebook [Part #1008794] Gateway NX100X Notebook [Part #1008798] Gateway E-100M Notebook [Part #1008799] Gateway E-100M G Notebook [Part #1008800] Gateway M255-E Notebook [Part #1008801] Gateway M255-G Notebook [Part #1008803] Gateway M285-E Convertible Notebook [Part #1008804] Gateway M285-G Convertible Notebook [Part #1008805] Gateway CX210S Convertible Notebook [Part #1008807] Gateway CX210X Convertible Notebook [Part #1008808] Gateway E-100M SB Notebook [Part #1008973] Gateway M255-E SB Notebook [Part #1008989] Gateway M285-E SB Convertible Notebook [Part #1008990] Gateway M465-E Notebook [Part #1009022] Gateway CX2724 Convertible Notebook [Part #1009036] Gateway MX1025 Notebook [Part #1009046] Gateway CX2720 Convertible Notebook [Part #1009063] Gateway CX2724h Convertible Notebook [Part #1009089] Gateway MX1023 Notebook [Part #1009097] Gateway MX1023h Notebook [Part #1009098] Gateway NX260X Notebook [Part #1009112] Gateway E-100M Notebook [Part #1009126] Gateway MX7533 Notebook [Part #1009146] [Part #1009163] Gateway CX210X Convertible Notebook [Part #1009346] Gateway NX570X Notebook [Part #1009442] Gateway NX570X Notebook [Part #1009448] Gateway NX270S Notebook [Part #1009550] Gateway MX6448 Notebook [Part #1013912R] Gateway MX6453 Notebook [Part #1013913R] Gateway MX6216 Notebook [Part #1013916R] Gateway MX6931 Notebook [Part #1013918R] Gateway CX2726 Convertible Notebook [Part #1013921R] Gateway MP8708 Notebook [Part #1013924R] Gateway MX6446 Notebook [Part #1013927R] Gateway MX6930 Notebook [Part #1013928R] Gateway MX6447 Notebook [Part #1013932R] Gateway MX6454 Notebook [Part #1013943R] Gateway MX6439 Notebook [Part #1013947R] [Part #1013955R] [Part #1013971R] Gateway MX6930h Notebook [Part #1013973R] [Part #1013974R] [Part #1013975R] Gateway MX6955 Notebook [Part #1014028R] Gateway MX6956 Notebook [Part #1014033R] Gateway MX6959 Notebook [Part #1014061R] Gateway MX6957 Notebook [Part #1014065R] Gateway MX6960 Notebook [Part #1014068R] Gateway MX6958 Notebook [Part #1014072R] Gateway NX570X Notebook [Part #1014077R] Gateway NX570XL Notebook [Part #1014078R] Gateway NX570QS Notebook [Part #1014079R] Gateway MX6961 Notebook [Part #1014080R] [Part #1014106R] Gateway MX6961h Notebook [Part #1014112R] Gateway NX270S Notebook [Part #1014120R] Gateway MX6431 Notebook [Part #1014121R] Gateway MX8710 Notebook [Part #2905895R] Gateway MX3702 Notebook [Part #2905898R] Blade-K8F GW UMA Single Core Motherboard w/RS485M and 1394 - Quanta (FRU) [Part #4006133R] Since some entries conflict with existing pinups, I'm providing a separate patch to fix those entries. Tested only with Gateway MX6453. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 89 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9e07f44ab28a..e70ef0505304 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -93,7 +93,13 @@ enum { enum { STAC_925x_REF, + STAC_M1, + STAC_M1_2, + STAC_M2, STAC_M2_2, + STAC_M3, + STAC_M5, + STAC_M6, STAC_MA6, STAC_PA6, STAC_925x_MODELS @@ -1600,11 +1606,40 @@ static unsigned int ref925x_pin_configs[8] = { 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, }; +static unsigned int stac925xM1_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, +}; +static unsigned int stac925xM1_2_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, +}; +static unsigned int stac925xM2_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, +}; + +static unsigned int stac925xM3_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, +}; +static unsigned int stac925xM5_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, +}; + +/* Original M6 entry at .ini file */ +static unsigned int stac925xM6_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, +}; + static unsigned int stac925x_MA6_pin_configs[8] = { 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, }; +/* This entry should be M2 */ static unsigned int stac925x_PA6_pin_configs[8] = { 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, @@ -1617,27 +1652,55 @@ static unsigned int stac925xM2_2_pin_configs[8] = { static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { [STAC_REF] = ref925x_pin_configs, + [STAC_M1] = stac925xM1_pin_configs, + [STAC_M1_2] = stac925xM1_2_pin_configs, + [STAC_M2] = stac925xM2_pin_configs, [STAC_M2_2] = stac925xM2_2_pin_configs, + [STAC_M3] = stac925xM3_pin_configs, + [STAC_M5] = stac925xM5_pin_configs, + [STAC_M6] = stac925xM6_pin_configs, [STAC_MA6] = stac925x_MA6_pin_configs, [STAC_PA6] = stac925x_PA6_pin_configs, }; static const char *stac925x_models[STAC_925x_MODELS] = { [STAC_REF] = "ref", + [STAC_M1] = "m1", + [STAC_M1_2] = "m1-2", + [STAC_M2] = "m2", [STAC_M2_2] = "m2-2", - [STAC_MA6] = "m6", + [STAC_M3] = "m3", + [STAC_M5] = "m5", + [STAC_M6] = "m6", + [STAC_MA6] = "ma6", [STAC_PA6] = "pa6", }; -static struct snd_pci_quirk stac925x_cfg_tbl[] = { - /* SigmaTel reference board */ - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), - SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), +static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), + SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), - SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), + SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), + + /* Not sure about the brand name for those */ + SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), + SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), + SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), + SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), + + {} /* terminator */ +}; + +static struct snd_pci_quirk stac925x_cfg_tbl[] = { + /* SigmaTel reference board */ + SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), + SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), + + /* Default table for unknown ID */ + SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), + {} /* terminator */ }; @@ -4371,12 +4434,22 @@ static int patch_stac925x(struct hda_codec *codec) codec->spec = spec; spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); spec->pin_nids = stac925x_pin_nids; - spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, + + /* Check first for codec ID */ + spec->board_config = snd_hda_check_board_codec_sid_config(codec, + STAC_925x_MODELS, + stac925x_models, + stac925x_codec_id_cfg_tbl); + + /* Now checks for PCI ID, if codec ID is not found */ + if (spec->board_config < 0) + spec->board_config = snd_hda_check_board_config(codec, + STAC_925x_MODELS, stac925x_models, stac925x_cfg_tbl); again: if (spec->board_config < 0) { - snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," + snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," "using BIOS defaults\n"); err = stac92xx_save_bios_config_regs(codec); } else -- cgit v1.2.3 From 58eec4235d63e07b98544527e031e7ae807e15df Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 11 Aug 2008 10:18:39 +0200 Subject: ALSA: hda - More fixes on Gateway entries Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 72 +++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 39 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e70ef0505304..c05d4643afd5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -55,7 +55,8 @@ enum { STAC_9200_DELL_M25, STAC_9200_DELL_M26, STAC_9200_DELL_M27, - STAC_9200_GATEWAY, + STAC_9200_M4, + STAC_9200_M4_2, STAC_9200_PANASONIC, STAC_9200_MODELS }; @@ -100,8 +101,6 @@ enum { STAC_M3, STAC_M5, STAC_M6, - STAC_MA6, - STAC_PA6, STAC_925x_MODELS }; @@ -1375,7 +1374,16 @@ static unsigned int ref9200_pin_configs[8] = { 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, }; -/* +static unsigned int gateway9200_m4_pin_configs[8] = { + 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, + 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, +}; +static unsigned int gateway9200_m4_2_pin_configs[8] = { + 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, + 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, +}; + +/* STAC 9200 pin configs for 102801A8 102801DE @@ -1505,6 +1513,8 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, + [STAC_9200_M4] = gateway9200_m4_pin_configs, + [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, [STAC_9200_PANASONIC] = ref9200_pin_configs, }; @@ -1521,7 +1531,8 @@ static const char *stac9200_models[STAC_9200_MODELS] = { [STAC_9200_DELL_M25] = "dell-m25", [STAC_9200_DELL_M26] = "dell-m26", [STAC_9200_DELL_M27] = "dell-m27", - [STAC_9200_GATEWAY] = "gateway", + [STAC_9200_M4] = "gateway-m4", + [STAC_9200_M4_2] = "gateway-m4-2", [STAC_9200_PANASONIC] = "panasonic", }; @@ -1591,11 +1602,9 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { /* Panasonic */ SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), /* Gateway machines needs EAPD to be set on resume */ - SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), - SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", - STAC_9200_GATEWAY), - SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", - STAC_9200_GATEWAY), + SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), + SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), + SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), /* OQO Mobile */ SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), {} /* terminator */ @@ -1610,46 +1619,37 @@ static unsigned int stac925xM1_pin_configs[8] = { 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, }; + static unsigned int stac925xM1_2_pin_configs[8] = { 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, }; + static unsigned int stac925xM2_pin_configs[8] = { 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, }; +static unsigned int stac925xM2_2_pin_configs[8] = { + 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, + 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, +}; + static unsigned int stac925xM3_pin_configs[8] = { 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, }; + static unsigned int stac925xM5_pin_configs[8] = { 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, }; -/* Original M6 entry at .ini file */ static unsigned int stac925xM6_pin_configs[8] = { 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, }; -static unsigned int stac925x_MA6_pin_configs[8] = { - 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, - 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, -}; - -/* This entry should be M2 */ -static unsigned int stac925x_PA6_pin_configs[8] = { - 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, - 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, -}; - -static unsigned int stac925xM2_2_pin_configs[8] = { - 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, - 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, -}; - static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { [STAC_REF] = ref925x_pin_configs, [STAC_M1] = stac925xM1_pin_configs, @@ -1659,8 +1659,6 @@ static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { [STAC_M3] = stac925xM3_pin_configs, [STAC_M5] = stac925xM5_pin_configs, [STAC_M6] = stac925xM6_pin_configs, - [STAC_MA6] = stac925x_MA6_pin_configs, - [STAC_PA6] = stac925x_PA6_pin_configs, }; static const char *stac925x_models[STAC_925x_MODELS] = { @@ -1672,24 +1670,19 @@ static const char *stac925x_models[STAC_925x_MODELS] = { [STAC_M3] = "m3", [STAC_M5] = "m5", [STAC_M6] = "m6", - [STAC_MA6] = "ma6", - [STAC_PA6] = "pa6", }; static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { - SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), - SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), - - SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), - SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), + SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), + SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), + SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), + SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), - /* Not sure about the brand name for those */ SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), - {} /* terminator */ }; @@ -4399,7 +4392,8 @@ static int patch_stac9200(struct hda_codec *codec) spec->num_adcs = 1; spec->num_pwrs = 0; - if (spec->board_config == STAC_9200_GATEWAY || + if (spec->board_config == STAC_9200_M4 || + spec->board_config == STAC_9200_M4_2 || spec->board_config == STAC_9200_OQO) spec->init = stac9200_eapd_init; else -- cgit v1.2.3 From bd8a71a7b0f50da9350d202d325c3926ffd6b189 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Jan 2009 16:56:56 +0000 Subject: ALSA: Reduce boilerplate for new jack types Use a lookup table rather than explicit code to map input subsystem jack types into ASoC ones, implemented as suggested by Takashi Iwai. Signed-off-by: Mark Brown --- include/sound/jack.h | 3 +++ sound/core/jack.c | 44 ++++++++++++++++++++------------------------ 2 files changed, 23 insertions(+), 24 deletions(-) (limited to 'sound') diff --git a/include/sound/jack.h b/include/sound/jack.h index 2e0315cdd0d6..85266a2f5c6f 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -30,6 +30,9 @@ struct input_dev; /** * Jack types which can be reported. These values are used as a * bitmask. + * + * Note that this must be kept in sync with the lookup table in + * sound/core/jack.c. */ enum snd_jack_types { SND_JACK_HEADPHONE = 0x0001, diff --git a/sound/core/jack.c b/sound/core/jack.c index dd4a12dc09aa..b2da10c9916a 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -23,6 +23,13 @@ #include #include +static int jack_types[] = { + SW_HEADPHONE_INSERT, + SW_MICROPHONE_INSERT, + SW_LINEOUT_INSERT, + SW_JACK_PHYSICAL_INSERT, +}; + static int snd_jack_dev_free(struct snd_device *device) { struct snd_jack *jack = device->device_data; @@ -79,6 +86,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, { struct snd_jack *jack; int err; + int i; static struct snd_device_ops ops = { .dev_free = snd_jack_dev_free, .dev_register = snd_jack_dev_register, @@ -100,18 +108,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, jack->type = type; - if (type & SND_JACK_HEADPHONE) - input_set_capability(jack->input_dev, EV_SW, - SW_HEADPHONE_INSERT); - if (type & SND_JACK_LINEOUT) - input_set_capability(jack->input_dev, EV_SW, - SW_LINEOUT_INSERT); - if (type & SND_JACK_MICROPHONE) - input_set_capability(jack->input_dev, EV_SW, - SW_MICROPHONE_INSERT); - if (type & SND_JACK_MECHANICAL) - input_set_capability(jack->input_dev, EV_SW, - SW_JACK_PHYSICAL_INSERT); + for (i = 0; i < ARRAY_SIZE(jack_types); i++) + if (type & (1 << i)) + input_set_capability(jack->input_dev, EV_SW, + jack_types[i]); err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops); if (err < 0) @@ -154,21 +154,17 @@ EXPORT_SYMBOL(snd_jack_set_parent); */ void snd_jack_report(struct snd_jack *jack, int status) { + int i; + if (!jack) return; - if (jack->type & SND_JACK_HEADPHONE) - input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, - status & SND_JACK_HEADPHONE); - if (jack->type & SND_JACK_LINEOUT) - input_report_switch(jack->input_dev, SW_LINEOUT_INSERT, - status & SND_JACK_LINEOUT); - if (jack->type & SND_JACK_MICROPHONE) - input_report_switch(jack->input_dev, SW_MICROPHONE_INSERT, - status & SND_JACK_MICROPHONE); - if (jack->type & SND_JACK_MECHANICAL) - input_report_switch(jack->input_dev, SW_JACK_PHYSICAL_INSERT, - status & SND_JACK_MECHANICAL); + for (i = 0; i < ARRAY_SIZE(jack_types); i++) { + int testbit = 1 << i; + if (jack->type & testbit) + input_report_switch(jack->input_dev, jack_types[i], + status & testbit); + } input_sync(jack->input_dev); } -- cgit v1.2.3 From d506fc322ec2af04fc47be83d796a1c9e1a16022 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 7 Jan 2009 11:54:25 +0200 Subject: ALSA: Add support for video out to the jack reporting API Add support for reporting new jack types SND_JACK_VIDEOOUT and SND_JACK_AVOUT (a combination of LINEOUT and VIDEOOUT) to the jack reporting API. Also add the corresponding SW_VIDEOOUT_INSERT switch to the input system header. Signed-off-by: Jani Nikula Signed-off-by: Mark Brown --- include/linux/input.h | 1 + include/sound/jack.h | 2 ++ sound/core/jack.c | 1 + 3 files changed, 4 insertions(+) (limited to 'sound') diff --git a/include/linux/input.h b/include/linux/input.h index 9a6355f74db2..adc13322d1d2 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -661,6 +661,7 @@ struct input_absinfo { #define SW_DOCK 0x05 /* set = plugged into dock */ #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ +#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ #define SW_MAX 0x0f #define SW_CNT (SW_MAX+1) diff --git a/include/sound/jack.h b/include/sound/jack.h index 85266a2f5c6f..6b013c6f6a04 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -40,6 +40,8 @@ enum snd_jack_types { SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE, SND_JACK_LINEOUT = 0x0004, SND_JACK_MECHANICAL = 0x0008, /* If detected separately */ + SND_JACK_VIDEOOUT = 0x0010, + SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT, }; struct snd_jack { diff --git a/sound/core/jack.c b/sound/core/jack.c index b2da10c9916a..43b10d6e522b 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -28,6 +28,7 @@ static int jack_types[] = { SW_MICROPHONE_INSERT, SW_LINEOUT_INSERT, SW_JACK_PHYSICAL_INSERT, + SW_VIDEOOUT_INSERT, }; static int snd_jack_dev_free(struct snd_device *device) -- cgit v1.2.3 From 3195954da9cdb1cadb2059921c62e69d376c624f Mon Sep 17 00:00:00 2001 From: Andrea Borgia Date: Wed, 7 Jan 2009 22:58:50 +0100 Subject: ALSA: preliminary support for Toshiba SB-0500 The Toshiba Multimedia Center SB-0500 is a rebranded version of the Creative Technology SB Live! 24-bit External: it shares the same chipset and only has minor cosmetic differences. Remote controller works with alsa_usb module, basic audio is there and mixer controls are mostly untested. Signed-off-by: Andrea Borgia Signed-off-by: Takashi Iwai --- sound/usb/usbmixer.c | 15 ++++++++++----- sound/usb/usbmixer_maps.c | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 00397c8a765b..bc8bd00047ad 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -66,6 +66,7 @@ static const struct rc_config { { USB_ID(0x041e, 0x3000), 0, 1, 2, 1, 18, 0x0013 }, /* Extigy */ { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */ { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ + { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ }; struct usb_mixer_interface { @@ -1706,7 +1707,8 @@ static void snd_usb_mixer_memory_change(struct usb_mixer_interface *mixer, break; /* live24ext: 4 = line-in jack */ case 3: /* hp-out jack (may actuate Mute) */ - if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040)) + if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || + mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id); break; default: @@ -1956,8 +1958,9 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer) int i, err; for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) { - if (i > 1 && /* Live24ext has 2 LEDs only */ - mixer->chip->usb_id == USB_ID(0x041e, 0x3040)) + if (i > 1 && /* Live24ext has 2 LEDs only */ + (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || + mixer->chip->usb_id == USB_ID(0x041e, 0x3048))) break; err = snd_ctl_add(mixer->chip->card, snd_ctl_new1(&snd_audigy2nx_controls[i], mixer)); @@ -1994,7 +1997,8 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, snd_iprintf(buffer, "%s jacks\n\n", mixer->chip->card->shortname); if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) jacks = jacks_audigy2nx; - else if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040)) + else if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || + mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) jacks = jacks_live24ext; else return; @@ -2044,7 +2048,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, goto _error; if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) || - mixer->chip->usb_id == USB_ID(0x041e, 0x3040)) { + mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || + mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) { struct snd_info_entry *entry; if ((err = snd_audigy2nx_controls_create(mixer)) < 0) diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c index d755be0ad811..f41214f3ad6b 100644 --- a/sound/usb/usbmixer_maps.c +++ b/sound/usb/usbmixer_maps.c @@ -284,6 +284,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x041e, 0x3040), .map = live24ext_map, }, + { + .id = USB_ID(0x041e, 0x3048), + .map = audigy2nx_map, + .selector_map = audigy2nx_selectors, + }, { /* Hercules DJ Console (Windows Edition) */ .id = USB_ID(0x06f8, 0xb000), -- cgit v1.2.3 From 199f7978730a4bbd88038fd84212b30759579f1a Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Fri, 9 Jan 2009 23:10:52 +0100 Subject: ALSA: wss-lib: move AD1845 frequency setting into wss-lib This is required to allow the sscape driver to autodetect installed codec. Also, do not create a timer if detected codec has no hardware timer (e.g. AD1848). Signed-off-by: Krzysztof Helt Cc: Rene Herman Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 113 ++++-------------------------------------------- sound/isa/wss/wss_lib.c | 40 +++++++++++++++++ 2 files changed, 48 insertions(+), 105 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 48a16d865834..bc449166d18d 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -129,9 +129,6 @@ enum GA_REG { #define DMA_8BIT 0x80 -#define AD1845_FREQ_SEL_MSB 0x16 -#define AD1845_FREQ_SEL_LSB 0x17 - enum card_type { SSCAPE, SSCAPE_PNP, @@ -954,82 +951,6 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned l } -/* - * Override for the CS4231 playback format function. - * The AD1845 has much simpler format and rate selection. - */ -static void ad1845_playback_format(struct snd_wss *chip, - struct snd_pcm_hw_params *params, - unsigned char format) -{ - unsigned long flags; - unsigned rate = params_rate(params); - - /* - * The AD1845 can't handle sample frequencies - * outside of 4 kHZ to 50 kHZ - */ - if (rate > 50000) - rate = 50000; - else if (rate < 4000) - rate = 4000; - - spin_lock_irqsave(&chip->reg_lock, flags); - - /* - * Program the AD1845 correctly for the playback stream. - * Note that we do NOT need to toggle the MCE bit because - * the PLAYBACK_ENABLE bit of the Interface Configuration - * register is set. - * - * NOTE: We seem to need to write to the MSB before the LSB - * to get the correct sample frequency. - */ - snd_wss_out(chip, CS4231_PLAYBK_FORMAT, (format & 0xf0)); - snd_wss_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8)); - snd_wss_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate); - - spin_unlock_irqrestore(&chip->reg_lock, flags); -} - -/* - * Override for the CS4231 capture format function. - * The AD1845 has much simpler format and rate selection. - */ -static void ad1845_capture_format(struct snd_wss *chip, - struct snd_pcm_hw_params *params, - unsigned char format) -{ - unsigned long flags; - unsigned rate = params_rate(params); - - /* - * The AD1845 can't handle sample frequencies - * outside of 4 kHZ to 50 kHZ - */ - if (rate > 50000) - rate = 50000; - else if (rate < 4000) - rate = 4000; - - spin_lock_irqsave(&chip->reg_lock, flags); - - /* - * Program the AD1845 correctly for the playback stream. - * Note that we do NOT need to toggle the MCE bit because - * the CAPTURE_ENABLE bit of the Interface Configuration - * register is set. - * - * NOTE: We seem to need to write to the MSB before the LSB - * to get the correct sample frequency. - */ - snd_wss_out(chip, CS4231_REC_FORMAT, (format & 0xf0)); - snd_wss_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8)); - snd_wss_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate); - - spin_unlock_irqrestore(&chip->reg_lock, flags); -} - /* * Create an AD1845 PCM subdevice on the SoundScape. The AD1845 * is very much like a CS4231, with a few extra bits. We will @@ -1055,11 +976,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, unsigned long flags; struct snd_pcm *pcm; -#define AD1845_FREQ_SEL_ENABLE 0x08 - -#define AD1845_PWR_DOWN_CTRL 0x1b -#define AD1845_CRYS_CLOCK_SEL 0x1d - /* * It turns out that the PLAYBACK_ENABLE bit is set * by the lowlevel driver ... @@ -1074,7 +990,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, */ if (sscape->type != SSCAPE_VIVO) { - int val; /* * The input clock frequency on the SoundScape must * be 14.31818 MHz, because we must set this register @@ -1082,22 +997,10 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, */ snd_wss_mce_up(chip); spin_lock_irqsave(&chip->reg_lock, flags); - snd_wss_out(chip, AD1845_CRYS_CLOCK_SEL, 0x20); + snd_wss_out(chip, AD1845_CLOCK, 0x20); spin_unlock_irqrestore(&chip->reg_lock, flags); snd_wss_mce_down(chip); - /* - * More custom configuration: - * a) select "mode 2" and provide a current drive of 8mA - * b) enable frequency selection (for capture/playback) - */ - spin_lock_irqsave(&chip->reg_lock, flags); - snd_wss_out(chip, CS4231_MISC_INFO, - CS4231_MODE2 | 0x10); - val = snd_wss_in(chip, AD1845_PWR_DOWN_CTRL); - snd_wss_out(chip, AD1845_PWR_DOWN_CTRL, - val | AD1845_FREQ_SEL_ENABLE); - spin_unlock_irqrestore(&chip->reg_lock, flags); } err = snd_wss_pcm(chip, 0, &pcm); @@ -1113,11 +1016,13 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, "for AD1845 chip\n"); goto _error; } - err = snd_wss_timer(chip, 0, NULL); - if (err < 0) { - snd_printk(KERN_ERR "sscape: No timer device " - "for AD1845 chip\n"); - goto _error; + if (chip->hardware != WSS_HW_AD1848) { + err = snd_wss_timer(chip, 0, NULL); + if (err < 0) { + snd_printk(KERN_ERR "sscape: No timer device " + "for AD1845 chip\n"); + goto _error; + } } if (sscape->type != SSCAPE_VIVO) { @@ -1128,8 +1033,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, "MIDI mixer control\n"); goto _error; } - chip->set_playback_format = ad1845_playback_format; - chip->set_capture_format = ad1845_capture_format; } strcpy(card->driver, "SoundScape"); diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 3d6c5f2838af..13299aebd077 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -646,6 +646,24 @@ static void snd_wss_playback_format(struct snd_wss *chip, full_calib = 0; } spin_unlock_irqrestore(&chip->reg_lock, flags); + } else if (chip->hardware == WSS_HW_AD1845) { + unsigned rate = params_rate(params); + + /* + * Program the AD1845 correctly for the playback stream. + * Note that we do NOT need to toggle the MCE bit because + * the PLAYBACK_ENABLE bit of the Interface Configuration + * register is set. + * + * NOTE: We seem to need to write to the MSB before the LSB + * to get the correct sample frequency. + */ + spin_lock_irqsave(&chip->reg_lock, flags); + snd_wss_out(chip, CS4231_PLAYBK_FORMAT, (pdfr & 0xf0)); + snd_wss_out(chip, AD1845_UPR_FREQ_SEL, (rate >> 8) & 0xff); + snd_wss_out(chip, AD1845_LWR_FREQ_SEL, rate & 0xff); + full_calib = 0; + spin_unlock_irqrestore(&chip->reg_lock, flags); } if (full_calib) { snd_wss_mce_up(chip); @@ -690,6 +708,24 @@ static void snd_wss_capture_format(struct snd_wss *chip, full_calib = 0; } spin_unlock_irqrestore(&chip->reg_lock, flags); + } else if (chip->hardware == WSS_HW_AD1845) { + unsigned rate = params_rate(params); + + /* + * Program the AD1845 correctly for the capture stream. + * Note that we do NOT need to toggle the MCE bit because + * the PLAYBACK_ENABLE bit of the Interface Configuration + * register is set. + * + * NOTE: We seem to need to write to the MSB before the LSB + * to get the correct sample frequency. + */ + spin_lock_irqsave(&chip->reg_lock, flags); + snd_wss_out(chip, CS4231_REC_FORMAT, (cdfr & 0xf0)); + snd_wss_out(chip, AD1845_UPR_FREQ_SEL, (rate >> 8) & 0xff); + snd_wss_out(chip, AD1845_LWR_FREQ_SEL, rate & 0xff); + full_calib = 0; + spin_unlock_irqrestore(&chip->reg_lock, flags); } if (full_calib) { snd_wss_mce_up(chip); @@ -1314,6 +1350,10 @@ static int snd_wss_probe(struct snd_wss *chip) chip->image[CS4231_ALT_FEATURE_2] = chip->hardware == WSS_HW_INTERWAVE ? 0xc2 : 0x01; } + /* enable fine grained frequency selection */ + if (chip->hardware == WSS_HW_AD1845) + chip->image[AD1845_PWR_DOWN] = 8; + ptr = (unsigned char *) &chip->image; regnum = (chip->hardware & WSS_HW_AD1848_MASK) ? 16 : 32; snd_wss_mce_down(chip); -- cgit v1.2.3 From 554b91edec1c588b889a7357ff201c0a450e31ff Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Mon, 12 Jan 2009 21:25:04 +0100 Subject: ALSA: sscape: fix incorrect timeout after microcode upload A comment states that one should wait up to 5 secs while a waiting loop waits only 5 system ticks. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index bc449166d18d..6a7f842b9627 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -393,20 +393,20 @@ static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, unsigned ti */ static int obp_startup_ack(struct soundscape *s, unsigned timeout) { - while (timeout != 0) { + unsigned long end_time = jiffies + msecs_to_jiffies(timeout); + + do { unsigned long flags; unsigned char x; - schedule_timeout_uninterruptible(1); - spin_lock_irqsave(&s->lock, flags); x = inb(HOST_DATA_IO(s->io_base)); spin_unlock_irqrestore(&s->lock, flags); if ((x & 0xfe) == 0xfe) return 1; - --timeout; - } /* while */ + msleep(10); + } while (time_before(jiffies, end_time)); return 0; } @@ -420,20 +420,20 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout) */ static int host_startup_ack(struct soundscape *s, unsigned timeout) { - while (timeout != 0) { + unsigned long end_time = jiffies + msecs_to_jiffies(timeout); + + do { unsigned long flags; unsigned char x; - schedule_timeout_uninterruptible(1); - spin_lock_irqsave(&s->lock, flags); x = inb(HOST_DATA_IO(s->io_base)); spin_unlock_irqrestore(&s->lock, flags); if (x == 0xfe) return 1; - --timeout; - } /* while */ + msleep(10); + } while (time_before(jiffies, end_time)); return 0; } @@ -529,10 +529,10 @@ static int upload_dma_data(struct soundscape *s, * give it 5 seconds (max) ... */ ret = 0; - if (!obp_startup_ack(s, 5)) { + if (!obp_startup_ack(s, 5000)) { snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n"); ret = -EAGAIN; - } else if (!host_startup_ack(s, 5)) { + } else if (!host_startup_ack(s, 5000)) { snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n"); ret = -EAGAIN; } -- cgit v1.2.3 From dc61b66fc724f89d357c43e2319d2cb7bec1e517 Mon Sep 17 00:00:00 2001 From: Andrea Borgia Date: Mon, 12 Jan 2009 23:17:47 +0100 Subject: ALSA: rename "Device" to "Toshiba SB-0500" via quirks Signed-off-by: Andrea Borgia Signed-off-by: Takashi Iwai --- sound/usb/usbquirks.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound') diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index 92115755d98e..d59323ecd571 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h @@ -39,6 +39,16 @@ .idProduct = prod, \ .bInterfaceClass = USB_CLASS_VENDOR_SPEC +/* Creative/Toshiba Multimedia Center SB-0500 */ +{ + USB_DEVICE(0x041e, 0x3048), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + .vendor_name = "Toshiba", + .product_name = "SB-0500", + .ifnum = QUIRK_NO_INTERFACE + } +}, + /* Creative/E-Mu devices */ { USB_DEVICE(0x041e, 0x3010), -- cgit v1.2.3 From f9d088b2080b476c86f8ddbc274851b89668c6d7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 13 Jan 2009 11:54:49 +0100 Subject: ALSA: hda - Fix a typo Fix a typo in stac92hd83xxx_cfg_tbl[]. The actual number is identical thus there is no behavior change. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 35b83dc6e19e..a4e2d8fcc8b7 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1682,7 +1682,7 @@ static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, - "DFI LanParty", STAC_92HD71BXX_REF), + "DFI LanParty", STAC_92HD83XXX_REF), {} /* terminator */ }; -- cgit v1.2.3 From f84e3e915ea03dfa6e32626fc25a4f284ef222ac Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 13 Jan 2009 12:32:21 +0100 Subject: ALSA: hda - Add support of NVidia MCP78 HDMI Added the new id for NVidia MCP HDMI (10de:0007). Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_nvhdmi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 96952a37d884..d57d8132a06e 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c @@ -160,6 +160,7 @@ static int patch_nvhdmi(struct hda_codec *codec) */ static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, + { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi }, { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi }, { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi }, @@ -167,6 +168,7 @@ static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { }; MODULE_ALIAS("snd-hda-codec-id:10de0002"); +MODULE_ALIAS("snd-hda-codec-id:10de0006"); MODULE_ALIAS("snd-hda-codec-id:10de0007"); MODULE_ALIAS("snd-hda-codec-id:10de0067"); MODULE_ALIAS("snd-hda-codec-id:10de8001"); -- cgit v1.2.3 From dafb70ce1026d4d6ef1b16ad6996c9589bb11cce Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 13 Jan 2009 08:58:49 -0500 Subject: ALSA: hda - Add quirk for another HP dv5 Add the model=hp-m4 quirk for another HP dv5 (103c:3603) Reference: kernel bug#12440 http://bugzilla.kernel.org/show_bug.cgi?id=12440 Signed-off-by: Takashi Iwai Cc: stable@kernel.org --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a4e2d8fcc8b7..9acf2f0a2df9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1736,6 +1736,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "HP dv7", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, "HP dv7", STAC_HP_M4), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, + "HP dv5", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, "unknown HP", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, -- cgit v1.2.3 From c107b41c485c43f15b24743e81eaab742b3c0b67 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 13 Jan 2009 17:46:37 +0100 Subject: ALSA: hda - Use queue_delayed_work() Replaced the old schedule_work() with queue_delayed_work() where overlooked in the previous patches. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3c596da2b9b5..fdad6ae7aad4 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2815,7 +2815,7 @@ void snd_hda_power_down(struct hda_codec *codec) return; if (power_save(codec)) { codec->power_transition = 1; /* avoid reentrance */ - schedule_delayed_work(&codec->power_work, + queue_delayed_work(codec->bus->workq, &codec->power_work, msecs_to_jiffies(power_save(codec) * 1000)); } } -- cgit v1.2.3 From 2acc9dcb609427a20463e529ef552dd93b469847 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 9 Jan 2009 16:57:14 +0100 Subject: ALSA: hda - Fix silent headphone output on Panasonic CF-74 CF-74 does the headphone/speaker switching on hardware, thus the driver shouldn't do any software-toggling of pins. Otherwise it results in a silent headphone output. This patch simply resets the hp_detect flag to fix the problem. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 0e6fc56fa378..89ff916a0ed1 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4467,6 +4467,12 @@ static int patch_stac9200(struct hda_codec *codec) return err; } + /* CF-74 has no headphone detection, and the driver should *NOT* + * do detection and HP/speaker toggle because the hardware does it. + */ + if (spec->board_config == STAC_9200_PANASONIC) + spec->hp_detect = 0; + codec->patch_ops = stac92xx_patch_ops; return 0; -- cgit v1.2.3 From c15c5060fc32d7de7cde76aa61e98bae1334d82e Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Tue, 13 Jan 2009 13:30:07 -0500 Subject: ALSA: hda: stac92hd8xxx amp mixers Added amp nid for stac92hd8xxx families of codecs so the input amp mixer is created. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 89ff916a0ed1..77fcc312a1f4 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -336,6 +336,10 @@ static unsigned int stac92hd83xxx_pwr_mapping[4] = { 0x03, 0x0c, 0x10, 0x40, }; +static unsigned int stac92hd83xxx_amp_nids[1] = { + 0xc, +}; + static hda_nid_t stac92hd71bxx_pwr_nids[3] = { 0x0a, 0x0d, 0x0f }; @@ -4747,6 +4751,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) spec->dmux_nids = stac92hd83xxx_dmux_nids; spec->adc_nids = stac92hd83xxx_adc_nids; spec->pwr_nids = stac92hd83xxx_pwr_nids; + spec->amp_nids = stac92hd83xxx_amp_nids; spec->pwr_mapping = stac92hd83xxx_pwr_mapping; spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); spec->multiout.dac_nids = spec->dac_nids; @@ -4764,6 +4769,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); + spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); spec->num_dmics = STAC92HD83XXX_NUM_DMICS; spec->dinput_mux = &stac92hd83xxx_dmux; spec->pin_nids = stac92hd83xxx_pin_nids; -- cgit v1.2.3 From 8317e0b0c2234f5f1f5d54804e4093d11bc0dffa Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 14 Jan 2009 07:56:51 +0100 Subject: ALSA: hda - Don't reset HP pinctl in patch_sigmatel.c Resetting HP pinctl at the unplugged state may cause a sort of regression on some devices because of their wrong pin configuration. A simple workaround is to disable the pin reset. This is ugly and may be not good from the power-saving POV (if any), but damn simple. Signed-off-by: Takashi Iwai Cc: stable@kernel.org --- sound/pci/hda/patch_sigmatel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 77fcc312a1f4..103ac6d743ef 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4225,8 +4225,19 @@ static void stac92xx_hp_detect(struct hda_codec *codec) continue; if (presence) stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); +#if 0 /* FIXME */ +/* Resetting the pinctl like below may lead to (a sort of) regressions + * on some devices since they use the HP pin actually for line/speaker + * outs although the default pin config shows a different pin (that is + * wrong and useless). + * + * So, it's basically a problem of default pin configs, likely a BIOS issue. + * But, disabling the code below just works around it, and I'm too tired of + * bug reports with such devices... + */ else stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); +#endif /* FIXME */ } } -- cgit v1.2.3 From 3e420e78ece6f9d2accc1568e80dfd0501e13df1 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 16 Dec 2008 12:37:47 +1100 Subject: ALSA: hda - Add automatic model setting for Samsung Q45 Have the Samsung Q45 (144d:c510) select ALC262_HIPPO by default Reference: Ubuntu bug 200210 http://launchpad.net/bugs/200210 Signed-off-by: Luke Yelavich Cc: stable@kernel.org Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ea4c88fe05c4..82dd08431970 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10573,6 +10573,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), + SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), -- cgit v1.2.3 From 9248f2693921b143b54f380b60c945b28a7a5358 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 14 Jan 2009 09:40:25 +0100 Subject: ALSA: hda - Fix stac92hd83xxx_amp_nids[] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the bug introduced in commit c15c5060fc32d7de7cde76aa61e98bae1334d82e: sound/pci/hda/patch_sigmatel.c: In function ‘patch_stac92hd83xxx’: sound/pci/hda/patch_sigmatel.c:4765: warning: assignment from incompatible pointer type Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 103ac6d743ef..25230f4c888e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -336,7 +336,7 @@ static unsigned int stac92hd83xxx_pwr_mapping[4] = { 0x03, 0x0c, 0x10, 0x40, }; -static unsigned int stac92hd83xxx_amp_nids[1] = { +static hda_nid_t stac92hd83xxx_amp_nids[1] = { 0xc, }; -- cgit v1.2.3 From 5c6c9e6feccf771d060708fbbba9e0f67f8e0e67 Mon Sep 17 00:00:00 2001 From: "Signed-off-by: Peter Stokes" Date: Wed, 14 Jan 2009 09:47:57 +0100 Subject: ALSA: USB quirk for Logitech Quickcam Pro 9000 name The Logitech QuickCam Pro 9000 does not appear to any product identification strings in its USB device descriptor. Therefore it receives a device name of "USB Device 0x46d:0x990". Th e attached patch below adds a USB quirk to provide a more friendly name. Signed-off-by: Takashi Iwai --- sound/usb/usbquirks.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index 92115755d98e..5d8ef09b9dcc 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h @@ -128,6 +128,14 @@ .bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL }, +{ + USB_DEVICE(0x046d, 0x0990), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + .vendor_name = "Logitech, Inc.", + .product_name = "QuickCam Pro 9000", + .ifnum = QUIRK_NO_INTERFACE + } +}, /* * Yamaha devices -- cgit v1.2.3 From 2465fb6605b4f8f3964b132017bf4078d1265fe9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 14 Jan 2009 15:58:55 +0100 Subject: ALSA: hda - Fix missing initialization of NID 0x0e for STAC925x The selector widget 0x0e isn't initialized properly in the whole probe process, thus it can be a wrong value depending on the BIOS setup. This patch adds the init verb to set it to the max & unmuted. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 25230f4c888e..6d9a4a2aa4af 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -884,6 +884,8 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = { static struct hda_verb stac925x_core_init[] = { /* set dac0mux for dac converter */ { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* unmute and set max the selector */ + { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f }, {} }; -- cgit v1.2.3 From 1b0652eb588e57c3ab230e0291e7da99c7e665e0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 14 Jan 2009 08:27:35 +0100 Subject: ALSA: hda - Fix HP dv5 mic input Fix HP dv5 (103c:3603) built-in mic input. Reference: kernel bug 12440 http://bugzilla.kernel.org/show_bug.cgi?id=12440 Signed-off-by: Takashi Iwai Cc: stable@kernel.org --- sound/pci/hda/patch_sigmatel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6d9a4a2aa4af..e6c13963f215 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -90,6 +90,7 @@ enum { STAC_DELL_M4_2, STAC_DELL_M4_3, STAC_HP_M4, + STAC_HP_DV5, STAC_92HD71BXX_MODELS }; @@ -1778,6 +1779,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { [STAC_DELL_M4_2] = dell_m4_2_pin_configs, [STAC_DELL_M4_3] = dell_m4_3_pin_configs, [STAC_HP_M4] = NULL, + [STAC_HP_DV5] = NULL, }; static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { @@ -1786,6 +1788,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { [STAC_DELL_M4_2] = "dell-m4-2", [STAC_DELL_M4_3] = "dell-m4-3", [STAC_HP_M4] = "hp-m4", + [STAC_HP_DV5] = "hp-dv5", }; static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { @@ -1799,7 +1802,7 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, "HP dv7", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, - "HP dv5", STAC_HP_M4), + "HP dv5", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, "unknown HP", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, -- cgit v1.2.3 From 7e86c0e6850504ec9516b953f316a47277825e33 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 15 Jan 2009 10:21:23 +0100 Subject: sound: virtuoso: do not overwrite EEPROM on Xonar D2/D2X On the Asus Xonar D2 and D2X models, the SPI chip select signal for the fourth DAC shares its pin with the serial clock for the EEPROM that contains the PCI subdevice ID values. It appears that when DAC registers are written and some other unknown conditions occur (probably noise on the EEPROM's chip select line), the EEPROM gets overwritten with garbage, which makes it impossible to properly detect the card later. Therefore, we better avoid DAC register writes and make sure that the driver works with the DAC's registers' default values. Consequently, the sample format is now I2S instead of left-justified (no user-visible change), and the DAC's volume/mute registers cannot be used anymore (volume changes are now done by the software volume plugin). Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/pci/oxygen/virtuoso.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 98c6a8c65d81..e9e829e83d7a 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -26,7 +26,7 @@ * SPI 0 -> 1st PCM1796 (front) * SPI 1 -> 2nd PCM1796 (surround) * SPI 2 -> 3rd PCM1796 (center/LFE) - * SPI 4 -> 4th PCM1796 (back) + * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!) * * GPIO 2 -> M0 of CS5381 * GPIO 3 -> M1 of CS5381 @@ -207,6 +207,12 @@ static void xonar_gpio_changed(struct oxygen *chip); static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, u8 reg, u8 value) { + /* + * We don't want to do writes on SPI 4 because the EEPROM, which shares + * the same pin, might get confused and broken. We'd better take care + * that the driver works with the default register values ... + */ +#if 0 /* maps ALSA channel pair number to SPI output */ static const u8 codec_map[4] = { 0, 1, 2, 4 @@ -217,6 +223,7 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | OXYGEN_SPI_CEN_LATCH_CLOCK_HI, (reg << 8) | value); +#endif } static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, @@ -750,6 +757,9 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); static int xonar_d2_control_filter(struct snd_kcontrol_new *template) { + if (!strncmp(template->name, "Master Playback ", 16)) + /* disable volume/mute because they would require SPI writes */ + return 1; if (!strncmp(template->name, "CD Capture ", 11)) /* CD in is actually connected to the video in pin */ template->private_value ^= AC97_CD ^ AC97_VIDEO; @@ -840,9 +850,8 @@ static const struct oxygen_model model_xonar_d2 = { .dac_volume_min = 0x0f, .dac_volume_max = 0xff, .misc_flags = OXYGEN_MISC_MIDI, - .function_flags = OXYGEN_FUNCTION_SPI | - OXYGEN_FUNCTION_ENABLE_SPI_4_5, - .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, + .function_flags = OXYGEN_FUNCTION_SPI, + .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S, .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, }; -- cgit v1.2.3 From 428549f5746c9d6135d425d076a1bed2614d58ee Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 15 Jan 2009 16:56:59 +0100 Subject: ALSA: hda - Fix invalid amp value for STAC925x The value set in the commit 2465fb6605b4f8f3964b132017bf4078d1265fe9 is actually wrong. The value range is from 0 to 0x1f while the patch sets to 0x7f. Let's fix it. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e6c13963f215..c39deebb588f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -886,7 +886,7 @@ static struct hda_verb stac925x_core_init[] = { /* set dac0mux for dac converter */ { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, /* unmute and set max the selector */ - { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f }, + { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f }, {} }; -- cgit v1.2.3 From c9280d681c4093405fc896dc25f81d5ff9de8183 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 15 Jan 2009 17:31:00 +0100 Subject: ALSA: hda - Fix (yet more) STAC925x issues The codec-parsing of STAC925x was utterly broken due to its unique design unlike other STAC codecs. It has a volume control only in NID 0x0e (similar as STAC9200), but the parser assumes that the amp is available on each DAC widget. The patch fixes the whole wrong stories: fix the initial volume, assign the fixed "Master" volume, and avoid to create wrong volume controls. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c39deebb588f..faef1ca86600 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -885,8 +885,8 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = { static struct hda_verb stac925x_core_init[] = { /* set dac0mux for dac converter */ { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* unmute and set max the selector */ - { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f }, + /* mute the master volume */ + { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, {} }; @@ -1138,6 +1138,8 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { }; static struct snd_kcontrol_new stac925x_mixer[] = { + HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), + HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), STAC_INPUT_SOURCE(1), HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), @@ -3573,13 +3575,12 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out err = stac92xx_auto_fill_dac_nids(codec); if (err < 0) return err; + err = stac92xx_auto_create_multi_out_ctls(codec, + &spec->autocfg); + if (err < 0) + return err; } - err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg); - - if (err < 0) - return err; - /* setup analog beep controls */ if (spec->anabeep_nid > 0) { err = stac92xx_auto_create_beep_ctls(codec, -- cgit v1.2.3 From 641b4879444c0edb276fedca5c2fcbd2e5c70044 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 15 Jan 2009 17:05:24 +0100 Subject: ALSA: usb-audio - Cache mixer values Cache mixer values in usb-audio driver to reduce too excessive accesses to the hardware. Signed-off-by: Takashi Iwai --- sound/usb/usbmixer.c | 122 +++++++++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 52 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 00397c8a765b..c07b3f8485e3 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -110,6 +110,8 @@ struct mixer_build { const struct usbmix_selector_map *selector_map; }; +#define MAX_CHANNELS 10 /* max logical channels */ + struct usb_mixer_elem_info { struct usb_mixer_interface *mixer; struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */ @@ -120,6 +122,8 @@ struct usb_mixer_elem_info { int channels; int val_type; int min, max, res; + int cached; + int cache_val[MAX_CHANNELS]; u8 initialized; }; @@ -181,8 +185,6 @@ enum { USB_PROC_DCR_RELEASE = 6, }; -#define MAX_CHANNELS 10 /* max logical channels */ - /* * manual mapping of mixer names @@ -376,11 +378,35 @@ static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int * } /* channel = 0: master, 1 = first channel */ -static inline int get_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int *value) +static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval, + int channel, int *value) { return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); } +static int get_cur_mix_value(struct usb_mixer_elem_info *cval, + int channel, int index, int *value) +{ + int err; + + if (cval->cached & (1 << channel)) { + *value = cval->cache_val[index]; + return 0; + } + err = get_cur_mix_raw(cval, channel, value); + if (err < 0) { + if (!cval->mixer->ignore_ctl_error) + snd_printd(KERN_ERR "cannot get current value for " + "control %d ch %d: err = %d\n", + cval->control, channel, err); + return err; + } + cval->cached |= 1 << channel; + cval->cache_val[index] = *value; + return 0; +} + + /* * set a mixer value */ @@ -412,9 +438,17 @@ static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int v return set_ctl_value(cval, SET_CUR, validx, value); } -static inline int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int value) +static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, + int index, int value) { - return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value); + int err; + err = set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, + value); + if (err < 0) + return err; + cval->cached |= 1 << channel; + cval->cache_val[index] = value; + return 0; } /* @@ -718,7 +752,7 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) if (cval->min + cval->res < cval->max) { int last_valid_res = cval->res; int saved, test, check; - get_cur_mix_value(cval, minchn, &saved); + get_cur_mix_raw(cval, minchn, &saved); for (;;) { test = saved; if (test < cval->max) @@ -726,8 +760,8 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) else test -= cval->res; if (test < cval->min || test > cval->max || - set_cur_mix_value(cval, minchn, test) || - get_cur_mix_value(cval, minchn, &check)) { + set_cur_mix_value(cval, minchn, 0, test) || + get_cur_mix_raw(cval, minchn, &check)) { cval->res = last_valid_res; break; } @@ -735,7 +769,7 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) break; cval->res *= 2; } - set_cur_mix_value(cval, minchn, saved); + set_cur_mix_value(cval, minchn, 0, saved); } cval->initialized = 1; @@ -775,35 +809,25 @@ static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e struct usb_mixer_elem_info *cval = kcontrol->private_data; int c, cnt, val, err; + ucontrol->value.integer.value[0] = cval->min; if (cval->cmask) { cnt = 0; for (c = 0; c < MAX_CHANNELS; c++) { - if (cval->cmask & (1 << c)) { - err = get_cur_mix_value(cval, c + 1, &val); - if (err < 0) { - if (cval->mixer->ignore_ctl_error) { - ucontrol->value.integer.value[0] = cval->min; - return 0; - } - snd_printd(KERN_ERR "cannot get current value for control %d ch %d: err = %d\n", cval->control, c + 1, err); - return err; - } - val = get_relative_value(cval, val); - ucontrol->value.integer.value[cnt] = val; - cnt++; - } + if (!(cval->cmask & (1 << c))) + continue; + err = get_cur_mix_value(cval, c + 1, cnt, &val); + if (err < 0) + return cval->mixer->ignore_ctl_error ? 0 : err; + val = get_relative_value(cval, val); + ucontrol->value.integer.value[cnt] = val; + cnt++; } + return 0; } else { /* master channel */ - err = get_cur_mix_value(cval, 0, &val); - if (err < 0) { - if (cval->mixer->ignore_ctl_error) { - ucontrol->value.integer.value[0] = cval->min; - return 0; - } - snd_printd(KERN_ERR "cannot get current value for control %d master ch: err = %d\n", cval->control, err); - return err; - } + err = get_cur_mix_value(cval, 0, 0, &val); + if (err < 0) + return cval->mixer->ignore_ctl_error ? 0 : err; val = get_relative_value(cval, val); ucontrol->value.integer.value[0] = val; } @@ -820,34 +844,28 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e if (cval->cmask) { cnt = 0; for (c = 0; c < MAX_CHANNELS; c++) { - if (cval->cmask & (1 << c)) { - err = get_cur_mix_value(cval, c + 1, &oval); - if (err < 0) { - if (cval->mixer->ignore_ctl_error) - return 0; - return err; - } - val = ucontrol->value.integer.value[cnt]; - val = get_abs_value(cval, val); - if (oval != val) { - set_cur_mix_value(cval, c + 1, val); - changed = 1; - } - get_cur_mix_value(cval, c + 1, &val); - cnt++; + if (!(cval->cmask & (1 << c))) + continue; + err = get_cur_mix_value(cval, c + 1, cnt, &oval); + if (err < 0) + return cval->mixer->ignore_ctl_error ? 0 : err; + val = ucontrol->value.integer.value[cnt]; + val = get_abs_value(cval, val); + if (oval != val) { + set_cur_mix_value(cval, c + 1, cnt, val); + changed = 1; } + cnt++; } } else { /* master channel */ - err = get_cur_mix_value(cval, 0, &oval); - if (err < 0 && cval->mixer->ignore_ctl_error) - return 0; + err = get_cur_mix_value(cval, 0, 0, &oval); if (err < 0) - return err; + return cval->mixer->ignore_ctl_error ? 0 : err; val = ucontrol->value.integer.value[0]; val = get_abs_value(cval, val); if (val != oval) { - set_cur_mix_value(cval, 0, val); + set_cur_mix_value(cval, 0, 0, val); changed = 1; } } -- cgit v1.2.3 From 45e513b689b8b0a01ec2b01cc21816e4780d7ea6 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 15 Jan 2009 18:21:48 +0100 Subject: ALSA: snd-aoa: handle older machines This patch changes snd-aoa to handle some older machines that are currently handled by snd-powermac. snd-aoa has a number of advantages though, notably it can autoload better and is generally a more modern driver. By hardcoding the accepted device-ids (last hunk of the patch) I'm trying to avoid regressions because this driver will otherwise load automatically and not let snd-powermac load. People who are unhappy with snd-powermac and have a device-id property in the device tree are encouraged to read this patch and make a patch to amend this as appropriate. Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai --- sound/aoa/fabrics/layout.c | 74 +++++++++++++++++++++++++++++++--------- sound/aoa/soundbus/i2sbus/core.c | 22 +++++++++--- 2 files changed, 74 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index ad60f5d10e82..d9b1d22a62c0 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c @@ -1,16 +1,14 @@ /* - * Apple Onboard Audio driver -- layout fabric + * Apple Onboard Audio driver -- layout/machine id fabric * - * Copyright 2006 Johannes Berg + * Copyright 2006-2008 Johannes Berg * * GPL v2, can be found in COPYING. * * - * This fabric module looks for sound codecs - * based on the layout-id property in the device tree. - * + * This fabric module looks for sound codecs based on the + * layout-id or device-id property in the device tree. */ - #include #include #include @@ -63,7 +61,7 @@ struct codec_connect_info { #define LAYOUT_FLAG_COMBO_LINEOUT_SPDIF (1<<0) struct layout { - unsigned int layout_id; + unsigned int layout_id, device_id; struct codec_connect_info codecs[MAX_CODECS_PER_BUS]; int flags; @@ -111,6 +109,10 @@ MODULE_ALIAS("sound-layout-96"); MODULE_ALIAS("sound-layout-98"); MODULE_ALIAS("sound-layout-100"); +MODULE_ALIAS("aoa-device-id-14"); +MODULE_ALIAS("aoa-device-id-22"); +MODULE_ALIAS("aoa-device-id-35"); + /* onyx with all but microphone connected */ static struct codec_connection onyx_connections_nomic[] = { { @@ -518,6 +520,27 @@ static struct layout layouts[] = { .connections = onyx_connections_noheadphones, }, }, + /* PowerMac3,4 */ + { .device_id = 14, + .codecs[0] = { + .name = "tas", + .connections = tas_connections_noline, + }, + }, + /* PowerMac3,6 */ + { .device_id = 22, + .codecs[0] = { + .name = "tas", + .connections = tas_connections_all, + }, + }, + /* PowerBook5,2 */ + { .device_id = 35, + .codecs[0] = { + .name = "tas", + .connections = tas_connections_all, + }, + }, {} }; @@ -526,7 +549,7 @@ static struct layout *find_layout_by_id(unsigned int id) struct layout *l; l = layouts; - while (l->layout_id) { + while (l->codecs[0].name) { if (l->layout_id == id) return l; l++; @@ -534,6 +557,19 @@ static struct layout *find_layout_by_id(unsigned int id) return NULL; } +static struct layout *find_layout_by_device(unsigned int id) +{ + struct layout *l; + + l = layouts; + while (l->codecs[0].name) { + if (l->device_id == id) + return l; + l++; + } + return NULL; +} + static void use_layout(struct layout *l) { int i; @@ -938,8 +974,8 @@ static struct aoa_fabric layout_fabric = { static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) { struct device_node *sound = NULL; - const unsigned int *layout_id; - struct layout *layout; + const unsigned int *id; + struct layout *layout = NULL; struct layout_dev *ldev = NULL; int err; @@ -952,15 +988,18 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) if (sound->type && strcasecmp(sound->type, "soundchip") == 0) break; } - if (!sound) return -ENODEV; + if (!sound) + return -ENODEV; - layout_id = of_get_property(sound, "layout-id", NULL); - if (!layout_id) - goto outnodev; - printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n", - *layout_id); + id = of_get_property(sound, "layout-id", NULL); + if (id) { + layout = find_layout_by_id(*id); + } else { + id = of_get_property(sound, "device-id", NULL); + if (id) + layout = find_layout_by_device(*id); + } - layout = find_layout_by_id(*layout_id); if (!layout) { printk(KERN_ERR "snd-aoa-fabric-layout: unknown layout\n"); goto outnodev; @@ -976,6 +1015,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) ldev->layout = layout; ldev->gpio.node = sound->parent; switch (layout->layout_id) { + case 0: /* anything with device_id, not layout_id */ case 41: /* that unknown machine no one seems to have */ case 51: /* PowerBook5,4 */ case 58: /* Mac Mini */ diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index be468edf3ecb..418c84c99d69 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -1,7 +1,7 @@ /* * i2sbus driver * - * Copyright 2006 Johannes Berg + * Copyright 2006-2008 Johannes Berg * * GPL v2, can be found in COPYING. */ @@ -186,13 +186,25 @@ static int i2sbus_add_dev(struct macio_dev *macio, } } if (i == 1) { - const u32 *layout_id = - of_get_property(sound, "layout-id", NULL); - if (layout_id) { - layout = *layout_id; + const u32 *id = of_get_property(sound, "layout-id", NULL); + + if (id) { + layout = *id; snprintf(dev->sound.modalias, 32, "sound-layout-%d", layout); ok = 1; + } else { + id = of_get_property(sound, "device-id", NULL); + /* + * We probably cannot handle all device-id machines, + * so restrict to those we do handle for now. + */ + if (id && (*id == 22 || *id == 14 || *id == 35)) { + snprintf(dev->sound.modalias, 32, + "aoa-device-id-%d", *id); + ok = 1; + layout = -1; + } } } /* for the time being, until we can handle non-layout-id -- cgit v1.2.3 From 5f17e79cdf530b1a6090c65730e5656ac9c19eaa Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 15 Jan 2009 18:22:31 +0100 Subject: ALSA: snd-aoa: handle master-amp if present Some machines have a master amp GPIO that needs to be toggled to get sound output, in addition to speaker/headphone/line-out amps. This makes snd-aoa handle it, if present in the device tree, thus making snd-aoa be able to output sound on PowerMac3,6, which was previously handled by snd-powermac which also doesn't use the master amp GPIO. Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai --- sound/aoa/aoa-gpio.h | 2 ++ sound/aoa/core/gpio-feature.c | 17 ++++++++++++++++- sound/aoa/fabrics/layout.c | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/aoa/aoa-gpio.h b/sound/aoa/aoa-gpio.h index ee64f5de8966..6065b0344e23 100644 --- a/sound/aoa/aoa-gpio.h +++ b/sound/aoa/aoa-gpio.h @@ -34,10 +34,12 @@ struct gpio_methods { void (*set_headphone)(struct gpio_runtime *rt, int on); void (*set_speakers)(struct gpio_runtime *rt, int on); void (*set_lineout)(struct gpio_runtime *rt, int on); + void (*set_master)(struct gpio_runtime *rt, int on); int (*get_headphone)(struct gpio_runtime *rt); int (*get_speakers)(struct gpio_runtime *rt); int (*get_lineout)(struct gpio_runtime *rt); + int (*get_master)(struct gpio_runtime *rt); void (*set_hw_reset)(struct gpio_runtime *rt, int on); diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c index c93ad5dec66b..de8e03afa97b 100644 --- a/sound/aoa/core/gpio-feature.c +++ b/sound/aoa/core/gpio-feature.c @@ -14,7 +14,7 @@ #include #include "../aoa.h" -/* TODO: these are 20 global variables +/* TODO: these are lots of global variables * that aren't used on most machines... * Move them into a dynamically allocated * structure and use that. @@ -23,6 +23,7 @@ /* these are the GPIO numbers (register addresses as offsets into * the GPIO space) */ static int headphone_mute_gpio; +static int master_mute_gpio; static int amp_mute_gpio; static int lineout_mute_gpio; static int hw_reset_gpio; @@ -32,6 +33,7 @@ static int linein_detect_gpio; /* see the SWITCH_GPIO macro */ static int headphone_mute_gpio_activestate; +static int master_mute_gpio_activestate; static int amp_mute_gpio_activestate; static int lineout_mute_gpio_activestate; static int hw_reset_gpio_activestate; @@ -156,6 +158,7 @@ static int ftr_gpio_get_##name(struct gpio_runtime *rt) \ FTR_GPIO(headphone, 0); FTR_GPIO(amp, 1); FTR_GPIO(lineout, 2); +FTR_GPIO(master, 3); static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) { @@ -172,6 +175,8 @@ static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) hw_reset_gpio, v); } +static struct gpio_methods methods; + static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) { int saved; @@ -181,6 +186,8 @@ static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) ftr_gpio_set_headphone(rt, 0); ftr_gpio_set_amp(rt, 0); ftr_gpio_set_lineout(rt, 0); + if (methods.set_master) + ftr_gpio_set_master(rt, 0); rt->implementation_private = saved; } @@ -193,6 +200,8 @@ static void ftr_gpio_all_amps_restore(struct gpio_runtime *rt) ftr_gpio_set_headphone(rt, (s>>0)&1); ftr_gpio_set_amp(rt, (s>>1)&1); ftr_gpio_set_lineout(rt, (s>>2)&1); + if (methods.set_master) + ftr_gpio_set_master(rt, (s>>3)&1); } static void ftr_handle_notify(struct work_struct *work) @@ -231,6 +240,12 @@ static void ftr_gpio_init(struct gpio_runtime *rt) get_gpio("hw-reset", "audio-hw-reset", &hw_reset_gpio, &hw_reset_gpio_activestate); + if (get_gpio("master-mute", NULL, + &master_mute_gpio, + &master_mute_gpio_activestate)) { + methods.set_master = ftr_gpio_set_master; + methods.get_master = ftr_gpio_get_master; + } headphone_detect_node = get_gpio("headphone-detect", NULL, &headphone_detect_gpio, diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index d9b1d22a62c0..fbf5c933baa4 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c @@ -600,6 +600,7 @@ struct layout_dev { struct snd_kcontrol *headphone_ctrl; struct snd_kcontrol *lineout_ctrl; struct snd_kcontrol *speaker_ctrl; + struct snd_kcontrol *master_ctrl; struct snd_kcontrol *headphone_detected_ctrl; struct snd_kcontrol *lineout_detected_ctrl; @@ -651,6 +652,7 @@ static struct snd_kcontrol_new n##_ctl = { \ AMP_CONTROL(headphone, "Headphone Switch"); AMP_CONTROL(speakers, "Speakers Switch"); AMP_CONTROL(lineout, "Line-Out Switch"); +AMP_CONTROL(master, "Master Switch"); static int detect_choice_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -891,6 +893,11 @@ static void layout_attached_codec(struct aoa_codec *codec) lineout = codec->gpio->methods->get_detect(codec->gpio, AOA_NOTIFY_LINE_OUT); + if (codec->gpio->methods->set_master) { + ctl = snd_ctl_new1(&master_ctl, codec->gpio); + ldev->master_ctrl = ctl; + aoa_snd_ctl_add(ctl); + } while (cc->connected) { if (cc->connected & CC_SPEAKERS) { if (headphones <= 0 && lineout <= 0) -- cgit v1.2.3 From 26db11af12fb58dde1d6327035a248a99f60f112 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Tue, 13 Jan 2009 20:07:55 +0000 Subject: powerpc/ps3: Printing fixups for l64 to ll64 conversion sound/ppc Signed-off-by: Stephen Rothwell Acked-by: Takashi Iwai Acked-by: Geoff Levand Signed-off-by: Benjamin Herrenschmidt --- sound/ppc/snd_ps3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 8f9e3859c37c..ff321110ec02 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c @@ -477,7 +477,7 @@ static int snd_ps3_pcm_prepare(struct snd_pcm_substream *substream) card->dma_start_bus_addr[SND_PS3_CH_R] = runtime->dma_addr + (runtime->dma_bytes / 2); - pr_debug("%s: vaddr=%p bus=%#lx\n", __func__, + pr_debug("%s: vaddr=%p bus=%#llx\n", __func__, card->dma_start_vaddr[SND_PS3_CH_L], card->dma_start_bus_addr[SND_PS3_CH_L]); @@ -1030,7 +1030,7 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) pr_info("%s: nullbuffer alloc failed\n", __func__); goto clean_preallocate; } - pr_debug("%s: null vaddr=%p dma=%#lx\n", __func__, + pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__, the_card.null_buffer_start_vaddr, the_card.null_buffer_start_dma_addr); /* set default sample rate/word width */ -- cgit v1.2.3 From 2de686d227e8869547683de659d5419061c2c518 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Fri, 16 Jan 2009 15:08:02 +1100 Subject: ALSA: hda - add quirks for some 82801H variants to use ALC883_MITAC Add the 82801H variants 1071:8227 and 8086:2503 to use ALC883_MITAC Reference: Ubuntu bug 210865 https://bugs.launchpad.net/bugs/210865 Signed-off-by: Luke Yelavich Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 82dd08431970..5d249a547fbf 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8478,6 +8478,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), + SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), @@ -8526,6 +8527,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), + SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), {} -- cgit v1.2.3 From 2165592b837e086f2b94835a2d81e6f3199c1319 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 16 Jan 2009 11:03:19 +0100 Subject: ALSA: snd-usb-caiaq: support for two more audio devices - Added support for two new audio devices from Native Instuments, 'Audio4DJ' and 'GuitarRig mobile' - Add missing statement about 'Session IO' in Kconfig help text - Version number bumped to 1.3.11 Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/Kconfig | 3 +++ sound/usb/caiaq/caiaq-audio.c | 5 +++-- sound/usb/caiaq/caiaq-control.c | 15 ++++++++++++--- sound/usb/caiaq/caiaq-device.c | 16 ++++++++++++++-- sound/usb/caiaq/caiaq-device.h | 2 ++ 5 files changed, 34 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 4f0eac9bff1e..523aec188ccf 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig @@ -48,7 +48,10 @@ config SND_USB_CAIAQ * Native Instruments Kore Controller * Native Instruments Kore Controller 2 * Native Instruments Audio Kontrol 1 + * Native Instruments Audio 4 DJ * Native Instruments Audio 8 DJ + * Native Instruments Guitar Rig Session I/O + * Native Instruments Guitar Rig mobile To compile this driver as a module, choose M here: the module will be called snd-usb-caiaq. diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index b3a603325835..fc6d571eeac6 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -638,9 +638,10 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): - dev->samplerates |= SNDRV_PCM_RATE_88200; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): dev->samplerates |= SNDRV_PCM_RATE_192000; - break; + /* fall thru */ + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): dev->samplerates |= SNDRV_PCM_RATE_88200; break; diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index ccd763dd7167..6ac5489a0f22 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -39,14 +39,15 @@ static int control_info(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; int is_intval = pos & CNT_INTVAL; + unsigned int id = dev->chip.usb_id; uinfo->count = 1; pos &= ~CNT_INTVAL; - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) + if (((id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) || + (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ))) && (pos == 0)) { - /* current input mode of A8DJ */ + /* current input mode of A8DJ and A4DJ */ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; uinfo->value.integer.max = 2; @@ -247,6 +248,10 @@ static struct caiaq_controller a8dj_controller[] = { { "Software lock", 40 } }; +static struct caiaq_controller a4dj_controller[] = { + { "Current input mode", 0 | CNT_INTVAL } +}; + static int __devinit add_controls(struct caiaq_controller *c, int num, struct snd_usb_caiaqdev *dev) { @@ -295,6 +300,10 @@ int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) ret = add_controls(a8dj_controller, ARRAY_SIZE(a8dj_controller), dev); break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + ret = add_controls(a4dj_controller, + ARRAY_SIZE(a4dj_controller), dev); + break; } return ret; diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 41c36b055f6b..d09fc2a88cf3 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,15 +42,17 @@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.11"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," "{Native Instruments, Kore Controller}," "{Native Instruments, Kore Controller 2}," "{Native Instruments, Audio Kontrol 1}," + "{Native Instruments, Audio 4 DJ}," "{Native Instruments, Audio 8 DJ}," - "{Native Instruments, Session I/O}}"); + "{Native Instruments, Session I/O}," + "{Native Instruments, GuitarRig mobile}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ @@ -116,6 +118,16 @@ static struct usb_device_id snd_usb_id_table[] = { .idVendor = USB_VID_NATIVEINSTRUMENTS, .idProduct = USB_PID_SESSIONIO }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_GUITARRIGMOBILE + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_AUDIO4DJ + }, { /* terminator */ } }; diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index ab56e738c5fc..0560c327d996 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -10,8 +10,10 @@ #define USB_PID_KORECONTROLLER 0x4711 #define USB_PID_KORECONTROLLER2 0x4712 #define USB_PID_AK1 0x0815 +#define USB_PID_AUDIO4DJ 0x0839 #define USB_PID_AUDIO8DJ 0x1978 #define USB_PID_SESSIONIO 0x1915 +#define USB_PID_GUITARRIGMOBILE 0x0d8d #define EP1_BUFSIZE 64 #define CAIAQ_USB_STR_LEN 0xff -- cgit v1.2.3 From 9ef344f89ac41116d4ab138b0941c784a3ab8cf4 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Fri, 16 Jan 2009 22:47:30 +0100 Subject: ALSA: wss-lib: remove "pops" before each played sound A WSS codec is autocalibrated each time before playing sound. Do only one calibration during codec initialization. Complete snd_wss_calibrate_mute to mute loopback volume as well. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 13299aebd077..f0c0be5bb684 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -181,25 +181,6 @@ static void snd_wss_wait(struct snd_wss *chip) udelay(100); } -static void snd_wss_outm(struct snd_wss *chip, unsigned char reg, - unsigned char mask, unsigned char value) -{ - unsigned char tmp = (chip->image[reg] & mask) | value; - - snd_wss_wait(chip); -#ifdef CONFIG_SND_DEBUG - if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) - snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); -#endif - chip->image[reg] = tmp; - if (!chip->calibrate_mute) { - wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); - wmb(); - wss_outb(chip, CS4231P(REG), tmp); - mb(); - } -} - static void snd_wss_dout(struct snd_wss *chip, unsigned char reg, unsigned char value) { @@ -587,7 +568,15 @@ static void snd_wss_calibrate_mute(struct snd_wss *chip, int mute) chip->image[CS4231_RIGHT_INPUT]); snd_wss_dout(chip, CS4231_LOOPBACK, chip->image[CS4231_LOOPBACK]); + } else { + snd_wss_dout(chip, CS4231_LEFT_INPUT, + 0); + snd_wss_dout(chip, CS4231_RIGHT_INPUT, + 0); + snd_wss_dout(chip, CS4231_LOOPBACK, + 0xfd); } + snd_wss_dout(chip, CS4231_AUX1_LEFT_INPUT, mute | chip->image[CS4231_AUX1_LEFT_INPUT]); snd_wss_dout(chip, CS4231_AUX1_RIGHT_INPUT, @@ -630,7 +619,6 @@ static void snd_wss_playback_format(struct snd_wss *chip, int full_calib = 1; mutex_lock(&chip->mce_mutex); - snd_wss_calibrate_mute(chip, 1); if (chip->hardware == WSS_HW_CS4231A || (chip->hardware & WSS_HW_CS4232_MASK)) { spin_lock_irqsave(&chip->reg_lock, flags); @@ -681,7 +669,6 @@ static void snd_wss_playback_format(struct snd_wss *chip, udelay(100); /* this seems to help */ snd_wss_mce_down(chip); } - snd_wss_calibrate_mute(chip, 0); mutex_unlock(&chip->mce_mutex); } @@ -693,7 +680,6 @@ static void snd_wss_capture_format(struct snd_wss *chip, int full_calib = 1; mutex_lock(&chip->mce_mutex); - snd_wss_calibrate_mute(chip, 1); if (chip->hardware == WSS_HW_CS4231A || (chip->hardware & WSS_HW_CS4232_MASK)) { spin_lock_irqsave(&chip->reg_lock, flags); @@ -750,7 +736,6 @@ static void snd_wss_capture_format(struct snd_wss *chip, spin_unlock_irqrestore(&chip->reg_lock, flags); snd_wss_mce_down(chip); } - snd_wss_calibrate_mute(chip, 0); mutex_unlock(&chip->mce_mutex); } @@ -807,6 +792,7 @@ static void snd_wss_init(struct snd_wss *chip) { unsigned long flags; + snd_wss_calibrate_mute(chip, 1); snd_wss_mce_down(chip); #ifdef SNDRV_DEBUG_MCE @@ -830,6 +816,8 @@ static void snd_wss_init(struct snd_wss *chip) snd_wss_mce_up(chip); spin_lock_irqsave(&chip->reg_lock, flags); + chip->image[CS4231_IFACE_CTRL] &= ~CS4231_AUTOCALIB; + snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); snd_wss_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); spin_unlock_irqrestore(&chip->reg_lock, flags); @@ -863,6 +851,7 @@ static void snd_wss_init(struct snd_wss *chip) chip->image[CS4231_REC_FORMAT]); spin_unlock_irqrestore(&chip->reg_lock, flags); snd_wss_mce_down(chip); + snd_wss_calibrate_mute(chip, 0); #ifdef SNDRV_DEBUG_MCE snd_printk("init: (5)\n"); @@ -921,8 +910,6 @@ static void snd_wss_close(struct snd_wss *chip, unsigned int mode) mutex_unlock(&chip->open_mutex); return; } - snd_wss_calibrate_mute(chip, 1); - /* disable IRQ */ spin_lock_irqsave(&chip->reg_lock, flags); if (!(chip->hardware & WSS_HW_AD1848_MASK)) @@ -955,8 +942,6 @@ static void snd_wss_close(struct snd_wss *chip, unsigned int mode) wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ spin_unlock_irqrestore(&chip->reg_lock, flags); - snd_wss_calibrate_mute(chip, 0); - chip->mode = 0; mutex_unlock(&chip->open_mutex); } @@ -1149,7 +1134,7 @@ irqreturn_t snd_wss_interrupt(int irq, void *dev_id) if (chip->hardware & WSS_HW_AD1848_MASK) wss_outb(chip, CS4231P(STATUS), 0); else - snd_wss_outm(chip, CS4231_IRQ_STATUS, status, 0); + snd_wss_out(chip, CS4231_IRQ_STATUS, status); spin_unlock(&chip->reg_lock); return IRQ_HANDLED; } -- cgit v1.2.3 From 989738c4f82126207b9e04c9395b78e544f3d33c Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Sat, 17 Jan 2009 18:47:27 -0500 Subject: ALSA: hda: fix invalid power mapping masks Fixed invalid power mappings for ports 0xd and 0xe on 93hd83xxx codecs. They were shifted right one too many bits. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index faef1ca86600..a4d4afe6b4fc 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -334,7 +334,7 @@ static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { }; static unsigned int stac92hd83xxx_pwr_mapping[4] = { - 0x03, 0x0c, 0x10, 0x40, + 0x03, 0x0c, 0x20, 0x80, }; static hda_nid_t stac92hd83xxx_amp_nids[1] = { -- cgit v1.2.3 From 8693290b9038f32b6b9bafd97b7e18465d62655b Mon Sep 17 00:00:00 2001 From: Andreas Bergmeier Date: Sun, 18 Jan 2009 18:48:03 +0100 Subject: ALSA: usb-audio - Quirk for Serato phono Ignore errors (wrong usb interface data) found when using the serato scratch live box with alsa Thus the alsa controls can be accessed (beware: they don't work though - but at least it's one ugly error message less) Signed-off-by: Andreas Bergmeier Signed-off-by: Takashi Iwai --- sound/usb/usbmixer_maps.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'sound') diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c index f41214f3ad6b..3e5d66cf1f5a 100644 --- a/sound/usb/usbmixer_maps.c +++ b/sound/usb/usbmixer_maps.c @@ -261,6 +261,22 @@ static struct usbmix_name_map aureon_51_2_map[] = { {} /* terminator */ }; +static struct usbmix_name_map scratch_live_map[] = { + /* 1: IT Line 1 (USB streaming) */ + /* 2: OT Line 1 (Speaker) */ + /* 3: IT Line 1 (Line connector) */ + { 4, "Line 1 In" }, /* FU */ + /* 5: OT Line 1 (USB streaming) */ + /* 6: IT Line 2 (USB streaming) */ + /* 7: OT Line 2 (Speaker) */ + /* 8: IT Line 2 (Line connector) */ + { 9, "Line 2 In" }, /* FU */ + /* 10: OT Line 2 (USB streaming) */ + /* 11: IT Mic (Line connector) */ + /* 12: OT Mic (USB streaming) */ + { 0 } /* terminator */ +}; + /* * Control map entries */ @@ -316,6 +332,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x0ccd, 0x0028), .map = aureon_51_2_map, }, + { + .id = USB_ID(0x13e5, 0x0001), + .map = scratch_live_map, + .ignore_ctl_error = 1, + }, { 0 } /* terminator */ }; -- cgit v1.2.3 From 22c733788bbd4b75c00279119a83da5cd74b987a Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 19 Jan 2009 10:07:21 +0100 Subject: sound: virtuoso: enable UART on Xonar HDAV1.3 This hardware has a better chance of working correctly if we don't forget to enable it. Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/pci/oxygen/virtuoso.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index e9e829e83d7a..a96216643053 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -908,6 +908,7 @@ static const struct oxygen_model model_xonar_hdav = { .dac_channels = 8, .dac_volume_min = 0x0f, .dac_volume_max = 0xff, + .misc_flags = OXYGEN_MISC_MIDI, .function_flags = OXYGEN_FUNCTION_2WIRE, .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, -- cgit v1.2.3 From 45bf81011312958777f33088ac0911f241ada297 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 19 Jan 2009 10:07:58 +0100 Subject: sound: virtuoso: add newline Add a missing newline. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/virtuoso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index a96216643053..18c7c91786bc 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -683,7 +683,7 @@ static void xonar_hdav_uart_input(struct oxygen *chip) if (chip->uart_input_count >= 2 && chip->uart_input[chip->uart_input_count - 2] == 'O' && chip->uart_input[chip->uart_input_count - 1] == 'K') { - printk(KERN_DEBUG "message from Xonar HDAV HDMI chip received:"); + printk(KERN_DEBUG "message from Xonar HDAV HDMI chip received:\n"); print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, chip->uart_input, chip->uart_input_count); chip->uart_input_count = 0; -- cgit v1.2.3 From 3288a66243c8d34c299dd6b8a336a34321ccff52 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 19 Jan 2009 10:08:38 +0100 Subject: sound: virtuoso: document HDAV1.3 driver status Mention in the Kconfig help text that the HDAV1.3 code is rather experimental. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 6e3a1848447c..82b9bddcdcd6 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -744,8 +744,8 @@ config SND_VIRTUOSO select SND_OXYGEN_LIB help Say Y here to include support for sound cards based on the - Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X and - HDAV1.3 (Deluxe). + Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2 and D2X. + Support for the HDAV1.3 (Deluxe) is very experimental. To compile this driver as a module, choose M here: the module will be called snd-virtuoso. -- cgit v1.2.3 From f3a374e55a60f7ca57335c24ef875731b6683147 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 19 Jan 2009 14:30:48 +0100 Subject: ALSA: ca0106 - Add quirk for GA-G1975X mobo Giga-byte GA-G1975X mobo has a CA0106 on-board chip. Reference: bnc#395807 https://bugzilla.novell.com/show_bug.cgi?id=395807 Signed-off-by: Takashi Iwai --- sound/pci/ca0106/ca0106_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 0e62205d4081..3aac7e6489c6 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -255,6 +255,14 @@ static struct snd_ca0106_details ca0106_chip_details[] = { .gpio_type = 2, .i2c_adc = 1, .spi_dac = 1 } , + /* Giga-byte GA-G1975X mobo + * Novell bnc#395807 + */ + /* FIXME: the GPIO and I2C setting aren't tested well */ + { .serial = 0x1458a006, + .name = "Giga-byte GA-G1975X", + .gpio_type = 1, + .i2c_adc = 1 }, /* Shuttle XPC SD31P which has an onboard Creative Labs * Sound Blaster Live! 24-bit EAX * high-definition 7.1 audio processor". -- cgit v1.2.3 From 29fdbec2dcb1ce364812778271056aa9516ff3ed Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 13:07:55 +0100 Subject: ALSA: hda - Add extra volume offset to standard volume amp macros Added the volume offset to base for the standard volume controls to handle elements with too big volume scales like -96dB..0dB. For such elements, you can set the base volume to reduce the range. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 45 +++++++++++++++++++++++++++++++++++++-------- sound/pci/hda/hda_local.h | 5 ++++- 2 files changed, 41 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b7bba7dc7cf1..0cf2424ada6a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1119,6 +1119,7 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, u16 nid = get_amp_nid(kcontrol); u8 chs = get_amp_channels(kcontrol); int dir = get_amp_direction(kcontrol); + unsigned int ofs = get_amp_offset(kcontrol); u32 caps; caps = query_amp_caps(codec, nid, dir); @@ -1130,6 +1131,8 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, kcontrol->id.name); return -EINVAL; } + if (ofs < caps) + caps -= ofs; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = chs == 3 ? 2 : 1; uinfo->value.integer.min = 0; @@ -1138,6 +1141,32 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info); + +static inline unsigned int +read_amp_value(struct hda_codec *codec, hda_nid_t nid, + int ch, int dir, int idx, unsigned int ofs) +{ + unsigned int val; + val = snd_hda_codec_amp_read(codec, nid, ch, dir, idx); + val &= HDA_AMP_VOLMASK; + if (val >= ofs) + val -= ofs; + else + val = 0; + return val; +} + +static inline int +update_amp_value(struct hda_codec *codec, hda_nid_t nid, + int ch, int dir, int idx, unsigned int ofs, + unsigned int val) +{ + if (val > 0) + val += ofs; + return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, + HDA_AMP_VOLMASK, val); +} + int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -1146,14 +1175,13 @@ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, int chs = get_amp_channels(kcontrol); int dir = get_amp_direction(kcontrol); int idx = get_amp_index(kcontrol); + unsigned int ofs = get_amp_offset(kcontrol); long *valp = ucontrol->value.integer.value; if (chs & 1) - *valp++ = snd_hda_codec_amp_read(codec, nid, 0, dir, idx) - & HDA_AMP_VOLMASK; + *valp++ = read_amp_value(codec, nid, 0, dir, idx, ofs); if (chs & 2) - *valp = snd_hda_codec_amp_read(codec, nid, 1, dir, idx) - & HDA_AMP_VOLMASK; + *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); return 0; } EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get); @@ -1166,18 +1194,17 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, int chs = get_amp_channels(kcontrol); int dir = get_amp_direction(kcontrol); int idx = get_amp_index(kcontrol); + unsigned int ofs = get_amp_offset(kcontrol); long *valp = ucontrol->value.integer.value; int change = 0; snd_hda_power_up(codec); if (chs & 1) { - change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, - 0x7f, *valp); + change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); valp++; } if (chs & 2) - change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, - 0x7f, *valp); + change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); snd_hda_power_down(codec); return change; } @@ -1189,6 +1216,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, struct hda_codec *codec = snd_kcontrol_chip(kcontrol); hda_nid_t nid = get_amp_nid(kcontrol); int dir = get_amp_direction(kcontrol); + unsigned int ofs = get_amp_offset(kcontrol); u32 caps, val1, val2; if (size < 4 * sizeof(unsigned int)) @@ -1197,6 +1225,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, val2 = (caps & AC_AMPCAP_STEP_SIZE) >> AC_AMPCAP_STEP_SIZE_SHIFT; val2 = (val2 + 1) * 25; val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); + val1 += ofs; val1 = ((int)val1) * ((int)val2); if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) return -EFAULT; diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 1dd8716c387f..d53ce1f85419 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -26,8 +26,10 @@ /* * for mixer controls */ +#define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \ + ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23)) #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \ - ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19)) + HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0) /* mono volume with index (index=0,1,...) (channel=1,2) */ #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ @@ -456,6 +458,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) +#define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f) /* * CEA Short Audio Descriptor data -- cgit v1.2.3 From 7c7767ebe2fa847c91a0dd5551ca422aba359473 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 15:28:38 +0100 Subject: ALSA: hda - Halve too large volume scales for STAC/IDT codecs STAC/IDT codecs have often too large volume scales such as -96dB, and exposing this as is results in too large scale in percentage representation. This patch adds the check of the volume scale and halves the volume range if it's too large automatically. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a4d4afe6b4fc..c2d4abee3b09 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -166,6 +166,7 @@ struct sigmatel_spec { unsigned int alt_switch: 1; unsigned int hp_detect: 1; unsigned int spdif_mute: 1; + unsigned int check_volume_offset:1; /* gpio lines */ unsigned int eapd_mask; @@ -202,6 +203,8 @@ struct sigmatel_spec { hda_nid_t hp_dacs[5]; hda_nid_t speaker_dacs[5]; + int volume_offset; + /* capture */ hda_nid_t *adc_nids; unsigned int num_adcs; @@ -1297,6 +1300,8 @@ static int stac92xx_build_controls(struct hda_codec *codec) unsigned int vmaster_tlv[4]; snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], HDA_OUTPUT, vmaster_tlv); + /* correct volume offset */ + vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; err = snd_hda_add_vmaster(codec, "Master Playback Volume", vmaster_tlv, slave_vols); if (err < 0) @@ -2980,14 +2985,34 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) } /* create volume control/switch for the given prefx type */ -static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) +static int create_controls(struct hda_codec *codec, const char *pfx, + hda_nid_t nid, int chs) { + struct sigmatel_spec *spec = codec->spec; char name[32]; int err; + if (!spec->check_volume_offset) { + unsigned int caps, step, nums, db_scale; + caps = query_amp_caps(codec, nid, HDA_OUTPUT); + step = (caps & AC_AMPCAP_STEP_SIZE) >> + AC_AMPCAP_STEP_SIZE_SHIFT; + step = (step + 1) * 25; /* in .01dB unit */ + nums = (caps & AC_AMPCAP_NUM_STEPS) >> + AC_AMPCAP_NUM_STEPS_SHIFT; + db_scale = nums * step; + /* if dB scale is over -64dB, and finer enough, + * let's reduce it to half + */ + if (db_scale > 6400 && nums >= 0x1f) + spec->volume_offset = nums / 2; + spec->check_volume_offset = 1; + } + sprintf(name, "%s Playback Volume", pfx); err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, - HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); + HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, + spec->volume_offset)); if (err < 0) return err; sprintf(name, "%s Playback Switch", pfx); @@ -3053,10 +3078,10 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, nid = spec->multiout.dac_nids[i]; if (i == 2) { /* Center/LFE */ - err = create_controls(spec, "Center", nid, 1); + err = create_controls(codec, "Center", nid, 1); if (err < 0) return err; - err = create_controls(spec, "LFE", nid, 2); + err = create_controls(codec, "LFE", nid, 2); if (err < 0) return err; @@ -3084,7 +3109,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, break; } } - err = create_controls(spec, name, nid, 3); + err = create_controls(codec, name, nid, 3); if (err < 0) return err; } @@ -3139,7 +3164,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, nid = spec->hp_dacs[i]; if (!nid) continue; - err = create_controls(spec, pfxs[nums++], nid, 3); + err = create_controls(codec, pfxs[nums++], nid, 3); if (err < 0) return err; } @@ -3153,7 +3178,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, nid = spec->speaker_dacs[i]; if (!nid) continue; - err = create_controls(spec, pfxs[nums++], nid, 3); + err = create_controls(codec, pfxs[nums++], nid, 3); if (err < 0) return err; } @@ -3729,7 +3754,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, } if (lfe_pin) { - err = create_controls(spec, "LFE", lfe_pin, 1); + err = create_controls(codec, "LFE", lfe_pin, 1); if (err < 0) return err; } -- cgit v1.2.3 From 89ce9e87083216389d2ff5740cc60f835537d8d0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 17:15:57 +0100 Subject: ALSA: hda - Add debug prints for digital I/O pin detections Add the debug prints for digital I/O pin detections in snd_hda_parse_pin_def_config() function. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b7bba7dc7cf1..c03de0bc3999 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3499,6 +3499,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, cfg->hp_pins[1], cfg->hp_pins[2], cfg->hp_pins[3], cfg->hp_pins[4]); snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); + if (cfg->dig_out_pin) + snd_printd(" dig-out=0x%x\n", cfg->dig_out_pin); snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," " cd=0x%x, aux=0x%x\n", cfg->input_pins[AUTO_PIN_MIC], @@ -3507,6 +3509,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, cfg->input_pins[AUTO_PIN_FRONT_LINE], cfg->input_pins[AUTO_PIN_CD], cfg->input_pins[AUTO_PIN_AUX]); + if (cfg->dig_out_pin) + snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin); return 0; } -- cgit v1.2.3 From 1b52ae701fedf97f9984e73b6a1fe2444230871b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 17:17:29 +0100 Subject: ALSA: hda - Detect non-SPDIF digital I/O Accept non-SPDIF digital I/O pins as the digital pins. These are usually corresponding to HDMI I/O. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c03de0bc3999..2d6f72ca0140 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3390,9 +3390,11 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, cfg->input_pins[AUTO_PIN_AUX] = nid; break; case AC_JACK_SPDIF_OUT: + case AC_JACK_DIG_OTHER_OUT: cfg->dig_out_pin = nid; break; case AC_JACK_SPDIF_IN: + case AC_JACK_DIG_OTHER_IN: cfg->dig_in_pin = nid; break; } -- cgit v1.2.3 From caa10b6e808a4d65eb0306f0006308244f2b8d79 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 17:19:01 +0100 Subject: ALSA: hda - Improve auto-probing of STAC9872 codec Use the standard STAC/IDT auto-probing routine for non-static STAC9872 codec probing. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 58 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a4d4afe6b4fc..b6e797d1c218 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -5511,24 +5511,62 @@ static struct snd_pci_quirk stac9872_cfg_tbl[] = { {} }; +static struct snd_kcontrol_new stac9872_mixer[] = { + HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), + STAC_INPUT_SOURCE(1), + { } /* end */ +}; + +static hda_nid_t stac9872_pin_nids[] = { + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x11, 0x13, 0x14, +}; + +static hda_nid_t stac9872_adc_nids[] = { + 0x8 /*,0x6*/ +}; + +static hda_nid_t stac9872_mux_nids[] = { + 0x15 +}; + static int patch_stac9872(struct hda_codec *codec) { struct sigmatel_spec *spec; - int board_config; - board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, - stac9872_models, - stac9872_cfg_tbl); - if (board_config < 0) - /* unknown config, let generic-parser do its job... */ - return snd_hda_parse_generic_codec(codec); - spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) return -ENOMEM; - codec->spec = spec; - switch (board_config) { + + spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, + stac9872_models, + stac9872_cfg_tbl); + if (spec->board_config < 0) { + int err; + + spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); + spec->pin_nids = stac9872_pin_nids; + spec->multiout.dac_nids = spec->dac_nids; + spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); + spec->adc_nids = stac9872_adc_nids; + spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); + spec->mux_nids = stac9872_mux_nids; + spec->mixer = stac9872_mixer; + spec->init = vaio_init; + + err = stac92xx_parse_auto_config(codec, 0x10, 0x12); + if (err < 0) { + stac92xx_free(codec); + return -EINVAL; + } + spec->input_mux = &spec->private_imux; + codec->patch_ops = stac92xx_patch_ops; + return 0; + } + + switch (spec->board_config) { case CXD9872RD_VAIO: case STAC9872AK_VAIO: case STAC9872K_VAIO: -- cgit v1.2.3 From 41b5b01afb71226653282951965d5efa9d7b843d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 18:21:23 +0100 Subject: ALSA: hda - Don't break the PCM creation loop Don't break the loop in snd_hda_codec_build_pcms() even if the item has no substreams. It's possible that it's an empty item and the next item containing the valid substreams (e.g. realtek codecs may create the analog and alt-analog but no digitl streams). Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 2d6f72ca0140..0129e95672ae 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2613,7 +2613,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) int dev; if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) - return 0; /* no substreams assigned */ + continue; /* no substreams assigned */ if (!cpcm->pcm) { dev = get_empty_pcm_device(codec->bus, cpcm->pcm_type); -- cgit v1.2.3 From 2297bd6e526ce1469279284ffda9140f8d60ea84 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 18:24:13 +0100 Subject: ALSA: hda - Check HDMI jack types in the auto configuration Add dig_out_type and dig_in_type fields to autocfg struct. A proper HDA_PCM_TYPE_* value is assigned to these fields according to the pin-jack location type value. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 8 ++++++++ sound/pci/hda/hda_local.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0129e95672ae..dd419ce43d92 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3392,10 +3392,18 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: cfg->dig_out_pin = nid; + if (loc == AC_JACK_LOC_HDMI) + cfg->dig_out_type = HDA_PCM_TYPE_HDMI; + else + cfg->dig_out_type = HDA_PCM_TYPE_SPDIF; break; case AC_JACK_SPDIF_IN: case AC_JACK_DIG_OTHER_IN: cfg->dig_in_pin = nid; + if (loc == AC_JACK_LOC_HDMI) + cfg->dig_in_type = HDA_PCM_TYPE_HDMI; + else + cfg->dig_in_type = HDA_PCM_TYPE_SPDIF; break; } } diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 1dd8716c387f..a4ecd77a451a 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -355,6 +355,8 @@ struct auto_pin_cfg { hda_nid_t dig_out_pin; hda_nid_t dig_in_pin; hda_nid_t mono_out_pin; + int dig_out_type; /* HDA_PCM_TYPE_XXX */ + int dig_in_type; /* HDA_PCM_TYPE_XXX */ }; #define get_defcfg_connect(cfg) \ -- cgit v1.2.3 From 8c441982fdc00f77b7aa609061c6411f47bcceda Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 18:30:20 +0100 Subject: ALSA: hda - Assign proper digital I/O type for STAC/IDT Assign the proper PCM digital I/O type (HDA_PCM_TYPE_*) for the digital I/O on STAC/IDT codecs. HDA_PCM_TYPE_HDMI is assigned for the HDMI I/O. A similar framework is implemented to patch_realtek.c, but it's not set up and still using only HDA_PCM_TYPE_SPDIF yet. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 6 +++++- sound/pci/hda/patch_sigmatel.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5d249a547fbf..4fdae06162ed 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -269,6 +269,7 @@ struct alc_spec { * dig_out_nid and hp_nid are optional */ hda_nid_t alt_dac_nid; + int dig_out_type; /* capture */ unsigned int num_adc_nids; @@ -3087,7 +3088,10 @@ static int alc_build_pcms(struct hda_codec *codec) codec->num_pcms = 2; info = spec->pcm_rec + 1; info->name = spec->stream_name_digital; - info->pcm_type = HDA_PCM_TYPE_SPDIF; + if (spec->dig_out_type) + info->pcm_type = spec->dig_out_type; + else + info->pcm_type = HDA_PCM_TYPE_SPDIF; if (spec->multiout.dig_out_nid && spec->stream_digital_playback) { info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b6e797d1c218..1dd448e85bc1 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2553,7 +2553,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) codec->num_pcms++; info++; info->name = "STAC92xx Digital"; - info->pcm_type = HDA_PCM_TYPE_SPDIF; + info->pcm_type = spec->autocfg.dig_out_type; if (spec->multiout.dig_out_nid) { info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; -- cgit v1.2.3 From e64f14f4e570d6ec5bc88abac92a3a27150756d7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Jan 2009 18:32:55 +0100 Subject: ALSA: hda - Allow digital-only I/O on ALC262 codec Some laptops like VAIO have multiple codecs and uses ALC262 only for the SPIDF output without analog I/O. So far, the codec-parser assumes the presence of analog I/O and returned an error for such a case. This patch adds some hacks to allow the digital-only configuration for ALC262. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4fdae06162ed..4cfa78c54398 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -306,6 +306,9 @@ struct alc_spec { unsigned int jack_present: 1; unsigned int master_sw: 1; + /* other flags */ + unsigned int no_analog :1; /* digital I/O only */ + /* for virtual master */ hda_nid_t vmaster_nid; #ifdef CONFIG_SND_HDA_POWER_SAVE @@ -2019,11 +2022,13 @@ static int alc_build_controls(struct hda_codec *codec) spec->multiout.dig_out_nid); if (err < 0) return err; - err = snd_hda_create_spdif_share_sw(codec, - &spec->multiout); - if (err < 0) - return err; - spec->multiout.share_spdif = 1; + if (!spec->no_analog) { + err = snd_hda_create_spdif_share_sw(codec, + &spec->multiout); + if (err < 0) + return err; + spec->multiout.share_spdif = 1; + } } if (spec->dig_in_nid) { err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); @@ -2032,7 +2037,8 @@ static int alc_build_controls(struct hda_codec *codec) } /* if we have no master control, let's create it */ - if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { + if (!spec->no_analog && + !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { unsigned int vmaster_tlv[4]; snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, HDA_OUTPUT, vmaster_tlv); @@ -2041,7 +2047,8 @@ static int alc_build_controls(struct hda_codec *codec) if (err < 0) return err; } - if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { + if (!spec->no_analog && + !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { err = snd_hda_add_vmaster(codec, "Master Playback Switch", NULL, alc_slave_sws); if (err < 0) @@ -3060,6 +3067,9 @@ static int alc_build_pcms(struct hda_codec *codec) codec->num_pcms = 1; codec->pcm_info = info; + if (spec->no_analog) + goto skip_analog; + info->name = spec->stream_name_analog; if (spec->stream_analog_playback) { if (snd_BUG_ON(!spec->multiout.dac_nids)) @@ -3083,6 +3093,7 @@ static int alc_build_pcms(struct hda_codec *codec) } } + skip_analog: /* SPDIF for stream index #1 */ if (spec->multiout.dig_out_nid || spec->dig_in_nid) { codec->num_pcms = 2; @@ -3106,6 +3117,9 @@ static int alc_build_pcms(struct hda_codec *codec) codec->spdif_status_reset = 1; } + if (spec->no_analog) + return 0; + /* If the use of more than one ADC is requested for the current * model, configure a second analog capture-only PCM. */ @@ -10468,8 +10482,14 @@ static int alc262_parse_auto_config(struct hda_codec *codec) alc262_ignore); if (err < 0) return err; - if (!spec->autocfg.line_outs) + if (!spec->autocfg.line_outs) { + if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) { + spec->multiout.max_channels = 2; + spec->no_analog = 1; + goto dig_only; + } return 0; /* can't find valid BIOS pin config */ + } err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); if (err < 0) return err; @@ -10479,8 +10499,11 @@ static int alc262_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + dig_only: + if (spec->autocfg.dig_out_pin) { spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; + spec->dig_out_type = spec->autocfg.dig_out_type; + } if (spec->autocfg.dig_in_pin) spec->dig_in_nid = ALC262_DIGIN_NID; @@ -10875,7 +10898,7 @@ static int patch_alc262(struct hda_codec *codec) spec->capsrc_nids = alc262_capsrc_nids; } } - if (!spec->cap_mixer) + if (!spec->cap_mixer && !spec->no_analog) set_capture_mixer(spec); spec->vmaster_nid = 0x0c; -- cgit v1.2.3 From 65557f350749e11d51d15dee759d6e04f290e256 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Tue, 20 Jan 2009 16:50:25 -0500 Subject: ALSA: hda: 83xxx port 0xe DAC selection On the 92hd8xxx codecs port 0xe needs the connection selected to be the last DAC in the list. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a4d4afe6b4fc..3b97d1eff92a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -841,10 +841,6 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = { }; static struct hda_verb stac92hd83xxx_core_init[] = { - /* start of config #1 */ - { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3}, - - /* start of config #2 */ { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, @@ -4754,7 +4750,9 @@ static struct hda_input_mux stac92hd83xxx_dmux = { static int patch_stac92hd83xxx(struct hda_codec *codec) { struct sigmatel_spec *spec; + hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; int err; + int num_dacs; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -4773,13 +4771,21 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); spec->multiout.dac_nids = spec->dac_nids; + + /* set port 0xe to select the last DAC + */ + num_dacs = snd_hda_get_connections(codec, 0x0e, + conn, STAC92HD83_DAC_COUNT + 1) - 1; + + snd_hda_codec_write_cache(codec, 0xe, 0, + AC_VERB_SET_CONNECT_SEL, num_dacs); + spec->init = stac92hd83xxx_core_init; switch (codec->vendor_id) { case 0x111d7605: break; default: spec->num_pwrs--; - spec->init++; /* switch to config #2 */ } spec->mixer = stac92hd83xxx_mixer; -- cgit v1.2.3 From 1e137f929bb490ff615ea475ac3904d58b0cdd5e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 21 Jan 2009 07:41:22 +0100 Subject: ALSA: hda - Clean up old VAIO hack codes for STAC9872 Get rid of old VAIO static hack codes for STAC9872 and use the BIOS auto-parser for all models. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 238 ++++------------------------------------- 1 file changed, 21 insertions(+), 217 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 775f8581906e..dbe8b1201eff 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -5351,172 +5351,12 @@ static int patch_stac9205(struct hda_codec *codec) * STAC9872 hack */ -/* static config for Sony VAIO FE550G and Sony VAIO AR */ -static hda_nid_t vaio_dacs[] = { 0x2 }; -#define VAIO_HP_DAC 0x5 -static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; -static hda_nid_t vaio_mux_nids[] = { 0x15 }; - -static struct hda_input_mux vaio_mux = { - .num_items = 3, - .items = { - /* { "HP", 0x0 }, */ - { "Mic Jack", 0x1 }, - { "Internal Mic", 0x2 }, - { "PCM", 0x3 }, - } -}; - -static struct hda_verb vaio_init[] = { - {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ - {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, - {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ - {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ - {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ - {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ - {} -}; - -static struct hda_verb vaio_ar_init[] = { - {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ - {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ - {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ - {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ -/* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ +static struct hda_verb stac9872_core_init[] = { {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ - {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ -/* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ {} }; -static struct snd_kcontrol_new vaio_mixer[] = { - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), - /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ - HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), - HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .count = 1, - .info = stac92xx_mux_enum_info, - .get = stac92xx_mux_enum_get, - .put = stac92xx_mux_enum_put, - }, - {} -}; - -static struct snd_kcontrol_new vaio_ar_mixer[] = { - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), - /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ - HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), - HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), - /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .count = 1, - .info = stac92xx_mux_enum_info, - .get = stac92xx_mux_enum_get, - .put = stac92xx_mux_enum_put, - }, - {} -}; - -static struct hda_codec_ops stac9872_patch_ops = { - .build_controls = stac92xx_build_controls, - .build_pcms = stac92xx_build_pcms, - .init = stac92xx_init, - .free = stac92xx_free, -#ifdef SND_HDA_NEEDS_RESUME - .resume = stac92xx_resume, -#endif -}; - -static int stac9872_vaio_init(struct hda_codec *codec) -{ - int err; - - err = stac92xx_init(codec); - if (err < 0) - return err; - if (codec->patch_ops.unsol_event) - codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); - return 0; -} - -static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) -{ - if (get_pin_presence(codec, 0x0a)) { - stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); - stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); - } else { - stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); - stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); - } -} - -static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res) -{ - switch (res >> 26) { - case STAC_HP_EVENT: - stac9872_vaio_hp_detect(codec, res); - break; - } -} - -static struct hda_codec_ops stac9872_vaio_patch_ops = { - .build_controls = stac92xx_build_controls, - .build_pcms = stac92xx_build_pcms, - .init = stac9872_vaio_init, - .free = stac92xx_free, - .unsol_event = stac9872_vaio_unsol_event, -#ifdef CONFIG_PM - .resume = stac92xx_resume, -#endif -}; - -enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ - CXD9872RD_VAIO, - /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ - STAC9872AK_VAIO, - /* Unknown. id=0x83847661 and subsys=0x104D1200. */ - STAC9872K_VAIO, - /* AR Series. id=0x83847664 and subsys=104D1300 */ - CXD9872AKD_VAIO, - STAC_9872_MODELS, -}; - -static const char *stac9872_models[STAC_9872_MODELS] = { - [CXD9872RD_VAIO] = "vaio", - [CXD9872AKD_VAIO] = "vaio-ar", -}; - -static struct snd_pci_quirk stac9872_cfg_tbl[] = { - SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), - SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), - SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), - SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO), - {} -}; - static struct snd_kcontrol_new stac9872_mixer[] = { HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), @@ -5540,72 +5380,36 @@ static hda_nid_t stac9872_mux_nids[] = { static int patch_stac9872(struct hda_codec *codec) { struct sigmatel_spec *spec; + int err; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) return -ENOMEM; codec->spec = spec; +#if 0 /* no model right now */ spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, stac9872_models, stac9872_cfg_tbl); - if (spec->board_config < 0) { - int err; - - spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); - spec->pin_nids = stac9872_pin_nids; - spec->multiout.dac_nids = spec->dac_nids; - spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); - spec->adc_nids = stac9872_adc_nids; - spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); - spec->mux_nids = stac9872_mux_nids; - spec->mixer = stac9872_mixer; - spec->init = vaio_init; - - err = stac92xx_parse_auto_config(codec, 0x10, 0x12); - if (err < 0) { - stac92xx_free(codec); - return -EINVAL; - } - spec->input_mux = &spec->private_imux; - codec->patch_ops = stac92xx_patch_ops; - return 0; - } - - switch (spec->board_config) { - case CXD9872RD_VAIO: - case STAC9872AK_VAIO: - case STAC9872K_VAIO: - spec->mixer = vaio_mixer; - spec->init = vaio_init; - spec->multiout.max_channels = 2; - spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); - spec->multiout.dac_nids = vaio_dacs; - spec->multiout.hp_nid = VAIO_HP_DAC; - spec->num_adcs = ARRAY_SIZE(vaio_adcs); - spec->adc_nids = vaio_adcs; - spec->num_pwrs = 0; - spec->input_mux = &vaio_mux; - spec->mux_nids = vaio_mux_nids; - codec->patch_ops = stac9872_vaio_patch_ops; - break; - - case CXD9872AKD_VAIO: - spec->mixer = vaio_ar_mixer; - spec->init = vaio_ar_init; - spec->multiout.max_channels = 2; - spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); - spec->multiout.dac_nids = vaio_dacs; - spec->multiout.hp_nid = VAIO_HP_DAC; - spec->num_adcs = ARRAY_SIZE(vaio_adcs); - spec->num_pwrs = 0; - spec->adc_nids = vaio_adcs; - spec->input_mux = &vaio_mux; - spec->mux_nids = vaio_mux_nids; - codec->patch_ops = stac9872_patch_ops; - break; - } +#endif + spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); + spec->pin_nids = stac9872_pin_nids; + spec->multiout.dac_nids = spec->dac_nids; + spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); + spec->adc_nids = stac9872_adc_nids; + spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); + spec->mux_nids = stac9872_mux_nids; + spec->mixer = stac9872_mixer; + spec->init = stac9872_core_init; + + err = stac92xx_parse_auto_config(codec, 0x10, 0x12); + if (err < 0) { + stac92xx_free(codec); + return -EINVAL; + } + spec->input_mux = &spec->private_imux; + codec->patch_ops = stac92xx_patch_ops; return 0; } -- cgit v1.2.3 From 48972cc5101dee24243c1b53d409cc27880e7a29 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Wed, 21 Jan 2009 08:18:16 +0100 Subject: ALSA: cmi8330: add OPL3 support Add OPL3 handling to the driver and volume control for FM synthesis. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/Kconfig | 1 + sound/isa/cmi8330.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index ce0aa044e274..be2d377ff90a 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -94,6 +94,7 @@ config SND_CMI8330 tristate "C-Media CMI8330" select SND_WSS_LIB select SND_SB16_DSP + select SND_OPL3_LIB help Say Y here to include support for soundcards based on the C-Media CMI8330 chip. diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index e49aec700a55..dec6ea52cc4f 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -79,6 +80,7 @@ static int sbdma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; +static long fmport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard."); @@ -107,6 +109,8 @@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver."); module_param_array(wssdma, int, NULL, 0444); MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); +module_param_array(fmport, long, NULL, 0444); +MODULE_PARM_DESC(fmport, "FM port # for CMI8330 driver."); #ifdef CONFIG_PNP static int isa_registered; static int pnp_registered; @@ -219,8 +223,10 @@ WSS_SINGLE("3D Control - Switch", 0, CMI8330_RMUX3D, 5, 1, 1), WSS_SINGLE("PC Speaker Playback Volume", 0, CMI8330_OUTPUTVOL, 3, 3, 0), -WSS_SINGLE("FM Playback Switch", 0, - CMI8330_RECMUX, 3, 1, 1), +WSS_DOUBLE("FM Playback Switch", 0, + CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), +WSS_DOUBLE("FM Playback Volume", 0, + CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", CAPTURE, SWITCH), 0, CMI8330_RMUX3D, 7, 1, 1), WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0, @@ -333,6 +339,7 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard, wssport[dev] = pnp_port_start(pdev, 0); wssdma[dev] = pnp_dma(pdev, 0); wssirq[dev] = pnp_irq(pdev, 0); + fmport[dev] = pnp_port_start(pdev, 1); /* allocate SB16 resources */ pdev = acard->play; @@ -487,6 +494,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) { struct snd_cmi8330 *acard; int i, err; + struct snd_opl3 *opl3; acard = card->private_data; err = snd_wss_create(card, wssport[dev] + 4, -1, @@ -530,6 +538,24 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) snd_printk(KERN_ERR PFX "failed to create pcms\n"); return err; } + if (fmport[dev] != SNDRV_AUTO_PORT) { + if (snd_opl3_create(card, + fmport[dev], fmport[dev] + 2, + OPL3_HW_AUTO, 0, &opl3) < 0) { + snd_printk(KERN_ERR PFX + "no OPL device at 0x%lx-0x%lx ?\n", + fmport[dev], fmport[dev] + 2); + } else { + err = snd_opl3_timer_new(opl3, 0, 1); + if (err < 0) + return err; + + err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (err < 0) + return err; + } + } + strcpy(card->driver, "CMI8330/C3D"); strcpy(card->shortname, "C-Media CMI8330/C3D"); -- cgit v1.2.3 From c9864fd30a28aceef5293f28559c4a2f5a20d7d5 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Wed, 21 Jan 2009 08:19:27 +0100 Subject: ALSA: sscape: use common MPU401 macros Remove local macros which redefines the common ones. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 6a7f842b9627..681e2237acb7 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -89,9 +89,6 @@ MODULE_DEVICE_TABLE(pnp_card, sscape_pnpids); #endif -#define MPU401_IO(i) ((i) + 0) -#define MIDI_DATA_IO(i) ((i) + 0) -#define MIDI_CTRL_IO(i) ((i) + 1) #define HOST_CTRL_IO(i) ((i) + 2) #define HOST_DATA_IO(i) ((i) + 3) #define ODIE_ADDR_IO(i) ((i) + 4) @@ -327,7 +324,7 @@ static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, */ static inline int verify_mpu401(const struct snd_mpu401 * mpu) { - return ((inb(MIDI_CTRL_IO(mpu->port)) & 0xc0) == 0x80); + return ((inb(MPU401C(mpu)) & 0xc0) == 0x80); } /* @@ -335,7 +332,7 @@ static inline int verify_mpu401(const struct snd_mpu401 * mpu) */ static inline void initialise_mpu401(const struct snd_mpu401 * mpu) { - outb(0, MIDI_DATA_IO(mpu->port)); + outb(0, MPU401D(mpu)); } /* @@ -1191,12 +1188,11 @@ static int __devinit create_sscape(int dev, struct snd_card *card) } #define MIDI_DEVNUM 0 if (sscape->type != SSCAPE_VIVO) { - err = create_mpu401(card, MIDI_DEVNUM, - MPU401_IO(xport), mpu_irq[dev]); + err = create_mpu401(card, MIDI_DEVNUM, xport, mpu_irq[dev]); if (err < 0) { printk(KERN_ERR "sscape: Failed to create " "MPU-401 device at 0x%x\n", - MPU401_IO(xport)); + xport); goto _release_dma; } -- cgit v1.2.3 From aa9c293ae46d71f5add0761bce8db67b162e3f29 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Wed, 21 Jan 2009 15:08:03 +0100 Subject: ALSA: do not create OPL3 timers if there is no OPL3 irq wired Most cards have OPL3 FM synthetiser but they do not have OPL3 interrupt wired to a sound chip or CPU. Do not create OPL3 timers for such cards as the timers are useless witthout interrupt. This patch removes OPL3 timers for following alsa drivers: snd-ad1816a, snd-opti93x, snd-opti92x, snd-sc6000, snd-cmi8330. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a.c | 7 ++----- sound/isa/cmi8330.c | 4 ---- sound/isa/opti9xx/opti92x-ad1848.c | 10 ++-------- sound/isa/sc6000.c | 4 ---- 4 files changed, 4 insertions(+), 21 deletions(-) (limited to 'sound') diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 77524244a846..3810833d3a87 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -207,11 +207,8 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard OPL3_HW_AUTO, 0, &opl3) < 0) { printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx.\n", fm_port[dev], fm_port[dev] + 2); } else { - if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) { - snd_card_free(card); - return error; - } - if ((error = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { + error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (error < 0) { snd_card_free(card); return error; } diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index dec6ea52cc4f..115437957413 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -546,10 +546,6 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) "no OPL device at 0x%lx-0x%lx ?\n", fmport[dev], fmport[dev] + 2); } else { - err = snd_opl3_timer_new(opl3, 0, 1); - if (err < 0) - return err; - err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); if (err < 0) return err; diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 19706b0d8497..5deb7e69a029 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -815,14 +815,8 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) chip->fm_port, chip->fm_port + 4 - 1); } if (opl3) { -#ifdef CS4231 - const int t1dev = 1; -#else - const int t1dev = 0; -#endif - if ((error = snd_opl3_timer_new(opl3, t1dev, t1dev+1)) < 0) - return error; - if ((error = snd_opl3_hwdep_new(opl3, 0, 1, &synth)) < 0) + error = snd_opl3_hwdep_new(opl3, 0, 1, &synth); + if (error < 0) return error; } } diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index ca35924dc3b3..bbc53692e68d 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@ -576,10 +576,6 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev) snd_printk(KERN_ERR PFX "no OPL device at 0x%x-0x%x ?\n", 0x388, 0x388 + 2); } else { - err = snd_opl3_timer_new(opl3, 0, 1); - if (err < 0) - goto err_unmap2; - err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); if (err < 0) goto err_unmap2; -- cgit v1.2.3 From a17ac45a5da76f851faf0b6502f66c1205159469 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Wed, 21 Jan 2009 15:14:09 +0100 Subject: ALSA: ad1816a: enable hardware timer Enable hardware timer with 10 usec resolution. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- include/sound/ad1816a.h | 2 ++ sound/isa/ad1816a/ad1816a.c | 7 +++++++ sound/isa/ad1816a/ad1816a_lib.c | 5 ----- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h index b3aa62ee3c8d..d010858c33c2 100644 --- a/include/sound/ad1816a.h +++ b/include/sound/ad1816a.h @@ -169,5 +169,7 @@ extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); +extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device, + struct snd_timer **rtimer); #endif /* __SOUND_AD1816A_H */ diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 3810833d3a87..15f60107a11e 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -156,6 +156,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard struct snd_card_ad1816a *acard; struct snd_ad1816a *chip; struct snd_opl3 *opl3; + struct snd_timer *timer; if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_card_ad1816a))) == NULL) @@ -194,6 +195,12 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard return error; } + error = snd_ad1816a_timer(chip, 0, &timer); + if (error < 0) { + snd_card_free(card); + return error; + } + if (mpu_port[dev] > 0) { if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, mpu_port[dev], 0, mpu_irq[dev], IRQF_DISABLED, diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 3bfca7c59baf..1c9e01ecac0b 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -377,7 +377,6 @@ static struct snd_pcm_hardware snd_ad1816a_capture = { .fifo_size = 0, }; -#if 0 /* not used now */ static int snd_ad1816a_timer_close(struct snd_timer *timer) { struct snd_ad1816a *chip = snd_timer_chip(timer); @@ -442,8 +441,6 @@ static struct snd_timer_hardware snd_ad1816a_timer_table = { .start = snd_ad1816a_timer_start, .stop = snd_ad1816a_timer_stop, }; -#endif /* not used now */ - static int snd_ad1816a_playback_open(struct snd_pcm_substream *substream) { @@ -687,7 +684,6 @@ int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_p return 0; } -#if 0 /* not used now */ int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer) { struct snd_timer *timer; @@ -709,7 +705,6 @@ int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd *rtimer = timer; return 0; } -#endif /* not used now */ /* * -- cgit v1.2.3 From e0c0e943af71c0f840a1f6a32a8cf0b61ebc61e5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 22 Jan 2009 12:58:11 +0100 Subject: ALSA: hda - Add model entry for HP dv4 Added model=hp-dv5 for HP dv4 (103c:30f7). Reference: kernel bug #12440 http://bugzilla.kernel.org/show_bug.cgi?id=12440 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3b97d1eff92a..c1635a188f41 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1797,6 +1797,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "HP dv5", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, "HP dv7", STAC_HP_M4), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, + "HP dv4", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, "HP dv7", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, -- cgit v1.2.3 From 8ce8419829998c91b33200894a0db5e1441d6952 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 22 Jan 2009 16:59:20 +0100 Subject: ALSA: hda - Avoid to set the pin control again if already set Check the present pin control bit and avoid the write if it's already set in patch_sigmatel.c. This will reduce the number of verb execs at jack plugging. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 0fa6c593d1d3..11634a4478ea 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4126,7 +4126,9 @@ static void stac92xx_free(struct hda_codec *codec) static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, unsigned int flag) { - unsigned int pin_ctl = snd_hda_codec_read(codec, nid, + unsigned int old_ctl, pin_ctl; + + pin_ctl = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); if (pin_ctl & AC_PINCTL_IN_EN) { @@ -4140,14 +4142,17 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, return; } + old_ctl = pin_ctl; /* if setting pin direction bits, clear the current direction bits first */ if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); - snd_hda_codec_write_cache(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - pin_ctl | flag); + pin_ctl |= flag; + if (old_ctl != pin_ctl) + snd_hda_codec_write_cache(codec, nid, 0, + AC_VERB_SET_PIN_WIDGET_CONTROL, + pin_ctl); } static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, @@ -4155,9 +4160,10 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, { unsigned int pin_ctl = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); - snd_hda_codec_write_cache(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - pin_ctl & ~flag); + if (pin_ctl & flag) + snd_hda_codec_write_cache(codec, nid, 0, + AC_VERB_SET_PIN_WIDGET_CONTROL, + pin_ctl & ~flag); } static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) -- cgit v1.2.3 From d9a4268ee92ba1a2355c892a3add1fa66856b510 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 22 Jan 2009 17:40:18 +0100 Subject: ALSA: hda - Add quirk for Gateway %1616 laptop Gateway T1616 laptop needs EAPD always on while the current STAC9205 code turns off per HP plug. Added a new model "eapd" to keep it on. Reference: Novell bnc#467597 https://bugzilla.novell.com/show_bug.cgi?id=467597 Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 1 + sound/pci/hda/patch_sigmatel.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 75914bcdce72..ef6b22e25412 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -285,6 +285,7 @@ STAC9205/9254 dell-m42 Dell (unknown) dell-m43 Dell Precision dell-m44 Dell Inspiron + eapd Keep EAPD on (e.g. Gateway T1616) STAC9220/9221 ============= diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3f85731055c0..ed2fa431b03f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -66,6 +66,7 @@ enum { STAC_9205_DELL_M42, STAC_9205_DELL_M43, STAC_9205_DELL_M44, + STAC_9205_EAPD, STAC_9205_MODELS }; @@ -2240,6 +2241,7 @@ static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, + [STAC_9205_EAPD] = NULL, }; static const char *stac9205_models[STAC_9205_MODELS] = { @@ -2247,12 +2249,14 @@ static const char *stac9205_models[STAC_9205_MODELS] = { [STAC_9205_DELL_M42] = "dell-m42", [STAC_9205_DELL_M43] = "dell-m43", [STAC_9205_DELL_M44] = "dell-m44", + [STAC_9205_EAPD] = "eapd", }; static struct snd_pci_quirk stac9205_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_9205_REF), + /* Dell */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, "unknown Dell", STAC_9205_DELL_M42), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, @@ -2283,6 +2287,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { "Dell Inspiron", STAC_9205_DELL_M44), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, "Dell Vostro 1500", STAC_9205_DELL_M42), + /* Gateway */ + SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), {} /* terminator */ }; @@ -5320,7 +5326,9 @@ static int patch_stac9205(struct hda_codec *codec) spec->aloopback_mask = 0x40; spec->aloopback_shift = 0; - spec->eapd_switch = 1; + /* Turn on/off EAPD per HP plugging */ + if (spec->board_config != STAC_9205_EAPD) + spec->eapd_switch = 1; spec->multiout.dac_nids = spec->dac_nids; switch (spec->board_config){ -- cgit v1.2.3 From 87e88a746d6d93242c15e380dc8cd2579b524974 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Thu, 22 Jan 2009 20:38:42 -0500 Subject: ALSA: hda: revert change to 92hd83xxx power mapping Port 0xe power mapping was incorrect set to 0x80 changed to the correct value 0x40. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c1635a188f41..c553fdb2b149 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -334,7 +334,7 @@ static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { }; static unsigned int stac92hd83xxx_pwr_mapping[4] = { - 0x03, 0x0c, 0x20, 0x80, + 0x03, 0x0c, 0x20, 0x40, }; static hda_nid_t stac92hd83xxx_amp_nids[1] = { -- cgit v1.2.3 From 32ed3f4640631ab7a4c0bc0f1463cf019d510341 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Thu, 22 Jan 2009 20:53:29 -0500 Subject: ALSA: hda: Add STAC92HD83XXX_PWR_REF quirk Some revisions of the 92hd8xxx codec's not supporting port power downs in which the using of it causes capture and also randomly playback streams to not function at all. Thus by disabling it by default and adding a option to enable it manually will fix all issue on current and future revisions. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 1 + sound/pci/hda/patch_sigmatel.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 64eb1100eec1..0f5d26bea80f 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -349,6 +349,7 @@ STAC92HD73* STAC92HD83* =========== ref Reference board + mic-ref Reference board with power managment for ports STAC9872 ======== diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c553fdb2b149..3dd4eee70b7c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -81,6 +81,7 @@ enum { enum { STAC_92HD83XXX_REF, + STAC_92HD83XXX_PWR_REF, STAC_92HD83XXX_MODELS }; @@ -1734,10 +1735,12 @@ static unsigned int ref92hd83xxx_pin_configs[14] = { static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, + [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, }; static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { [STAC_92HD83XXX_REF] = "ref", + [STAC_92HD83XXX_PWR_REF] = "mic-ref", }; static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { @@ -4783,13 +4786,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) AC_VERB_SET_CONNECT_SEL, num_dacs); spec->init = stac92hd83xxx_core_init; - switch (codec->vendor_id) { - case 0x111d7605: - break; - default: - spec->num_pwrs--; - } - spec->mixer = stac92hd83xxx_mixer; spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); @@ -4815,6 +4811,15 @@ again: return err; } + switch (codec->vendor_id) { + case 0x111d7604: + case 0x111d7605: + if (spec->board_config == STAC_92HD83XXX_PWR_REF) + break; + spec->num_pwrs = 0; + break; + } + err = stac92xx_parse_auto_config(codec, 0x1d, 0); if (!err) { if (spec->board_config < 0) { -- cgit v1.2.3 From 577aa2c195045599275b54356969ae19f34e7a66 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Thu, 22 Jan 2009 22:55:44 -0500 Subject: ALSA: hda: add reference board SND_PCI_QUIRK Add another LanParty reference board SND_PCI_QUIRK to quirk lists of all codec families. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 212d8c09a67b..3fbe22053b3f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1517,6 +1517,8 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_REF), /* Dell laptops have BIOS problem */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, "unknown Dell", STAC_9200_DELL_D21), @@ -1666,6 +1668,7 @@ static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { static struct snd_pci_quirk stac925x_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), /* Default table for unknown ID */ @@ -1709,6 +1712,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_92HD73XX_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_92HD73XX_REF), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, "Dell Studio 1535", STAC_DELL_M6_DMIC), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, @@ -1753,6 +1758,8 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_92HD83XXX_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_92HD83XXX_REF), {} /* terminator */ }; @@ -1802,6 +1809,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_92HD71BXX_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_92HD71BXX_REF), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, "HP dv5", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, @@ -1992,6 +2001,8 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_D945_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_D945_REF), /* Intel 945G based systems */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, "Intel D945G", STAC_D945GTP3), @@ -2148,6 +2159,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_D965_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_D965_REF), /* Intel 946 based systems */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), @@ -2259,6 +2272,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_9205_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, + "DFI LanParty", STAC_9205_REF), /* Dell */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, "unknown Dell", STAC_9205_DELL_M42), -- cgit v1.2.3 From 8056d47e77a0f7e3c99c114deab4859d31496075 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 09:09:43 +0100 Subject: ALSA: hda - Add model=ref for Intel board with STAC9221 An intel board (8086:0204) works only with model=ref. Reference: Novell bug #406529 https://bugzilla.novell.com/show_bug.cgi?id=406529 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3fbe22053b3f..4ee9f7fc7724 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2056,6 +2056,9 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { "Intel D945P", STAC_D945GTP3), SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, "Intel D945P", STAC_D945GTP5), + /* other intel */ + SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, + "Intel D945", STAC_D945_REF), /* other systems */ /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ SND_PCI_QUIRK(0x8384, 0x7680, -- cgit v1.2.3 From 00a602db1ce9d61319d6f769dee206ec85f19bda Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 11:55:42 +0100 Subject: ALSA: hda - Fix PCM reference NID for STAC/IDT analog outputs The reference NID for the analog outputs of STAC/IDT codecs is set to a fixed number 0x02. But this isn't always correct and in many codecs it points to a non-existing NID. This patch fixes the initialization of the PCM reference NID taken from the actually probed DAC list. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3dd4eee70b7c..b787b3cc096f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2539,6 +2539,8 @@ static int stac92xx_build_pcms(struct hda_codec *codec) info->name = "STAC92xx Analog"; info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; + info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = + spec->multiout.dac_nids[0]; info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; -- cgit v1.2.3 From e3c75964666a27cec46d2cccf2d9806336becd48 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 11:57:22 +0100 Subject: ALSA: hda - Create "Input Source" control dynamically for STAC/IDT Instead of fixed kcontrol_new element, build "Input Source" controls dynamically. If the number of input-source items is 0 or 1, we don't need to create such a control. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 78 ++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 25 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b3c3a02a4222..80a4c288b319 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -958,16 +958,6 @@ static struct hda_verb stac9205_core_init[] = { .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ } -#define STAC_INPUT_SOURCE(cnt) \ - { \ - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ - .name = "Input Source", \ - .count = cnt, \ - .info = stac92xx_mux_enum_info, \ - .get = stac92xx_mux_enum_get, \ - .put = stac92xx_mux_enum_put, \ - } - #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ @@ -982,7 +972,6 @@ static struct hda_verb stac9205_core_init[] = { static struct snd_kcontrol_new stac9200_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), - STAC_INPUT_SOURCE(1), HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), { } /* end */ @@ -1098,7 +1087,6 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { }; static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { - STAC_INPUT_SOURCE(2), STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), @@ -1127,7 +1115,6 @@ static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { }; static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { - STAC_INPUT_SOURCE(2), STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), @@ -1141,14 +1128,12 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { static struct snd_kcontrol_new stac925x_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), - STAC_INPUT_SOURCE(1), HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), { } /* end */ }; static struct snd_kcontrol_new stac9205_mixer[] = { - STAC_INPUT_SOURCE(2), STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), @@ -1161,7 +1146,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = { /* This needs to be generated dynamically based on sequence */ static struct snd_kcontrol_new stac922x_mixer[] = { - STAC_INPUT_SOURCE(2), HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), @@ -1172,7 +1156,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = { static struct snd_kcontrol_new stac927x_mixer[] = { - STAC_INPUT_SOURCE(3), STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), @@ -2777,22 +2760,37 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { }; /* add dynamic controls */ -static int stac92xx_add_control_temp(struct sigmatel_spec *spec, - struct snd_kcontrol_new *ktemp, - int idx, const char *name, - unsigned long val) +static struct snd_kcontrol_new * +stac_control_new(struct sigmatel_spec *spec, + struct snd_kcontrol_new *ktemp, + const char *name) { struct snd_kcontrol_new *knew; snd_array_init(&spec->kctls, sizeof(*knew), 32); knew = snd_array_new(&spec->kctls); if (!knew) - return -ENOMEM; + return NULL; *knew = *ktemp; - knew->index = idx; knew->name = kstrdup(name, GFP_KERNEL); - if (!knew->name) + if (!knew->name) { + /* roolback */ + memset(knew, 0, sizeof(*knew)); + spec->kctls.alloced--; + return NULL; + } + return knew; +} + +static int stac92xx_add_control_temp(struct sigmatel_spec *spec, + struct snd_kcontrol_new *ktemp, + int idx, const char *name, + unsigned long val) +{ + struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name); + if (!knew) return -ENOMEM; + knew->index = idx; knew->private_value = val; return 0; } @@ -2814,6 +2812,29 @@ static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, return stac92xx_add_control_idx(spec, type, 0, name, val); } +static struct snd_kcontrol_new stac_input_src_temp = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Input Source", + .info = stac92xx_mux_enum_info, + .get = stac92xx_mux_enum_get, + .put = stac92xx_mux_enum_put, +}; + +static int stac92xx_add_input_source(struct sigmatel_spec *spec) +{ + struct snd_kcontrol_new *knew; + struct hda_input_mux *imux = &spec->private_imux; + + if (!spec->num_adcs || imux->num_items <= 1) + return 0; /* no need for input source control */ + knew = stac_control_new(spec, &stac_input_src_temp, + stac_input_src_temp.name); + if (!knew) + return -ENOMEM; + knew->count = spec->num_adcs; + return 0; +} + /* check whether the line-input can be used as line-out */ static hda_nid_t check_line_out_switch(struct hda_codec *codec) { @@ -3699,6 +3720,10 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out return err; } + err = stac92xx_add_input_source(spec); + if (err < 0) + return err; + spec->multiout.max_channels = spec->multiout.num_dacs * 2; if (spec->multiout.max_channels > 2) spec->surr_switch = 1; @@ -3812,6 +3837,10 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) return err; } + err = stac92xx_add_input_source(spec); + if (err < 0) + return err; + if (spec->autocfg.dig_out_pin) spec->multiout.dig_out_nid = 0x05; if (spec->autocfg.dig_in_pin) @@ -5426,7 +5455,6 @@ static struct hda_verb stac9872_core_init[] = { static struct snd_kcontrol_new stac9872_mixer[] = { HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), - STAC_INPUT_SOURCE(1), { } /* end */ }; -- cgit v1.2.3 From 6d6e17de4f64131e9c976fd524d73aaec268178f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 12:33:54 +0100 Subject: ALSA: hda - Fix initial verbs for mic-boosts on AD1981HD The mic boosts (NID 0x08 and 0x18) are input-amps, not output-amps. Fix the initial verbs for them. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2e7371ec2e23..9a902c2f05a2 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -1407,8 +1407,8 @@ static struct hda_verb ad1981_init_verbs[] = { {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, /* Mic boost: 0dB */ - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, + {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* Record selector: Front mic */ {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, -- cgit v1.2.3 From 19a2d3e9b99ffa264adf1138bd8d8aef8909dca9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 12:35:25 +0100 Subject: ALSA: hda - Remove invalid amp initializations for AD1988* codecs The ADC widgets on AD1988* codecs have no amp controls. Remove invalid initialization verbs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 9a902c2f05a2..52bc85dd6f54 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -2288,10 +2288,6 @@ static struct hda_verb ad1988_capture_init_verbs[] = { {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, - /* ADCs; muted */ - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, { } }; @@ -2399,10 +2395,6 @@ static struct hda_verb ad1988_3stack_init_verbs[] = { {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, - /* ADCs; muted */ - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Analog Mix output amp */ {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ { } @@ -2474,10 +2466,6 @@ static struct hda_verb ad1988_laptop_init_verbs[] = { {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, - /* ADCs; muted */ - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Analog Mix output amp */ {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ { } -- cgit v1.2.3 From 60e388e89c9e258a51a0995ddd9e18fdebcdbe12 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 12:37:09 +0100 Subject: ALSA: hda - Fix invalid verbs for mic-boosts on AD1884* The mic-boosts (0x14 and 0x15) on AD1884* codecs are input-amps, not output-amps. Fix the invalid initialization verbs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 52bc85dd6f54..a7298d28a0d4 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3183,10 +3183,10 @@ static struct hda_verb ad1884_init_verbs[] = { {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, /* Port-B (front mic) pin */ {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* Port-C (rear mic) pin */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* Analog mixer; mute as default */ {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, @@ -3601,10 +3601,10 @@ static struct hda_verb ad1884a_init_verbs[] = { {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Port-B (front mic) pin */ {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* Port-C (rear line-in) pin */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* Port-E (rear mic) pin */ {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, -- cgit v1.2.3 From 4cfb91c6d764b18e81bfb6e6779e07bcecbb197c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 12:53:09 +0100 Subject: ALSA: hda - Fix invalid amp init for ALC268 codec Fix some invalid AMP initializations for ALC268 codecs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4cfa78c54398..863ab957204b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11279,19 +11279,13 @@ static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, static struct hda_verb alc268_base_init_verbs[] = { /* Unmute DAC0-1 and set vol = 0 */ {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, /* * Set up output mixers (0x0c - 0x0e) */ /* set vol=0 to output mixers */ {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, @@ -11310,9 +11304,7 @@ static struct hda_verb alc268_base_init_verbs[] = { {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* set PCBEEP vol = 0, mute connections */ {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, @@ -11334,10 +11326,8 @@ static struct hda_verb alc268_base_init_verbs[] = { */ static struct hda_verb alc268_volume_init_verbs[] = { /* set output DAC */ - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, @@ -11345,16 +11335,12 @@ static struct hda_verb alc268_volume_init_verbs[] = { {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* set PCBEEP vol = 0, mute connections */ {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -- cgit v1.2.3 From 70040c07402ef5a3fad2133daffb7ee61b0d4641 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 23 Jan 2009 14:18:11 +0100 Subject: ALSA: hda - Fix wrong initial verb for AD1984 thinkpad model The docking mic-boost (0x25) has no mute bit. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index a7298d28a0d4..e934e2c187d0 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3337,7 +3337,7 @@ static struct hda_verb ad1984_thinkpad_init_verbs[] = { {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* docking mic boost */ - {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, /* Analog mixer - docking mic; mute as default */ {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* enable EAPD bit */ -- cgit v1.2.3 From 55aef4508598d59c2baea7e2a3e6dfed415bbfc0 Mon Sep 17 00:00:00 2001 From: Markus Bollinger Date: Fri, 23 Jan 2009 14:45:41 +0100 Subject: ALSA: pcxhr - add support for gpio ports and minor bug fix - add support for gpio ports (2 GPI, 2 GPO) of pcxhr stereo cards - minor bugfixes : allow setting clock to internal by the mixer even if there is no stream (but monitoring) Signed-off-by: Markus Bollinger Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 41 +++++++++++++++++++++++++++++++++++++++++ sound/pci/pcxhr/pcxhr.h | 5 +++-- sound/pci/pcxhr/pcxhr_mix22.c | 40 ++++++++++++++++++++++++++++++++++++---- sound/pci/pcxhr/pcxhr_mix22.h | 3 +++ sound/pci/pcxhr/pcxhr_mixer.c | 8 ++++++-- 5 files changed, 89 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 27cf2c28d113..ca89106f8c5d 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1334,6 +1334,40 @@ static void pcxhr_proc_sync(struct snd_info_entry *entry, snd_iprintf(buffer, "\n"); } +static void pcxhr_proc_gpio_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_pcxhr *chip = entry->private_data; + struct pcxhr_mgr *mgr = chip->mgr; + /* commands available when embedded DSP is running */ + if (mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX)) { + /* gpio ports on stereo boards only available */ + int value = 0; + hr222_read_gpio(mgr, 1, &value); /* GPI */ + snd_iprintf(buffer, "GPI: 0x%x\n", value); + hr222_read_gpio(mgr, 0, &value); /* GP0 */ + snd_iprintf(buffer, "GPO: 0x%x\n", value); + } else + snd_iprintf(buffer, "no firmware loaded\n"); + snd_iprintf(buffer, "\n"); +} +static void pcxhr_proc_gpo_write(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_pcxhr *chip = entry->private_data; + struct pcxhr_mgr *mgr = chip->mgr; + char line[64]; + int value; + /* commands available when embedded DSP is running */ + if (!(mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))) + return; + while (!snd_info_get_line(buffer, line, sizeof(line))) { + if (sscanf(line, "GPO: 0x%x", &value) != 1) + continue; + hr222_write_gpo(mgr, value); /* GP0 */ + } +} + static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) { struct snd_info_entry *entry; @@ -1342,6 +1376,13 @@ static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) snd_info_set_text_ops(entry, chip, pcxhr_proc_info); if (! snd_card_proc_new(chip->card, "sync", &entry)) snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); + /* gpio available on stereo sound cards only */ + if (chip->mgr->is_hr_stereo && + !snd_card_proc_new(chip->card, "gpio", &entry)) { + snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read); + entry->c.text.write = pcxhr_proc_gpo_write; + entry->mode |= S_IWUSR; + } } /* end of proc interface */ diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 84131a916c92..ac9c3b3bb4e8 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h @@ -27,8 +27,8 @@ #include #include -#define PCXHR_DRIVER_VERSION 0x000905 /* 0.9.5 */ -#define PCXHR_DRIVER_VERSION_STRING "0.9.5" /* 0.9.5 */ +#define PCXHR_DRIVER_VERSION 0x000906 /* 0.9.6 */ +#define PCXHR_DRIVER_VERSION_STRING "0.9.6" /* 0.9.6 */ #define PCXHR_MAX_CARDS 6 @@ -124,6 +124,7 @@ struct pcxhr_mgr { unsigned char xlx_cfg; /* copy of PCXHR_XLX_CFG register */ unsigned char xlx_selmic; /* copy of PCXHR_XLX_SELMIC register */ + unsigned char dsp_reset; /* copy of PCXHR_DSP_RESET register */ }; diff --git a/sound/pci/pcxhr/pcxhr_mix22.c b/sound/pci/pcxhr/pcxhr_mix22.c index ff019126b672..1cb82c0a9cb3 100644 --- a/sound/pci/pcxhr/pcxhr_mix22.c +++ b/sound/pci/pcxhr/pcxhr_mix22.c @@ -53,6 +53,8 @@ #define PCXHR_DSP_RESET_DSP 0x01 #define PCXHR_DSP_RESET_MUTE 0x02 #define PCXHR_DSP_RESET_CODEC 0x08 +#define PCXHR_DSP_RESET_GPO_OFFSET 5 +#define PCXHR_DSP_RESET_GPO_MASK 0x60 /* values for PCHR_XLX_CFG register */ #define PCXHR_CFG_SYNCDSP_MASK 0x80 @@ -81,6 +83,8 @@ /* values for PCHR_XLX_STATUS register - READ */ #define PCXHR_STAT_SRC_LOCK 0x01 #define PCXHR_STAT_LEVEL_IN 0x02 +#define PCXHR_STAT_GPI_OFFSET 2 +#define PCXHR_STAT_GPI_MASK 0x0C #define PCXHR_STAT_MIC_CAPS 0x10 /* values for PCHR_XLX_STATUS register - WRITE */ #define PCXHR_STAT_FREQ_SYNC_MASK 0x01 @@ -291,10 +295,11 @@ int hr222_sub_init(struct pcxhr_mgr *mgr) PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, PCXHR_DSP_RESET_DSP); msleep(5); - PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, - PCXHR_DSP_RESET_DSP | - PCXHR_DSP_RESET_MUTE | - PCXHR_DSP_RESET_CODEC); + mgr->dsp_reset = PCXHR_DSP_RESET_DSP | + PCXHR_DSP_RESET_MUTE | + PCXHR_DSP_RESET_CODEC; + PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset); + /* hr222_write_gpo(mgr, 0); does the same */ msleep(5); /* config AKM */ @@ -496,6 +501,33 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr, } +int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value) +{ + if (is_gpi) { + unsigned char reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS); + *value = (int)(reg & PCXHR_STAT_GPI_MASK) >> + PCXHR_STAT_GPI_OFFSET; + } else { + *value = (int)(mgr->dsp_reset & PCXHR_DSP_RESET_GPO_MASK) >> + PCXHR_DSP_RESET_GPO_OFFSET; + } + return 0; +} + + +int hr222_write_gpo(struct pcxhr_mgr *mgr, int value) +{ + unsigned char reg = mgr->dsp_reset & ~PCXHR_DSP_RESET_GPO_MASK; + + reg |= (unsigned char)(value << PCXHR_DSP_RESET_GPO_OFFSET) & + PCXHR_DSP_RESET_GPO_MASK; + + PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, reg); + mgr->dsp_reset = reg; + return 0; +} + + int hr222_update_analog_audio_level(struct snd_pcxhr *chip, int is_capture, int channel) { diff --git a/sound/pci/pcxhr/pcxhr_mix22.h b/sound/pci/pcxhr/pcxhr_mix22.h index 6b318b2f0100..5a37a0007e8f 100644 --- a/sound/pci/pcxhr/pcxhr_mix22.h +++ b/sound/pci/pcxhr/pcxhr_mix22.h @@ -32,6 +32,9 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr, enum pcxhr_clock_type clock_type, int *sample_rate); +int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value); +int hr222_write_gpo(struct pcxhr_mgr *mgr, int value); + #define HR222_LINE_PLAYBACK_LEVEL_MIN 0 /* -25.5 dB */ #define HR222_LINE_PLAYBACK_ZERO_LEVEL 51 /* 0.0 dB */ #define HR222_LINE_PLAYBACK_LEVEL_MAX 99 /* +24.0 dB */ diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 2436e374586f..fec049344621 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c @@ -789,11 +789,15 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol, if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { mutex_lock(&mgr->setup_mutex); mgr->use_clock_type = ucontrol->value.enumerated.item[0]; - if (mgr->use_clock_type) + rate = 0; + if (mgr->use_clock_type != PCXHR_CLOCK_TYPE_INTERNAL) { pcxhr_get_external_clock(mgr, mgr->use_clock_type, &rate); - else + } else { rate = mgr->sample_rate; + if (!rate) + rate = 48000; + } if (rate) { pcxhr_set_clock(mgr, rate); if (mgr->sample_rate) -- cgit v1.2.3 From ca8d33fc9fafe373362d35107f01fba1e73fb966 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Mon, 26 Jan 2009 09:33:52 -0500 Subject: ALSA: hda: 92hd71xxx disable unmute support for codecs that don't have input amps Some revisions of the 92hd71xxx codec families don't have input amps on ports 0xa, 0xd and 0xf, so probe the widget caps on port 0xa and check for support, if found run snd_hda_sequence_write_cache() on the stac92hd71xxx_unmute_core_init verb list. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 80a4c288b319..03b26426611b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -858,26 +858,25 @@ static struct hda_verb stac92hd83xxx_core_init[] = { static struct hda_verb stac92hd71bxx_core_init[] = { /* set master volume and direct control */ { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, - /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ - { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {} }; -#define HD_DISABLE_PORTF 2 +#define HD_DISABLE_PORTF 1 static struct hda_verb stac92hd71bxx_analog_core_init[] = { /* start of config #1 */ /* connect port 0f to audio mixer */ { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, - /* unmute right and left channels for node 0x0f */ - { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* start of config #2 */ /* set master volume and direct control */ { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, - /* unmute right and left channels for nodes 0x0a, 0xd */ + {} +}; + +static struct hda_verb stac92hd71bxx_unmute_core_init[] = { + /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ + { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {} @@ -4942,6 +4941,7 @@ static struct hda_input_mux stac92hd71bxx_dmux = { static int patch_stac92hd71bxx(struct hda_codec *codec) { struct sigmatel_spec *spec; + struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; int err = 0; spec = kzalloc(sizeof(*spec), GFP_KERNEL); @@ -5015,6 +5015,7 @@ again: /* disable VSW */ spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; + unmute_init++; stac_change_pin_config(codec, 0xf, 0x40f000f0); break; case 0x111d7603: /* 6 Port with Analog Mixer */ @@ -5031,6 +5032,9 @@ again: codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; } + if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) + snd_hda_sequence_write_cache(codec, unmute_init); + spec->aloopback_mask = 0x50; spec->aloopback_shift = 0; -- cgit v1.2.3 From b7eb4a06e9980973755b7e95a6d97fb8decbf8fd Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 26 Jan 2009 08:08:34 +0100 Subject: sound: usb-audio: use normal number of frames for no-data URBs When sending a silence URB (before playback has started, or when it is paused), use the number of frames that would be normally sent instead of a single frame so that the rate at which completion interrupts arrive is consistent. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c709b9563226..417d557ed641 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -525,7 +525,7 @@ static int snd_usb_audio_next_packet_size(struct snd_usb_substream *subs) /* * Prepare urb for streaming before playback starts or when paused. * - * We don't have any data, so we send a frame of silence. + * We don't have any data, so we send silence. */ static int prepare_nodata_playback_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, @@ -537,13 +537,13 @@ static int prepare_nodata_playback_urb(struct snd_usb_substream *subs, offs = 0; urb->dev = ctx->subs->dev; - urb->number_of_packets = subs->packs_per_ms; - for (i = 0; i < subs->packs_per_ms; ++i) { + for (i = 0; i < ctx->packets; ++i) { counts = snd_usb_audio_next_packet_size(subs); urb->iso_frame_desc[i].offset = offs * stride; urb->iso_frame_desc[i].length = counts * stride; offs += counts; } + urb->number_of_packets = ctx->packets; urb->transfer_buffer_length = offs * stride; memset(urb->transfer_buffer, subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0, -- cgit v1.2.3 From 4d788e040b72d2a46ea3ba726b7fa0b65de06c88 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 26 Jan 2009 08:09:28 +0100 Subject: sound: usb-audio: limit playback queue length Once our URBs contain enough packets, queueing more URBs does not give us any additional underrun protection (as we use double-buffering) but just increases latency unnecessarily. Therefore, we try to limit the queue length to some reasonable value. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 417d557ed641..f3d4de23fedf 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -108,6 +108,7 @@ MODULE_PARM_DESC(ignore_ctl_error, #define MAX_URBS 8 #define SYNC_URBS 4 /* always four urbs for sync */ #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ +#define MAX_QUEUE 24 /* try not to exceed this queue length, in ms */ struct audioformat { struct list_head list; @@ -1079,7 +1080,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri /* decide how many packets to be used */ if (is_playback) { - unsigned int minsize; + unsigned int minsize, maxpacks; /* determine how small a packet can be */ minsize = (subs->freqn >> (16 - subs->datainterval)) * (frame_bits >> 3); @@ -1094,6 +1095,12 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri /* we need at least two URBs for queueing */ if (total_packs < 2 * MIN_PACKS_URB * packs_per_ms) total_packs = 2 * MIN_PACKS_URB * packs_per_ms; + else { + /* and we don't want too long a queue either */ + maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); + if (total_packs > maxpacks * packs_per_ms) + total_packs = maxpacks * packs_per_ms; + } } else { total_packs = MAX_URBS * urb_packs; } -- cgit v1.2.3 From 160389c8d21c8139a93191c2e5ca2273f311ed4e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 26 Jan 2009 08:10:19 +0100 Subject: sound: usb-audio: make URB sizes more equal Distribute the packets evenly among the URBs, instead of making all URBs except the last one to have the maximum size. This makes the timing of pointer updates more regular and removes some special cases from the code. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index f3d4de23fedf..44485b29f675 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1035,9 +1035,9 @@ static void release_substream_urbs(struct snd_usb_substream *subs, int force) static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int period_bytes, unsigned int rate, unsigned int frame_bits) { - unsigned int maxsize, n, i; + unsigned int maxsize, i; int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK; - unsigned int npacks[MAX_URBS], urb_packs, total_packs, packs_per_ms; + unsigned int urb_packs, total_packs, packs_per_ms; /* calculate the frequency in 16.16 format */ if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) @@ -1109,31 +1109,11 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri /* too much... */ subs->nurbs = MAX_URBS; total_packs = MAX_URBS * urb_packs; - } - n = total_packs; - for (i = 0; i < subs->nurbs; i++) { - npacks[i] = n > urb_packs ? urb_packs : n; - n -= urb_packs; - } - if (subs->nurbs <= 1) { + } else if (subs->nurbs < 2) { /* too little - we need at least two packets * to ensure contiguous playback/capture */ subs->nurbs = 2; - npacks[0] = (total_packs + 1) / 2; - npacks[1] = total_packs - npacks[0]; - } else if (npacks[subs->nurbs-1] < MIN_PACKS_URB * packs_per_ms) { - /* the last packet is too small.. */ - if (subs->nurbs > 2) { - /* merge to the first one */ - npacks[0] += npacks[subs->nurbs - 1]; - subs->nurbs--; - } else { - /* divide to two */ - subs->nurbs = 2; - npacks[0] = (total_packs + 1) / 2; - npacks[1] = total_packs - npacks[0]; - } } /* allocate and initialize data urbs */ @@ -1141,7 +1121,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri struct snd_urb_ctx *u = &subs->dataurb[i]; u->index = i; u->subs = subs; - u->packets = npacks[i]; + u->packets = (i + 1) * total_packs / subs->nurbs + - i * total_packs / subs->nurbs; u->buffer_size = maxsize * u->packets; if (subs->fmt_type == USB_FORMAT_TYPE_II) u->packets++; /* for transfer delimiter */ -- cgit v1.2.3 From aa9d823bb347fb66cb07f98c686be8bb85cb6a74 Mon Sep 17 00:00:00 2001 From: Joerg Schirottke Date: Tue, 27 Jan 2009 11:01:34 +0100 Subject: ALSA: hda - Add quirk for HP DV6700 laptop Added the matching model=laptop for HP DV6700 laptop. Signed-off-by: Joerg Schirottke Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 75de40aaab0a..9ae72b803f2d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1566,6 +1566,7 @@ static struct snd_pci_quirk cxt5047_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), + SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP), SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), {} }; -- cgit v1.2.3 From b9d710b3c530ed91e8683933fe94c7605d175bf5 Mon Sep 17 00:00:00 2001 From: Andreas Bergmeier Date: Sat, 24 Jan 2009 12:15:14 +0100 Subject: ALSA: usbaudio - use printf format instead of hardcoding it Rather use printf format instead of hardcoding prefix like 0x. A next step would be to predefine certain formats. Signed-off-by: Andreas Bergmeier Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 44485b29f675..4636926d12d7 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1280,14 +1280,14 @@ static int init_usb_sample_rate(struct usb_device *dev, int iface, if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0) { - snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep 0x%x\n", + snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n", dev->devnum, iface, fmt->altsetting, rate, ep); return err; } if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN, SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0) { - snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep 0x%x\n", + snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n", dev->devnum, iface, fmt->altsetting, ep); return 0; /* some devices don't support reading */ } @@ -1456,7 +1456,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, channels = params_channels(hw_params); fmt = find_format(subs, format, rate, channels); if (!fmt) { - snd_printd(KERN_DEBUG "cannot set format: format = 0x%x, rate = %d, channels = %d\n", + snd_printd(KERN_DEBUG "cannot set format: format = %#x, rate = %d, channels = %d\n", format, rate, channels); return -EINVAL; } @@ -2148,7 +2148,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s fp = list_entry(p, struct audioformat, list); snd_iprintf(buffer, " Interface %d\n", fp->iface); snd_iprintf(buffer, " Altset %d\n", fp->altsetting); - snd_iprintf(buffer, " Format: 0x%x\n", fp->format); + snd_iprintf(buffer, " Format: %#x\n", fp->format); snd_iprintf(buffer, " Channels: %d\n", fp->channels); snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", fp->endpoint & USB_ENDPOINT_NUMBER_MASK, @@ -2168,7 +2168,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s snd_iprintf(buffer, "\n"); } // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); - // snd_iprintf(buffer, " EP Attribute = 0x%x\n", fp->attributes); + // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); } } @@ -2607,7 +2607,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, struct audioformat fp->format = SNDRV_PCM_FORMAT_MPEG; break; default: - snd_printd(KERN_INFO "%d:%u:%d : unknown format tag 0x%x is detected. processed as MPEG.\n", + snd_printd(KERN_INFO "%d:%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", chip->dev->devnum, fp->iface, fp->altsetting, format); fp->format = SNDRV_PCM_FORMAT_MPEG; break; @@ -2805,7 +2805,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) continue; } - snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint 0x%x\n", dev->devnum, iface_no, altno, fp->endpoint); + snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint); err = add_audio_endpoint(chip, stream, fp); if (err < 0) { kfree(fp->rate_table); -- cgit v1.2.3 From 5801f992276366cd6a4f1f9939a4c9da33d499ee Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 27 Jan 2009 12:53:22 +0100 Subject: ALSA: hda - Fix compile warning with CONFIG_SND_JACK=n sound/pci/hda/patch_conexant.c:352: warning: 'conexant_add_jack' defined but not used Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 9ae72b803f2d..0177ef8f4c9e 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -347,6 +347,7 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, &spec->cur_mux[adc_idx]); } +#ifdef CONFIG_SND_JACK static int conexant_add_jack(struct hda_codec *codec, hda_nid_t nid, int type) { @@ -394,7 +395,6 @@ static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) static int conexant_init_jacks(struct hda_codec *codec) { -#ifdef CONFIG_SND_JACK struct conexant_spec *spec = codec->spec; int i; @@ -422,10 +422,19 @@ static int conexant_init_jacks(struct hda_codec *codec) ++hv; } } -#endif return 0; } +#else +static inline void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) +{ +} + +static inline int conexant_init_jacks(struct hda_codec *codec) +{ + return 0; +} +#endif static int conexant_init(struct hda_codec *codec) { -- cgit v1.2.3 From f6c6383502751ceb6f2f3579ad22578ca44f91f5 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sat, 24 Jan 2009 13:35:28 +0100 Subject: ALSA: Turtle Beach Multisound Classic/Pinnacle driver This is driver for Turtle Beach Multisound cards: Classic, Fiji and Pinnacle. Tested pcm playback and recording and MIDI playback on Multisound Pinnacle. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/Kconfig | 31 + sound/isa/msnd/Makefile | 9 + sound/isa/msnd/msnd.c | 702 +++++++++++++++++++ sound/isa/msnd/msnd.h | 308 +++++++++ sound/isa/msnd/msnd_classic.c | 3 + sound/isa/msnd/msnd_classic.h | 129 ++++ sound/isa/msnd/msnd_midi.c | 180 +++++ sound/isa/msnd/msnd_pinnacle.c | 1235 ++++++++++++++++++++++++++++++++++ sound/isa/msnd/msnd_pinnacle.h | 181 +++++ sound/isa/msnd/msnd_pinnacle_mixer.c | 343 ++++++++++ 10 files changed, 3121 insertions(+) create mode 100644 sound/isa/msnd/Makefile create mode 100644 sound/isa/msnd/msnd.c create mode 100644 sound/isa/msnd/msnd.h create mode 100644 sound/isa/msnd/msnd_classic.c create mode 100644 sound/isa/msnd/msnd_classic.h create mode 100644 sound/isa/msnd/msnd_midi.c create mode 100644 sound/isa/msnd/msnd_pinnacle.c create mode 100644 sound/isa/msnd/msnd_pinnacle.h create mode 100644 sound/isa/msnd/msnd_pinnacle_mixer.c (limited to 'sound') diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index ce0aa044e274..a74725950b02 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -411,5 +411,36 @@ config SND_WAVEFRONT_FIRMWARE_IN_KERNEL you need to install the firmware files from the alsa-firmware package. +config SND_MSND_PINNACLE + tristate "Turtle Beach MultiSound Pinnacle/Fiji driver" + depends on X86 && EXPERIMENTAL + select FW_LOADER + select SND_MPU401_UART + select SND_PCM + help + Say Y to include support for Turtle Beach MultiSound Pinnacle/ + Fiji soundcards. + + To compile this driver as a module, choose M here: the module + will be called snd-msnd-pinnacle. + +config SND_MSND_CLASSIC + tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey" + depends on X86 && EXPERIMENTAL + select FW_LOADER + select SND_MPU401_UART + select SND_PCM + help + Say M here if you have a Turtle Beach MultiSound Classic, Tahiti or + Monterey (not for the Pinnacle or Fiji). + + See for important information + about this driver. Note that it has been discontinued, but the + Voyetra Turtle Beach knowledge base entry for it is still available + at . + + To compile this driver as a module, choose M here: the module + will be called snd-msnd-classic. + endif # SND_ISA diff --git a/sound/isa/msnd/Makefile b/sound/isa/msnd/Makefile new file mode 100644 index 000000000000..2171c0aa2f62 --- /dev/null +++ b/sound/isa/msnd/Makefile @@ -0,0 +1,9 @@ + +snd-msnd-lib-objs := msnd.o msnd_midi.o msnd_pinnacle_mixer.o +snd-msnd-pinnacle-objs := msnd_pinnacle.o +snd-msnd-classic-objs := msnd_classic.o + +# Toplevel Module Dependency +obj-$(CONFIG_SND_MSND_PINNACLE) += snd-msnd-pinnacle.o snd-msnd-lib.o +obj-$(CONFIG_SND_MSND_CLASSIC) += snd-msnd-classic.o snd-msnd-lib.o + diff --git a/sound/isa/msnd/msnd.c b/sound/isa/msnd/msnd.c new file mode 100644 index 000000000000..264e08212c69 --- /dev/null +++ b/sound/isa/msnd/msnd.c @@ -0,0 +1,702 @@ +/********************************************************************* + * + * 2002/06/30 Karsten Wiese: + * removed kernel-version dependencies. + * ripped from linux kernel 2.4.18 (OSS Implementation) by me. + * In the OSS Version, this file is compiled to a separate MODULE, + * that is used by the pinnacle and the classic driver. + * since there is no classic driver for alsa yet (i dont have a classic + * & writing one blindfold is difficult) this file's object is statically + * linked into the pinnacle-driver-module for now. look for the string + * "uncomment this to make this a module again" + * to do guess what. + * + * the following is a copy of the 2.4.18 OSS FREE file-heading comment: + * + * msnd.c - Driver Base + * + * Turtle Beach MultiSound Sound Card Driver for Linux + * + * Copyright (C) 1998 Andrew Veliath + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + ********************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "msnd.h" + +#define LOGNAME "msnd" + + +void snd_msnd_init_queue(void *base, int start, int size) +{ + writew(PCTODSP_BASED(start), base + JQS_wStart); + writew(PCTODSP_OFFSET(size) - 1, base + JQS_wSize); + writew(0, base + JQS_wHead); + writew(0, base + JQS_wTail); +} +EXPORT_SYMBOL(snd_msnd_init_queue); + +static int snd_msnd_wait_TXDE(struct snd_msnd *dev) +{ + unsigned int io = dev->io; + int timeout = 1000; + + while (timeout-- > 0) + if (inb(io + HP_ISR) & HPISR_TXDE) + return 0; + + return -EIO; +} + +static int snd_msnd_wait_HC0(struct snd_msnd *dev) +{ + unsigned int io = dev->io; + int timeout = 1000; + + while (timeout-- > 0) + if (!(inb(io + HP_CVR) & HPCVR_HC)) + return 0; + + return -EIO; +} + +int snd_msnd_send_dsp_cmd(struct snd_msnd *dev, u8 cmd) +{ + unsigned long flags; + + spin_lock_irqsave(&dev->lock, flags); + if (snd_msnd_wait_HC0(dev) == 0) { + outb(cmd, dev->io + HP_CVR); + spin_unlock_irqrestore(&dev->lock, flags); + return 0; + } + spin_unlock_irqrestore(&dev->lock, flags); + + snd_printd(KERN_ERR LOGNAME ": Send DSP command timeout\n"); + + return -EIO; +} +EXPORT_SYMBOL(snd_msnd_send_dsp_cmd); + +int snd_msnd_send_word(struct snd_msnd *dev, unsigned char high, + unsigned char mid, unsigned char low) +{ + unsigned int io = dev->io; + + if (snd_msnd_wait_TXDE(dev) == 0) { + outb(high, io + HP_TXH); + outb(mid, io + HP_TXM); + outb(low, io + HP_TXL); + return 0; + } + + snd_printd(KERN_ERR LOGNAME ": Send host word timeout\n"); + + return -EIO; +} +EXPORT_SYMBOL(snd_msnd_send_word); + +int snd_msnd_upload_host(struct snd_msnd *dev, const u8 *bin, int len) +{ + int i; + + if (len % 3 != 0) { + snd_printk(KERN_ERR LOGNAME + ": Upload host data not multiple of 3!\n"); + return -EINVAL; + } + + for (i = 0; i < len; i += 3) + if (snd_msnd_send_word(dev, bin[i], bin[i + 1], bin[i + 2])) + return -EIO; + + inb(dev->io + HP_RXL); + inb(dev->io + HP_CVR); + + return 0; +} +EXPORT_SYMBOL(snd_msnd_upload_host); + +int snd_msnd_enable_irq(struct snd_msnd *dev) +{ + unsigned long flags; + + if (dev->irq_ref++) + return 0; + + snd_printdd(LOGNAME ": Enabling IRQ\n"); + + spin_lock_irqsave(&dev->lock, flags); + if (snd_msnd_wait_TXDE(dev) == 0) { + outb(inb(dev->io + HP_ICR) | HPICR_TREQ, dev->io + HP_ICR); + if (dev->type == msndClassic) + outb(dev->irqid, dev->io + HP_IRQM); + + outb(inb(dev->io + HP_ICR) & ~HPICR_TREQ, dev->io + HP_ICR); + outb(inb(dev->io + HP_ICR) | HPICR_RREQ, dev->io + HP_ICR); + enable_irq(dev->irq); + snd_msnd_init_queue(dev->DSPQ, dev->dspq_data_buff, + dev->dspq_buff_size); + spin_unlock_irqrestore(&dev->lock, flags); + return 0; + } + spin_unlock_irqrestore(&dev->lock, flags); + + snd_printd(KERN_ERR LOGNAME ": Enable IRQ failed\n"); + + return -EIO; +} +EXPORT_SYMBOL(snd_msnd_enable_irq); + +int snd_msnd_disable_irq(struct snd_msnd *dev) +{ + unsigned long flags; + + if (--dev->irq_ref > 0) + return 0; + + if (dev->irq_ref < 0) + snd_printd(KERN_WARNING LOGNAME ": IRQ ref count is %d\n", + dev->irq_ref); + + snd_printdd(LOGNAME ": Disabling IRQ\n"); + + spin_lock_irqsave(&dev->lock, flags); + if (snd_msnd_wait_TXDE(dev) == 0) { + outb(inb(dev->io + HP_ICR) & ~HPICR_RREQ, dev->io + HP_ICR); + if (dev->type == msndClassic) + outb(HPIRQ_NONE, dev->io + HP_IRQM); + disable_irq(dev->irq); + spin_unlock_irqrestore(&dev->lock, flags); + return 0; + } + spin_unlock_irqrestore(&dev->lock, flags); + + snd_printd(KERN_ERR LOGNAME ": Disable IRQ failed\n"); + + return -EIO; +} +EXPORT_SYMBOL(snd_msnd_disable_irq); + +static inline long get_play_delay_jiffies(struct snd_msnd *chip, long size) +{ + long tmp = (size * HZ * chip->play_sample_size) / 8; + return tmp / (chip->play_sample_rate * chip->play_channels); +} + +static void snd_msnd_dsp_write_flush(struct snd_msnd *chip) +{ + if (!(chip->mode & FMODE_WRITE) || !test_bit(F_WRITING, &chip->flags)) + return; + set_bit(F_WRITEFLUSH, &chip->flags); +/* interruptible_sleep_on_timeout( + &chip->writeflush, + get_play_delay_jiffies(&chip, chip->DAPF.len));*/ + clear_bit(F_WRITEFLUSH, &chip->flags); + if (!signal_pending(current)) + schedule_timeout_interruptible( + get_play_delay_jiffies(chip, chip->play_period_bytes)); + clear_bit(F_WRITING, &chip->flags); +} + +void snd_msnd_dsp_halt(struct snd_msnd *chip, struct file *file) +{ + if ((file ? file->f_mode : chip->mode) & FMODE_READ) { + clear_bit(F_READING, &chip->flags); + snd_msnd_send_dsp_cmd(chip, HDEX_RECORD_STOP); + snd_msnd_disable_irq(chip); + if (file) { + snd_printd(KERN_INFO LOGNAME + ": Stopping read for %p\n", file); + chip->mode &= ~FMODE_READ; + } + clear_bit(F_AUDIO_READ_INUSE, &chip->flags); + } + if ((file ? file->f_mode : chip->mode) & FMODE_WRITE) { + if (test_bit(F_WRITING, &chip->flags)) { + snd_msnd_dsp_write_flush(chip); + snd_msnd_send_dsp_cmd(chip, HDEX_PLAY_STOP); + } + snd_msnd_disable_irq(chip); + if (file) { + snd_printd(KERN_INFO + LOGNAME ": Stopping write for %p\n", file); + chip->mode &= ~FMODE_WRITE; + } + clear_bit(F_AUDIO_WRITE_INUSE, &chip->flags); + } +} +EXPORT_SYMBOL(snd_msnd_dsp_halt); + + +int snd_msnd_DARQ(struct snd_msnd *chip, int bank) +{ + int /*size, n,*/ timeout = 3; + u16 wTmp; + /* void *DAQD; */ + + /* Increment the tail and check for queue wrap */ + wTmp = readw(chip->DARQ + JQS_wTail) + PCTODSP_OFFSET(DAQDS__size); + if (wTmp > readw(chip->DARQ + JQS_wSize)) + wTmp = 0; + while (wTmp == readw(chip->DARQ + JQS_wHead) && timeout--) + udelay(1); + + if (chip->capturePeriods == 2) { + void *pDAQ = chip->mappedbase + DARQ_DATA_BUFF + + bank * DAQDS__size + DAQDS_wStart; + unsigned short offset = 0x3000 + chip->capturePeriodBytes; + + if (readw(pDAQ) != PCTODSP_BASED(0x3000)) + offset = 0x3000; + writew(PCTODSP_BASED(offset), pDAQ); + } + + writew(wTmp, chip->DARQ + JQS_wTail); + +#if 0 + /* Get our digital audio queue struct */ + DAQD = bank * DAQDS__size + chip->mappedbase + DARQ_DATA_BUFF; + + /* Get length of data */ + size = readw(DAQD + DAQDS_wSize); + + /* Read data from the head (unprotected bank 1 access okay + since this is only called inside an interrupt) */ + outb(HPBLKSEL_1, chip->io + HP_BLKS); + n = msnd_fifo_write(&chip->DARF, + (char *)(chip->base + bank * DAR_BUFF_SIZE), + size, 0); + if (n <= 0) { + outb(HPBLKSEL_0, chip->io + HP_BLKS); + return n; + } + outb(HPBLKSEL_0, chip->io + HP_BLKS); +#endif + + return 1; +} +EXPORT_SYMBOL(snd_msnd_DARQ); + +int snd_msnd_DAPQ(struct snd_msnd *chip, int start) +{ + u16 DAPQ_tail; + int protect = start, nbanks = 0; + void *DAQD; + static int play_banks_submitted; + /* unsigned long flags; + spin_lock_irqsave(&chip->lock, flags); not necessary */ + + DAPQ_tail = readw(chip->DAPQ + JQS_wTail); + while (DAPQ_tail != readw(chip->DAPQ + JQS_wHead) || start) { + int bank_num = DAPQ_tail / PCTODSP_OFFSET(DAQDS__size); + + if (start) { + start = 0; + play_banks_submitted = 0; + } + + /* Get our digital audio queue struct */ + DAQD = bank_num * DAQDS__size + chip->mappedbase + + DAPQ_DATA_BUFF; + + /* Write size of this bank */ + writew(chip->play_period_bytes, DAQD + DAQDS_wSize); + if (play_banks_submitted < 3) + ++play_banks_submitted; + else if (chip->playPeriods == 2) { + unsigned short offset = chip->play_period_bytes; + + if (readw(DAQD + DAQDS_wStart) != PCTODSP_BASED(0x0)) + offset = 0; + + writew(PCTODSP_BASED(offset), DAQD + DAQDS_wStart); + } + ++nbanks; + + /* Then advance the tail */ + /* + if (protect) + snd_printd(KERN_INFO "B %X %lX\n", + bank_num, xtime.tv_usec); + */ + + DAPQ_tail = (++bank_num % 3) * PCTODSP_OFFSET(DAQDS__size); + writew(DAPQ_tail, chip->DAPQ + JQS_wTail); + /* Tell the DSP to play the bank */ + snd_msnd_send_dsp_cmd(chip, HDEX_PLAY_START); + if (protect) + if (2 == bank_num) + break; + } + /* + if (protect) + snd_printd(KERN_INFO "%lX\n", xtime.tv_usec); + */ + /* spin_unlock_irqrestore(&chip->lock, flags); not necessary */ + return nbanks; +} +EXPORT_SYMBOL(snd_msnd_DAPQ); + +static void snd_msnd_play_reset_queue(struct snd_msnd *chip, + unsigned int pcm_periods, + unsigned int pcm_count) +{ + int n; + void *pDAQ = chip->mappedbase + DAPQ_DATA_BUFF; + + chip->last_playbank = -1; + chip->playLimit = pcm_count * (pcm_periods - 1); + chip->playPeriods = pcm_periods; + writew(PCTODSP_OFFSET(0 * DAQDS__size), chip->DAPQ + JQS_wHead); + writew(PCTODSP_OFFSET(0 * DAQDS__size), chip->DAPQ + JQS_wTail); + + chip->play_period_bytes = pcm_count; + + for (n = 0; n < pcm_periods; ++n, pDAQ += DAQDS__size) { + writew(PCTODSP_BASED((u32)(pcm_count * n)), + pDAQ + DAQDS_wStart); + writew(0, pDAQ + DAQDS_wSize); + writew(1, pDAQ + DAQDS_wFormat); + writew(chip->play_sample_size, pDAQ + DAQDS_wSampleSize); + writew(chip->play_channels, pDAQ + DAQDS_wChannels); + writew(chip->play_sample_rate, pDAQ + DAQDS_wSampleRate); + writew(HIMT_PLAY_DONE * 0x100 + n, pDAQ + DAQDS_wIntMsg); + writew(n, pDAQ + DAQDS_wFlags); + } +} + +static void snd_msnd_capture_reset_queue(struct snd_msnd *chip, + unsigned int pcm_periods, + unsigned int pcm_count) +{ + int n; + void *pDAQ; + /* unsigned long flags; */ + + /* snd_msnd_init_queue(chip->DARQ, DARQ_DATA_BUFF, DARQ_BUFF_SIZE); */ + + chip->last_recbank = 2; + chip->captureLimit = pcm_count * (pcm_periods - 1); + chip->capturePeriods = pcm_periods; + writew(PCTODSP_OFFSET(0 * DAQDS__size), chip->DARQ + JQS_wHead); + writew(PCTODSP_OFFSET(chip->last_recbank * DAQDS__size), + chip->DARQ + JQS_wTail); + +#if 0 /* Critical section: bank 1 access. this is how the OSS driver does it:*/ + spin_lock_irqsave(&chip->lock, flags); + outb(HPBLKSEL_1, chip->io + HP_BLKS); + memset_io(chip->mappedbase, 0, DAR_BUFF_SIZE * 3); + outb(HPBLKSEL_0, chip->io + HP_BLKS); + spin_unlock_irqrestore(&chip->lock, flags); +#endif + + chip->capturePeriodBytes = pcm_count; + snd_printdd("snd_msnd_capture_reset_queue() %i\n", pcm_count); + + pDAQ = chip->mappedbase + DARQ_DATA_BUFF; + + for (n = 0; n < pcm_periods; ++n, pDAQ += DAQDS__size) { + u32 tmp = pcm_count * n; + + writew(PCTODSP_BASED(tmp + 0x3000), pDAQ + DAQDS_wStart); + writew(pcm_count, pDAQ + DAQDS_wSize); + writew(1, pDAQ + DAQDS_wFormat); + writew(chip->capture_sample_size, pDAQ + DAQDS_wSampleSize); + writew(chip->capture_channels, pDAQ + DAQDS_wChannels); + writew(chip->capture_sample_rate, pDAQ + DAQDS_wSampleRate); + writew(HIMT_RECORD_DONE * 0x100 + n, pDAQ + DAQDS_wIntMsg); + writew(n, pDAQ + DAQDS_wFlags); + } +} + +static struct snd_pcm_hardware snd_msnd_playback = { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_MMAP_VALID, + .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_8000_48000, + .rate_min = 8000, + .rate_max = 48000, + .channels_min = 1, + .channels_max = 2, + .buffer_bytes_max = 0x3000, + .period_bytes_min = 0x40, + .period_bytes_max = 0x1800, + .periods_min = 2, + .periods_max = 3, + .fifo_size = 0, +}; + +static struct snd_pcm_hardware snd_msnd_capture = { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_MMAP_VALID, + .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_8000_48000, + .rate_min = 8000, + .rate_max = 48000, + .channels_min = 1, + .channels_max = 2, + .buffer_bytes_max = 0x3000, + .period_bytes_min = 0x40, + .period_bytes_max = 0x1800, + .periods_min = 2, + .periods_max = 3, + .fifo_size = 0, +}; + + +static int snd_msnd_playback_open(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + set_bit(F_AUDIO_WRITE_INUSE, &chip->flags); + clear_bit(F_WRITING, &chip->flags); + snd_msnd_enable_irq(chip); + + runtime->dma_area = chip->mappedbase; + runtime->dma_bytes = 0x3000; + + chip->playback_substream = substream; + runtime->hw = snd_msnd_playback; + return 0; +} + +static int snd_msnd_playback_close(struct snd_pcm_substream *substream) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + snd_msnd_disable_irq(chip); + clear_bit(F_AUDIO_WRITE_INUSE, &chip->flags); + return 0; +} + + +static int snd_msnd_playback_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + int i; + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + void *pDAQ = chip->mappedbase + DAPQ_DATA_BUFF; + + chip->play_sample_size = snd_pcm_format_width(params_format(params)); + chip->play_channels = params_channels(params); + chip->play_sample_rate = params_rate(params); + + for (i = 0; i < 3; ++i, pDAQ += DAQDS__size) { + writew(chip->play_sample_size, pDAQ + DAQDS_wSampleSize); + writew(chip->play_channels, pDAQ + DAQDS_wChannels); + writew(chip->play_sample_rate, pDAQ + DAQDS_wSampleRate); + } + /* dont do this here: + * snd_msnd_calibrate_adc(chip->play_sample_rate); + */ + + return 0; +} + +static int snd_msnd_playback_prepare(struct snd_pcm_substream *substream) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + unsigned int pcm_size = snd_pcm_lib_buffer_bytes(substream); + unsigned int pcm_count = snd_pcm_lib_period_bytes(substream); + unsigned int pcm_periods = pcm_size / pcm_count; + + snd_msnd_play_reset_queue(chip, pcm_periods, pcm_count); + chip->playDMAPos = 0; + return 0; +} + +static int snd_msnd_playback_trigger(struct snd_pcm_substream *substream, + int cmd) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + int result = 0; + + if (cmd == SNDRV_PCM_TRIGGER_START) { + snd_printdd("snd_msnd_playback_trigger(START)\n"); + chip->banksPlayed = 0; + set_bit(F_WRITING, &chip->flags); + snd_msnd_DAPQ(chip, 1); + } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { + snd_printdd("snd_msnd_playback_trigger(STop)\n"); + /* interrupt diagnostic, comment this out later */ + clear_bit(F_WRITING, &chip->flags); + snd_msnd_send_dsp_cmd(chip, HDEX_PLAY_STOP); + } else { + snd_printd(KERN_ERR "snd_msnd_playback_trigger(?????)\n"); + result = -EINVAL; + } + + snd_printdd("snd_msnd_playback_trigger() ENDE\n"); + return result; +} + +static snd_pcm_uframes_t +snd_msnd_playback_pointer(struct snd_pcm_substream *substream) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + return bytes_to_frames(substream->runtime, chip->playDMAPos); +} + + +static struct snd_pcm_ops snd_msnd_playback_ops = { + .open = snd_msnd_playback_open, + .close = snd_msnd_playback_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_msnd_playback_hw_params, + .prepare = snd_msnd_playback_prepare, + .trigger = snd_msnd_playback_trigger, + .pointer = snd_msnd_playback_pointer, +}; + +static int snd_msnd_capture_open(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + set_bit(F_AUDIO_READ_INUSE, &chip->flags); + snd_msnd_enable_irq(chip); + runtime->dma_area = chip->mappedbase + 0x3000; + runtime->dma_bytes = 0x3000; + memset(runtime->dma_area, 0, runtime->dma_bytes); + chip->capture_substream = substream; + runtime->hw = snd_msnd_capture; + return 0; +} + +static int snd_msnd_capture_close(struct snd_pcm_substream *substream) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + snd_msnd_disable_irq(chip); + clear_bit(F_AUDIO_READ_INUSE, &chip->flags); + return 0; +} + +static int snd_msnd_capture_prepare(struct snd_pcm_substream *substream) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + unsigned int pcm_size = snd_pcm_lib_buffer_bytes(substream); + unsigned int pcm_count = snd_pcm_lib_period_bytes(substream); + unsigned int pcm_periods = pcm_size / pcm_count; + + snd_msnd_capture_reset_queue(chip, pcm_periods, pcm_count); + chip->captureDMAPos = 0; + return 0; +} + +static int snd_msnd_capture_trigger(struct snd_pcm_substream *substream, + int cmd) +{ + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + if (cmd == SNDRV_PCM_TRIGGER_START) { + chip->last_recbank = -1; + set_bit(F_READING, &chip->flags); + if (snd_msnd_send_dsp_cmd(chip, HDEX_RECORD_START) == 0) + return 0; + + clear_bit(F_READING, &chip->flags); + } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { + clear_bit(F_READING, &chip->flags); + snd_msnd_send_dsp_cmd(chip, HDEX_RECORD_STOP); + return 0; + } + return -EINVAL; +} + + +static snd_pcm_uframes_t +snd_msnd_capture_pointer(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + + return bytes_to_frames(runtime, chip->captureDMAPos); +} + + +static int snd_msnd_capture_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + int i; + struct snd_msnd *chip = snd_pcm_substream_chip(substream); + void *pDAQ = chip->mappedbase + DARQ_DATA_BUFF; + + chip->capture_sample_size = snd_pcm_format_width(params_format(params)); + chip->capture_channels = params_channels(params); + chip->capture_sample_rate = params_rate(params); + + for (i = 0; i < 3; ++i, pDAQ += DAQDS__size) { + writew(chip->capture_sample_size, pDAQ + DAQDS_wSampleSize); + writew(chip->capture_channels, pDAQ + DAQDS_wChannels); + writew(chip->capture_sample_rate, pDAQ + DAQDS_wSampleRate); + } + return 0; +} + + +static struct snd_pcm_ops snd_msnd_capture_ops = { + .open = snd_msnd_capture_open, + .close = snd_msnd_capture_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_msnd_capture_hw_params, + .prepare = snd_msnd_capture_prepare, + .trigger = snd_msnd_capture_trigger, + .pointer = snd_msnd_capture_pointer, +}; + + +int snd_msnd_pcm(struct snd_card *card, int device, + struct snd_pcm **rpcm) +{ + struct snd_msnd *chip = card->private_data; + struct snd_pcm *pcm; + int err; + + err = snd_pcm_new(card, "MSNDPINNACLE", device, 1, 1, &pcm); + if (err < 0) + return err; + + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_msnd_playback_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_msnd_capture_ops); + + pcm->private_data = chip; + strcpy(pcm->name, "Hurricane"); + + + if (rpcm) + *rpcm = pcm; + return 0; +} +EXPORT_SYMBOL(snd_msnd_pcm); + diff --git a/sound/isa/msnd/msnd.h b/sound/isa/msnd/msnd.h new file mode 100644 index 000000000000..3773e242b58e --- /dev/null +++ b/sound/isa/msnd/msnd.h @@ -0,0 +1,308 @@ +/********************************************************************* + * + * msnd.h + * + * Turtle Beach MultiSound Sound Card Driver for Linux + * + * Some parts of this header file were derived from the Turtle Beach + * MultiSound Driver Development Kit. + * + * Copyright (C) 1998 Andrew Veliath + * Copyright (C) 1993 Turtle Beach Systems, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + ********************************************************************/ +#ifndef __MSND_H +#define __MSND_H + +#define DEFSAMPLERATE 44100 +#define DEFSAMPLESIZE SNDRV_PCM_FORMAT_S16 +#define DEFCHANNELS 1 + +#define SRAM_BANK_SIZE 0x8000 +#define SRAM_CNTL_START 0x7F00 +#define SMA_STRUCT_START 0x7F40 + +#define DSP_BASE_ADDR 0x4000 +#define DSP_BANK_BASE 0x4000 + +#define AGND 0x01 +#define SIGNAL 0x02 + +#define EXT_DSP_BIT_DCAL 0x0001 +#define EXT_DSP_BIT_MIDI_CON 0x0002 + +#define BUFFSIZE 0x8000 +#define HOSTQ_SIZE 0x40 + +#define DAP_BUFF_SIZE 0x2400 + +#define DAPQ_STRUCT_SIZE 0x10 +#define DARQ_STRUCT_SIZE 0x10 +#define DAPQ_BUFF_SIZE (3 * 0x10) +#define DARQ_BUFF_SIZE (3 * 0x10) +#define MODQ_BUFF_SIZE 0x400 + +#define DAPQ_DATA_BUFF 0x6C00 +#define DARQ_DATA_BUFF 0x6C30 +#define MODQ_DATA_BUFF 0x6C60 +#define MIDQ_DATA_BUFF 0x7060 + +#define DAPQ_OFFSET SRAM_CNTL_START +#define DARQ_OFFSET (SRAM_CNTL_START + 0x08) +#define MODQ_OFFSET (SRAM_CNTL_START + 0x10) +#define MIDQ_OFFSET (SRAM_CNTL_START + 0x18) +#define DSPQ_OFFSET (SRAM_CNTL_START + 0x20) + +#define HP_ICR 0x00 +#define HP_CVR 0x01 +#define HP_ISR 0x02 +#define HP_IVR 0x03 +#define HP_NU 0x04 +#define HP_INFO 0x04 +#define HP_TXH 0x05 +#define HP_RXH 0x05 +#define HP_TXM 0x06 +#define HP_RXM 0x06 +#define HP_TXL 0x07 +#define HP_RXL 0x07 + +#define HP_ICR_DEF 0x00 +#define HP_CVR_DEF 0x12 +#define HP_ISR_DEF 0x06 +#define HP_IVR_DEF 0x0f +#define HP_NU_DEF 0x00 + +#define HP_IRQM 0x09 + +#define HPR_BLRC 0x08 +#define HPR_SPR1 0x09 +#define HPR_SPR2 0x0A +#define HPR_TCL0 0x0B +#define HPR_TCL1 0x0C +#define HPR_TCL2 0x0D +#define HPR_TCL3 0x0E +#define HPR_TCL4 0x0F + +#define HPICR_INIT 0x80 +#define HPICR_HM1 0x40 +#define HPICR_HM0 0x20 +#define HPICR_HF1 0x10 +#define HPICR_HF0 0x08 +#define HPICR_TREQ 0x02 +#define HPICR_RREQ 0x01 + +#define HPCVR_HC 0x80 + +#define HPISR_HREQ 0x80 +#define HPISR_DMA 0x40 +#define HPISR_HF3 0x10 +#define HPISR_HF2 0x08 +#define HPISR_TRDY 0x04 +#define HPISR_TXDE 0x02 +#define HPISR_RXDF 0x01 + +#define HPIO_290 0 +#define HPIO_260 1 +#define HPIO_250 2 +#define HPIO_240 3 +#define HPIO_230 4 +#define HPIO_220 5 +#define HPIO_210 6 +#define HPIO_3E0 7 + +#define HPMEM_NONE 0 +#define HPMEM_B000 1 +#define HPMEM_C800 2 +#define HPMEM_D000 3 +#define HPMEM_D400 4 +#define HPMEM_D800 5 +#define HPMEM_E000 6 +#define HPMEM_E800 7 + +#define HPIRQ_NONE 0 +#define HPIRQ_5 1 +#define HPIRQ_7 2 +#define HPIRQ_9 3 +#define HPIRQ_10 4 +#define HPIRQ_11 5 +#define HPIRQ_12 6 +#define HPIRQ_15 7 + +#define HIMT_PLAY_DONE 0x00 +#define HIMT_RECORD_DONE 0x01 +#define HIMT_MIDI_EOS 0x02 +#define HIMT_MIDI_OUT 0x03 + +#define HIMT_MIDI_IN_UCHAR 0x0E +#define HIMT_DSP 0x0F + +#define HDEX_BASE 0x92 +#define HDEX_PLAY_START (0 + HDEX_BASE) +#define HDEX_PLAY_STOP (1 + HDEX_BASE) +#define HDEX_PLAY_PAUSE (2 + HDEX_BASE) +#define HDEX_PLAY_RESUME (3 + HDEX_BASE) +#define HDEX_RECORD_START (4 + HDEX_BASE) +#define HDEX_RECORD_STOP (5 + HDEX_BASE) +#define HDEX_MIDI_IN_START (6 + HDEX_BASE) +#define HDEX_MIDI_IN_STOP (7 + HDEX_BASE) +#define HDEX_MIDI_OUT_START (8 + HDEX_BASE) +#define HDEX_MIDI_OUT_STOP (9 + HDEX_BASE) +#define HDEX_AUX_REQ (10 + HDEX_BASE) + +#define HDEXAR_CLEAR_PEAKS 1 +#define HDEXAR_IN_SET_POTS 2 +#define HDEXAR_AUX_SET_POTS 3 +#define HDEXAR_CAL_A_TO_D 4 +#define HDEXAR_RD_EXT_DSP_BITS 5 + +/* Pinnacle only HDEXAR defs */ +#define HDEXAR_SET_ANA_IN 0 +#define HDEXAR_SET_SYNTH_IN 4 +#define HDEXAR_READ_DAT_IN 5 +#define HDEXAR_MIC_SET_POTS 6 +#define HDEXAR_SET_DAT_IN 7 + +#define HDEXAR_SET_SYNTH_48 8 +#define HDEXAR_SET_SYNTH_44 9 + +#define HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) +#define LOWORD(l) ((u16)(u32)(l)) +#define HIBYTE(w) ((u8)(((u16)(w) >> 8) & 0xFF)) +#define LOBYTE(w) ((u8)(w)) +#define MAKELONG(low, hi) ((long)(((u16)(low))|(((u32)((u16)(hi)))<<16))) +#define MAKEWORD(low, hi) ((u16)(((u8)(low))|(((u16)((u8)(hi)))<<8))) + +#define PCTODSP_OFFSET(w) (u16)((w)/2) +#define PCTODSP_BASED(w) (u16)(((w)/2) + DSP_BASE_ADDR) +#define DSPTOPC_BASED(w) (((w) - DSP_BASE_ADDR) * 2) + +#ifdef SLOWIO +# undef outb +# undef inb +# define outb outb_p +# define inb inb_p +#endif + +/* JobQueueStruct */ +#define JQS_wStart 0x00 +#define JQS_wSize 0x02 +#define JQS_wHead 0x04 +#define JQS_wTail 0x06 +#define JQS__size 0x08 + +/* DAQueueDataStruct */ +#define DAQDS_wStart 0x00 +#define DAQDS_wSize 0x02 +#define DAQDS_wFormat 0x04 +#define DAQDS_wSampleSize 0x06 +#define DAQDS_wChannels 0x08 +#define DAQDS_wSampleRate 0x0A +#define DAQDS_wIntMsg 0x0C +#define DAQDS_wFlags 0x0E +#define DAQDS__size 0x10 + +#include + +struct snd_msnd { + void __iomem *mappedbase; + int play_period_bytes; + int playLimit; + int playPeriods; + int playDMAPos; + int banksPlayed; + int captureDMAPos; + int capturePeriodBytes; + int captureLimit; + int capturePeriods; + struct snd_card *card; + void *msndmidi_mpu; + struct snd_rawmidi *rmidi; + + /* Hardware resources */ + long io; + int memid, irqid; + int irq, irq_ref; + unsigned long base; + + /* Motorola 56k DSP SMA */ + void __iomem *SMA; + void __iomem *DAPQ; + void __iomem *DARQ; + void __iomem *MODQ; + void __iomem *MIDQ; + void __iomem *DSPQ; + int dspq_data_buff, dspq_buff_size; + + /* State variables */ + enum { msndClassic, msndPinnacle } type; + mode_t mode; + unsigned long flags; +#define F_RESETTING 0 +#define F_HAVEDIGITAL 1 +#define F_AUDIO_WRITE_INUSE 2 +#define F_WRITING 3 +#define F_WRITEBLOCK 4 +#define F_WRITEFLUSH 5 +#define F_AUDIO_READ_INUSE 6 +#define F_READING 7 +#define F_READBLOCK 8 +#define F_EXT_MIDI_INUSE 9 +#define F_HDR_MIDI_INUSE 10 +#define F_DISABLE_WRITE_NDELAY 11 + spinlock_t lock; + spinlock_t mixer_lock; + int nresets; + unsigned recsrc; +#define LEVEL_ENTRIES 32 + int left_levels[LEVEL_ENTRIES]; + int right_levels[LEVEL_ENTRIES]; + int calibrate_signal; + int play_sample_size, play_sample_rate, play_channels; + int play_ndelay; + int capture_sample_size, capture_sample_rate, capture_channels; + int capture_ndelay; + u8 bCurrentMidiPatch; + + int last_playbank, last_recbank; + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; + +}; + +void snd_msnd_init_queue(void *base, int start, int size); + +int snd_msnd_send_dsp_cmd(struct snd_msnd *chip, u8 cmd); +int snd_msnd_send_word(struct snd_msnd *chip, + unsigned char high, + unsigned char mid, + unsigned char low); +int snd_msnd_upload_host(struct snd_msnd *chip, + const u8 *bin, int len); +int snd_msnd_enable_irq(struct snd_msnd *chip); +int snd_msnd_disable_irq(struct snd_msnd *chip); +void snd_msnd_dsp_halt(struct snd_msnd *chip, struct file *file); +int snd_msnd_DAPQ(struct snd_msnd *chip, int start); +int snd_msnd_DARQ(struct snd_msnd *chip, int start); +int snd_msnd_pcm(struct snd_card *card, int device, struct snd_pcm **rpcm); + +int snd_msndmidi_new(struct snd_card *card, int device); +void snd_msndmidi_input_read(void *mpu); + +void snd_msndmix_setup(struct snd_msnd *chip); +int __devinit snd_msndmix_new(struct snd_card *card); +int snd_msndmix_force_recsrc(struct snd_msnd *chip, int recsrc); +#endif /* __MSND_H */ diff --git a/sound/isa/msnd/msnd_classic.c b/sound/isa/msnd/msnd_classic.c new file mode 100644 index 000000000000..3b23a096fa4e --- /dev/null +++ b/sound/isa/msnd/msnd_classic.c @@ -0,0 +1,3 @@ +/* The work is in msnd_pinnacle.c, just define MSND_CLASSIC before it. */ +#define MSND_CLASSIC +#include "msnd_pinnacle.c" diff --git a/sound/isa/msnd/msnd_classic.h b/sound/isa/msnd/msnd_classic.h new file mode 100644 index 000000000000..f18d5fa5baf4 --- /dev/null +++ b/sound/isa/msnd/msnd_classic.h @@ -0,0 +1,129 @@ +/********************************************************************* + * + * msnd_classic.h + * + * Turtle Beach MultiSound Sound Card Driver for Linux + * + * Some parts of this header file were derived from the Turtle Beach + * MultiSound Driver Development Kit. + * + * Copyright (C) 1998 Andrew Veliath + * Copyright (C) 1993 Turtle Beach Systems, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + ********************************************************************/ +#ifndef __MSND_CLASSIC_H +#define __MSND_CLASSIC_H + +#define DSP_NUMIO 0x10 + +#define HP_MEMM 0x08 + +#define HP_BITM 0x0E +#define HP_WAIT 0x0D +#define HP_DSPR 0x0A +#define HP_PROR 0x0B +#define HP_BLKS 0x0C + +#define HPPRORESET_OFF 0 +#define HPPRORESET_ON 1 + +#define HPDSPRESET_OFF 0 +#define HPDSPRESET_ON 1 + +#define HPBLKSEL_0 0 +#define HPBLKSEL_1 1 + +#define HPWAITSTATE_0 0 +#define HPWAITSTATE_1 1 + +#define HPBITMODE_16 0 +#define HPBITMODE_8 1 + +#define HIDSP_INT_PLAY_UNDER 0x00 +#define HIDSP_INT_RECORD_OVER 0x01 +#define HIDSP_INPUT_CLIPPING 0x02 +#define HIDSP_MIDI_IN_OVER 0x10 +#define HIDSP_MIDI_OVERRUN_ERR 0x13 + +#define TIME_PRO_RESET_DONE 0x028A +#define TIME_PRO_SYSEX 0x0040 +#define TIME_PRO_RESET 0x0032 + +#define DAR_BUFF_SIZE 0x2000 + +#define MIDQ_BUFF_SIZE 0x200 +#define DSPQ_BUFF_SIZE 0x40 + +#define DSPQ_DATA_BUFF 0x7260 + +#define MOP_SYNTH 0x10 +#define MOP_EXTOUT 0x32 +#define MOP_EXTTHRU 0x02 +#define MOP_OUTMASK 0x01 + +#define MIP_EXTIN 0x01 +#define MIP_SYNTH 0x00 +#define MIP_INMASK 0x32 + +/* Classic SMA Common Data */ +#define SMA_wCurrPlayBytes 0x0000 +#define SMA_wCurrRecordBytes 0x0002 +#define SMA_wCurrPlayVolLeft 0x0004 +#define SMA_wCurrPlayVolRight 0x0006 +#define SMA_wCurrInVolLeft 0x0008 +#define SMA_wCurrInVolRight 0x000a +#define SMA_wUser_3 0x000c +#define SMA_wUser_4 0x000e +#define SMA_dwUser_5 0x0010 +#define SMA_dwUser_6 0x0014 +#define SMA_wUser_7 0x0018 +#define SMA_wReserved_A 0x001a +#define SMA_wReserved_B 0x001c +#define SMA_wReserved_C 0x001e +#define SMA_wReserved_D 0x0020 +#define SMA_wReserved_E 0x0022 +#define SMA_wReserved_F 0x0024 +#define SMA_wReserved_G 0x0026 +#define SMA_wReserved_H 0x0028 +#define SMA_wCurrDSPStatusFlags 0x002a +#define SMA_wCurrHostStatusFlags 0x002c +#define SMA_wCurrInputTagBits 0x002e +#define SMA_wCurrLeftPeak 0x0030 +#define SMA_wCurrRightPeak 0x0032 +#define SMA_wExtDSPbits 0x0034 +#define SMA_bExtHostbits 0x0036 +#define SMA_bBoardLevel 0x0037 +#define SMA_bInPotPosRight 0x0038 +#define SMA_bInPotPosLeft 0x0039 +#define SMA_bAuxPotPosRight 0x003a +#define SMA_bAuxPotPosLeft 0x003b +#define SMA_wCurrMastVolLeft 0x003c +#define SMA_wCurrMastVolRight 0x003e +#define SMA_bUser_12 0x0040 +#define SMA_bUser_13 0x0041 +#define SMA_wUser_14 0x0042 +#define SMA_wUser_15 0x0044 +#define SMA_wCalFreqAtoD 0x0046 +#define SMA_wUser_16 0x0048 +#define SMA_wUser_17 0x004a +#define SMA__size 0x004c + +#define INITCODEFILE "turtlebeach/msndinit.bin" +#define PERMCODEFILE "turtlebeach/msndperm.bin" +#define LONGNAME "MultiSound (Classic/Monterey/Tahiti)" + +#endif /* __MSND_CLASSIC_H */ diff --git a/sound/isa/msnd/msnd_midi.c b/sound/isa/msnd/msnd_midi.c new file mode 100644 index 000000000000..cb9aa4c4edd0 --- /dev/null +++ b/sound/isa/msnd/msnd_midi.c @@ -0,0 +1,180 @@ +/* + * Copyright (c) by Jaroslav Kysela + * Copyright (c) 2009 by Krzysztof Helt + * Routines for control of MPU-401 in UART mode + * + * MPU-401 supports UART mode which is not capable generate transmit + * interrupts thus output is done via polling. Also, if irq < 0, then + * input is done also via polling. Do not expect good performance. + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include + +#include "msnd.h" + +#define MSNDMIDI_MODE_BIT_INPUT 0 +#define MSNDMIDI_MODE_BIT_OUTPUT 1 +#define MSNDMIDI_MODE_BIT_INPUT_TRIGGER 2 +#define MSNDMIDI_MODE_BIT_OUTPUT_TRIGGER 3 + +struct snd_msndmidi { + struct snd_msnd *dev; + + unsigned long mode; /* MSNDMIDI_MODE_XXXX */ + + struct snd_rawmidi_substream *substream_input; + + spinlock_t input_lock; +}; + +/* + * input/output open/close - protected by open_mutex in rawmidi.c + */ +static int snd_msndmidi_input_open(struct snd_rawmidi_substream *substream) +{ + struct snd_msndmidi *mpu; + + snd_printdd("snd_msndmidi_input_open()\n"); + + mpu = substream->rmidi->private_data; + + mpu->substream_input = substream; + + snd_msnd_enable_irq(mpu->dev); + + snd_msnd_send_dsp_cmd(mpu->dev, HDEX_MIDI_IN_START); + set_bit(MSNDMIDI_MODE_BIT_INPUT, &mpu->mode); + return 0; +} + +static int snd_msndmidi_input_close(struct snd_rawmidi_substream *substream) +{ + struct snd_msndmidi *mpu; + + mpu = substream->rmidi->private_data; + snd_msnd_send_dsp_cmd(mpu->dev, HDEX_MIDI_IN_STOP); + clear_bit(MSNDMIDI_MODE_BIT_INPUT, &mpu->mode); + mpu->substream_input = NULL; + snd_msnd_disable_irq(mpu->dev); + return 0; +} + +static void snd_msndmidi_input_drop(struct snd_msndmidi *mpu) +{ + u16 tail; + + tail = readw(mpu->dev->MIDQ + JQS_wTail); + writew(tail, mpu->dev->MIDQ + JQS_wHead); +} + +/* + * trigger input + */ +static void snd_msndmidi_input_trigger(struct snd_rawmidi_substream *substream, + int up) +{ + unsigned long flags; + struct snd_msndmidi *mpu; + + snd_printdd("snd_msndmidi_input_trigger(, %i)\n", up); + + mpu = substream->rmidi->private_data; + spin_lock_irqsave(&mpu->input_lock, flags); + if (up) { + if (!test_and_set_bit(MSNDMIDI_MODE_BIT_INPUT_TRIGGER, + &mpu->mode)) + snd_msndmidi_input_drop(mpu); + } else { + clear_bit(MSNDMIDI_MODE_BIT_INPUT_TRIGGER, &mpu->mode); + } + spin_unlock_irqrestore(&mpu->input_lock, flags); + if (up) + snd_msndmidi_input_read(mpu); +} + +void snd_msndmidi_input_read(void *mpuv) +{ + unsigned long flags; + struct snd_msndmidi *mpu = mpuv; + void *pwMIDQData = mpu->dev->mappedbase + MIDQ_DATA_BUFF; + + spin_lock_irqsave(&mpu->input_lock, flags); + while (readw(mpu->dev->MIDQ + JQS_wTail) != + readw(mpu->dev->MIDQ + JQS_wHead)) { + u16 wTmp, val; + val = readw(pwMIDQData + 2 * readw(mpu->dev->MIDQ + JQS_wHead)); + + if (test_bit(MSNDMIDI_MODE_BIT_INPUT_TRIGGER, + &mpu->mode)) + snd_rawmidi_receive(mpu->substream_input, + (unsigned char *)&val, 1); + + wTmp = readw(mpu->dev->MIDQ + JQS_wHead) + 1; + if (wTmp > readw(mpu->dev->MIDQ + JQS_wSize)) + writew(0, mpu->dev->MIDQ + JQS_wHead); + else + writew(wTmp, mpu->dev->MIDQ + JQS_wHead); + } + spin_unlock_irqrestore(&mpu->input_lock, flags); +} +EXPORT_SYMBOL(snd_msndmidi_input_read); + +static struct snd_rawmidi_ops snd_msndmidi_input = { + .open = snd_msndmidi_input_open, + .close = snd_msndmidi_input_close, + .trigger = snd_msndmidi_input_trigger, +}; + +static void snd_msndmidi_free(struct snd_rawmidi *rmidi) +{ + struct snd_msndmidi *mpu = rmidi->private_data; + kfree(mpu); +} + +int snd_msndmidi_new(struct snd_card *card, int device) +{ + struct snd_msnd *chip = card->private_data; + struct snd_msndmidi *mpu; + struct snd_rawmidi *rmidi; + int err; + + err = snd_rawmidi_new(card, "MSND-MIDI", device, 1, 1, &rmidi); + if (err < 0) + return err; + mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL); + if (mpu == NULL) { + snd_device_free(card, rmidi); + return -ENOMEM; + } + mpu->dev = chip; + chip->msndmidi_mpu = mpu; + rmidi->private_data = mpu; + rmidi->private_free = snd_msndmidi_free; + spin_lock_init(&mpu->input_lock); + strcpy(rmidi->name, "MSND MIDI"); + snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, + &snd_msndmidi_input); + rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT; + return 0; +} diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c new file mode 100644 index 000000000000..70559223e8f3 --- /dev/null +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -0,0 +1,1235 @@ +/********************************************************************* + * + * Linux multisound pinnacle/fiji driver for ALSA. + * + * 2002/06/30 Karsten Wiese: + * for now this is only used to build a pinnacle / fiji driver. + * the OSS parent of this code is designed to also support + * the multisound classic via the file msnd_classic.c. + * to make it easier for some brave heart to implemt classic + * support in alsa, i left all the MSND_CLASSIC tokens in this file. + * but for now this untested & undone. + * + * + * ripped from linux kernel 2.4.18 by Karsten Wiese. + * + * the following is a copy of the 2.4.18 OSS FREE file-heading comment: + * + * Turtle Beach MultiSound Sound Card Driver for Linux + * msnd_pinnacle.c / msnd_classic.c + * + * -- If MSND_CLASSIC is defined: + * + * -> driver for Turtle Beach Classic/Monterey/Tahiti + * + * -- Else + * + * -> driver for Turtle Beach Pinnacle/Fiji + * + * 12-3-2000 Modified IO port validation Steve Sycamore + * + * Copyright (C) 1998 Andrew Veliath + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + ********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#ifdef MSND_CLASSIC +# ifndef __alpha__ +# define SLOWIO +# endif +#endif +#include "msnd.h" +#ifdef MSND_CLASSIC +# include "msnd_classic.h" +# define LOGNAME "msnd_classic" +#else +# include "msnd_pinnacle.h" +# define LOGNAME "snd_msnd_pinnacle" +#endif + +static void __devinit set_default_audio_parameters(struct snd_msnd *chip) +{ + chip->play_sample_size = DEFSAMPLESIZE; + chip->play_sample_rate = DEFSAMPLERATE; + chip->play_channels = DEFCHANNELS; + chip->capture_sample_size = DEFSAMPLESIZE; + chip->capture_sample_rate = DEFSAMPLERATE; + chip->capture_channels = DEFCHANNELS; +} + +static void snd_msnd_eval_dsp_msg(struct snd_msnd *chip, u16 wMessage) +{ + switch (HIBYTE(wMessage)) { + case HIMT_PLAY_DONE: { + if (chip->banksPlayed < 3) + snd_printdd("%08X: HIMT_PLAY_DONE: %i\n", + (unsigned)jiffies, LOBYTE(wMessage)); + + if (chip->last_playbank == LOBYTE(wMessage)) { + snd_printdd("chip.last_playbank == LOBYTE(wMessage)\n"); + break; + } + chip->banksPlayed++; + + if (test_bit(F_WRITING, &chip->flags)) + snd_msnd_DAPQ(chip, 0); + + chip->last_playbank = LOBYTE(wMessage); + chip->playDMAPos += chip->play_period_bytes; + if (chip->playDMAPos > chip->playLimit) + chip->playDMAPos = 0; + snd_pcm_period_elapsed(chip->playback_substream); + + break; + } + case HIMT_RECORD_DONE: + if (chip->last_recbank == LOBYTE(wMessage)) + break; + chip->last_recbank = LOBYTE(wMessage); + chip->captureDMAPos += chip->capturePeriodBytes; + if (chip->captureDMAPos > (chip->captureLimit)) + chip->captureDMAPos = 0; + + if (test_bit(F_READING, &chip->flags)) + snd_msnd_DARQ(chip, chip->last_recbank); + + snd_pcm_period_elapsed(chip->capture_substream); + break; + + case HIMT_DSP: + switch (LOBYTE(wMessage)) { +#ifndef MSND_CLASSIC + case HIDSP_PLAY_UNDER: +#endif + case HIDSP_INT_PLAY_UNDER: + snd_printd(KERN_WARNING LOGNAME ": Play underflow %i\n", + chip->banksPlayed); + if (chip->banksPlayed > 2) + clear_bit(F_WRITING, &chip->flags); + break; + + case HIDSP_INT_RECORD_OVER: + snd_printd(KERN_WARNING LOGNAME ": Record overflow\n"); + clear_bit(F_READING, &chip->flags); + break; + + default: + snd_printd(KERN_WARNING LOGNAME + ": DSP message %d 0x%02x\n", + LOBYTE(wMessage), LOBYTE(wMessage)); + break; + } + break; + + case HIMT_MIDI_IN_UCHAR: + if (chip->msndmidi_mpu) + snd_msndmidi_input_read(chip->msndmidi_mpu); + break; + + default: + snd_printd(KERN_WARNING LOGNAME ": HIMT message %d 0x%02x\n", + HIBYTE(wMessage), HIBYTE(wMessage)); + break; + } +} + +static irqreturn_t snd_msnd_interrupt(int irq, void *dev_id) +{ + struct snd_msnd *chip = dev_id; + void *pwDSPQData = chip->mappedbase + DSPQ_DATA_BUFF; + + /* Send ack to DSP */ + /* inb(chip->io + HP_RXL); */ + + /* Evaluate queued DSP messages */ + while (readw(chip->DSPQ + JQS_wTail) != readw(chip->DSPQ + JQS_wHead)) { + u16 wTmp; + + snd_msnd_eval_dsp_msg(chip, + readw(pwDSPQData + 2 * readw(chip->DSPQ + JQS_wHead))); + + wTmp = readw(chip->DSPQ + JQS_wHead) + 1; + if (wTmp > readw(chip->DSPQ + JQS_wSize)) + writew(0, chip->DSPQ + JQS_wHead); + else + writew(wTmp, chip->DSPQ + JQS_wHead); + } + /* Send ack to DSP */ + inb(chip->io + HP_RXL); + return IRQ_HANDLED; +} + + +static int snd_msnd_reset_dsp(long io, unsigned char *info) +{ + int timeout = 100; + + outb(HPDSPRESET_ON, io + HP_DSPR); + msleep(1); +#ifndef MSND_CLASSIC + if (info) + *info = inb(io + HP_INFO); +#endif + outb(HPDSPRESET_OFF, io + HP_DSPR); + msleep(1); + while (timeout-- > 0) { + if (inb(io + HP_CVR) == HP_CVR_DEF) + return 0; + msleep(1); + } + snd_printk(KERN_ERR LOGNAME ": Cannot reset DSP\n"); + + return -EIO; +} + +static int __devinit snd_msnd_probe(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + unsigned char info; +#ifndef MSND_CLASSIC + char *xv, *rev = NULL; + char *pin = "TB Pinnacle", *fiji = "TB Fiji"; + char *pinfiji = "TB Pinnacle/Fiji"; +#endif + + if (!request_region(chip->io, DSP_NUMIO, "probing")) { + snd_printk(KERN_ERR LOGNAME ": I/O port conflict\n"); + return -ENODEV; + } + + if (snd_msnd_reset_dsp(chip->io, &info) < 0) { + release_region(chip->io, DSP_NUMIO); + return -ENODEV; + } + +#ifdef MSND_CLASSIC + strcpy(card->shortname, "Classic/Tahiti/Monterey"); + strcpy(card->longname, "Turtle Beach Multisound"); + printk(KERN_INFO LOGNAME ": %s, " + "I/O 0x%lx-0x%lx, IRQ %d, memory mapped to 0x%lX-0x%lX\n", + card->shortname, + chip->io, chip->io + DSP_NUMIO - 1, + chip->irq, + chip->base, chip->base + 0x7fff); +#else + switch (info >> 4) { + case 0xf: + xv = "<= 1.15"; + break; + case 0x1: + xv = "1.18/1.2"; + break; + case 0x2: + xv = "1.3"; + break; + case 0x3: + xv = "1.4"; + break; + default: + xv = "unknown"; + break; + } + + switch (info & 0x7) { + case 0x0: + rev = "I"; + strcpy(card->shortname, pin); + break; + case 0x1: + rev = "F"; + strcpy(card->shortname, pin); + break; + case 0x2: + rev = "G"; + strcpy(card->shortname, pin); + break; + case 0x3: + rev = "H"; + strcpy(card->shortname, pin); + break; + case 0x4: + rev = "E"; + strcpy(card->shortname, fiji); + break; + case 0x5: + rev = "C"; + strcpy(card->shortname, fiji); + break; + case 0x6: + rev = "D"; + strcpy(card->shortname, fiji); + break; + case 0x7: + rev = "A-B (Fiji) or A-E (Pinnacle)"; + strcpy(card->shortname, pinfiji); + break; + } + strcpy(card->longname, "Turtle Beach Multisound Pinnacle"); + printk(KERN_INFO LOGNAME ": %s revision %s, Xilinx version %s, " + "I/O 0x%lx-0x%lx, IRQ %d, memory mapped to 0x%lX-0x%lX\n", + card->shortname, + rev, xv, + chip->io, chip->io + DSP_NUMIO - 1, + chip->irq, + chip->base, chip->base + 0x7fff); +#endif + + release_region(chip->io, DSP_NUMIO); + return 0; +} + +static int snd_msnd_init_sma(struct snd_msnd *chip) +{ + static int initted; + u16 mastVolLeft, mastVolRight; + unsigned long flags; + +#ifdef MSND_CLASSIC + outb(chip->memid, chip->io + HP_MEMM); +#endif + outb(HPBLKSEL_0, chip->io + HP_BLKS); + /* Motorola 56k shared memory base */ + chip->SMA = chip->mappedbase + SMA_STRUCT_START; + + if (initted) { + mastVolLeft = readw(chip->SMA + SMA_wCurrMastVolLeft); + mastVolRight = readw(chip->SMA + SMA_wCurrMastVolRight); + } else + mastVolLeft = mastVolRight = 0; + memset_io(chip->mappedbase, 0, 0x8000); + + /* Critical section: bank 1 access */ + spin_lock_irqsave(&chip->lock, flags); + outb(HPBLKSEL_1, chip->io + HP_BLKS); + memset_io(chip->mappedbase, 0, 0x8000); + outb(HPBLKSEL_0, chip->io + HP_BLKS); + spin_unlock_irqrestore(&chip->lock, flags); + + /* Digital audio play queue */ + chip->DAPQ = chip->mappedbase + DAPQ_OFFSET; + snd_msnd_init_queue(chip->DAPQ, DAPQ_DATA_BUFF, DAPQ_BUFF_SIZE); + + /* Digital audio record queue */ + chip->DARQ = chip->mappedbase + DARQ_OFFSET; + snd_msnd_init_queue(chip->DARQ, DARQ_DATA_BUFF, DARQ_BUFF_SIZE); + + /* MIDI out queue */ + chip->MODQ = chip->mappedbase + MODQ_OFFSET; + snd_msnd_init_queue(chip->MODQ, MODQ_DATA_BUFF, MODQ_BUFF_SIZE); + + /* MIDI in queue */ + chip->MIDQ = chip->mappedbase + MIDQ_OFFSET; + snd_msnd_init_queue(chip->MIDQ, MIDQ_DATA_BUFF, MIDQ_BUFF_SIZE); + + /* DSP -> host message queue */ + chip->DSPQ = chip->mappedbase + DSPQ_OFFSET; + snd_msnd_init_queue(chip->DSPQ, DSPQ_DATA_BUFF, DSPQ_BUFF_SIZE); + + /* Setup some DSP values */ +#ifndef MSND_CLASSIC + writew(1, chip->SMA + SMA_wCurrPlayFormat); + writew(chip->play_sample_size, chip->SMA + SMA_wCurrPlaySampleSize); + writew(chip->play_channels, chip->SMA + SMA_wCurrPlayChannels); + writew(chip->play_sample_rate, chip->SMA + SMA_wCurrPlaySampleRate); +#endif + writew(chip->play_sample_rate, chip->SMA + SMA_wCalFreqAtoD); + writew(mastVolLeft, chip->SMA + SMA_wCurrMastVolLeft); + writew(mastVolRight, chip->SMA + SMA_wCurrMastVolRight); +#ifndef MSND_CLASSIC + writel(0x00010000, chip->SMA + SMA_dwCurrPlayPitch); + writel(0x00000001, chip->SMA + SMA_dwCurrPlayRate); +#endif + writew(0x303, chip->SMA + SMA_wCurrInputTagBits); + + initted = 1; + + return 0; +} + + +static int upload_dsp_code(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + const struct firmware *init_fw = NULL, *perm_fw = NULL; + int err; + + outb(HPBLKSEL_0, chip->io + HP_BLKS); + + err = request_firmware(&init_fw, INITCODEFILE, card->dev); + if (err < 0) { + printk(KERN_ERR LOGNAME ": Error loading " INITCODEFILE); + goto cleanup1; + } + err = request_firmware(&perm_fw, PERMCODEFILE, card->dev); + if (err < 0) { + printk(KERN_ERR LOGNAME ": Error loading " PERMCODEFILE); + goto cleanup; + } + + memcpy_toio(chip->mappedbase, perm_fw->data, perm_fw->size); + if (snd_msnd_upload_host(chip, init_fw->data, init_fw->size) < 0) { + printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n"); + err = -ENODEV; + goto cleanup; + } + printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n"); + err = 0; + +cleanup: + release_firmware(perm_fw); +cleanup1: + release_firmware(init_fw); + return err; +} + +#ifdef MSND_CLASSIC +static void reset_proteus(struct snd_msnd *chip) +{ + outb(HPPRORESET_ON, chip->io + HP_PROR); + msleep(TIME_PRO_RESET); + outb(HPPRORESET_OFF, chip->io + HP_PROR); + msleep(TIME_PRO_RESET_DONE); +} +#endif + +static int snd_msnd_initialize(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + int err, timeout; + +#ifdef MSND_CLASSIC + outb(HPWAITSTATE_0, chip->io + HP_WAIT); + outb(HPBITMODE_16, chip->io + HP_BITM); + + reset_proteus(chip); +#endif + err = snd_msnd_init_sma(chip); + if (err < 0) { + printk(KERN_WARNING LOGNAME ": Cannot initialize SMA\n"); + return err; + } + + err = snd_msnd_reset_dsp(chip->io, NULL); + if (err < 0) + return err; + + err = upload_dsp_code(card); + if (err < 0) { + printk(KERN_WARNING LOGNAME ": Cannot upload DSP code\n"); + return err; + } + + timeout = 200; + + while (readw(chip->mappedbase)) { + msleep(1); + if (!timeout--) { + snd_printd(KERN_ERR LOGNAME ": DSP reset timeout\n"); + return -EIO; + } + } + + snd_msndmix_setup(chip); + return 0; +} + +static int snd_msnd_dsp_full_reset(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + int rv; + + if (test_bit(F_RESETTING, &chip->flags) || ++chip->nresets > 10) + return 0; + + set_bit(F_RESETTING, &chip->flags); + snd_msnd_dsp_halt(chip, NULL); /* Unconditionally halt */ + + rv = snd_msnd_initialize(card); + if (rv) + printk(KERN_WARNING LOGNAME ": DSP reset failed\n"); + snd_msndmix_force_recsrc(chip, 0); + clear_bit(F_RESETTING, &chip->flags); + return rv; +} + +static int snd_msnd_dev_free(struct snd_device *device) +{ + snd_printdd("snd_msnd_chip_free()\n"); + return 0; +} + +static int snd_msnd_send_dsp_cmd_chk(struct snd_msnd *chip, u8 cmd) +{ + if (snd_msnd_send_dsp_cmd(chip, cmd) == 0) + return 0; + snd_msnd_dsp_full_reset(chip->card); + return snd_msnd_send_dsp_cmd(chip, cmd); +} + +static int __devinit snd_msnd_calibrate_adc(struct snd_msnd *chip, u16 srate) +{ + snd_printdd("snd_msnd_calibrate_adc(%i)\n", srate); + writew(srate, chip->SMA + SMA_wCalFreqAtoD); + if (chip->calibrate_signal == 0) + writew(readw(chip->SMA + SMA_wCurrHostStatusFlags) + | 0x0001, chip->SMA + SMA_wCurrHostStatusFlags); + else + writew(readw(chip->SMA + SMA_wCurrHostStatusFlags) + & ~0x0001, chip->SMA + SMA_wCurrHostStatusFlags); + if (snd_msnd_send_word(chip, 0, 0, HDEXAR_CAL_A_TO_D) == 0 && + snd_msnd_send_dsp_cmd_chk(chip, HDEX_AUX_REQ) == 0) { + schedule_timeout_interruptible(msecs_to_jiffies(333)); + return 0; + } + printk(KERN_WARNING LOGNAME ": ADC calibration failed\n"); + return -EIO; +} + +/* + * ALSA callback function, called when attempting to open the MIDI device. + */ +static int snd_msnd_mpu401_open(struct snd_mpu401 *mpu) +{ + snd_msnd_enable_irq(mpu->private_data); + snd_msnd_send_dsp_cmd(mpu->private_data, HDEX_MIDI_IN_START); + return 0; +} + +static void snd_msnd_mpu401_close(struct snd_mpu401 *mpu) +{ + snd_msnd_send_dsp_cmd(mpu->private_data, HDEX_MIDI_IN_STOP); + snd_msnd_disable_irq(mpu->private_data); +} + +static long mpu_io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; + +static int __devinit snd_msnd_attach(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + int err; + static struct snd_device_ops ops = { + .dev_free = snd_msnd_dev_free, + }; + + err = request_irq(chip->irq, snd_msnd_interrupt, 0, card->shortname, + chip); + if (err < 0) { + printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", chip->irq); + return err; + } + request_region(chip->io, DSP_NUMIO, card->shortname); + + if (!request_mem_region(chip->base, BUFFSIZE, card->shortname)) { + printk(KERN_ERR LOGNAME + ": unable to grab memory region 0x%lx-0x%lx\n", + chip->base, chip->base + BUFFSIZE - 1); + release_region(chip->io, DSP_NUMIO); + free_irq(chip->irq, chip); + return -EBUSY; + } + chip->mappedbase = ioremap_nocache(chip->base, 0x8000); + if (!chip->mappedbase) { + printk(KERN_ERR LOGNAME + ": unable to map memory region 0x%lx-0x%lx\n", + chip->base, chip->base + BUFFSIZE - 1); + err = -EIO; + goto err_release_region; + } + + err = snd_msnd_dsp_full_reset(card); + if (err < 0) + goto err_release_region; + + /* Register device */ + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); + if (err < 0) + goto err_release_region; + + err = snd_msnd_pcm(card, 0, NULL); + if (err < 0) { + printk(KERN_ERR LOGNAME ": error creating new PCM device\n"); + goto err_release_region; + } + + err = snd_msndmix_new(card); + if (err < 0) { + printk(KERN_ERR LOGNAME ": error creating new Mixer device\n"); + goto err_release_region; + } + + + if (mpu_io[0] != SNDRV_AUTO_PORT) { + struct snd_mpu401 *mpu; + + err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, + mpu_io[0], + MPU401_MODE_INPUT | + MPU401_MODE_OUTPUT, + mpu_irq[0], IRQF_DISABLED, + &chip->rmidi); + if (err < 0) { + printk(KERN_ERR LOGNAME + ": error creating new Midi device\n"); + goto err_release_region; + } + mpu = chip->rmidi->private_data; + + mpu->open_input = snd_msnd_mpu401_open; + mpu->close_input = snd_msnd_mpu401_close; + mpu->private_data = chip; + } + + disable_irq(chip->irq); + snd_msnd_calibrate_adc(chip, chip->play_sample_rate); + snd_msndmix_force_recsrc(chip, 0); + + err = snd_card_register(card); + if (err < 0) + goto err_release_region; + + return 0; + +err_release_region: + if (chip->mappedbase) + iounmap(chip->mappedbase); + release_mem_region(chip->base, BUFFSIZE); + release_region(chip->io, DSP_NUMIO); + free_irq(chip->irq, chip); + return err; +} + + +static void __devexit snd_msnd_unload(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + + iounmap(chip->mappedbase); + release_mem_region(chip->base, BUFFSIZE); + release_region(chip->io, DSP_NUMIO); + free_irq(chip->irq, chip); + snd_card_free(card); +} + +#ifndef MSND_CLASSIC + +/* Pinnacle/Fiji Logical Device Configuration */ + +static int __devinit snd_msnd_write_cfg(int cfg, int reg, int value) +{ + outb(reg, cfg); + outb(value, cfg + 1); + if (value != inb(cfg + 1)) { + printk(KERN_ERR LOGNAME ": snd_msnd_write_cfg: I/O error\n"); + return -EIO; + } + return 0; +} + +static int __devinit snd_msnd_write_cfg_io0(int cfg, int num, u16 io) +{ + if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io))) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io))) + return -EIO; + return 0; +} + +static int __devinit snd_msnd_write_cfg_io1(int cfg, int num, u16 io) +{ + if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io))) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io))) + return -EIO; + return 0; +} + +static int __devinit snd_msnd_write_cfg_irq(int cfg, int num, u16 irq) +{ + if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_IRQ_NUMBER, LOBYTE(irq))) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_IRQ_TYPE, IRQTYPE_EDGE)) + return -EIO; + return 0; +} + +static int __devinit snd_msnd_write_cfg_mem(int cfg, int num, int mem) +{ + u16 wmem; + + mem >>= 8; + wmem = (u16)(mem & 0xfff); + if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_MEMBASEHI, HIBYTE(wmem))) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_MEMBASELO, LOBYTE(wmem))) + return -EIO; + if (wmem && snd_msnd_write_cfg(cfg, IREG_MEMCONTROL, + MEMTYPE_HIADDR | MEMTYPE_16BIT)) + return -EIO; + return 0; +} + +static int __devinit snd_msnd_activate_logical(int cfg, int num) +{ + if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) + return -EIO; + if (snd_msnd_write_cfg(cfg, IREG_ACTIVATE, LD_ACTIVATE)) + return -EIO; + return 0; +} + +static int __devinit snd_msnd_write_cfg_logical(int cfg, int num, u16 io0, + u16 io1, u16 irq, int mem) +{ + if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) + return -EIO; + if (snd_msnd_write_cfg_io0(cfg, num, io0)) + return -EIO; + if (snd_msnd_write_cfg_io1(cfg, num, io1)) + return -EIO; + if (snd_msnd_write_cfg_irq(cfg, num, irq)) + return -EIO; + if (snd_msnd_write_cfg_mem(cfg, num, mem)) + return -EIO; + if (snd_msnd_activate_logical(cfg, num)) + return -EIO; + return 0; +} + +static int __devinit snd_msnd_pinnacle_cfg_reset(int cfg) +{ + int i; + + /* Reset devices if told to */ + printk(KERN_INFO LOGNAME ": Resetting all devices\n"); + for (i = 0; i < 4; ++i) + if (snd_msnd_write_cfg_logical(cfg, i, 0, 0, 0, 0)) + return -EIO; + + return 0; +} +#endif + +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ + +module_param_array(index, int, NULL, S_IRUGO); +MODULE_PARM_DESC(index, "Index value for msnd_pinnacle soundcard."); +module_param_array(id, charp, NULL, S_IRUGO); +MODULE_PARM_DESC(id, "ID string for msnd_pinnacle soundcard."); + +static long io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; +static long mem[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; + +static long cfg[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; + +#ifndef MSND_CLASSIC +/* Extra Peripheral Configuration (Default: Disable) */ +static long ide_io0[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long ide_io1[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int ide_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; + +static long joystick_io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +/* If we have the digital daugherboard... */ +static int digital[SNDRV_CARDS]; + +/* Extra Peripheral Configuration */ +static int reset[SNDRV_CARDS]; +#endif + +static int write_ndelay[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 }; + +static int calibrate_signal; + +#ifdef CONFIG_PNP +static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +module_param_array(isapnp, bool, NULL, 0444); +MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); +#endif + +MODULE_AUTHOR("Karsten Wiese "); +MODULE_DESCRIPTION("Turtle Beach " LONGNAME " Linux Driver"); +MODULE_LICENSE("GPL"); +MODULE_FIRMWARE(INITCODEFILE); +MODULE_FIRMWARE(PERMCODEFILE); + +module_param_array(io, long, NULL, S_IRUGO); +MODULE_PARM_DESC(io, "IO port #"); +module_param_array(irq, int, NULL, S_IRUGO); +module_param_array(mem, long, NULL, S_IRUGO); +module_param_array(write_ndelay, int, NULL, S_IRUGO); +module_param(calibrate_signal, int, S_IRUGO); +#ifndef MSND_CLASSIC +module_param_array(digital, int, NULL, S_IRUGO); +module_param_array(cfg, long, NULL, S_IRUGO); +module_param_array(reset, int, 0, S_IRUGO); +module_param_array(mpu_io, long, NULL, S_IRUGO); +module_param_array(mpu_irq, int, NULL, S_IRUGO); +module_param_array(ide_io0, long, NULL, S_IRUGO); +module_param_array(ide_io1, long, NULL, S_IRUGO); +module_param_array(ide_irq, int, NULL, S_IRUGO); +module_param_array(joystick_io, long, NULL, S_IRUGO); +#endif + + +static int __devinit snd_msnd_isa_match(struct device *pdev, unsigned int i) +{ + if (io[i] == SNDRV_AUTO_PORT) + return 0; + + if (irq[i] == SNDRV_AUTO_PORT || mem[i] == SNDRV_AUTO_PORT) { + printk(KERN_WARNING LOGNAME ": io, irq and mem must be set\n"); + return 0; + } + +#ifdef MSND_CLASSIC + if (!(io[i] == 0x290 || + io[i] == 0x260 || + io[i] == 0x250 || + io[i] == 0x240 || + io[i] == 0x230 || + io[i] == 0x220 || + io[i] == 0x210 || + io[i] == 0x3e0)) { + printk(KERN_ERR LOGNAME ": \"io\" - DSP I/O base must be set " + " to 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x290, " + "or 0x3E0\n"); + return 0; + } +#else + if (io[i] < 0x100 || io[i] > 0x3e0 || (io[i] % 0x10) != 0) { + printk(KERN_ERR LOGNAME + ": \"io\" - DSP I/O base must within the range 0x100 " + "to 0x3E0 and must be evenly divisible by 0x10\n"); + return 0; + } +#endif /* MSND_CLASSIC */ + + if (!(irq[i] == 5 || + irq[i] == 7 || + irq[i] == 9 || + irq[i] == 10 || + irq[i] == 11 || + irq[i] == 12)) { + printk(KERN_ERR LOGNAME + ": \"irq\" - must be set to 5, 7, 9, 10, 11 or 12\n"); + return 0; + } + + if (!(mem[i] == 0xb0000 || + mem[i] == 0xc8000 || + mem[i] == 0xd0000 || + mem[i] == 0xd8000 || + mem[i] == 0xe0000 || + mem[i] == 0xe8000)) { + printk(KERN_ERR LOGNAME ": \"mem\" - must be set to " + "0xb0000, 0xc8000, 0xd0000, 0xd8000, 0xe0000 or " + "0xe8000\n"); + return 0; + } + +#ifndef MSND_CLASSIC + if (cfg[i] == SNDRV_AUTO_PORT) { + printk(KERN_INFO LOGNAME ": Assuming PnP mode\n"); + } else if (cfg[i] != 0x250 && cfg[i] != 0x260 && cfg[i] != 0x270) { + printk(KERN_INFO LOGNAME + ": Config port must be 0x250, 0x260 or 0x270 " + "(or unspecified for PnP mode)\n"); + return 0; + } +#endif /* MSND_CLASSIC */ + + return 1; +} + +static int __devinit snd_msnd_isa_probe(struct device *pdev, unsigned int idx) +{ + int err; + struct snd_card *card; + struct snd_msnd *chip; + + if (isapnp[idx] || cfg[idx] == SNDRV_AUTO_PORT) { + printk(KERN_INFO LOGNAME ": Assuming PnP mode\n"); + return -ENODEV; + } + + err = snd_card_create(index[idx], id[idx], THIS_MODULE, + sizeof(struct snd_msnd), &card); + if (err < 0) + return err; + + snd_card_set_dev(card, pdev); + chip = card->private_data; + chip->card = card; + +#ifdef MSND_CLASSIC + switch (irq[idx]) { + case 5: + chip->irqid = HPIRQ_5; break; + case 7: + chip->irqid = HPIRQ_7; break; + case 9: + chip->irqid = HPIRQ_9; break; + case 10: + chip->irqid = HPIRQ_10; break; + case 11: + chip->irqid = HPIRQ_11; break; + case 12: + chip->irqid = HPIRQ_12; break; + } + + switch (mem[idx]) { + case 0xb0000: + chip->memid = HPMEM_B000; break; + case 0xc8000: + chip->memid = HPMEM_C800; break; + case 0xd0000: + chip->memid = HPMEM_D000; break; + case 0xd8000: + chip->memid = HPMEM_D800; break; + case 0xe0000: + chip->memid = HPMEM_E000; break; + case 0xe8000: + chip->memid = HPMEM_E800; break; + } +#else + printk(KERN_INFO LOGNAME ": Non-PnP mode: configuring at port 0x%lx\n", + cfg[idx]); + + if (!request_region(cfg[idx], 2, "Pinnacle/Fiji Config")) { + printk(KERN_ERR LOGNAME ": Config port 0x%lx conflict\n", + cfg[idx]); + snd_card_free(card); + return -EIO; + } + if (reset[idx]) + if (snd_msnd_pinnacle_cfg_reset(cfg[idx])) { + err = -EIO; + goto cfg_error; + } + + /* DSP */ + err = snd_msnd_write_cfg_logical(cfg[idx], 0, + io[idx], 0, + irq[idx], mem[idx]); + + if (err) + goto cfg_error; + + /* The following are Pinnacle specific */ + + /* MPU */ + if (mpu_io[idx] != SNDRV_AUTO_PORT + && mpu_irq[idx] != SNDRV_AUTO_IRQ) { + printk(KERN_INFO LOGNAME + ": Configuring MPU to I/O 0x%lx IRQ %d\n", + mpu_io[idx], mpu_irq[idx]); + err = snd_msnd_write_cfg_logical(cfg[idx], 1, + mpu_io[idx], 0, + mpu_irq[idx], 0); + + if (err) + goto cfg_error; + } + + /* IDE */ + if (ide_io0[idx] != SNDRV_AUTO_PORT + && ide_io1[idx] != SNDRV_AUTO_PORT + && ide_irq[idx] != SNDRV_AUTO_IRQ) { + printk(KERN_INFO LOGNAME + ": Configuring IDE to I/O 0x%lx, 0x%lx IRQ %d\n", + ide_io0[idx], ide_io1[idx], ide_irq[idx]); + err = snd_msnd_write_cfg_logical(cfg[idx], 2, + ide_io0[idx], ide_io1[idx], + ide_irq[idx], 0); + + if (err) + goto cfg_error; + } + + /* Joystick */ + if (joystick_io[idx] != SNDRV_AUTO_PORT) { + printk(KERN_INFO LOGNAME + ": Configuring joystick to I/O 0x%lx\n", + joystick_io[idx]); + err = snd_msnd_write_cfg_logical(cfg[idx], 3, + joystick_io[idx], 0, + 0, 0); + + if (err) + goto cfg_error; + } + release_region(cfg[idx], 2); + +#endif /* MSND_CLASSIC */ + + set_default_audio_parameters(chip); +#ifdef MSND_CLASSIC + chip->type = msndClassic; +#else + chip->type = msndPinnacle; +#endif + chip->io = io[idx]; + chip->irq = irq[idx]; + chip->base = mem[idx]; + + chip->calibrate_signal = calibrate_signal ? 1 : 0; + chip->recsrc = 0; + chip->dspq_data_buff = DSPQ_DATA_BUFF; + chip->dspq_buff_size = DSPQ_BUFF_SIZE; + if (write_ndelay[idx]) + clear_bit(F_DISABLE_WRITE_NDELAY, &chip->flags); + else + set_bit(F_DISABLE_WRITE_NDELAY, &chip->flags); +#ifndef MSND_CLASSIC + if (digital[idx]) + set_bit(F_HAVEDIGITAL, &chip->flags); +#endif + spin_lock_init(&chip->lock); + err = snd_msnd_probe(card); + if (err < 0) { + printk(KERN_ERR LOGNAME ": Probe failed\n"); + snd_card_free(card); + return err; + } + + err = snd_msnd_attach(card); + if (err < 0) { + printk(KERN_ERR LOGNAME ": Attach failed\n"); + snd_card_free(card); + return err; + } + dev_set_drvdata(pdev, card); + + return 0; + +#ifndef MSND_CLASSIC +cfg_error: + release_region(cfg[idx], 2); + snd_card_free(card); + return err; +#endif +} + +static int __devexit snd_msnd_isa_remove(struct device *pdev, unsigned int dev) +{ + snd_msnd_unload(dev_get_drvdata(pdev)); + dev_set_drvdata(pdev, NULL); + return 0; +} + +#define DEV_NAME "msnd-pinnacle" + +static struct isa_driver snd_msnd_driver = { + .match = snd_msnd_isa_match, + .probe = snd_msnd_isa_probe, + .remove = __devexit_p(snd_msnd_isa_remove), + /* FIXME: suspend, resume */ + .driver = { + .name = DEV_NAME + }, +}; + +#ifdef CONFIG_PNP +static int __devinit snd_msnd_pnp_detect(struct pnp_card_link *pcard, + const struct pnp_card_device_id *pid) +{ + static int idx; + struct pnp_dev *pnp_dev; + struct pnp_dev *mpu_dev; + struct snd_card *card; + struct snd_msnd *chip; + int ret; + + for ( ; idx < SNDRV_CARDS; idx++) { + if (isapnp[idx]) + break; + } + if (idx >= SNDRV_CARDS) + return -ENODEV; + + /* + * Check that we still have room for another sound card ... + */ + pnp_dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); + if (!pnp_dev) + return -ENODEV; + + mpu_dev = pnp_request_card_device(pcard, pid->devs[1].id, NULL); + if (!mpu_dev) + return -ENODEV; + + if (!pnp_is_active(pnp_dev) && pnp_activate_dev(pnp_dev) < 0) { + printk(KERN_INFO "msnd_pinnacle: device is inactive\n"); + return -EBUSY; + } + + if (!pnp_is_active(mpu_dev) && pnp_activate_dev(mpu_dev) < 0) { + printk(KERN_INFO "msnd_pinnacle: MPU device is inactive\n"); + return -EBUSY; + } + + /* + * Create a new ALSA sound card entry, in anticipation + * of detecting our hardware ... + */ + ret = snd_card_create(index[idx], id[idx], THIS_MODULE, + sizeof(struct snd_msnd), &card); + if (ret < 0) + return ret; + + chip = card->private_data; + chip->card = card; + snd_card_set_dev(card, &pcard->card->dev); + + /* + * Read the correct parameters off the ISA PnP bus ... + */ + io[idx] = pnp_port_start(pnp_dev, 0); + irq[idx] = pnp_irq(pnp_dev, 0); + mem[idx] = pnp_mem_start(pnp_dev, 0); + mpu_io[idx] = pnp_port_start(mpu_dev, 0); + mpu_irq[idx] = pnp_irq(mpu_dev, 0); + + set_default_audio_parameters(chip); +#ifdef MSND_CLASSIC + chip->type = msndClassic; +#else + chip->type = msndPinnacle; +#endif + chip->io = io[idx]; + chip->irq = irq[idx]; + chip->base = mem[idx]; + + chip->calibrate_signal = calibrate_signal ? 1 : 0; + chip->recsrc = 0; + chip->dspq_data_buff = DSPQ_DATA_BUFF; + chip->dspq_buff_size = DSPQ_BUFF_SIZE; + if (write_ndelay[idx]) + clear_bit(F_DISABLE_WRITE_NDELAY, &chip->flags); + else + set_bit(F_DISABLE_WRITE_NDELAY, &chip->flags); +#ifndef MSND_CLASSIC + if (digital[idx]) + set_bit(F_HAVEDIGITAL, &chip->flags); +#endif + spin_lock_init(&chip->lock); + ret = snd_msnd_probe(card); + if (ret < 0) { + printk(KERN_ERR LOGNAME ": Probe failed\n"); + goto _release_card; + } + + ret = snd_msnd_attach(card); + if (ret < 0) { + printk(KERN_ERR LOGNAME ": Attach failed\n"); + goto _release_card; + } + + pnp_set_card_drvdata(pcard, card); + ++idx; + return 0; + +_release_card: + snd_card_free(card); + return ret; +} + +static void __devexit snd_msnd_pnp_remove(struct pnp_card_link *pcard) +{ + snd_msnd_unload(pnp_get_card_drvdata(pcard)); + pnp_set_card_drvdata(pcard, NULL); +} + +static int isa_registered; +static int pnp_registered; + +static struct pnp_card_device_id msnd_pnpids[] = { + /* Pinnacle PnP */ + { .id = "BVJ0440", .devs = { { "TBS0000" }, { "TBS0001" } } }, + { .id = "" } /* end */ +}; + +MODULE_DEVICE_TABLE(pnp_card, msnd_pnpids); + +static struct pnp_card_driver msnd_pnpc_driver = { + .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, + .name = "msnd_pinnacle", + .id_table = msnd_pnpids, + .probe = snd_msnd_pnp_detect, + .remove = __devexit_p(snd_msnd_pnp_remove), +}; +#endif /* CONFIG_PNP */ + +static int __init snd_msnd_init(void) +{ + int err; + + err = isa_register_driver(&snd_msnd_driver, SNDRV_CARDS); +#ifdef CONFIG_PNP + if (!err) + isa_registered = 1; + + err = pnp_register_card_driver(&msnd_pnpc_driver); + if (!err) + pnp_registered = 1; + + if (isa_registered) + err = 0; +#endif + return err; +} + +static void __exit snd_msnd_exit(void) +{ +#ifdef CONFIG_PNP + if (pnp_registered) + pnp_unregister_card_driver(&msnd_pnpc_driver); + if (isa_registered) +#endif + isa_unregister_driver(&snd_msnd_driver); +} + +module_init(snd_msnd_init); +module_exit(snd_msnd_exit); + diff --git a/sound/isa/msnd/msnd_pinnacle.h b/sound/isa/msnd/msnd_pinnacle.h new file mode 100644 index 000000000000..48318d1ee340 --- /dev/null +++ b/sound/isa/msnd/msnd_pinnacle.h @@ -0,0 +1,181 @@ +/********************************************************************* + * + * msnd_pinnacle.h + * + * Turtle Beach MultiSound Sound Card Driver for Linux + * + * Some parts of this header file were derived from the Turtle Beach + * MultiSound Driver Development Kit. + * + * Copyright (C) 1998 Andrew Veliath + * Copyright (C) 1993 Turtle Beach Systems, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + ********************************************************************/ +#ifndef __MSND_PINNACLE_H +#define __MSND_PINNACLE_H + +#define DSP_NUMIO 0x08 + +#define IREG_LOGDEVICE 0x07 +#define IREG_ACTIVATE 0x30 +#define LD_ACTIVATE 0x01 +#define LD_DISACTIVATE 0x00 +#define IREG_EECONTROL 0x3F +#define IREG_MEMBASEHI 0x40 +#define IREG_MEMBASELO 0x41 +#define IREG_MEMCONTROL 0x42 +#define IREG_MEMRANGEHI 0x43 +#define IREG_MEMRANGELO 0x44 +#define MEMTYPE_8BIT 0x00 +#define MEMTYPE_16BIT 0x02 +#define MEMTYPE_RANGE 0x00 +#define MEMTYPE_HIADDR 0x01 +#define IREG_IO0_BASEHI 0x60 +#define IREG_IO0_BASELO 0x61 +#define IREG_IO1_BASEHI 0x62 +#define IREG_IO1_BASELO 0x63 +#define IREG_IRQ_NUMBER 0x70 +#define IREG_IRQ_TYPE 0x71 +#define IRQTYPE_HIGH 0x02 +#define IRQTYPE_LOW 0x00 +#define IRQTYPE_LEVEL 0x01 +#define IRQTYPE_EDGE 0x00 + +#define HP_DSPR 0x04 +#define HP_BLKS 0x04 + +#define HPDSPRESET_OFF 2 +#define HPDSPRESET_ON 0 + +#define HPBLKSEL_0 2 +#define HPBLKSEL_1 3 + +#define HIMT_DAT_OFF 0x03 + +#define HIDSP_PLAY_UNDER 0x00 +#define HIDSP_INT_PLAY_UNDER 0x01 +#define HIDSP_SSI_TX_UNDER 0x02 +#define HIDSP_RECQ_OVERFLOW 0x08 +#define HIDSP_INT_RECORD_OVER 0x09 +#define HIDSP_SSI_RX_OVERFLOW 0x0a + +#define HIDSP_MIDI_IN_OVER 0x10 + +#define HIDSP_MIDI_FRAME_ERR 0x11 +#define HIDSP_MIDI_PARITY_ERR 0x12 +#define HIDSP_MIDI_OVERRUN_ERR 0x13 + +#define HIDSP_INPUT_CLIPPING 0x20 +#define HIDSP_MIX_CLIPPING 0x30 +#define HIDSP_DAT_IN_OFF 0x21 + +#define TIME_PRO_RESET_DONE 0x028A +#define TIME_PRO_SYSEX 0x001E +#define TIME_PRO_RESET 0x0032 + +#define DAR_BUFF_SIZE 0x1000 + +#define MIDQ_BUFF_SIZE 0x800 +#define DSPQ_BUFF_SIZE 0x5A0 + +#define DSPQ_DATA_BUFF 0x7860 + +#define MOP_WAVEHDR 0 +#define MOP_EXTOUT 1 +#define MOP_HWINIT 0xfe +#define MOP_NONE 0xff +#define MOP_MAX 1 + +#define MIP_EXTIN 0 +#define MIP_WAVEHDR 1 +#define MIP_HWINIT 0xfe +#define MIP_MAX 1 + +/* Pinnacle/Fiji SMA Common Data */ +#define SMA_wCurrPlayBytes 0x0000 +#define SMA_wCurrRecordBytes 0x0002 +#define SMA_wCurrPlayVolLeft 0x0004 +#define SMA_wCurrPlayVolRight 0x0006 +#define SMA_wCurrInVolLeft 0x0008 +#define SMA_wCurrInVolRight 0x000a +#define SMA_wCurrMHdrVolLeft 0x000c +#define SMA_wCurrMHdrVolRight 0x000e +#define SMA_dwCurrPlayPitch 0x0010 +#define SMA_dwCurrPlayRate 0x0014 +#define SMA_wCurrMIDIIOPatch 0x0018 +#define SMA_wCurrPlayFormat 0x001a +#define SMA_wCurrPlaySampleSize 0x001c +#define SMA_wCurrPlayChannels 0x001e +#define SMA_wCurrPlaySampleRate 0x0020 +#define SMA_wCurrRecordFormat 0x0022 +#define SMA_wCurrRecordSampleSize 0x0024 +#define SMA_wCurrRecordChannels 0x0026 +#define SMA_wCurrRecordSampleRate 0x0028 +#define SMA_wCurrDSPStatusFlags 0x002a +#define SMA_wCurrHostStatusFlags 0x002c +#define SMA_wCurrInputTagBits 0x002e +#define SMA_wCurrLeftPeak 0x0030 +#define SMA_wCurrRightPeak 0x0032 +#define SMA_bMicPotPosLeft 0x0034 +#define SMA_bMicPotPosRight 0x0035 +#define SMA_bMicPotMaxLeft 0x0036 +#define SMA_bMicPotMaxRight 0x0037 +#define SMA_bInPotPosLeft 0x0038 +#define SMA_bInPotPosRight 0x0039 +#define SMA_bAuxPotPosLeft 0x003a +#define SMA_bAuxPotPosRight 0x003b +#define SMA_bInPotMaxLeft 0x003c +#define SMA_bInPotMaxRight 0x003d +#define SMA_bAuxPotMaxLeft 0x003e +#define SMA_bAuxPotMaxRight 0x003f +#define SMA_bInPotMaxMethod 0x0040 +#define SMA_bAuxPotMaxMethod 0x0041 +#define SMA_wCurrMastVolLeft 0x0042 +#define SMA_wCurrMastVolRight 0x0044 +#define SMA_wCalFreqAtoD 0x0046 +#define SMA_wCurrAuxVolLeft 0x0048 +#define SMA_wCurrAuxVolRight 0x004a +#define SMA_wCurrPlay1VolLeft 0x004c +#define SMA_wCurrPlay1VolRight 0x004e +#define SMA_wCurrPlay2VolLeft 0x0050 +#define SMA_wCurrPlay2VolRight 0x0052 +#define SMA_wCurrPlay3VolLeft 0x0054 +#define SMA_wCurrPlay3VolRight 0x0056 +#define SMA_wCurrPlay4VolLeft 0x0058 +#define SMA_wCurrPlay4VolRight 0x005a +#define SMA_wCurrPlay1PeakLeft 0x005c +#define SMA_wCurrPlay1PeakRight 0x005e +#define SMA_wCurrPlay2PeakLeft 0x0060 +#define SMA_wCurrPlay2PeakRight 0x0062 +#define SMA_wCurrPlay3PeakLeft 0x0064 +#define SMA_wCurrPlay3PeakRight 0x0066 +#define SMA_wCurrPlay4PeakLeft 0x0068 +#define SMA_wCurrPlay4PeakRight 0x006a +#define SMA_wCurrPlayPeakLeft 0x006c +#define SMA_wCurrPlayPeakRight 0x006e +#define SMA_wCurrDATSR 0x0070 +#define SMA_wCurrDATRXCHNL 0x0072 +#define SMA_wCurrDATTXCHNL 0x0074 +#define SMA_wCurrDATRXRate 0x0076 +#define SMA_dwDSPPlayCount 0x0078 +#define SMA__size 0x007c + +#define INITCODEFILE "turtlebeach/pndspini.bin" +#define PERMCODEFILE "turtlebeach/pndsperm.bin" +#define LONGNAME "MultiSound (Pinnacle/Fiji)" + +#endif /* __MSND_PINNACLE_H */ diff --git a/sound/isa/msnd/msnd_pinnacle_mixer.c b/sound/isa/msnd/msnd_pinnacle_mixer.c new file mode 100644 index 000000000000..494058a1a502 --- /dev/null +++ b/sound/isa/msnd/msnd_pinnacle_mixer.c @@ -0,0 +1,343 @@ +/*************************************************************************** + msnd_pinnacle_mixer.c - description + ------------------- + begin : Fre Jun 7 2002 + copyright : (C) 2002 by karsten wiese + email : annabellesgarden@yahoo.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include + +#include +#include +#include "msnd.h" +#include "msnd_pinnacle.h" + + +#define MSND_MIXER_VOLUME 0 +#define MSND_MIXER_PCM 1 +#define MSND_MIXER_AUX 2 /* Input source 1 (aux1) */ +#define MSND_MIXER_IMIX 3 /* Recording monitor */ +#define MSND_MIXER_SYNTH 4 +#define MSND_MIXER_SPEAKER 5 +#define MSND_MIXER_LINE 6 +#define MSND_MIXER_MIC 7 +#define MSND_MIXER_RECLEV 11 /* Recording level */ +#define MSND_MIXER_IGAIN 12 /* Input gain */ +#define MSND_MIXER_OGAIN 13 /* Output gain */ +#define MSND_MIXER_DIGITAL 17 /* Digital (input) 1 */ + +/* Device mask bits */ + +#define MSND_MASK_VOLUME (1 << MSND_MIXER_VOLUME) +#define MSND_MASK_SYNTH (1 << MSND_MIXER_SYNTH) +#define MSND_MASK_PCM (1 << MSND_MIXER_PCM) +#define MSND_MASK_SPEAKER (1 << MSND_MIXER_SPEAKER) +#define MSND_MASK_LINE (1 << MSND_MIXER_LINE) +#define MSND_MASK_MIC (1 << MSND_MIXER_MIC) +#define MSND_MASK_IMIX (1 << MSND_MIXER_IMIX) +#define MSND_MASK_RECLEV (1 << MSND_MIXER_RECLEV) +#define MSND_MASK_IGAIN (1 << MSND_MIXER_IGAIN) +#define MSND_MASK_OGAIN (1 << MSND_MIXER_OGAIN) +#define MSND_MASK_AUX (1 << MSND_MIXER_AUX) +#define MSND_MASK_DIGITAL (1 << MSND_MIXER_DIGITAL) + +static int snd_msndmix_info_mux(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + static char *texts[3] = { + "Analog", "MASS", "SPDIF", + }; + struct snd_msnd *chip = snd_kcontrol_chip(kcontrol); + unsigned items = test_bit(F_HAVEDIGITAL, &chip->flags) ? 3 : 2; + + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; + uinfo->count = 1; + uinfo->value.enumerated.items = items; + if (uinfo->value.enumerated.item >= items) + uinfo->value.enumerated.item = items - 1; + strcpy(uinfo->value.enumerated.name, + texts[uinfo->value.enumerated.item]); + return 0; +} + +static int snd_msndmix_get_mux(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_msnd *chip = snd_kcontrol_chip(kcontrol); + /* MSND_MASK_IMIX is the default */ + ucontrol->value.enumerated.item[0] = 0; + + if (chip->recsrc & MSND_MASK_SYNTH) { + ucontrol->value.enumerated.item[0] = 1; + } else if ((chip->recsrc & MSND_MASK_DIGITAL) && + test_bit(F_HAVEDIGITAL, &chip->flags)) { + ucontrol->value.enumerated.item[0] = 2; + } + + + return 0; +} + +static int snd_msndmix_set_mux(struct snd_msnd *chip, int val) +{ + unsigned newrecsrc; + int change; + unsigned char msndbyte; + + switch (val) { + case 0: + newrecsrc = MSND_MASK_IMIX; + msndbyte = HDEXAR_SET_ANA_IN; + break; + case 1: + newrecsrc = MSND_MASK_SYNTH; + msndbyte = HDEXAR_SET_SYNTH_IN; + break; + case 2: + newrecsrc = MSND_MASK_DIGITAL; + msndbyte = HDEXAR_SET_DAT_IN; + break; + default: + return -EINVAL; + } + change = newrecsrc != chip->recsrc; + if (change) { + change = 0; + if (!snd_msnd_send_word(chip, 0, 0, msndbyte)) + if (!snd_msnd_send_dsp_cmd(chip, HDEX_AUX_REQ)) { + chip->recsrc = newrecsrc; + change = 1; + } + } + return change; +} + +static int snd_msndmix_put_mux(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_msnd *msnd = snd_kcontrol_chip(kcontrol); + return snd_msndmix_set_mux(msnd, ucontrol->value.enumerated.item[0]); +} + + +static int snd_msndmix_volume_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 2; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 100; + return 0; +} + +static int snd_msndmix_volume_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_msnd *msnd = snd_kcontrol_chip(kcontrol); + int addr = kcontrol->private_value; + unsigned long flags; + + spin_lock_irqsave(&msnd->mixer_lock, flags); + ucontrol->value.integer.value[0] = msnd->left_levels[addr] * 100; + ucontrol->value.integer.value[0] /= 0xFFFF; + ucontrol->value.integer.value[1] = msnd->right_levels[addr] * 100; + ucontrol->value.integer.value[1] /= 0xFFFF; + spin_unlock_irqrestore(&msnd->mixer_lock, flags); + return 0; +} + +#define update_volm(a, b) \ + do { \ + writew((dev->left_levels[a] >> 1) * \ + readw(dev->SMA + SMA_wCurrMastVolLeft) / 0xffff, \ + dev->SMA + SMA_##b##Left); \ + writew((dev->right_levels[a] >> 1) * \ + readw(dev->SMA + SMA_wCurrMastVolRight) / 0xffff, \ + dev->SMA + SMA_##b##Right); \ + } while (0); + +#define update_potm(d, s, ar) \ + do { \ + writeb((dev->left_levels[d] >> 8) * \ + readw(dev->SMA + SMA_wCurrMastVolLeft) / 0xffff, \ + dev->SMA + SMA_##s##Left); \ + writeb((dev->right_levels[d] >> 8) * \ + readw(dev->SMA + SMA_wCurrMastVolRight) / 0xffff, \ + dev->SMA + SMA_##s##Right); \ + if (snd_msnd_send_word(dev, 0, 0, ar) == 0) \ + snd_msnd_send_dsp_cmd(dev, HDEX_AUX_REQ); \ + } while (0); + +#define update_pot(d, s, ar) \ + do { \ + writeb(dev->left_levels[d] >> 8, \ + dev->SMA + SMA_##s##Left); \ + writeb(dev->right_levels[d] >> 8, \ + dev->SMA + SMA_##s##Right); \ + if (snd_msnd_send_word(dev, 0, 0, ar) == 0) \ + snd_msnd_send_dsp_cmd(dev, HDEX_AUX_REQ); \ + } while (0); + + +static int snd_msndmix_set(struct snd_msnd *dev, int d, int left, int right) +{ + int bLeft, bRight; + int wLeft, wRight; + int updatemaster = 0; + + if (d >= LEVEL_ENTRIES) + return -EINVAL; + + bLeft = left * 0xff / 100; + wLeft = left * 0xffff / 100; + + bRight = right * 0xff / 100; + wRight = right * 0xffff / 100; + + dev->left_levels[d] = wLeft; + dev->right_levels[d] = wRight; + + switch (d) { + /* master volume unscaled controls */ + case MSND_MIXER_LINE: /* line pot control */ + /* scaled by IMIX in digital mix */ + writeb(bLeft, dev->SMA + SMA_bInPotPosLeft); + writeb(bRight, dev->SMA + SMA_bInPotPosRight); + if (snd_msnd_send_word(dev, 0, 0, HDEXAR_IN_SET_POTS) == 0) + snd_msnd_send_dsp_cmd(dev, HDEX_AUX_REQ); + break; + case MSND_MIXER_MIC: /* mic pot control */ + if (dev->type == msndClassic) + return -EINVAL; + /* scaled by IMIX in digital mix */ + writeb(bLeft, dev->SMA + SMA_bMicPotPosLeft); + writeb(bRight, dev->SMA + SMA_bMicPotPosRight); + if (snd_msnd_send_word(dev, 0, 0, HDEXAR_MIC_SET_POTS) == 0) + snd_msnd_send_dsp_cmd(dev, HDEX_AUX_REQ); + break; + case MSND_MIXER_VOLUME: /* master volume */ + writew(wLeft, dev->SMA + SMA_wCurrMastVolLeft); + writew(wRight, dev->SMA + SMA_wCurrMastVolRight); + /* fall through */ + + case MSND_MIXER_AUX: /* aux pot control */ + /* scaled by master volume */ + /* fall through */ + + /* digital controls */ + case MSND_MIXER_SYNTH: /* synth vol (dsp mix) */ + case MSND_MIXER_PCM: /* pcm vol (dsp mix) */ + case MSND_MIXER_IMIX: /* input monitor (dsp mix) */ + /* scaled by master volume */ + updatemaster = 1; + break; + + default: + return -EINVAL; + } + + if (updatemaster) { + /* update master volume scaled controls */ + update_volm(MSND_MIXER_PCM, wCurrPlayVol); + update_volm(MSND_MIXER_IMIX, wCurrInVol); + if (dev->type == msndPinnacle) + update_volm(MSND_MIXER_SYNTH, wCurrMHdrVol); + update_potm(MSND_MIXER_AUX, bAuxPotPos, HDEXAR_AUX_SET_POTS); + } + + return 0; +} + +static int snd_msndmix_volume_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_msnd *msnd = snd_kcontrol_chip(kcontrol); + int change, addr = kcontrol->private_value; + int left, right; + unsigned long flags; + + left = ucontrol->value.integer.value[0] % 101; + right = ucontrol->value.integer.value[1] % 101; + spin_lock_irqsave(&msnd->mixer_lock, flags); + change = msnd->left_levels[addr] != left + || msnd->right_levels[addr] != right; + snd_msndmix_set(msnd, addr, left, right); + spin_unlock_irqrestore(&msnd->mixer_lock, flags); + return change; +} + + +#define DUMMY_VOLUME(xname, xindex, addr) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ + .info = snd_msndmix_volume_info, \ + .get = snd_msndmix_volume_get, .put = snd_msndmix_volume_put, \ + .private_value = addr } + + +static struct snd_kcontrol_new snd_msnd_controls[] = { +DUMMY_VOLUME("Master Volume", 0, MSND_MIXER_VOLUME), +DUMMY_VOLUME("PCM Volume", 0, MSND_MIXER_PCM), +DUMMY_VOLUME("Aux Volume", 0, MSND_MIXER_AUX), +DUMMY_VOLUME("Line Volume", 0, MSND_MIXER_LINE), +DUMMY_VOLUME("Mic Volume", 0, MSND_MIXER_MIC), +DUMMY_VOLUME("Monitor", 0, MSND_MIXER_IMIX), +{ + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Capture Source", + .info = snd_msndmix_info_mux, + .get = snd_msndmix_get_mux, + .put = snd_msndmix_put_mux, +} +}; + + +int __devinit snd_msndmix_new(struct snd_card *card) +{ + struct snd_msnd *chip = card->private_data; + unsigned int idx; + int err; + + if (snd_BUG_ON(!chip)) + return -EINVAL; + spin_lock_init(&chip->mixer_lock); + strcpy(card->mixername, "MSND Pinnacle Mixer"); + + for (idx = 0; idx < ARRAY_SIZE(snd_msnd_controls); idx++) + err = snd_ctl_add(card, + snd_ctl_new1(snd_msnd_controls + idx, chip)); + if (err < 0) + return err; + + return 0; +} +EXPORT_SYMBOL(snd_msndmix_new); + +void snd_msndmix_setup(struct snd_msnd *dev) +{ + update_pot(MSND_MIXER_LINE, bInPotPos, HDEXAR_IN_SET_POTS); + update_potm(MSND_MIXER_AUX, bAuxPotPos, HDEXAR_AUX_SET_POTS); + update_volm(MSND_MIXER_PCM, wCurrPlayVol); + update_volm(MSND_MIXER_IMIX, wCurrInVol); + if (dev->type == msndPinnacle) { + update_pot(MSND_MIXER_MIC, bMicPotPos, HDEXAR_MIC_SET_POTS); + update_volm(MSND_MIXER_SYNTH, wCurrMHdrVol); + } +} +EXPORT_SYMBOL(snd_msndmix_setup); + +int snd_msndmix_force_recsrc(struct snd_msnd *dev, int recsrc) +{ + dev->recsrc = -1; + return snd_msndmix_set_mux(dev, recsrc); +} +EXPORT_SYMBOL(snd_msndmix_force_recsrc); -- cgit v1.2.3 From 2a88464ceb1bda2571f88902fd8068a6168e3f7b Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Wed, 28 Jan 2009 15:58:38 +1100 Subject: ALSA: hda - add another MacBook Pro 4, 1 subsystem ID Add another MacBook Pro 4,1 SSID (106b:3800). It seems that latter revisions, (at least mine), have different IDs to earlier revisions. Signed-off-by: Luke Yelavich Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5d249a547fbf..7884a4e07061 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7018,6 +7018,7 @@ static int patch_alc882(struct hda_codec *codec) case 0x106b00a4: /* MacbookPro4,1 */ case 0x106b2c00: /* Macbook Pro rev3 */ case 0x106b3600: /* Macbook 3.1 */ + case 0x106b3800: /* MacbookPro4,1 - latter revision */ board_config = ALC885_MBP3; break; default: -- cgit v1.2.3 From a5f7c47391ca15c3e2f8e2aa46fb089408541bcd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 28 Jan 2009 09:02:52 +0100 Subject: ALSA: enable build of snd-msnd-* drivers Added the missing msnd directory to Makefile. Signed-off-by: Takashi Iwai --- sound/isa/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/isa/Makefile b/sound/isa/Makefile index 63af13d901a5..b906b9a1a81e 100644 --- a/sound/isa/Makefile +++ b/sound/isa/Makefile @@ -26,5 +26,5 @@ obj-$(CONFIG_SND_SC6000) += snd-sc6000.o obj-$(CONFIG_SND_SGALAXY) += snd-sgalaxy.o obj-$(CONFIG_SND_SSCAPE) += snd-sscape.o -obj-$(CONFIG_SND) += ad1816a/ ad1848/ cs423x/ es1688/ gus/ opti9xx/ \ +obj-$(CONFIG_SND) += ad1816a/ ad1848/ cs423x/ es1688/ gus/ msnd/ opti9xx/ \ sb/ wavefront/ wss/ -- cgit v1.2.3 From e3e9c5e7096f6379ca8fa78413b2055fa29f4530 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Wed, 28 Jan 2009 12:40:42 -0200 Subject: ALSA: Don't cold reset AC97 codecs in some ICH chipsets Check in a quirk list if it should do cold reset when AC97 power saving is enabled. Some devices do not resume properly when cold reset, although power saving works OK. Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 68 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 19d3391e229f..b37bd268301f 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2287,23 +2287,23 @@ static void do_ali_reset(struct intel8x0 *chip) iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); } -static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) -{ - unsigned long end_time; - unsigned int cnt, status, nstatus; - - /* put logic to right state */ - /* first clear status bits */ - status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; - if (chip->device_type == DEVICE_NFORCE) - status |= ICH_NVSPINT; - cnt = igetdword(chip, ICHREG(GLOB_STA)); - iputdword(chip, ICHREG(GLOB_STA), cnt & status); +#ifdef CONFIG_SND_AC97_POWER_SAVE +static struct snd_pci_quirk ich_chip_reset_mode[] = { + SND_PCI_QUIRK(0x1014, 0x051f, "Thinkpad R32", 1), + { } /* end */ +}; +static int snd_intel8x0_ich_chip_cold_reset(struct intel8x0 *chip) +{ + unsigned int cnt; /* ACLink on, 2 channels */ + + if (snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) + return -EIO; + cnt = igetdword(chip, ICHREG(GLOB_CNT)); cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); -#ifdef CONFIG_SND_AC97_POWER_SAVE + /* do cold reset - the full ac97 powerdown may leave the controller * in a warm state but actually it cannot communicate with the codec. */ @@ -2312,22 +2312,58 @@ static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) udelay(10); iputdword(chip, ICHREG(GLOB_CNT), cnt | ICH_AC97COLD); msleep(1); + return 0; +} +#define snd_intel8x0_ich_chip_can_cold_reset(chip) \ + (!snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) #else +#define snd_intel8x0_ich_chip_cold_reset(x) do { } while (0) +#define snd_intel8x0_ich_chip_can_cold_reset(chip) (0) +#endif + +static int snd_intel8x0_ich_chip_reset(struct intel8x0 *chip) +{ + unsigned long end_time; + unsigned int cnt; + /* ACLink on, 2 channels */ + cnt = igetdword(chip, ICHREG(GLOB_CNT)); + cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); /* finish cold or do warm reset */ cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM; iputdword(chip, ICHREG(GLOB_CNT), cnt); end_time = (jiffies + (HZ / 4)) + 1; do { if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) - goto __ok; + return 0; schedule_timeout_uninterruptible(1); } while (time_after_eq(end_time, jiffies)); snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); return -EIO; +} + +static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) +{ + unsigned long end_time; + unsigned int status, nstatus; + unsigned int cnt; + int err; + + /* put logic to right state */ + /* first clear status bits */ + status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; + if (chip->device_type == DEVICE_NFORCE) + status |= ICH_NVSPINT; + cnt = igetdword(chip, ICHREG(GLOB_STA)); + iputdword(chip, ICHREG(GLOB_STA), cnt & status); + + if (snd_intel8x0_ich_chip_can_cold_reset(chip)) + err = snd_intel8x0_ich_chip_cold_reset(chip); + else + err = snd_intel8x0_ich_chip_reset(chip); + if (err < 0) + return err; - __ok: -#endif if (probing) { /* wait for any codec ready status. * Once it becomes ready it should remain ready -- cgit v1.2.3 From e167280070cccd2e0cde94f73ded0a4b08bf6412 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 28 Jan 2009 16:05:16 +0100 Subject: ALSA: intel8x0 - Fix build with CONFIG_SND_AC97_POWERSAVE=n Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index b37bd268301f..b13ef1e2a4a3 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2317,7 +2317,7 @@ static int snd_intel8x0_ich_chip_cold_reset(struct intel8x0 *chip) #define snd_intel8x0_ich_chip_can_cold_reset(chip) \ (!snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) #else -#define snd_intel8x0_ich_chip_cold_reset(x) do { } while (0) +#define snd_intel8x0_ich_chip_cold_reset(chip) 0 #define snd_intel8x0_ich_chip_can_cold_reset(chip) (0) #endif -- cgit v1.2.3 From 61b9b9b109217b2bfb128c3ca24d8f8c839a425f Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 28 Jan 2009 09:16:33 -0200 Subject: ALSA: hda - Consider additional capture source/selector in ALC889 Currently code for capture source support in ALC889 only considers capture mixers. This change adds additional support for ADC+selector present in ALC889, taking into account also the presence of an additional DMIC connection item in the selector. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 105 +++++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 863ab957204b..d81cb5eb8c5f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -238,6 +238,13 @@ enum { ALC883_MODEL_LAST, }; +/* styles of capture selection */ +enum { + CAPT_MUX = 0, /* only mux based */ + CAPT_MIX, /* only mixer based */ + CAPT_1MUX_MIX, /* first mux and other mixers */ +}; + /* for GPIO Poll */ #define GPIO_MASK 0x03 @@ -276,7 +283,7 @@ struct alc_spec { hda_nid_t *adc_nids; hda_nid_t *capsrc_nids; hda_nid_t dig_in_nid; /* digital-in NID; optional */ - unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ + int capture_style; /* capture style (CAPT_*) */ /* capture source */ unsigned int num_mux_defs; @@ -294,7 +301,7 @@ struct alc_spec { /* dynamic controls, init_verbs and input_mux */ struct auto_pin_cfg autocfg; struct snd_array kctls; - struct hda_input_mux private_imux; + struct hda_input_mux private_imux[3]; hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; /* hooks */ @@ -396,7 +403,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; imux = &spec->input_mux[mux_idx]; - if (spec->is_mix_capture) { + if (spec->capture_style && + !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { /* Matrix-mixer style (e.g. ALC882) */ unsigned int *cur_val = &spec->cur_mux[adc_idx]; unsigned int i, idx; @@ -4130,7 +4138,7 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) { - struct hda_input_mux *imux = &spec->private_imux; + struct hda_input_mux *imux = &spec->private_imux[0]; int i, err, idx; for (i = 0; i < AUTO_PIN_LAST; i++) { @@ -4279,7 +4287,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc880_volume_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; store_pin_configs(codec); return 1; @@ -5487,7 +5495,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) { - struct hda_input_mux *imux = &spec->private_imux; + struct hda_input_mux *imux = &spec->private_imux[0]; int i, err, idx; for (i = 0; i < AUTO_PIN_LAST; i++) { @@ -5647,7 +5655,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc260_volume_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; store_pin_configs(codec); return 1; @@ -7087,7 +7095,7 @@ static int patch_alc882(struct hda_codec *codec) spec->stream_digital_playback = &alc882_pcm_digital_playback; spec->stream_digital_capture = &alc882_pcm_digital_capture; - spec->is_mix_capture = 1; /* matrix-style capture */ + spec->capture_style = CAPT_MIX; /* matrix-style capture */ if (!spec->adc_nids && spec->input_mux) { /* check whether NID 0x07 is valid */ unsigned int wcap = get_wcaps(codec, 0x07); @@ -7155,10 +7163,14 @@ static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; +#define alc889_adc_nids alc880_adc_nids + static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; +#define alc889_capsrc_nids alc882_capsrc_nids + /* input MUX */ /* FIXME: should be a matrix-type input source selection */ @@ -8977,6 +8989,8 @@ static int alc883_parse_auto_config(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; int err = alc880_parse_auto_config(codec); + struct auto_pin_cfg *cfg = &spec->autocfg; + int i; if (err < 0) return err; @@ -8990,6 +9004,26 @@ static int alc883_parse_auto_config(struct hda_codec *codec) /* hack - override the init verbs */ spec->init_verbs[0] = alc883_auto_init_verbs; + /* setup input_mux for ALC889 */ + if (codec->vendor_id == 0x10ec0889) { + /* digital-mic input pin is excluded in alc880_auto_create..() + * because it's under 0x18 + */ + if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || + cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { + struct hda_input_mux *imux = &spec->private_imux[0]; + for (i = 1; i < 3; i++) + memcpy(&spec->private_imux[i], + &spec->private_imux[0], + sizeof(spec->private_imux[0])); + imux->items[imux->num_items].label = "Int DMic"; + imux->items[imux->num_items].index = 0x0b; + imux->num_items++; + spec->num_mux_defs = 3; + spec->input_mux = spec->private_imux; + } + } + return 1; /* config found */ } @@ -9053,14 +9087,36 @@ static int patch_alc883(struct hda_codec *codec) spec->stream_name_analog = "ALC888 Analog"; spec->stream_name_digital = "ALC888 Digital"; } + if (!spec->num_adc_nids) { + spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); + spec->adc_nids = alc883_adc_nids; + } + if (!spec->capsrc_nids) + spec->capsrc_nids = alc883_capsrc_nids; + spec->capture_style = CAPT_MIX; /* matrix-style capture */ break; case 0x10ec0889: spec->stream_name_analog = "ALC889 Analog"; spec->stream_name_digital = "ALC889 Digital"; + if (!spec->num_adc_nids) { + spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); + spec->adc_nids = alc889_adc_nids; + } + if (!spec->capsrc_nids) + spec->capsrc_nids = alc889_capsrc_nids; + spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style + capture */ break; default: spec->stream_name_analog = "ALC883 Analog"; spec->stream_name_digital = "ALC883 Digital"; + if (!spec->num_adc_nids) { + spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); + spec->adc_nids = alc883_adc_nids; + } + if (!spec->capsrc_nids) + spec->capsrc_nids = alc883_capsrc_nids; + spec->capture_style = CAPT_MIX; /* matrix-style capture */ break; } @@ -9071,13 +9127,6 @@ static int patch_alc883(struct hda_codec *codec) spec->stream_digital_playback = &alc883_pcm_digital_playback; spec->stream_digital_capture = &alc883_pcm_digital_capture; - if (!spec->num_adc_nids) { - spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); - spec->adc_nids = alc883_adc_nids; - } - if (!spec->capsrc_nids) - spec->capsrc_nids = alc883_capsrc_nids; - spec->is_mix_capture = 1; /* matrix-style capture */ if (!spec->cap_mixer) set_capture_mixer(spec); @@ -10512,7 +10561,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc262_volume_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; err = alc_auto_add_mic_boost(codec); if (err < 0) @@ -10881,7 +10930,7 @@ static int patch_alc262(struct hda_codec *codec) spec->stream_digital_playback = &alc262_pcm_digital_playback; spec->stream_digital_capture = &alc262_pcm_digital_capture; - spec->is_mix_capture = 1; + spec->capture_style = CAPT_MIX; if (!spec->adc_nids && spec->input_mux) { /* check whether NID 0x07 is valid */ unsigned int wcap = get_wcaps(codec, 0x07); @@ -11539,7 +11588,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) { - struct hda_input_mux *imux = &spec->private_imux; + struct hda_input_mux *imux = &spec->private_imux[0]; int i, idx1; for (i = 0; i < AUTO_PIN_LAST; i++) { @@ -11657,7 +11706,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc268_volume_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; err = alc_auto_add_mic_boost(codec); if (err < 0) @@ -12511,7 +12560,7 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, */ if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { - struct hda_input_mux *imux = &spec->private_imux; + struct hda_input_mux *imux = &spec->private_imux[0]; imux->items[imux->num_items].label = "Int Mic"; imux->items[imux->num_items].index = 0x05; imux->num_items++; @@ -12567,7 +12616,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc269_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; /* set default input source */ snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], 0, AC_VERB_SET_CONNECT_SEL, @@ -13483,7 +13532,7 @@ static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) { - struct hda_input_mux *imux = &spec->private_imux; + struct hda_input_mux *imux = &spec->private_imux[0]; int i, err, idx, idx1; for (i = 0; i < AUTO_PIN_LAST; i++) { @@ -13620,7 +13669,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc861_auto_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; spec->adc_nids = alc861_adc_nids; spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); @@ -14724,7 +14773,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) add_verb(spec, alc861vd_volume_init_verbs); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; err = alc_auto_add_mic_boost(codec); if (err < 0) @@ -14803,7 +14852,7 @@ static int patch_alc861vd(struct hda_codec *codec) spec->adc_nids = alc861vd_adc_nids; spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); spec->capsrc_nids = alc861vd_capsrc_nids; - spec->is_mix_capture = 1; + spec->capture_style = CAPT_MIX; set_capture_mixer(spec); @@ -16397,7 +16446,7 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) { - struct hda_input_mux *imux = &spec->private_imux; + struct hda_input_mux *imux = &spec->private_imux[0]; int i, err, idx; for (i = 0; i < AUTO_PIN_LAST; i++) { @@ -16528,7 +16577,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) add_mixer(spec, spec->kctls.list); spec->num_mux_defs = 1; - spec->input_mux = &spec->private_imux; + spec->input_mux = &spec->private_imux[0]; add_verb(spec, alc662_auto_init_verbs); if (codec->vendor_id == 0x10ec0663) @@ -16613,7 +16662,7 @@ static int patch_alc662(struct hda_codec *codec) spec->adc_nids = alc662_adc_nids; spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); spec->capsrc_nids = alc662_capsrc_nids; - spec->is_mix_capture = 1; + spec->capture_style = CAPT_MIX; if (!spec->cap_mixer) set_capture_mixer(spec); -- cgit v1.2.3 From 328cc6dfaadad614449eca1c75559e64c5054fea Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Wed, 28 Jan 2009 15:39:22 -0200 Subject: ALSA: AC97: Print AC97 flags in proc file to make debug it easier While debugging some code paths in AC97 codec patches and its suspend and resume functions, getting to know the flags has proved useful to follow those code paths. Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_proc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index 060ea59d5f02..73b17d526c8b 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c @@ -125,6 +125,8 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe snd_iprintf(buffer, "PCI Subsys Device: 0x%04x\n\n", ac97->subsystem_device); + snd_iprintf(buffer, "Flags: %x\n", ac97->flags); + if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) { val = snd_ac97_read(ac97, AC97_INT_PAGING); snd_ac97_update_bits(ac97, AC97_INT_PAGING, -- cgit v1.2.3 From b833b5ec0411adc2255053a0e0ec536d97e5784e Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Wed, 28 Jan 2009 18:20:06 -0200 Subject: ALSA: AC97: Fix function name type in comment s/updat/update/ Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index e2b843b4f9d0..27551e963e52 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -383,7 +383,7 @@ int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned sho EXPORT_SYMBOL(snd_ac97_update_bits); -/* no lock version - see snd_ac97_updat_bits() */ +/* no lock version - see snd_ac97_update_bits() */ int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value) { -- cgit v1.2.3 From 56305757f0b64b7d5dd02fd54c6dfc0989868f31 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 29 Jan 2009 11:44:24 +0100 Subject: ALSA: sscape: update Kconfig description about SoundScape cards The SoundScape driver handles more cards then described. Signed-off-by: Takashi Iwai --- sound/isa/Kconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index ce0aa044e274..542c1ead14bd 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -377,14 +377,17 @@ config SND_SGALAXY will be called snd-sgalaxy. config SND_SSCAPE - tristate "Ensoniq SoundScape PnP driver" + tristate "Ensoniq SoundScape driver" select SND_HWDEP select SND_MPU401_UART select SND_WSS_LIB help - Say Y here to include support for Ensoniq SoundScape PnP + Say Y here to include support for Ensoniq SoundScape soundcards. + The PCM audio is supported on SoundScape Classic, Elite, PnP + and VIVO cards. The MIDI support is very experimental. + To compile this driver as a module, choose M here: the module will be called snd-sscape. -- cgit v1.2.3 From 0a898e6e500ec8ab98000896fe243c4c0e91c72a Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 29 Jan 2009 11:46:45 +0100 Subject: ALSA: gus: update debug messages Convert some of them to snd_printdd() and update arguments to make them compilable. Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_dma.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index f45f6116c77a..cf8cd3c26a55 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c @@ -45,7 +45,8 @@ static void snd_gf1_dma_program(struct snd_gus_card * gus, unsigned char dma_cmd; unsigned int address_high; - // snd_printk("dma_transfer: addr=0x%x, buf=0x%lx, count=0x%x\n", addr, (long) buf, count); + snd_printdd("dma_transfer: addr=0x%x, buf=0x%lx, count=0x%x\n", + addr, buf_addr, count); if (gus->gf1.dma1 > 3) { if (gus->gf1.enh_mode) { @@ -142,7 +143,9 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus) snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd); kfree(block); #if 0 - printk("program dma (IRQ) - addr = 0x%x, buffer = 0x%lx, count = 0x%x, cmd = 0x%x\n", addr, (long) buffer, count, cmd); + snd_printd(KERN_DEBUG "program dma (IRQ) - " + "addr = 0x%x, buffer = 0x%lx, count = 0x%x, cmd = 0x%x\n", + block->addr, block->buf_addr, block->count, block->cmd); #endif } @@ -203,13 +206,16 @@ int snd_gf1_dma_transfer_block(struct snd_gus_card * gus, } *block = *__block; block->next = NULL; -#if 0 - printk("addr = 0x%x, buffer = 0x%lx, count = 0x%x, cmd = 0x%x\n", block->addr, (long) block->buffer, block->count, block->cmd); -#endif -#if 0 - printk("gus->gf1.dma_data_pcm_last = 0x%lx\n", (long)gus->gf1.dma_data_pcm_last); - printk("gus->gf1.dma_data_pcm = 0x%lx\n", (long)gus->gf1.dma_data_pcm); -#endif + + snd_printdd("addr = 0x%x, buffer = 0x%lx, count = 0x%x, cmd = 0x%x\n", + block->addr, (long) block->buffer, block->count, + block->cmd); + + snd_printdd("gus->gf1.dma_data_pcm_last = 0x%lx\n", + (long)gus->gf1.dma_data_pcm_last); + snd_printdd("gus->gf1.dma_data_pcm = 0x%lx\n", + (long)gus->gf1.dma_data_pcm); + spin_lock_irqsave(&gus->dma_lock, flags); if (synth) { if (gus->gf1.dma_data_synth_last) { -- cgit v1.2.3 From c97dff84e0d9a4e0b7048e033d33511e3897c859 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 29 Jan 2009 11:48:14 +0100 Subject: ALSA: cmi8330: add MPU-401 support Add MPU-401 port support for the chip. Also, update some error messages and description. Signed-off-by: Takashi Iwai --- sound/isa/Kconfig | 1 + sound/isa/cmi8330.c | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index be2d377ff90a..5915dc41c0ee 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -95,6 +95,7 @@ config SND_CMI8330 select SND_WSS_LIB select SND_SB16_DSP select SND_OPL3_LIB + select SND_MPU401_UART help Say Y here to include support for soundcards based on the C-Media CMI8330 chip. diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 115437957413..9ca8122f7ba2 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -31,11 +31,11 @@ * To quickly load the module, * * modprobe -a snd-cmi8330 sbport=0x220 sbirq=5 sbdma8=1 - * sbdma16=5 wssport=0x530 wssirq=11 wssdma=0 + * sbdma16=5 wssport=0x530 wssirq=11 wssdma=0 fmport=0x388 * * This card has two mixers and two PCM devices. I've cheesed it such * that recording and playback can be done through the same device. - * The driver "magically" routes the capturing to the AD1848 codec, + * The driver "magically" routes the capturing to the CMI8330 codec, * and playback to the SB16 codec. This allows for full-duplex mode * to some extent. * The utilities in alsa-utils are aware of both devices, so passing @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,8 @@ static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; static long fmport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long mpuport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int mpuirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard."); @@ -111,6 +114,10 @@ MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); module_param_array(fmport, long, NULL, 0444); MODULE_PARM_DESC(fmport, "FM port # for CMI8330 driver."); +module_param_array(mpuport, long, NULL, 0444); +MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8330 driver."); +module_param_array(mpuirq, int, NULL, 0444); +MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8330 MPU-401 port."); #ifdef CONFIG_PNP static int isa_registered; static int pnp_registered; @@ -153,6 +160,7 @@ struct snd_cmi8330 { #ifdef CONFIG_PNP struct pnp_dev *cap; struct pnp_dev *play; + struct pnp_dev *mpu; #endif struct snd_card *card; struct snd_wss *wss; @@ -169,7 +177,7 @@ struct snd_cmi8330 { #ifdef CONFIG_PNP static struct pnp_card_device_id snd_cmi8330_pnpids[] = { - { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" } } }, + { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } }, { .id = "" } }; @@ -329,11 +337,15 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard, if (acard->play == NULL) return -EBUSY; + acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL); + if (acard->play == NULL) + return -EBUSY; + pdev = acard->cap; err = pnp_activate_dev(pdev); if (err < 0) { - snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n"); + snd_printk(KERN_ERR "CMI8330/C3D PnP configure failure\n"); return -EBUSY; } wssport[dev] = pnp_port_start(pdev, 0); @@ -354,6 +366,17 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard, sbdma16[dev] = pnp_dma(pdev, 1); sbirq[dev] = pnp_irq(pdev, 0); + /* allocate MPU-401 resources */ + pdev = acard->mpu; + + err = pnp_activate_dev(pdev); + if (err < 0) { + snd_printk(KERN_ERR + "CMI8330/C3D (MPU-401) PnP configure failure\n"); + return -EBUSY; + } + mpuport[dev] = pnp_port_start(pdev, 0); + mpuirq[dev] = pnp_irq(pdev, 0); return 0; } #endif @@ -502,11 +525,11 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) wssdma[dev], -1, WSS_HW_DETECT, 0, &acard->wss); if (err < 0) { - snd_printk(KERN_ERR PFX "(AD1848) device busy??\n"); + snd_printk(KERN_ERR PFX "(CMI8330) device busy??\n"); return err; } if (acard->wss->hardware != WSS_HW_CMI8330) { - snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n"); + snd_printk(KERN_ERR PFX "(CMI8330) not found during probe\n"); return -ENODEV; } @@ -552,6 +575,13 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) } } + if (mpuport[dev] != SNDRV_AUTO_PORT) { + if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, + mpuport[dev], 0, mpuirq[dev], + IRQF_DISABLED, NULL) < 0) + printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", + mpuport[dev]); + } strcpy(card->driver, "CMI8330/C3D"); strcpy(card->shortname, "C-Media CMI8330/C3D"); -- cgit v1.2.3 From b98b7b347eed333d6fa2f74770beb8106e576cc6 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Thu, 29 Jan 2009 13:18:31 -0200 Subject: ALSA: hda - make alc882_auto_init_input_src aware of selectors In the case of having a selector instead of mixer while initing input sources, the case that happens with ALC889, we must select instead of muting input. Problem was found while testing with hda-emu. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d81cb5eb8c5f..3666cc5dc3bc 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6924,18 +6924,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) static void alc882_auto_init_input_src(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - const struct hda_input_mux *imux = spec->input_mux; int c; for (c = 0; c < spec->num_adc_nids; c++) { hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; hda_nid_t nid = spec->capsrc_nids[c]; + unsigned int mux_idx; + const struct hda_input_mux *imux; int conns, mute, idx, item; conns = snd_hda_get_connections(codec, nid, conn_list, ARRAY_SIZE(conn_list)); if (conns < 0) continue; + mux_idx = c >= spec->num_mux_defs ? 0 : c; + imux = &spec->input_mux[mux_idx]; for (idx = 0; idx < conns; idx++) { /* if the current connection is the selected one, * unmute it as default - otherwise mute it @@ -6948,8 +6951,20 @@ static void alc882_auto_init_input_src(struct hda_codec *codec) break; } } - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_AMP_GAIN_MUTE, mute); + /* check if we have a selector or mixer + * we could check for the widget type instead, but + * just check for Amp-In presence (in case of mixer + * without amp-in there is something wrong, this + * function shouldn't be used or capsrc nid is wrong) + */ + if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_AMP_GAIN_MUTE, + mute); + else if (mute != AMP_IN_MUTE(idx)) + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_CONNECT_SEL, + idx); } } } -- cgit v1.2.3 From 4272ebfbefd0db40073f3ee5990bceaf2894f08b Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Thu, 29 Jan 2009 15:14:46 -0800 Subject: x86: allow more than 8 cpus to be used on 32-bit X86_PC is the only remaining 'sub' architecture, so we dont need it anymore. This also cleans up a few spurious references to X86_PC in the driver space - those certainly should be X86. Signed-off-by: Yinghai Lu Signed-off-by: Ingo Molnar --- arch/x86/Kconfig | 6 +----- arch/x86/configs/i386_defconfig | 1 - arch/x86/configs/x86_64_defconfig | 1 - arch/x86/kernel/smpboot.c | 2 +- drivers/eisa/Kconfig | 6 +++--- drivers/input/keyboard/Kconfig | 4 ++-- drivers/input/mouse/Kconfig | 2 +- drivers/mtd/nand/Kconfig | 2 +- sound/drivers/Kconfig | 2 +- 9 files changed, 10 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5bf0e0c58289..afaf2cb7c1ac 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -262,9 +262,6 @@ config X86_MPPARSE For old smp systems that do not have proper acpi support. Newer systems (esp with 64bit cpus) with acpi support, MADT and DSDT will override it -config X86_PC - def_bool y - config X86_NON_STANDARD bool "Support for non-standard x86 platforms" help @@ -1019,7 +1016,6 @@ config NUMA bool "Numa Memory Allocation and Scheduler Support" depends on SMP depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL) - default n if X86_PC default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP) help Enable NUMA (Non Uniform Memory Access) support. @@ -1122,7 +1118,7 @@ config ARCH_SPARSEMEM_DEFAULT config ARCH_SPARSEMEM_ENABLE def_bool y - depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) || X86_32_NON_STANDARD + depends on X86_64 || NUMA || (EXPERIMENTAL && X86_32) || X86_32_NON_STANDARD select SPARSEMEM_STATIC if X86_32 select SPARSEMEM_VMEMMAP_ENABLE if X86_64 diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index edba00d98ac3..739bce993b56 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig @@ -188,7 +188,6 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_SMP=y CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y -CONFIG_X86_PC=y # CONFIG_X86_ELAN is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_GENERICARCH is not set diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index 322dd2748fc9..02b514e8f4c4 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig @@ -187,7 +187,6 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_SMP=y CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y -CONFIG_X86_PC=y # CONFIG_X86_ELAN is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_GENERICARCH is not set diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index fc80bc18943e..2912fa3a8ef2 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1000,7 +1000,7 @@ static int __init smp_sanity_check(unsigned max_cpus) { preempt_disable(); -#if defined(CONFIG_X86_PC) && defined(CONFIG_X86_32) +#ifndef CONFIG_X86_BIGSMP if (def_to_bigsmp && nr_cpu_ids > 8) { unsigned int cpu; unsigned nr; diff --git a/drivers/eisa/Kconfig b/drivers/eisa/Kconfig index c0646576cf47..2705284f6223 100644 --- a/drivers/eisa/Kconfig +++ b/drivers/eisa/Kconfig @@ -3,7 +3,7 @@ # config EISA_VLB_PRIMING bool "Vesa Local Bus priming" - depends on X86_PC && EISA + depends on X86 && EISA default n ---help--- Activate this option if your system contains a Vesa Local @@ -24,11 +24,11 @@ config EISA_PCI_EISA When in doubt, say Y. # Using EISA_VIRTUAL_ROOT on something other than an Alpha or -# an X86_PC may lead to crashes... +# an X86 may lead to crashes... config EISA_VIRTUAL_ROOT bool "EISA virtual root device" - depends on EISA && (ALPHA || X86_PC) + depends on EISA && (ALPHA || X86) default y ---help--- Activate this option if your system only have EISA bus diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 35561689ff38..ea2638b41982 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -13,11 +13,11 @@ menuconfig INPUT_KEYBOARD if INPUT_KEYBOARD config KEYBOARD_ATKBD - tristate "AT keyboard" if EMBEDDED || !X86_PC + tristate "AT keyboard" if EMBEDDED || !X86 default y select SERIO select SERIO_LIBPS2 - select SERIO_I8042 if X86_PC + select SERIO_I8042 if X86 select SERIO_GSCPS2 if GSC help Say Y here if you want to use a standard AT or PS/2 keyboard. Usually diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 093c8c1bca74..9bef935ef19f 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig @@ -17,7 +17,7 @@ config MOUSE_PS2 default y select SERIO select SERIO_LIBPS2 - select SERIO_I8042 if X86_PC + select SERIO_I8042 if X86 select SERIO_GSCPS2 if GSC help Say Y here if you have a PS/2 mouse connected to your system. This diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 928923665f6c..2ff88791cebc 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -273,7 +273,7 @@ config MTD_NAND_CAFE config MTD_NAND_CS553X tristate "NAND support for CS5535/CS5536 (AMD Geode companion chip)" - depends on X86_32 && (X86_PC || X86_32_NON_STANDARD) + depends on X86_32 help The CS553x companion chips for the AMD Geode processor include NAND flash controllers with built-in hardware ECC diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 0bcf14640fde..84714a65e5c8 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig @@ -33,7 +33,7 @@ if SND_DRIVERS config SND_PCSP tristate "PC-Speaker support (READ HELP!)" - depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS + depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS depends on INPUT depends on EXPERIMENTAL select SND_PCM -- cgit v1.2.3 From 42de55cb3b332e1430509a343b082731d7972b50 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 30 Jan 2009 15:49:58 +0100 Subject: ALSA: hda - Add quirk for another HP dv5 model Added model=hp-dv5 for another HP dv5 model with AMD chip (103c:3600) Reference: kernel bug#12440 http://bugzilla.kernel.org/show_bug.cgi?id=12440 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b787b3cc096f..38428e22428f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1804,6 +1804,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "HP dv4", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, "HP dv7", STAC_HP_M4), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, + "HP dv5", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, "HP dv5", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, -- cgit v1.2.3 From 880abd42d0891635e988b0a2cfb0942cf79fa2c3 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Fri, 30 Jan 2009 19:20:29 +0100 Subject: ALSA: ess1688: fix OPL3 port setting The ess1688 driver uses the same port for PCM audio (SB compatible) and OPL3 synthesis. It is not always right so allow to choose a different port for OPL3 synthesis. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/es1688/es1688.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index b46377139cf8..b0eb0cf6050e 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -49,6 +49,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ +static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ @@ -65,6 +66,8 @@ MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); module_param_array(mpu_port, long, NULL, 0444); MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); module_param_array(irq, int, NULL, 0444); +module_param_array(fm_port, long, NULL, 0444); +MODULE_PARM_DESC(fm_port, "FM port # for ES1688 driver."); MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); module_param_array(mpu_irq, int, NULL, 0444); MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); @@ -143,13 +146,19 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n) sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, chip->irq, chip->dma8); - if (snd_opl3_create(card, chip->port, chip->port + 2, - OPL3_HW_OPL3, 0, &opl3) < 0) - dev_warn(dev, "opl3 not detected at 0x%lx\n", chip->port); - else { - error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); - if (error < 0) - goto out; + if (fm_port[n] == SNDRV_AUTO_PORT) + fm_port[n] = port[n]; /* share the same port */ + + if (fm_port[n] > 0) { + if (snd_opl3_create(card, fm_port[n], fm_port[n] + 2, + OPL3_HW_OPL3, 0, &opl3) < 0) + dev_warn(dev, + "opl3 not detected at 0x%lx\n", fm_port[n]); + else { + error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (error < 0) + goto out; + } } if (mpu_irq[n] >= 0 && mpu_irq[n] != SNDRV_AUTO_IRQ && -- cgit v1.2.3 From 67d8a3c1221bc883c821e7695ba6d327a5d6f2af Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Sat, 31 Jan 2009 12:17:28 +0100 Subject: ALSA: alsa: time reaches -1, tested 0 With a postfix decrement time will reach -1 rather than 0, so the warning will not be issued. Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 19d3391e229f..e900cdc84849 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -617,7 +617,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip) int time = 100; if (chip->buggy_semaphore) return 0; /* just ignore ... */ - while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) + while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) udelay(1); if (! time && ! chip->in_ac97_init) snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); -- cgit v1.2.3 From 3077e44c48242bb5867b41586f23aa8f6921073a Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Sat, 31 Jan 2009 17:57:54 +0100 Subject: ALSA: hda - Add support of iMac 24 Aluminium Added the support for 24" Aluminium iMac (106b:3e00) Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7884a4e07061..0040101f6150 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7012,6 +7012,7 @@ static int patch_alc882(struct hda_codec *codec) break; case 0x106b1000: /* iMac 24 */ case 0x106b2800: /* AppleTV */ + case 0x106b3e00: /* iMac 24 Aluminium */ board_config = ALC885_IMAC24; break; case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ -- cgit v1.2.3 From d563ffa6b319a4e401d096db9014a947590ca081 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 31 Jan 2009 18:01:13 +0100 Subject: ALSA: pcxhr: fix trivial typo Signed-off-by: Tim Blechmann Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/pcxhr/pcxhr_core.h b/sound/pci/pcxhr/pcxhr_core.h index bbbd66d13a64..be0173796cdb 100644 --- a/sound/pci/pcxhr/pcxhr_core.h +++ b/sound/pci/pcxhr/pcxhr_core.h @@ -1,7 +1,7 @@ /* * Driver for Digigram pcxhr compatible soundcards * - * low level interface with interrupt ans message handling + * low level interface with interrupt and message handling * * Copyright (c) 2004 by Digigram * -- cgit v1.2.3 From 5aa13a94098ef5fc1bb0a7f531fdda8864ae67ff Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Sun, 1 Feb 2009 21:13:15 +0100 Subject: ALSA: msnd: add module description and license for the snd-msnd-lib The missing module license generates warning during module loading. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/msnd/msnd.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/isa/msnd/msnd.c b/sound/isa/msnd/msnd.c index 264e08212c69..906454413ed2 100644 --- a/sound/isa/msnd/msnd.c +++ b/sound/isa/msnd/msnd.c @@ -700,3 +700,6 @@ int snd_msnd_pcm(struct snd_card *card, int device, } EXPORT_SYMBOL(snd_msnd_pcm); +MODULE_DESCRIPTION("Common routines for Turtle Beach Multisound drivers"); +MODULE_LICENSE("GPL"); + -- cgit v1.2.3 From 516a1ced456a6d118db738f0f09fce0cb0f42794 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Feb 2009 11:37:03 +0100 Subject: ALSA: hda - No widget selection for volume knob widgets in proc output Volume-knob widgets have no widget selection although they have widget connections. Thus, the connection list in the proc output shouldn't contain the selection (*). Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 7ca66d654148..144b85276d5a 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -399,7 +399,8 @@ static void print_conn_list(struct snd_info_buffer *buffer, { int c, curr = -1; - if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) + if (conn_len > 1 && wid_type != AC_WID_AUD_MIX && + wid_type != AC_WID_VOL_KNB) curr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); snd_iprintf(buffer, " Connection: %d\n", conn_len); -- cgit v1.2.3 From e683ec4697c74c7d04ff8e90ec625ac34e25a7d8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 12 Nov 2008 16:42:44 +0100 Subject: ALSA: ice1724 - Dynamic MIDI TX irq control MIDI_TX IRQ seems always pending when any bytes on FIFO is available. Thus, it's better to enable MPU_TX only when any bytres are really stored in the substream, and disables immediately when the queue becomes empty. Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1724.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index bb8d8c766b9d..eb7872dec5ae 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,8 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); } +static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable); + static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +256,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); } + /* mask irq when all bytes have been transmitted. + * enabled again in output_trigger when the new data comes in. + */ + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, + !snd_rawmidi_transmit_empty(s)); } static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +279,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } } -static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, - u8 flag, int enable) +/* call with ice->reg_lock */ +static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable) { - struct snd_ice1712 *ice = substream->rmidi->private_data; - u8 mask; - - spin_lock_irq(&ice->reg_lock); - mask = inb(ICEREG1724(ice, IRQMASK)); + u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK)); +} + +static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, + u8 flag, int enable) +{ + struct snd_ice1712 *ice = substream->rmidi->private_data; + + spin_lock_irq(&ice->reg_lock); + enable_midi_irq(ice, flag, enable); spin_unlock_irq(&ice->reg_lock); } static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) { - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0; } static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) { - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0; } @@ -311,6 +321,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) vt1724_midi_write(ice); } else { ice->midi_output = 0; + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); } spin_unlock_irqrestore(&ice->reg_lock, flags); } @@ -320,6 +331,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout; + vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do { @@ -389,24 +401,24 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break; + spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); - outb(inb(ICEREG1724(ice, IRQMASK)) | - VT1724_IRQ_MPU_TX, - ICEREG1724(ice, IRQMASK)); + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); } + spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) { - spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice); - spin_unlock(&ice->reg_lock); + else + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the @@ -415,15 +427,14 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status_mask &= ~VT1724_IRQ_MPU_TX; } if (status & VT1724_IRQ_MPU_RX) { - spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice); - spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT)); + spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM -- cgit v1.2.3 From ba340e825f4b892782779abd0f93bcff7e763567 Mon Sep 17 00:00:00 2001 From: Tony Vroon Date: Mon, 2 Feb 2009 19:01:30 +0000 Subject: ALSA: hda - Add tyan model for Realtek ALC262 The Realtek ALC262 on the Tyan Thunder n6650W (S2915-E) mainboard has a rather odd configuration template. As a result, the white AUX connector can not be used. This rewrites the default config to more accurately reflect the connector layout, colour and function. Unfortunately the black CD_IN connector, which is suspected to be widget 0x1c refuses to switch into input (0x20), instead opting to remain on 0x0. As such, no mixer controls are exposed for it. Autoswitching is implemented between the front headphone output and back line output. Signed-off-by: Tony Vroon Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0c81d92c3d75..bd9ef3363890 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -103,6 +103,7 @@ enum { ALC262_NEC, ALC262_TOSHIBA_S06, ALC262_TOSHIBA_RX1, + ALC262_TYAN, ALC262_AUTO, ALC262_MODEL_LAST /* last tag */ }; @@ -9509,6 +9510,67 @@ static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { { } /* end */ }; +static struct snd_kcontrol_new alc262_tyan_mixer[] = { + HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), + HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), + HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), + HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), + HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), + HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), + HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), + { } /* end */ +}; + +static struct hda_verb alc262_tyan_verbs[] = { + /* Headphone automute */ + {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, + {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, + + /* P11 AUX_IN, white 4-pin connector */ + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, + {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, + {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, + + {} +}; + +/* unsolicited event for HP jack sensing */ +static void alc262_tyan_automute(struct hda_codec *codec) +{ + unsigned int mute; + unsigned int present; + + snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); + present = snd_hda_codec_read(codec, 0x1b, 0, + AC_VERB_GET_PIN_SENSE, 0); + present = (present & 0x80000000) != 0; + if (present) { + /* mute line output on ATX panel */ + snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, + HDA_AMP_MUTE, HDA_AMP_MUTE); + } else { + /* unmute line output if necessary */ + mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); + snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, + HDA_AMP_MUTE, mute); + } +} + +static void alc262_tyan_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + if ((res >> 26) != ALC880_HP_EVENT) + return; + alc262_tyan_automute(codec); +} + #define alc262_capture_mixer alc882_capture_mixer #define alc262_capture_alt_mixer alc882_capture_alt_mixer @@ -10626,6 +10688,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { [ALC262_ULTRA] = "ultra", [ALC262_LENOVO_3000] = "lenovo-3000", [ALC262_NEC] = "nec", + [ALC262_TYAN] = "tyan", [ALC262_AUTO] = "auto", }; @@ -10666,6 +10729,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), + SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), @@ -10884,6 +10948,19 @@ static struct alc_config_preset alc262_presets[] = { .unsol_event = alc262_hippo_unsol_event, .init_hook = alc262_hippo_automute, }, + [ALC262_TYAN] = { + .mixers = { alc262_tyan_mixer }, + .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, + .num_dacs = ARRAY_SIZE(alc262_dac_nids), + .dac_nids = alc262_dac_nids, + .hp_nid = 0x02, + .dig_out_nid = ALC262_DIGOUT_NID, + .num_channel_mode = ARRAY_SIZE(alc262_modes), + .channel_mode = alc262_modes, + .input_mux = &alc262_capture_source, + .unsol_event = alc262_tyan_unsol_event, + .init_hook = alc262_tyan_automute, + }, }; static int patch_alc262(struct hda_codec *codec) -- cgit v1.2.3 From 680cd53652d8bfb2b97d8c0248d1afb82de6b61d Mon Sep 17 00:00:00 2001 From: Kusanagi Kouichi Date: Thu, 5 Feb 2009 00:00:58 +0900 Subject: ALSA: hda: Add digital beep generator support for Realtek codecs. A digital beep generator can be used via input layer. Signed-off-by: Kusanagi Kouichi Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_beep.h | 2 +- sound/pci/hda/patch_realtek.c | 62 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index b9679f081cae..51bf6a5daf39 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h @@ -39,7 +39,7 @@ struct hda_beep { int snd_hda_attach_beep_device(struct hda_codec *codec, int nid); void snd_hda_detach_beep_device(struct hda_codec *codec); #else -#define snd_hda_attach_beep_device(...) +#define snd_hda_attach_beep_device(...) 0 #define snd_hda_detach_beep_device(...) #endif #endif diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index bd9ef3363890..0faa41bfc8be 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -30,6 +30,7 @@ #include #include "hda_codec.h" #include "hda_local.h" +#include "hda_beep.h" #define ALC880_FRONT_EVENT 0x01 #define ALC880_DCVOL_EVENT 0x02 @@ -3187,6 +3188,7 @@ static void alc_free(struct hda_codec *codec) alc_free_kctls(codec); kfree(spec); + snd_hda_detach_beep_device(codec); codec->spec = NULL; /* to be sure */ } @@ -4355,6 +4357,12 @@ static int patch_alc880(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC880_AUTO) setup_preset(spec, &alc880_presets[board_config]); @@ -5882,6 +5890,12 @@ static int patch_alc260(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC260_AUTO) setup_preset(spec, &alc260_presets[board_config]); @@ -7093,6 +7107,12 @@ static int patch_alc882(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC882_AUTO) setup_preset(spec, &alc882_presets[board_config]); @@ -9093,6 +9113,12 @@ static int patch_alc883(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC883_AUTO) setup_preset(spec, &alc883_presets[board_config]); @@ -11013,6 +11039,12 @@ static int patch_alc262(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC262_AUTO) setup_preset(spec, &alc262_presets[board_config]); @@ -12051,6 +12083,12 @@ static int patch_alc268(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC268_AUTO) setup_preset(spec, &alc268_presets[board_config]); @@ -12885,6 +12923,12 @@ static int patch_alc269(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC269_AUTO) setup_preset(spec, &alc269_presets[board_config]); @@ -13978,6 +14022,12 @@ static int patch_alc861(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x23); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC861_AUTO) setup_preset(spec, &alc861_presets[board_config]); @@ -14924,6 +14974,12 @@ static int patch_alc861vd(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x23); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC861VD_AUTO) setup_preset(spec, &alc861vd_presets[board_config]); @@ -16733,6 +16789,12 @@ static int patch_alc662(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (board_config != ALC662_AUTO) setup_preset(spec, &alc662_presets[board_config]); -- cgit v1.2.3 From 453e37b37521b613f0927fcf53ccd93ad3a8b3ae Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Wed, 4 Feb 2009 17:41:32 +0100 Subject: ALSA: sscape: drop redundant fields from soundscape struct The wss_base is disuised parameter for one function. It is converted to function parameter. The code_type is only set but never read. It is removed. The midi_vol is set only to 0 so it does not work as detection of change in midi volume. It is fixed. The xport variable is alias to the port[dev]. Use the port[dev] directly to increase readability. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/sscape.c | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 681e2237acb7..33c1258029f9 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -135,8 +135,6 @@ enum card_type { struct soundscape { spinlock_t lock; unsigned io_base; - unsigned wss_base; - int codec_type; int ic_type; enum card_type type; struct resource *io_res; @@ -726,13 +724,7 @@ static int sscape_midi_get(struct snd_kcontrol *kctl, unsigned long flags; spin_lock_irqsave(&s->lock, flags); - set_host_mode_unsafe(s->io_base); - - if (host_write_ctrl_unsafe(s->io_base, CMD_GET_MIDI_VOL, 100)) { - uctl->value.integer.value[0] = host_read_ctrl_unsafe(s->io_base, 100); - } - - set_midi_mode_unsafe(s->io_base); + uctl->value.integer.value[0] = s->midi_vol; spin_unlock_irqrestore(&s->lock, flags); return 0; } @@ -767,6 +759,7 @@ static int sscape_midi_put(struct snd_kcontrol *kctl, change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) && host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100) && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100)); + s->midi_vol = (unsigned char) uctl->value.integer.value[0] & 127; __skip_change: /* @@ -809,12 +802,11 @@ static unsigned __devinit get_irq_config(int irq) * Perform certain arcane port-checks to see whether there * is a SoundScape board lurking behind the given ports. */ -static int __devinit detect_sscape(struct soundscape *s) +static int __devinit detect_sscape(struct soundscape *s, long wss_io) { unsigned long flags; unsigned d; int retval = 0; - int codec = s->wss_base; spin_lock_irqsave(&s->lock, flags); @@ -830,13 +822,11 @@ static int __devinit detect_sscape(struct soundscape *s) if ((d & 0x80) != 0) goto _done; - if (d == 0) { - s->codec_type = 1; + if (d == 0) s->ic_type = IC_ODIE; - } else if ((d & 0x60) != 0) { - s->codec_type = 2; + else if ((d & 0x60) != 0) s->ic_type = IC_OPUS; - } else + else goto _done; outb(0xfa, ODIE_ADDR_IO(s->io_base)); @@ -856,10 +846,10 @@ static int __devinit detect_sscape(struct soundscape *s) sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); if (s->type == SSCAPE_VIVO) - codec += 4; + wss_io += 4; /* wait for WSS codec */ for (d = 0; d < 500; d++) { - if ((inb(codec) & 0x80) == 0) + if ((inb(wss_io) & 0x80) == 0) break; spin_unlock_irqrestore(&s->lock, flags); msleep(1); @@ -1057,7 +1047,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) unsigned dma_cfg; unsigned irq_cfg; unsigned mpu_irq_cfg; - unsigned xport; struct resource *io_res; struct resource *wss_res; unsigned long flags; @@ -1077,15 +1066,15 @@ static int __devinit create_sscape(int dev, struct snd_card *card) printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); return -ENXIO; } - xport = port[dev]; /* * Grab IO ports that we will need to probe so that we * can detect and control this hardware ... */ - io_res = request_region(xport, 8, "SoundScape"); + io_res = request_region(port[dev], 8, "SoundScape"); if (!io_res) { - snd_printk(KERN_ERR "sscape: can't grab port 0x%x\n", xport); + snd_printk(KERN_ERR + "sscape: can't grab port 0x%lx\n", port[dev]); return -EBUSY; } wss_res = NULL; @@ -1112,10 +1101,9 @@ static int __devinit create_sscape(int dev, struct snd_card *card) spin_lock_init(&sscape->fwlock); sscape->io_res = io_res; sscape->wss_res = wss_res; - sscape->io_base = xport; - sscape->wss_base = wss_port[dev]; + sscape->io_base = port[dev]; - if (!detect_sscape(sscape)) { + if (!detect_sscape(sscape, wss_port[dev])) { printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", sscape->io_base); err = -ENODEV; goto _release_dma; @@ -1188,11 +1176,11 @@ static int __devinit create_sscape(int dev, struct snd_card *card) } #define MIDI_DEVNUM 0 if (sscape->type != SSCAPE_VIVO) { - err = create_mpu401(card, MIDI_DEVNUM, xport, mpu_irq[dev]); + err = create_mpu401(card, MIDI_DEVNUM, port[dev], mpu_irq[dev]); if (err < 0) { printk(KERN_ERR "sscape: Failed to create " - "MPU-401 device at 0x%x\n", - xport); + "MPU-401 device at 0x%lx\n", + port[dev]); goto _release_dma; } -- cgit v1.2.3 From 7924f0cadcf52cb316d6eca60a6ae3fc9e42b465 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Wed, 4 Feb 2009 18:14:55 +0100 Subject: ALSA: pcm_oss: AFMT_S24_LE is set twice in return value AFMT_S24_LE is set twice in return value vi sound/core/oss/pcm_oss.c +640 #define AFMT_S24_LE 0x00008000 #define AFMT_S24_BE 0x00010000 Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/core/oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index e17836680f49..0a1798eafb0b 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1767,7 +1767,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) AFMT_S8 | AFMT_U16_LE | AFMT_U16_BE | AFMT_S32_LE | AFMT_S32_BE | - AFMT_S24_LE | AFMT_S24_LE | + AFMT_S24_LE | AFMT_S24_BE | AFMT_S24_PACKED; params = kmalloc(sizeof(*params), GFP_KERNEL); if (!params) -- cgit v1.2.3 From 5e7476243ad755fa1d8be2b1774d0aeb16bb48df Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Feb 2009 18:28:42 +0100 Subject: ALSA: msnd - Fix build error with CONFIG_PNP=n sound/isa/msnd/msnd_pinnacle.c:891: error: 'isapnp' undeclared (first use in this function) Signed-off-by: Takashi Iwai --- sound/isa/msnd/msnd_pinnacle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index 70559223e8f3..60b6abd71612 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -785,6 +785,9 @@ static int calibrate_signal; static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(isapnp, bool, NULL, 0444); MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); +#define has_isapnp(x) isapnp[x] +#else +#define has_isapnp(x) 0 #endif MODULE_AUTHOR("Karsten Wiese "); @@ -888,7 +891,7 @@ static int __devinit snd_msnd_isa_probe(struct device *pdev, unsigned int idx) struct snd_card *card; struct snd_msnd *chip; - if (isapnp[idx] || cfg[idx] == SNDRV_AUTO_PORT) { + if (has_isapnp(idx) || cfg[idx] == SNDRV_AUTO_PORT) { printk(KERN_INFO LOGNAME ": Assuming PnP mode\n"); return -ENODEV; } @@ -1082,7 +1085,7 @@ static int __devinit snd_msnd_pnp_detect(struct pnp_card_link *pcard, int ret; for ( ; idx < SNDRV_CARDS; idx++) { - if (isapnp[idx]) + if (has_isapnp(idx)) break; } if (idx >= SNDRV_CARDS) -- cgit v1.2.3 From f67d8176ba9a3dbc33454cd67057184b2ef5ee31 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Feb 2009 23:30:19 +0100 Subject: ALSA: hda - Add quirk for FSC Amilo Xi2550 Added model=fujisu-pi2515 for FSC Amilo Xi2550 with ALC883 codec. Refernece: Novell bnc#450979 https://bugzilla.novell.com/show_bug.cgi?id=450979 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0040101f6150..a3baa33aedfd 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8515,6 +8515,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), + SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", + ALC883_FUJITSU_PI2515), SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", ALC888_FUJITSU_XA3530), -- cgit v1.2.3 From e8c0ee5d77ec0f144c753a622c67dd96fa195d50 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 07:34:28 +0100 Subject: ALSA: hda - Fix misc workqueue issues Some fixes regarding snd-hda-intel workqueue: - Use create_singlethread_workqueue() instead of create_workqueue() as per-CPU work isn't required. - Allocate workq name string properly - Renamed the workq name to "hd-audio*" to be more obvious. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 9 +++++---- sound/pci/hda/hda_codec.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b7bba7dc7cf1..0b708134d12f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -487,7 +487,6 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, { struct hda_bus *bus; int err; - char qname[8]; static struct snd_device_ops dev_ops = { .dev_register = snd_hda_bus_dev_register, .dev_free = snd_hda_bus_dev_free, @@ -517,10 +516,12 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, mutex_init(&bus->cmd_mutex); INIT_LIST_HEAD(&bus->codec_list); - snprintf(qname, sizeof(qname), "hda%d", card->number); - bus->workq = create_workqueue(qname); + snprintf(bus->workq_name, sizeof(bus->workq_name), + "hd-audio%d", card->number); + bus->workq = create_singlethread_workqueue(bus->workq_name); if (!bus->workq) { - snd_printk(KERN_ERR "cannot create workqueue %s\n", qname); + snd_printk(KERN_ERR "cannot create workqueue %s\n", + bus->workq_name); kfree(bus); return -ENOMEM; } diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5810ef588402..09a332ada0c6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -614,6 +614,7 @@ struct hda_bus { /* unsolicited event queue */ struct hda_bus_unsolicited *unsol; + char workq_name[16]; struct workqueue_struct *workq; /* common workqueue for codecs */ /* assigned PCMs */ -- cgit v1.2.3 From 616f89e74cd954e04ae4f8bad6a3dc8730a4a47a Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 4 Feb 2009 11:23:19 -0500 Subject: ALSA: hda - Additional pin nids for STAC92HD71Bx and STAC92HD75Bx codecs Current code for STAC92HD71Bx and STAC92HD75Bx doesn't consider pin complexes 0x20 and 0x27. Also for 4 port models, nids 0x0e and 0x0f are vendor reserved. This commit changes code so it'll consider the additional pin complexes for models that have it, and avoid reserved nids to be touched on 4 port models. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 59 ++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a7df81efed23..58c9ff9d27f5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -481,10 +481,17 @@ static hda_nid_t stac92hd83xxx_pin_nids[14] = { 0x0f, 0x10, 0x11, 0x12, 0x13, 0x1d, 0x1e, 0x1f, 0x20 }; -static hda_nid_t stac92hd71bxx_pin_nids[11] = { + +#define STAC92HD71BXX_NUM_PINS 13 +static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { + 0x0a, 0x0b, 0x0c, 0x0d, 0x00, + 0x00, 0x14, 0x18, 0x19, 0x1e, + 0x1f, 0x20, 0x27 +}; +static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x18, 0x19, 0x1e, - 0x1f, + 0x1f, 0x20, 0x27 }; static hda_nid_t stac927x_pin_nids[14] = { @@ -1745,28 +1752,32 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { {} /* terminator */ }; -static unsigned int ref92hd71bxx_pin_configs[11] = { +static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, - 0x90a000f0, 0x01452050, 0x01452050, + 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, + 0x00000000 }; -static unsigned int dell_m4_1_pin_configs[11] = { +static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, - 0x40f000f0, 0x4f0000f0, 0x4f0000f0, + 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, + 0x00000000 }; -static unsigned int dell_m4_2_pin_configs[11] = { +static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, - 0x40f000f0, 0x044413b0, 0x044413b0, + 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, + 0x00000000 }; -static unsigned int dell_m4_3_pin_configs[11] = { +static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, - 0x40f000f0, 0x044413b0, 0x044413b0, + 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, + 0x00000000 }; static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { @@ -2311,7 +2322,9 @@ static int stac92xx_save_bios_config_regs(struct hda_codec *codec) for (i = 0; i < spec->num_pins; i++) { hda_nid_t nid = spec->pin_nids[i]; unsigned int pin_cfg; - + + if (!nid) + continue; pin_cfg = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0x00); snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", @@ -2354,8 +2367,9 @@ static void stac92xx_set_config_regs(struct hda_codec *codec) return; for (i = 0; i < spec->num_pins; i++) - stac92xx_set_config_reg(codec, spec->pin_nids[i], - spec->pin_configs[i]); + if (spec->pin_nids[i] && spec->pin_configs[i]) + stac92xx_set_config_reg(codec, spec->pin_nids[i], + spec->pin_configs[i]); } static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins) @@ -4952,9 +4966,21 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) codec->spec = spec; codec->patch_ops = stac92xx_patch_ops; - spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); + spec->num_pins = STAC92HD71BXX_NUM_PINS; + switch (codec->vendor_id) { + case 0x111d76b6: + case 0x111d76b7: + spec->pin_nids = stac92hd71bxx_pin_nids_4port; + break; + case 0x111d7603: + case 0x111d7608: + /* On 92HD75Bx 0x27 isn't a pin nid */ + spec->num_pins--; + /* fallthrough */ + default: + spec->pin_nids = stac92hd71bxx_pin_nids_6port; + } spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); - spec->pin_nids = stac92hd71bxx_pin_nids; memcpy(&spec->private_dimux, &stac92hd71bxx_dmux, sizeof(stac92hd71bxx_dmux)); spec->board_config = snd_hda_check_board_config(codec, @@ -5018,7 +5044,8 @@ again: /* disable VSW */ spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; unmute_init++; - stac_change_pin_config(codec, 0xf, 0x40f000f0); + stac_change_pin_config(codec, 0x0f, 0x40f000f0); + stac_change_pin_config(codec, 0x19, 0x40f000f3); break; case 0x111d7603: /* 6 Port with Analog Mixer */ if ((codec->revision_id & 0xf) == 1) -- cgit v1.2.3 From 6df703aefc81252447c69d24d2863007de2338e9 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 4 Feb 2009 11:34:22 -0500 Subject: ALSA: hda - Dynamic detection of dmics/dmuxes/smuxes in stac92hd71bxx Detect the number of connected ports and number of smuxes dynamically, looking at pin configs, using new introduced functions stac92hd71bxx_connected_ports and stac92hd71bxx_connected_smuxes. Also use proper input mux configuration for 4port and 5port models. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 99 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 58c9ff9d27f5..c36c1c0f9574 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4944,7 +4944,16 @@ again: return 0; } -static struct hda_input_mux stac92hd71bxx_dmux = { +static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { + .num_items = 3, + .items = { + { "Analog Inputs", 0x00 }, + { "Digital Mic 1", 0x02 }, + { "Digital Mic 2", 0x03 }, + } +}; + +static struct hda_input_mux stac92hd71bxx_dmux_amixer = { .num_items = 4, .items = { { "Analog Inputs", 0x00 }, @@ -4954,11 +4963,57 @@ static struct hda_input_mux stac92hd71bxx_dmux = { } }; +static int stac92hd71bxx_connected_ports(struct hda_codec *codec, + hda_nid_t *nids, int num_nids) +{ + struct sigmatel_spec *spec = codec->spec; + int idx, num; + unsigned int def_conf; + + for (num = 0; num < num_nids; num++) { + for (idx = 0; idx < spec->num_pins; idx++) + if (spec->pin_nids[idx] == nids[num]) + break; + if (idx >= spec->num_pins) + break; + def_conf = get_defcfg_connect(spec->pin_configs[idx]); + if (def_conf == AC_JACK_PORT_NONE) + break; + } + return num; +} + +static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, + hda_nid_t dig0pin) +{ + struct sigmatel_spec *spec = codec->spec; + int idx; + + for (idx = 0; idx < spec->num_pins; idx++) + if (spec->pin_nids[idx] == dig0pin) + break; + if ((idx + 2) >= spec->num_pins) + return 0; + + /* dig1pin case */ + if (get_defcfg_connect(spec->pin_configs[idx+1]) != AC_JACK_PORT_NONE) + return 2; + + /* dig0pin + dig2pin case */ + if (get_defcfg_connect(spec->pin_configs[idx+2]) != AC_JACK_PORT_NONE) + return 2; + if (get_defcfg_connect(spec->pin_configs[idx]) != AC_JACK_PORT_NONE) + return 1; + else + return 0; +} + static int patch_stac92hd71bxx(struct hda_codec *codec) { struct sigmatel_spec *spec; struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; int err = 0; + unsigned int ndmic_nids = 0; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -4981,8 +5036,6 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) spec->pin_nids = stac92hd71bxx_pin_nids_6port; } spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); - memcpy(&spec->private_dimux, &stac92hd71bxx_dmux, - sizeof(stac92hd71bxx_dmux)); spec->board_config = snd_hda_check_board_config(codec, STAC_92HD71BXX_MODELS, stac92hd71bxx_models, @@ -5007,16 +5060,32 @@ again: spec->gpio_data = 0x01; } + spec->dmic_nids = stac92hd71bxx_dmic_nids; + spec->dmux_nids = stac92hd71bxx_dmux_nids; + switch (codec->vendor_id) { case 0x111d76b6: /* 4 Port without Analog Mixer */ case 0x111d76b7: case 0x111d76b4: /* 6 Port without Analog Mixer */ case 0x111d76b5: + memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, + sizeof(stac92hd71bxx_dmux_nomixer)); spec->mixer = stac92hd71bxx_mixer; spec->init = stac92hd71bxx_core_init; codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; + spec->num_dmics = stac92hd71bxx_connected_ports(codec, + stac92hd71bxx_dmic_nids, + STAC92HD71BXX_NUM_DMICS); + if (spec->num_dmics) { + spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); + spec->dinput_mux = &spec->private_dimux; + ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; + } break; case 0x111d7608: /* 5 Port with Analog Mixer */ + memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, + sizeof(stac92hd71bxx_dmux_amixer)); + spec->private_dimux.num_items--; switch (spec->board_config) { case STAC_HP_M4: /* Enable VREF power saving on GPIO1 detect */ @@ -5046,6 +5115,12 @@ again: unmute_init++; stac_change_pin_config(codec, 0x0f, 0x40f000f0); stac_change_pin_config(codec, 0x19, 0x40f000f3); + stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; + spec->num_dmics = stac92hd71bxx_connected_ports(codec, + stac92hd71bxx_dmic_nids, + STAC92HD71BXX_NUM_DMICS - 1); + spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); + ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; break; case 0x111d7603: /* 6 Port with Analog Mixer */ if ((codec->revision_id & 0xf) == 1) @@ -5055,10 +5130,17 @@ again: spec->num_pwrs = 0; /* fallthru */ default: + memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, + sizeof(stac92hd71bxx_dmux_amixer)); spec->dinput_mux = &spec->private_dimux; spec->mixer = stac92hd71bxx_analog_mixer; spec->init = stac92hd71bxx_analog_core_init; codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; + spec->num_dmics = stac92hd71bxx_connected_ports(codec, + stac92hd71bxx_dmic_nids, + STAC92HD71BXX_NUM_DMICS); + spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); + ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; } if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) @@ -5071,13 +5153,12 @@ again: spec->digbeep_nid = 0x26; spec->mux_nids = stac92hd71bxx_mux_nids; spec->adc_nids = stac92hd71bxx_adc_nids; - spec->dmic_nids = stac92hd71bxx_dmic_nids; - spec->dmux_nids = stac92hd71bxx_dmux_nids; spec->smux_nids = stac92hd71bxx_smux_nids; spec->pwr_nids = stac92hd71bxx_pwr_nids; spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); + spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); switch (spec->board_config) { case STAC_HP_M4: @@ -5097,17 +5178,11 @@ again: spec->num_smuxes = 0; spec->num_dmuxes = 0; break; - default: - spec->num_dmics = STAC92HD71BXX_NUM_DMICS; - spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); - spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); }; spec->multiout.dac_nids = spec->dac_nids; if (spec->dinput_mux) - spec->private_dimux.num_items += - spec->num_dmics - - (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1); + spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; err = stac92xx_parse_auto_config(codec, 0x21, 0x23); if (!err) { -- cgit v1.2.3 From 29d4ab4d6e996ef4c71910c915611151c34f1c75 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 4 Feb 2009 11:37:27 -0500 Subject: ALSA: hda - Don't call stac92xx_parse_auto_config with wrong dig_in Don't use uneeded/wrong third parameter for stac92xx_parse_auto_config in patch_stac92hd71bxx (no SPDIF in). Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c36c1c0f9574..0b00110a5a02 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -5184,7 +5184,7 @@ again: if (spec->dinput_mux) spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; - err = stac92xx_parse_auto_config(codec, 0x21, 0x23); + err = stac92xx_parse_auto_config(codec, 0x21, 0); if (!err) { if (spec->board_config < 0) { printk(KERN_WARNING "hda_codec: No auto-config is " -- cgit v1.2.3 From 45c1d85bcc6438454d104966c30fd2497ae1cdd7 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Wed, 4 Feb 2009 17:49:41 -0500 Subject: ALSA: hda: Added stac378x digital slave out struct Added the ADATOut nid to a slave digital outs struct to allow output via the DigOut pin. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 0b00110a5a02..85dc642d1130 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -404,6 +404,10 @@ static hda_nid_t stac922x_mux_nids[2] = { 0x12, 0x13, }; +static hda_nid_t stac927x_slave_dig_outs[2] = { + 0x1f, 0, +}; + static hda_nid_t stac927x_adc_nids[3] = { 0x07, 0x08, 0x09 }; @@ -5320,6 +5324,7 @@ static int patch_stac927x(struct hda_codec *codec) return -ENOMEM; codec->spec = spec; + codec->slave_dig_outs = stac927x_slave_dig_outs; spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); spec->pin_nids = stac927x_pin_nids; spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, -- cgit v1.2.3 From 345d0b1964df83a6c3fff815fabd34e37265581f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 09:10:20 +0100 Subject: ALSA: hwdep - Make open callback optional Don't require the open callback as mandatory. Now all hwdeps ops can be optional. Signed-off-by: Takashi Iwai --- sound/core/hwdep.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 195cafc5a553..a70ee7f1ed98 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) if (hw == NULL) return -ENODEV; - if (!hw->ops.open) - return -ENXIO; - if (!try_module_get(hw->card->module)) return -EFAULT; @@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) err = -EBUSY; break; } + if (!hw->ops.open) { + err = 0; + break; + } err = hw->ops.open(hw, file); if (err >= 0) break; @@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) static int snd_hwdep_release(struct inode *inode, struct file * file) { - int err = -ENXIO; + int err = 0; struct snd_hwdep *hw = file->private_data; struct module *mod = hw->card->module; -- cgit v1.2.3 From 28b7e343ee63454d563a71d2d5f769fc297fd5ad Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 09:28:08 +0100 Subject: ALSA: Remove superfluous hwdep ops Remove NOP hwdep ops in sound drivers. Signed-off-by: Takashi Iwai --- sound/drivers/vx/vx_hwdep.c | 12 ------------ sound/pci/mixart/mixart_hwdep.c | 12 ------------ sound/pci/pcxhr/pcxhr_hwdep.c | 12 ------------ sound/pci/rme9652/hdsp.c | 9 --------- sound/pci/rme9652/hdspm.c | 9 --------- sound/synth/emux/emux_hwdep.c | 21 --------------------- sound/usb/usbmixer.c | 22 +--------------------- sound/usb/usx2y/usX2Yhwdep.c | 12 ------------ 8 files changed, 1 insertion(+), 108 deletions(-) (limited to 'sound') diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index 8d6362e2d4c9..46df8817c18f 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c @@ -119,16 +119,6 @@ void snd_vx_free_firmware(struct vx_core *chip) #else /* old style firmware loading */ -static int vx_hwdep_open(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - -static int vx_hwdep_release(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - static int vx_hwdep_dsp_status(struct snd_hwdep *hw, struct snd_hwdep_dsp_status *info) { @@ -243,8 +233,6 @@ int snd_vx_setup_firmware(struct vx_core *chip) hw->iface = SNDRV_HWDEP_IFACE_VX; hw->private_data = chip; - hw->ops.open = vx_hwdep_open; - hw->ops.release = vx_hwdep_release; hw->ops.dsp_status = vx_hwdep_dsp_status; hw->ops.dsp_load = vx_hwdep_dsp_load; hw->exclusive = 1; diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 3782b52bc0e8..fa4de985fc4c 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c @@ -581,16 +581,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx"); /* miXart hwdep interface id string */ #define SND_MIXART_HWDEP_ID "miXart Loader" -static int mixart_hwdep_open(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - -static int mixart_hwdep_release(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, struct snd_hwdep_dsp_status *info) { @@ -643,8 +633,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr) hw->iface = SNDRV_HWDEP_IFACE_MIXART; hw->private_data = mgr; - hw->ops.open = mixart_hwdep_open; - hw->ops.release = mixart_hwdep_release; hw->ops.dsp_status = mixart_hwdep_dsp_status; hw->ops.dsp_load = mixart_hwdep_dsp_load; hw->exclusive = 1; diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index 592743a298b0..17cb1233a903 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c @@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw, return 0; } -static int pcxhr_hwdep_open(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - -static int pcxhr_hwdep_release(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) { int err; @@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) hw->iface = SNDRV_HWDEP_IFACE_PCXHR; hw->private_data = mgr; - hw->ops.open = pcxhr_hwdep_open; - hw->ops.release = pcxhr_hwdep_release; hw->ops.dsp_status = pcxhr_hwdep_dsp_status; hw->ops.dsp_load = pcxhr_hwdep_dsp_load; hw->exclusive = 1; diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 44d0c15e2b71..2434609b2d35 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -4413,13 +4413,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream) return 0; } -static int snd_hdsp_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file) -{ - /* we have nothing to initialize but the call is required */ - return 0; -} - - /* helper functions for copying meter values */ static inline int copy_u32_le(void __user *dest, void __iomem *src) { @@ -4738,9 +4731,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp) hw->private_data = hdsp; strcpy(hw->name, "HDSP hwdep interface"); - hw->ops.open = snd_hdsp_hwdep_dummy_op; hw->ops.ioctl = snd_hdsp_hwdep_ioctl; - hw->ops.release = snd_hdsp_hwdep_dummy_op; return 0; } diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 71231cf1b2b0..df2034eb235d 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream) return 0; } -static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file) -{ - /* we have nothing to initialize but the call is required */ - return 0; -} - - static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg) { @@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card, hw->private_data = hdspm; strcpy(hw->name, "HDSPM hwdep interface"); - hw->ops.open = snd_hdspm_hwdep_dummy_op; hw->ops.ioctl = snd_hdspm_hwdep_ioctl; - hw->ops.release = snd_hdspm_hwdep_dummy_op; return 0; } diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c index 0a5391436add..ff0b2a8fd25b 100644 --- a/sound/synth/emux/emux_hwdep.c +++ b/sound/synth/emux/emux_hwdep.c @@ -24,25 +24,6 @@ #include #include "emux_voice.h" -/* - * open the hwdep device - */ -static int -snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - - -/* - * close the device - */ -static int -snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - #define TMP_CLIENT_ID 0x1001 @@ -146,8 +127,6 @@ snd_emux_init_hwdep(struct snd_emux *emu) emu->hwdep = hw; strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME); hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE; - hw->ops.open = snd_emux_hwdep_open; - hw->ops.release = snd_emux_hwdep_release; hw->ops.ioctl = snd_emux_hwdep_ioctl; hw->exclusive = 1; hw->private_data = emu; diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 00397c8a765b..2bde79216fa5 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -78,7 +78,6 @@ struct usb_mixer_interface { /* Sound Blaster remote control stuff */ const struct rc_config *rc_cfg; - unsigned long rc_hwdep_open; u32 rc_code; wait_queue_head_t rc_waitq; struct urb *rc_urb; @@ -1797,24 +1796,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb) wake_up(&mixer->rc_waitq); } -static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file) -{ - struct usb_mixer_interface *mixer = hw->private_data; - - if (test_and_set_bit(0, &mixer->rc_hwdep_open)) - return -EBUSY; - return 0; -} - -static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file) -{ - struct usb_mixer_interface *mixer = hw->private_data; - - clear_bit(0, &mixer->rc_hwdep_open); - smp_mb__after_clear_bit(); - return 0; -} - static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset) { @@ -1867,9 +1848,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; hwdep->private_data = mixer; hwdep->ops.read = snd_usb_sbrc_hwdep_read; - hwdep->ops.open = snd_usb_sbrc_hwdep_open; - hwdep->ops.release = snd_usb_sbrc_hwdep_release; hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; + hwdep->exclusive = 1; mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); if (!mixer->rc_urb) diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 1558a5c4094f..a26d8d83d3eb 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -106,16 +106,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, } -static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - -static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file) -{ - return 0; -} - static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, struct snd_hwdep_dsp_status *info) { @@ -267,8 +257,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) hw->iface = SNDRV_HWDEP_IFACE_USX2Y; hw->private_data = usX2Y(card); - hw->ops.open = snd_usX2Y_hwdep_open; - hw->ops.release = snd_usX2Y_hwdep_release; hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; hw->ops.mmap = snd_us428ctls_mmap; -- cgit v1.2.3 From 705350f8bd6b44fda3f0dcc3e6f4b453da4378dd Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:30 +0000 Subject: ALSA: snd-usb-caiaq: Send the correct command when setting controls Fixes a bug where an incorrect command was sent which had no effect on the device. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 6ac5489a0f22..1f9531d0fce4 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -94,7 +94,7 @@ static int control_put(struct snd_kcontrol *kcontrol, if (pos & CNT_INTVAL) { dev->control_state[pos & ~CNT_INTVAL] = ucontrol->value.integer.value[0]; - snd_usb_caiaq_send_command(dev, EP1_CMD_DIMM_LEDS, + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, dev->control_state, sizeof(dev->control_state)); } else { if (ucontrol->value.integer.value[0]) -- cgit v1.2.3 From e3ca4c9982e3b84da859ca20a3ca0a9d5bda8c30 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:31 +0000 Subject: ALSA: snd-usb-caiaq: Set default input mode of A4DJ Do not start the device with input mode undefined. Mimic the behaviour of the Audio 8 DJ and start in phono input mode. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-device.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index d09fc2a88cf3..94610dda8ab4 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -312,6 +312,12 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) } break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + /* Audio 4 DJ - default input mode to phono */ + dev->control_state[0] = 2; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, 1); + break; } if (dev->spec.num_analog_audio_out + -- cgit v1.2.3 From 9a9527ed49f45e75a5b005592a261ab2bd7c1b1d Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:32 +0000 Subject: ALSA: snd-usb-caiaq: Do not expose hardware input mode 0 of A4DJ In the context of the Audio 4 DJ (when compared to Audio 8 DJ), hardware input mode 0 is not used. Expose modes 1 (line) and 2 (phono) to the user as modes 0 and 1 respectively. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-control.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 1f9531d0fce4..136ef34300d1 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -44,16 +44,24 @@ static int control_info(struct snd_kcontrol *kcontrol, uinfo->count = 1; pos &= ~CNT_INTVAL; - if (((id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) || - (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ))) + if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) && (pos == 0)) { - /* current input mode of A8DJ and A4DJ */ + /* current input mode of A8DJ */ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; uinfo->value.integer.max = 2; return 0; } + if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ) + && (pos == 0)) { + /* current input mode of A4DJ */ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; + } + if (is_intval) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; @@ -74,6 +82,14 @@ static int control_get(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + ucontrol->value.integer.value[0] = dev->control_state[0] - 1; + return 0; + } + if (pos & CNT_INTVAL) ucontrol->value.integer.value[0] = dev->control_state[pos & ~CNT_INTVAL]; @@ -91,6 +107,16 @@ static int control_put(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + dev->control_state[0] = ucontrol->value.integer.value[0] + 1; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, sizeof(dev->control_state)); + return 1; + } + if (pos & CNT_INTVAL) { dev->control_state[pos & ~CNT_INTVAL] = ucontrol->value.integer.value[0]; -- cgit v1.2.3 From a8564155a9cb3b5c4a18afc451679a1f02c647b5 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:33 +0000 Subject: ALSA: snd-usb-caiaq: Remove duplicate A8DJ control Remove a duplicate control which causes an error when it is registered, and causes later controls to not be registered. The device does not have a fourth ground lift control. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-control.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 136ef34300d1..e92c2bbf4fe9 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -270,7 +270,6 @@ static struct caiaq_controller a8dj_controller[] = { { "GND lift for TC Vinyl mode", 24 + 0 }, { "GND lift for TC CD/Line mode", 24 + 1 }, { "GND lift for phono mode", 24 + 2 }, - { "GND lift for TC Vinyl mode", 24 + 3 }, { "Software lock", 40 } }; -- cgit v1.2.3 From 238c0270baade3a542c1497712dd8e66cc9cc476 Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Wed, 4 Feb 2009 22:34:34 +0000 Subject: ALSA: snd-usb-caiaq: Increase version number to 1.3.12 Indicates fixes affecting control messages and switching of input mode on Audio 8 DJ and Audio 4 DJ. Signed-off-by: Mark Hills Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 94610dda8ab4..5736669df2d5 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,7 +42,7 @@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.11"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.12"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," -- cgit v1.2.3 From 67f7857ab12e9f8005ef988f0b667396e07622c2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 12:14:52 +0100 Subject: ALSA: hda - Add quirk for HP zenith laptop Added model=laptop for another HP laptop (103c:3072) with AD1984A codec. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e934e2c187d0..6e348d03b716 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3890,6 +3890,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), + SND_PCI_QUIRK(0x103c, 0x3072, "HP", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), -- cgit v1.2.3 From 632da7321b7e9fa5375956280f8a0f380836c22d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:02:06 +0100 Subject: ALSA: hda - Add quirk for another HP laptop Add model=laptop entry for another HP laptop (103c:3077) with AD1984A. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 6e348d03b716..30399cbf8193 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3891,6 +3891,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), SND_PCI_QUIRK(0x103c, 0x3072, "HP", AD1884A_LAPTOP), + SND_PCI_QUIRK(0x103c, 0x3077, "HP", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), -- cgit v1.2.3 From e6161653094f14b1add10efe3493a2e526fe9538 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 5 Feb 2009 13:01:54 +0100 Subject: ALSA: snd_pcm_new api cleanup Impact: cleanup snd_pcm_new takes a char *id argument, although it is not modifying the string. it can therefore be declared as const char *id. Signed-off-by: Tim Blechmann Signed-off-by: Takashi Iwai --- include/sound/pcm.h | 2 +- sound/core/pcm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 40c5a6fa6bcd..ee0e887e49d4 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -451,7 +451,7 @@ struct snd_pcm_notify { extern const struct file_operations snd_pcm_f_ops[2]; -int snd_pcm_new(struct snd_card *card, char *id, int device, +int snd_pcm_new(struct snd_card *card, const char *id, int device, int playback_count, int capture_count, struct snd_pcm **rpcm); int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 192a433a2403..583453e2355c 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -692,7 +692,7 @@ EXPORT_SYMBOL(snd_pcm_new_stream); * * Returns zero if successful, or a negative error code on failure. */ -int snd_pcm_new(struct snd_card *card, char *id, int device, +int snd_pcm_new(struct snd_card *card, const char *id, int device, int playback_count, int capture_count, struct snd_pcm ** rpcm) { -- cgit v1.2.3 From e4967d6016b7785edafdb871e6d3e4426cb4bd1f Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 5 Feb 2009 13:10:59 +0100 Subject: ALSA: Add ALSA driver for Atmel Audio Bitstream DAC This patch adds ALSA support for the Audio Bistream DAC found on Atmel AVR32 devices. The ABDAC is an Atmel IP which might show up on AT91 devices in the future, hence making a generic driver which can be utilized by AT91 arch if needed. Datasheet describing the ABDAC peripheral is available in the AT32AP7000 datasheet, http://www.atmel.com/dyn/products/datasheets.asp?family_id=682 Tested on ATSTK1006 + ATSTK1000 with a class D amplifier stage. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- include/sound/atmel-abdac.h | 23 ++ sound/atmel/Kconfig | 11 + sound/atmel/Makefile | 3 + sound/atmel/abdac.c | 602 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 639 insertions(+) create mode 100644 include/sound/atmel-abdac.h create mode 100644 sound/atmel/Kconfig create mode 100644 sound/atmel/Makefile create mode 100644 sound/atmel/abdac.c (limited to 'sound') diff --git a/include/sound/atmel-abdac.h b/include/sound/atmel-abdac.h new file mode 100644 index 000000000000..edff6a8ba1b5 --- /dev/null +++ b/include/sound/atmel-abdac.h @@ -0,0 +1,23 @@ +/* + * Driver for the Atmel Audio Bitstream DAC (ABDAC) + * + * Copyright (C) 2009 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ +#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H +#define __INCLUDE_SOUND_ATMEL_ABDAC_H + +#include + +/** + * struct atmel_abdac_pdata - board specific ABDAC configuration + * @dws: DMA slave interface to use for sound playback. + */ +struct atmel_abdac_pdata { + struct dw_dma_slave dws; +}; + +#endif /* __INCLUDE_SOUND_ATMEL_ABDAC_H */ diff --git a/sound/atmel/Kconfig b/sound/atmel/Kconfig new file mode 100644 index 000000000000..715318e3670f --- /dev/null +++ b/sound/atmel/Kconfig @@ -0,0 +1,11 @@ +menu "Atmel devices (AVR32 and AT91)" + depends on AVR32 || ARCH_AT91 + +config SND_ATMEL_ABDAC + tristate "Atmel Audio Bitstream DAC (ABDAC) driver" + select SND_PCM + depends on DW_DMAC && AVR32 + help + ALSA sound driver for the Atmel Audio Bitstream DAC (ABDAC). + +endmenu diff --git a/sound/atmel/Makefile b/sound/atmel/Makefile new file mode 100644 index 000000000000..c5a8213f9cb9 --- /dev/null +++ b/sound/atmel/Makefile @@ -0,0 +1,3 @@ +snd-atmel-abdac-objs := abdac.o + +obj-$(CONFIG_SND_ATMEL_ABDAC) += snd-atmel-abdac.o diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c new file mode 100644 index 000000000000..28b3c7f7cfe6 --- /dev/null +++ b/sound/atmel/abdac.c @@ -0,0 +1,602 @@ +/* + * Driver for the Atmel on-chip Audio Bitstream DAC (ABDAC) + * + * Copyright (C) 2006-2009 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* DAC register offsets */ +#define DAC_DATA 0x0000 +#define DAC_CTRL 0x0008 +#define DAC_INT_MASK 0x000c +#define DAC_INT_EN 0x0010 +#define DAC_INT_DIS 0x0014 +#define DAC_INT_CLR 0x0018 +#define DAC_INT_STATUS 0x001c + +/* Bitfields in CTRL */ +#define DAC_SWAP_OFFSET 30 +#define DAC_SWAP_SIZE 1 +#define DAC_EN_OFFSET 31 +#define DAC_EN_SIZE 1 + +/* Bitfields in INT_MASK/INT_EN/INT_DIS/INT_STATUS/INT_CLR */ +#define DAC_UNDERRUN_OFFSET 28 +#define DAC_UNDERRUN_SIZE 1 +#define DAC_TX_READY_OFFSET 29 +#define DAC_TX_READY_SIZE 1 + +/* Bit manipulation macros */ +#define DAC_BIT(name) \ + (1 << DAC_##name##_OFFSET) +#define DAC_BF(name, value) \ + (((value) & ((1 << DAC_##name##_SIZE) - 1)) \ + << DAC_##name##_OFFSET) +#define DAC_BFEXT(name, value) \ + (((value) >> DAC_##name##_OFFSET) \ + & ((1 << DAC_##name##_SIZE) - 1)) +#define DAC_BFINS(name, value, old) \ + (((old) & ~(((1 << DAC_##name##_SIZE) - 1) \ + << DAC_##name##_OFFSET)) \ + | DAC_BF(name, value)) + +/* Register access macros */ +#define dac_readl(port, reg) \ + __raw_readl((port)->regs + DAC_##reg) +#define dac_writel(port, reg, value) \ + __raw_writel((value), (port)->regs + DAC_##reg) + +/* + * ABDAC supports a maximum of 6 different rates from a generic clock. The + * generic clock has a power of two divider, which gives 6 steps from 192 kHz + * to 5112 Hz. + */ +#define MAX_NUM_RATES 6 +/* ALSA seems to use rates between 192000 Hz and 5112 Hz. */ +#define RATE_MAX 192000 +#define RATE_MIN 5112 + +enum { + DMA_READY = 0, +}; + +struct atmel_abdac_dma { + struct dma_chan *chan; + struct dw_cyclic_desc *cdesc; +}; + +struct atmel_abdac { + struct clk *pclk; + struct clk *sample_clk; + struct platform_device *pdev; + struct atmel_abdac_dma dma; + + struct snd_pcm_hw_constraint_list constraints_rates; + struct snd_pcm_substream *substream; + struct snd_card *card; + struct snd_pcm *pcm; + + void __iomem *regs; + unsigned long flags; + unsigned int rates[MAX_NUM_RATES]; + unsigned int rates_num; + int irq; +}; + +#define get_dac(card) ((struct atmel_abdac *)(card)->private_data) + +/* This function is called by the DMA driver. */ +static void atmel_abdac_dma_period_done(void *arg) +{ + struct atmel_abdac *dac = arg; + snd_pcm_period_elapsed(dac->substream); +} + +static int atmel_abdac_prepare_dma(struct atmel_abdac *dac, + struct snd_pcm_substream *substream, + enum dma_data_direction direction) +{ + struct dma_chan *chan = dac->dma.chan; + struct dw_cyclic_desc *cdesc; + struct snd_pcm_runtime *runtime = substream->runtime; + unsigned long buffer_len, period_len; + + /* + * We don't do DMA on "complex" transfers, i.e. with + * non-halfword-aligned buffers or lengths. + */ + if (runtime->dma_addr & 1 || runtime->buffer_size & 1) { + dev_dbg(&dac->pdev->dev, "too complex transfer\n"); + return -EINVAL; + } + + buffer_len = frames_to_bytes(runtime, runtime->buffer_size); + period_len = frames_to_bytes(runtime, runtime->period_size); + + cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len, + period_len, DMA_TO_DEVICE); + if (IS_ERR(cdesc)) { + dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n"); + return PTR_ERR(cdesc); + } + + cdesc->period_callback = atmel_abdac_dma_period_done; + cdesc->period_callback_param = dac; + + dac->dma.cdesc = cdesc; + + set_bit(DMA_READY, &dac->flags); + + return 0; +} + +static struct snd_pcm_hardware atmel_abdac_hw = { + .info = (SNDRV_PCM_INFO_MMAP + | SNDRV_PCM_INFO_MMAP_VALID + | SNDRV_PCM_INFO_INTERLEAVED + | SNDRV_PCM_INFO_BLOCK_TRANSFER + | SNDRV_PCM_INFO_RESUME + | SNDRV_PCM_INFO_PAUSE), + .formats = (SNDRV_PCM_FMTBIT_S16_BE), + .rates = (SNDRV_PCM_RATE_KNOT), + .rate_min = RATE_MIN, + .rate_max = RATE_MAX, + .channels_min = 2, + .channels_max = 2, + .buffer_bytes_max = 64 * 4096, + .period_bytes_min = 4096, + .period_bytes_max = 4096, + .periods_min = 4, + .periods_max = 64, +}; + +static int atmel_abdac_open(struct snd_pcm_substream *substream) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + + dac->substream = substream; + atmel_abdac_hw.rate_max = dac->rates[dac->rates_num - 1]; + atmel_abdac_hw.rate_min = dac->rates[0]; + substream->runtime->hw = atmel_abdac_hw; + + return snd_pcm_hw_constraint_list(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &dac->constraints_rates); +} + +static int atmel_abdac_close(struct snd_pcm_substream *substream) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + dac->substream = NULL; + return 0; +} + +static int atmel_abdac_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + int retval; + + retval = snd_pcm_lib_malloc_pages(substream, + params_buffer_bytes(hw_params)); + if (retval < 0) + return retval; + /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */ + if (retval == 1) + if (test_and_clear_bit(DMA_READY, &dac->flags)) + dw_dma_cyclic_free(dac->dma.chan); + + return retval; +} + +static int atmel_abdac_hw_free(struct snd_pcm_substream *substream) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + if (test_and_clear_bit(DMA_READY, &dac->flags)) + dw_dma_cyclic_free(dac->dma.chan); + return snd_pcm_lib_free_pages(substream); +} + +static int atmel_abdac_prepare(struct snd_pcm_substream *substream) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + int retval; + + retval = clk_set_rate(dac->sample_clk, 256 * substream->runtime->rate); + if (retval) + return retval; + + if (!test_bit(DMA_READY, &dac->flags)) + retval = atmel_abdac_prepare_dma(dac, substream, DMA_TO_DEVICE); + + return retval; +} + +static int atmel_abdac_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + int retval = 0; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ + case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ + case SNDRV_PCM_TRIGGER_START: + clk_enable(dac->sample_clk); + retval = dw_dma_cyclic_start(dac->dma.chan); + if (retval) + goto out; + dac_writel(dac, CTRL, DAC_BIT(EN)); + break; + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ + case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ + case SNDRV_PCM_TRIGGER_STOP: + dw_dma_cyclic_stop(dac->dma.chan); + dac_writel(dac, DATA, 0); + dac_writel(dac, CTRL, 0); + clk_disable(dac->sample_clk); + break; + default: + retval = -EINVAL; + break; + } +out: + return retval; +} + +static snd_pcm_uframes_t +atmel_abdac_pointer(struct snd_pcm_substream *substream) +{ + struct atmel_abdac *dac = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t frames; + unsigned long bytes; + + bytes = dw_dma_get_src_addr(dac->dma.chan); + bytes -= runtime->dma_addr; + + frames = bytes_to_frames(runtime, bytes); + if (frames >= runtime->buffer_size) + frames -= runtime->buffer_size; + + return frames; +} + +static irqreturn_t abdac_interrupt(int irq, void *dev_id) +{ + struct atmel_abdac *dac = dev_id; + u32 status; + + status = dac_readl(dac, INT_STATUS); + if (status & DAC_BIT(UNDERRUN)) { + dev_err(&dac->pdev->dev, "underrun detected\n"); + dac_writel(dac, INT_CLR, DAC_BIT(UNDERRUN)); + } else { + dev_err(&dac->pdev->dev, "spurious interrupt (status=0x%x)\n", + status); + dac_writel(dac, INT_CLR, status); + } + + return IRQ_HANDLED; +} + +static struct snd_pcm_ops atmel_abdac_ops = { + .open = atmel_abdac_open, + .close = atmel_abdac_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = atmel_abdac_hw_params, + .hw_free = atmel_abdac_hw_free, + .prepare = atmel_abdac_prepare, + .trigger = atmel_abdac_trigger, + .pointer = atmel_abdac_pointer, +}; + +static int __devinit atmel_abdac_pcm_new(struct atmel_abdac *dac) +{ + struct snd_pcm_hardware hw = atmel_abdac_hw; + struct snd_pcm *pcm; + int retval; + + retval = snd_pcm_new(dac->card, dac->card->shortname, + dac->pdev->id, 1, 0, &pcm); + if (retval) + return retval; + + strcpy(pcm->name, dac->card->shortname); + pcm->private_data = dac; + pcm->info_flags = 0; + dac->pcm = pcm; + + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &atmel_abdac_ops); + + retval = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + &dac->pdev->dev, hw.periods_min * hw.period_bytes_min, + hw.buffer_bytes_max); + + return retval; +} + +static bool filter(struct dma_chan *chan, void *slave) +{ + struct dw_dma_slave *dws = slave; + + if (dws->dma_dev == chan->device->dev) { + chan->private = dws; + return true; + } else + return false; +} + +static int set_sample_rates(struct atmel_abdac *dac) +{ + long new_rate = RATE_MAX; + int retval = -EINVAL; + int index = 0; + + /* we start at 192 kHz and work our way down to 5112 Hz */ + while (new_rate >= RATE_MIN && index < (MAX_NUM_RATES + 1)) { + new_rate = clk_round_rate(dac->sample_clk, 256 * new_rate); + if (new_rate < 0) + break; + /* make sure we are below the ABDAC clock */ + if (new_rate <= clk_get_rate(dac->pclk)) { + dac->rates[index] = new_rate / 256; + index++; + } + /* divide by 256 and then by two to get next rate */ + new_rate /= 256 * 2; + } + + if (index) { + int i; + + /* reverse array, smallest go first */ + for (i = 0; i < (index / 2); i++) { + unsigned int tmp = dac->rates[index - 1 - i]; + dac->rates[index - 1 - i] = dac->rates[i]; + dac->rates[i] = tmp; + } + + dac->constraints_rates.count = index; + dac->constraints_rates.list = dac->rates; + dac->constraints_rates.mask = 0; + dac->rates_num = index; + + retval = 0; + } + + return retval; +} + +static int __devinit atmel_abdac_probe(struct platform_device *pdev) +{ + struct snd_card *card; + struct atmel_abdac *dac; + struct resource *regs; + struct atmel_abdac_pdata *pdata; + struct clk *pclk; + struct clk *sample_clk; + int retval; + int irq; + + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) { + dev_dbg(&pdev->dev, "no memory resource\n"); + return -ENXIO; + } + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_dbg(&pdev->dev, "could not get IRQ number\n"); + return irq; + } + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_dbg(&pdev->dev, "no platform data\n"); + return -ENXIO; + } + + pclk = clk_get(&pdev->dev, "pclk"); + if (IS_ERR(pclk)) { + dev_dbg(&pdev->dev, "no peripheral clock\n"); + return PTR_ERR(pclk); + } + sample_clk = clk_get(&pdev->dev, "sample_clk"); + if (IS_ERR(pclk)) { + dev_dbg(&pdev->dev, "no sample clock\n"); + retval = PTR_ERR(pclk); + goto out_put_pclk; + } + clk_enable(pclk); + + retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, + THIS_MODULE, sizeof(struct atmel_abdac), &card); + if (retval) { + dev_dbg(&pdev->dev, "could not create sound card device\n"); + goto out_put_sample_clk; + } + + dac = get_dac(card); + + dac->irq = irq; + dac->card = card; + dac->pclk = pclk; + dac->sample_clk = sample_clk; + dac->pdev = pdev; + + retval = set_sample_rates(dac); + if (retval < 0) { + dev_dbg(&pdev->dev, "could not set supported rates\n"); + goto out_free_card; + } + + dac->regs = ioremap(regs->start, regs->end - regs->start + 1); + if (!dac->regs) { + dev_dbg(&pdev->dev, "could not remap register memory\n"); + goto out_free_card; + } + + /* make sure the DAC is silent and disabled */ + dac_writel(dac, DATA, 0); + dac_writel(dac, CTRL, 0); + + retval = request_irq(irq, abdac_interrupt, 0, "abdac", dac); + if (retval) { + dev_dbg(&pdev->dev, "could not request irq\n"); + goto out_unmap_regs; + } + + snd_card_set_dev(card, &pdev->dev); + + if (pdata->dws.dma_dev) { + struct dw_dma_slave *dws = &pdata->dws; + dma_cap_mask_t mask; + + dws->tx_reg = regs->start + DAC_DATA; + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + + dac->dma.chan = dma_request_channel(mask, filter, dws); + } + if (!pdata->dws.dma_dev || !dac->dma.chan) { + dev_dbg(&pdev->dev, "DMA not available\n"); + retval = -ENODEV; + goto out_unset_card_dev; + } + + strcpy(card->driver, "Atmel ABDAC"); + strcpy(card->shortname, "Atmel ABDAC"); + sprintf(card->longname, "Atmel Audio Bitstream DAC"); + + retval = atmel_abdac_pcm_new(dac); + if (retval) { + dev_dbg(&pdev->dev, "could not register ABDAC pcm device\n"); + goto out_release_dma; + } + + retval = snd_card_register(card); + if (retval) { + dev_dbg(&pdev->dev, "could not register sound card\n"); + goto out_release_dma; + } + + platform_set_drvdata(pdev, card); + + dev_info(&pdev->dev, "Atmel ABDAC at 0x%p using %s\n", + dac->regs, dac->dma.chan->dev->device.bus_id); + + return retval; + +out_release_dma: + dma_release_channel(dac->dma.chan); + dac->dma.chan = NULL; +out_unset_card_dev: + snd_card_set_dev(card, NULL); + free_irq(irq, dac); +out_unmap_regs: + iounmap(dac->regs); +out_free_card: + snd_card_free(card); +out_put_sample_clk: + clk_put(sample_clk); + clk_disable(pclk); +out_put_pclk: + clk_put(pclk); + return retval; +} + +#ifdef CONFIG_PM +static int atmel_abdac_suspend(struct platform_device *pdev, pm_message_t msg) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct atmel_abdac *dac = card->private_data; + + dw_dma_cyclic_stop(dac->dma.chan); + clk_disable(dac->sample_clk); + clk_disable(dac->pclk); + + return 0; +} + +static int atmel_abdac_resume(struct platform_device *pdev) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct atmel_abdac *dac = card->private_data; + + clk_enable(dac->pclk); + clk_enable(dac->sample_clk); + if (test_bit(DMA_READY, &dac->flags)) + dw_dma_cyclic_start(dac->dma.chan); + + return 0; +} +#else +#define atmel_abdac_suspend NULL +#define atmel_abdac_resume NULL +#endif + +static int __devexit atmel_abdac_remove(struct platform_device *pdev) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct atmel_abdac *dac = get_dac(card); + + clk_put(dac->sample_clk); + clk_disable(dac->pclk); + clk_put(dac->pclk); + + dma_release_channel(dac->dma.chan); + dac->dma.chan = NULL; + snd_card_set_dev(card, NULL); + iounmap(dac->regs); + free_irq(dac->irq, dac); + snd_card_free(card); + + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static struct platform_driver atmel_abdac_driver = { + .remove = __devexit_p(atmel_abdac_remove), + .driver = { + .name = "atmel_abdac", + }, + .suspend = atmel_abdac_suspend, + .resume = atmel_abdac_resume, +}; + +static int __init atmel_abdac_init(void) +{ + return platform_driver_probe(&atmel_abdac_driver, + atmel_abdac_probe); +} +module_init(atmel_abdac_init); + +static void __exit atmel_abdac_exit(void) +{ + platform_driver_unregister(&atmel_abdac_driver); +} +module_exit(atmel_abdac_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Driver for Atmel Audio Bitstream DAC (ABDAC)"); +MODULE_AUTHOR("Hans-Christian Egtvedt "); -- cgit v1.2.3 From 4ede028f8716523fc31e0d3d01b81405613dfb8f Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 5 Feb 2009 13:11:00 +0100 Subject: ALSA: Add ALSA driver for Atmel AC97 controller This patch adds ALSA support for the AC97 controller found on Atmel AVR32 devices. Tested on ATSTK1006 + ATSTK1000 with a development board with a AC97 codec. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- include/sound/atmel-ac97c.h | 40 ++ sound/atmel/Kconfig | 8 + sound/atmel/Makefile | 2 + sound/atmel/ac97c.c | 932 ++++++++++++++++++++++++++++++++++++++++++++ sound/atmel/ac97c.h | 71 ++++ 5 files changed, 1053 insertions(+) create mode 100644 include/sound/atmel-ac97c.h create mode 100644 sound/atmel/ac97c.c create mode 100644 sound/atmel/ac97c.h (limited to 'sound') diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h new file mode 100644 index 000000000000..e6aabdb45865 --- /dev/null +++ b/include/sound/atmel-ac97c.h @@ -0,0 +1,40 @@ +/* + * Driver for the Atmel AC97C controller + * + * Copyright (C) 2005-2009 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ +#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H +#define __INCLUDE_SOUND_ATMEL_AC97C_H + +#include + +#define AC97C_CAPTURE 0x01 +#define AC97C_PLAYBACK 0x02 +#define AC97C_BOTH (AC97C_CAPTURE | AC97C_PLAYBACK) + +/** + * struct atmel_ac97c_pdata - board specific AC97C configuration + * @rx_dws: DMA slave interface to use for sound capture. + * @tx_dws: DMA slave interface to use for sound playback. + * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec, + * optional to use, set to -ENODEV if not in use. AC97 layer will + * try to do a software reset of the external codec anyway. + * @flags: Flags for which directions should be enabled. + * + * If the user do not want to use a DMA channel for playback or capture, i.e. + * only one feature is required on the board. The slave for playback or capture + * can be set to NULL. The AC97C driver will take use of this when setting up + * the sound streams. + */ +struct ac97c_platform_data { + struct dw_dma_slave rx_dws; + struct dw_dma_slave tx_dws; + unsigned int flags; + int reset_pin; +}; + +#endif /* __INCLUDE_SOUND_ATMEL_AC97C_H */ diff --git a/sound/atmel/Kconfig b/sound/atmel/Kconfig index 715318e3670f..6c228a91940d 100644 --- a/sound/atmel/Kconfig +++ b/sound/atmel/Kconfig @@ -8,4 +8,12 @@ config SND_ATMEL_ABDAC help ALSA sound driver for the Atmel Audio Bitstream DAC (ABDAC). +config SND_ATMEL_AC97C + tristate "Atmel AC97 Controller (AC97C) driver" + select SND_PCM + select SND_AC97_CODEC + depends on DW_DMAC && AVR32 + help + ALSA sound driver for the Atmel AC97 controller. + endmenu diff --git a/sound/atmel/Makefile b/sound/atmel/Makefile index c5a8213f9cb9..219dcfac6086 100644 --- a/sound/atmel/Makefile +++ b/sound/atmel/Makefile @@ -1,3 +1,5 @@ snd-atmel-abdac-objs := abdac.o +snd-atmel-ac97c-objs := ac97c.o obj-$(CONFIG_SND_ATMEL_ABDAC) += snd-atmel-abdac.o +obj-$(CONFIG_SND_ATMEL_AC97C) += snd-atmel-ac97c.o diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c new file mode 100644 index 000000000000..dd72e00e5ae1 --- /dev/null +++ b/sound/atmel/ac97c.c @@ -0,0 +1,932 @@ +/* + * Driver for the Atmel AC97C controller + * + * Copyright (C) 2005-2009 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "ac97c.h" + +enum { + DMA_TX_READY = 0, + DMA_RX_READY, + DMA_TX_CHAN_PRESENT, + DMA_RX_CHAN_PRESENT, +}; + +/* Serialize access to opened variable */ +static DEFINE_MUTEX(opened_mutex); + +struct atmel_ac97c_dma { + struct dma_chan *rx_chan; + struct dma_chan *tx_chan; +}; + +struct atmel_ac97c { + struct clk *pclk; + struct platform_device *pdev; + struct atmel_ac97c_dma dma; + + struct snd_pcm_substream *playback_substream; + struct snd_pcm_substream *capture_substream; + struct snd_card *card; + struct snd_pcm *pcm; + struct snd_ac97 *ac97; + struct snd_ac97_bus *ac97_bus; + + u64 cur_format; + unsigned int cur_rate; + unsigned long flags; + /* Serialize access to opened variable */ + spinlock_t lock; + void __iomem *regs; + int opened; + int reset_pin; +}; + +#define get_chip(card) ((struct atmel_ac97c *)(card)->private_data) + +#define ac97c_writel(chip, reg, val) \ + __raw_writel((val), (chip)->regs + AC97C_##reg) +#define ac97c_readl(chip, reg) \ + __raw_readl((chip)->regs + AC97C_##reg) + +/* This function is called by the DMA driver. */ +static void atmel_ac97c_dma_playback_period_done(void *arg) +{ + struct atmel_ac97c *chip = arg; + snd_pcm_period_elapsed(chip->playback_substream); +} + +static void atmel_ac97c_dma_capture_period_done(void *arg) +{ + struct atmel_ac97c *chip = arg; + snd_pcm_period_elapsed(chip->capture_substream); +} + +static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip, + struct snd_pcm_substream *substream, + enum dma_data_direction direction) +{ + struct dma_chan *chan; + struct dw_cyclic_desc *cdesc; + struct snd_pcm_runtime *runtime = substream->runtime; + unsigned long buffer_len, period_len; + + /* + * We don't do DMA on "complex" transfers, i.e. with + * non-halfword-aligned buffers or lengths. + */ + if (runtime->dma_addr & 1 || runtime->buffer_size & 1) { + dev_dbg(&chip->pdev->dev, "too complex transfer\n"); + return -EINVAL; + } + + if (direction == DMA_TO_DEVICE) + chan = chip->dma.tx_chan; + else + chan = chip->dma.rx_chan; + + buffer_len = frames_to_bytes(runtime, runtime->buffer_size); + period_len = frames_to_bytes(runtime, runtime->period_size); + + cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len, + period_len, direction); + if (IS_ERR(cdesc)) { + dev_dbg(&chip->pdev->dev, "could not prepare cyclic DMA\n"); + return PTR_ERR(cdesc); + } + + if (direction == DMA_TO_DEVICE) { + cdesc->period_callback = atmel_ac97c_dma_playback_period_done; + set_bit(DMA_TX_READY, &chip->flags); + } else { + cdesc->period_callback = atmel_ac97c_dma_capture_period_done; + set_bit(DMA_RX_READY, &chip->flags); + } + + cdesc->period_callback_param = chip; + + return 0; +} + +static struct snd_pcm_hardware atmel_ac97c_hw = { + .info = (SNDRV_PCM_INFO_MMAP + | SNDRV_PCM_INFO_MMAP_VALID + | SNDRV_PCM_INFO_INTERLEAVED + | SNDRV_PCM_INFO_BLOCK_TRANSFER + | SNDRV_PCM_INFO_JOINT_DUPLEX + | SNDRV_PCM_INFO_RESUME + | SNDRV_PCM_INFO_PAUSE), + .formats = (SNDRV_PCM_FMTBIT_S16_BE + | SNDRV_PCM_FMTBIT_S16_LE), + .rates = (SNDRV_PCM_RATE_CONTINUOUS), + .rate_min = 4000, + .rate_max = 48000, + .channels_min = 1, + .channels_max = 2, + .buffer_bytes_max = 64 * 4096, + .period_bytes_min = 4096, + .period_bytes_max = 4096, + .periods_min = 4, + .periods_max = 64, +}; + +static int atmel_ac97c_playback_open(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + + mutex_lock(&opened_mutex); + chip->opened++; + runtime->hw = atmel_ac97c_hw; + if (chip->cur_rate) { + runtime->hw.rate_min = chip->cur_rate; + runtime->hw.rate_max = chip->cur_rate; + } + if (chip->cur_format) + runtime->hw.formats = (1ULL << chip->cur_format); + mutex_unlock(&opened_mutex); + chip->playback_substream = substream; + return 0; +} + +static int atmel_ac97c_capture_open(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + + mutex_lock(&opened_mutex); + chip->opened++; + runtime->hw = atmel_ac97c_hw; + if (chip->cur_rate) { + runtime->hw.rate_min = chip->cur_rate; + runtime->hw.rate_max = chip->cur_rate; + } + if (chip->cur_format) + runtime->hw.formats = (1ULL << chip->cur_format); + mutex_unlock(&opened_mutex); + chip->capture_substream = substream; + return 0; +} + +static int atmel_ac97c_playback_close(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + + mutex_lock(&opened_mutex); + chip->opened--; + if (!chip->opened) { + chip->cur_rate = 0; + chip->cur_format = 0; + } + mutex_unlock(&opened_mutex); + + chip->playback_substream = NULL; + + return 0; +} + +static int atmel_ac97c_capture_close(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + + mutex_lock(&opened_mutex); + chip->opened--; + if (!chip->opened) { + chip->cur_rate = 0; + chip->cur_format = 0; + } + mutex_unlock(&opened_mutex); + + chip->capture_substream = NULL; + + return 0; +} + +static int atmel_ac97c_playback_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + int retval; + + retval = snd_pcm_lib_malloc_pages(substream, + params_buffer_bytes(hw_params)); + if (retval < 0) + return retval; + /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */ + if (retval == 1) + if (test_and_clear_bit(DMA_TX_READY, &chip->flags)) + dw_dma_cyclic_free(chip->dma.tx_chan); + + /* Set restrictions to params. */ + mutex_lock(&opened_mutex); + chip->cur_rate = params_rate(hw_params); + chip->cur_format = params_format(hw_params); + mutex_unlock(&opened_mutex); + + return retval; +} + +static int atmel_ac97c_capture_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + int retval; + + retval = snd_pcm_lib_malloc_pages(substream, + params_buffer_bytes(hw_params)); + if (retval < 0) + return retval; + /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */ + if (retval == 1) + if (test_and_clear_bit(DMA_RX_READY, &chip->flags)) + dw_dma_cyclic_free(chip->dma.rx_chan); + + /* Set restrictions to params. */ + mutex_lock(&opened_mutex); + chip->cur_rate = params_rate(hw_params); + chip->cur_format = params_format(hw_params); + mutex_unlock(&opened_mutex); + + return retval; +} + +static int atmel_ac97c_playback_hw_free(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + if (test_and_clear_bit(DMA_TX_READY, &chip->flags)) + dw_dma_cyclic_free(chip->dma.tx_chan); + return snd_pcm_lib_free_pages(substream); +} + +static int atmel_ac97c_capture_hw_free(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + if (test_and_clear_bit(DMA_RX_READY, &chip->flags)) + dw_dma_cyclic_free(chip->dma.rx_chan); + return snd_pcm_lib_free_pages(substream); +} + +static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + unsigned long word = 0; + int retval; + + /* assign channels to AC97C channel A */ + switch (runtime->channels) { + case 1: + word |= AC97C_CH_ASSIGN(PCM_LEFT, A); + break; + case 2: + word |= AC97C_CH_ASSIGN(PCM_LEFT, A) + | AC97C_CH_ASSIGN(PCM_RIGHT, A); + break; + default: + /* TODO: support more than two channels */ + return -EINVAL; + break; + } + ac97c_writel(chip, OCA, word); + + /* configure sample format and size */ + word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16; + + switch (runtime->format) { + case SNDRV_PCM_FORMAT_S16_LE: + word |= AC97C_CMR_CEM_LITTLE; + break; + case SNDRV_PCM_FORMAT_S16_BE: /* fall through */ + default: + word &= ~(AC97C_CMR_CEM_LITTLE); + break; + } + + ac97c_writel(chip, CAMR, word); + + /* set variable rate if needed */ + if (runtime->rate != 48000) { + word = ac97c_readl(chip, MR); + word |= AC97C_MR_VRA; + ac97c_writel(chip, MR, word); + } else { + word = ac97c_readl(chip, MR); + word &= ~(AC97C_MR_VRA); + ac97c_writel(chip, MR, word); + } + + retval = snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, + runtime->rate); + if (retval) + dev_dbg(&chip->pdev->dev, "could not set rate %d Hz\n", + runtime->rate); + + if (!test_bit(DMA_TX_READY, &chip->flags)) + retval = atmel_ac97c_prepare_dma(chip, substream, + DMA_TO_DEVICE); + + return retval; +} + +static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + unsigned long word = 0; + int retval; + + /* assign channels to AC97C channel A */ + switch (runtime->channels) { + case 1: + word |= AC97C_CH_ASSIGN(PCM_LEFT, A); + break; + case 2: + word |= AC97C_CH_ASSIGN(PCM_LEFT, A) + | AC97C_CH_ASSIGN(PCM_RIGHT, A); + break; + default: + /* TODO: support more than two channels */ + return -EINVAL; + break; + } + ac97c_writel(chip, ICA, word); + + /* configure sample format and size */ + word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16; + + switch (runtime->format) { + case SNDRV_PCM_FORMAT_S16_LE: + word |= AC97C_CMR_CEM_LITTLE; + break; + case SNDRV_PCM_FORMAT_S16_BE: /* fall through */ + default: + word &= ~(AC97C_CMR_CEM_LITTLE); + break; + } + + ac97c_writel(chip, CAMR, word); + + /* set variable rate if needed */ + if (runtime->rate != 48000) { + word = ac97c_readl(chip, MR); + word |= AC97C_MR_VRA; + ac97c_writel(chip, MR, word); + } else { + word = ac97c_readl(chip, MR); + word &= ~(AC97C_MR_VRA); + ac97c_writel(chip, MR, word); + } + + retval = snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE, + runtime->rate); + if (retval) + dev_dbg(&chip->pdev->dev, "could not set rate %d Hz\n", + runtime->rate); + + if (!test_bit(DMA_RX_READY, &chip->flags)) + retval = atmel_ac97c_prepare_dma(chip, substream, + DMA_FROM_DEVICE); + + return retval; +} + +static int +atmel_ac97c_playback_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + unsigned long camr; + int retval = 0; + + camr = ac97c_readl(chip, CAMR); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ + case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ + case SNDRV_PCM_TRIGGER_START: + retval = dw_dma_cyclic_start(chip->dma.tx_chan); + if (retval) + goto out; + camr |= AC97C_CMR_CENA; + break; + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ + case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ + case SNDRV_PCM_TRIGGER_STOP: + dw_dma_cyclic_stop(chip->dma.tx_chan); + if (chip->opened <= 1) + camr &= ~AC97C_CMR_CENA; + break; + default: + retval = -EINVAL; + goto out; + } + + ac97c_writel(chip, CAMR, camr); +out: + return retval; +} + +static int +atmel_ac97c_capture_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + unsigned long camr; + int retval = 0; + + camr = ac97c_readl(chip, CAMR); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ + case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ + case SNDRV_PCM_TRIGGER_START: + retval = dw_dma_cyclic_start(chip->dma.rx_chan); + if (retval) + goto out; + camr |= AC97C_CMR_CENA; + break; + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ + case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ + case SNDRV_PCM_TRIGGER_STOP: + dw_dma_cyclic_stop(chip->dma.rx_chan); + if (chip->opened <= 1) + camr &= ~AC97C_CMR_CENA; + break; + default: + retval = -EINVAL; + break; + } + + ac97c_writel(chip, CAMR, camr); +out: + return retval; +} + +static snd_pcm_uframes_t +atmel_ac97c_playback_pointer(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t frames; + unsigned long bytes; + + bytes = dw_dma_get_src_addr(chip->dma.tx_chan); + bytes -= runtime->dma_addr; + + frames = bytes_to_frames(runtime, bytes); + if (frames >= runtime->buffer_size) + frames -= runtime->buffer_size; + return frames; +} + +static snd_pcm_uframes_t +atmel_ac97c_capture_pointer(struct snd_pcm_substream *substream) +{ + struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t frames; + unsigned long bytes; + + bytes = dw_dma_get_dst_addr(chip->dma.rx_chan); + bytes -= runtime->dma_addr; + + frames = bytes_to_frames(runtime, bytes); + if (frames >= runtime->buffer_size) + frames -= runtime->buffer_size; + return frames; +} + +static struct snd_pcm_ops atmel_ac97_playback_ops = { + .open = atmel_ac97c_playback_open, + .close = atmel_ac97c_playback_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = atmel_ac97c_playback_hw_params, + .hw_free = atmel_ac97c_playback_hw_free, + .prepare = atmel_ac97c_playback_prepare, + .trigger = atmel_ac97c_playback_trigger, + .pointer = atmel_ac97c_playback_pointer, +}; + +static struct snd_pcm_ops atmel_ac97_capture_ops = { + .open = atmel_ac97c_capture_open, + .close = atmel_ac97c_capture_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = atmel_ac97c_capture_hw_params, + .hw_free = atmel_ac97c_capture_hw_free, + .prepare = atmel_ac97c_capture_prepare, + .trigger = atmel_ac97c_capture_trigger, + .pointer = atmel_ac97c_capture_pointer, +}; + +static int __devinit atmel_ac97c_pcm_new(struct atmel_ac97c *chip) +{ + struct snd_pcm *pcm; + struct snd_pcm_hardware hw = atmel_ac97c_hw; + int capture, playback, retval; + + capture = test_bit(DMA_RX_CHAN_PRESENT, &chip->flags); + playback = test_bit(DMA_TX_CHAN_PRESENT, &chip->flags); + + retval = snd_pcm_new(chip->card, chip->card->shortname, + chip->pdev->id, playback, capture, &pcm); + if (retval) + return retval; + + if (capture) + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, + &atmel_ac97_capture_ops); + if (playback) + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, + &atmel_ac97_playback_ops); + + retval = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + &chip->pdev->dev, hw.periods_min * hw.period_bytes_min, + hw.buffer_bytes_max); + if (retval) + return retval; + + pcm->private_data = chip; + pcm->info_flags = 0; + strcpy(pcm->name, chip->card->shortname); + chip->pcm = pcm; + + return 0; +} + +static int atmel_ac97c_mixer_new(struct atmel_ac97c *chip) +{ + struct snd_ac97_template template; + memset(&template, 0, sizeof(template)); + template.private_data = chip; + return snd_ac97_mixer(chip->ac97_bus, &template, &chip->ac97); +} + +static void atmel_ac97c_write(struct snd_ac97 *ac97, unsigned short reg, + unsigned short val) +{ + struct atmel_ac97c *chip = get_chip(ac97); + unsigned long word; + int timeout = 40; + + word = (reg & 0x7f) << 16 | val; + + do { + if (ac97c_readl(chip, COSR) & AC97C_CSR_TXRDY) { + ac97c_writel(chip, COTHR, word); + return; + } + udelay(1); + } while (--timeout); + + dev_dbg(&chip->pdev->dev, "codec write timeout\n"); +} + +static unsigned short atmel_ac97c_read(struct snd_ac97 *ac97, + unsigned short reg) +{ + struct atmel_ac97c *chip = get_chip(ac97); + unsigned long word; + int timeout = 40; + int write = 10; + + word = (0x80 | (reg & 0x7f)) << 16; + + if ((ac97c_readl(chip, COSR) & AC97C_CSR_RXRDY) != 0) + ac97c_readl(chip, CORHR); + +retry_write: + timeout = 40; + + do { + if ((ac97c_readl(chip, COSR) & AC97C_CSR_TXRDY) != 0) { + ac97c_writel(chip, COTHR, word); + goto read_reg; + } + udelay(10); + } while (--timeout); + + if (!--write) + goto timed_out; + goto retry_write; + +read_reg: + do { + if ((ac97c_readl(chip, COSR) & AC97C_CSR_RXRDY) != 0) { + unsigned short val = ac97c_readl(chip, CORHR); + return val; + } + udelay(10); + } while (--timeout); + + if (!--write) + goto timed_out; + goto retry_write; + +timed_out: + dev_dbg(&chip->pdev->dev, "codec read timeout\n"); + return 0xffff; +} + +static bool filter(struct dma_chan *chan, void *slave) +{ + struct dw_dma_slave *dws = slave; + + if (dws->dma_dev == chan->device->dev) { + chan->private = dws; + return true; + } else + return false; +} + +static void atmel_ac97c_reset(struct atmel_ac97c *chip) +{ + ac97c_writel(chip, MR, AC97C_MR_WRST); + + if (gpio_is_valid(chip->reset_pin)) { + gpio_set_value(chip->reset_pin, 0); + /* AC97 v2.2 specifications says minimum 1 us. */ + udelay(10); + gpio_set_value(chip->reset_pin, 1); + } + + udelay(1); + ac97c_writel(chip, MR, AC97C_MR_ENA); +} + +static int __devinit atmel_ac97c_probe(struct platform_device *pdev) +{ + struct snd_card *card; + struct atmel_ac97c *chip; + struct resource *regs; + struct ac97c_platform_data *pdata; + struct clk *pclk; + static struct snd_ac97_bus_ops ops = { + .write = atmel_ac97c_write, + .read = atmel_ac97c_read, + }; + int retval; + + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) { + dev_dbg(&pdev->dev, "no memory resource\n"); + return -ENXIO; + } + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_dbg(&pdev->dev, "no platform data\n"); + return -ENXIO; + } + + pclk = clk_get(&pdev->dev, "pclk"); + if (IS_ERR(pclk)) { + dev_dbg(&pdev->dev, "no peripheral clock\n"); + return PTR_ERR(pclk); + } + clk_enable(pclk); + + retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, + THIS_MODULE, sizeof(struct atmel_ac97c), &card); + if (retval) { + dev_dbg(&pdev->dev, "could not create sound card device\n"); + goto err_snd_card_new; + } + + chip = get_chip(card); + + spin_lock_init(&chip->lock); + + strcpy(card->driver, "Atmel AC97C"); + strcpy(card->shortname, "Atmel AC97C"); + sprintf(card->longname, "Atmel AC97 controller"); + + chip->card = card; + chip->pclk = pclk; + chip->pdev = pdev; + chip->regs = ioremap(regs->start, regs->end - regs->start + 1); + + if (!chip->regs) { + dev_dbg(&pdev->dev, "could not remap register memory\n"); + goto err_ioremap; + } + + if (gpio_is_valid(pdata->reset_pin)) { + if (gpio_request(pdata->reset_pin, "reset_pin")) { + dev_dbg(&pdev->dev, "reset pin not available\n"); + chip->reset_pin = -ENODEV; + } else { + gpio_direction_output(pdata->reset_pin, 1); + chip->reset_pin = pdata->reset_pin; + } + } + + snd_card_set_dev(card, &pdev->dev); + + retval = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus); + if (retval) { + dev_dbg(&pdev->dev, "could not register on ac97 bus\n"); + goto err_ac97_bus; + } + + atmel_ac97c_reset(chip); + + retval = atmel_ac97c_mixer_new(chip); + if (retval) { + dev_dbg(&pdev->dev, "could not register ac97 mixer\n"); + goto err_ac97_bus; + } + + if (pdata->rx_dws.dma_dev) { + struct dw_dma_slave *dws = &pdata->rx_dws; + dma_cap_mask_t mask; + + dws->rx_reg = regs->start + AC97C_CARHR + 2; + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + + chip->dma.rx_chan = dma_request_channel(mask, filter, dws); + + dev_info(&chip->pdev->dev, "using %s for DMA RX\n", + chip->dma.rx_chan->dev->device.bus_id); + set_bit(DMA_RX_CHAN_PRESENT, &chip->flags); + } + + if (pdata->tx_dws.dma_dev) { + struct dw_dma_slave *dws = &pdata->tx_dws; + dma_cap_mask_t mask; + + dws->tx_reg = regs->start + AC97C_CATHR + 2; + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + + chip->dma.tx_chan = dma_request_channel(mask, filter, dws); + + dev_info(&chip->pdev->dev, "using %s for DMA TX\n", + chip->dma.tx_chan->dev->device.bus_id); + set_bit(DMA_TX_CHAN_PRESENT, &chip->flags); + } + + if (!test_bit(DMA_RX_CHAN_PRESENT, &chip->flags) && + !test_bit(DMA_TX_CHAN_PRESENT, &chip->flags)) { + dev_dbg(&pdev->dev, "DMA not available\n"); + retval = -ENODEV; + goto err_dma; + } + + retval = atmel_ac97c_pcm_new(chip); + if (retval) { + dev_dbg(&pdev->dev, "could not register ac97 pcm device\n"); + goto err_dma; + } + + retval = snd_card_register(card); + if (retval) { + dev_dbg(&pdev->dev, "could not register sound card\n"); + goto err_ac97_bus; + } + + platform_set_drvdata(pdev, card); + + dev_info(&pdev->dev, "Atmel AC97 controller at 0x%p\n", + chip->regs); + + return 0; + +err_dma: + if (test_bit(DMA_RX_CHAN_PRESENT, &chip->flags)) + dma_release_channel(chip->dma.rx_chan); + if (test_bit(DMA_TX_CHAN_PRESENT, &chip->flags)) + dma_release_channel(chip->dma.tx_chan); + clear_bit(DMA_RX_CHAN_PRESENT, &chip->flags); + clear_bit(DMA_TX_CHAN_PRESENT, &chip->flags); + chip->dma.rx_chan = NULL; + chip->dma.tx_chan = NULL; +err_ac97_bus: + snd_card_set_dev(card, NULL); + + if (gpio_is_valid(chip->reset_pin)) + gpio_free(chip->reset_pin); + + iounmap(chip->regs); +err_ioremap: + snd_card_free(card); +err_snd_card_new: + clk_disable(pclk); + clk_put(pclk); + return retval; +} + +#ifdef CONFIG_PM +static int atmel_ac97c_suspend(struct platform_device *pdev, pm_message_t msg) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct atmel_ac97c *chip = card->private_data; + + if (test_bit(DMA_RX_READY, &chip->flags)) + dw_dma_cyclic_stop(chip->dma.rx_chan); + if (test_bit(DMA_TX_READY, &chip->flags)) + dw_dma_cyclic_stop(chip->dma.tx_chan); + clk_disable(chip->pclk); + + return 0; +} + +static int atmel_ac97c_resume(struct platform_device *pdev) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct atmel_ac97c *chip = card->private_data; + + clk_enable(chip->pclk); + if (test_bit(DMA_RX_READY, &chip->flags)) + dw_dma_cyclic_start(chip->dma.rx_chan); + if (test_bit(DMA_TX_READY, &chip->flags)) + dw_dma_cyclic_start(chip->dma.tx_chan); + + return 0; +} +#else +#define atmel_ac97c_suspend NULL +#define atmel_ac97c_resume NULL +#endif + +static int __devexit atmel_ac97c_remove(struct platform_device *pdev) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct atmel_ac97c *chip = get_chip(card); + + if (gpio_is_valid(chip->reset_pin)) + gpio_free(chip->reset_pin); + + clk_disable(chip->pclk); + clk_put(chip->pclk); + iounmap(chip->regs); + + if (test_bit(DMA_RX_CHAN_PRESENT, &chip->flags)) + dma_release_channel(chip->dma.rx_chan); + if (test_bit(DMA_TX_CHAN_PRESENT, &chip->flags)) + dma_release_channel(chip->dma.tx_chan); + clear_bit(DMA_RX_CHAN_PRESENT, &chip->flags); + clear_bit(DMA_TX_CHAN_PRESENT, &chip->flags); + chip->dma.rx_chan = NULL; + chip->dma.tx_chan = NULL; + + snd_card_set_dev(card, NULL); + snd_card_free(card); + + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static struct platform_driver atmel_ac97c_driver = { + .remove = __devexit_p(atmel_ac97c_remove), + .driver = { + .name = "atmel_ac97c", + }, + .suspend = atmel_ac97c_suspend, + .resume = atmel_ac97c_resume, +}; + +static int __init atmel_ac97c_init(void) +{ + return platform_driver_probe(&atmel_ac97c_driver, + atmel_ac97c_probe); +} +module_init(atmel_ac97c_init); + +static void __exit atmel_ac97c_exit(void) +{ + platform_driver_unregister(&atmel_ac97c_driver); +} +module_exit(atmel_ac97c_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Driver for Atmel AC97 controller"); +MODULE_AUTHOR("Hans-Christian Egtvedt "); diff --git a/sound/atmel/ac97c.h b/sound/atmel/ac97c.h new file mode 100644 index 000000000000..c17bd5825980 --- /dev/null +++ b/sound/atmel/ac97c.h @@ -0,0 +1,71 @@ +/* + * Register definitions for the Atmel AC97C controller + * + * Copyright (C) 2005-2009 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ +#ifndef __SOUND_ATMEL_AC97C_H +#define __SOUND_ATMEL_AC97C_H + +#define AC97C_MR 0x08 +#define AC97C_ICA 0x10 +#define AC97C_OCA 0x14 +#define AC97C_CARHR 0x20 +#define AC97C_CATHR 0x24 +#define AC97C_CASR 0x28 +#define AC97C_CAMR 0x2c +#define AC97C_CBRHR 0x30 +#define AC97C_CBTHR 0x34 +#define AC97C_CBSR 0x38 +#define AC97C_CBMR 0x3c +#define AC97C_CORHR 0x40 +#define AC97C_COTHR 0x44 +#define AC97C_COSR 0x48 +#define AC97C_COMR 0x4c +#define AC97C_SR 0x50 +#define AC97C_IER 0x54 +#define AC97C_IDR 0x58 +#define AC97C_IMR 0x5c +#define AC97C_VERSION 0xfc + +#define AC97C_CATPR PDC_TPR +#define AC97C_CATCR PDC_TCR +#define AC97C_CATNPR PDC_TNPR +#define AC97C_CATNCR PDC_TNCR +#define AC97C_CARPR PDC_RPR +#define AC97C_CARCR PDC_RCR +#define AC97C_CARNPR PDC_RNPR +#define AC97C_CARNCR PDC_RNCR +#define AC97C_PTCR PDC_PTCR + +#define AC97C_MR_ENA (1 << 0) +#define AC97C_MR_WRST (1 << 1) +#define AC97C_MR_VRA (1 << 2) + +#define AC97C_CSR_TXRDY (1 << 0) +#define AC97C_CSR_UNRUN (1 << 2) +#define AC97C_CSR_RXRDY (1 << 4) +#define AC97C_CSR_ENDTX (1 << 10) +#define AC97C_CSR_ENDRX (1 << 14) + +#define AC97C_CMR_SIZE_20 (0 << 16) +#define AC97C_CMR_SIZE_18 (1 << 16) +#define AC97C_CMR_SIZE_16 (2 << 16) +#define AC97C_CMR_SIZE_10 (3 << 16) +#define AC97C_CMR_CEM_LITTLE (1 << 18) +#define AC97C_CMR_CEM_BIG (0 << 18) +#define AC97C_CMR_CENA (1 << 21) +#define AC97C_CMR_DMAEN (1 << 22) + +#define AC97C_SR_CAEVT (1 << 3) + +#define AC97C_CH_ASSIGN(slot, channel) \ + (AC97C_CHANNEL_##channel << (3 * (AC97_SLOT_##slot - 3))) +#define AC97C_CHANNEL_NONE 0x0 +#define AC97C_CHANNEL_A 0x1 +#define AC97C_CHANNEL_B 0x2 + +#endif /* __SOUND_ATMEL_AC97C_H */ -- cgit v1.2.3 From 6c7578bb0a631d018a68e5f90554f29fbd928055 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 5 Feb 2009 13:11:01 +0100 Subject: ALSA: Add Atmel ALSA drivers directory Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Haavard Skinnemoen Signed-off-by: Takashi Iwai --- sound/Kconfig | 2 ++ sound/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/Kconfig b/sound/Kconfig index 200aca1faa71..1eceb85287c5 100644 --- a/sound/Kconfig +++ b/sound/Kconfig @@ -60,6 +60,8 @@ source "sound/aoa/Kconfig" source "sound/arm/Kconfig" +source "sound/atmel/Kconfig" + source "sound/spi/Kconfig" source "sound/mips/Kconfig" diff --git a/sound/Makefile b/sound/Makefile index c76d70716fa5..ec467decfa79 100644 --- a/sound/Makefile +++ b/sound/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_SOUND_PRIME) += sound_firmware.o obj-$(CONFIG_SOUND_PRIME) += oss/ obj-$(CONFIG_DMASOUND) += oss/ obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \ - sparc/ spi/ parisc/ pcmcia/ mips/ soc/ + sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ obj-$(CONFIG_SND_AOA) += aoa/ # This one must be compilable even if sound is configured out -- cgit v1.2.3 From 76d498e43fa5f9f0a148dca8915cc7e9d9b9a643 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:45:05 +0100 Subject: ALSA: wss - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 76 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 23 deletions(-) (limited to 'sound') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 3d6c5f2838af..8de5deda7ad6 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -219,7 +219,8 @@ void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char value) snd_wss_wait(chip); #ifdef CONFIG_SND_DEBUG if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) - snd_printk("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); + snd_printk(KERN_DEBUG "out: auto calibration time out " + "- reg = 0x%x, value = 0x%x\n", reg, value); #endif wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); wss_outb(chip, CS4231P(REG), value); @@ -235,7 +236,8 @@ unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg) snd_wss_wait(chip); #ifdef CONFIG_SND_DEBUG if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) - snd_printk("in: auto calibration time out - reg = 0x%x\n", reg); + snd_printk(KERN_DEBUG "in: auto calibration time out " + "- reg = 0x%x\n", reg); #endif wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); mb(); @@ -252,7 +254,7 @@ void snd_cs4236_ext_out(struct snd_wss *chip, unsigned char reg, wss_outb(chip, CS4231P(REG), val); chip->eimage[CS4236_REG(reg)] = val; #if 0 - printk("ext out : reg = 0x%x, val = 0x%x\n", reg, val); + printk(KERN_DEBUG "ext out : reg = 0x%x, val = 0x%x\n", reg, val); #endif } EXPORT_SYMBOL(snd_cs4236_ext_out); @@ -268,7 +270,8 @@ unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg) { unsigned char res; res = wss_inb(chip, CS4231P(REG)); - printk("ext in : reg = 0x%x, val = 0x%x\n", reg, res); + printk(KERN_DEBUG "ext in : reg = 0x%x, val = 0x%x\n", + reg, res); return res; } #endif @@ -394,13 +397,16 @@ void snd_wss_mce_up(struct snd_wss *chip) snd_wss_wait(chip); #ifdef CONFIG_SND_DEBUG if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) - snd_printk("mce_up - auto calibration time out (0)\n"); + snd_printk(KERN_DEBUG + "mce_up - auto calibration time out (0)\n"); #endif spin_lock_irqsave(&chip->reg_lock, flags); chip->mce_bit |= CS4231_MCE; timeout = wss_inb(chip, CS4231P(REGSEL)); if (timeout == 0x80) - snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk(KERN_DEBUG "mce_up [0x%lx]: " + "serious init problem - codec still busy\n", + chip->port); if (!(timeout & CS4231_MCE)) wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); @@ -419,7 +425,9 @@ void snd_wss_mce_down(struct snd_wss *chip) #ifdef CONFIG_SND_DEBUG if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) - snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", (long)CS4231P(REGSEL)); + snd_printk(KERN_DEBUG "mce_down [0x%lx] - " + "auto calibration time out (0)\n", + (long)CS4231P(REGSEL)); #endif spin_lock_irqsave(&chip->reg_lock, flags); chip->mce_bit &= ~CS4231_MCE; @@ -427,7 +435,9 @@ void snd_wss_mce_down(struct snd_wss *chip) wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); spin_unlock_irqrestore(&chip->reg_lock, flags); if (timeout == 0x80) - snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk(KERN_DEBUG "mce_down [0x%lx]: " + "serious init problem - codec still busy\n", + chip->port); if ((timeout & CS4231_MCE) == 0 || !(chip->hardware & hw_mask)) return; @@ -565,7 +575,7 @@ static unsigned char snd_wss_get_format(struct snd_wss *chip, if (channels > 1) rformat |= CS4231_STEREO; #if 0 - snd_printk("get_format: 0x%x (mode=0x%x)\n", format, mode); + snd_printk(KERN_DEBUG "get_format: 0x%x (mode=0x%x)\n", format, mode); #endif return rformat; } @@ -774,7 +784,7 @@ static void snd_wss_init(struct snd_wss *chip) snd_wss_mce_down(chip); #ifdef SNDRV_DEBUG_MCE - snd_printk("init: (1)\n"); + snd_printk(KERN_DEBUG "init: (1)\n"); #endif snd_wss_mce_up(chip); spin_lock_irqsave(&chip->reg_lock, flags); @@ -789,7 +799,7 @@ static void snd_wss_init(struct snd_wss *chip) snd_wss_mce_down(chip); #ifdef SNDRV_DEBUG_MCE - snd_printk("init: (2)\n"); + snd_printk(KERN_DEBUG "init: (2)\n"); #endif snd_wss_mce_up(chip); @@ -800,7 +810,7 @@ static void snd_wss_init(struct snd_wss *chip) snd_wss_mce_down(chip); #ifdef SNDRV_DEBUG_MCE - snd_printk("init: (3) - afei = 0x%x\n", + snd_printk(KERN_DEBUG "init: (3) - afei = 0x%x\n", chip->image[CS4231_ALT_FEATURE_1]); #endif @@ -817,7 +827,7 @@ static void snd_wss_init(struct snd_wss *chip) snd_wss_mce_down(chip); #ifdef SNDRV_DEBUG_MCE - snd_printk("init: (4)\n"); + snd_printk(KERN_DEBUG "init: (4)\n"); #endif snd_wss_mce_up(chip); @@ -829,7 +839,7 @@ static void snd_wss_init(struct snd_wss *chip) snd_wss_mce_down(chip); #ifdef SNDRV_DEBUG_MCE - snd_printk("init: (5)\n"); + snd_printk(KERN_DEBUG "init: (5)\n"); #endif } @@ -1278,7 +1288,8 @@ static int snd_wss_probe(struct snd_wss *chip) } else if (rev == 0x03) { chip->hardware = WSS_HW_CS4236B; } else { - snd_printk("unknown CS chip with version 0x%x\n", rev); + snd_printk(KERN_ERR + "unknown CS chip with version 0x%x\n", rev); return -ENODEV; /* unknown CS4231 chip? */ } } @@ -1342,7 +1353,10 @@ static int snd_wss_probe(struct snd_wss *chip) case 6: break; default: - snd_printk("unknown CS4235 chip (enhanced version = 0x%x)\n", id); + snd_printk(KERN_WARNING + "unknown CS4235 chip " + "(enhanced version = 0x%x)\n", + id); } } else if ((id & 0x1f) == 0x0b) { /* CS4236/B */ switch (id >> 5) { @@ -1353,7 +1367,10 @@ static int snd_wss_probe(struct snd_wss *chip) chip->hardware = WSS_HW_CS4236B; break; default: - snd_printk("unknown CS4236 chip (enhanced version = 0x%x)\n", id); + snd_printk(KERN_WARNING + "unknown CS4236 chip " + "(enhanced version = 0x%x)\n", + id); } } else if ((id & 0x1f) == 0x08) { /* CS4237B */ chip->hardware = WSS_HW_CS4237B; @@ -1364,7 +1381,10 @@ static int snd_wss_probe(struct snd_wss *chip) case 7: break; default: - snd_printk("unknown CS4237B chip (enhanced version = 0x%x)\n", id); + snd_printk(KERN_WARNING + "unknown CS4237B chip " + "(enhanced version = 0x%x)\n", + id); } } else if ((id & 0x1f) == 0x09) { /* CS4238B */ chip->hardware = WSS_HW_CS4238B; @@ -1374,7 +1394,10 @@ static int snd_wss_probe(struct snd_wss *chip) case 7: break; default: - snd_printk("unknown CS4238B chip (enhanced version = 0x%x)\n", id); + snd_printk(KERN_WARNING + "unknown CS4238B chip " + "(enhanced version = 0x%x)\n", + id); } } else if ((id & 0x1f) == 0x1e) { /* CS4239 */ chip->hardware = WSS_HW_CS4239; @@ -1384,10 +1407,15 @@ static int snd_wss_probe(struct snd_wss *chip) case 6: break; default: - snd_printk("unknown CS4239 chip (enhanced version = 0x%x)\n", id); + snd_printk(KERN_WARNING + "unknown CS4239 chip " + "(enhanced version = 0x%x)\n", + id); } } else { - snd_printk("unknown CS4236/CS423xB chip (enhanced version = 0x%x)\n", id); + snd_printk(KERN_WARNING + "unknown CS4236/CS423xB chip " + "(enhanced version = 0x%x)\n", id); } } } @@ -1618,7 +1646,8 @@ static void snd_wss_resume(struct snd_wss *chip) wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); spin_unlock_irqrestore(&chip->reg_lock, flags); if (timeout == 0x80) - snd_printk("down [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk(KERN_ERR "down [0x%lx]: serious init problem " + "- codec still busy\n", chip->port); if ((timeout & CS4231_MCE) == 0 || !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { return; @@ -1820,7 +1849,8 @@ int snd_wss_create(struct snd_card *card, #if 0 if (chip->hardware & WSS_HW_CS4232_MASK) { if (chip->res_cport == NULL) - snd_printk("CS4232 control port features are not accessible\n"); + snd_printk(KERN_ERR "CS4232 control port features are " + "not accessible\n"); } #endif -- cgit v1.2.3 From 91f050604cc045a0b7aa0460d36eb6e0f0cb301a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:46:48 +0100 Subject: ALSA: gus - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_dma.c | 3 ++- sound/isa/gus/gus_irq.c | 6 ++++-- sound/isa/gus/gus_pcm.c | 26 ++++++++++++++++++++------ sound/isa/gus/gus_uart.c | 10 ++++++++-- sound/isa/gus/interwave.c | 16 +++++++++------- 5 files changed, 43 insertions(+), 18 deletions(-) (limited to 'sound') diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index cf8cd3c26a55..36c27c832360 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c @@ -78,7 +78,8 @@ static void snd_gf1_dma_program(struct snd_gus_card * gus, snd_gf1_dma_ack(gus); snd_dma_program(gus->gf1.dma1, buf_addr, count, dma_cmd & SNDRV_GF1_DMA_READ ? DMA_MODE_READ : DMA_MODE_WRITE); #if 0 - snd_printk("address = 0x%x, count = 0x%x, dma_cmd = 0x%x\n", address << 1, count, dma_cmd); + snd_printk(KERN_DEBUG "address = 0x%x, count = 0x%x, dma_cmd = 0x%x\n", + address << 1, count, dma_cmd); #endif spin_lock_irqsave(&gus->reg_lock, flags); if (gus->gf1.enh_mode) { diff --git a/sound/isa/gus/gus_irq.c b/sound/isa/gus/gus_irq.c index 041894ddd014..2055aff71b50 100644 --- a/sound/isa/gus/gus_irq.c +++ b/sound/isa/gus/gus_irq.c @@ -41,7 +41,7 @@ __again: if (status == 0) return IRQ_RETVAL(handled); handled = 1; - // snd_printk("IRQ: status = 0x%x\n", status); + /* snd_printk(KERN_DEBUG "IRQ: status = 0x%x\n", status); */ if (status & 0x02) { STAT_ADD(gus->gf1.interrupt_stat_midi_in); if (gus->gf1.interrupt_handler_midi_in) @@ -65,7 +65,9 @@ __again: continue; /* multi request */ already |= _current_; /* mark request */ #if 0 - printk("voice = %i, voice_status = 0x%x, voice_verify = %i\n", voice, voice_status, inb(GUSP(gus, GF1PAGE))); + printk(KERN_DEBUG "voice = %i, voice_status = 0x%x, " + "voice_verify = %i\n", + voice, voice_status, inb(GUSP(gus, GF1PAGE))); #endif pvoice = &gus->gf1.voices[voice]; if (pvoice->use) { diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index 38510aeb21c6..edb11eefdfe3 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -82,7 +82,10 @@ static int snd_gf1_pcm_block_change(struct snd_pcm_substream *substream, count += offset & 31; offset &= ~31; - // snd_printk("block change - offset = 0x%x, count = 0x%x\n", offset, count); + /* + snd_printk(KERN_DEBUG "block change - offset = 0x%x, count = 0x%x\n", + offset, count); + */ memset(&block, 0, sizeof(block)); block.cmd = SNDRV_GF1_DMA_IRQ; if (snd_pcm_format_unsigned(runtime->format)) @@ -135,7 +138,11 @@ static void snd_gf1_pcm_trigger_up(struct snd_pcm_substream *substream) curr = begin + (pcmp->bpos * pcmp->block_size) / runtime->channels; end = curr + (pcmp->block_size / runtime->channels); end -= snd_pcm_format_width(runtime->format) == 16 ? 2 : 1; - // snd_printk("init: curr=0x%x, begin=0x%x, end=0x%x, ctrl=0x%x, ramp=0x%x, rate=0x%x\n", curr, begin, end, voice_ctrl, ramp_ctrl, rate); + /* + snd_printk(KERN_DEBUG "init: curr=0x%x, begin=0x%x, end=0x%x, " + "ctrl=0x%x, ramp=0x%x, rate=0x%x\n", + curr, begin, end, voice_ctrl, ramp_ctrl, rate); + */ pan = runtime->channels == 2 ? (!voice ? 1 : 14) : 8; vol = !voice ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right; spin_lock_irqsave(&gus->reg_lock, flags); @@ -205,9 +212,11 @@ static void snd_gf1_pcm_interrupt_wave(struct snd_gus_card * gus, ramp_ctrl = (snd_gf1_read8(gus, SNDRV_GF1_VB_VOLUME_CONTROL) & ~0xa4) | 0x03; #if 0 snd_gf1_select_voice(gus, pvoice->number); - printk("position = 0x%x\n", (snd_gf1_read_addr(gus, SNDRV_GF1_VA_CURRENT, voice_ctrl & 4) >> 4)); + printk(KERN_DEBUG "position = 0x%x\n", + (snd_gf1_read_addr(gus, SNDRV_GF1_VA_CURRENT, voice_ctrl & 4) >> 4)); snd_gf1_select_voice(gus, pcmp->pvoices[1]->number); - printk("position = 0x%x\n", (snd_gf1_read_addr(gus, SNDRV_GF1_VA_CURRENT, voice_ctrl & 4) >> 4)); + printk(KERN_DEBUG "position = 0x%x\n", + (snd_gf1_read_addr(gus, SNDRV_GF1_VA_CURRENT, voice_ctrl & 4) >> 4)); snd_gf1_select_voice(gus, pvoice->number); #endif pcmp->bpos++; @@ -299,7 +308,11 @@ static int snd_gf1_pcm_poke_block(struct snd_gus_card *gus, unsigned char *buf, unsigned int len; unsigned long flags; - // printk("poke block; buf = 0x%x, pos = %i, count = %i, port = 0x%x\n", (int)buf, pos, count, gus->gf1.port); + /* + printk(KERN_DEBUG + "poke block; buf = 0x%x, pos = %i, count = %i, port = 0x%x\n", + (int)buf, pos, count, gus->gf1.port); + */ while (count > 0) { len = count; if (len > 512) /* limit, to allow IRQ */ @@ -680,7 +693,8 @@ static int snd_gf1_pcm_playback_open(struct snd_pcm_substream *substream) runtime->private_free = snd_gf1_pcm_playback_free; #if 0 - printk("playback.buffer = 0x%lx, gf1.pcm_buffer = 0x%lx\n", (long) pcm->playback.buffer, (long) gus->gf1.pcm_buffer); + printk(KERN_DEBUG "playback.buffer = 0x%lx, gf1.pcm_buffer = 0x%lx\n", + (long) pcm->playback.buffer, (long) gus->gf1.pcm_buffer); #endif if ((err = snd_gf1_dma_init(gus)) < 0) return err; diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c index f0af3f79b08b..21cc42e4c4be 100644 --- a/sound/isa/gus/gus_uart.c +++ b/sound/isa/gus/gus_uart.c @@ -129,8 +129,14 @@ static int snd_gf1_uart_input_open(struct snd_rawmidi_substream *substream) } spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); #if 0 - snd_printk("read init - enable = %i, cmd = 0x%x, stat = 0x%x\n", gus->uart_enable, gus->gf1.uart_cmd, snd_gf1_uart_stat(gus)); - snd_printk("[0x%x] reg (ctrl/status) = 0x%x, reg (data) = 0x%x (page = 0x%x)\n", gus->gf1.port + 0x100, inb(gus->gf1.port + 0x100), inb(gus->gf1.port + 0x101), inb(gus->gf1.port + 0x102)); + snd_printk(KERN_DEBUG + "read init - enable = %i, cmd = 0x%x, stat = 0x%x\n", + gus->uart_enable, gus->gf1.uart_cmd, snd_gf1_uart_stat(gus)); + snd_printk(KERN_DEBUG + "[0x%x] reg (ctrl/status) = 0x%x, reg (data) = 0x%x " + "(page = 0x%x)\n", + gus->gf1.port + 0x100, inb(gus->gf1.port + 0x100), + inb(gus->gf1.port + 0x101), inb(gus->gf1.port + 0x102)); #endif return 0; } diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 5faecfb602d3..418d49eef926 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -170,7 +170,7 @@ static void snd_interwave_i2c_setlines(struct snd_i2c_bus *bus, int ctrl, int da unsigned long port = bus->private_value; #if 0 - printk("i2c_setlines - 0x%lx <- %i,%i\n", port, ctrl, data); + printk(KERN_DEBUG "i2c_setlines - 0x%lx <- %i,%i\n", port, ctrl, data); #endif outb((data << 1) | ctrl, port); udelay(10); @@ -183,7 +183,7 @@ static int snd_interwave_i2c_getclockline(struct snd_i2c_bus *bus) res = inb(port) & 1; #if 0 - printk("i2c_getclockline - 0x%lx -> %i\n", port, res); + printk(KERN_DEBUG "i2c_getclockline - 0x%lx -> %i\n", port, res); #endif return res; } @@ -197,7 +197,7 @@ static int snd_interwave_i2c_getdataline(struct snd_i2c_bus *bus, int ack) udelay(10); res = (inb(port) & 2) >> 1; #if 0 - printk("i2c_getdataline - 0x%lx -> %i\n", port, res); + printk(KERN_DEBUG "i2c_getdataline - 0x%lx -> %i\n", port, res); #endif return res; } @@ -342,7 +342,8 @@ static void __devinit snd_interwave_bank_sizes(struct snd_gus_card * gus, int *s snd_gf1_poke(gus, local, d); snd_gf1_poke(gus, local + 1, d + 1); #if 0 - printk("d = 0x%x, local = 0x%x, local + 1 = 0x%x, idx << 22 = 0x%x\n", + printk(KERN_DEBUG "d = 0x%x, local = 0x%x, " + "local + 1 = 0x%x, idx << 22 = 0x%x\n", d, snd_gf1_peek(gus, local), snd_gf1_peek(gus, local + 1), @@ -356,7 +357,8 @@ static void __devinit snd_interwave_bank_sizes(struct snd_gus_card * gus, int *s } } #if 0 - printk("sizes: %i %i %i %i\n", sizes[0], sizes[1], sizes[2], sizes[3]); + printk(KERN_DEBUG "sizes: %i %i %i %i\n", + sizes[0], sizes[1], sizes[2], sizes[3]); #endif } @@ -410,12 +412,12 @@ static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus) lmct = (psizes[3] << 24) | (psizes[2] << 16) | (psizes[1] << 8) | psizes[0]; #if 0 - printk("lmct = 0x%08x\n", lmct); + printk(KERN_DEBUG "lmct = 0x%08x\n", lmct); #endif for (i = 0; i < ARRAY_SIZE(lmc); i++) if (lmct == lmc[i]) { #if 0 - printk("found !!! %i\n", i); + printk(KERN_DEBUG "found !!! %i\n", i); #endif snd_gf1_write16(gus, SNDRV_GF1_GW_MEMORY_CONFIG, (snd_gf1_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG) & 0xfff0) | i); snd_interwave_bank_sizes(gus, psizes); -- cgit v1.2.3 From 4c9f1d3ed7e5f910b66dc4d1456cfac17e58cf0e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:47:51 +0100 Subject: ALSA: isa/*: Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 6 +++--- sound/isa/cs423x/cs4236_lib.c | 21 ++++++++++++++------- sound/isa/es1688/es1688_lib.c | 23 +++++++++++++++-------- sound/isa/opl3sa2.c | 10 +++++++--- sound/isa/opti9xx/opti92x-ad1848.c | 30 +++++++++++++++++------------- sound/isa/wavefront/wavefront.c | 4 ++-- sound/isa/wavefront/wavefront_synth.c | 2 +- 7 files changed, 59 insertions(+), 37 deletions(-) (limited to 'sound') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 1c9e01ecac0b..05aef8b97e96 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -37,7 +37,7 @@ static inline int snd_ad1816a_busy_wait(struct snd_ad1816a *chip) if (inb(AD1816A_REG(AD1816A_CHIP_STATUS)) & AD1816A_READY) return 0; - snd_printk("chip busy.\n"); + snd_printk(KERN_WARNING "chip busy.\n"); return -EBUSY; } @@ -196,7 +196,7 @@ static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, spin_unlock(&chip->lock); break; default: - snd_printk("invalid trigger mode 0x%x.\n", what); + snd_printk(KERN_WARNING "invalid trigger mode 0x%x.\n", what); error = -EINVAL; } @@ -565,7 +565,7 @@ static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip) case AD1816A_HW_AD1815: return "AD1815"; case AD1816A_HW_AD18MAX10: return "AD18max10"; default: - snd_printk("Unknown chip version %d:%d.\n", + snd_printk(KERN_WARNING "Unknown chip version %d:%d.\n", chip->version, chip->hardware); return "AD1816A - unknown"; } diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 6a85fdc53b60..2406efdfd8dd 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -286,7 +286,8 @@ int snd_cs4236_create(struct snd_card *card, if (hardware == WSS_HW_DETECT) hardware = WSS_HW_DETECT3; if (cport < 0x100) { - snd_printk("please, specify control port for CS4236+ chips\n"); + snd_printk(KERN_ERR "please, specify control port " + "for CS4236+ chips\n"); return -ENODEV; } err = snd_wss_create(card, port, cport, @@ -295,7 +296,8 @@ int snd_cs4236_create(struct snd_card *card, return err; if (!(chip->hardware & WSS_HW_CS4236B_MASK)) { - snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware); + snd_printk(KERN_ERR "CS4236+: MODE3 and extended registers " + "not available, hardware=0x%x\n", chip->hardware); snd_device_free(card, chip); return -ENODEV; } @@ -303,16 +305,19 @@ int snd_cs4236_create(struct snd_card *card, { int idx; for (idx = 0; idx < 8; idx++) - snd_printk("CD%i = 0x%x\n", idx, inb(chip->cport + idx)); + snd_printk(KERN_DEBUG "CD%i = 0x%x\n", + idx, inb(chip->cport + idx)); for (idx = 0; idx < 9; idx++) - snd_printk("C%i = 0x%x\n", idx, snd_cs4236_ctrl_in(chip, idx)); + snd_printk(KERN_DEBUG "C%i = 0x%x\n", + idx, snd_cs4236_ctrl_in(chip, idx)); } #endif ver1 = snd_cs4236_ctrl_in(chip, 1); ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION); snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n", cport, ver1, ver2); if (ver1 != ver2) { - snd_printk("CS4236+ chip detected, but control port 0x%lx is not valid\n", cport); + snd_printk(KERN_ERR "CS4236+ chip detected, but " + "control port 0x%lx is not valid\n", cport); snd_device_free(card, chip); return -ENODEV; } @@ -883,7 +888,8 @@ static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct sn spin_lock_irqsave(&chip->reg_lock, flags); ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0; #if 0 - printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", + printk(KERN_DEBUG "get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, " + "C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", snd_wss_in(chip, CS4231_ALT_FEATURE_1), snd_cs4236_ctrl_in(chip, 3), snd_cs4236_ctrl_in(chip, 4), @@ -920,7 +926,8 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn mutex_unlock(&chip->mce_mutex); #if 0 - printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", + printk(KERN_DEBUG "set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, " + "C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", snd_wss_in(chip, CS4231_ALT_FEATURE_1), snd_cs4236_ctrl_in(chip, 3), snd_cs4236_ctrl_in(chip, 4), diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 4fbb508a817f..4c6e14f87f2d 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -45,7 +45,7 @@ static int snd_es1688_dsp_command(struct snd_es1688 *chip, unsigned char val) return 1; } #ifdef CONFIG_SND_DEBUG - printk("snd_es1688_dsp_command: timeout (0x%x)\n", val); + printk(KERN_DEBUG "snd_es1688_dsp_command: timeout (0x%x)\n", val); #endif return 0; } @@ -167,13 +167,16 @@ static int snd_es1688_probe(struct snd_es1688 *chip) hw = ES1688_HW_AUTO; switch (chip->version & 0xfff0) { case 0x4880: - snd_printk("[0x%lx] ESS: AudioDrive ES488 detected, but driver is in another place\n", chip->port); + snd_printk(KERN_ERR "[0x%lx] ESS: AudioDrive ES488 detected, " + "but driver is in another place\n", chip->port); return -ENODEV; case 0x6880: hw = (chip->version & 0x0f) >= 8 ? ES1688_HW_1688 : ES1688_HW_688; break; default: - snd_printk("[0x%lx] ESS: unknown AudioDrive chip with version 0x%x (Jazz16 soundcard?)\n", chip->port, chip->version); + snd_printk(KERN_ERR "[0x%lx] ESS: unknown AudioDrive chip " + "with version 0x%x (Jazz16 soundcard?)\n", + chip->port, chip->version); return -ENODEV; } @@ -223,7 +226,7 @@ static int snd_es1688_init(struct snd_es1688 * chip, int enable) } } #if 0 - snd_printk("mpu cfg = 0x%x\n", cfg); + snd_printk(KERN_DEBUG "mpu cfg = 0x%x\n", cfg); #endif spin_lock_irqsave(&chip->reg_lock, flags); snd_es1688_mixer_write(chip, 0x40, cfg); @@ -237,7 +240,9 @@ static int snd_es1688_init(struct snd_es1688 * chip, int enable) cfg = 0xf0; /* enable only DMA counter interrupt */ irq_bits = irqs[chip->irq & 0x0f]; if (irq_bits < 0) { - snd_printk("[0x%lx] ESS: bad IRQ %d for ES1688 chip!!\n", chip->port, chip->irq); + snd_printk(KERN_ERR "[0x%lx] ESS: bad IRQ %d " + "for ES1688 chip!!\n", + chip->port, chip->irq); #if 0 irq_bits = 0; cfg = 0x10; @@ -250,7 +255,8 @@ static int snd_es1688_init(struct snd_es1688 * chip, int enable) cfg = 0xf0; /* extended mode DMA enable */ dma = chip->dma8; if (dma > 3 || dma == 2) { - snd_printk("[0x%lx] ESS: bad DMA channel %d for ES1688 chip!!\n", chip->port, dma); + snd_printk(KERN_ERR "[0x%lx] ESS: bad DMA channel %d " + "for ES1688 chip!!\n", chip->port, dma); #if 0 dma_bits = 0; cfg = 0x00; /* disable all DMA */ @@ -341,8 +347,9 @@ static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char va return -EINVAL; /* something is wrong */ } #if 0 - printk("trigger: val = 0x%x, value = 0x%x\n", val, value); - printk("trigger: pointer = 0x%x\n", snd_dma_pointer(chip->dma8, chip->dma_size)); + printk(KERN_DEBUG "trigger: val = 0x%x, value = 0x%x\n", val, value); + printk(KERN_DEBUG "trigger: pointer = 0x%x\n", + snd_dma_pointer(chip->dma8, chip->dma_size)); #endif snd_es1688_write(chip, 0xb8, (val & 0xf0) | value); spin_unlock(&chip->reg_lock); diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 58c972b2af03..06810dfb9d9a 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -179,12 +179,13 @@ static unsigned char __snd_opl3sa2_read(struct snd_opl3sa2 *chip, unsigned char unsigned char result; #if 0 outb(0x1d, port); /* password */ - printk("read [0x%lx] = 0x%x\n", port, inb(port)); + printk(KERN_DEBUG "read [0x%lx] = 0x%x\n", port, inb(port)); #endif outb(reg, chip->port); /* register */ result = inb(chip->port + 1); #if 0 - printk("read [0x%lx] = 0x%x [0x%x]\n", port, result, inb(port)); + printk(KERN_DEBUG "read [0x%lx] = 0x%x [0x%x]\n", + port, result, inb(port)); #endif return result; } @@ -233,7 +234,10 @@ static int __devinit snd_opl3sa2_detect(struct snd_card *card) snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); return -EBUSY; } - // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); + /* + snd_printk(KERN_DEBUG "REG 0A = 0x%x\n", + snd_opl3sa2_read(chip, 0x0a)); + */ chip->version = 0; tmp = snd_opl3sa2_read(chip, OPL3SA2_MISC); if (tmp == 0xff) { diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 5deb7e69a029..d5bc0e03132a 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -252,7 +252,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", hardware); + snd_printk(KERN_ERR "chip %d not supported\n", hardware); return -ENODEV; } return 0; @@ -294,7 +294,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", chip->hardware); + snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); } spin_unlock_irqrestore(&chip->lock, flags); @@ -336,7 +336,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", chip->hardware); + snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); } spin_unlock_irqrestore(&chip->lock, flags); @@ -412,7 +412,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) #endif /* OPTi93X */ default: - snd_printk("chip %d not supported\n", chip->hardware); + snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); return -EINVAL; } @@ -430,7 +430,8 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) wss_base_bits = 0x02; break; default: - snd_printk("WSS port 0x%lx not valid\n", chip->wss_base); + snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", + chip->wss_base); goto __skip_base; } snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); @@ -455,7 +456,7 @@ __skip_base: irq_bits = 0x04; break; default: - snd_printk("WSS irq # %d not valid\n", chip->irq); + snd_printk(KERN_WARNING "WSS irq # %d not valid\n", chip->irq); goto __skip_resources; } @@ -470,13 +471,14 @@ __skip_base: dma_bits = 0x03; break; default: - snd_printk("WSS dma1 # %d not valid\n", chip->dma1); + snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", + chip->dma1); goto __skip_resources; } #if defined(CS4231) || defined(OPTi93X) if (chip->dma1 == chip->dma2) { - snd_printk("don't want to share dmas\n"); + snd_printk(KERN_ERR "don't want to share dmas\n"); return -EBUSY; } @@ -485,7 +487,8 @@ __skip_base: case 1: break; default: - snd_printk("WSS dma2 # %d not valid\n", chip->dma2); + snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", + chip->dma2); goto __skip_resources; } dma_bits |= 0x04; @@ -516,7 +519,8 @@ __skip_resources: mpu_port_bits = 0x00; break; default: - snd_printk("MPU-401 port 0x%lx not valid\n", + snd_printk(KERN_WARNING + "MPU-401 port 0x%lx not valid\n", chip->mpu_port); goto __skip_mpu; } @@ -535,7 +539,7 @@ __skip_resources: mpu_irq_bits = 0x01; break; default: - snd_printk("MPU-401 irq # %d not valid\n", + snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n", chip->mpu_irq); goto __skip_mpu; } @@ -726,7 +730,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) if (chip->wss_base == SNDRV_AUTO_PORT) { chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4); if (chip->wss_base < 0) { - snd_printk("unable to find a free WSS port\n"); + snd_printk(KERN_ERR "unable to find a free WSS port\n"); return -EBUSY; } } @@ -891,7 +895,7 @@ static int __devinit snd_opti9xx_isa_probe(struct device *devptr, #if defined(CS4231) || defined(OPTi93X) if (dma2 == SNDRV_AUTO_DMA) { if ((dma2 = snd_legacy_find_free_dma(possible_dma2s[dma1 % 4])) < 0) { - snd_printk("unable to find a free DMA2\n"); + snd_printk(KERN_ERR "unable to find a free DMA2\n"); return -EBUSY; } } diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 4c095bc7c729..c280e6220aee 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -551,11 +551,11 @@ static int __devinit snd_wavefront_isa_match(struct device *pdev, return 0; #endif if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify CS4232 port\n"); + snd_printk(KERN_ERR "specify CS4232 port\n"); return 0; } if (ics2115_port[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify ICS2115 port\n"); + snd_printk(KERN_ERR "specify ICS2115 port\n"); return 0; } return 1; diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 4c410820a994..beb312cca75b 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -633,7 +633,7 @@ wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom) wbuf[1] = i >> 7; if (snd_wavefront_cmd (dev, WFC_IDENTIFY_SAMPLE_TYPE, rbuf, wbuf)) { - snd_printk("cannot identify sample " + snd_printk(KERN_WARNING "cannot identify sample " "type of slot %d\n", i); dev->sample_status[i] = WF_ST_EMPTY; continue; -- cgit v1.2.3 From 54530bded6ecf22d683423b66fc3cd6dddb249aa Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:55:18 +0100 Subject: ALSA: usb - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 6 ++++-- sound/usb/usbmixer.c | 5 ++++- sound/usb/usx2y/usb_stream.c | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 4636926d12d7..c69cc6e4f549 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1419,9 +1419,11 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) subs->cur_audiofmt = fmt; #if 0 - printk("setting done: format = %d, rate = %d..%d, channels = %d\n", + printk(KERN_DEBUG + "setting done: format = %d, rate = %d..%d, channels = %d\n", fmt->format, fmt->rate_min, fmt->rate_max, fmt->channels); - printk(" datapipe = 0x%0x, syncpipe = 0x%0x\n", + printk(KERN_DEBUG + " datapipe = 0x%0x, syncpipe = 0x%0x\n", subs->datapipe, subs->syncpipe); #endif diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 330f2fbff2d1..6615cd3b4079 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -222,7 +222,10 @@ static int check_ignored_ctl(struct mixer_build *state, int unitid, int control) for (p = state->map; p->id; p++) { if (p->id == unitid && ! p->name && (! control || ! p->control || control == p->control)) { - // printk("ignored control %d:%d\n", unitid, control); + /* + printk(KERN_DEBUG "ignored control %d:%d\n", + unitid, control); + */ return 1; } } diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 70b96355ca4c..24393dafcb6e 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -557,7 +557,7 @@ static void stream_start(struct usb_stream_kernel *sk, s->idle_insize -= max_diff - max_diff_0; s->idle_insize += urb_size - s->period_size; if (s->idle_insize < 0) { - snd_printk("%i %i %i\n", + snd_printk(KERN_WARNING "%i %i %i\n", s->idle_insize, urb_size, s->period_size); return; } else if (s->idle_insize == 0) { -- cgit v1.2.3 From 939778aedd9386e13051a9e1d57c14cba2b6ae13 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:57:55 +0100 Subject: ALSA: hda - Add missing KERN_* prefix to printk ... and disable the annoying debug message. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5218118f01b0..d2812ab729cc 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8265,7 +8265,7 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec, { switch (res >> 26) { case ALC880_HP_EVENT: - printk("hp_event\n"); + /* printk(KERN_DEBUG "hp_event\n"); */ alc888_6st_dell_front_automute(codec); break; } @@ -16564,7 +16564,7 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, if (alc880_is_fixed_pin(pin)) { nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); - /* printk("DAC nid=%x\n",nid); */ + /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ /* specify the DAC as the extra output */ if (!spec->multiout.hp_nid) spec->multiout.hp_nid = nid; -- cgit v1.2.3 From 006de267351aa3d836f3307370eae7ec16eac09d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:51:04 +0100 Subject: ALSA: Add missing KERN_* prefix to printk in sound/core Signed-off-by: Takashi Iwai --- sound/core/oss/pcm_oss.c | 49 +++++++++++++++++++++++-------------- sound/core/oss/pcm_plugin.h | 4 +-- sound/core/pcm_native.c | 6 ++--- sound/core/seq/oss/seq_oss_device.h | 2 +- sound/core/seq/seq_prioq.c | 3 ++- 5 files changed, 39 insertions(+), 25 deletions(-) (limited to 'sound') diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index e17836680f49..4b883595a85a 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1160,9 +1160,11 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { #ifdef OSS_DEBUG if (runtime->status->state == SNDRV_PCM_STATE_XRUN) - printk("pcm_oss: write: recovering from XRUN\n"); + printk(KERN_DEBUG "pcm_oss: write: " + "recovering from XRUN\n"); else - printk("pcm_oss: write: recovering from SUSPEND\n"); + printk(KERN_DEBUG "pcm_oss: write: " + "recovering from SUSPEND\n"); #endif ret = snd_pcm_oss_prepare(substream); if (ret < 0) @@ -1196,9 +1198,11 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { #ifdef OSS_DEBUG if (runtime->status->state == SNDRV_PCM_STATE_XRUN) - printk("pcm_oss: read: recovering from XRUN\n"); + printk(KERN_DEBUG "pcm_oss: read: " + "recovering from XRUN\n"); else - printk("pcm_oss: read: recovering from SUSPEND\n"); + printk(KERN_DEBUG "pcm_oss: read: " + "recovering from SUSPEND\n"); #endif ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); if (ret < 0) @@ -1242,9 +1246,11 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { #ifdef OSS_DEBUG if (runtime->status->state == SNDRV_PCM_STATE_XRUN) - printk("pcm_oss: writev: recovering from XRUN\n"); + printk(KERN_DEBUG "pcm_oss: writev: " + "recovering from XRUN\n"); else - printk("pcm_oss: writev: recovering from SUSPEND\n"); + printk(KERN_DEBUG "pcm_oss: writev: " + "recovering from SUSPEND\n"); #endif ret = snd_pcm_oss_prepare(substream); if (ret < 0) @@ -1278,9 +1284,11 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void * runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { #ifdef OSS_DEBUG if (runtime->status->state == SNDRV_PCM_STATE_XRUN) - printk("pcm_oss: readv: recovering from XRUN\n"); + printk(KERN_DEBUG "pcm_oss: readv: " + "recovering from XRUN\n"); else - printk("pcm_oss: readv: recovering from SUSPEND\n"); + printk(KERN_DEBUG "pcm_oss: readv: " + "recovering from SUSPEND\n"); #endif ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); if (ret < 0) @@ -1533,7 +1541,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) init_waitqueue_entry(&wait, current); add_wait_queue(&runtime->sleep, &wait); #ifdef OSS_DEBUG - printk("sync1: size = %li\n", size); + printk(KERN_DEBUG "sync1: size = %li\n", size); #endif while (1) { result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); @@ -1590,7 +1598,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file) mutex_lock(&runtime->oss.params_lock); if (runtime->oss.buffer_used > 0) { #ifdef OSS_DEBUG - printk("sync: buffer_used\n"); + printk(KERN_DEBUG "sync: buffer_used\n"); #endif size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; snd_pcm_format_set_silence(format, @@ -1603,7 +1611,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file) } } else if (runtime->oss.period_ptr > 0) { #ifdef OSS_DEBUG - printk("sync: period_ptr\n"); + printk(KERN_DEBUG "sync: period_ptr\n"); #endif size = runtime->oss.period_bytes - runtime->oss.period_ptr; snd_pcm_format_set_silence(format, @@ -1952,7 +1960,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr int err, cmd; #ifdef OSS_DEBUG - printk("pcm_oss: trigger = 0x%x\n", trigger); + printk(KERN_DEBUG "pcm_oss: trigger = 0x%x\n", trigger); #endif psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; @@ -2170,7 +2178,9 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre } #ifdef OSS_DEBUG - printk("pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize = %i\n", info.bytes, info.fragments, info.fragstotal, info.fragsize); + printk(KERN_DEBUG "pcm_oss: space: bytes = %i, fragments = %i, " + "fragstotal = %i, fragsize = %i\n", + info.bytes, info.fragments, info.fragstotal, info.fragsize); #endif if (copy_to_user(_info, &info, sizeof(info))) return -EFAULT; @@ -2473,7 +2483,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long if (((cmd >> 8) & 0xff) != 'P') return -EINVAL; #ifdef OSS_DEBUG - printk("pcm_oss: ioctl = 0x%x\n", cmd); + printk(KERN_DEBUG "pcm_oss: ioctl = 0x%x\n", cmd); #endif switch (cmd) { case SNDCTL_DSP_RESET: @@ -2627,7 +2637,8 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun #else { ssize_t res = snd_pcm_oss_read1(substream, buf, count); - printk("pcm_oss: read %li bytes (returned %li bytes)\n", (long)count, (long)res); + printk(KERN_DEBUG "pcm_oss: read %li bytes " + "(returned %li bytes)\n", (long)count, (long)res); return res; } #endif @@ -2646,7 +2657,8 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size substream->f_flags = file->f_flags & O_NONBLOCK; result = snd_pcm_oss_write1(substream, buf, count); #ifdef OSS_DEBUG - printk("pcm_oss: write %li bytes (wrote %li bytes)\n", (long)count, (long)result); + printk(KERN_DEBUG "pcm_oss: write %li bytes (wrote %li bytes)\n", + (long)count, (long)result); #endif return result; } @@ -2720,7 +2732,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) int err; #ifdef OSS_DEBUG - printk("pcm_oss: mmap begin\n"); + printk(KERN_DEBUG "pcm_oss: mmap begin\n"); #endif pcm_oss_file = file->private_data; switch ((area->vm_flags & (VM_READ | VM_WRITE))) { @@ -2770,7 +2782,8 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) runtime->silence_threshold = 0; runtime->silence_size = 0; #ifdef OSS_DEBUG - printk("pcm_oss: mmap ok, bytes = 0x%x\n", runtime->oss.mmap_bytes); + printk(KERN_DEBUG "pcm_oss: mmap ok, bytes = 0x%x\n", + runtime->oss.mmap_bytes); #endif /* In mmap mode we never stop */ runtime->stop_threshold = runtime->boundary; diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h index ca2f4c39be46..b9afab603711 100644 --- a/sound/core/oss/pcm_plugin.h +++ b/sound/core/oss/pcm_plugin.h @@ -176,9 +176,9 @@ static inline int snd_pcm_plug_slave_format(int format, struct snd_mask *format_ #endif #ifdef PLUGIN_DEBUG -#define pdprintf( fmt, args... ) printk( "plugin: " fmt, ##args) +#define pdprintf(fmt, args...) printk(KERN_DEBUG "plugin: " fmt, ##args) #else -#define pdprintf( fmt, args... ) +#define pdprintf(fmt, args...) #endif #endif /* __PCM_PLUGIN_H */ diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index a789efc9df39..d9b8f5379428 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -186,7 +186,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (!(params->rmask & (1 << k))) continue; #ifdef RULES_DEBUG - printk("%s = ", snd_pcm_hw_param_names[k]); + printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]); printk("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); #endif changed = snd_mask_refine(m, constrs_mask(constrs, k)); @@ -206,7 +206,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (!(params->rmask & (1 << k))) continue; #ifdef RULES_DEBUG - printk("%s = ", snd_pcm_hw_param_names[k]); + printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]); if (i->empty) printk("empty"); else @@ -251,7 +251,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (!doit) continue; #ifdef RULES_DEBUG - printk("Rule %d [%p]: ", k, r->func); + printk(KERN_DEBUG "Rule %d [%p]: ", k, r->func); if (r->var >= 0) { printk("%s = ", snd_pcm_hw_param_names[r->var]); if (hw_is_mask(r->var)) { diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h index bf8d2b4cb15e..c0154a959d55 100644 --- a/sound/core/seq/oss/seq_oss_device.h +++ b/sound/core/seq/oss/seq_oss_device.h @@ -181,7 +181,7 @@ char *enabled_str(int bool); /* for debug */ #ifdef SNDRV_SEQ_OSS_DEBUG extern int seq_oss_debug; -#define debug_printk(x) do { if (seq_oss_debug > 0) snd_printk x; } while (0) +#define debug_printk(x) do { if (seq_oss_debug > 0) snd_printd x; } while (0) #else #define debug_printk(x) /**/ #endif diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index 0101a8b99b73..29896ab23403 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c @@ -321,7 +321,8 @@ void snd_seq_prioq_leave(struct snd_seq_prioq * f, int client, int timestamp) freeprev = cell; } else { #if 0 - printk("type = %i, source = %i, dest = %i, client = %i\n", + printk(KERN_DEBUG "type = %i, source = %i, dest = %i, " + "client = %i\n", cell->event.type, cell->event.source.client, cell->event.dest.client, -- cgit v1.2.3 From 45203832df2fa9e94ca0a249ddb20d2b077e58cc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 15:51:50 +0100 Subject: ALSA: Add missing KERN_* prefix to printk in sound/drivers Signed-off-by: Takashi Iwai --- sound/drivers/mtpav.c | 12 +++++++----- sound/drivers/mts64.c | 2 +- sound/drivers/opl3/opl3_lib.c | 2 +- sound/drivers/opl3/opl3_midi.c | 30 +++++++++++++++--------------- sound/drivers/opl3/opl3_oss.c | 8 +++++--- sound/drivers/opl3/opl3_synth.c | 2 +- sound/drivers/pcsp/pcsp.c | 2 +- sound/drivers/serial-u16550.c | 18 ++++++++++++------ sound/drivers/virmidi.c | 4 +++- sound/drivers/vx/vx_core.c | 3 ++- 10 files changed, 48 insertions(+), 35 deletions(-) (limited to 'sound') diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 5b89c0883d60..6b26305ff0e6 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -303,8 +303,10 @@ static void snd_mtpav_output_port_write(struct mtpav *mtp_card, snd_mtpav_send_byte(mtp_card, 0xf5); snd_mtpav_send_byte(mtp_card, portp->hwport); - //snd_printk("new outport: 0x%x\n", (unsigned int) portp->hwport); - + /* + snd_printk(KERN_DEBUG "new outport: 0x%x\n", + (unsigned int) portp->hwport); + */ if (!(outbyte & 0x80) && portp->running_status) snd_mtpav_send_byte(mtp_card, portp->running_status); } @@ -540,7 +542,7 @@ static void snd_mtpav_read_bytes(struct mtpav *mcrd) u8 sbyt = snd_mtpav_getreg(mcrd, SREG); - //printk("snd_mtpav_read_bytes() sbyt: 0x%x\n", sbyt); + /* printk(KERN_DEBUG "snd_mtpav_read_bytes() sbyt: 0x%x\n", sbyt); */ if (!(sbyt & SIGS_BYTE)) return; @@ -585,12 +587,12 @@ static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id) static int __devinit snd_mtpav_get_ISA(struct mtpav * mcard) { if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) { - snd_printk("MTVAP port 0x%lx is busy\n", port); + snd_printk(KERN_ERR "MTVAP port 0x%lx is busy\n", port); return -EBUSY; } mcard->port = port; if (request_irq(irq, snd_mtpav_irqh, IRQF_DISABLED, "MOTU MTPAV", mcard)) { - snd_printk("MTVAP IRQ %d busy\n", irq); + snd_printk(KERN_ERR "MTVAP IRQ %d busy\n", irq); return -EBUSY; } mcard->irq = irq; diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index 87ba1ddc0115..1a05b2d64c9b 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -1015,7 +1015,7 @@ static int __devinit snd_mts64_probe(struct platform_device *pdev) goto __err; } - snd_printk("ESI Miditerminal 4140 on 0x%lx\n", p->base); + snd_printk(KERN_INFO "ESI Miditerminal 4140 on 0x%lx\n", p->base); return 0; __err: diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index 780582340fef..6e31e46ca393 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c @@ -302,7 +302,7 @@ void snd_opl3_interrupt(struct snd_hwdep * hw) opl3 = hw->private_data; status = inb(opl3->l_port); #if 0 - snd_printk("AdLib IRQ status = 0x%x\n", status); + snd_printk(KERN_DEBUG "AdLib IRQ status = 0x%x\n", status); #endif if (!(status & 0x80)) return; diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 16feafa2c51e..6e7d09ae0e82 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -125,7 +125,7 @@ static void debug_alloc(struct snd_opl3 *opl3, char *s, int voice) { int i; char *str = "x.24"; - printk("time %.5i: %s [%.2i]: ", opl3->use_time, s, voice); + printk(KERN_DEBUG "time %.5i: %s [%.2i]: ", opl3->use_time, s, voice); for (i = 0; i < opl3->max_voices; i++) printk("%c", *(str + opl3->voices[i].state + 1)); printk("\n"); @@ -218,7 +218,7 @@ static int opl3_get_voice(struct snd_opl3 *opl3, int instr_4op, for (i = 0; i < END; i++) { if (best[i].voice >= 0) { #ifdef DEBUG_ALLOC - printk("%s %iop allocation on voice %i\n", + printk(KERN_DEBUG "%s %iop allocation on voice %i\n", alloc_type[i], instr_4op ? 4 : 2, best[i].voice); #endif @@ -317,7 +317,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) opl3 = p; #ifdef DEBUG_MIDI - snd_printk("Note on, ch %i, inst %i, note %i, vel %i\n", + snd_printk(KERN_DEBUG "Note on, ch %i, inst %i, note %i, vel %i\n", chan->number, chan->midi_program, note, vel); #endif @@ -372,7 +372,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) return; } #ifdef DEBUG_MIDI - snd_printk(" --> OPL%i instrument: %s\n", + snd_printk(KERN_DEBUG " --> OPL%i instrument: %s\n", instr_4op ? 3 : 2, patch->name); #endif /* in SYNTH mode, application takes care of voices */ @@ -431,7 +431,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) } #ifdef DEBUG_MIDI - snd_printk(" --> setting OPL3 connection: 0x%x\n", + snd_printk(KERN_DEBUG " --> setting OPL3 connection: 0x%x\n", opl3->connection_reg); #endif /* @@ -466,7 +466,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) /* Program the FM voice characteristics */ for (i = 0; i < (instr_4op ? 4 : 2); i++) { #ifdef DEBUG_MIDI - snd_printk(" --> programming operator %i\n", i); + snd_printk(KERN_DEBUG " --> programming operator %i\n", i); #endif op_offset = snd_opl3_regmap[voice_offset][i]; @@ -546,7 +546,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) blocknum |= OPL3_KEYON_BIT; #ifdef DEBUG_MIDI - snd_printk(" --> trigger voice %i\n", voice); + snd_printk(KERN_DEBUG " --> trigger voice %i\n", voice); #endif /* Set OPL3 KEYON_BLOCK register of requested voice */ opl3_reg = reg_side | (OPL3_REG_KEYON_BLOCK + voice_offset); @@ -602,7 +602,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) prg = extra_prg - 1; } #ifdef DEBUG_MIDI - snd_printk(" *** allocating extra program\n"); + snd_printk(KERN_DEBUG " *** allocating extra program\n"); #endif goto __extra_prg; } @@ -633,7 +633,7 @@ static void snd_opl3_kill_voice(struct snd_opl3 *opl3, int voice) /* kill voice */ #ifdef DEBUG_MIDI - snd_printk(" --> kill voice %i\n", voice); + snd_printk(KERN_DEBUG " --> kill voice %i\n", voice); #endif opl3_reg = reg_side | (OPL3_REG_KEYON_BLOCK + voice_offset); /* clear Key ON bit */ @@ -670,7 +670,7 @@ void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan opl3 = p; #ifdef DEBUG_MIDI - snd_printk("Note off, ch %i, inst %i, note %i\n", + snd_printk(KERN_DEBUG "Note off, ch %i, inst %i, note %i\n", chan->number, chan->midi_program, note); #endif @@ -709,7 +709,7 @@ void snd_opl3_key_press(void *p, int note, int vel, struct snd_midi_channel *cha opl3 = p; #ifdef DEBUG_MIDI - snd_printk("Key pressure, ch#: %i, inst#: %i\n", + snd_printk(KERN_DEBUG "Key pressure, ch#: %i, inst#: %i\n", chan->number, chan->midi_program); #endif } @@ -723,7 +723,7 @@ void snd_opl3_terminate_note(void *p, int note, struct snd_midi_channel *chan) opl3 = p; #ifdef DEBUG_MIDI - snd_printk("Terminate note, ch#: %i, inst#: %i\n", + snd_printk(KERN_DEBUG "Terminate note, ch#: %i, inst#: %i\n", chan->number, chan->midi_program); #endif } @@ -812,7 +812,7 @@ void snd_opl3_control(void *p, int type, struct snd_midi_channel *chan) opl3 = p; #ifdef DEBUG_MIDI - snd_printk("Controller, TYPE = %i, ch#: %i, inst#: %i\n", + snd_printk(KERN_DEBUG "Controller, TYPE = %i, ch#: %i, inst#: %i\n", type, chan->number, chan->midi_program); #endif @@ -849,7 +849,7 @@ void snd_opl3_nrpn(void *p, struct snd_midi_channel *chan, opl3 = p; #ifdef DEBUG_MIDI - snd_printk("NRPN, ch#: %i, inst#: %i\n", + snd_printk(KERN_DEBUG "NRPN, ch#: %i, inst#: %i\n", chan->number, chan->midi_program); #endif } @@ -864,6 +864,6 @@ void snd_opl3_sysex(void *p, unsigned char *buf, int len, opl3 = p; #ifdef DEBUG_MIDI - snd_printk("SYSEX\n"); + snd_printk(KERN_DEBUG "SYSEX\n"); #endif } diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index 9a2271dc046a..a54b1dc5cc78 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c @@ -220,14 +220,14 @@ static int snd_opl3_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format, return -EINVAL; if (count < (int)sizeof(sbi)) { - snd_printk("FM Error: Patch record too short\n"); + snd_printk(KERN_ERR "FM Error: Patch record too short\n"); return -EINVAL; } if (copy_from_user(&sbi, buf, sizeof(sbi))) return -EFAULT; if (sbi.channel < 0 || sbi.channel >= SBFM_MAXINSTR) { - snd_printk("FM Error: Invalid instrument number %d\n", + snd_printk(KERN_ERR "FM Error: Invalid instrument number %d\n", sbi.channel); return -EINVAL; } @@ -254,7 +254,9 @@ static int snd_opl3_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, opl3 = arg->private_data; switch (cmd) { case SNDCTL_FM_LOAD_INSTR: - snd_printk("OPL3: Obsolete ioctl(SNDCTL_FM_LOAD_INSTR) used. Fix the program.\n"); + snd_printk(KERN_ERR "OPL3: " + "Obsolete ioctl(SNDCTL_FM_LOAD_INSTR) used. " + "Fix the program.\n"); return -EINVAL; case SNDCTL_SYNTH_MEMAVL: diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index 962bb9c8b9c8..6d57b6441dec 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c @@ -168,7 +168,7 @@ int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, #ifdef CONFIG_SND_DEBUG default: - snd_printk("unknown IOCTL: 0x%x\n", cmd); + snd_printk(KERN_WARNING "unknown IOCTL: 0x%x\n", cmd); #endif } return -ENOTTY; diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index a4049eb94d35..c7c744c6fc0b 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c @@ -57,7 +57,7 @@ static int __devinit snd_pcsp_create(struct snd_card *card) else min_div = MAX_DIV; #if PCSP_DEBUG - printk("PCSP: lpj=%li, min_div=%i, res=%li\n", + printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n", loops_per_jiffy, min_div, tp.tv_nsec); #endif diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index d8aab9da97c2..ff0a41510945 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -241,7 +241,8 @@ static void snd_uart16550_io_loop(struct snd_uart16550 * uart) snd_rawmidi_receive(uart->midi_input[substream], &c, 1); if (status & UART_LSR_OE) - snd_printk("%s: Overrun on device at 0x%lx\n", + snd_printk(KERN_WARNING + "%s: Overrun on device at 0x%lx\n", uart->rmidi->name, uart->base); } @@ -636,7 +637,8 @@ static int snd_uart16550_output_byte(struct snd_uart16550 *uart, } } else { if (!snd_uart16550_write_buffer(uart, midi_byte)) { - snd_printk("%s: Buffer overrun on device at 0x%lx\n", + snd_printk(KERN_WARNING + "%s: Buffer overrun on device at 0x%lx\n", uart->rmidi->name, uart->base); return 0; } @@ -815,7 +817,8 @@ static int __devinit snd_uart16550_create(struct snd_card *card, if (irq >= 0 && irq != SNDRV_AUTO_IRQ) { if (request_irq(irq, snd_uart16550_interrupt, IRQF_DISABLED, "Serial MIDI", uart)) { - snd_printk("irq %d busy. Using Polling.\n", irq); + snd_printk(KERN_WARNING + "irq %d busy. Using Polling.\n", irq); } else { uart->irq = irq; } @@ -919,19 +922,22 @@ static int __devinit snd_serial_probe(struct platform_device *devptr) case SNDRV_SERIAL_GENERIC: break; default: - snd_printk("Adaptor type is out of range 0-%d (%d)\n", + snd_printk(KERN_ERR + "Adaptor type is out of range 0-%d (%d)\n", SNDRV_SERIAL_MAX_ADAPTOR, adaptor[dev]); return -ENODEV; } if (outs[dev] < 1 || outs[dev] > SNDRV_SERIAL_MAX_OUTS) { - snd_printk("Count of outputs is out of range 1-%d (%d)\n", + snd_printk(KERN_ERR + "Count of outputs is out of range 1-%d (%d)\n", SNDRV_SERIAL_MAX_OUTS, outs[dev]); return -ENODEV; } if (ins[dev] < 1 || ins[dev] > SNDRV_SERIAL_MAX_INS) { - snd_printk("Count of inputs is out of range 1-%d (%d)\n", + snd_printk(KERN_ERR + "Count of inputs is out of range 1-%d (%d)\n", SNDRV_SERIAL_MAX_INS, ins[dev]); return -ENODEV; } diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index f79e3614079d..1022e365606f 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -98,7 +98,9 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr) vmidi->card = card; if (midi_devs[dev] > MAX_MIDI_DEVICES) { - snd_printk("too much midi devices for virmidi %d: force to use %d\n", dev, MAX_MIDI_DEVICES); + snd_printk(KERN_WARNING + "too much midi devices for virmidi %d: " + "force to use %d\n", dev, MAX_MIDI_DEVICES); midi_devs[dev] = MAX_MIDI_DEVICES; } for (idx = 0; idx < midi_devs[dev]; idx++) { diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index 14e3354be43a..19c6e376c7c7 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c @@ -688,7 +688,8 @@ int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp) image = dsp->data + i; /* Wait DSP ready for a new read */ if ((err = vx_wait_isr_bit(chip, ISR_TX_EMPTY)) < 0) { - printk("dsp loading error at position %d\n", i); + printk(KERN_ERR + "dsp loading error at position %d\n", i); return err; } cptr = image; -- cgit v1.2.3 From 42b0158bdb1344b05cc1e98c363fba9e97137565 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:01:46 +0100 Subject: ALSA: emux - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/synth/emux/emux_oss.c | 2 +- sound/synth/emux/emux_seq.c | 16 ++++++++-------- sound/synth/emux/emux_synth.c | 6 ++++-- sound/synth/emux/soundfont.c | 28 +++++++++++++++++----------- 4 files changed, 30 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c index 5c47b6c09264..87e42206c4ef 100644 --- a/sound/synth/emux/emux_oss.c +++ b/sound/synth/emux/emux_oss.c @@ -132,7 +132,7 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) p = snd_emux_create_port(emu, tmpname, 32, 1, &callback); if (p == NULL) { - snd_printk("can't create port\n"); + snd_printk(KERN_ERR "can't create port\n"); snd_emux_dec_count(emu); mutex_unlock(&emu->register_mutex); return -ENOMEM; diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 335aa2ce2574..ca5f7effb4df 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c @@ -74,15 +74,15 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index) emu->client = snd_seq_create_kernel_client(card, index, "%s WaveTable", emu->name); if (emu->client < 0) { - snd_printk("can't create client\n"); + snd_printk(KERN_ERR "can't create client\n"); return -ENODEV; } if (emu->num_ports < 0) { - snd_printk("seqports must be greater than zero\n"); + snd_printk(KERN_WARNING "seqports must be greater than zero\n"); emu->num_ports = 1; } else if (emu->num_ports >= SNDRV_EMUX_MAX_PORTS) { - snd_printk("too many ports." + snd_printk(KERN_WARNING "too many ports." "limited max. ports %d\n", SNDRV_EMUX_MAX_PORTS); emu->num_ports = SNDRV_EMUX_MAX_PORTS; } @@ -100,7 +100,7 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index) p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS, 0, &pinfo); if (p == NULL) { - snd_printk("can't create port\n"); + snd_printk(KERN_ERR "can't create port\n"); return -ENOMEM; } @@ -147,12 +147,12 @@ snd_emux_create_port(struct snd_emux *emu, char *name, /* Allocate structures for this channel */ if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) { - snd_printk("no memory\n"); + snd_printk(KERN_ERR "no memory\n"); return NULL; } p->chset.channels = kcalloc(max_channels, sizeof(struct snd_midi_channel), GFP_KERNEL); if (p->chset.channels == NULL) { - snd_printk("no memory\n"); + snd_printk(KERN_ERR "no memory\n"); kfree(p); return NULL; } @@ -376,12 +376,12 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card) goto __error; } emu->vmidi[i] = rmidi; - //snd_printk("virmidi %d ok\n", i); + /* snd_printk(KERN_DEBUG "virmidi %d ok\n", i); */ } return 0; __error: - //snd_printk("error init..\n"); + /* snd_printk(KERN_DEBUG "error init..\n"); */ snd_emux_delete_virmidi(emu); return -ENOMEM; } diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index 2cc6f6f79065..3e921b386fd5 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c @@ -956,7 +956,8 @@ void snd_emux_lock_voice(struct snd_emux *emu, int voice) if (emu->voices[voice].state == SNDRV_EMUX_ST_OFF) emu->voices[voice].state = SNDRV_EMUX_ST_LOCKED; else - snd_printk("invalid voice for lock %d (state = %x)\n", + snd_printk(KERN_WARNING + "invalid voice for lock %d (state = %x)\n", voice, emu->voices[voice].state); spin_unlock_irqrestore(&emu->voice_lock, flags); } @@ -973,7 +974,8 @@ void snd_emux_unlock_voice(struct snd_emux *emu, int voice) if (emu->voices[voice].state == SNDRV_EMUX_ST_LOCKED) emu->voices[voice].state = SNDRV_EMUX_ST_OFF; else - snd_printk("invalid voice for unlock %d (state = %x)\n", + snd_printk(KERN_WARNING + "invalid voice for unlock %d (state = %x)\n", voice, emu->voices[voice].state); spin_unlock_irqrestore(&emu->voice_lock, flags); } diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 36d53bd317ed..63c8f45c0c22 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -133,7 +133,7 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, int rc; if (count < (long)sizeof(patch)) { - snd_printk("patch record too small %ld\n", count); + snd_printk(KERN_ERR "patch record too small %ld\n", count); return -EINVAL; } if (copy_from_user(&patch, data, sizeof(patch))) @@ -143,15 +143,16 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, data += sizeof(patch); if (patch.key != SNDRV_OSS_SOUNDFONT_PATCH) { - snd_printk("'The wrong kind of patch' %x\n", patch.key); + snd_printk(KERN_ERR "The wrong kind of patch %x\n", patch.key); return -EINVAL; } if (count < patch.len) { - snd_printk("Patch too short %ld, need %d\n", count, patch.len); + snd_printk(KERN_ERR "Patch too short %ld, need %d\n", + count, patch.len); return -EINVAL; } if (patch.len < 0) { - snd_printk("poor length %d\n", patch.len); + snd_printk(KERN_ERR "poor length %d\n", patch.len); return -EINVAL; } @@ -195,7 +196,8 @@ snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, case SNDRV_SFNT_REMOVE_INFO: /* patch must be opened */ if (!sflist->currsf) { - snd_printk("soundfont: remove_info: patch not opened\n"); + snd_printk(KERN_ERR "soundfont: remove_info: " + "patch not opened\n"); rc = -EINVAL; } else { int bank, instr; @@ -531,7 +533,7 @@ load_info(struct snd_sf_list *sflist, const void __user *data, long count) return -EINVAL; if (count < (long)sizeof(hdr)) { - printk("Soundfont error: invalid patch zone length\n"); + printk(KERN_ERR "Soundfont error: invalid patch zone length\n"); return -EINVAL; } if (copy_from_user((char*)&hdr, data, sizeof(hdr))) @@ -541,12 +543,14 @@ load_info(struct snd_sf_list *sflist, const void __user *data, long count) count -= sizeof(hdr); if (hdr.nvoices <= 0 || hdr.nvoices >= 100) { - printk("Soundfont error: Illegal voice number %d\n", hdr.nvoices); + printk(KERN_ERR "Soundfont error: Illegal voice number %d\n", + hdr.nvoices); return -EINVAL; } if (count < (long)sizeof(struct soundfont_voice_info) * hdr.nvoices) { - printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n", + printk(KERN_ERR "Soundfont Error: " + "patch length(%ld) is smaller than nvoices(%d)\n", count, hdr.nvoices); return -EINVAL; } @@ -952,7 +956,7 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, int rc; if (count < (long)sizeof(patch)) { - snd_printk("patch record too small %ld\n", count); + snd_printk(KERN_ERR "patch record too small %ld\n", count); return -EINVAL; } if (copy_from_user(&patch, data, sizeof(patch))) @@ -1034,7 +1038,8 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, /* panning position; -128 - 127 => 0-127 */ zone->v.pan = (patch.panning + 128) / 2; #if 0 - snd_printk("gus: basefrq=%d (ofs=%d) root=%d,tune=%d, range:%d-%d\n", + snd_printk(KERN_DEBUG + "gus: basefrq=%d (ofs=%d) root=%d,tune=%d, range:%d-%d\n", (int)patch.base_freq, zone->v.rate_offset, zone->v.root, zone->v.tune, zone->v.low, zone->v.high); #endif @@ -1068,7 +1073,8 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, zone->v.parm.volrelease = 0x8000 | snd_sf_calc_parm_decay(release); zone->v.attenuation = calc_gus_attenuation(patch.env_offset[0]); #if 0 - snd_printk("gus: atkhld=%x, dcysus=%x, volrel=%x, att=%d\n", + snd_printk(KERN_DEBUG + "gus: atkhld=%x, dcysus=%x, volrel=%x, att=%d\n", zone->v.parm.volatkhld, zone->v.parm.voldcysus, zone->v.parm.volrelease, -- cgit v1.2.3 From e2ea7cfc703cba3299d22db728516a0fc1a9717c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:07:02 +0100 Subject: ALSA: Add missing KERN_* prefix to printk in sound/pci/ice1712 Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1712.c | 2 +- sound/pci/ice1712/ice1724.c | 17 ++++++++++++++--- sound/pci/ice1712/juli.c | 5 +++-- sound/pci/ice1712/prodigy192.c | 13 +++++++++---- 4 files changed, 27 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 58d7cda03de5..dcd3f4f89b44 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -458,7 +458,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) u16 pbkstatus; struct snd_pcm_substream *substream; pbkstatus = inw(ICEDS(ice, INTSTAT)); - /* printk("pbkstatus = 0x%x\n", pbkstatus); */ + /* printk(KERN_DEBUG "pbkstatus = 0x%x\n", pbkstatus); */ for (idx = 0; idx < 6; idx++) { if ((pbkstatus & (3 << (idx * 2))) == 0) continue; diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index eb7872dec5ae..da8c111e9e39 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -756,7 +756,14 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) spin_unlock_irq(&ice->reg_lock); - /* printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); */ + /* + printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, " + "buffer = 0x%x, period = 0x%x\n", + substream->runtime->channels, + (unsigned int)substream->runtime->dma_addr, + snd_pcm_lib_buffer_bytes(substream), + snd_pcm_lib_period_bytes(substream)); + */ return 0; } @@ -2133,7 +2140,9 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, wait_i2c_busy(ice); val = inb(ICEREG1724(ice, I2C_DATA)); mutex_unlock(&ice->i2c_mutex); - /* printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); */ + /* + printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); + */ return val; } @@ -2142,7 +2151,9 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice, { mutex_lock(&ice->i2c_mutex); wait_i2c_busy(ice); - /* printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); */ + /* + printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); + */ outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); outb(data, ICEREG1724(ice, I2C_DATA)); outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index c51659b9caf6..fd948bfd9aef 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -345,8 +345,9 @@ static int juli_mute_put(struct snd_kcontrol *kcontrol, new_gpio = old_gpio & ~((unsigned int) kcontrol->private_value); } - /* printk("JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, \ - new_gpio 0x%x\n", + /* printk(KERN_DEBUG + "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, " + "new_gpio 0x%x\n", (unsigned int)ucontrol->value.integer.value[0], old_gpio, new_gpio); */ if (old_gpio != new_gpio) { diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 48d3679292a7..2a8e5cd8f2d8 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c @@ -133,8 +133,10 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; /* due to possible conflicts with stac9460_set_rate_val, mutexing */ mutex_lock(&spec->mute_mutex); - /*printk("Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, - ucontrol->value.integer.value[0]);*/ + /* + printk(KERN_DEBUG "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, + ucontrol->value.integer.value[0]); + */ change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); mutex_unlock(&spec->mute_mutex); return change; @@ -185,7 +187,10 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el change = (ovol != nvol); if (change) { ovol = (0x7f - nvol) | (tmp & 0x80); - /*printk("DAC Volume: reg 0x%02x: 0x%02x\n", idx, ovol);*/ + /* + printk(KERN_DEBUG "DAC Volume: reg 0x%02x: 0x%02x\n", + idx, ovol); + */ stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); } return change; @@ -344,7 +349,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) for (idx = 0; idx < 7 ; ++idx) changed[idx] = stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 0); - /*printk("Rate change: %d, new MC: 0x%02x\n", rate, new);*/ + /*printk(KERN_DEBUG "Rate change: %d, new MC: 0x%02x\n", rate, new);*/ stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); udelay(10); /* unmuting - only originally unmuted dacs - -- cgit v1.2.3 From 28a97c194cec477073ae341f15b836437d8ef8e5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:08:14 +0100 Subject: ALSA: emu10k1 - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emu10k1_callback.c | 7 ++- sound/pci/emu10k1/emu10k1_main.c | 5 +- sound/pci/emu10k1/emufx.c | 11 ++-- sound/pci/emu10k1/emupcm.c | 37 ++++++++++--- sound/pci/emu10k1/io.c | 4 +- sound/pci/emu10k1/p16v.c | 100 +++++++++++++++++++++++++---------- sound/pci/emu10k1/voice.c | 12 +++-- 7 files changed, 130 insertions(+), 46 deletions(-) (limited to 'sound') diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index 0e649dcdbf64..7ef949d99a50 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c @@ -103,7 +103,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) int ch; vp = &emu->voices[best[i].voice]; if ((ch = vp->ch) < 0) { - //printk("synth_get_voice: ch < 0 (%d) ??", i); + /* + printk(KERN_WARNING + "synth_get_voice: ch < 0 (%d) ??", i); + */ continue; } vp->emu->num_voices--; @@ -335,7 +338,7 @@ start_voice(struct snd_emux_voice *vp) return -EINVAL; emem->map_locked++; if (snd_emu10k1_memblk_map(hw, emem) < 0) { - // printk("emu: cannot map!\n"); + /* printk(KERN_ERR "emu: cannot map!\n"); */ return -ENOMEM; } mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1; diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 7958006a1d66..8343aecbd25f 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -758,7 +758,8 @@ static int emu1010_firmware_thread(void *data) snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); - snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2); + snd_printk(KERN_INFO "Audio Dock ver:%d.%d\n", + tmp, tmp2); /* Sync clocking between 1010 and Dock */ /* Allow DLL to settle */ msleep(10); @@ -887,7 +888,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); - snd_printk("emu1010: Hana version: %d.%d\n", tmp, tmp2); + snd_printk(KERN_INFO "emu1010: Hana version: %d.%d\n", tmp, tmp2); /* Enable 48Volt power to Audio Dock */ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 7dba08f0ab8e..191e1cd9997d 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -1519,7 +1519,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */ if (emu->card_capabilities->emu_model) { /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */ - snd_printk("EMU outputs on\n"); + snd_printk(KERN_INFO "EMU outputs on\n"); for (z = 0; z < 8; z++) { if (emu->card_capabilities->ca0108_chip) { A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000); @@ -1567,7 +1567,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->ca0108_chip) { - snd_printk("EMU2 inputs on\n"); + snd_printk(KERN_INFO "EMU2 inputs on\n"); for (z = 0; z < 0x10; z++) { snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, @@ -1575,10 +1575,13 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) A_FXBUS2(z*2) ); } } else { - snd_printk("EMU inputs on\n"); + snd_printk(KERN_INFO "EMU inputs on\n"); /* Capture 16 (originally 8) channels of S32_LE sound */ - /* printk("emufx.c: gpr=0x%x, tmp=0x%x\n",gpr, tmp); */ + /* + printk(KERN_DEBUG "emufx.c: gpr=0x%x, tmp=0x%x\n", + gpr, tmp); + */ /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */ /* A_P16VIN(0) is delayed by one sample, * so all other A_P16VIN channels will need to also be delayed diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index cf9276ddad42..78f62fd404c2 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -44,7 +44,7 @@ static void snd_emu10k1_pcm_interrupt(struct snd_emu10k1 *emu, if (epcm->substream == NULL) return; #if 0 - printk("IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", + printk(KERN_DEBUG "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", epcm->substream->runtime->hw->pointer(emu, epcm->substream), snd_pcm_lib_period_bytes(epcm->substream), snd_pcm_lib_buffer_bytes(epcm->substream)); @@ -146,7 +146,11 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic 1, &epcm->extra); if (err < 0) { - /* printk("pcm_channel_alloc: failed extra: voices=%d, frame=%d\n", voices, frame); */ + /* + printk(KERN_DEBUG "pcm_channel_alloc: " + "failed extra: voices=%d, frame=%d\n", + voices, frame); + */ for (i = 0; i < voices; i++) { snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); epcm->voices[i] = NULL; @@ -737,7 +741,10 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, struct snd_emu10k1_pcm_mixer *mix; int result = 0; - /* printk("trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", (int)emu, cmd, substream->ops->pointer(substream)); */ + /* + printk(KERN_DEBUG "trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", + (int)emu, cmd, substream->ops->pointer(substream)) + */ spin_lock(&emu->reg_lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -786,7 +793,10 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, /* hmm this should cause full and half full interrupt to be raised? */ outl(epcm->capture_ipr, emu->port + IPR); snd_emu10k1_intr_enable(emu, epcm->capture_inte); - /* printk("adccr = 0x%x, adcbs = 0x%x\n", epcm->adccr, epcm->adcbs); */ + /* + printk(KERN_DEBUG "adccr = 0x%x, adcbs = 0x%x\n", + epcm->adccr, epcm->adcbs); + */ switch (epcm->type) { case CAPTURE_AC97ADC: snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); @@ -857,7 +867,11 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream * ptr -= runtime->buffer_size; } #endif - /* printk("ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", ptr, runtime->buffer_size, runtime->period_size); */ + /* + printk(KERN_DEBUG + "ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", + ptr, runtime->buffer_size, runtime->period_size); + */ return ptr; } @@ -1546,7 +1560,11 @@ static void snd_emu10k1_fx8010_playback_tram_poke1(unsigned short *dst_left, unsigned int count, unsigned int tram_shift) { - /* printk("tram_poke1: dst_left = 0x%p, dst_right = 0x%p, src = 0x%p, count = 0x%x\n", dst_left, dst_right, src, count); */ + /* + printk(KERN_DEBUG "tram_poke1: dst_left = 0x%p, dst_right = 0x%p, " + "src = 0x%p, count = 0x%x\n", + dst_left, dst_right, src, count); + */ if ((tram_shift & 1) == 0) { while (count--) { *dst_left-- = *src++; @@ -1623,7 +1641,12 @@ static int snd_emu10k1_fx8010_playback_prepare(struct snd_pcm_substream *substre struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; unsigned int i; - /* printk("prepare: etram_pages = 0x%p, dma_area = 0x%x, buffer_size = 0x%x (0x%x)\n", emu->fx8010.etram_pages, runtime->dma_area, runtime->buffer_size, runtime->buffer_size << 2); */ + /* + printk(KERN_DEBUG "prepare: etram_pages = 0x%p, dma_area = 0x%x, " + "buffer_size = 0x%x (0x%x)\n", + emu->fx8010.etram_pages, runtime->dma_area, + runtime->buffer_size, runtime->buffer_size << 2); + */ memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index b5a802bdeb7c..4bfc31d1b281 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -226,7 +226,9 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, break; if (timeout > 1000) { - snd_printk("emu10k1:I2C:timeout status=0x%x\n", status); + snd_printk(KERN_WARNING + "emu10k1:I2C:timeout status=0x%x\n", + status); break; } } diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 749a21b6bd06..e617acaf10e3 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c @@ -168,7 +168,7 @@ static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) struct snd_emu10k1_pcm *epcm = runtime->private_data; if (epcm) { - //snd_printk("epcm free: %p\n", epcm); + /* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */ kfree(epcm); } } @@ -183,14 +183,16 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea int err; epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); - //snd_printk("epcm kcalloc: %p\n", epcm); + /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ if (epcm == NULL) return -ENOMEM; epcm->emu = emu; epcm->substream = substream; - //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); - + /* + snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", + substream->pcm->device, channel_id); + */ runtime->private_data = epcm; runtime->private_free = snd_p16v_pcm_free_substream; @@ -200,10 +202,15 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea channel->number = channel_id; channel->use=1; - //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); - //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); - //channel->interrupt = snd_p16v_pcm_channel_interrupt; - channel->epcm=epcm; +#if 0 /* debug */ + snd_printk(KERN_DEBUG + "p16v: open channel_id=%d, channel=%p, use=0x%x\n", + channel_id, channel, channel->use); + printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + channel_id, chip, channel); +#endif /* debug */ + /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ + channel->epcm = epcm; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) return err; @@ -224,14 +231,16 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream int err; epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); - //snd_printk("epcm kcalloc: %p\n", epcm); + /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ if (epcm == NULL) return -ENOMEM; epcm->emu = emu; epcm->substream = substream; - //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); - + /* + snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", + substream->pcm->device, channel_id); + */ runtime->private_data = epcm; runtime->private_free = snd_p16v_pcm_free_substream; @@ -241,10 +250,15 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream channel->number = channel_id; channel->use=1; - //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); - //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); - //channel->interrupt = snd_p16v_pcm_channel_interrupt; - channel->epcm=epcm; +#if 0 /* debug */ + snd_printk(KERN_DEBUG + "p16v: open channel_id=%d, channel=%p, use=0x%x\n", + channel_id, channel, channel->use); + printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + channel_id, chip, channel); +#endif /* debug */ + /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ + channel->epcm = epcm; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) return err; @@ -334,9 +348,19 @@ static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream) int i; u32 tmp; - //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); - //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); - //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->p16v_buffer.addr, emu->p16v_buffer.area, emu->p16v_buffer.bytes); +#if 0 /* debug */ + snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, " + "format=0x%x, channels=%d, buffer_size=%ld, " + "period_size=%ld, periods=%u, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, runtime->channels, + runtime->buffer_size, runtime->period_size, + runtime->periods, frames_to_bytes(runtime, 1)); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", + runtime->dma_addr, runtime->dma_area, table_base); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", + emu->p16v_buffer.addr, emu->p16v_buffer.area, + emu->p16v_buffer.bytes); +#endif /* debug */ tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); switch (runtime->rate) { case 44100: @@ -379,7 +403,15 @@ static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; int channel = substream->pcm->device - emu->p16v_device_offset; u32 tmp; - //printk("prepare capture:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); + + /* + printk(KERN_DEBUG "prepare capture:channel_number=%d, rate=%d, " + "format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, " + "frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, runtime->channels, + runtime->buffer_size, runtime->period_size, + frames_to_bytes(runtime, 1)); + */ tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); switch (runtime->rate) { case 44100: @@ -459,13 +491,13 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream, runtime = s->runtime; epcm = runtime->private_data; channel = substream->pcm->device-emu->p16v_device_offset; - //snd_printk("p16v channel=%d\n",channel); + /* snd_printk(KERN_DEBUG "p16v channel=%d\n", channel); */ epcm->running = running; basic |= (0x1<buffer_size; printk(KERN_WARNING "buffer capture limited!\n"); } - //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); - + /* + printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " + "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", + ptr1, ptr2, ptr, (int)runtime->buffer_size, + (int)runtime->period_size, (int)runtime->frame_bits, + (int)runtime->rate); + */ return ptr; } @@ -592,7 +629,10 @@ int snd_p16v_free(struct snd_emu10k1 *chip) // release the data if (chip->p16v_buffer.area) { snd_dma_free_pages(&chip->p16v_buffer); - //snd_printk("period lables free: %p\n", &chip->p16v_buffer); + /* + snd_printk(KERN_DEBUG "period lables free: %p\n", + &chip->p16v_buffer); + */ } return 0; } @@ -604,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * int err; int capture=1; - //snd_printk("snd_p16v_pcm called. device=%d\n", device); + /* snd_printk("KERN_DEBUG snd_p16v_pcm called. device=%d\n", device); */ emu->p16v_device_offset = device; if (rpcm) *rpcm = NULL; @@ -631,7 +671,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * snd_dma_pci_data(emu->pci), ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) return err; - //snd_printk("preallocate playback substream: err=%d\n", err); + /* + snd_printk(KERN_DEBUG + "preallocate playback substream: err=%d\n", err); + */ } for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; @@ -642,7 +685,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * snd_dma_pci_data(emu->pci), 65536 - 64, 65536 - 64)) < 0) return err; - //snd_printk("preallocate capture substream: err=%d\n", err); + /* + snd_printk(KERN_DEBUG + "preallocate capture substream: err=%d\n", err); + */ } if (rpcm) diff --git a/sound/pci/emu10k1/voice.c b/sound/pci/emu10k1/voice.c index d7300a1aa262..20b8da250bd0 100644 --- a/sound/pci/emu10k1/voice.c +++ b/sound/pci/emu10k1/voice.c @@ -53,7 +53,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, *rvoice = NULL; first_voice = last_voice = 0; for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) { - // printk("i %d j %d next free %d!\n", i, j, emu->next_free_voice); + /* + printk(KERN_DEBUG "i %d j %d next free %d!\n", + i, j, emu->next_free_voice); + */ i %= NUM_G; /* stereo voices must be even/odd */ @@ -71,7 +74,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, } } if (!skip) { - // printk("allocated voice %d\n", i); + /* printk(KERN_DEBUG "allocated voice %d\n", i); */ first_voice = i; last_voice = (i + number) % NUM_G; emu->next_free_voice = last_voice; @@ -84,7 +87,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, for (i = 0; i < number; i++) { voice = &emu->voices[(first_voice + i) % NUM_G]; - // printk("voice alloc - %i, %i of %i\n", voice->number, idx-first_voice+1, number); + /* + printk(kERN_DEBUG "voice alloc - %i, %i of %i\n", + voice->number, idx-first_voice+1, number); + */ voice->use = 1; switch (type) { case EMU10K1_PCM: -- cgit v1.2.3 From 14ab08610971eb1db572ad8ca63acd13bc4d4caf Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:09:57 +0100 Subject: ALSA: intel8x0 - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 11 +++++++---- sound/pci/intel8x0m.c | 14 ++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index b13ef1e2a4a3..0f7d12911904 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -689,7 +689,7 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ ichdev->fragsize >> ichdev->pos_shift); #if 0 - printk("bdbar[%i] = 0x%x [0x%x]\n", + printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", idx + 0, bdbar[idx + 0], bdbar[idx + 1]); #endif } @@ -701,8 +701,10 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; ichdev->position = 0; #if 0 - printk("lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n", - ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, ichdev->fragsize1); + printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " + "period_size1 = 0x%x\n", + ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, + ichdev->fragsize1); #endif /* clear interrupts */ iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); @@ -768,7 +770,8 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich ichdev->lvi_frag %= ichdev->frags; ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1); #if 0 - printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", + printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, " + "all = 0x%x, 0x%x\n", ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), inl(port + 4), inb(port + ICH_REG_OFF_CR)); diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 93449e464566..7c819fd824a5 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -411,7 +411,10 @@ static void snd_intel8x0_setup_periods(struct intel8x0m *chip, struct ichdev *ic bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + (((idx >> 1) * ichdev->fragsize) % ichdev->size)); bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ ichdev->fragsize >> chip->pcm_pos_shift); - // printk("bdbar[%i] = 0x%x [0x%x]\n", idx + 0, bdbar[idx + 0], bdbar[idx + 1]); + /* + printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", + idx + 0, bdbar[idx + 0], bdbar[idx + 1]); + */ } ichdev->frags = ichdev->size / ichdev->fragsize; } @@ -421,8 +424,10 @@ static void snd_intel8x0_setup_periods(struct intel8x0m *chip, struct ichdev *ic ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; ichdev->position = 0; #if 0 - printk("lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n", - ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, ichdev->fragsize1); + printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " + "period_size1 = 0x%x\n", + ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, + ichdev->fragsize1); #endif /* clear interrupts */ iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); @@ -465,7 +470,8 @@ static inline void snd_intel8x0_update(struct intel8x0m *chip, struct ichdev *ic ichdev->lvi_frag * ichdev->fragsize1); #if 0 - printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", + printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], " + "prefetch = %i, all = 0x%x, 0x%x\n", ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), inl(port + 4), inb(port + ICH_REG_OFF_CR)); -- cgit v1.2.3 From ee419653a38de93b75a577851d9e4003cf0bbe07 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:11:31 +0100 Subject: ALSA: Fix missing KERN_* prefix to printk in sound/pci Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_codec.c | 5 +- sound/pci/ak4531_codec.c | 3 +- sound/pci/als300.c | 2 +- sound/pci/au88x0/au88x0_a3d.c | 7 ++- sound/pci/au88x0/au88x0_core.c | 19 +++++-- sound/pci/au88x0/au88x0_synth.c | 39 ++++++++++--- sound/pci/azt3328.c | 8 +-- sound/pci/ca0106/ca0106_main.c | 91 +++++++++++++++++++++++------- sound/pci/cs4281.c | 6 +- sound/pci/cs46xx/cs46xx_lib.c | 6 +- sound/pci/cs46xx/cs46xx_lib.h | 6 +- sound/pci/cs5535audio/cs5535audio.c | 2 +- sound/pci/ens1370.c | 3 +- sound/pci/es1938.c | 23 +++++--- sound/pci/mixart/mixart_hwdep.c | 46 ++++++++------- sound/pci/sonicvibes.c | 109 ++++++++++++++++++++++++------------ sound/pci/trident/trident_main.c | 57 ++++++++++--------- sound/pci/via82xx.c | 5 +- sound/pci/via82xx_modem.c | 5 +- sound/pci/vx222/vx222_ops.c | 8 ++- sound/pci/ymfpci/ymfpci_main.c | 14 ++++- 21 files changed, 318 insertions(+), 146 deletions(-) (limited to 'sound') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index e2b843b4f9d0..bc707b603852 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -1643,7 +1643,10 @@ static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97) { int err, idx; - //printk("AC97_GPIO_CFG = %x\n",snd_ac97_read(ac97,AC97_GPIO_CFG)); + /* + printk(KERN_DEBUG "AC97_GPIO_CFG = %x\n", + snd_ac97_read(ac97,AC97_GPIO_CFG)); + */ snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); snd_ac97_write(ac97, AC97_GPIO_POLARITY, 0xffff & ~(AC97_GPIO_LINE1_OH)); snd_ac97_write(ac97, AC97_GPIO_STICKY, 0xffff); diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c index 0f819ddb3ebf..fd135e3d8a84 100644 --- a/sound/pci/ak4531_codec.c +++ b/sound/pci/ak4531_codec.c @@ -51,7 +51,8 @@ static void snd_ak4531_dump(struct snd_ak4531 *ak4531) int idx; for (idx = 0; idx < 0x19; idx++) - printk("ak4531 0x%x: 0x%x\n", idx, ak4531->regs[idx]); + printk(KERN_DEBUG "ak4531 0x%x: 0x%x\n", + idx, ak4531->regs[idx]); } #endif diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 8df6824b51cd..a2c35c1081c3 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -91,7 +91,7 @@ #define DEBUG_PLAY_REC 0 #if DEBUG_CALLS -#define snd_als300_dbgcalls(format, args...) printk(format, ##args) +#define snd_als300_dbgcalls(format, args...) printk(KERN_DEBUG format, ##args) #define snd_als300_dbgcallenter() printk(KERN_ERR "--> %s\n", __func__) #define snd_als300_dbgcallleave() printk(KERN_ERR "<-- %s\n", __func__) #else diff --git a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c index 649849e540d3..f4aa8ff6f5f9 100644 --- a/sound/pci/au88x0/au88x0_a3d.c +++ b/sound/pci/au88x0/au88x0_a3d.c @@ -462,9 +462,10 @@ static void a3dsrc_ZeroSliceIO(a3dsrc_t * a) /* Reset Single A3D source. */ static void a3dsrc_ZeroState(a3dsrc_t * a) { - - //printk("vortex: ZeroState slice: %d, source %d\n", a->slice, a->source); - + /* + printk(KERN_DEBUG "vortex: ZeroState slice: %d, source %d\n", + a->slice, a->source); + */ a3dsrc_SetAtmosState(a, 0, 0, 0, 0); a3dsrc_SetHrtfState(a, A3dHrirZeros, A3dHrirZeros); a3dsrc_SetItdDline(a, A3dItdDlineZeros); diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index b070e5714514..e6a04d037c15 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -1135,7 +1135,10 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma, snd_pcm_sgbuf_get_addr(dma->substream, 0)); break; } - //printk("vortex: cfg0 = 0x%x\nvortex: cfg1=0x%x\n", dma->cfg0, dma->cfg1); + /* + printk(KERN_DEBUG "vortex: cfg0 = 0x%x\nvortex: cfg1=0x%x\n", + dma->cfg0, dma->cfg1); + */ hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG0 + (adbdma << 3), dma->cfg0); hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG1 + (adbdma << 3), dma->cfg1); @@ -1959,7 +1962,7 @@ vortex_connect_codecplay(vortex_t * vortex, int en, unsigned char mixers[]) ADB_CODECOUT(0 + 4)); vortex_connection_mix_adb(vortex, en, 0x11, mixers[3], ADB_CODECOUT(1 + 4)); - //printk("SDAC detected "); + /* printk(KERN_DEBUG "SDAC detected "); */ } #else // Use plain direct output to codec. @@ -2013,7 +2016,11 @@ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype) resmap[restype] |= (1 << i); else vortex->dma_adb[i].resources[restype] |= (1 << i); - //printk("vortex: ResManager: type %d out %d\n", restype, i); + /* + printk(KERN_DEBUG + "vortex: ResManager: type %d out %d\n", + restype, i); + */ return i; } } @@ -2024,7 +2031,11 @@ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype) for (i = 0; i < qty; i++) { if (resmap[restype] & (1 << i)) { resmap[restype] &= ~(1 << i); - //printk("vortex: ResManager: type %d in %d\n",restype, i); + /* + printk(KERN_DEBUG + "vortex: ResManager: type %d in %d\n", + restype, i); + */ return i; } } diff --git a/sound/pci/au88x0/au88x0_synth.c b/sound/pci/au88x0/au88x0_synth.c index 978b856f5621..2805e34bd41d 100644 --- a/sound/pci/au88x0/au88x0_synth.c +++ b/sound/pci/au88x0/au88x0_synth.c @@ -213,38 +213,59 @@ vortex_wt_SetReg(vortex_t * vortex, unsigned char reg, int wt, switch (reg) { /* Voice specific parameters */ case 0: /* running */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_RUN(wt), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_RUN(wt), (int)val); + */ hwwrite(vortex->mmio, WT_RUN(wt), val); return 0xc; break; case 1: /* param 0 */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,0), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_PARM(wt,0), (int)val); + */ hwwrite(vortex->mmio, WT_PARM(wt, 0), val); return 0xc; break; case 2: /* param 1 */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,1), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_PARM(wt,1), (int)val); + */ hwwrite(vortex->mmio, WT_PARM(wt, 1), val); return 0xc; break; case 3: /* param 2 */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,2), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_PARM(wt,2), (int)val); + */ hwwrite(vortex->mmio, WT_PARM(wt, 2), val); return 0xc; break; case 4: /* param 3 */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,3), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_PARM(wt,3), (int)val); + */ hwwrite(vortex->mmio, WT_PARM(wt, 3), val); return 0xc; break; case 6: /* mute */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_MUTE(wt), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_MUTE(wt), (int)val); + */ hwwrite(vortex->mmio, WT_MUTE(wt), val); return 0xc; break; case 0xb: { /* delay */ - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_DELAY(wt,0), (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", + WT_DELAY(wt,0), (int)val); + */ hwwrite(vortex->mmio, WT_DELAY(wt, 3), val); hwwrite(vortex->mmio, WT_DELAY(wt, 2), val); hwwrite(vortex->mmio, WT_DELAY(wt, 1), val); @@ -272,7 +293,9 @@ vortex_wt_SetReg(vortex_t * vortex, unsigned char reg, int wt, return 0; break; } - //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", ecx, (int)val); + /* + printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", ecx, (int)val); + */ hwwrite(vortex->mmio, ecx, val); return 1; } diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 333007c523a1..8121763b0c10 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -211,25 +211,25 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); #endif #if DEBUG_MIXER -#define snd_azf3328_dbgmixer(format, args...) printk(format, ##args) +#define snd_azf3328_dbgmixer(format, args...) printk(KERN_DEBUG format, ##args) #else #define snd_azf3328_dbgmixer(format, args...) #endif #if DEBUG_PLAY_REC -#define snd_azf3328_dbgplay(format, args...) printk(KERN_ERR format, ##args) +#define snd_azf3328_dbgplay(format, args...) printk(KERN_DEBUG format, ##args) #else #define snd_azf3328_dbgplay(format, args...) #endif #if DEBUG_MISC -#define snd_azf3328_dbgtimer(format, args...) printk(KERN_ERR format, ##args) +#define snd_azf3328_dbgtimer(format, args...) printk(KERN_DEBUG format, ##args) #else #define snd_azf3328_dbgtimer(format, args...) #endif #if DEBUG_GAME -#define snd_azf3328_dbggame(format, args...) printk(KERN_ERR format, ##args) +#define snd_azf3328_dbggame(format, args...) printk(KERN_DEBUG format, ##args) #else #define snd_azf3328_dbggame(format, args...) #endif diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 0e62205d4081..f2f8fd17ea4d 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -404,7 +404,9 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, } tmp = reg << 25 | value << 16; - // snd_printk("I2C-write:reg=0x%x, value=0x%x\n", reg, value); + /* + snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value); + */ /* Not sure what this I2C channel controls. */ /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ @@ -422,7 +424,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, /* Wait till the transaction ends */ while (1) { status = snd_ca0106_ptr_read(emu, I2C_A, 0); - //snd_printk("I2C:status=0x%x\n", status); + /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/ timeout++; if ((status & I2C_A_ADC_START) == 0) break; @@ -521,7 +523,10 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr channel->number = channel_id; channel->use = 1; - //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); + /* + printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + channel_id, chip, channel); + */ //channel->interrupt = snd_ca0106_pcm_channel_interrupt; channel->epcm = epcm; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) @@ -614,7 +619,10 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre channel->number = channel_id; channel->use = 1; - //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); + /* + printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + channel_id, chip, channel); + */ //channel->interrupt = snd_ca0106_pcm_channel_interrupt; channel->epcm = epcm; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) @@ -705,9 +713,20 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) u32 reg71; int i; - //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); - //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); - //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#if 0 /* debug */ + snd_printk(KERN_DEBUG + "prepare:channel_number=%d, rate=%d, format=0x%x, " + "channels=%d, buffer_size=%ld, period_size=%ld, " + "periods=%u, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, + runtime->channels, runtime->buffer_size, + runtime->period_size, runtime->periods, + frames_to_bytes(runtime, 1)); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", + runtime->dma_addr, runtime->dma_area, table_base); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", + emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#endif /* debug */ /* Rate can be set per channel. */ /* reg40 control host to fifo */ /* reg71 controls DAC rate. */ @@ -799,9 +818,20 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) u32 reg71_set = 0; u32 reg71; - //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); - //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); - //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#if 0 /* debug */ + snd_printk(KERN_DEBUG + "prepare:channel_number=%d, rate=%d, format=0x%x, " + "channels=%d, buffer_size=%ld, period_size=%ld, " + "periods=%u, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, + runtime->channels, runtime->buffer_size, + runtime->period_size, runtime->periods, + frames_to_bytes(runtime, 1)); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", + runtime->dma_addr, runtime->dma_area, table_base); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", + emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#endif /* debug */ /* reg71 controls ADC rate. */ switch (runtime->rate) { case 44100: @@ -846,7 +876,14 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) } - //printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); + /* + printk(KERN_DEBUG + "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, " + "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, runtime->channels, + runtime->buffer_size, runtime->period_size, + frames_to_bytes(runtime, 1)); + */ snd_ca0106_ptr_write(emu, 0x13, channel, 0); snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes @@ -888,13 +925,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, runtime = s->runtime; epcm = runtime->private_data; channel = epcm->channel_id; - /* snd_printk("channel=%d\n",channel); */ + /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ epcm->running = running; basic |= (0x1 << channel); extended |= (0x10 << channel); snd_pcm_trigger_done(s, substream); } - /* snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); */ + /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */ switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -972,8 +1009,13 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream) ptr=ptr2; if (ptr >= runtime->buffer_size) ptr -= runtime->buffer_size; - //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); - + /* + printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " + "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", + ptr1, ptr2, ptr, (int)runtime->buffer_size, + (int)runtime->period_size, (int)runtime->frame_bits, + (int)runtime->rate); + */ return ptr; } @@ -995,8 +1037,13 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream) ptr=ptr2; if (ptr >= runtime->buffer_size) ptr -= runtime->buffer_size; - //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); - + /* + printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " + "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", + ptr1, ptr2, ptr, (int)runtime->buffer_size, + (int)runtime->period_size, (int)runtime->frame_bits, + (int)runtime->rate); + */ return ptr; } @@ -1181,8 +1228,12 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) return IRQ_NONE; stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); - //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); - //snd_printk("ptr=0x%08x\n",snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); + /* + snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n", + status, stat76); + snd_printk(KERN_DEBUG "ptr=0x%08x\n", + snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); + */ mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ for(i = 0; i < 4; i++) { pchannel = &(chip->playback_channels[i]); @@ -1470,7 +1521,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) int size, n; size = ARRAY_SIZE(i2c_adc_init); - /* snd_printk("I2C:array size=0x%x\n", size); */ + /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */ for (n = 0; n < size; n++) snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], i2c_adc_init[n][1]); diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 192e7842e181..415e88f2c62f 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -834,7 +834,11 @@ static snd_pcm_uframes_t snd_cs4281_pointer(struct snd_pcm_substream *substream) struct cs4281_dma *dma = runtime->private_data; struct cs4281 *chip = snd_pcm_substream_chip(substream); - // printk("DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, jiffies); + /* + printk(KERN_DEBUG "DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", + snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, + jiffies); + */ return runtime->buffer_size - snd_cs4281_peekBA0(chip, dma->regDCC) - 1; } diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 8ab07aa63652..1be96ead4244 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -194,7 +194,7 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip, * ACSDA = Status Data Register = 474h */ #if 0 - printk("e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, + printk(KERN_DEBUG "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, snd_cs46xx_peekBA0(chip, BA0_ACSDA), snd_cs46xx_peekBA0(chip, BA0_ACCAD)); #endif @@ -428,8 +428,8 @@ static int cs46xx_wait_for_fifo(struct snd_cs46xx * chip,int retry_timeout) } if(status & SERBST_WBSY) { - snd_printk( KERN_ERR "cs46xx: failure waiting for FIFO command to complete\n"); - + snd_printk(KERN_ERR "cs46xx: failure waiting for " + "FIFO command to complete\n"); return -EINVAL; } diff --git a/sound/pci/cs46xx/cs46xx_lib.h b/sound/pci/cs46xx/cs46xx_lib.h index 018a7de56017..4eb55aa33612 100644 --- a/sound/pci/cs46xx/cs46xx_lib.h +++ b/sound/pci/cs46xx/cs46xx_lib.h @@ -62,7 +62,11 @@ static inline void snd_cs46xx_poke(struct snd_cs46xx *chip, unsigned long reg, u unsigned int bank = reg >> 16; unsigned int offset = reg & 0xffff; - /*if (bank == 0) printk("snd_cs46xx_poke: %04X - %08X\n",reg >> 2,val); */ + /* + if (bank == 0) + printk(KERN_DEBUG "snd_cs46xx_poke: %04X - %08X\n", + reg >> 2,val); + */ writel(val, chip->region.idx[bank+1].remap_addr + offset); } diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 826e6dec2e97..6506201d56f6 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c @@ -312,7 +312,7 @@ static int __devinit snd_cs5535audio_create(struct snd_card *card, if (request_irq(pci->irq, snd_cs5535audio_interrupt, IRQF_SHARED, "CS5535 Audio", cs5535au)) { - snd_printk("unable to grab IRQ %d\n", pci->irq); + snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); err = -EBUSY; goto sndfail; } diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 9bf95367c882..17674b3406bd 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -584,7 +584,8 @@ static void snd_es1370_codec_write(struct snd_ak4531 *ak4531, unsigned long end_time = jiffies + HZ / 10; #if 0 - printk("CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", + printk(KERN_DEBUG + "CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); #endif do { diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 4cd9a1faaecc..e4ba84bed4ad 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1673,18 +1673,22 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id) status = inb(SLIO_REG(chip, IRQCONTROL)); #if 0 - printk("Es1938debug - interrupt status: =0x%x\n", status); + printk(KERN_DEBUG "Es1938debug - interrupt status: =0x%x\n", status); #endif /* AUDIO 1 */ if (status & 0x10) { #if 0 - printk("Es1938debug - AUDIO channel 1 interrupt\n"); - printk("Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 1 interrupt\n"); + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", inw(SLDM_REG(chip, DMACOUNT))); - printk("Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", inl(SLDM_REG(chip, DMAADDR))); - printk("Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", inl(SLDM_REG(chip, DMASTATUS))); #endif /* clear irq */ @@ -1699,10 +1703,13 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id) /* AUDIO 2 */ if (status & 0x20) { #if 0 - printk("Es1938debug - AUDIO channel 2 interrupt\n"); - printk("Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 2 interrupt\n"); + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", inw(SLIO_REG(chip, AUDIO2DMACOUNT))); - printk("Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", + printk(KERN_DEBUG + "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", inl(SLIO_REG(chip, AUDIO2DMAADDR))); #endif diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 3782b52bc0e8..dda562081d7e 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c @@ -345,8 +345,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw status_daught = readl_be( MIXART_MEM( mgr,MIXART_PSEUDOREG_DXLX_STATUS_OFFSET )); /* motherboard xilinx status 5 will say that the board is performing a reset */ - if( status_xilinx == 5 ) { - snd_printk( KERN_ERR "miXart is resetting !\n"); + if (status_xilinx == 5) { + snd_printk(KERN_ERR "miXart is resetting !\n"); return -EAGAIN; /* try again later */ } @@ -354,13 +354,14 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw case MIXART_MOTHERBOARD_XLX_INDEX: /* xilinx already loaded ? */ - if( status_xilinx == 4 ) { - snd_printk( KERN_DEBUG "xilinx is already loaded !\n"); + if (status_xilinx == 4) { + snd_printk(KERN_DEBUG "xilinx is already loaded !\n"); return 0; } /* the status should be 0 == "idle" */ - if( status_xilinx != 0 ) { - snd_printk( KERN_ERR "xilinx load error ! status = %d\n", status_xilinx); + if (status_xilinx != 0) { + snd_printk(KERN_ERR "xilinx load error ! status = %d\n", + status_xilinx); return -EIO; /* modprob -r may help ? */ } @@ -389,21 +390,23 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw case MIXART_MOTHERBOARD_ELF_INDEX: - if( status_elf == 4 ) { - snd_printk( KERN_DEBUG "elf file already loaded !\n"); + if (status_elf == 4) { + snd_printk(KERN_DEBUG "elf file already loaded !\n"); return 0; } /* the status should be 0 == "idle" */ - if( status_elf != 0 ) { - snd_printk( KERN_ERR "elf load error ! status = %d\n", status_elf); + if (status_elf != 0) { + snd_printk(KERN_ERR "elf load error ! status = %d\n", + status_elf); return -EIO; /* modprob -r may help ? */ } /* wait for xilinx status == 4 */ err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET, 1, 4, 500); /* 5sec */ if (err < 0) { - snd_printk( KERN_ERR "xilinx was not loaded or could not be started\n"); + snd_printk(KERN_ERR "xilinx was not loaded or " + "could not be started\n"); return err; } @@ -424,7 +427,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw /* wait for elf status == 4 */ err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_ELF_STATUS_OFFSET, 1, 4, 300); /* 3sec */ if (err < 0) { - snd_printk( KERN_ERR "elf could not be started\n"); + snd_printk(KERN_ERR "elf could not be started\n"); return err; } @@ -437,15 +440,16 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw default: /* elf and xilinx should be loaded */ - if( (status_elf != 4) || (status_xilinx != 4) ) { - printk( KERN_ERR "xilinx or elf not successfully loaded\n"); + if (status_elf != 4 || status_xilinx != 4) { + printk(KERN_ERR "xilinx or elf not " + "successfully loaded\n"); return -EIO; /* modprob -r may help ? */ } /* wait for daughter detection != 0 */ err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DBRD_PRESENCE_OFFSET, 0, 0, 30); /* 300msec */ if (err < 0) { - snd_printk( KERN_ERR "error starting elf file\n"); + snd_printk(KERN_ERR "error starting elf file\n"); return err; } @@ -460,8 +464,9 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw return -EINVAL; /* daughter should be idle */ - if( status_daught != 0 ) { - printk( KERN_ERR "daughter load error ! status = %d\n", status_daught); + if (status_daught != 0) { + printk(KERN_ERR "daughter load error ! status = %d\n", + status_daught); return -EIO; /* modprob -r may help ? */ } @@ -480,7 +485,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw /* wait for status == 2 */ err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 2, 30); /* 300msec */ if (err < 0) { - snd_printk( KERN_ERR "daughter board load error\n"); + snd_printk(KERN_ERR "daughter board load error\n"); return err; } @@ -502,7 +507,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw /* wait for daughter status == 3 */ err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 3, 300); /* 3sec */ if (err < 0) { - snd_printk( KERN_ERR "daughter board could not be initialised\n"); + snd_printk(KERN_ERR + "daughter board could not be initialised\n"); return err; } @@ -512,7 +518,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw /* first communication with embedded */ err = mixart_first_init(mgr); if (err < 0) { - snd_printk( KERN_ERR "miXart could not be set up\n"); + snd_printk(KERN_ERR "miXart could not be set up\n"); return err; } diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index cd408b86c839..e922b1887b1d 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -273,7 +273,8 @@ static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic, outl(count, sonic->dmaa_port + SV_DMA_COUNT0); outb(0x18, sonic->dmaa_port + SV_DMA_MODE); #if 0 - printk("program dmaa: addr = 0x%x, paddr = 0x%x\n", addr, inl(sonic->dmaa_port + SV_DMA_ADDR0)); + printk(KERN_DEBUG "program dmaa: addr = 0x%x, paddr = 0x%x\n", + addr, inl(sonic->dmaa_port + SV_DMA_ADDR0)); #endif } @@ -288,7 +289,8 @@ static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic, outl(count, sonic->dmac_port + SV_DMA_COUNT0); outb(0x14, sonic->dmac_port + SV_DMA_MODE); #if 0 - printk("program dmac: addr = 0x%x, paddr = 0x%x\n", addr, inl(sonic->dmac_port + SV_DMA_ADDR0)); + printk(KERN_DEBUG "program dmac: addr = 0x%x, paddr = 0x%x\n", + addr, inl(sonic->dmac_port + SV_DMA_ADDR0)); #endif } @@ -355,71 +357,104 @@ static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char #if 0 static void snd_sonicvibes_debug(struct sonicvibes * sonic) { - printk("SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX))); + printk(KERN_DEBUG + "SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX))); printk(" STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS))); - printk(" 0x00: left input = 0x%02x ", snd_sonicvibes_in(sonic, 0x00)); + printk(KERN_DEBUG + " 0x00: left input = 0x%02x ", snd_sonicvibes_in(sonic, 0x00)); printk(" 0x20: synth rate low = 0x%02x\n", snd_sonicvibes_in(sonic, 0x20)); - printk(" 0x01: right input = 0x%02x ", snd_sonicvibes_in(sonic, 0x01)); + printk(KERN_DEBUG + " 0x01: right input = 0x%02x ", snd_sonicvibes_in(sonic, 0x01)); printk(" 0x21: synth rate high = 0x%02x\n", snd_sonicvibes_in(sonic, 0x21)); - printk(" 0x02: left AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x02)); + printk(KERN_DEBUG + " 0x02: left AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x02)); printk(" 0x22: ADC clock = 0x%02x\n", snd_sonicvibes_in(sonic, 0x22)); - printk(" 0x03: right AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x03)); + printk(KERN_DEBUG + " 0x03: right AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x03)); printk(" 0x23: ADC alt rate = 0x%02x\n", snd_sonicvibes_in(sonic, 0x23)); - printk(" 0x04: left CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x04)); + printk(KERN_DEBUG + " 0x04: left CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x04)); printk(" 0x24: ADC pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x24)); - printk(" 0x05: right CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x05)); + printk(KERN_DEBUG + " 0x05: right CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x05)); printk(" 0x25: ADC pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x25)); - printk(" 0x06: left line = 0x%02x ", snd_sonicvibes_in(sonic, 0x06)); + printk(KERN_DEBUG + " 0x06: left line = 0x%02x ", snd_sonicvibes_in(sonic, 0x06)); printk(" 0x26: Synth pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x26)); - printk(" 0x07: right line = 0x%02x ", snd_sonicvibes_in(sonic, 0x07)); + printk(KERN_DEBUG + " 0x07: right line = 0x%02x ", snd_sonicvibes_in(sonic, 0x07)); printk(" 0x27: Synth pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x27)); - printk(" 0x08: MIC = 0x%02x ", snd_sonicvibes_in(sonic, 0x08)); + printk(KERN_DEBUG + " 0x08: MIC = 0x%02x ", snd_sonicvibes_in(sonic, 0x08)); printk(" 0x28: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x28)); - printk(" 0x09: Game port = 0x%02x ", snd_sonicvibes_in(sonic, 0x09)); + printk(KERN_DEBUG + " 0x09: Game port = 0x%02x ", snd_sonicvibes_in(sonic, 0x09)); printk(" 0x29: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x29)); - printk(" 0x0a: left synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0a)); + printk(KERN_DEBUG + " 0x0a: left synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0a)); printk(" 0x2a: MPU401 = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2a)); - printk(" 0x0b: right synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0b)); + printk(KERN_DEBUG + " 0x0b: right synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0b)); printk(" 0x2b: drive ctrl = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2b)); - printk(" 0x0c: left AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0c)); + printk(KERN_DEBUG + " 0x0c: left AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0c)); printk(" 0x2c: SRS space = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2c)); - printk(" 0x0d: right AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0d)); + printk(KERN_DEBUG + " 0x0d: right AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0d)); printk(" 0x2d: SRS center = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2d)); - printk(" 0x0e: left analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0e)); + printk(KERN_DEBUG + " 0x0e: left analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0e)); printk(" 0x2e: wave source = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2e)); - printk(" 0x0f: right analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0f)); + printk(KERN_DEBUG + " 0x0f: right analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0f)); printk(" 0x2f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2f)); - printk(" 0x10: left PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x10)); + printk(KERN_DEBUG + " 0x10: left PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x10)); printk(" 0x30: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x30)); - printk(" 0x11: right PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x11)); + printk(KERN_DEBUG + " 0x11: right PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x11)); printk(" 0x31: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x31)); - printk(" 0x12: DMA data format = 0x%02x ", snd_sonicvibes_in(sonic, 0x12)); + printk(KERN_DEBUG + " 0x12: DMA data format = 0x%02x ", snd_sonicvibes_in(sonic, 0x12)); printk(" 0x32: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x32)); - printk(" 0x13: P/C enable = 0x%02x ", snd_sonicvibes_in(sonic, 0x13)); + printk(KERN_DEBUG + " 0x13: P/C enable = 0x%02x ", snd_sonicvibes_in(sonic, 0x13)); printk(" 0x33: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x33)); - printk(" 0x14: U/D button = 0x%02x ", snd_sonicvibes_in(sonic, 0x14)); + printk(KERN_DEBUG + " 0x14: U/D button = 0x%02x ", snd_sonicvibes_in(sonic, 0x14)); printk(" 0x34: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x34)); - printk(" 0x15: revision = 0x%02x ", snd_sonicvibes_in(sonic, 0x15)); + printk(KERN_DEBUG + " 0x15: revision = 0x%02x ", snd_sonicvibes_in(sonic, 0x15)); printk(" 0x35: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x35)); - printk(" 0x16: ADC output ctrl = 0x%02x ", snd_sonicvibes_in(sonic, 0x16)); + printk(KERN_DEBUG + " 0x16: ADC output ctrl = 0x%02x ", snd_sonicvibes_in(sonic, 0x16)); printk(" 0x36: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x36)); - printk(" 0x17: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x17)); + printk(KERN_DEBUG + " 0x17: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x17)); printk(" 0x37: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x37)); - printk(" 0x18: DMA A upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x18)); + printk(KERN_DEBUG + " 0x18: DMA A upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x18)); printk(" 0x38: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x38)); - printk(" 0x19: DMA A lower cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x19)); + printk(KERN_DEBUG + " 0x19: DMA A lower cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x19)); printk(" 0x39: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x39)); - printk(" 0x1a: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1a)); + printk(KERN_DEBUG + " 0x1a: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1a)); printk(" 0x3a: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3a)); - printk(" 0x1b: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1b)); + printk(KERN_DEBUG + " 0x1b: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1b)); printk(" 0x3b: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3b)); - printk(" 0x1c: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1c)); + printk(KERN_DEBUG + " 0x1c: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1c)); printk(" 0x3c: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3c)); - printk(" 0x1d: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1d)); + printk(KERN_DEBUG + " 0x1d: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1d)); printk(" 0x3d: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3d)); - printk(" 0x1e: PCM rate low = 0x%02x ", snd_sonicvibes_in(sonic, 0x1e)); + printk(KERN_DEBUG + " 0x1e: PCM rate low = 0x%02x ", snd_sonicvibes_in(sonic, 0x1e)); printk(" 0x3e: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3e)); - printk(" 0x1f: PCM rate high = 0x%02x ", snd_sonicvibes_in(sonic, 0x1f)); + printk(KERN_DEBUG + " 0x1f: PCM rate high = 0x%02x ", snd_sonicvibes_in(sonic, 0x1f)); printk(" 0x3f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3f)); } @@ -476,8 +511,8 @@ static void snd_sonicvibes_pll(unsigned int rate, *res_m = m; *res_n = n; #if 0 - printk("metric = %i, xm = %i, xn = %i\n", metric, xm, xn); - printk("pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n); + printk(KERN_DEBUG "metric = %i, xm = %i, xn = %i\n", metric, xm, xn); + printk(KERN_DEBUG "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n); #endif } diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index c612b435ca2b..a9da9c184660 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -68,40 +68,40 @@ static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice) { unsigned int val, tmp; - printk("Trident voice %i:\n", voice); + printk(KERN_DEBUG "Trident voice %i:\n", voice); outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR)); val = inl(TRID_REG(trident, CH_LBA)); - printk("LBA: 0x%x\n", val); + printk(KERN_DEBUG "LBA: 0x%x\n", val); val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); - printk("GVSel: %i\n", val >> 31); - printk("Pan: 0x%x\n", (val >> 24) & 0x7f); - printk("Vol: 0x%x\n", (val >> 16) & 0xff); - printk("CTRL: 0x%x\n", (val >> 12) & 0x0f); - printk("EC: 0x%x\n", val & 0x0fff); + printk(KERN_DEBUG "GVSel: %i\n", val >> 31); + printk(KERN_DEBUG "Pan: 0x%x\n", (val >> 24) & 0x7f); + printk(KERN_DEBUG "Vol: 0x%x\n", (val >> 16) & 0xff); + printk(KERN_DEBUG "CTRL: 0x%x\n", (val >> 12) & 0x0f); + printk(KERN_DEBUG "EC: 0x%x\n", val & 0x0fff); if (trident->device != TRIDENT_DEVICE_ID_NX) { val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS)); - printk("CSO: 0x%x\n", val >> 16); + printk(KERN_DEBUG "CSO: 0x%x\n", val >> 16); printk("Alpha: 0x%x\n", (val >> 4) & 0x0fff); - printk("FMS: 0x%x\n", val & 0x0f); + printk(KERN_DEBUG "FMS: 0x%x\n", val & 0x0f); val = inl(TRID_REG(trident, CH_DX_ESO_DELTA)); - printk("ESO: 0x%x\n", val >> 16); - printk("Delta: 0x%x\n", val & 0xffff); + printk(KERN_DEBUG "ESO: 0x%x\n", val >> 16); + printk(KERN_DEBUG "Delta: 0x%x\n", val & 0xffff); val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); } else { // TRIDENT_DEVICE_ID_NX val = inl(TRID_REG(trident, CH_NX_DELTA_CSO)); tmp = (val >> 24) & 0xff; - printk("CSO: 0x%x\n", val & 0x00ffffff); + printk(KERN_DEBUG "CSO: 0x%x\n", val & 0x00ffffff); val = inl(TRID_REG(trident, CH_NX_DELTA_ESO)); tmp |= (val >> 16) & 0xff00; - printk("Delta: 0x%x\n", tmp); - printk("ESO: 0x%x\n", val & 0x00ffffff); + printk(KERN_DEBUG "Delta: 0x%x\n", tmp); + printk(KERN_DEBUG "ESO: 0x%x\n", val & 0x00ffffff); val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL)); - printk("Alpha: 0x%x\n", val >> 20); - printk("FMS: 0x%x\n", (val >> 16) & 0x0f); + printk(KERN_DEBUG "Alpha: 0x%x\n", val >> 20); + printk(KERN_DEBUG "FMS: 0x%x\n", (val >> 16) & 0x0f); } - printk("FMC: 0x%x\n", (val >> 14) & 3); - printk("RVol: 0x%x\n", (val >> 7) & 0x7f); - printk("CVol: 0x%x\n", val & 0x7f); + printk(KERN_DEBUG "FMC: 0x%x\n", (val >> 14) & 3); + printk(KERN_DEBUG "RVol: 0x%x\n", (val >> 7) & 0x7f); + printk(KERN_DEBUG "CVol: 0x%x\n", val & 0x7f); } #endif @@ -496,12 +496,17 @@ void snd_trident_write_voice_regs(struct snd_trident * trident, outl(regs[4], TRID_REG(trident, CH_START + 16)); #if 0 - printk("written %i channel:\n", voice->number); - printk(" regs[0] = 0x%x/0x%x\n", regs[0], inl(TRID_REG(trident, CH_START + 0))); - printk(" regs[1] = 0x%x/0x%x\n", regs[1], inl(TRID_REG(trident, CH_START + 4))); - printk(" regs[2] = 0x%x/0x%x\n", regs[2], inl(TRID_REG(trident, CH_START + 8))); - printk(" regs[3] = 0x%x/0x%x\n", regs[3], inl(TRID_REG(trident, CH_START + 12))); - printk(" regs[4] = 0x%x/0x%x\n", regs[4], inl(TRID_REG(trident, CH_START + 16))); + printk(KERN_DEBUG "written %i channel:\n", voice->number); + printk(KERN_DEBUG " regs[0] = 0x%x/0x%x\n", + regs[0], inl(TRID_REG(trident, CH_START + 0))); + printk(KERN_DEBUG " regs[1] = 0x%x/0x%x\n", + regs[1], inl(TRID_REG(trident, CH_START + 4))); + printk(KERN_DEBUG " regs[2] = 0x%x/0x%x\n", + regs[2], inl(TRID_REG(trident, CH_START + 8))); + printk(KERN_DEBUG " regs[3] = 0x%x/0x%x\n", + regs[3], inl(TRID_REG(trident, CH_START + 12))); + printk(KERN_DEBUG " regs[4] = 0x%x/0x%x\n", + regs[4], inl(TRID_REG(trident, CH_START + 16))); #endif } @@ -583,7 +588,7 @@ static void snd_trident_write_vol_reg(struct snd_trident * trident, outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2)); break; case TRIDENT_DEVICE_ID_SI7018: - // printk("voice->Vol = 0x%x\n", voice->Vol); + /* printk(KERN_DEBUG "voice->Vol = 0x%x\n", voice->Vol); */ outw((voice->CTRL << 12) | voice->Vol, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); break; diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 1aafe956ee2b..fc62d6380f86 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -466,7 +466,10 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre flag = VIA_TBL_BIT_FLAG; /* period boundary */ } else flag = 0; /* period continues to the next */ - // printk("via: tbl %d: at %d size %d (rest %d)\n", idx, ofs, r, rest); + /* + printk(KERN_DEBUG "via: tbl %d: at %d size %d " + "(rest %d)\n", idx, ofs, r, rest); + */ ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); dev->idx_table[idx].offset = ofs; dev->idx_table[idx].size = r; diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 5bd79d2a5a15..c0d9cc9dad44 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -328,7 +328,10 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre flag = VIA_TBL_BIT_FLAG; /* period boundary */ } else flag = 0; /* period continues to the next */ - // printk("via: tbl %d: at %d size %d (rest %d)\n", idx, ofs, r, rest); + /* + printk(KERN_DEBUG "via: tbl %d: at %d size %d " + "(rest %d)\n", idx, ofs, r, rest); + */ ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); dev->idx_table[idx].offset = ofs; dev->idx_table[idx].size = r; diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 7e87f398ff0b..c0efe4491116 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c @@ -107,7 +107,9 @@ static unsigned char vx2_inb(struct vx_core *chip, int offset) static void vx2_outb(struct vx_core *chip, int offset, unsigned char val) { outb(val, vx2_reg_addr(chip, offset)); - //printk("outb: %x -> %x\n", val, vx2_reg_addr(chip, offset)); + /* + printk(KERN_DEBUG "outb: %x -> %x\n", val, vx2_reg_addr(chip, offset)); + */ } /** @@ -126,7 +128,9 @@ static unsigned int vx2_inl(struct vx_core *chip, int offset) */ static void vx2_outl(struct vx_core *chip, int offset, unsigned int val) { - // printk("outl: %x -> %x\n", val, vx2_reg_addr(chip, offset)); + /* + printk(KERN_DEBUG "outl: %x -> %x\n", val, vx2_reg_addr(chip, offset)); + */ outl(val, vx2_reg_addr(chip, offset)); } diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 90d0d62bd0b4..2f0925236a1b 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -318,7 +318,12 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_ ypcm->period_pos += delta; ypcm->last_pos = pos; if (ypcm->period_pos >= ypcm->period_size) { - // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start); + /* + printk(KERN_DEBUG + "done - active_bank = 0x%x, start = 0x%x\n", + chip->active_bank, + voice->bank[chip->active_bank].start); + */ ypcm->period_pos %= ypcm->period_size; spin_unlock(&chip->reg_lock); snd_pcm_period_elapsed(ypcm->substream); @@ -366,7 +371,12 @@ static void snd_ymfpci_pcm_capture_interrupt(struct snd_pcm_substream *substream ypcm->last_pos = pos; if (ypcm->period_pos >= ypcm->period_size) { ypcm->period_pos %= ypcm->period_size; - // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start); + /* + printk(KERN_DEBUG + "done - active_bank = 0x%x, start = 0x%x\n", + chip->active_bank, + voice->bank[chip->active_bank].start); + */ spin_unlock(&chip->reg_lock); snd_pcm_period_elapsed(substream); spin_lock(&chip->reg_lock); -- cgit v1.2.3 From 2ebfb8eeb8f244f9d25937d31a947895cf819e26 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:11:58 +0100 Subject: ALSA: Add missing KERN_* prefix to printk in other sound/* Signed-off-by: Takashi Iwai --- sound/arm/sa11xx-uda1341.c | 2 +- sound/mips/au1x00.c | 2 +- sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 23 +++++++++++++++-------- sound/pcmcia/pdaudiocf/pdaudiocf_irq.c | 4 ++-- sound/sparc/amd7930.c | 5 +++-- 5 files changed, 22 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index 1dcd51d81d10..ed481a866a3e 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c @@ -914,7 +914,7 @@ static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr) snd_card_set_dev(card, &devptr->dev); if ((err = snd_card_register(card)) == 0) { - printk( KERN_INFO "iPAQ audio support initialized\n" ); + printk(KERN_INFO "iPAQ audio support initialized\n"); platform_set_drvdata(devptr, card); return 0; } diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index 1881cec11e78..7c1afc96ab87 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c @@ -678,7 +678,7 @@ au1000_init(void) return err; } - printk( KERN_INFO "ALSA AC97: Driver Initialized\n" ); + printk(KERN_INFO "ALSA AC97: Driver Initialized\n"); au1000_card = card; return 0; } diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index dfa40b0ed86d..5d2afa0b0ce4 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c @@ -82,14 +82,21 @@ static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned c #if 0 void pdacf_dump(struct snd_pdacf *chip) { - printk("PDAUDIOCF DUMP (0x%lx):\n", chip->port); - printk("WPD : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_WDP)); - printk("RDP : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_RDP)); - printk("TCR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_TCR)); - printk("SCR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_SCR)); - printk("ISR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_ISR)); - printk("IER : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_IER)); - printk("AK_IFR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_AK_IFR)); + printk(KERN_DEBUG "PDAUDIOCF DUMP (0x%lx):\n", chip->port); + printk(KERN_DEBUG "WPD : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_WDP)); + printk(KERN_DEBUG "RDP : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_RDP)); + printk(KERN_DEBUG "TCR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_TCR)); + printk(KERN_DEBUG "SCR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_SCR)); + printk(KERN_DEBUG "ISR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_ISR)); + printk(KERN_DEBUG "IER : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_IER)); + printk(KERN_DEBUG "AK_IFR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_AK_IFR)); } #endif diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c index ea903c8e90dd..dcd32201bc8c 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c @@ -269,7 +269,7 @@ void pdacf_tasklet(unsigned long private_data) rdp = inw(chip->port + PDAUDIOCF_REG_RDP); wdp = inw(chip->port + PDAUDIOCF_REG_WDP); - // printk("TASKLET: rdp = %x, wdp = %x\n", rdp, wdp); + /* printk(KERN_DEBUG "TASKLET: rdp = %x, wdp = %x\n", rdp, wdp); */ size = wdp - rdp; if (size < 0) size += 0x10000; @@ -321,5 +321,5 @@ void pdacf_tasklet(unsigned long private_data) spin_lock(&chip->reg_lock); } spin_unlock(&chip->reg_lock); - // printk("TASKLET: end\n"); + /* printk(KERN_DEBUG "TASKLET: end\n"); */ } diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index f87933e48812..7cbc725934e5 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c @@ -954,7 +954,8 @@ static int __devinit snd_amd7930_create(struct snd_card *card, amd->regs = of_ioremap(&op->resource[0], 0, resource_size(&op->resource[0]), "amd7930"); if (!amd->regs) { - snd_printk("amd7930-%d: Unable to map chip registers.\n", dev); + snd_printk(KERN_ERR + "amd7930-%d: Unable to map chip registers.\n", dev); return -EIO; } @@ -962,7 +963,7 @@ static int __devinit snd_amd7930_create(struct snd_card *card, if (request_irq(irq, snd_amd7930_interrupt, IRQF_DISABLED | IRQF_SHARED, "amd7930", amd)) { - snd_printk("amd7930-%d: Unable to grab IRQ %d\n", + snd_printk(KERN_ERR "amd7930-%d: Unable to grab IRQ %d\n", dev, irq); snd_amd7930_free(amd); return -EBUSY; -- cgit v1.2.3 From dd542f169aaa35f4ac0d063e04b41c648a93887c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:15:39 +0100 Subject: ALSA: ca0106 - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/pci/ca0106/ca0106_main.c | 91 ++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 3aac7e6489c6..dac8a5f040ef 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -412,7 +412,9 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, } tmp = reg << 25 | value << 16; - // snd_printk("I2C-write:reg=0x%x, value=0x%x\n", reg, value); + /* + snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value); + */ /* Not sure what this I2C channel controls. */ /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ @@ -430,7 +432,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, /* Wait till the transaction ends */ while (1) { status = snd_ca0106_ptr_read(emu, I2C_A, 0); - //snd_printk("I2C:status=0x%x\n", status); + /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/ timeout++; if ((status & I2C_A_ADC_START) == 0) break; @@ -529,7 +531,10 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr channel->number = channel_id; channel->use = 1; - //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); + /* + printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + channel_id, chip, channel); + */ //channel->interrupt = snd_ca0106_pcm_channel_interrupt; channel->epcm = epcm; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) @@ -622,7 +627,10 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre channel->number = channel_id; channel->use = 1; - //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); + /* + printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + channel_id, chip, channel); + */ //channel->interrupt = snd_ca0106_pcm_channel_interrupt; channel->epcm = epcm; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) @@ -713,9 +721,20 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) u32 reg71; int i; - //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); - //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); - //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#if 0 /* debug */ + snd_printk(KERN_DEBUG + "prepare:channel_number=%d, rate=%d, format=0x%x, " + "channels=%d, buffer_size=%ld, period_size=%ld, " + "periods=%u, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, + runtime->channels, runtime->buffer_size, + runtime->period_size, runtime->periods, + frames_to_bytes(runtime, 1)); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", + runtime->dma_addr, runtime->dma_area, table_base); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", + emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#endif /* debug */ /* Rate can be set per channel. */ /* reg40 control host to fifo */ /* reg71 controls DAC rate. */ @@ -807,9 +826,20 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) u32 reg71_set = 0; u32 reg71; - //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); - //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); - //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#if 0 /* debug */ + snd_printk(KERN_DEBUG + "prepare:channel_number=%d, rate=%d, format=0x%x, " + "channels=%d, buffer_size=%ld, period_size=%ld, " + "periods=%u, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, + runtime->channels, runtime->buffer_size, + runtime->period_size, runtime->periods, + frames_to_bytes(runtime, 1)); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", + runtime->dma_addr, runtime->dma_area, table_base); + snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", + emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); +#endif /* debug */ /* reg71 controls ADC rate. */ switch (runtime->rate) { case 44100: @@ -854,7 +884,14 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) } - //printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); + /* + printk(KERN_DEBUG + "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, " + "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n", + channel, runtime->rate, runtime->format, runtime->channels, + runtime->buffer_size, runtime->period_size, + frames_to_bytes(runtime, 1)); + */ snd_ca0106_ptr_write(emu, 0x13, channel, 0); snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes @@ -896,13 +933,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, runtime = s->runtime; epcm = runtime->private_data; channel = epcm->channel_id; - /* snd_printk("channel=%d\n",channel); */ + /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ epcm->running = running; basic |= (0x1 << channel); extended |= (0x10 << channel); snd_pcm_trigger_done(s, substream); } - /* snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); */ + /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */ switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -980,8 +1017,13 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream) ptr=ptr2; if (ptr >= runtime->buffer_size) ptr -= runtime->buffer_size; - //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); - + /* + printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " + "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", + ptr1, ptr2, ptr, (int)runtime->buffer_size, + (int)runtime->period_size, (int)runtime->frame_bits, + (int)runtime->rate); + */ return ptr; } @@ -1003,8 +1045,13 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream) ptr=ptr2; if (ptr >= runtime->buffer_size) ptr -= runtime->buffer_size; - //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); - + /* + printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " + "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", + ptr1, ptr2, ptr, (int)runtime->buffer_size, + (int)runtime->period_size, (int)runtime->frame_bits, + (int)runtime->rate); + */ return ptr; } @@ -1189,8 +1236,12 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) return IRQ_NONE; stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); - //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); - //snd_printk("ptr=0x%08x\n",snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); + /* + snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n", + status, stat76); + snd_printk(KERN_DEBUG "ptr=0x%08x\n", + snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); + */ mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ for(i = 0; i < 4; i++) { pchannel = &(chip->playback_channels[i]); @@ -1478,7 +1529,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) int size, n; size = ARRAY_SIZE(i2c_adc_init); - /* snd_printk("I2C:array size=0x%x\n", size); */ + /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */ for (n = 0; n < size; n++) snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], i2c_adc_init[n][1]); -- cgit v1.2.3 From b25c9da19889e33bb4ee2dff369fc46caa4543b0 Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Fri, 6 Feb 2009 15:02:27 +0800 Subject: ALSA: enable concurrent digital outputs for ALC1200 Add the SPDIF pin as slave digital out to enable concurrent HDMI/SPDIF outputs for ASUS M3A-H/HDMI with ALC1200 codec. Tested-by: Thomas Schneider Signed-off-by: Wu Fengguang Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_local.h | 1 + sound/pci/hda/patch_realtek.c | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index ec687b206c0a..4086491ed33a 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -229,6 +229,7 @@ struct hda_multi_out { hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */ hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */ hda_nid_t dig_out_nid; /* digital out audio widget */ + hda_nid_t *slave_dig_outs; int max_channels; /* currently supported analog channels */ int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ int no_share_stream; /* don't share a stream with multiple pins */ diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d2812ab729cc..5194a58fafaa 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -349,6 +349,7 @@ struct alc_config_preset { hda_nid_t *dac_nids; hda_nid_t dig_out_nid; /* optional */ hda_nid_t hp_nid; /* optional */ + hda_nid_t *slave_dig_outs; unsigned int num_adc_nids; hda_nid_t *adc_nids; hda_nid_t *capsrc_nids; @@ -824,6 +825,7 @@ static void setup_preset(struct alc_spec *spec, spec->multiout.num_dacs = preset->num_dacs; spec->multiout.dac_nids = preset->dac_nids; spec->multiout.dig_out_nid = preset->dig_out_nid; + spec->multiout.slave_dig_outs = preset->slave_dig_outs; spec->multiout.hp_nid = preset->hp_nid; spec->num_mux_defs = preset->num_mux_defs; @@ -3107,6 +3109,7 @@ static int alc_build_pcms(struct hda_codec *codec) /* SPDIF for stream index #1 */ if (spec->multiout.dig_out_nid || spec->dig_in_nid) { codec->num_pcms = 2; + codec->slave_dig_outs = spec->multiout.slave_dig_outs; info = spec->pcm_rec + 1; info->name = spec->stream_name_digital; if (spec->dig_out_type) @@ -8603,6 +8606,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { {} }; +static hda_nid_t alc1200_slave_dig_outs[] = { + ALC883_DIGOUT_NID, 0, +}; + static struct alc_config_preset alc883_presets[] = { [ALC883_3ST_2ch_DIG] = { .mixers = { alc883_3ST_2ch_mixer }, @@ -8943,6 +8950,7 @@ static struct alc_config_preset alc883_presets[] = { .dac_nids = alc883_dac_nids, .dig_out_nid = ALC1200_DIGOUT_NID, .dig_in_nid = ALC883_DIGIN_NID, + .slave_dig_outs = alc1200_slave_dig_outs, .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), .channel_mode = alc883_sixstack_modes, .input_mux = &alc883_capture_source, -- cgit v1.2.3 From 894dcd78782842924527598b0b764c9b4e679e21 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 6 Feb 2009 08:13:07 +0100 Subject: sound: usb-audio: handle wMaxPacketSize for FIXED_ENDPOINT devices For audio devices that do not have proper audio descriptors (e.g., Edirol UA-20), we use hardcoded parameters from our quirks list. However, we must still read the maximum packet size from the standard endpoint descriptor; otherwise, we might use packets that are too big and therefore rejected by the USB core. Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c709b9563226..2ab83129d9b0 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -2966,6 +2966,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, return -EINVAL; } alts = &iface->altsetting[fp->altset_idx]; + fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); usb_set_interface(chip->dev, fp->iface, 0); init_usb_pitch(chip->dev, fp->iface, alts, fp); init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); -- cgit v1.2.3 From c6e8f2daadc6d61a32b7486a1058c8f1f9baa499 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 12:45:52 +0100 Subject: ALSA: hda - Add missing initialization for ALC272 ALC272 needs EAPD for speaker outputs as well as other similar ALC codecs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a3baa33aedfd..ac1a6e728430 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1037,6 +1037,7 @@ do_sku: case 0x10ec0267: case 0x10ec0268: case 0x10ec0269: + case 0x10ec0272: case 0x10ec0660: case 0x10ec0662: case 0x10ec0663: -- cgit v1.2.3 From 4a5a4c56b443a213fa9c2ad27984a8681a3d7087 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 12:46:59 +0100 Subject: ALSA: hda - Add missing COEF initialization for ALC887 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ac1a6e728430..ae5c8a0d1479 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1066,6 +1066,7 @@ do_sku: case 0x10ec0882: case 0x10ec0883: case 0x10ec0885: + case 0x10ec0887: case 0x10ec0889: snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); -- cgit v1.2.3 From 45bdd1c1bbac56876cb9c71649300013281e4b22 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 16:11:25 +0100 Subject: ALSA: hda - Create beep mixer controls dynamically for Realtek codecs Create beep mixer controls dynamically for Realtek codecs instead of static arrays. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 147 ++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 100 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5194a58fafaa..3b3b483e2a91 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -255,6 +255,7 @@ struct alc_spec { struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ unsigned int num_mixers; struct snd_kcontrol_new *cap_mixer; /* capture mixer */ + unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ const struct hda_verb *init_verbs[5]; /* initialization verbs * don't forget NULL @@ -937,7 +938,7 @@ static void alc_mic_automute(struct hda_codec *codec) HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); } #else -#define alc_mic_automute(codec) /* NOP */ +#define alc_mic_automute(codec) do {} while(0) /* NOP */ #endif /* disabled */ /* unsolicited event for HP jack sensing */ @@ -1389,8 +1390,6 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -1497,8 +1496,6 @@ static struct snd_kcontrol_new alc880_three_stack_mixer[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1720,8 +1717,6 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Channel Mode", @@ -1898,13 +1893,6 @@ static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { { } /* end */ }; -/* additional mixers to alc880_asus_mixer */ -static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), - { } /* end */ -}; - /* TCL S700 */ static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -1937,8 +1925,6 @@ static struct snd_kcontrol_new alc880_uniwill_mixer[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Channel Mode", @@ -2013,6 +1999,13 @@ static const char *alc_slave_sws[] = { static void alc_free_kctls(struct hda_codec *codec); +/* additional beep mixers; the actual parameters are overwritten at build */ +static struct snd_kcontrol_new alc_beep_mixer[] = { + HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), + HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), + { } /* end */ +}; + static int alc_build_controls(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; @@ -2048,6 +2041,21 @@ static int alc_build_controls(struct hda_codec *codec) return err; } + /* create beep controls if needed */ + if (spec->beep_amp) { + struct snd_kcontrol_new *knew; + for (knew = alc_beep_mixer; knew->name; knew++) { + struct snd_kcontrol *kctl; + kctl = snd_ctl_new1(knew, codec); + if (!kctl) + return -ENOMEM; + kctl->private_value = spec->beep_amp; + err = snd_hda_ctl_add(codec, kctl); + if (err < 0) + return err; + } + } + /* if we have no master control, let's create it */ if (!spec->no_analog && !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { @@ -3812,7 +3820,7 @@ static struct alc_config_preset alc880_presets[] = { .input_mux = &alc880_capture_source, }, [ALC880_UNIWILL_DIG] = { - .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, + .mixers = { alc880_asus_mixer }, .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs }, .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), @@ -3850,8 +3858,7 @@ static struct alc_config_preset alc880_presets[] = { .init_hook = alc880_uniwill_p53_hp_automute, }, [ALC880_FUJITSU] = { - .mixers = { alc880_fujitsu_mixer, - alc880_pcbeep_mixer, }, + .mixers = { alc880_fujitsu_mixer }, .init_verbs = { alc880_volume_init_verbs, alc880_uniwill_p53_init_verbs, alc880_beep_init_verbs }, @@ -4310,10 +4317,6 @@ static void alc880_auto_init(struct hda_codec *codec) alc_inithook(codec); } -/* - * OK, here we have finally the patch for ALC880 - */ - static void set_capture_mixer(struct alc_spec *spec) { static struct snd_kcontrol_new *caps[3] = { @@ -4325,6 +4328,13 @@ static void set_capture_mixer(struct alc_spec *spec) spec->cap_mixer = caps[spec->num_adc_nids - 1]; } +#define set_beep_amp(spec, nid, idx, dir) \ + ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) + +/* + * OK, here we have finally the patch for ALC880 + */ + static int patch_alc880(struct hda_codec *codec) { struct alc_spec *spec; @@ -4392,6 +4402,7 @@ static int patch_alc880(struct hda_codec *codec) } } set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x0c; @@ -4541,12 +4552,6 @@ static struct snd_kcontrol_new alc260_input_mixer[] = { { } /* end */ }; -static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), - { } /* end */ -}; - /* update HP, line and mono out pins according to the master switch */ static void alc260_hp_master_update(struct hda_codec *codec, hda_nid_t hp, hda_nid_t line, @@ -4738,8 +4743,6 @@ static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), { } /* end */ @@ -4784,8 +4787,6 @@ static struct snd_kcontrol_new alc260_acer_mixer[] = { HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), { } /* end */ }; @@ -4803,8 +4804,6 @@ static struct snd_kcontrol_new alc260_will_mixer[] = { ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), { } /* end */ }; @@ -5308,8 +5307,6 @@ static struct snd_kcontrol_new alc260_test_mixer[] = { HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), @@ -5737,8 +5734,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = { static struct alc_config_preset alc260_presets[] = { [ALC260_BASIC] = { .mixers = { alc260_base_output_mixer, - alc260_input_mixer, - alc260_pc_beep_mixer }, + alc260_input_mixer }, .init_verbs = { alc260_init_verbs }, .num_dacs = ARRAY_SIZE(alc260_dac_nids), .dac_nids = alc260_dac_nids, @@ -5924,6 +5920,7 @@ static int patch_alc260(struct hda_codec *codec) } } set_capture_mixer(spec); + set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); spec->vmaster_nid = 0x08; @@ -6095,8 +6092,6 @@ static struct snd_kcontrol_new alc882_base_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -6123,8 +6118,6 @@ static struct snd_kcontrol_new alc882_w2jc_mixer[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -6176,8 +6169,6 @@ static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -6286,8 +6277,10 @@ static struct snd_kcontrol_new alc882_macpro_mixer[] = { HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), + /* FIXME: this looks suspicious... HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), + */ { } /* end */ }; @@ -7153,6 +7146,7 @@ static int patch_alc882(struct hda_codec *codec) } } set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x0c; @@ -7429,8 +7423,6 @@ static struct snd_kcontrol_new alc883_base_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -7493,8 +7485,6 @@ static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -7518,8 +7508,6 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -7544,8 +7532,6 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -7569,8 +7555,6 @@ static struct snd_kcontrol_new alc883_fivestack_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -9183,6 +9167,7 @@ static int patch_alc883(struct hda_codec *codec) if (!spec->cap_mixer) set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x0c; @@ -9235,8 +9220,6 @@ static struct snd_kcontrol_new alc262_base_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), - /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), @@ -9257,8 +9240,6 @@ static struct snd_kcontrol_new alc262_hippo1_mixer[] = { HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), - /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), { } /* end */ @@ -9367,8 +9348,6 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), { } /* end */ @@ -9397,8 +9376,6 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -10073,8 +10050,6 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { }, HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), @@ -11085,6 +11060,7 @@ static int patch_alc262(struct hda_codec *codec) } if (!spec->cap_mixer && !spec->no_analog) set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x0c; @@ -12205,8 +12181,6 @@ static struct snd_kcontrol_new alc269_base_mixer[] = { HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), @@ -12233,8 +12207,6 @@ static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), { } }; @@ -12258,8 +12230,6 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = { HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), { } }; @@ -12296,13 +12266,6 @@ static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { { } /* end */ }; -/* beep control */ -static struct snd_kcontrol_new alc269_beep_mixer[] = { - HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), - { } /* end */ -}; - static struct hda_verb alc269_quanta_fl1_verbs[] = { {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, @@ -12749,13 +12712,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec) if (spec->kctls.list) add_mixer(spec, spec->kctls.list); - /* create a beep mixer control if the pin 0x1d isn't assigned */ - for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) - if (spec->autocfg.input_pins[i] == 0x1d) - break; - if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) - add_mixer(spec, alc269_beep_mixer); - add_verb(spec, alc269_init_verbs); spec->num_mux_defs = 1; spec->input_mux = &spec->private_imux[0]; @@ -12868,7 +12824,7 @@ static struct alc_config_preset alc269_presets[] = { .init_hook = alc269_eeepc_dmic_inithook, }, [ALC269_FUJITSU] = { - .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, + .mixers = { alc269_fujitsu_mixer }, .cap_mixer = alc269_epc_capture_mixer, .init_verbs = { alc269_init_verbs, alc269_eeepc_dmic_init_verbs }, @@ -12955,6 +12911,7 @@ static int patch_alc269(struct hda_codec *codec) spec->capsrc_nids = alc269_capsrc_nids; if (!spec->cap_mixer) set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); codec->patch_ops = alc_patch_ops; if (board_config == ALC269_AUTO) @@ -13205,8 +13162,6 @@ static struct snd_kcontrol_new alc861_asus_mixer[] = { static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), { } }; @@ -14049,6 +14004,8 @@ static int patch_alc861(struct hda_codec *codec) spec->stream_digital_playback = &alc861_pcm_digital_playback; spec->stream_digital_capture = &alc861_pcm_digital_capture; + set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); + spec->vmaster_nid = 0x03; codec->patch_ops = alc_patch_ops; @@ -14205,9 +14162,6 @@ static struct snd_kcontrol_new alc861vd_6st_mixer[] = { HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), - { } /* end */ }; @@ -14231,9 +14185,6 @@ static struct snd_kcontrol_new alc861vd_3st_mixer[] = { HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), - { } /* end */ }; @@ -14272,8 +14223,6 @@ static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -15015,6 +14964,7 @@ static int patch_alc861vd(struct hda_codec *codec) spec->capture_style = CAPT_MIX; set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x02; @@ -15203,8 +15153,6 @@ static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -15226,8 +15174,6 @@ static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), { } /* end */ }; @@ -16832,6 +16778,7 @@ static int patch_alc662(struct hda_codec *codec) if (!spec->cap_mixer) set_capture_mixer(spec); + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x02; -- cgit v1.2.3 From c8dcdf829ca1827a802eae841dd04de8c9d6653f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 16:21:20 +0100 Subject: ALSA: hda - Add missing NULL check in snd_hda_create_spdif_in_ctls() Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c9158799ccb6..93412f335dc4 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1984,6 +1984,8 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) } for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) { kctl = snd_ctl_new1(dig_mix, codec); + if (!kctl) + return -ENOMEM; kctl->private_value = nid; err = snd_hda_ctl_add(codec, kctl); if (err < 0) -- cgit v1.2.3 From c44765b8c8bfc883c9868ab7aef37d27b5b14be8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 16:48:10 +0100 Subject: ALSA: hda - Clear codec->beep at release Clear codec->beep field in snd_hda_detach_beep_device() to be sure. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_beep.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 960fd7970384..4de5bacd3929 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c @@ -138,6 +138,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) input_unregister_device(beep->dev); kfree(beep); + codec->beep = NULL; } } EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device); -- cgit v1.2.3 From a4ddeba9c8896cba8c6ce7a98c0b5c755c15a746 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 17:21:09 +0100 Subject: ALSA: hda - Remove superfluous code in patch_realtek.c codec->spec is reset in the caller side. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 76934bc8b484..3d933e307b19 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3202,7 +3202,6 @@ static void alc_free(struct hda_codec *codec) alc_free_kctls(codec); kfree(spec); snd_hda_detach_beep_device(codec); - codec->spec = NULL; /* to be sure */ } #ifdef SND_HDA_NEEDS_RESUME -- cgit v1.2.3 From c5a4bcd0cac546c5d776af881c5e913ba4a9922d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 17:22:05 +0100 Subject: ALSA: hda - Use digital beep for AD codecs Use digital beep instead of analog pc-beep for AD codecs. Create the beep mixer controls dynamically on demand. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 140 +++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 52 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 30399cbf8193..cc02f2df2510 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -27,11 +27,12 @@ #include #include "hda_codec.h" #include "hda_local.h" +#include "hda_beep.h" struct ad198x_spec { struct snd_kcontrol_new *mixers[5]; int num_mixers; - + unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ const struct hda_verb *init_verbs[5]; /* initialization verbs * don't forget NULL termination! */ @@ -154,6 +155,16 @@ static const char *ad_slave_sws[] = { static void ad198x_free_kctls(struct hda_codec *codec); +/* additional beep mixers; the actual parameters are overwritten at build */ +static struct snd_kcontrol_new ad_beep_mixer[] = { + HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT), + HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_OUTPUT), + { } /* end */ +}; + +#define set_beep_amp(spec, nid, idx, dir) \ + ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */ + static int ad198x_build_controls(struct hda_codec *codec) { struct ad198x_spec *spec = codec->spec; @@ -181,6 +192,21 @@ static int ad198x_build_controls(struct hda_codec *codec) return err; } + /* create beep controls if needed */ + if (spec->beep_amp) { + struct snd_kcontrol_new *knew; + for (knew = ad_beep_mixer; knew->name; knew++) { + struct snd_kcontrol *kctl; + kctl = snd_ctl_new1(knew, codec); + if (!kctl) + return -ENOMEM; + kctl->private_value = spec->beep_amp; + err = snd_hda_ctl_add(codec, kctl); + if (err < 0) + return err; + } + } + /* if we have no master control, let's create it */ if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { unsigned int vmaster_tlv[4]; @@ -397,7 +423,8 @@ static void ad198x_free(struct hda_codec *codec) return; ad198x_free_kctls(codec); - kfree(codec->spec); + kfree(spec); + snd_hda_detach_beep_device(codec); } static struct hda_codec_ops ad198x_patch_ops = { @@ -536,8 +563,6 @@ static struct snd_kcontrol_new ad1986a_mixers[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), @@ -601,8 +626,7 @@ static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), - /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), + /* HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), @@ -800,8 +824,6 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x18, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x18, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), { @@ -1026,7 +1048,7 @@ static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) static int patch_ad1986a(struct hda_codec *codec) { struct ad198x_spec *spec; - int board_config; + int err, board_config; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -1034,6 +1056,13 @@ static int patch_ad1986a(struct hda_codec *codec) codec->spec = spec; + err = snd_hda_attach_beep_device(codec, 0x19); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x18, 0, HDA_OUTPUT); + spec->multiout.max_channels = 6; spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); spec->multiout.dac_nids = ad1986a_dac_nids; @@ -1213,8 +1242,6 @@ static struct snd_kcontrol_new ad1983_mixers[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x10, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x10, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), @@ -1285,6 +1312,7 @@ static struct hda_amp_list ad1983_loopbacks[] = { static int patch_ad1983(struct hda_codec *codec) { struct ad198x_spec *spec; + int err; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -1292,6 +1320,13 @@ static int patch_ad1983(struct hda_codec *codec) codec->spec = spec; + err = snd_hda_attach_beep_device(codec, 0x10); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); + spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); spec->multiout.dac_nids = ad1983_dac_nids; @@ -1361,8 +1396,6 @@ static struct snd_kcontrol_new ad1981_mixers[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x0d, 1, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), @@ -1685,7 +1718,7 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { static int patch_ad1981(struct hda_codec *codec) { struct ad198x_spec *spec; - int board_config; + int err, board_config; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -1693,6 +1726,13 @@ static int patch_ad1981(struct hda_codec *codec) codec->spec = spec; + err = snd_hda_attach_beep_device(codec, 0x10); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT); + spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); spec->multiout.dac_nids = ad1981_dac_nids; @@ -1979,9 +2019,6 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), @@ -2025,9 +2062,6 @@ static struct snd_kcontrol_new ad1988_3stack_mixers2[] = { HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), @@ -2057,9 +2091,6 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = { HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), @@ -2919,7 +2950,7 @@ static struct snd_pci_quirk ad1988_cfg_tbl[] = { static int patch_ad1988(struct hda_codec *codec) { struct ad198x_spec *spec; - int board_config; + int err, board_config; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -2939,7 +2970,7 @@ static int patch_ad1988(struct hda_codec *codec) if (board_config == AD1988_AUTO) { /* automatic parse from the BIOS config */ - int err = ad1988_parse_auto_config(codec); + err = ad1988_parse_auto_config(codec); if (err < 0) { ad198x_free(codec); return err; @@ -2949,6 +2980,13 @@ static int patch_ad1988(struct hda_codec *codec) } } + err = snd_hda_attach_beep_device(codec, 0x10); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); + switch (board_config) { case AD1988_6STACK: case AD1988_6STACK_DIG: @@ -3105,12 +3143,6 @@ static struct snd_kcontrol_new ad1884_base_mixers[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), - /* - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Digital Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), - */ HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -3219,7 +3251,7 @@ static const char *ad1884_slave_vols[] = { "CD Playback Volume", "Internal Mic Playback Volume", "Docking Mic Playback Volume" - "Beep Playback Volume", + /* "Beep Playback Volume", */ "IEC958 Playback Volume", NULL }; @@ -3227,6 +3259,7 @@ static const char *ad1884_slave_vols[] = { static int patch_ad1884(struct hda_codec *codec) { struct ad198x_spec *spec; + int err; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -3234,6 +3267,13 @@ static int patch_ad1884(struct hda_codec *codec) codec->spec = spec; + err = snd_hda_attach_beep_device(codec, 0x10); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); + spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); spec->multiout.dac_nids = ad1884_dac_nids; @@ -3300,8 +3340,6 @@ static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), @@ -3358,10 +3396,6 @@ static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = { HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), - /* - HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), - */ HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -3540,8 +3574,6 @@ static struct snd_kcontrol_new ad1884a_base_mixers[] = { HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), @@ -3674,8 +3706,6 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), @@ -3703,8 +3733,6 @@ static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -3815,8 +3843,6 @@ static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -3902,7 +3928,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { static int patch_ad1884a(struct hda_codec *codec) { struct ad198x_spec *spec; - int board_config; + int err, board_config; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -3910,6 +3936,13 @@ static int patch_ad1884a(struct hda_codec *codec) codec->spec = spec; + err = snd_hda_attach_beep_device(codec, 0x10); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); + spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); spec->multiout.dac_nids = ad1884a_dac_nids; @@ -4064,8 +4097,6 @@ static struct snd_kcontrol_new ad1882_loopback_mixers[] = { HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), { } /* end */ }; @@ -4078,8 +4109,6 @@ static struct snd_kcontrol_new ad1882a_loopback_mixers[] = { HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), - HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), { } /* end */ }; @@ -4238,7 +4267,7 @@ static const char *ad1882_models[AD1986A_MODELS] = { static int patch_ad1882(struct hda_codec *codec) { struct ad198x_spec *spec; - int board_config; + int err, board_config; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -4246,6 +4275,13 @@ static int patch_ad1882(struct hda_codec *codec) codec->spec = spec; + err = snd_hda_attach_beep_device(codec, 0x10); + if (err < 0) { + ad198x_free(codec); + return err; + } + set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); + spec->multiout.max_channels = 6; spec->multiout.num_dacs = 3; spec->multiout.dac_nids = ad1882_dac_nids; -- cgit v1.2.3 From cfb9fb5517faa9e61c7e874fc89ef9c9253a0902 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Feb 2009 17:34:03 +0100 Subject: ALSA: hda - Fix unused variable compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sound/pci/hda/patch_realtek.c:12693: warning: unused variable ‘i’ Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3d933e307b19..f594a0960290 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -12690,7 +12690,7 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, static int alc269_parse_auto_config(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - int i, err; + int err; static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, -- cgit v1.2.3 From 8663ae55f39e99c25242adb6242a191258a4eca1 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Sun, 8 Feb 2009 19:50:34 -0200 Subject: ALSA: hda - Bind new ecs mobo id (1019:2950) to model=ecs202 This adds a new sound quirk entry (model=ecs202) for an ecs motherboard with IDT STAC9221 codec (1019:2950). Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 85dc642d1130..d16d5c60eecd 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2108,6 +2108,8 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { "ECS/PC chips", STAC_ECS_202), SND_PCI_QUIRK(0x1019, 0x2820, "ECS/PC chips", STAC_ECS_202), + SND_PCI_QUIRK(0x1019, 0x2950, + "ECS/PC chips", STAC_ECS_202), {} /* terminator */ }; -- cgit v1.2.3 From 23c7b521c250b261dd97a7a06d5a2e74b56233d5 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Sun, 8 Feb 2009 19:51:28 -0200 Subject: ALSA: hda - Don't touch non-existent port f on 4-port 92hd71bxx codecs When checking for input amps on pins 0x0a, 0x0d and 0x0f, and initializing them for 92hd71xxx codec models, we must skip nid 0x0f for 4-port models too like with 5-port models, as it is unused (nid 0x0f is vendor reserved in 4-port models). Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d16d5c60eecd..2f4e090b0557 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -5072,6 +5072,8 @@ again: switch (codec->vendor_id) { case 0x111d76b6: /* 4 Port without Analog Mixer */ case 0x111d76b7: + unmute_init++; + /* fallthru */ case 0x111d76b4: /* 6 Port without Analog Mixer */ case 0x111d76b5: memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, -- cgit v1.2.3 From 8bd4bb7a35e8ebb015a531218614c48e10a3c4ee Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 30 Jan 2009 17:27:45 +0100 Subject: ALSA: Add subdevice_mask field to quirk entries Introduced a new field, subdevice_mask, which specifies the bitmask to match with the given subdevice ID. Signed-off-by: Takashi Iwai --- include/sound/core.h | 16 ++++++++++++++-- sound/core/misc.c | 10 ++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/include/sound/core.h b/include/sound/core.h index f632484bc743..f67952a61a2d 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -446,21 +446,33 @@ static inline int __snd_bug_on(int cond) struct snd_pci_quirk { unsigned short subvendor; /* PCI subvendor ID */ unsigned short subdevice; /* PCI subdevice ID */ + unsigned short subdevice_mask; /* bitmask to match */ int value; /* value */ #ifdef CONFIG_SND_DEBUG_VERBOSE const char *name; /* name of the device (optional) */ #endif }; -#define _SND_PCI_QUIRK_ID(vend,dev) \ - .subvendor = (vend), .subdevice = (dev) +#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \ + .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask) +#define _SND_PCI_QUIRK_ID(vend, dev) \ + _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev) #define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} #ifdef CONFIG_SND_DEBUG_VERBOSE #define SND_PCI_QUIRK(vend,dev,xname,val) \ {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} +#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \ + {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)} +#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \ + {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \ + .value = (val), .name = (xname)} #else #define SND_PCI_QUIRK(vend,dev,xname,val) \ {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} +#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \ + {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)} +#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \ + {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)} #endif const struct snd_pci_quirk * diff --git a/sound/core/misc.c b/sound/core/misc.c index 38524f615d94..a9710e0c97af 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -95,12 +95,14 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) { const struct snd_pci_quirk *q; - for (q = list; q->subvendor; q++) - if (q->subvendor == pci->subsystem_vendor && - (!q->subdevice || q->subdevice == pci->subsystem_device)) + for (q = list; q->subvendor; q++) { + if (q->subvendor != pci->subsystem_vendor) + continue; + if (!q->subdevice || + (pci->subsystem_device & q->subdevice_mask) == q->subdevice) return q; + } return NULL; } - EXPORT_SYMBOL(snd_pci_quirk_lookup); #endif -- cgit v1.2.3 From dea0a5095b5e21306a81c496567043798fac7815 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Feb 2009 17:14:52 +0100 Subject: ALSA: hda - Clean up quirk lists Clean up quirk lists with bit masks. Also, sorted in numerical order for alc662_cfg_tbl[]. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 10 ++--- sound/pci/hda/patch_conexant.c | 20 +++------ sound/pci/hda/patch_realtek.c | 97 ++++++++++++++++++++---------------------- sound/pci/hda/patch_sigmatel.c | 61 ++++---------------------- 4 files changed, 65 insertions(+), 123 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index cc02f2df2510..6106dfe8ec04 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -1015,10 +1015,8 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), - SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG), - SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG), - SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG), SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), + SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG), SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), @@ -1706,10 +1704,10 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), /* All HP models */ - SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), + SND_PCI_QUIRK_VENDOR(0x103c, "HP nx", AD1981_HP), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), /* Lenovo Thinkpad T60/X60/Z6xx */ - SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), + SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1981_THINKPAD), /* HP nx6320 (reversed SSID, H/W bug) */ SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), {} @@ -3481,7 +3479,7 @@ static const char *ad1984_models[AD1984_MODELS] = { static struct snd_pci_quirk ad1984_cfg_tbl[] = { /* Lenovo Thinkpad T61/X61 */ - SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1984_THINKPAD), + SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD), SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), {} }; diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 0177ef8f4c9e..fdf876be712d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1002,15 +1002,9 @@ static const char *cxt5045_models[CXT5045_MODELS] = { }; static struct snd_pci_quirk cxt5045_cfg_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x30a5, "HP", CXT5045_LAPTOP_HPSENSE), - SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV Series", CXT5045_LAPTOP_HPSENSE), - SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2120", CXT5045_LAPTOP_HPSENSE), - SND_PCI_QUIRK(0x103c, 0x30b7, "HP DV6000Z", CXT5045_LAPTOP_HPSENSE), - SND_PCI_QUIRK(0x103c, 0x30bb, "HP DV8000", CXT5045_LAPTOP_HPSENSE), - SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP_HPSENSE), - SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV9533EG", CXT5045_LAPTOP_HPSENSE), SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), - SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP_HPSENSE), + SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", + CXT5045_LAPTOP_HPSENSE), SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), @@ -1020,8 +1014,8 @@ static struct snd_pci_quirk cxt5045_cfg_tbl[] = { SND_PCI_QUIRK(0x1509, 0x1e40, "FIC", CXT5045_LAPTOP_HPMICSENSE), SND_PCI_QUIRK(0x1509, 0x2f05, "FIC", CXT5045_LAPTOP_HPMICSENSE), SND_PCI_QUIRK(0x1509, 0x2f06, "FIC", CXT5045_LAPTOP_HPMICSENSE), - SND_PCI_QUIRK(0x1631, 0xc106, "Packard Bell", CXT5045_LAPTOP_HPMICSENSE), - SND_PCI_QUIRK(0x1631, 0xc107, "Packard Bell", CXT5045_LAPTOP_HPMICSENSE), + SND_PCI_QUIRK_MASK(0x1631, 0xff00, 0xc100, "Packard Bell", + CXT5045_LAPTOP_HPMICSENSE), SND_PCI_QUIRK(0x8086, 0x2111, "Conexant Reference board", CXT5045_LAPTOP_HPSENSE), {} }; @@ -1571,11 +1565,9 @@ static const char *cxt5047_models[CXT5047_MODELS] = { }; static struct snd_pci_quirk cxt5047_cfg_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x30a0, "HP DV1000", CXT5047_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), - SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP), + SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", + CXT5047_LAPTOP), SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), {} }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index f594a0960290..7ae8fad0189f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3598,7 +3598,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), - SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ + SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), @@ -3641,7 +3641,8 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), - SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ + /* default Intel */ + SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), {} @@ -8521,7 +8522,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", ALC888_ACER_ASPIRE_4930G), - SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ + /* default Acer */ + SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), @@ -8566,7 +8568,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), - SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), + SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", @@ -10707,14 +10709,10 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), - SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), + SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", + ALC262_HP_BPC), + SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", + ALC262_HP_BPC), SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), @@ -10742,8 +10740,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), - SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), - SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), + SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", + ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), @@ -14534,9 +14532,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = { SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), - SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), - SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), - SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), + SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), {} }; @@ -16150,56 +16146,55 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { }; static struct snd_pci_quirk alc662_cfg_tbl[] = { - SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), - SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), - SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), - SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), - SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), - SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), + SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), - SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), + SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), + SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), + SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), + SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), - SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), + /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), - SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), - SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), - SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), + SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), + SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), + /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ + SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), - SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), - SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), - SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), - SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), + SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), + SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), + SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), + SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", ALC662_3ST_6ch_DIG), - SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), - SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), - SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", ALC662_3ST_6ch_DIG), SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), + SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", ALC662_3ST_6ch_DIG), - SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), - SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), - SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), + SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", + ALC663_ASUS_H13), {} }; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 2f4e090b0557..12b30884843b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2082,33 +2082,7 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, "Dell XPS M1210", STAC_922X_DELL_M82), /* ECS/PC Chips boards */ - SND_PCI_QUIRK(0x1019, 0x2144, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2608, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2633, - "ECS/PC chips P17G/1333", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2811, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2812, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2813, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2814, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2815, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2816, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2817, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2818, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2819, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2820, - "ECS/PC chips", STAC_ECS_202), - SND_PCI_QUIRK(0x1019, 0x2950, + SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, "ECS/PC chips", STAC_ECS_202), {} /* terminator */ }; @@ -2169,22 +2143,10 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), /* 965 based 3 stack systems */ - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, + "Intel D965", STAC_D965_3ST), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, + "Intel D965", STAC_D965_3ST), /* Dell 3 stack systems */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), @@ -2200,15 +2162,10 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), /* 965 based 5 stack systems */ - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), - SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, + "Intel D965", STAC_D965_5ST), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, + "Intel D965", STAC_D965_5ST), {} /* terminator */ }; -- cgit v1.2.3 From a85165c66c5640c37b67a94aa4e00fe45273bca1 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Feb 2009 17:15:50 +0100 Subject: ALSA: via82xx - Clean up quirk list Use SND_PCI_QUIRK_VENDOR() macro. Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index fc62d6380f86..a027896a220f 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2363,14 +2363,14 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { SND_PCI_QUIRK(0x1019, 0x0996, "ESC Mobo", VIA_DXS_48K), SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA), SND_PCI_QUIRK(0x1019, 0x0a85, "ECS L7VMM2", VIA_DXS_NO_VRA), - SND_PCI_QUIRK(0x1019, 0, "ESC K8", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x1019, "ESC K8", VIA_DXS_SRC), SND_PCI_QUIRK(0x1019, 0xaa01, "ESC K8T890-A", VIA_DXS_SRC), SND_PCI_QUIRK(0x1025, 0x0033, "Acer Inspire 1353LM", VIA_DXS_NO_VRA), SND_PCI_QUIRK(0x1025, 0x0046, "Acer Aspire 1524 WLMi", VIA_DXS_SRC), - SND_PCI_QUIRK(0x1043, 0, "ASUS A7/A8", VIA_DXS_NO_VRA), - SND_PCI_QUIRK(0x1071, 0, "Diverse Notebook", VIA_DXS_NO_VRA), + SND_PCI_QUIRK_VENDOR(0x1043, "ASUS A7/A8", VIA_DXS_NO_VRA), + SND_PCI_QUIRK_VENDOR(0x1071, "Diverse Notebook", VIA_DXS_NO_VRA), SND_PCI_QUIRK(0x10cf, 0x118e, "FSC Laptop", VIA_DXS_ENABLE), - SND_PCI_QUIRK(0x1106, 0, "ASRock", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x1106, "ASRock", VIA_DXS_SRC), SND_PCI_QUIRK(0x1297, 0xa231, "Shuttle AK31v2", VIA_DXS_SRC), SND_PCI_QUIRK(0x1297, 0xa232, "Shuttle", VIA_DXS_SRC), SND_PCI_QUIRK(0x1297, 0xc160, "Shuttle Sk41G", VIA_DXS_SRC), @@ -2378,7 +2378,7 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { SND_PCI_QUIRK(0x1462, 0x3800, "MSI KT266", VIA_DXS_ENABLE), SND_PCI_QUIRK(0x1462, 0x7120, "MSI KT4V", VIA_DXS_ENABLE), SND_PCI_QUIRK(0x1462, 0x7142, "MSI K8MM-V", VIA_DXS_ENABLE), - SND_PCI_QUIRK(0x1462, 0, "MSI Mobo", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x1462, "MSI Mobo", VIA_DXS_SRC), SND_PCI_QUIRK(0x147b, 0x1401, "ABIT KD7(-RAID)", VIA_DXS_ENABLE), SND_PCI_QUIRK(0x147b, 0x1411, "ABIT VA-20", VIA_DXS_ENABLE), SND_PCI_QUIRK(0x147b, 0x1413, "ABIT KV8 Pro", VIA_DXS_ENABLE), @@ -2392,11 +2392,11 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { SND_PCI_QUIRK(0x161f, 0x2032, "m680x machines", VIA_DXS_48K), SND_PCI_QUIRK(0x1631, 0xe004, "PB EasyNote 3174", VIA_DXS_ENABLE), SND_PCI_QUIRK(0x1695, 0x3005, "EPoX EP-8K9A", VIA_DXS_ENABLE), - SND_PCI_QUIRK(0x1695, 0, "EPoX mobo", VIA_DXS_SRC), - SND_PCI_QUIRK(0x16f3, 0, "Jetway K8", VIA_DXS_SRC), - SND_PCI_QUIRK(0x1734, 0, "FSC Laptop", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x1695, "EPoX mobo", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x16f3, "Jetway K8", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x1734, "FSC Laptop", VIA_DXS_SRC), SND_PCI_QUIRK(0x1849, 0x3059, "ASRock K7VM2", VIA_DXS_NO_VRA), - SND_PCI_QUIRK(0x1849, 0, "ASRock mobo", VIA_DXS_SRC), + SND_PCI_QUIRK_VENDOR(0x1849, "ASRock mobo", VIA_DXS_SRC), SND_PCI_QUIRK(0x1919, 0x200a, "Soltek SL-K8", VIA_DXS_NO_VRA), SND_PCI_QUIRK(0x4005, 0x4710, "MSI K7T266", VIA_DXS_SRC), { } /* terminator */ -- cgit v1.2.3 From f6f35bbe7c6494e66590cf519e21da2dd8d59e01 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Sun, 8 Feb 2009 15:22:25 +0100 Subject: [ARM] AACI: timeout will reach -1 With a postfix decrement the timeout will reach -1 rather than 0, so the warning will not be issued. Signed-off-by: Roel Kluin Signed-off-by: Russell King --- sound/arm/aaci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 89096e811a4b..772901e41ecb 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -90,7 +90,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, */ do { v = readl(aaci->base + AACI_SLFR); - } while ((v & (SLFR_1TXB|SLFR_2TXB)) && timeout--); + } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); if (!timeout) dev_err(&aaci->dev->dev, @@ -126,7 +126,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) */ do { v = readl(aaci->base + AACI_SLFR); - } while ((v & SLFR_1TXB) && timeout--); + } while ((v & SLFR_1TXB) && --timeout); if (!timeout) { dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); @@ -147,7 +147,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) do { cond_resched(); v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); - } while ((v != (SLFR_1RXV|SLFR_2RXV)) && timeout--); + } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); if (!timeout) { dev_err(&aaci->dev->dev, "timeout on RX valid\n"); -- cgit v1.2.3 From 22971e3a77f193579be525a12f3ab91dbf241517 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Feb 2009 11:56:44 +0100 Subject: ALSA: hda - add digital beep support for ALC268 Added the digital beep support for ALC268. It was missing in the last patches. However, ALC268 has a strange pin use for widget 0x1d, which could be used as another purpose. So, the patch adds a check of the beep control before creating the hook for input layer. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7ae8fad0189f..97eaf3b1d97f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11885,7 +11885,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { static struct alc_config_preset alc268_presets[] = { [ALC267_QUANTA_IL1] = { - .mixers = { alc267_quanta_il1_mixer }, + .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, alc267_quanta_il1_verbs }, .num_dacs = ARRAY_SIZE(alc268_dac_nids), @@ -11967,7 +11967,8 @@ static struct alc_config_preset alc268_presets[] = { }, [ALC268_ACER_ASPIRE_ONE] = { .mixers = { alc268_acer_aspire_one_mixer, - alc268_capture_alt_mixer }, + alc268_beep_mixer, + alc268_capture_alt_mixer }, .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, alc268_acer_aspire_one_verbs }, .num_dacs = ARRAY_SIZE(alc268_dac_nids), @@ -12036,7 +12037,7 @@ static int patch_alc268(struct hda_codec *codec) { struct alc_spec *spec; int board_config; - int err; + int i, has_beep, err; spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -12091,13 +12092,28 @@ static int patch_alc268(struct hda_codec *codec) spec->stream_digital_playback = &alc268_pcm_digital_playback; - if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) - /* override the amp caps for beep generator */ - snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, + has_beep = 0; + for (i = 0; i < spec->num_mixers; i++) { + if (spec->mixers[i] == alc268_beep_mixer) { + has_beep = 1; + break; + } + } + + if (has_beep) { + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } + if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) + /* override the amp caps for beep generator */ + snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, (0x0c << AC_AMPCAP_OFFSET_SHIFT) | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | (0 << AC_AMPCAP_MUTE_SHIFT)); + } if (!spec->adc_nids && spec->input_mux) { /* check whether NID 0x07 is valid */ -- cgit v1.2.3 From 44a678d04babaa751c0ee98e006ede9576fa9e00 Mon Sep 17 00:00:00 2001 From: Mackenzie Morgan Date: Tue, 10 Feb 2009 17:13:43 +0100 Subject: ALSA: hda - Add quirk for Asus z37e (1043:8284) Added a quirk for Asus Z37E for fixing suspend/hibernation problem. Reference: https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/25896 http://launchpadlibrarian.net/17053575/0001-Add-quirk-for-ASUS-Z37E-to-make-sound-audible-afte.patch https://bugtrack.alsa-project.org/alsa-bug/bug_view_page.php?bug_id=4282 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ae5c8a0d1479..ed8fcbd60003 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8478,6 +8478,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), + SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), -- cgit v1.2.3 From a1667e4eea0a7085815d1532d7630bb4611271d0 Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Wed, 11 Feb 2009 15:22:28 +0800 Subject: ALSA: hda - allow multi-channel HDMI audio playback when ELD is not present The YAMAHA AV-X1800 requires audio infoframe to include speaker-channel mapping to play >2 channel HDMI audio. In theory that mapping should be derived from its speaker configurations contained in its ELD. However we currently cannot get ELD in console before the KMS functionalities are ready. This is a more or less general issue at least in the near future. As a workaround, we propose to allow playback of mult-channel audio when ELD is not available. Signed-off-by: Wu Fengguang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_intelhdmi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 3564f4e4b74c..a8643509e2af 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c @@ -419,13 +419,17 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec, /* * CA defaults to 0 for basic stereo audio */ - if (!eld->eld_ver) - return 0; - if (!eld->spk_alloc) - return 0; if (channels <= 2) return 0; + /* + * HDMI sink's ELD info cannot always be retrieved for now, e.g. + * in console or for audio devices. Assume the highest speakers + * configuration, to _not_ prohibit multi-channel audio playback. + */ + if (!eld->spk_alloc) + eld->spk_alloc = 0xffff; + /* * expand ELD's speaker allocation mask * -- cgit v1.2.3 From 606c0cee695bbd0c2bf32132999e35cff5a6dd9e Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Wed, 11 Feb 2009 15:22:29 +0800 Subject: ALSA: hda - enable HDMI audio pin out at module loading time We found that enabling/disabling HDMI audio pin out at stream start/stop time will kill the leading 500ms or so sound samples. Avoid this by enabling pin out once and for ever at module loading time. The leading ~500ms audio samples will still be lost when switching from X-channel playback to Y-channel playback where X != Y. However there's no much we can do about it: the audio infoframe has to change and it looks like either G45 or YAMAHA requires some time to switch the configuration. Signed-off-by: Wu Fengguang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_intelhdmi.c | 42 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index a8643509e2af..f2610d67e187 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c @@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_verb[] = { {} /* terminator */ }; -static struct hda_verb pinout_disable_verb[] = { - {PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00}, - {} -}; - static struct hda_verb unsolicited_response_verb[] = { {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | INTEL_HDMI_EVENT_TAG}, @@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid, static void hdmi_enable_output(struct hda_codec *codec) { - /* Enable Audio InfoFrame Transmission */ - hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); - snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, - AC_DIPXMIT_BEST); /* Unmute */ if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) snd_hda_codec_write(codec, PIN_NID, 0, @@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hda_codec *codec) snd_hda_sequence_write(codec, pinout_enable_verb); } -static void hdmi_disable_output(struct hda_codec *codec) +/* + * Enable Audio InfoFrame Transmission + */ +static void hdmi_start_infoframe_trans(struct hda_codec *codec) { - snd_hda_sequence_write(codec, pinout_disable_verb); - if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) - snd_hda_codec_write(codec, PIN_NID, 0, - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); + hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); + snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, + AC_DIPXMIT_BEST); +} - /* - * FIXME: noises may arise when playing music after reloading the - * kernel module, until the next X restart or monitor repower. - */ +/* + * Disable Audio InfoFrame Transmission + */ +static void hdmi_stop_infoframe_trans(struct hda_codec *codec) +{ + hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); + snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, + AC_DIPXMIT_DISABLE); } static int hdmi_get_channel_count(struct hda_codec *codec) @@ -489,6 +487,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hdmi_setup_channel_mapping(codec, &ai); hdmi_fill_audio_infoframe(codec, &ai); + hdmi_start_infoframe_trans(codec); } @@ -566,7 +565,7 @@ static int intel_hdmi_playback_pcm_close(struct hda_pcm_stream *hinfo, { struct intel_hdmi_spec *spec = codec->spec; - hdmi_disable_output(codec); + hdmi_stop_infoframe_trans(codec); return snd_hda_multi_out_dig_close(codec, &spec->multiout); } @@ -586,8 +585,6 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, hdmi_setup_audio_infoframe(codec, substream); - hdmi_enable_output(codec); - return 0; } @@ -632,8 +629,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec) static int intel_hdmi_init(struct hda_codec *codec) { - /* disable audio output as early as possible */ - hdmi_disable_output(codec); + hdmi_enable_output(codec); snd_hda_sequence_write(codec, unsolicited_response_verb); -- cgit v1.2.3 From 9a957a24e3b4008d84e204cdf25849ae4d5592a2 Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Wed, 11 Feb 2009 15:22:30 +0800 Subject: ALSA: hda - compute checksum in HDMI audio infoframe Signed-off-by: Wu Fengguang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_intelhdmi.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index f2610d67e187..90b11374a0a8 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c @@ -366,11 +366,16 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec, struct hdmi_audio_infoframe *ai) { u8 *params = (u8 *)ai; + u8 sum = 0; int i; hdmi_debug_dip_size(codec); hdmi_clear_dip_buffers(codec); /* be paranoid */ + for (i = 0; i < sizeof(ai); i++) + sum += params[i]; + ai->checksum = - sum; + hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); for (i = 0; i < sizeof(ai); i++) hdmi_write_dip_byte(codec, PIN_NID, params[i]); -- cgit v1.2.3 From a57c0eb65576c810c408f0a086afac179242a21c Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Wed, 11 Feb 2009 15:22:31 +0800 Subject: ALSA: hda - add id for Intel IbexPeak integrated HDMI codec Signed-off-by: Wu Fengguang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_intelhdmi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 90b11374a0a8..fcc77fec4487 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c @@ -684,6 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = { { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, + { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi }, { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, {} /* terminator */ }; @@ -692,6 +693,7 @@ MODULE_ALIAS("snd-hda-codec-id:808629fb"); MODULE_ALIAS("snd-hda-codec-id:80862801"); MODULE_ALIAS("snd-hda-codec-id:80862802"); MODULE_ALIAS("snd-hda-codec-id:80862803"); +MODULE_ALIAS("snd-hda-codec-id:80862804"); MODULE_ALIAS("snd-hda-codec-id:10951392"); MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 32d2c7fa1344ddf51886eddf31e228d139501dc6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Feb 2009 11:33:13 +0100 Subject: ALSA: hda - Fix a wrong pin check in snd_hda_parse_pin_def_config() Fixed a wrong pin check (a typo) for debug print of digital input pin. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 93412f335dc4..95f10aec7a06 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3551,7 +3551,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, cfg->input_pins[AUTO_PIN_FRONT_LINE], cfg->input_pins[AUTO_PIN_CD], cfg->input_pins[AUTO_PIN_AUX]); - if (cfg->dig_out_pin) + if (cfg->dig_in_pin) snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin); return 0; -- cgit v1.2.3 From 1afa6e2e1d26d0b9d96785ee1823bf11c4c5f202 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Wed, 11 Feb 2009 13:53:26 +0100 Subject: sound: OSS: dmabuf: too many loops loop adev->dmap_out->nbufs times Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/oss/dmabuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c index 1e90d769b62e..1bfcf7e88546 100644 --- a/sound/oss/dmabuf.c +++ b/sound/oss/dmabuf.c @@ -439,7 +439,7 @@ int DMAbuf_sync(int dev) DMAbuf_launch_output(dev, dmap); adev->dmap_out->flags |= DMA_SYNCING; adev->dmap_out->underrun_count = 0; - while (!signal_pending(current) && n++ <= adev->dmap_out->nbufs && + while (!signal_pending(current) && n++ < adev->dmap_out->nbufs && adev->dmap_out->qlen && adev->dmap_out->underrun_count == 0) { long t = dmabuf_timeout(dmap); spin_unlock_irqrestore(&dmap->lock,flags); -- cgit v1.2.3 From 0852d7a654f75d22a3c09fd7da4a3551bbb37740 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Feb 2009 11:35:15 +0100 Subject: ALSA: hda - Detect multiple digital-out pins Detect multiple digital-out pins in snd_hda_parse_pin_defconfig(). The dig_out_pin and dig_out_type fields become arrays. The codec parser still doesn't use this multiple pins detection, though. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 17 ++++++++++------- sound/pci/hda/hda_local.h | 5 +++-- sound/pci/hda/patch_analog.c | 2 +- sound/pci/hda/patch_realtek.c | 20 ++++++++++---------- sound/pci/hda/patch_sigmatel.c | 10 +++++----- sound/pci/hda/patch_via.c | 10 +++++----- 6 files changed, 34 insertions(+), 30 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 95f10aec7a06..29eeb748561d 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3423,11 +3423,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, break; case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: - cfg->dig_out_pin = nid; - if (loc == AC_JACK_LOC_HDMI) - cfg->dig_out_type = HDA_PCM_TYPE_HDMI; - else - cfg->dig_out_type = HDA_PCM_TYPE_SPDIF; + if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins)) + continue; + cfg->dig_out_pins[cfg->dig_outs] = nid; + cfg->dig_out_type[cfg->dig_outs] = + (loc == AC_JACK_LOC_HDMI) ? + HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF; + cfg->dig_outs++; break; case AC_JACK_SPDIF_IN: case AC_JACK_DIG_OTHER_IN: @@ -3541,8 +3543,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, cfg->hp_pins[1], cfg->hp_pins[2], cfg->hp_pins[3], cfg->hp_pins[4]); snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); - if (cfg->dig_out_pin) - snd_printd(" dig-out=0x%x\n", cfg->dig_out_pin); + if (cfg->dig_outs) + snd_printd(" dig-out=0x%x/0x%x\n", + cfg->dig_out_pins[0], cfg->dig_out_pins[1]); snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," " cd=0x%x, aux=0x%x\n", cfg->input_pins[AUTO_PIN_MIC], diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 4086491ed33a..2ae6b53a4628 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -355,10 +355,11 @@ struct auto_pin_cfg { int line_out_type; /* AUTO_PIN_XXX_OUT */ hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; hda_nid_t input_pins[AUTO_PIN_LAST]; - hda_nid_t dig_out_pin; + int dig_outs; + hda_nid_t dig_out_pins[2]; hda_nid_t dig_in_pin; hda_nid_t mono_out_pin; - int dig_out_type; /* HDA_PCM_TYPE_XXX */ + int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */ int dig_in_type; /* HDA_PCM_TYPE_XXX */ }; diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 6106dfe8ec04..d58c32b5b433 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -2898,7 +2898,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = AD1988_SPDIF_IN; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1db99df79502..e46251bceb9d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4291,7 +4291,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = ALC880_DIGIN_NID; @@ -5658,7 +5658,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; if (spec->kctls.list) add_mixer(spec, spec->kctls.list); @@ -10626,7 +10626,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; if (!spec->autocfg.line_outs) { - if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) { + if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { spec->multiout.max_channels = 2; spec->no_analog = 1; goto dig_only; @@ -10643,9 +10643,9 @@ static int alc262_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; dig_only: - if (spec->autocfg.dig_out_pin) { + if (spec->autocfg.dig_outs) { spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; - spec->dig_out_type = spec->autocfg.dig_out_type; + spec->dig_out_type = spec->autocfg.dig_out_type[0]; } if (spec->autocfg.dig_in_pin) spec->dig_in_nid = ALC262_DIGIN_NID; @@ -11807,7 +11807,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = 2; /* digital only support output */ - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; if (spec->kctls.list) @@ -12722,7 +12722,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; if (spec->kctls.list) @@ -13779,7 +13779,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; if (spec->kctls.list) @@ -14881,7 +14881,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; if (spec->kctls.list) @@ -16689,7 +16689,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; if (spec->kctls.list) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 12b30884843b..1882c5735879 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2546,7 +2546,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) codec->num_pcms++; info++; info->name = "STAC92xx Digital"; - info->pcm_type = spec->autocfg.dig_out_type; + info->pcm_type = spec->autocfg.dig_out_type[0]; if (spec->multiout.dig_out_nid) { info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; @@ -3706,7 +3706,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out if (spec->multiout.max_channels > 2) spec->surr_switch = 1; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = dig_out; if (dig_in && spec->autocfg.dig_in_pin) spec->dig_in_nid = dig_in; @@ -3819,7 +3819,7 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = 0x05; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = 0x04; @@ -4069,8 +4069,8 @@ static int stac92xx_init(struct hda_codec *codec) for (i = 0; i < spec->num_dmics; i++) stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], AC_PINCTL_IN_EN); - if (cfg->dig_out_pin) - stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, + if (cfg->dig_out_pins[0]) + stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], AC_PINCTL_OUT_EN); if (cfg->dig_in_pin) stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index c761394cbe84..639b2ff510a6 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1354,7 +1354,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = VT1708_DIGIN_NID; @@ -1827,7 +1827,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = VT1709_DIGIN_NID; @@ -2371,7 +2371,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = VT1708B_DIGIN_NID; @@ -2836,7 +2836,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID; spec->extra_dig_out_nid = 0x15; @@ -3155,7 +3155,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1702_DIGOUT_NID; spec->extra_dig_out_nid = 0x1B; -- cgit v1.2.3 From 32cf9a16f4af01573ddec1eb073111fc20a9d7d4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 12 Feb 2009 00:06:42 +0100 Subject: ALSA: mtpav - Fix initial value for input hwport Fix the initial value for input hwport. The old value (-1) may cause Oops when an realtime MIDI byte is received before the input port is explicitly given. Instead, now it's set to the broadcasting as default. Tested-by: Holger Dehnhardt Cc: Signed-off-by: Takashi Iwai --- sound/drivers/mtpav.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 5b89c0883d60..48b64e6b2670 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -706,7 +706,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) mtp_card->card = card; mtp_card->irq = -1; mtp_card->share_irq = 0; - mtp_card->inmidiport = 0xffffffff; mtp_card->inmidistate = 0; mtp_card->outmidihwport = 0xffffffff; init_timer(&mtp_card->timer); @@ -719,6 +718,8 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) if (err < 0) goto __error; + mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST; + err = snd_mtpav_get_ISA(mtp_card); if (err < 0) goto __error; -- cgit v1.2.3 From 26a74f1f61c5bba1c0b46e67e91e921e941f76d7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 12 Feb 2009 00:13:19 +0100 Subject: ALSA: hda - Register (new) devices at reconfig The devices that have been newly added during reconfig must be registered. Otherwise they won't be visible to user-space. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_hwdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 300ab407cf42..482fb0304ca9 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -175,7 +175,7 @@ static int reconfig_codec(struct hda_codec *codec) err = snd_hda_codec_build_controls(codec); if (err < 0) return err; - return 0; + return snd_card_register(codec->bus->card); } /* -- cgit v1.2.3 From c98041f7d71890ac6aa2257d78ef175db44d2cd3 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 11 Feb 2009 20:33:15 -0200 Subject: ALSA: hda - Cleanup setting of pin_configs in patch_stac927x After commit "ALSA: hda - Fix restore of pin configs at resume for STAC/IDT codecs", the introduced stac_save_pin_cfgs function checks already for pins == NULL case, saving then default pin configs from machine with stac92xx_save_bios_config_regs. So we can remove the extra checks when stac927x_brd_tbl[spec->board_config] == NULL. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 1882c5735879..3c84817ccd2e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -5292,10 +5292,9 @@ static int patch_stac927x(struct hda_codec *codec) stac927x_models, stac927x_cfg_tbl); again: - if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) { - if (spec->board_config < 0) - snd_printdd(KERN_INFO "hda_codec: Unknown model for" - "STAC927x, using BIOS defaults\n"); + if (spec->board_config < 0) { + snd_printdd(KERN_INFO "hda_codec: Unknown model for" + "STAC927x, using BIOS defaults\n"); err = stac92xx_save_bios_config_regs(codec); } else err = stac_save_pin_cfgs(codec, -- cgit v1.2.3 From e930e99500e5bd055270c668cca8bd2f33056895 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Wed, 11 Feb 2009 14:49:30 -0800 Subject: ALSA: echoaudio - replace uses of __constant_{endian} The base versions handle constant folding now. Signed-off-by: Harvey Harrison Signed-off-by: Takashi Iwai --- sound/pci/echoaudio/echo3g_dsp.c | 2 +- sound/pci/echoaudio/echoaudio_3g.c | 3 +-- sound/pci/echoaudio/echoaudio_dsp.c | 6 +++--- sound/pci/echoaudio/gina20_dsp.c | 4 ++-- sound/pci/echoaudio/layla20_dsp.c | 4 ++-- sound/pci/echoaudio/mia_dsp.c | 4 ++-- sound/pci/echoaudio/midi.c | 4 ++-- 7 files changed, 13 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/pci/echoaudio/echo3g_dsp.c b/sound/pci/echoaudio/echo3g_dsp.c index 417e25add82b..57967e580571 100644 --- a/sound/pci/echoaudio/echo3g_dsp.c +++ b/sound/pci/echoaudio/echo3g_dsp.c @@ -56,7 +56,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) } chip->comm_page->e3g_frq_register = - __constant_cpu_to_le32((E3G_MAGIC_NUMBER / 48000) - 2); + cpu_to_le32((E3G_MAGIC_NUMBER / 48000) - 2); chip->device_id = device_id; chip->subdevice_id = subdevice_id; chip->bad_board = TRUE; diff --git a/sound/pci/echoaudio/echoaudio_3g.c b/sound/pci/echoaudio/echoaudio_3g.c index c3736bbd819e..e32a74897921 100644 --- a/sound/pci/echoaudio/echoaudio_3g.c +++ b/sound/pci/echoaudio/echoaudio_3g.c @@ -40,8 +40,7 @@ static int check_asic_status(struct echoaudio *chip) if (wait_handshake(chip)) return -EIO; - chip->comm_page->ext_box_status = - __constant_cpu_to_le32(E3G_ASIC_NOT_LOADED); + chip->comm_page->ext_box_status = cpu_to_le32(E3G_ASIC_NOT_LOADED); chip->asic_loaded = FALSE; clear_handshake(chip); send_vector(chip, DSP_VC_TEST_ASIC); diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c index be0e18192de3..4df51ef5e095 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.c +++ b/sound/pci/echoaudio/echoaudio_dsp.c @@ -926,11 +926,11 @@ static int init_dsp_comm_page(struct echoaudio *chip) /* Init the comm page */ chip->comm_page->comm_size = - __constant_cpu_to_le32(sizeof(struct comm_page)); + cpu_to_le32(sizeof(struct comm_page)); chip->comm_page->handshake = 0xffffffff; chip->comm_page->midi_out_free_count = - __constant_cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE); - chip->comm_page->sample_rate = __constant_cpu_to_le32(44100); + cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE); + chip->comm_page->sample_rate = cpu_to_le32(44100); chip->sample_rate = 44100; /* Set line levels so we don't blast any inputs on startup */ diff --git a/sound/pci/echoaudio/gina20_dsp.c b/sound/pci/echoaudio/gina20_dsp.c index db6c952e9d7f..3f1e7475faea 100644 --- a/sound/pci/echoaudio/gina20_dsp.c +++ b/sound/pci/echoaudio/gina20_dsp.c @@ -208,10 +208,10 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) DE_ACT(("set_professional_spdif %d\n", prof)); if (prof) chip->comm_page->flags |= - __constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); + cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); else chip->comm_page->flags &= - ~__constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); + ~cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); chip->professional_spdif = prof; return update_flags(chip); } diff --git a/sound/pci/echoaudio/layla20_dsp.c b/sound/pci/echoaudio/layla20_dsp.c index ede75c6ca0fb..83750e9fd7b4 100644 --- a/sound/pci/echoaudio/layla20_dsp.c +++ b/sound/pci/echoaudio/layla20_dsp.c @@ -284,10 +284,10 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) DE_ACT(("set_professional_spdif %d\n", prof)); if (prof) chip->comm_page->flags |= - __constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); + cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); else chip->comm_page->flags &= - ~__constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); + ~cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); chip->professional_spdif = prof; return update_flags(chip); } diff --git a/sound/pci/echoaudio/mia_dsp.c b/sound/pci/echoaudio/mia_dsp.c index 227386602f9b..3eca16cb7f71 100644 --- a/sound/pci/echoaudio/mia_dsp.c +++ b/sound/pci/echoaudio/mia_dsp.c @@ -222,10 +222,10 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) DE_ACT(("set_professional_spdif %d\n", prof)); if (prof) chip->comm_page->flags |= - __constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); + cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); else chip->comm_page->flags &= - ~__constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); + ~cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); chip->professional_spdif = prof; return update_flags(chip); } diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c index 77bf2a83d997..a953d142cb4b 100644 --- a/sound/pci/echoaudio/midi.c +++ b/sound/pci/echoaudio/midi.c @@ -44,10 +44,10 @@ static int enable_midi_input(struct echoaudio *chip, char enable) if (enable) { chip->mtc_state = MIDI_IN_STATE_NORMAL; chip->comm_page->flags |= - __constant_cpu_to_le32(DSP_FLAG_MIDI_INPUT); + cpu_to_le32(DSP_FLAG_MIDI_INPUT); } else chip->comm_page->flags &= - ~__constant_cpu_to_le32(DSP_FLAG_MIDI_INPUT); + ~cpu_to_le32(DSP_FLAG_MIDI_INPUT); clear_handshake(chip); return send_vector(chip, DSP_VC_UPDATE_FLAGS); -- cgit v1.2.3 From f1eaaeec11982c6b529d4255987fdf507a5fa69e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 08:16:55 +0100 Subject: ALSA: hda - Allow fixed codec-probe mask Some devices have broken BIOS and they don't set the codec probe-bit properly after cleared by the driver. This makes the driver skipping the necessary codec slots. Since BIOS update isn't always easy, now the semantics of probe_mask option is changed a bit. When it contains the bit 8 (0x100), the lower bits are used to probe that slots regardless of codec-probe bits returned by the hardware. For example, probe_mask=0x103 will force to probe the codec slot #0 and #1. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 11e791b965f6..19886e4bc829 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -381,6 +381,7 @@ struct azx { /* HD codec */ unsigned short codec_mask; + int codec_probe_mask; /* copied from probe_mask option */ struct hda_bus *bus; /* CORB/RIRB */ @@ -1228,7 +1229,6 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { }; static int __devinit azx_codec_create(struct azx *chip, const char *model, - unsigned int codec_probe_mask, int no_init) { struct hda_bus_template bus_temp; @@ -1261,7 +1261,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, /* First try to probe all given codec slots */ for (c = 0; c < max_slots; c++) { - if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { + if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { if (probe_codec(chip, c) < 0) { /* Some BIOSen give you wrong codec addresses * that don't exist @@ -1285,7 +1285,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, /* Then create codec instances */ for (c = 0; c < max_slots; c++) { - if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { + if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { struct hda_codec *codec; err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); if (err < 0) @@ -2101,20 +2101,31 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { {} }; +#define AZX_FORCE_CODEC_MASK 0x100 + static void __devinit check_probe_mask(struct azx *chip, int dev) { const struct snd_pci_quirk *q; - if (probe_mask[dev] == -1) { + chip->codec_probe_mask = probe_mask[dev]; + if (chip->codec_probe_mask == -1) { q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); if (q) { printk(KERN_INFO "hda_intel: probe_mask set to 0x%x " "for device %04x:%04x\n", q->value, q->subvendor, q->subdevice); - probe_mask[dev] = q->value; + chip->codec_probe_mask = q->value; } } + + /* check forced option */ + if (chip->codec_probe_mask != -1 && + (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { + chip->codec_mask = chip->codec_probe_mask & 0xff; + printk(KERN_INFO "hda_intel: codec_mask forced to 0x%x\n", + chip->codec_mask); + } } @@ -2347,8 +2358,7 @@ static int __devinit azx_probe(struct pci_dev *pci, card->private_data = chip; /* create codec instances */ - err = azx_codec_create(chip, model[dev], probe_mask[dev], - probe_only[dev]); + err = azx_codec_create(chip, model[dev], probe_only[dev]); if (err < 0) goto out_free; -- cgit v1.2.3 From 20db7cb0acd0ba5a3b12f686148d670294a69366 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 08:18:48 +0100 Subject: ALSA: hda - Add forced codec-slots for ASUS W5F ASUS W5F needs the fixed codec-slots to probe to override the BIOS problem. Tested-by: Giovanni Moser Frainer Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 19886e4bc829..e853e4a8bde9 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2098,6 +2098,8 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), + /* forced codec slots */ + SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), {} }; -- cgit v1.2.3 From 8bb0ac5573ff0879fef511e1a80a4a4db0316daa Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Thu, 12 Feb 2009 16:50:01 -0500 Subject: ALSA: hda: Add STAC_DELL_S14 quirk Add STAC_DELL_S14 quirk for new laptop series. Removed un-needed pins in pin_nids for stac92hd83xxx. Also reorganized connection selection code for the respective ports per quirk define. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 52 ++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 17 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3c84817ccd2e..1ebb36ca2e00 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -83,6 +83,7 @@ enum { enum { STAC_92HD83XXX_REF, STAC_92HD83XXX_PWR_REF, + STAC_DELL_S14, STAC_92HD83XXX_MODELS }; @@ -480,10 +481,9 @@ static hda_nid_t stac92hd73xx_pin_nids[13] = { 0x14, 0x22, 0x23 }; -static hda_nid_t stac92hd83xxx_pin_nids[14] = { +static hda_nid_t stac92hd83xxx_pin_nids[10] = { 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, - 0x1d, 0x1e, 0x1f, 0x20 + 0x0f, 0x10, 0x11, 0x1f, 0x20, }; #define STAC92HD71BXX_NUM_PINS 13 @@ -857,9 +857,9 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = { }; static struct hda_verb stac92hd83xxx_core_init[] = { - { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, - { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, - { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, + { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1}, + { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1}, + { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0}, /* power state controls amps */ { 0x01, AC_VERB_SET_EAPD, 1 << 2}, @@ -1730,21 +1730,28 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { {} /* terminator */ }; -static unsigned int ref92hd83xxx_pin_configs[14] = { +static unsigned int ref92hd83xxx_pin_configs[10] = { 0x02214030, 0x02211010, 0x02a19020, 0x02170130, 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, - 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x01451160, 0x98560170, }; +static unsigned int dell_s14_pin_configs[10] = { + 0x02214030, 0x02211010, 0x02a19020, 0x01014050, + 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160, + 0x40f000f0, 0x40f000f0, +}; + static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, + [STAC_DELL_S14] = dell_s14_pin_configs, }; static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { [STAC_92HD83XXX_REF] = "ref", [STAC_92HD83XXX_PWR_REF] = "mic-ref", + [STAC_DELL_S14] = "dell-s14", }; static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { @@ -1753,6 +1760,8 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { "DFI LanParty", STAC_92HD83XXX_REF), SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_92HD83XXX_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, + "unknown Dell", STAC_DELL_S14), {} /* terminator */ }; @@ -4822,6 +4831,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; int err; int num_dacs; + hda_nid_t nid; spec = kzalloc(sizeof(*spec), GFP_KERNEL); if (spec == NULL) @@ -4840,15 +4850,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); spec->multiout.dac_nids = spec->dac_nids; - - /* set port 0xe to select the last DAC - */ - num_dacs = snd_hda_get_connections(codec, 0x0e, - conn, STAC92HD83_DAC_COUNT + 1) - 1; - - snd_hda_codec_write_cache(codec, 0xe, 0, - AC_VERB_SET_CONNECT_SEL, num_dacs); - spec->init = stac92hd83xxx_core_init; spec->mixer = stac92hd83xxx_mixer; spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); @@ -4900,6 +4901,23 @@ again: return err; } + switch (spec->board_config) { + case STAC_DELL_S14: + nid = 0xf; + break; + default: + nid = 0xe; + break; + } + + num_dacs = snd_hda_get_connections(codec, nid, + conn, STAC92HD83_DAC_COUNT + 1) - 1; + + /* set port X to select the last DAC + */ + snd_hda_codec_write_cache(codec, nid, 0, + AC_VERB_SET_CONNECT_SEL, num_dacs); + codec->patch_ops = stac92xx_patch_ops; codec->proc_widget_hook = stac92hd_proc_hook; -- cgit v1.2.3 From 27e089888fb1a3d1d13892262f9d522b03985044 Mon Sep 17 00:00:00 2001 From: Aristeu Sergio Rozanski Filho Date: Thu, 12 Feb 2009 17:50:37 -0500 Subject: ALSA: hda: add quirk for Lenovo X200 laptop dock Currently the HP connector on X200 dock doesn't detect when a HP is connected nor allows sound to be played using it. This patch fixes the problem by adding a quirk for this specific model. It's possible that others have the same NID (0x19) to report when dock HP is connected, but I don't have access to any. Please Cc me in the reply since I'm not subscribed to alsa-devel@. Signed-off-by: Aristeu Rozanski Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 1 + sound/pci/hda/patch_conexant.c | 40 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 8f40999a456e..0e52d273ce96 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -262,6 +262,7 @@ Conexant 5051 ============= laptop Basic Laptop config (default) hp HP Spartan laptop + lenovo-x200 Lenovo X200 laptop STAC9200 ======== diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index fdf876be712d..b8de73ecfdeb 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1798,6 +1798,40 @@ static struct hda_verb cxt5051_init_verbs[] = { { } /* end */ }; +static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { + /* Line in, Mic */ + {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, + {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, + {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, + {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, + {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, + /* SPK */ + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* HP, Amp */ + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* Docking HP */ + {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* DAC1 */ + {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + /* Record selector: Int mic */ + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, + /* SPDIF route: PCM */ + {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, + /* EAPD */ + {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ + {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, + {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, + {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTC_EVENT}, + {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, + { } /* end */ +}; + /* initialize jack-sensing, too */ static int cxt5051_init(struct hda_codec *codec) { @@ -1815,18 +1849,21 @@ static int cxt5051_init(struct hda_codec *codec) enum { CXT5051_LAPTOP, /* Laptops w/ EAPD support */ CXT5051_HP, /* no docking */ + CXT5051_LENOVO_X200, /* Lenovo X200 laptop */ CXT5051_MODELS }; static const char *cxt5051_models[CXT5051_MODELS] = { [CXT5051_LAPTOP] = "laptop", [CXT5051_HP] = "hp", + [CXT5051_LENOVO_X200] = "lenovo-x200", }; static struct snd_pci_quirk cxt5051_cfg_tbl[] = { SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", CXT5051_LAPTOP), SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), + SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT5051_LENOVO_X200), {} }; @@ -1867,6 +1904,9 @@ static int patch_cxt5051(struct hda_codec *codec) codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; spec->mixers[0] = cxt5051_hp_mixers; break; + case CXT5051_LENOVO_X200: + spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; + /* fallthru */ default: case CXT5051_LAPTOP: codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; -- cgit v1.2.3 From 92258a3ed2f583c8720ef570f5c62b28e6c58d71 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Thu, 12 Feb 2009 17:27:27 -0200 Subject: ALSA: hda - Change HP dv7 (103c:30f4) quirk from hp-m4 to hp-dv5 model Change HP dv7 quirk: although reported to work with hp-m4 model (https://bugzilla.novell.com/show_bug.cgi?id=445321), the original report doesn't contain info about testing of internal microphone. Recently I received a report about internal mic not working (https://qa.mandriva.com/show_bug.cgi?id=44855#c193), this must be related with the forced line in on pin 0x0e done with hp-m4 model. Thus change the current quirk from STAC_HP_M4 to STAC_HP_DV5, later reported to be fixed on a provided kernel with this change (https://qa.mandriva.com/show_bug.cgi?id=44855#c196). Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 38428e22428f..aa814a3c2d8c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1799,7 +1799,7 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, "HP dv5", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, - "HP dv7", STAC_HP_M4), + "HP dv7", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, "HP dv4", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, -- cgit v1.2.3 From 946835074e026f4bbe9f3c2b091dca6346bd1474 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 09:31:20 +0100 Subject: ALSA: hda - Add quirk for Acer AX1700-U3700A Force model=auto for Acer AX1700-U3700A with ALC888 codec. Since Acer devices are handlded as model=acer as default, the auto parsing has to be specified explicitly. (Maybe it's better rather to remove this default model=acer handling, though.) Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e46251bceb9d..2306cca1b69f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8520,6 +8520,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", ALC888_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", ALC888_ACER_ASPIRE_4930G), /* default Acer */ -- cgit v1.2.3 From 3a08e30de2facffe8e1a25bf4fa62cbc920fbaf6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 11:37:08 +0100 Subject: ALSA: hda - Add missing terminator in slave dig-out array Added the missing terminator for ad1989b_slave_dig_outs[]. Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2e7371ec2e23..7006d62ca6c2 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -1885,8 +1885,8 @@ static hda_nid_t ad1988_capsrc_nids[3] = { #define AD1988_SPDIF_OUT_HDMI 0x0b #define AD1988_SPDIF_IN 0x07 -static hda_nid_t ad1989b_slave_dig_outs[2] = { - AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI +static hda_nid_t ad1989b_slave_dig_outs[] = { + AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0 }; static struct hda_input_mux ad1988_6stack_capture_source = { -- cgit v1.2.3 From 9411e21cd0cc4fd046b4f448417b0e103e80951c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 11:32:28 +0100 Subject: ALSA: hda - Add snd_hda_multi_out_dig_cleanup() Added the helper function snd_hda_multi_out_dig_cleanup() to clean up the digital outputs with multi setup. This call is needed in cases the codec supports multiple digital outputs as slaves. Otherwise the slave widgets aren't properly cleaned up. For a single digital output (e.g. in patch_conexant.c), this call isn't needed. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 10 ++++++++++ sound/pci/hda/hda_local.h | 2 ++ sound/pci/hda/patch_analog.c | 11 ++++++++++- sound/pci/hda/patch_sigmatel.c | 11 ++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0b708134d12f..d03f99298be9 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3088,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, } EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); +int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, + struct hda_multi_out *mout) +{ + mutex_lock(&codec->spdif_mutex); + cleanup_dig_out_stream(codec, mout->dig_out_nid); + mutex_unlock(&codec->spdif_mutex); + return 0; +} +EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup); + /* * release the digital out */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 1dd8716c387f..44f189cb97ae 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, unsigned int stream_tag, unsigned int format, struct snd_pcm_substream *substream); +int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, + struct hda_multi_out *mout); int snd_hda_multi_out_analog_open(struct hda_codec *codec, struct hda_multi_out *mout, struct snd_pcm_substream *substream, diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 7006d62ca6c2..e48612323aa0 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, format, substream); } +static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, + struct hda_codec *codec, + struct snd_pcm_substream *substream) +{ + struct ad198x_spec *spec = codec->spec; + return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); +} + /* * Analog capture */ @@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = { .ops = { .open = ad198x_dig_playback_pcm_open, .close = ad198x_dig_playback_pcm_close, - .prepare = ad198x_dig_playback_pcm_prepare + .prepare = ad198x_dig_playback_pcm_prepare, + .cleanup = ad198x_dig_playback_pcm_cleanup }, }; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index aa814a3c2d8c..8027edf3c8f2 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2442,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, stream_tag, format, substream); } +static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, + struct hda_codec *codec, + struct snd_pcm_substream *substream) +{ + struct sigmatel_spec *spec = codec->spec; + return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); +} + /* * Analog capture callbacks @@ -2486,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = { .ops = { .open = stac92xx_dig_playback_pcm_open, .close = stac92xx_dig_playback_pcm_close, - .prepare = stac92xx_dig_playback_pcm_prepare + .prepare = stac92xx_dig_playback_pcm_prepare, + .cleanup = stac92xx_dig_playback_pcm_cleanup }, }; -- cgit v1.2.3 From 9b5f12e5a4029c1cd03784754687faef6d9e54fa Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 11:47:37 +0100 Subject: ALSA: hda - Add proper cleanup for multiout-dig for ALC codecs The recent patch_realtek.c contains the slave digital-out support as well. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 2306cca1b69f..ef9b7ee34100 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2979,6 +2979,14 @@ static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, stream_tag, format, substream); } +static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, + struct hda_codec *codec, + struct snd_pcm_substream *substream) +{ + struct alc_spec *spec = codec->spec; + return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); +} + static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, struct hda_codec *codec, struct snd_pcm_substream *substream) @@ -3062,7 +3070,8 @@ static struct hda_pcm_stream alc880_pcm_digital_playback = { .ops = { .open = alc880_dig_playback_pcm_open, .close = alc880_dig_playback_pcm_close, - .prepare = alc880_dig_playback_pcm_prepare + .prepare = alc880_dig_playback_pcm_prepare, + .cleanup = alc880_dig_playback_pcm_cleanup }, }; -- cgit v1.2.3 From 6a05ac4afa90ac9c38fedd3f6940fe8da5d1fcf6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Feb 2009 11:19:09 +0100 Subject: ALSA: hda - Support multiple digital outs with auto-probing Added the support of multiple digital outputs via auto-probing for Realtek ALC88x codecs. The multiple outputs are handled as slave streams, so only one PCM stream (and the corresponding IEC958* elements) is provided to control both digital outputs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ef9b7ee34100..244de597c5be 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -279,6 +279,7 @@ struct alc_spec { * dig_out_nid and hp_nid are optional */ hda_nid_t alt_dac_nid; + hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ int dig_out_type; /* capture */ @@ -4269,7 +4270,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) static int alc880_parse_auto_config(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - int err; + int i, err; static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, @@ -4300,8 +4301,23 @@ static int alc880_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_outs) - spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; + /* check multiple SPDIF-out (for recent codecs) */ + for (i = 0; i < spec->autocfg.dig_outs; i++) { + hda_nid_t dig_nid; + err = snd_hda_get_connections(codec, + spec->autocfg.dig_out_pins[i], + &dig_nid, 1); + if (err < 0) + continue; + if (!i) + spec->multiout.dig_out_nid = dig_nid; + else { + spec->multiout.slave_dig_outs = spec->slave_dig_outs; + spec->slave_dig_outs[i - 1] = dig_nid; + if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) + break; + } + } if (spec->autocfg.dig_in_pin) spec->dig_in_nid = ALC880_DIGIN_NID; -- cgit v1.2.3 From d14a7e0bfc4aed6452a436c9836903fbd1a5d6ad Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Feb 2009 10:13:03 +0100 Subject: Revert "Sound: hda - Restore PCI configuration space with interrupts off" This reverts commit 32e176c14d7a425b681ef003c9061001ddb7fc7b. That commit caused a regression with suspend on Thinkpad SL300. Reference: kernel bug#12711 http://bugzilla.kernel.org/show_bug.cgi?id=12711 Tested-by: Alexandre Rostovtsev Acked-by: Rafael J. Wysocki Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 11e791b965f6..c8d9178f47e5 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1947,16 +1947,13 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) return 0; } -static int azx_resume_early(struct pci_dev *pci) -{ - return pci_restore_state(pci); -} - static int azx_resume(struct pci_dev *pci) { struct snd_card *card = pci_get_drvdata(pci); struct azx *chip = card->private_data; + pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); if (pci_enable_device(pci) < 0) { printk(KERN_ERR "hda-intel: pci_enable_device failed, " "disabling device\n"); @@ -2468,7 +2465,6 @@ static struct pci_driver driver = { .remove = __devexit_p(azx_remove), #ifdef CONFIG_PM .suspend = azx_suspend, - .resume_early = azx_resume_early, .resume = azx_resume, #endif }; -- cgit v1.2.3 From e2ea57a8df6da45f5f63ab7b56528a552f36fb72 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Mon, 16 Feb 2009 10:23:00 +0100 Subject: ALSA: hda - Fix speaker output on HP DV4 1155-SE Force speaker pin config with model=hp-dv5 model for cases when bios doesn't set it up properly. All reported hp laptops using model=hp-dv5 model have speaker at pin 0x0d with same config, so it's safe to add this within hp-dv5 model. Reference: alsa-devel mailing list thread on http://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014390.html Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index aeb5d2126dae..7320059b7135 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1823,6 +1823,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "HP dv7", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, "HP dv4", STAC_HP_DV5), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, + "HP dv7", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, "HP dv7", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, @@ -5170,6 +5172,10 @@ again: spec->num_smuxes = 0; spec->num_dmuxes = 0; break; + case STAC_HP_DV5: + stac_change_pin_config(codec, 0x0d, 0x90170010); + stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); + break; }; spec->multiout.dac_nids = spec->dac_nids; -- cgit v1.2.3 From a259cb8eb784352ee9ce46a4fc6cd94fc2fbc68d Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Sun, 15 Feb 2009 20:51:19 +0100 Subject: sound: OSS: &&/|| typo in ad1848.c &&/|| typo Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/oss/ad1848.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 7cf9913a47b2..a5b83568bdc8 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -2107,7 +2107,7 @@ int ad1848_control(int cmd, int arg) switch (cmd) { case AD1848_SET_XTAL: /* Change clock frequency of AD1845 (only ) */ - if (devc->model != MD_1845 || devc->model != MD_1845_SSCAPE) + if (devc->model != MD_1845 && devc->model != MD_1845_SSCAPE) return -EINVAL; spin_lock_irqsave(&devc->lock,flags); ad_enter_MCE(devc); -- cgit v1.2.3 From 2ae466f8cc522843fa9a456e46007dd98b052b13 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Feb 2009 14:16:36 +0100 Subject: ALSA: hda - Cleanup IDT92HD7x HP quirks Clean up IDT92HD7x quirks for HP laptops with SND_PCI_QUIRK_MASK(). Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7320059b7135..d00a211a813b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1817,22 +1817,12 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "DFI LanParty", STAC_92HD71BXX_REF), SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_92HD71BXX_REF), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, - "HP dv5", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, - "HP dv7", STAC_HP_DV5), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, - "HP dv4", STAC_HP_DV5), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, - "HP dv7", STAC_HP_DV5), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, - "HP dv7", STAC_HP_M4), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, - "HP dv5", STAC_HP_DV5), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, - "HP dv5", STAC_HP_DV5), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, + "HP dv4-7", STAC_HP_DV5), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, + "HP dv4-7", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, - "unknown HP", STAC_HP_M4), + "HP mini 1000", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, "unknown Dell", STAC_DELL_M4_1), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, -- cgit v1.2.3 From c23127566c7a54c8413bf1b99becea76072f467e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Feb 2009 15:20:41 +0100 Subject: ALSA: hda - Clean up quirks for HP laptops with AD1984A Clean up quirks for HP laptops with AD1984A using SND_PCI_QUIRK_MASK() Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index af6b0035e2e8..2c58d7b05aba 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3923,8 +3923,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), - SND_PCI_QUIRK(0x103c, 0x3072, "HP", AD1884A_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x3077, "HP", AD1884A_LAPTOP), + SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x3070, "HP", AD1884A_MOBILE), SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), -- cgit v1.2.3 From e156ac4c571e3be741bc411e58820b74a9295c72 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 16 Feb 2009 15:22:39 +0100 Subject: sound: usb-audio: fix uninitialized variable with M-Audio MIDI interfaces Fix the snd_usbmidi_create_endpoints_midiman() function, which forgot to set the out_interval member of the endpoint info structure for Midiman/ M-Audio devices. Since kernel 2.6.24, any non-zero value makes the driver use interrupt transfers instead of bulk transfers. With EHCI controllers, these random interval values result in unbearably large latencies for output MIDI transfers. Signed-off-by: Clemens Ladisch Reported-by: David Tested-by: David Cc: Signed-off-by: Takashi Iwai --- sound/usb/usbmidi.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 320641ab5be7..26bad373fe65 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, } ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; + ep_info.out_interval = 0; ep_info.out_cables = endpoint->out_cables & 0x5555; err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); if (err < 0) -- cgit v1.2.3 From 0412558c873f716efe902b397af0653a550f7341 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Feb 2009 22:48:12 +0100 Subject: ALSA: usb-audio - Fix non-continuous rate detection The detection of non-continuous rates (given via rate tables) isn't processed properly (e.g. for type II). This patch fixes and simplifies the detection code. Tested-by: Joris van Rantwijk Cc: Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 2ab83129d9b0..80863093d2c8 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform * build the rate table and bitmap flags */ int r, idx; - unsigned int nonzero_rates = 0; fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); if (fp->rate_table == NULL) { @@ -2532,24 +2531,26 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform return -1; } - fp->nr_rates = nr_rates; - fp->rate_min = fp->rate_max = combine_triple(&fmt[8]); + fp->nr_rates = 0; + fp->rate_min = fp->rate_max = 0; for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { unsigned int rate = combine_triple(&fmt[idx]); + if (!rate) + continue; /* C-Media CM6501 mislabels its 96 kHz altsetting */ if (rate == 48000 && nr_rates == 1 && chip->usb_id == USB_ID(0x0d8c, 0x0201) && fp->altsetting == 5 && fp->maxpacksize == 392) rate = 96000; - fp->rate_table[r] = rate; - nonzero_rates |= rate; - if (rate < fp->rate_min) + fp->rate_table[fp->nr_rates] = rate; + if (!fp->rate_min || rate < fp->rate_min) fp->rate_min = rate; - else if (rate > fp->rate_max) + if (!fp->rate_max || rate > fp->rate_max) fp->rate_max = rate; fp->rates |= snd_pcm_rate_to_rate_bit(rate); + fp->nr_rates++; } - if (!nonzero_rates) { + if (!fp->nr_rates) { hwc_debug("All rates were zero. Skipping format!\n"); return -1; } -- cgit v1.2.3 From 3b03cc5b86e2052295b9b484f37226ee15c87924 Mon Sep 17 00:00:00 2001 From: Joris van Rantwijk Date: Mon, 16 Feb 2009 22:58:23 +0100 Subject: ALSA: usb-audio - Workaround for misdetected sample rate with CM6207 The CM6207 incorrectly advertises its 96 kHz playback setting as 48 kHz in its USB device descriptor. This patch extends an existing workaround in usbaudio.c to also cover the CM6207. This resolves issue 0004249 in the ALSA bug tracker. Signed-off-by: Joris van Rantwijk Cc: Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 80863093d2c8..19e37451c216 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -2539,7 +2539,8 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform continue; /* C-Media CM6501 mislabels its 96 kHz altsetting */ if (rate == 48000 && nr_rates == 1 && - chip->usb_id == USB_ID(0x0d8c, 0x0201) && + (chip->usb_id == USB_ID(0x0d8c, 0x0201) || + chip->usb_id == USB_ID(0x0d8c, 0x0102)) && fp->altsetting == 5 && fp->maxpacksize == 392) rate = 96000; fp->rate_table[fp->nr_rates] = rate; -- cgit v1.2.3 From c2b73d1458014a9f461b75bc1756a699a6c0781f Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Mon, 16 Feb 2009 21:38:37 +0100 Subject: ALSA: cs4236: cs4232 and cs4236 driver merge to solve PnP BIOS detection cs4232 and cs4236 driver merge to solve PnP BIOS detection. Also, the patch adds recognition if the chip is cs4236b+ or earlier part. This unifies drivers for both cs4232 and cs4236+ chips. It allows to use the PnP BIOS detection for the cs4236+ chips. Previously, only the snd-cs4232 could be detected by the PnP BIOS. The cs4232+ cards reports two separate PnP BIOS ids. The patch adds search for the second id to find out resources assigned to a control port. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- include/sound/wss.h | 1 + sound/isa/Kconfig | 23 ++----- sound/isa/cs423x/Makefile | 2 - sound/isa/cs423x/cs4232.c | 2 - sound/isa/cs423x/cs4236.c | 153 +++++++++++++++++++++------------------------- sound/isa/wss/wss_lib.c | 3 +- 6 files changed, 78 insertions(+), 106 deletions(-) delete mode 100644 sound/isa/cs423x/cs4232.c (limited to 'sound') diff --git a/include/sound/wss.h b/include/sound/wss.h index fd01f22825cd..6d65f322f1d5 100644 --- a/include/sound/wss.h +++ b/include/sound/wss.h @@ -154,6 +154,7 @@ int snd_wss_create(struct snd_card *card, unsigned short hardware, unsigned short hwshare, struct snd_wss **rchip); +int snd_wss_free(struct snd_wss *chip); int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); int snd_wss_mixer(struct snd_wss *chip); diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 5915dc41c0ee..4e06bbd9298d 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -56,8 +56,8 @@ config SND_AD1848 Say Y here to include support for AD1848 (Analog Devices) or CS4248 (Cirrus Logic - Crystal Semiconductors) chips. - For newer chips from Cirrus Logic, use the CS4231, CS4232 or - CS4236+ drivers. + For newer chips from Cirrus Logic, use the CS4231 or CS4232+ + drivers. To compile this driver as a module, choose M here: the module will be called snd-ad1848. @@ -114,26 +114,15 @@ config SND_CS4231 To compile this driver as a module, choose M here: the module will be called snd-cs4231. -config SND_CS4232 - tristate "Generic Cirrus Logic CS4232 driver" - select SND_OPL3_LIB - select SND_MPU401_UART - select SND_WSS_LIB - help - Say Y here to include support for CS4232 chips from Cirrus - Logic - Crystal Semiconductors. - - To compile this driver as a module, choose M here: the module - will be called snd-cs4232. - config SND_CS4236 - tristate "Generic Cirrus Logic CS4236+ driver" + tristate "Generic Cirrus Logic CS4232/CS4236+ driver" select SND_OPL3_LIB select SND_MPU401_UART select SND_WSS_LIB help - Say Y to include support for CS4235,CS4236,CS4237B,CS4238B, - CS4239 chips from Cirrus Logic - Crystal Semiconductors. + Say Y to include support for CS4232,CS4235,CS4236,CS4237B, + CS4238B,CS4239 chips from Cirrus Logic - Crystal + Semiconductors. To compile this driver as a module, choose M here: the module will be called snd-cs4236. diff --git a/sound/isa/cs423x/Makefile b/sound/isa/cs423x/Makefile index 5870ca21ab59..732f66cc036d 100644 --- a/sound/isa/cs423x/Makefile +++ b/sound/isa/cs423x/Makefile @@ -5,11 +5,9 @@ snd-cs4236-lib-objs := cs4236_lib.o snd-cs4231-objs := cs4231.o -snd-cs4232-objs := cs4232.o snd-cs4236-objs := cs4236.o # Toplevel Module Dependency obj-$(CONFIG_SND_CS4231) += snd-cs4231.o -obj-$(CONFIG_SND_CS4232) += snd-cs4232.o obj-$(CONFIG_SND_CS4236) += snd-cs4236.o snd-cs4236-lib.o diff --git a/sound/isa/cs423x/cs4232.c b/sound/isa/cs423x/cs4232.c deleted file mode 100644 index 9fad2e6c0c2c..000000000000 --- a/sound/isa/cs423x/cs4232.c +++ /dev/null @@ -1,2 +0,0 @@ -#define CS4232 -#include "cs4236.c" diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index f7845986f467..a076a6ce8071 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -33,17 +33,14 @@ MODULE_AUTHOR("Jaroslav Kysela "); MODULE_LICENSE("GPL"); -#ifdef CS4232 -MODULE_DESCRIPTION("Cirrus Logic CS4232"); +MODULE_DESCRIPTION("Cirrus Logic CS4232-9"); MODULE_SUPPORTED_DEVICE("{{Turtle Beach,TBS-2000}," "{Turtle Beach,Tropez Plus}," "{SIC CrystalWave 32}," "{Hewlett Packard,Omnibook 5500}," "{TerraTec,Maestro 32/96}," - "{Philips,PCA70PS}}"); -#else -MODULE_DESCRIPTION("Cirrus Logic CS4235-9"); -MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4235}," + "{Philips,PCA70PS}}," + "{{Crystal Semiconductors,CS4235}," "{Crystal Semiconductors,CS4236}," "{Crystal Semiconductors,CS4237}," "{Crystal Semiconductors,CS4238}," @@ -70,15 +67,11 @@ MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4235}," "{Typhoon Soundsystem,CS4236B}," "{Turtle Beach,Malibu}," "{Unknown,Digital PC 5000 Onboard}}"); -#endif -#ifdef CS4232 -#define IDENT "CS4232" -#define DEV_NAME "cs4232" -#else -#define IDENT "CS4236+" -#define DEV_NAME "cs4236" -#endif +MODULE_ALIAS("snd_cs4232"); + +#define IDENT "CS4232+" +#define DEV_NAME "cs4232+" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ @@ -128,9 +121,7 @@ MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); #ifdef CONFIG_PNP static int isa_registered; static int pnpc_registered; -#ifdef CS4232 static int pnp_registered; -#endif #endif /* CONFIG_PNP */ struct snd_card_cs4236 { @@ -145,11 +136,10 @@ struct snd_card_cs4236 { #ifdef CONFIG_PNP -#ifdef CS4232 /* * PNP BIOS */ -static const struct pnp_device_id snd_cs4232_pnpbiosids[] = { +static const struct pnp_device_id snd_cs423x_pnpbiosids[] = { { .id = "CSC0100" }, { .id = "CSC0000" }, /* Guillemot Turtlebeach something appears to be cs4232 compatible @@ -157,10 +147,8 @@ static const struct pnp_device_id snd_cs4232_pnpbiosids[] = { { .id = "GIM0100" }, { .id = "" } }; -MODULE_DEVICE_TABLE(pnp, snd_cs4232_pnpbiosids); -#endif /* CS4232 */ +MODULE_DEVICE_TABLE(pnp, snd_cs423x_pnpbiosids); -#ifdef CS4232 #define CS423X_ISAPNP_DRIVER "cs4232_isapnp" static struct pnp_card_device_id snd_cs423x_pnpids[] = { /* Philips PCA70PS */ @@ -179,12 +167,6 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = { { .id = "CSCf032", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, /* Netfinity 3000 on-board soundcard */ { .id = "CSCe825", .devs = { { "CSC0100" }, { "CSC0110" }, { "CSC010f" } } }, - /* --- */ - { .id = "" } /* end */ -}; -#else /* CS4236 */ -#define CS423X_ISAPNP_DRIVER "cs4236_isapnp" -static struct pnp_card_device_id snd_cs423x_pnpids[] = { /* Intel Marlin Spike Motherboard - CS4235 */ { .id = "CSC0225", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, /* Intel Marlin Spike Motherboard (#2) - CS4235 */ @@ -266,7 +248,6 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = { /* --- */ { .id = "" } /* end */ }; -#endif MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids); @@ -323,17 +304,19 @@ static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) return 0; } -#ifdef CS4232 -static int __devinit snd_card_cs4232_pnp(int dev, struct snd_card_cs4236 *acard, - struct pnp_dev *pdev) +static int __devinit snd_card_cs423x_pnp(int dev, struct snd_card_cs4236 *acard, + struct pnp_dev *pdev, + struct pnp_dev *cdev) { acard->wss = pdev; if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0) return -EBUSY; - cport[dev] = -1; + if (cdev) + cport[dev] = pnp_port_start(cdev, 0); + else + cport[dev] = -1; return 0; } -#endif static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard, struct pnp_card_link *card, @@ -411,40 +394,39 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) return -EBUSY; } -#ifdef CS4232 err = snd_wss_create(card, port[dev], cport[dev], irq[dev], dma1[dev], dma2[dev], - WSS_HW_DETECT, 0, &chip); - if (err < 0) - return err; - acard->chip = chip; - - err = snd_wss_pcm(chip, 0, &pcm); - if (err < 0) - return err; - - err = snd_wss_mixer(chip); + WSS_HW_DETECT3, 0, &chip); if (err < 0) return err; - -#else /* CS4236 */ - err = snd_cs4236_create(card, - port[dev], cport[dev], - irq[dev], dma1[dev], dma2[dev], - WSS_HW_DETECT, 0, &chip); - if (err < 0) - return err; - acard->chip = chip; - - err = snd_cs4236_pcm(chip, 0, &pcm); - if (err < 0) - return err; - - err = snd_cs4236_mixer(chip); - if (err < 0) - return err; -#endif + if (chip->hardware & WSS_HW_CS4236B_MASK) { + snd_wss_free(chip); + err = snd_cs4236_create(card, + port[dev], cport[dev], + irq[dev], dma1[dev], dma2[dev], + WSS_HW_DETECT, 0, &chip); + if (err < 0) + return err; + acard->chip = chip; + + err = snd_cs4236_pcm(chip, 0, &pcm); + if (err < 0) + return err; + + err = snd_cs4236_mixer(chip); + if (err < 0) + return err; + } else { + acard->chip = chip; + err = snd_wss_pcm(chip, 0, &pcm); + if (err < 0) + return err; + + err = snd_wss_mixer(chip); + if (err < 0) + return err; + } strcpy(card->driver, pcm->name); strcpy(card->shortname, pcm->name); sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", @@ -579,13 +561,14 @@ static struct isa_driver cs423x_isa_driver = { #ifdef CONFIG_PNP -#ifdef CS4232 -static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, +static int __devinit snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, const struct pnp_device_id *id) { static int dev; int err; struct snd_card *card; + struct pnp_dev *cdev; + char cid[PNP_ID_LEN]; if (pnp_device_is_isapnp(pdev)) return -ENOENT; /* we have another procedure - card */ @@ -596,10 +579,19 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, if (dev >= SNDRV_CARDS) return -ENODEV; + /* prepare second id */ + strcpy(cid, pdev->id[0].id); + cid[5] = '1'; + cdev = NULL; + list_for_each_entry(cdev, &(pdev->protocol->devices), protocol_list) { + if (!strcmp(cdev->id[0].id, cid)) + break; + } err = snd_cs423x_card_new(dev, &card); if (err < 0) return err; - if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) { + err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev); + if (err < 0) { printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n"); snd_card_free(card); return err; @@ -614,35 +606,34 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, return 0; } -static void __devexit snd_cs4232_pnp_remove(struct pnp_dev * pdev) +static void __devexit snd_cs423x_pnp_remove(struct pnp_dev *pdev) { snd_card_free(pnp_get_drvdata(pdev)); pnp_set_drvdata(pdev, NULL); } #ifdef CONFIG_PM -static int snd_cs4232_pnp_suspend(struct pnp_dev *pdev, pm_message_t state) +static int snd_cs423x_pnp_suspend(struct pnp_dev *pdev, pm_message_t state) { return snd_cs423x_suspend(pnp_get_drvdata(pdev)); } -static int snd_cs4232_pnp_resume(struct pnp_dev *pdev) +static int snd_cs423x_pnp_resume(struct pnp_dev *pdev) { return snd_cs423x_resume(pnp_get_drvdata(pdev)); } #endif -static struct pnp_driver cs4232_pnp_driver = { - .name = "cs4232-pnpbios", - .id_table = snd_cs4232_pnpbiosids, - .probe = snd_cs4232_pnpbios_detect, - .remove = __devexit_p(snd_cs4232_pnp_remove), +static struct pnp_driver cs423x_pnp_driver = { + .name = "cs423x-pnpbios", + .id_table = snd_cs423x_pnpbiosids, + .probe = snd_cs423x_pnpbios_detect, + .remove = __devexit_p(snd_cs423x_pnp_remove), #ifdef CONFIG_PM - .suspend = snd_cs4232_pnp_suspend, - .resume = snd_cs4232_pnp_resume, + .suspend = snd_cs423x_pnp_suspend, + .resume = snd_cs423x_pnp_resume, #endif }; -#endif /* CS4232 */ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -716,18 +707,14 @@ static int __init alsa_card_cs423x_init(void) #ifdef CONFIG_PNP if (!err) isa_registered = 1; -#ifdef CS4232 - err = pnp_register_driver(&cs4232_pnp_driver); + err = pnp_register_driver(&cs423x_pnp_driver); if (!err) pnp_registered = 1; -#endif err = pnp_register_card_driver(&cs423x_pnpc_driver); if (!err) pnpc_registered = 1; -#ifdef CS4232 if (pnp_registered) err = 0; -#endif if (isa_registered) err = 0; #endif @@ -739,10 +726,8 @@ static void __exit alsa_card_cs423x_exit(void) #ifdef CONFIG_PNP if (pnpc_registered) pnp_unregister_card_driver(&cs423x_pnpc_driver); -#ifdef CS4232 if (pnp_registered) - pnp_unregister_driver(&cs4232_pnp_driver); -#endif + pnp_unregister_driver(&cs423x_pnp_driver); if (isa_registered) #endif isa_unregister_driver(&cs423x_isa_driver); diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 8de5deda7ad6..ac27832b2c6f 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -1657,7 +1657,7 @@ static void snd_wss_resume(struct snd_wss *chip) } #endif /* CONFIG_PM */ -static int snd_wss_free(struct snd_wss *chip) +int snd_wss_free(struct snd_wss *chip) { release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_cport); @@ -1680,6 +1680,7 @@ static int snd_wss_free(struct snd_wss *chip) kfree(chip); return 0; } +EXPORT_SYMBOL(snd_wss_free); static int snd_wss_dev_free(struct snd_device *device) { -- cgit v1.2.3 From 83807400794a1d680a4fb70a610c5f486e734f45 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Feb 2009 07:59:40 +0100 Subject: ALSA: au88x0 - Fix &&|| typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed a typo of || and &&. As it's in a disabled code section, there is no behavior change, though. Reported-by: Jörg-Volker Peetz Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index e6a04d037c15..3906f5afe27a 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -2800,7 +2800,7 @@ vortex_translateformat(vortex_t * vortex, char bits, char nch, int encod) { int a, this_194; - if ((bits != 8) || (bits != 16)) + if ((bits != 8) && (bits != 16)) return -1; switch (encod) { -- cgit v1.2.3 From b22f5d94c432e97df8d85151fcf3da16cee75f04 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Feb 2009 08:02:16 +0100 Subject: sound: OSS: ad1848 - Fix another typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix another typo of || and &&. Reported-by: Jörg-Volker Peetz Signed-off-by: Takashi Iwai --- sound/oss/ad1848.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index a5b83568bdc8..d12bd98a37ba 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -280,7 +280,7 @@ static void wait_for_calibration(ad1848_info * devc) while (timeout > 0 && (ad_read(devc, 11) & 0x20)) timeout--; if (ad_read(devc, 11) & 0x20) - if ( (devc->model != MD_1845) || (devc->model != MD_1845_SSCAPE)) + if ((devc->model != MD_1845) && (devc->model != MD_1845_SSCAPE)) printk(KERN_WARNING "ad1848: Auto calibration timed out(3).\n"); } -- cgit v1.2.3 From cda9043d56cee9fea39e4ee33fd605ae477a1950 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Feb 2009 08:10:54 +0100 Subject: ALSA: cs4236 - Merge snd-cs4236-lib module into snd-cs4236 Since cs4232 and cs4236 drivers are merged, there is no reason to keep snd-cs4236-lib module separately. Let's merge it into the main driver as well. Signed-off-by: Takashi Iwai --- sound/isa/cs423x/Makefile | 6 +++--- sound/isa/cs423x/cs4236_lib.c | 24 ------------------------ 2 files changed, 3 insertions(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/isa/cs423x/Makefile b/sound/isa/cs423x/Makefile index 732f66cc036d..6d397e8d54ac 100644 --- a/sound/isa/cs423x/Makefile +++ b/sound/isa/cs423x/Makefile @@ -3,11 +3,11 @@ # Copyright (c) 2001 by Jaroslav Kysela # -snd-cs4236-lib-objs := cs4236_lib.o snd-cs4231-objs := cs4231.o -snd-cs4236-objs := cs4236.o +snd-cs4236-objs := cs4236.o cs4236_lib.o # Toplevel Module Dependency obj-$(CONFIG_SND_CS4231) += snd-cs4231.o -obj-$(CONFIG_SND_CS4236) += snd-cs4236.o snd-cs4236-lib.o +obj-$(CONFIG_SND_CS4236) += snd-cs4236.o + diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 2406efdfd8dd..38835f31298b 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -88,10 +88,6 @@ #include #include -MODULE_AUTHOR("Jaroslav Kysela "); -MODULE_DESCRIPTION("Routines for control of CS4235/4236B/4237B/4238B/4239 chips"); -MODULE_LICENSE("GPL"); - /* * */ @@ -1022,23 +1018,3 @@ int snd_cs4236_mixer(struct snd_wss *chip) } return 0; } - -EXPORT_SYMBOL(snd_cs4236_create); -EXPORT_SYMBOL(snd_cs4236_pcm); -EXPORT_SYMBOL(snd_cs4236_mixer); - -/* - * INIT part - */ - -static int __init alsa_cs4236_init(void) -{ - return 0; -} - -static void __exit alsa_cs4236_exit(void) -{ -} - -module_init(alsa_cs4236_init) -module_exit(alsa_cs4236_exit) -- cgit v1.2.3 From c16159123d5b3245e2b30023a207606c74032f9c Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Wed, 18 Feb 2009 10:15:00 +0100 Subject: sound: OSS: missing parentheses in pas2_card.c Add missing parentheses in pas2_card.c. Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/oss/pas2_card.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c index 25f3a22c52ee..7f377ec3486d 100644 --- a/sound/oss/pas2_card.c +++ b/sound/oss/pas2_card.c @@ -156,9 +156,7 @@ static int __init config_pas_hw(struct address_info *hw_config) * 0x80 */ , 0xB88); - pas_write(0x80 - | joystick?0x40:0 - ,0xF388); + pas_write(0x80 | (joystick ? 0x40 : 0), 0xF388); if (pas_irq < 0 || pas_irq > 15) { -- cgit v1.2.3 From b3bdb30b6d1989129e297641fec791e9e555e4d8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 18 Feb 2009 13:16:26 +0100 Subject: ALSA: hda - Add quirk for Acer X3200 Acer X3200 needs model=auto, otherwise model=acer is pre-selected. Reference: Novell bnc#476268 https://bugzilla.novell.com/show_bug.cgi?id=476268 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 244de597c5be..192c92a5af38 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8545,6 +8545,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", ALC888_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", ALC888_ACER_ASPIRE_4930G), -- cgit v1.2.3 From 2678f60d2bc05a12580b93eb36f089f0e55693e0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 18 Feb 2009 16:46:27 +0100 Subject: ALSA: jack - Use card->shortname for input name Currently the jack layer refers to card->longname as a part of its input device name string. However, longname is often really long and way too ugly as an identifier, such as, "HDA Intel at 0xf8400000 irq 21". This patch changes the code to use card->shortname instead. The shortname string contains usually the h/w vendor and product names but without messy I/O port or IRQ numbers. Signed-off-by: Takashi Iwai --- sound/core/jack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/core/jack.c b/sound/core/jack.c index dd4a12dc09aa..077a85262c1c 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -47,7 +47,7 @@ static int snd_jack_dev_register(struct snd_device *device) int err; snprintf(jack->name, sizeof(jack->name), "%s %s", - card->longname, jack->id); + card->shortname, jack->id); jack->input_dev->name = jack->name; /* Default to the sound card device. */ -- cgit v1.2.3 From 07eba61dd68678e30b24b4776f59798f625e089d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Feb 2009 08:06:35 +0100 Subject: ALSA: hda - Don't enable beep for digital-only ALC262 When ALC262 codec is configured as digital-only, it's meaningless to add the digital beep input. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 192c92a5af38..91da92259c80 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11051,10 +11051,12 @@ static int patch_alc262(struct hda_codec *codec) } } - err = snd_hda_attach_beep_device(codec, 0x1); - if (err < 0) { - alc_free(codec); - return err; + if (!spec->no_analog) { + err = snd_hda_attach_beep_device(codec, 0x1); + if (err < 0) { + alc_free(codec); + return err; + } } if (board_config != ALC262_AUTO) @@ -11087,7 +11089,8 @@ static int patch_alc262(struct hda_codec *codec) } if (!spec->cap_mixer && !spec->no_analog) set_capture_mixer(spec); - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + if (!spec->no_analog) + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); spec->vmaster_nid = 0x0c; -- cgit v1.2.3 From ab9fec099b796b002b6996c4c5845167d8fe6dbd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Feb 2009 08:13:26 +0100 Subject: ALSA: hda - Avoid doubly beep attachment in patch_alc268() Remove the doubly attachment in patch_alc268(). The input beep is attached conditionally only when needed. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 91da92259c80..df32f9353e71 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -12100,12 +12100,6 @@ static int patch_alc268(struct hda_codec *codec) } } - err = snd_hda_attach_beep_device(codec, 0x1); - if (err < 0) { - alc_free(codec); - return err; - } - if (board_config != ALC268_AUTO) setup_preset(spec, &alc268_presets[board_config]); -- cgit v1.2.3 From 7e0e44d430281d398769f1d7864e161203252760 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Feb 2009 08:15:49 +0100 Subject: ALSA: hda - Add digital-only mode for ALC268 ALC268 can be configured as digital-only, e.g. for HDMI, on some machines. Allow the parser to set up the digital-only mode. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index df32f9353e71..169b3837af52 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11824,9 +11824,14 @@ static int alc268_parse_auto_config(struct hda_codec *codec) alc268_ignore); if (err < 0) return err; - if (!spec->autocfg.line_outs) + if (!spec->autocfg.line_outs) { + if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { + spec->multiout.max_channels = 2; + spec->no_analog = 1; + goto dig_only; + } return 0; /* can't find valid BIOS pin config */ - + } err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); if (err < 0) return err; @@ -11836,10 +11841,12 @@ static int alc268_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = 2; + dig_only: /* digital only support output */ - if (spec->autocfg.dig_outs) + if (spec->autocfg.dig_outs) { spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; - + spec->dig_out_type = spec->autocfg.dig_out_type[0]; + } if (spec->kctls.list) add_mixer(spec, spec->kctls.list); @@ -12140,7 +12147,7 @@ static int patch_alc268(struct hda_codec *codec) (0 << AC_AMPCAP_MUTE_SHIFT)); } - if (!spec->adc_nids && spec->input_mux) { + if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { /* check whether NID 0x07 is valid */ unsigned int wcap = get_wcaps(codec, 0x07); int i; @@ -12764,7 +12771,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - if (!spec->cap_mixer) + if (!spec->cap_mixer && !spec->no_analog) set_capture_mixer(spec); store_pin_configs(codec); -- cgit v1.2.3 From 6ce6c473a7fd742fdb0db95841e2c4c6b37337c5 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 17 Feb 2009 09:50:30 +0100 Subject: sound: virtuoso: revert "do not overwrite EEPROM on Xonar D2/D2X" This reverts commit 7e86c0e6850504ec9516b953f316a47277825e33 ("do not overwrite EEPROM on Xonar D2/D2X") because it did not actually help with the problem. More user reports show that the overwriting of the EEPROM is not triggered by using this driver but by installing Linux, and that the installation of any other operating system (even one without any CMI8788 driver) has the same effect. In other words, the presence of this driver does not have any effect on the occurrence of the error. (So far, the available evidence seems to point to a BIOS bug.) Furthermore, it turns out that the EEPROM chip is protected against stray write commands by the command format and by requiring a separate write-enable command, so the error scenario in the previous commit (that SPI writes can be misinterpreted as an EEPROM write command) is not even theoretically possible. The mixer control that was removed as a consequence of the previous commit can only be partially emulated in userspace, which also means it cannot be seen be the in-kernel OSS API emulation, so it is better to revert that change. Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/pci/oxygen/virtuoso.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 18c7c91786bc..6c870c12a177 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -26,7 +26,7 @@ * SPI 0 -> 1st PCM1796 (front) * SPI 1 -> 2nd PCM1796 (surround) * SPI 2 -> 3rd PCM1796 (center/LFE) - * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!) + * SPI 4 -> 4th PCM1796 (back) * * GPIO 2 -> M0 of CS5381 * GPIO 3 -> M1 of CS5381 @@ -207,12 +207,6 @@ static void xonar_gpio_changed(struct oxygen *chip); static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, u8 reg, u8 value) { - /* - * We don't want to do writes on SPI 4 because the EEPROM, which shares - * the same pin, might get confused and broken. We'd better take care - * that the driver works with the default register values ... - */ -#if 0 /* maps ALSA channel pair number to SPI output */ static const u8 codec_map[4] = { 0, 1, 2, 4 @@ -223,7 +217,6 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | OXYGEN_SPI_CEN_LATCH_CLOCK_HI, (reg << 8) | value); -#endif } static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, @@ -757,9 +750,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); static int xonar_d2_control_filter(struct snd_kcontrol_new *template) { - if (!strncmp(template->name, "Master Playback ", 16)) - /* disable volume/mute because they would require SPI writes */ - return 1; if (!strncmp(template->name, "CD Capture ", 11)) /* CD in is actually connected to the video in pin */ template->private_value ^= AC97_CD ^ AC97_VIDEO; @@ -850,8 +840,9 @@ static const struct oxygen_model model_xonar_d2 = { .dac_volume_min = 0x0f, .dac_volume_max = 0xff, .misc_flags = OXYGEN_MISC_MIDI, - .function_flags = OXYGEN_FUNCTION_SPI, - .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S, + .function_flags = OXYGEN_FUNCTION_SPI | + OXYGEN_FUNCTION_ENABLE_SPI_4_5, + .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, }; -- cgit v1.2.3 From bb71858853a5c9616eea98512f4075d4f081154d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 19 Feb 2009 08:37:13 +0100 Subject: sound: oxygen: make the owner module a parameter of the probe function Move the owner field out of the oxygen_model structure and make it a parameter of oxygen_pci_probe(), because the actual owner module does not depend on the card model. Furthermore, moving it out of the model structure allows us to create the card structure before the actual model is known. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/hifier.c | 3 +-- sound/pci/oxygen/oxygen.c | 3 +-- sound/pci/oxygen/oxygen.h | 2 +- sound/pci/oxygen/oxygen_lib.c | 3 ++- sound/pci/oxygen/virtuoso.c | 5 +---- 5 files changed, 6 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c index 1ab833f843eb..cc98bad9916a 100644 --- a/sound/pci/oxygen/hifier.c +++ b/sound/pci/oxygen/hifier.c @@ -151,7 +151,6 @@ static const struct oxygen_model model_hifier = { .shortname = "C-Media CMI8787", .longname = "C-Media Oxygen HD Audio", .chip = "CMI8788", - .owner = THIS_MODULE, .init = hifier_init, .control_filter = hifier_control_filter, .cleanup = hifier_cleanup, @@ -185,7 +184,7 @@ static int __devinit hifier_probe(struct pci_dev *pci, ++dev; return -ENOENT; } - err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier, 0); + err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, &model_hifier, 0); if (err >= 0) ++dev; return err; diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index de999c6d6dd3..12b6c2137d50 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -315,7 +315,6 @@ static const struct oxygen_model model_generic = { .shortname = "C-Media CMI8788", .longname = "C-Media Oxygen HD Audio", .chip = "CMI8788", - .owner = THIS_MODULE, .probe = generic_probe, .init = generic_init, .cleanup = generic_cleanup, @@ -353,7 +352,7 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci, ++dev; return -ENOENT; } - err = oxygen_pci_probe(pci, index[dev], id[dev], + err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, &model_generic, pci_id->driver_data); if (err >= 0) ++dev; diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 19107c6307e5..268bff4f29d2 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h @@ -62,7 +62,6 @@ struct oxygen_model { const char *shortname; const char *longname; const char *chip; - struct module *owner; int (*probe)(struct oxygen *chip, unsigned long driver_data); void (*init)(struct oxygen *chip); int (*control_filter)(struct snd_kcontrol_new *template); @@ -134,6 +133,7 @@ struct oxygen { /* oxygen_lib.c */ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, + struct module *owner, const struct oxygen_model *model, unsigned long driver_data); void oxygen_pci_remove(struct pci_dev *pci); diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 9c81e0b05113..b5560fa5a5e3 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -452,6 +452,7 @@ static void oxygen_card_free(struct snd_card *card) } int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, + struct module *owner, const struct oxygen_model *model, unsigned long driver_data) { @@ -459,7 +460,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct oxygen *chip; int err; - err = snd_card_create(index, id, model->owner, + err = snd_card_create(index, id, owner, sizeof(*chip) + model->model_data_size, &card); if (err < 0) return err; diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 6c870c12a177..c05f7e7bdb34 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -816,7 +816,6 @@ static int xonar_model_probe(struct oxygen *chip, unsigned long driver_data) static const struct oxygen_model model_xonar_d2 = { .longname = "Asus Virtuoso 200", .chip = "AV200", - .owner = THIS_MODULE, .probe = xonar_model_probe, .init = xonar_d2_init, .control_filter = xonar_d2_control_filter, @@ -849,7 +848,6 @@ static const struct oxygen_model model_xonar_d2 = { static const struct oxygen_model model_xonar_d1 = { .longname = "Asus Virtuoso 100", .chip = "AV200", - .owner = THIS_MODULE, .probe = xonar_model_probe, .init = xonar_d1_init, .control_filter = xonar_d1_control_filter, @@ -878,7 +876,6 @@ static const struct oxygen_model model_xonar_d1 = { static const struct oxygen_model model_xonar_hdav = { .longname = "Asus Virtuoso 200", .chip = "AV200", - .owner = THIS_MODULE, .probe = xonar_model_probe, .init = xonar_hdav_init, .cleanup = xonar_hdav_cleanup, @@ -925,7 +922,7 @@ static int __devinit xonar_probe(struct pci_dev *pci, return -ENOENT; } BUG_ON(pci_id->driver_data >= ARRAY_SIZE(models)); - err = oxygen_pci_probe(pci, index[dev], id[dev], + err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, models[pci_id->driver_data], pci_id->driver_data); if (err >= 0) -- cgit v1.2.3 From 6ed91157093c60e26bf0215b752f07af52935afc Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 19 Feb 2009 08:38:25 +0100 Subject: sound: oxygen: allocate model_data dynamically Allocate the model-specific data dynamically instead of including it in the memory block of the card structure. This will allow us to determine the actual model after the card creation. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen_lib.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index b5560fa5a5e3..228f30800fd9 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -446,6 +446,7 @@ static void oxygen_card_free(struct snd_card *card) free_irq(chip->irq, chip); flush_scheduled_work(); chip->model.cleanup(chip); + kfree(chip->model_data); mutex_destroy(&chip->mutex); pci_release_regions(chip->pci); pci_disable_device(chip->pci); @@ -460,8 +461,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct oxygen *chip; int err; - err = snd_card_create(index, id, owner, - sizeof(*chip) + model->model_data_size, &card); + err = snd_card_create(index, id, owner, sizeof(*chip), &card); if (err < 0) return err; @@ -470,7 +470,6 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, chip->pci = pci; chip->irq = -1; chip->model = *model; - chip->model_data = chip + 1; spin_lock_init(&chip->reg_lock); mutex_init(&chip->mutex); INIT_WORK(&chip->spdif_input_bits_work, @@ -496,6 +495,15 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, } chip->addr = pci_resource_start(pci, 0); + if (chip->model.model_data_size) { + chip->model_data = kmalloc(chip->model.model_data_size, + GFP_KERNEL); + if (!chip->model_data) { + err = -ENOMEM; + goto err_pci_regions; + } + } + pci_set_master(pci); snd_card_set_dev(card, &pci->dev); card->private_free = oxygen_card_free; -- cgit v1.2.3 From a69bb3c3fe0881d986ec78e253cb8a6bb9c28230 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 19 Feb 2009 08:38:55 +0100 Subject: sound: oxygen: use static driver name When allocating resources, use a fixed name instead of reading it from the model structure. This allows us to allocate the resources before the actual model is known. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen_lib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 228f30800fd9..516d94ad2bbb 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -34,6 +34,7 @@ MODULE_AUTHOR("Clemens Ladisch "); MODULE_DESCRIPTION("C-Media CMI8788 helper library"); MODULE_LICENSE("GPL v2"); +#define DRIVER "oxygen" static inline int oxygen_uart_input_ready(struct oxygen *chip) { @@ -481,7 +482,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, if (err < 0) goto err_card; - err = pci_request_regions(pci, model->chip); + err = pci_request_regions(pci, DRIVER); if (err < 0) { snd_printk(KERN_ERR "cannot reserve PCI resources\n"); goto err_pci_enable; @@ -517,7 +518,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, chip->model.init(chip); err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, - chip->model.chip, chip); + DRIVER, chip); if (err < 0) { snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq); goto err_card; -- cgit v1.2.3 From 30459d7b1843cbdea56ca120c8cac10dc5613e90 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 19 Feb 2009 08:42:44 +0100 Subject: sound: oxygen: handle cards with broken EEPROM Under as yet unknown circumstances, the first word of the sound card's EEPROM gets overwritten. When this has happened, we cannot rely on the subsystem IDs that the kernel reads from the PCI configuration registers. Instead, we read the IDs directly from the EEPROM and do the ID matching manually. Because the model-specific driver cannot determine the model before calling oxygen_pci_probe(), that function now gets a get_model() callback as parameter. The customizing of the model structure, which was formerly done by the probe() callback, also has moved into get_model(). Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/hifier.c | 11 +++- sound/pci/oxygen/oxygen.c | 44 +++++++------- sound/pci/oxygen/oxygen.h | 17 +++++- sound/pci/oxygen/oxygen_io.c | 15 +++++ sound/pci/oxygen/oxygen_lib.c | 51 +++++++++++++--- sound/pci/oxygen/virtuoso.c | 134 +++++++++++++++++++++++------------------- 6 files changed, 179 insertions(+), 93 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c index cc98bad9916a..84ef13183419 100644 --- a/sound/pci/oxygen/hifier.c +++ b/sound/pci/oxygen/hifier.c @@ -45,6 +45,7 @@ MODULE_PARM_DESC(enable, "enable card"); static struct pci_device_id hifier_ids[] __devinitdata = { { OXYGEN_PCI_SUBID(0x14c3, 0x1710) }, { OXYGEN_PCI_SUBID(0x14c3, 0x1711) }, + { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, { } }; MODULE_DEVICE_TABLE(pci, hifier_ids); @@ -172,6 +173,13 @@ static const struct oxygen_model model_hifier = { .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, }; +static int __devinit get_hifier_model(struct oxygen *chip, + const struct pci_device_id *id) +{ + chip->model = model_hifier; + return 0; +} + static int __devinit hifier_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -184,7 +192,8 @@ static int __devinit hifier_probe(struct pci_dev *pci, ++dev; return -ENOENT; } - err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, &model_hifier, 0); + err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, + hifier_ids, get_hifier_model); if (err >= 0) ++dev; return err; diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index 12b6c2137d50..f2c37f379d39 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -293,29 +293,10 @@ static void set_ak5385_params(struct oxygen *chip, static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); -static int generic_probe(struct oxygen *chip, unsigned long driver_data) -{ - if (driver_data == MODEL_MERIDIAN) { - chip->model.init = meridian_init; - chip->model.resume = meridian_resume; - chip->model.set_adc_params = set_ak5385_params; - chip->model.device_config = PLAYBACK_0_TO_I2S | - PLAYBACK_1_TO_SPDIF | - CAPTURE_0_FROM_I2S_2 | - CAPTURE_1_FROM_SPDIF; - } - if (driver_data == MODEL_MERIDIAN || driver_data == MODEL_HALO) { - chip->model.misc_flags = OXYGEN_MISC_MIDI; - chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT; - } - return 0; -} - static const struct oxygen_model model_generic = { .shortname = "C-Media CMI8788", .longname = "C-Media Oxygen HD Audio", .chip = "CMI8788", - .probe = generic_probe, .init = generic_init, .cleanup = generic_cleanup, .resume = generic_resume, @@ -340,6 +321,29 @@ static const struct oxygen_model model_generic = { .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, }; +static int __devinit get_oxygen_model(struct oxygen *chip, + const struct pci_device_id *id) +{ + chip->model = model_generic; + switch (id->driver_data) { + case MODEL_MERIDIAN: + chip->model.init = meridian_init; + chip->model.resume = meridian_resume; + chip->model.set_adc_params = set_ak5385_params; + chip->model.device_config = PLAYBACK_0_TO_I2S | + PLAYBACK_1_TO_SPDIF | + CAPTURE_0_FROM_I2S_2 | + CAPTURE_1_FROM_SPDIF; + break; + } + if (id->driver_data == MODEL_MERIDIAN || + id->driver_data == MODEL_HALO) { + chip->model.misc_flags = OXYGEN_MISC_MIDI; + chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT; + } + return 0; +} + static int __devinit generic_oxygen_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -353,7 +357,7 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci, return -ENOENT; } err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, - &model_generic, pci_id->driver_data); + oxygen_ids, get_oxygen_model); if (err >= 0) ++dev; return err; diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 268bff4f29d2..c500d48ea349 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h @@ -49,7 +49,13 @@ enum { .subvendor = sv, \ .subdevice = sd +#define BROKEN_EEPROM_DRIVER_DATA ((unsigned long)-1) +#define OXYGEN_PCI_SUBID_BROKEN_EEPROM \ + OXYGEN_PCI_SUBID(PCI_VENDOR_ID_CMEDIA, 0x8788), \ + .driver_data = BROKEN_EEPROM_DRIVER_DATA + struct pci_dev; +struct pci_device_id; struct snd_card; struct snd_pcm_substream; struct snd_pcm_hardware; @@ -62,7 +68,6 @@ struct oxygen_model { const char *shortname; const char *longname; const char *chip; - int (*probe)(struct oxygen *chip, unsigned long driver_data); void (*init)(struct oxygen *chip); int (*control_filter)(struct snd_kcontrol_new *template); int (*mixer_init)(struct oxygen *chip); @@ -82,6 +87,7 @@ struct oxygen_model { void (*ac97_switch)(struct oxygen *chip, unsigned int reg, unsigned int mute); const unsigned int *dac_tlv; + unsigned long private_data; size_t model_data_size; unsigned int device_config; u8 dac_channels; @@ -134,8 +140,11 @@ struct oxygen { int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct module *owner, - const struct oxygen_model *model, - unsigned long driver_data); + const struct pci_device_id *ids, + int (*get_model)(struct oxygen *chip, + const struct pci_device_id *id + ) + ); void oxygen_pci_remove(struct pci_dev *pci); #ifdef CONFIG_PM int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); @@ -180,6 +189,8 @@ void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data); void oxygen_reset_uart(struct oxygen *chip); void oxygen_write_uart(struct oxygen *chip, u8 data); +u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index); + static inline void oxygen_set_bits8(struct oxygen *chip, unsigned int reg, u8 value) { diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 3126c4b403dd..05f48ef1a442 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c @@ -254,3 +254,18 @@ void oxygen_write_uart(struct oxygen *chip, u8 data) _write_uart(chip, 0, data); } EXPORT_SYMBOL(oxygen_write_uart); + +u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index) +{ + unsigned int timeout; + + oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, + index | OXYGEN_EEPROM_DIR_READ); + for (timeout = 0; timeout < 100; ++timeout) { + udelay(1); + if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) + & OXYGEN_EEPROM_BUSY)) + break; + } + return oxygen_read16(chip, OXYGEN_EEPROM_DATA); +} diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 516d94ad2bbb..d83c3a957323 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -244,6 +244,34 @@ static void oxygen_proc_init(struct oxygen *chip) #define oxygen_proc_init(chip) #endif +static const struct pci_device_id * +oxygen_search_pci_id(struct oxygen *chip, const struct pci_device_id ids[]) +{ + u16 subdevice; + + /* + * Make sure the EEPROM pins are available, i.e., not used for SPI. + * (This function is called before we initialize or use SPI.) + */ + oxygen_clear_bits8(chip, OXYGEN_FUNCTION, + OXYGEN_FUNCTION_ENABLE_SPI_4_5); + /* + * Read the subsystem device ID directly from the EEPROM, because the + * chip didn't if the first EEPROM word was overwritten. + */ + subdevice = oxygen_read_eeprom(chip, 2); + /* + * We use only the subsystem device ID for searching because it is + * unique even without the subsystem vendor ID, which may have been + * overwritten in the EEPROM. + */ + for (; ids->vendor; ++ids) + if (ids->subdevice == subdevice && + ids->driver_data != BROKEN_EEPROM_DRIVER_DATA) + return ids; + return NULL; +} + static void oxygen_init(struct oxygen *chip) { unsigned int i; @@ -455,11 +483,15 @@ static void oxygen_card_free(struct snd_card *card) int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct module *owner, - const struct oxygen_model *model, - unsigned long driver_data) + const struct pci_device_id *ids, + int (*get_model)(struct oxygen *chip, + const struct pci_device_id *id + ) + ) { struct snd_card *card; struct oxygen *chip; + const struct pci_device_id *pci_id; int err; err = snd_card_create(index, id, owner, sizeof(*chip), &card); @@ -470,7 +502,6 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, chip->card = card; chip->pci = pci; chip->irq = -1; - chip->model = *model; spin_lock_init(&chip->reg_lock); mutex_init(&chip->mutex); INIT_WORK(&chip->spdif_input_bits_work, @@ -496,6 +527,15 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, } chip->addr = pci_resource_start(pci, 0); + pci_id = oxygen_search_pci_id(chip, ids); + if (!pci_id) { + err = -ENODEV; + goto err_pci_regions; + } + err = get_model(chip, pci_id); + if (err < 0) + goto err_pci_regions; + if (chip->model.model_data_size) { chip->model_data = kmalloc(chip->model.model_data_size, GFP_KERNEL); @@ -509,11 +549,6 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, snd_card_set_dev(card, &pci->dev); card->private_free = oxygen_card_free; - if (chip->model.probe) { - err = chip->model.probe(chip, driver_data); - if (err < 0) - goto err_card; - } oxygen_init(chip); chip->model.init(chip); diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index c05f7e7bdb34..4ac49772da8c 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -160,6 +160,7 @@ static struct pci_device_id xonar_ids[] __devinitdata = { { OXYGEN_PCI_SUBID(0x1043, 0x82b7), .driver_data = MODEL_D2X }, { OXYGEN_PCI_SUBID(0x1043, 0x8314), .driver_data = MODEL_HDAV }, { OXYGEN_PCI_SUBID(0x1043, 0x834f), .driver_data = MODEL_D1 }, + { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, { } }; MODULE_DEVICE_TABLE(pci, xonar_ids); @@ -188,7 +189,6 @@ MODULE_DEVICE_TABLE(pci, xonar_ids); #define I2C_DEVICE_CS4362A 0x30 /* 001100, AD0=0, /W=0 */ struct xonar_data { - unsigned int model; unsigned int anti_pop_delay; unsigned int dacs; u16 output_enable_bit; @@ -334,15 +334,9 @@ static void xonar_d2_init(struct oxygen *chip) struct xonar_data *data = chip->model_data; data->anti_pop_delay = 300; + data->dacs = 4; data->output_enable_bit = GPIO_D2_OUTPUT_ENABLE; data->pcm1796_oversampling = PCM1796_OS_64; - if (data->model == MODEL_D2X) { - data->ext_power_reg = OXYGEN_GPIO_DATA; - data->ext_power_int_reg = OXYGEN_GPIO_INTERRUPT_MASK; - data->ext_power_bit = GPIO_D2X_EXT_POWER; - oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, - GPIO_D2X_EXT_POWER); - } pcm1796_init(chip); @@ -355,6 +349,18 @@ static void xonar_d2_init(struct oxygen *chip) snd_component_add(chip->card, "CS5381"); } +static void xonar_d2x_init(struct oxygen *chip) +{ + struct xonar_data *data = chip->model_data; + + data->ext_power_reg = OXYGEN_GPIO_DATA; + data->ext_power_int_reg = OXYGEN_GPIO_INTERRUPT_MASK; + data->ext_power_bit = GPIO_D2X_EXT_POWER; + oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_D2X_EXT_POWER); + + xonar_d2_init(chip); +} + static void update_cs4362a_volumes(struct oxygen *chip) { u8 mute; @@ -422,11 +428,6 @@ static void xonar_d1_init(struct oxygen *chip) data->cs4398_fm = CS4398_FM_SINGLE | CS4398_DEM_NONE | CS4398_DIF_LJUST; data->cs4362a_fm = CS4362A_FM_SINGLE | CS4362A_ATAPI_B_R | CS4362A_ATAPI_A_L; - if (data->model == MODEL_DX) { - data->ext_power_reg = OXYGEN_GPI_DATA; - data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; - data->ext_power_bit = GPI_DX_EXT_POWER; - } oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, OXYGEN_2WIRE_LENGTH_8 | @@ -447,6 +448,17 @@ static void xonar_d1_init(struct oxygen *chip) snd_component_add(chip->card, "CS5361"); } +static void xonar_dx_init(struct oxygen *chip) +{ + struct xonar_data *data = chip->model_data; + + data->ext_power_reg = OXYGEN_GPI_DATA; + data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; + data->ext_power_bit = GPI_DX_EXT_POWER; + + xonar_d1_init(chip); +} + static void xonar_hdav_init(struct oxygen *chip) { struct xonar_data *data = chip->model_data; @@ -458,6 +470,7 @@ static void xonar_hdav_init(struct oxygen *chip) OXYGEN_2WIRE_SPEED_FAST); data->anti_pop_delay = 100; + data->dacs = chip->model.private_data == MODEL_HDAV_H6 ? 4 : 1; data->output_enable_bit = GPIO_DX_OUTPUT_ENABLE; data->ext_power_reg = OXYGEN_GPI_DATA; data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; @@ -773,50 +786,9 @@ static int xonar_d1_mixer_init(struct oxygen *chip) return snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip)); } -static int xonar_model_probe(struct oxygen *chip, unsigned long driver_data) -{ - static const char *const names[] = { - [MODEL_D1] = "Xonar D1", - [MODEL_DX] = "Xonar DX", - [MODEL_D2] = "Xonar D2", - [MODEL_D2X] = "Xonar D2X", - [MODEL_HDAV] = "Xonar HDAV1.3", - [MODEL_HDAV_H6] = "Xonar HDAV1.3+H6", - }; - static const u8 dacs[] = { - [MODEL_D1] = 2, - [MODEL_DX] = 2, - [MODEL_D2] = 4, - [MODEL_D2X] = 4, - [MODEL_HDAV] = 1, - [MODEL_HDAV_H6] = 4, - }; - struct xonar_data *data = chip->model_data; - - data->model = driver_data; - if (data->model == MODEL_HDAV) { - oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, - GPIO_HDAV_DB_MASK); - switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & - GPIO_HDAV_DB_MASK) { - case GPIO_HDAV_DB_H6: - data->model = MODEL_HDAV_H6; - break; - case GPIO_HDAV_DB_XX: - snd_printk(KERN_ERR "unknown daughterboard\n"); - return -ENODEV; - } - } - - data->dacs = dacs[data->model]; - chip->model.shortname = names[data->model]; - return 0; -} - static const struct oxygen_model model_xonar_d2 = { .longname = "Asus Virtuoso 200", .chip = "AV200", - .probe = xonar_model_probe, .init = xonar_d2_init, .control_filter = xonar_d2_control_filter, .mixer_init = xonar_d2_mixer_init, @@ -848,7 +820,6 @@ static const struct oxygen_model model_xonar_d2 = { static const struct oxygen_model model_xonar_d1 = { .longname = "Asus Virtuoso 100", .chip = "AV200", - .probe = xonar_model_probe, .init = xonar_d1_init, .control_filter = xonar_d1_control_filter, .mixer_init = xonar_d1_mixer_init, @@ -876,7 +847,6 @@ static const struct oxygen_model model_xonar_d1 = { static const struct oxygen_model model_xonar_hdav = { .longname = "Asus Virtuoso 200", .chip = "AV200", - .probe = xonar_model_probe, .init = xonar_hdav_init, .cleanup = xonar_hdav_cleanup, .suspend = xonar_hdav_suspend, @@ -902,8 +872,8 @@ static const struct oxygen_model model_xonar_hdav = { .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, }; -static int __devinit xonar_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) +static int __devinit get_xonar_model(struct oxygen *chip, + const struct pci_device_id *id) { static const struct oxygen_model *const models[] = { [MODEL_D1] = &model_xonar_d1, @@ -912,6 +882,50 @@ static int __devinit xonar_probe(struct pci_dev *pci, [MODEL_D2X] = &model_xonar_d2, [MODEL_HDAV] = &model_xonar_hdav, }; + static const char *const names[] = { + [MODEL_D1] = "Xonar D1", + [MODEL_DX] = "Xonar DX", + [MODEL_D2] = "Xonar D2", + [MODEL_D2X] = "Xonar D2X", + [MODEL_HDAV] = "Xonar HDAV1.3", + [MODEL_HDAV_H6] = "Xonar HDAV1.3+H6", + }; + unsigned int model = id->driver_data; + + if (model >= ARRAY_SIZE(models) || !models[model]) + return -EINVAL; + chip->model = *models[model]; + + switch (model) { + case MODEL_D2X: + chip->model.init = xonar_d2x_init; + break; + case MODEL_DX: + chip->model.init = xonar_dx_init; + break; + case MODEL_HDAV: + oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, + GPIO_HDAV_DB_MASK); + switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & + GPIO_HDAV_DB_MASK) { + case GPIO_HDAV_DB_H6: + model = MODEL_HDAV_H6; + break; + case GPIO_HDAV_DB_XX: + snd_printk(KERN_ERR "unknown daughterboard\n"); + return -ENODEV; + } + break; + } + + chip->model.shortname = names[model]; + chip->model.private_data = model; + return 0; +} + +static int __devinit xonar_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ static int dev; int err; @@ -921,10 +935,8 @@ static int __devinit xonar_probe(struct pci_dev *pci, ++dev; return -ENOENT; } - BUG_ON(pci_id->driver_data >= ARRAY_SIZE(models)); err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, - models[pci_id->driver_data], - pci_id->driver_data); + xonar_ids, get_xonar_model); if (err >= 0) ++dev; return err; -- cgit v1.2.3 From 1275d6f608abda23d101ada17dc39940192d4bc4 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 19 Feb 2009 08:44:12 +0100 Subject: sound: oxygen: automatically restore overwritten EEPROM If the EEPROM was partially overwritten (which seems to happen before the OS is booted), restore its entire contents by deducing it from the remaining information. This does not have any effect on the Linux driver, which works even with incomplete information in the EEPROM, but it makes other drivers work again. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen.h | 3 +++ sound/pci/oxygen/oxygen_io.c | 16 ++++++++++++++++ sound/pci/oxygen/oxygen_lib.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) (limited to 'sound') diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index c500d48ea349..bd615dbffadb 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h @@ -18,6 +18,8 @@ #define OXYGEN_IO_SIZE 0x100 +#define OXYGEN_EEPROM_ID 0x434d /* "CM" */ + /* model-specific configuration of outputs/inputs */ #define PLAYBACK_0_TO_I2S 0x0001 /* PLAYBACK_0_TO_AC97_0 not implemented */ @@ -190,6 +192,7 @@ void oxygen_reset_uart(struct oxygen *chip); void oxygen_write_uart(struct oxygen *chip, u8 data); u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index); +void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value); static inline void oxygen_set_bits8(struct oxygen *chip, unsigned int reg, u8 value) diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 05f48ef1a442..c1eb923f2ac9 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c @@ -269,3 +269,19 @@ u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index) } return oxygen_read16(chip, OXYGEN_EEPROM_DATA); } + +void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value) +{ + unsigned int timeout; + + oxygen_write16(chip, OXYGEN_EEPROM_DATA, value); + oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, + index | OXYGEN_EEPROM_DIR_WRITE); + for (timeout = 0; timeout < 10; ++timeout) { + msleep(1); + if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) + & OXYGEN_EEPROM_BUSY)) + return; + } + snd_printk(KERN_ERR "EEPROM write timeout\n"); +} diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index d83c3a957323..6e1cdd2fd768 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -272,6 +272,34 @@ oxygen_search_pci_id(struct oxygen *chip, const struct pci_device_id ids[]) return NULL; } +static void oxygen_restore_eeprom(struct oxygen *chip, + const struct pci_device_id *id) +{ + if (oxygen_read_eeprom(chip, 0) != OXYGEN_EEPROM_ID) { + /* + * This function gets called only when a known card model has + * been detected, i.e., we know there is a valid subsystem + * product ID at index 2 in the EEPROM. Therefore, we have + * been able to deduce the correct subsystem vendor ID, and + * this is enough information to restore the original EEPROM + * contents. + */ + oxygen_write_eeprom(chip, 1, id->subvendor); + oxygen_write_eeprom(chip, 0, OXYGEN_EEPROM_ID); + + oxygen_set_bits8(chip, OXYGEN_MISC, + OXYGEN_MISC_WRITE_PCI_SUBID); + pci_write_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, + id->subvendor); + pci_write_config_word(chip->pci, PCI_SUBSYSTEM_ID, + id->subdevice); + oxygen_clear_bits8(chip, OXYGEN_MISC, + OXYGEN_MISC_WRITE_PCI_SUBID); + + snd_printk(KERN_INFO "EEPROM ID restored\n"); + } +} + static void oxygen_init(struct oxygen *chip) { unsigned int i; @@ -532,6 +560,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, err = -ENODEV; goto err_pci_regions; } + oxygen_restore_eeprom(chip, pci_id); err = get_model(chip, pci_id); if (err < 0) goto err_pci_regions; -- cgit v1.2.3 From e32740d9786b8a6c54f6e3d670567d9ef57b3b8c Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Thu, 19 Feb 2009 11:58:37 -0800 Subject: ALSA: pcxhr.h replace signed one-bit bitfields The usage and comments make it clear values of 1/0 were intended rather than -1/0 Noticed by sparse: sound/pci/pcxhr/pcxhr.h:100:20: error: dubious one-bit signed bitfield sound/pci/pcxhr/pcxhr.h:101:22: error: dubious one-bit signed bitfield sound/pci/pcxhr/pcxhr.h:102:24: error: dubious one-bit signed bitfield sound/pci/pcxhr/pcxhr.h:103:21: error: dubious one-bit signed bitfield sound/pci/pcxhr/pcxhr.h:104:25: error: dubious one-bit signed bitfield sound/pci/pcxhr/pcxhr.h:105:20: error: dubious one-bit signed bitfield Signed-off-by: Harvey Harrison Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 84131a916c92..69d87dee6995 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h @@ -97,12 +97,12 @@ struct pcxhr_mgr { int capture_chips; int fw_file_set; int firmware_num; - int is_hr_stereo:1; - int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ - int board_has_analog:1; /* if 0 the board is digital only */ - int board_has_mic:1; /* if 1 the board has microphone input */ - int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ - int mono_capture:1; /* if 1 the board does mono capture */ + unsigned int is_hr_stereo:1; + unsigned int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ + unsigned int board_has_analog:1; /* if 0 the board is digital only */ + unsigned int board_has_mic:1; /* if 1 the board has microphone input */ + unsigned int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ + unsigned int mono_capture:1; /* if 1 the board does mono capture */ struct snd_dma_buffer hostport; -- cgit v1.2.3 From d91b424d6d7bda0773b6b6b606d48d089c4f5115 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 20 Feb 2009 09:31:14 +0100 Subject: sound: oxygen: handle AK5385 ADC on Claro halo cards The HT-Omega Claro halo's ADC is an AK5385 instead of a WM8785, so we should handle the ADC parameters as we do with the X-Meridian. Using the code for the wrong ADC does not seem to have any audible effects, and the Windows driver does it, but it is nonetheless a good idea to run the AK5385 with an oversampling ratio that is not outside the documented limits. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sound') diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index f2c37f379d39..1d8e2b29745d 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -196,6 +196,12 @@ static void meridian_init(struct oxygen *chip) ak5385_init(chip); } +static void halo_init(struct oxygen *chip) +{ + ak4396_init(chip); + ak5385_init(chip); +} + static void generic_cleanup(struct oxygen *chip) { } @@ -211,6 +217,11 @@ static void meridian_resume(struct oxygen *chip) ak4396_registers_init(chip); } +static void halo_resume(struct oxygen *chip) +{ + ak4396_registers_init(chip); +} + static void set_ak4396_params(struct oxygen *chip, struct snd_pcm_hw_params *params) { @@ -335,6 +346,11 @@ static int __devinit get_oxygen_model(struct oxygen *chip, CAPTURE_0_FROM_I2S_2 | CAPTURE_1_FROM_SPDIF; break; + case MODEL_HALO: + chip->model.init = halo_init; + chip->model.resume = halo_resume; + chip->model.set_adc_params = set_ak5385_params; + break; } if (id->driver_data == MODEL_MERIDIAN || id->driver_data == MODEL_HALO) { -- cgit v1.2.3 From eacbb9dba6b4c982a0217ea2c7d15db88d4fda37 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 20 Feb 2009 09:33:40 +0100 Subject: sound: virtuoso: increase minimum volume to -60 dB Use -60 dB as the minimum value of the master volume mixer control. While the DACs would support ranges down to about -120 dB, such attenuations are not useful in practice. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/virtuoso.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 4ac49772da8c..00dc97806f1b 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -758,8 +758,8 @@ static void xonar_line_mic_ac97_switch(struct oxygen *chip, } } -static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -12000, 50, 0); -static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); +static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -6000, 50, 0); +static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -6000, 100, 0); static int xonar_d2_control_filter(struct snd_kcontrol_new *template) { @@ -808,8 +808,8 @@ static const struct oxygen_model model_xonar_d2 = { MIDI_OUTPUT | MIDI_INPUT, .dac_channels = 8, - .dac_volume_min = 0x0f, - .dac_volume_max = 0xff, + .dac_volume_min = 255 - 2*60, + .dac_volume_max = 255, .misc_flags = OXYGEN_MISC_MIDI, .function_flags = OXYGEN_FUNCTION_SPI | OXYGEN_FUNCTION_ENABLE_SPI_4_5, @@ -837,7 +837,7 @@ static const struct oxygen_model model_xonar_d1 = { PLAYBACK_1_TO_SPDIF | CAPTURE_0_FROM_I2S_2, .dac_channels = 8, - .dac_volume_min = 0, + .dac_volume_min = 127 - 60, .dac_volume_max = 127, .function_flags = OXYGEN_FUNCTION_2WIRE, .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, @@ -864,8 +864,8 @@ static const struct oxygen_model model_xonar_hdav = { PLAYBACK_1_TO_SPDIF | CAPTURE_0_FROM_I2S_2, .dac_channels = 8, - .dac_volume_min = 0x0f, - .dac_volume_max = 0xff, + .dac_volume_min = 255 - 2*60, + .dac_volume_max = 255, .misc_flags = OXYGEN_MISC_MIDI, .function_flags = OXYGEN_FUNCTION_2WIRE, .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, -- cgit v1.2.3 From f3990e610a157e9c36af85a75bc66260dff31f40 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 20 Feb 2009 09:32:40 +0100 Subject: sound: usb-audio: remove MIN_PACKS_URB Remove the MIN_PACKS_URB symbol because other limits can force the number of packets down to one, regardless of the value of this symbol, and nobody has ever changed it anyway. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c69cc6e4f549..2b24496ddec7 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -107,7 +107,6 @@ MODULE_PARM_DESC(ignore_ctl_error, #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ #define MAX_URBS 8 #define SYNC_URBS 4 /* always four urbs for sync */ -#define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ #define MAX_QUEUE 24 /* try not to exceed this queue length, in ms */ struct audioformat { @@ -1071,8 +1070,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri subs->packs_per_ms = packs_per_ms; if (is_playback) { - urb_packs = nrpacks; - urb_packs = max(urb_packs, (unsigned int)MIN_PACKS_URB); + urb_packs = max(nrpacks, 1); urb_packs = min(urb_packs, (unsigned int)MAX_PACKS); } else urb_packs = 1; @@ -1093,9 +1091,9 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri total_packs = (total_packs + packs_per_ms - 1) & ~(packs_per_ms - 1); /* we need at least two URBs for queueing */ - if (total_packs < 2 * MIN_PACKS_URB * packs_per_ms) - total_packs = 2 * MIN_PACKS_URB * packs_per_ms; - else { + if (total_packs < 2 * packs_per_ms) { + total_packs = 2 * packs_per_ms; + } else { /* and we don't want too long a queue either */ maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); if (total_packs > maxpacks * packs_per_ms) @@ -1909,7 +1907,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre * in the current code assume the 1ms period. */ snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, - 1000 * MIN_PACKS_URB, + 1000, /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); err = check_hw_params_convention(subs); @@ -3753,7 +3751,7 @@ static int usb_audio_resume(struct usb_interface *intf) static int __init snd_usb_audio_init(void) { - if (nrpacks < MIN_PACKS_URB || nrpacks > MAX_PACKS) { + if (nrpacks < 1 || nrpacks > MAX_PACKS) { printk(KERN_WARNING "invalid nrpacks value.\n"); return -EINVAL; } -- cgit v1.2.3 From 55290e1932102f57ea17e7cff895914c2dbdb4c4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Feb 2009 15:59:01 +0100 Subject: ALSA: hda - Fix parse of init_verbs sysfs entry Fixed the parse of init_verbs hwdep sysfs entry. Simplieied using sscanf. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_hwdep.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 482fb0304ca9..4ae51dcb81af 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -277,18 +277,19 @@ static ssize_t init_verbs_store(struct device *dev, { struct snd_hwdep *hwdep = dev_get_drvdata(dev); struct hda_codec *codec = hwdep->private_data; - char *p; - struct hda_verb verb, *v; + struct hda_verb *v; + int nid, verb, param; - verb.nid = simple_strtoul(buf, &p, 0); - verb.verb = simple_strtoul(p, &p, 0); - verb.param = simple_strtoul(p, &p, 0); - if (!verb.nid || !verb.verb || !verb.param) + if (sscanf(buf, "%i %i %i", &nid, &verb, ¶m) != 3) + return -EINVAL; + if (!nid || !verb) return -EINVAL; v = snd_array_new(&codec->init_verbs); if (!v) return -ENOMEM; - *v = verb; + v->nid = nid; + v->verb = verb; + v->param = param; return count; } -- cgit v1.2.3 From 3be141494a080a9189b51fa78154c975ad8d9806 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Feb 2009 14:11:16 +0100 Subject: ALSA: hda - Add generic pincfg initialization Added the generic pincfg cache and save/restore functions. Also introduced the pin-overriding via hwdep sysfs. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 151 +++++++++++++++++++++++++++++++++++++++++++--- sound/pci/hda/hda_codec.h | 15 +++++ sound/pci/hda/hda_hwdep.c | 66 ++++++++++++++++++++ 3 files changed, 223 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 98884bc8f35f..6fa871f66a72 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -682,11 +682,132 @@ static int read_widget_caps(struct hda_codec *codec, hda_nid_t fg_node) return 0; } +/* read all pin default configurations and save codec->init_pins */ +static int read_pin_defaults(struct hda_codec *codec) +{ + int i; + hda_nid_t nid = codec->start_nid; + + for (i = 0; i < codec->num_nodes; i++, nid++) { + struct hda_pincfg *pin; + unsigned int wcaps = get_wcaps(codec, nid); + unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> + AC_WCAP_TYPE_SHIFT; + if (wid_type != AC_WID_PIN) + continue; + pin = snd_array_new(&codec->init_pins); + if (!pin) + return -ENOMEM; + pin->nid = nid; + pin->cfg = snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_CONFIG_DEFAULT, 0); + } + return 0; +} + +/* look up the given pin config list and return the item matching with NID */ +static struct hda_pincfg *look_up_pincfg(struct hda_codec *codec, + struct snd_array *array, + hda_nid_t nid) +{ + int i; + for (i = 0; i < array->used; i++) { + struct hda_pincfg *pin = snd_array_elem(array, i); + if (pin->nid == nid) + return pin; + } + return NULL; +} + +/* write a config value for the given NID */ +static void set_pincfg(struct hda_codec *codec, hda_nid_t nid, + unsigned int cfg) +{ + int i; + for (i = 0; i < 4; i++) { + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, + cfg & 0xff); + cfg >>= 8; + } +} + +/* set the current pin config value for the given NID. + * the value is cached, and read via snd_hda_codec_get_pincfg() + */ +int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, + hda_nid_t nid, unsigned int cfg) +{ + struct hda_pincfg *pin; + + pin = look_up_pincfg(codec, list, nid); + if (!pin) { + pin = snd_array_new(list); + if (!pin) + return -ENOMEM; + pin->nid = nid; + } + pin->cfg = cfg; + set_pincfg(codec, nid, cfg); + return 0; +} + +int snd_hda_codec_set_pincfg(struct hda_codec *codec, + hda_nid_t nid, unsigned int cfg) +{ + return snd_hda_add_pincfg(codec, &codec->cur_pins, nid, cfg); +} +EXPORT_SYMBOL_HDA(snd_hda_codec_set_pincfg); + +/* get the current pin config value of the given pin NID */ +unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_pincfg *pin; + + pin = look_up_pincfg(codec, &codec->cur_pins, nid); + if (pin) + return pin->cfg; +#ifdef CONFIG_SND_HDA_HWDEP + pin = look_up_pincfg(codec, &codec->override_pins, nid); + if (pin) + return pin->cfg; +#endif + pin = look_up_pincfg(codec, &codec->init_pins, nid); + if (pin) + return pin->cfg; + return 0; +} +EXPORT_SYMBOL_HDA(snd_hda_codec_get_pincfg); + +/* restore all current pin configs */ +static void restore_pincfgs(struct hda_codec *codec) +{ + int i; + for (i = 0; i < codec->init_pins.used; i++) { + struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); + set_pincfg(codec, pin->nid, + snd_hda_codec_get_pincfg(codec, pin->nid)); + } +} static void init_hda_cache(struct hda_cache_rec *cache, unsigned int record_size); static void free_hda_cache(struct hda_cache_rec *cache); +/* restore the initial pin cfgs and release all pincfg lists */ +static void restore_init_pincfgs(struct hda_codec *codec) +{ + /* first free cur_pins and override_pins, then call restore_pincfg + * so that only the values in init_pins are restored + */ + snd_array_free(&codec->cur_pins); +#ifdef CONFIG_SND_HDA_HWDEP + snd_array_free(&codec->override_pins); +#endif + restore_pincfgs(codec); + snd_array_free(&codec->init_pins); +} + /* * codec destructor */ @@ -694,6 +815,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) { if (!codec) return; + restore_init_pincfgs(codec); #ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); flush_workqueue(codec->bus->workq); @@ -751,6 +873,8 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); + snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->cur_pins, sizeof(struct hda_pincfg), 16); if (codec->bus->modelname) { codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); if (!codec->modelname) { @@ -787,15 +911,18 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr setup_fg_nodes(codec); if (!codec->afg && !codec->mfg) { snd_printdd("hda_codec: no AFG or MFG node found\n"); - snd_hda_codec_free(codec); - return -ENODEV; + err = -ENODEV; + goto error; } - if (read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg) < 0) { + err = read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg); + if (err < 0) { snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); - snd_hda_codec_free(codec); - return -ENOMEM; + goto error; } + err = read_pin_defaults(codec); + if (err < 0) + goto error; if (!codec->subsystem_id) { hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; @@ -808,10 +935,8 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr if (do_init) { err = snd_hda_codec_configure(codec); - if (err < 0) { - snd_hda_codec_free(codec); - return err; - } + if (err < 0) + goto error; } snd_hda_codec_proc_new(codec); @@ -824,6 +949,10 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr if (codecp) *codecp = codec; return 0; + + error: + snd_hda_codec_free(codec); + return err; } EXPORT_SYMBOL_HDA(snd_hda_codec_new); @@ -1334,6 +1463,9 @@ void snd_hda_codec_reset(struct hda_codec *codec) free_hda_cache(&codec->cmd_cache); init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); + /* free only cur_pins so that init_pins + override_pins are restored */ + snd_array_free(&codec->cur_pins); + restore_pincfgs(codec); codec->num_pcms = 0; codec->pcm_info = NULL; codec->preset = NULL; @@ -2175,6 +2307,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) hda_set_power_state(codec, codec->afg ? codec->afg : codec->mfg, AC_PWRST_D0); + restore_pincfgs(codec); /* restore all current pin configs */ hda_exec_init_verbs(codec); if (codec->patch_ops.resume) codec->patch_ops.resume(codec); diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 09a332ada0c6..6d01a8058f0a 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -778,11 +778,14 @@ struct hda_codec { unsigned short spdif_ctls; /* SPDIF control bits */ unsigned int spdif_in_enable; /* SPDIF input enable? */ hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ + struct snd_array init_pins; /* initial (BIOS) pin configurations */ + struct snd_array cur_pins; /* current pin configurations */ #ifdef CONFIG_SND_HDA_HWDEP struct snd_hwdep *hwdep; /* assigned hwdep device */ struct snd_array init_verbs; /* additional init verbs */ struct snd_array hints; /* additional hints */ + struct snd_array override_pins; /* default pin configs to override */ #endif /* misc flags */ @@ -855,6 +858,18 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec); #define snd_hda_sequence_write_cache snd_hda_sequence_write #endif +/* the struct for codec->pin_configs */ +struct hda_pincfg { + hda_nid_t nid; + unsigned int cfg; +}; + +unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid); +int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, + unsigned int cfg); +int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, + hda_nid_t nid, unsigned int cfg); /* for hwdep */ + /* * Mixer */ diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 4ae51dcb81af..71039a6dec28 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -109,6 +109,7 @@ static void clear_hwdep_elements(struct hda_codec *codec) for (i = 0; i < codec->hints.used; i++, head++) kfree(*head); snd_array_free(&codec->hints); + snd_array_free(&codec->override_pins); } static void hwdep_free(struct snd_hwdep *hwdep) @@ -141,6 +142,7 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); snd_array_init(&codec->hints, sizeof(char *), 32); + snd_array_init(&codec->override_pins, sizeof(struct hda_pincfg), 16); return 0; } @@ -316,6 +318,67 @@ static ssize_t hints_store(struct device *dev, return count; } +static ssize_t pin_configs_show(struct hda_codec *codec, + struct snd_array *list, + char *buf) +{ + int i, len = 0; + for (i = 0; i < list->used; i++) { + struct hda_pincfg *pin = snd_array_elem(list, i); + len += sprintf(buf + len, "0x%02x 0x%08x\n", + pin->nid, pin->cfg); + } + return len; +} + +static ssize_t init_pin_configs_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct snd_hwdep *hwdep = dev_get_drvdata(dev); + struct hda_codec *codec = hwdep->private_data; + return pin_configs_show(codec, &codec->init_pins, buf); +} + +static ssize_t override_pin_configs_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct snd_hwdep *hwdep = dev_get_drvdata(dev); + struct hda_codec *codec = hwdep->private_data; + return pin_configs_show(codec, &codec->override_pins, buf); +} + +static ssize_t cur_pin_configs_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct snd_hwdep *hwdep = dev_get_drvdata(dev); + struct hda_codec *codec = hwdep->private_data; + return pin_configs_show(codec, &codec->cur_pins, buf); +} + +#define MAX_PIN_CONFIGS 32 + +static ssize_t override_pin_configs_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct snd_hwdep *hwdep = dev_get_drvdata(dev); + struct hda_codec *codec = hwdep->private_data; + int nid, cfg; + int err; + + if (sscanf(buf, "%i %i", &nid, &cfg) != 2) + return -EINVAL; + if (!nid) + return -EINVAL; + err = snd_hda_add_pincfg(codec, &codec->override_pins, nid, cfg); + if (err < 0) + return err; + return count; +} + #define CODEC_ATTR_RW(type) \ __ATTR(type, 0644, type##_show, type##_store) #define CODEC_ATTR_RO(type) \ @@ -333,6 +396,9 @@ static struct device_attribute codec_attrs[] = { CODEC_ATTR_RW(modelname), CODEC_ATTR_WO(init_verbs), CODEC_ATTR_WO(hints), + CODEC_ATTR_RO(init_pin_configs), + CODEC_ATTR_RW(override_pin_configs), + CODEC_ATTR_RO(cur_pin_configs), CODEC_ATTR_WO(reconfig), CODEC_ATTR_WO(clear), }; -- cgit v1.2.3 From 0e8a21b59d48a63f45b3e6d2aca7fb91c5aec882 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Feb 2009 14:13:06 +0100 Subject: ALSA: hda - Remove realtek codec-specific pin save/restore functions Now it's done in the common code. Also use the common access functions for pin defaults. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 78 ++----------------------------------------- 1 file changed, 3 insertions(+), 75 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 169b3837af52..d7f255e3b916 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -329,13 +329,6 @@ struct alc_spec { /* for PLL fix */ hda_nid_t pll_nid; unsigned int pll_coef_idx, pll_coef_bit; - -#ifdef SND_HDA_NEEDS_RESUME -#define ALC_MAX_PINS 16 - unsigned int num_pins; - hda_nid_t pin_nids[ALC_MAX_PINS]; - unsigned int pin_cfgs[ALC_MAX_PINS]; -#endif }; /* @@ -1009,8 +1002,7 @@ static void alc_subsystem_id(struct hda_codec *codec, nid = 0x1d; if (codec->vendor_id == 0x10ec0260) nid = 0x17; - ass = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + ass = snd_hda_codec_get_pincfg(codec, nid); if (!(ass & 1) && !(ass & 0x100000)) return; if ((ass >> 30) != 1) /* no physical connection */ @@ -1184,16 +1176,8 @@ static void alc_fix_pincfg(struct hda_codec *codec, return; cfg = pinfix[quirk->value]; - for (; cfg->nid; cfg++) { - int i; - u32 val = cfg->val; - for (i = 0; i < 4; i++) { - snd_hda_codec_write(codec, cfg->nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, - val & 0xff); - val >>= 8; - } - } + for (; cfg->nid; cfg++) + snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); } /* @@ -3215,61 +3199,13 @@ static void alc_free(struct hda_codec *codec) } #ifdef SND_HDA_NEEDS_RESUME -static void store_pin_configs(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - hda_nid_t nid, end_nid; - - end_nid = codec->start_nid + codec->num_nodes; - for (nid = codec->start_nid; nid < end_nid; nid++) { - unsigned int wid_caps = get_wcaps(codec, nid); - unsigned int wid_type = - (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; - if (wid_type != AC_WID_PIN) - continue; - if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) - break; - spec->pin_nids[spec->num_pins] = nid; - spec->pin_cfgs[spec->num_pins] = - snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); - spec->num_pins++; - } -} - -static void resume_pin_configs(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - int i; - - for (i = 0; i < spec->num_pins; i++) { - hda_nid_t pin_nid = spec->pin_nids[i]; - unsigned int pin_config = spec->pin_cfgs[i]; - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, - pin_config & 0x000000ff); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, - (pin_config & 0x0000ff00) >> 8); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, - (pin_config & 0x00ff0000) >> 16); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, - pin_config >> 24); - } -} - static int alc_resume(struct hda_codec *codec) { - resume_pin_configs(codec); codec->patch_ops.init(codec); snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_cache(codec); return 0; } -#else -#define store_pin_configs(codec) #endif /* @@ -4329,7 +4265,6 @@ static int alc880_parse_auto_config(struct hda_codec *codec) spec->num_mux_defs = 1; spec->input_mux = &spec->private_imux[0]; - store_pin_configs(codec); return 1; } @@ -5693,7 +5628,6 @@ static int alc260_parse_auto_config(struct hda_codec *codec) spec->num_mux_defs = 1; spec->input_mux = &spec->private_imux[0]; - store_pin_configs(codec); return 1; } @@ -10688,7 +10622,6 @@ static int alc262_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - store_pin_configs(codec); return 1; } @@ -11861,7 +11794,6 @@ static int alc268_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - store_pin_configs(codec); return 1; } @@ -12774,7 +12706,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec) if (!spec->cap_mixer && !spec->no_analog) set_capture_mixer(spec); - store_pin_configs(codec); return 1; } @@ -13825,7 +13756,6 @@ static int alc861_parse_auto_config(struct hda_codec *codec) spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); set_capture_mixer(spec); - store_pin_configs(codec); return 1; } @@ -14927,7 +14857,6 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - store_pin_configs(codec); return 1; } @@ -16737,7 +16666,6 @@ static int alc662_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - store_pin_configs(codec); return 1; } -- cgit v1.2.3 From 330ee9957910826a072c2ad5d4045182335f9963 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Feb 2009 14:33:36 +0100 Subject: ALSA: hda - Remove IDT codec-specific pin save/restore functions Removed its own save/restore functions and replaced with the common code. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 255 +++++++++++------------------------------ 1 file changed, 65 insertions(+), 190 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d00a211a813b..da48d8c0b295 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -229,7 +229,6 @@ struct sigmatel_spec { /* pin widgets */ hda_nid_t *pin_nids; unsigned int num_pins; - unsigned int *pin_configs; /* codec specific stuff */ struct hda_verb *init; @@ -2272,101 +2271,19 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { {} /* terminator */ }; -static int stac92xx_save_bios_config_regs(struct hda_codec *codec) +static void stac92xx_set_config_regs(struct hda_codec *codec, + unsigned int *pincfgs) { int i; struct sigmatel_spec *spec = codec->spec; - - kfree(spec->pin_configs); - spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs), - GFP_KERNEL); - if (!spec->pin_configs) - return -ENOMEM; - - for (i = 0; i < spec->num_pins; i++) { - hda_nid_t nid = spec->pin_nids[i]; - unsigned int pin_cfg; - - if (!nid) - continue; - pin_cfg = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0x00); - snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", - nid, pin_cfg); - spec->pin_configs[i] = pin_cfg; - } - - return 0; -} -static void stac92xx_set_config_reg(struct hda_codec *codec, - hda_nid_t pin_nid, unsigned int pin_config) -{ - int i; - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, - pin_config & 0x000000ff); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, - (pin_config & 0x0000ff00) >> 8); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, - (pin_config & 0x00ff0000) >> 16); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, - pin_config >> 24); - i = snd_hda_codec_read(codec, pin_nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, - 0x00); - snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", - pin_nid, i); -} - -static void stac92xx_set_config_regs(struct hda_codec *codec) -{ - int i; - struct sigmatel_spec *spec = codec->spec; - - if (!spec->pin_configs) - return; + if (!pincfgs) + return; for (i = 0; i < spec->num_pins; i++) - if (spec->pin_nids[i] && spec->pin_configs[i]) - stac92xx_set_config_reg(codec, spec->pin_nids[i], - spec->pin_configs[i]); -} - -static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins) -{ - struct sigmatel_spec *spec = codec->spec; - - if (!pins) - return stac92xx_save_bios_config_regs(codec); - - kfree(spec->pin_configs); - spec->pin_configs = kmemdup(pins, - spec->num_pins * sizeof(*pins), - GFP_KERNEL); - if (!spec->pin_configs) - return -ENOMEM; - - stac92xx_set_config_regs(codec); - return 0; -} - -static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid, - unsigned int cfg) -{ - struct sigmatel_spec *spec = codec->spec; - int i; - - for (i = 0; i < spec->num_pins; i++) { - if (spec->pin_nids[i] == nid) { - spec->pin_configs[i] = cfg; - stac92xx_set_config_reg(codec, nid, cfg); - break; - } - } + if (spec->pin_nids[i] && pincfgs[i]) + snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], + pincfgs[i]); } /* @@ -2853,8 +2770,7 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec) mic_pin = AUTO_PIN_MIC; for (;;) { hda_nid_t nid = cfg->input_pins[mic_pin]; - def_conf = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + def_conf = snd_hda_codec_get_pincfg(codec, nid); /* some laptops have an internal analog microphone * which can't be used as a output */ if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { @@ -3426,11 +3342,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, unsigned int wcaps; unsigned int def_conf; - def_conf = snd_hda_codec_read(codec, - spec->dmic_nids[i], - 0, - AC_VERB_GET_CONFIG_DEFAULT, - 0); + def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) continue; @@ -3779,9 +3691,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { hda_nid_t pin = spec->autocfg.line_out_pins[i]; unsigned int defcfg; - defcfg = snd_hda_codec_read(codec, pin, 0, - AC_VERB_GET_CONFIG_DEFAULT, - 0x00); + defcfg = snd_hda_codec_get_pincfg(codec, pin); if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { unsigned int wcaps = get_wcaps(codec, pin); wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); @@ -3885,8 +3795,7 @@ static int stac92xx_add_jack(struct hda_codec *codec, #ifdef CONFIG_SND_JACK struct sigmatel_spec *spec = codec->spec; struct sigmatel_jack *jack; - int def_conf = snd_hda_codec_read(codec, nid, - 0, AC_VERB_GET_CONFIG_DEFAULT, 0); + int def_conf = snd_hda_codec_get_pincfg(codec, nid); int connectivity = get_defcfg_connect(def_conf); char name[32]; @@ -4066,8 +3975,7 @@ static int stac92xx_init(struct hda_codec *codec) pinctl); } } - conf = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + conf = snd_hda_codec_get_pincfg(codec, nid); if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { enable_pin_detect(codec, nid, STAC_INSERT_EVENT); @@ -4108,8 +4016,7 @@ static int stac92xx_init(struct hda_codec *codec) stac_toggle_power_map(codec, nid, 1); continue; } - def_conf = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + def_conf = snd_hda_codec_get_pincfg(codec, nid); def_conf = get_defcfg_connect(def_conf); /* skip any ports that don't have jacks since presence * detection is useless */ @@ -4163,7 +4070,6 @@ static void stac92xx_free(struct hda_codec *codec) if (! spec) return; - kfree(spec->pin_configs); stac92xx_free_jacks(codec); snd_array_free(&spec->events); @@ -4474,7 +4380,6 @@ static int stac92xx_resume(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; - stac92xx_set_config_regs(codec); stac92xx_init(codec); snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_cache(codec); @@ -4523,16 +4428,11 @@ static int patch_stac9200(struct hda_codec *codec) spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, stac9200_models, stac9200_cfg_tbl); - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac9200_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } spec->multiout.max_channels = 2; spec->multiout.num_dacs = 1; @@ -4600,17 +4500,12 @@ static int patch_stac925x(struct hda_codec *codec) stac925x_models, stac925x_cfg_tbl); again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," "using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac925x_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } spec->multiout.max_channels = 2; spec->multiout.num_dacs = 1; @@ -4688,17 +4583,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec) stac92hd73xx_models, stac92hd73xx_cfg_tbl); again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for" " STAC92HD73XX, using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac92hd73xx_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } num_dacs = snd_hda_get_connections(codec, 0x0a, conn, STAC92HD73_DAC_COUNT + 2) - 1; @@ -4758,18 +4648,18 @@ again: spec->init = dell_m6_core_init; switch (spec->board_config) { case STAC_DELL_M6_AMIC: /* Analog Mics */ - stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); + snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); spec->num_dmics = 0; spec->private_dimux.num_items = 1; break; case STAC_DELL_M6_DMIC: /* Digital Mics */ - stac92xx_set_config_reg(codec, 0x13, 0x90A60160); + snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); spec->num_dmics = 1; spec->private_dimux.num_items = 2; break; case STAC_DELL_M6_BOTH: /* Both */ - stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); - stac92xx_set_config_reg(codec, 0x13, 0x90A60160); + snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); + snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); spec->num_dmics = 1; spec->private_dimux.num_items = 2; break; @@ -4865,17 +4755,12 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) stac92hd83xxx_models, stac92hd83xxx_cfg_tbl); again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for" " STAC92HD83XXX, using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac92hd83xxx_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } switch (codec->vendor_id) { case 0x111d7604: @@ -4945,6 +4830,16 @@ static struct hda_input_mux stac92hd71bxx_dmux_amixer = { } }; +/* get the pin connection (fixed, none, etc) */ +static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) +{ + struct sigmatel_spec *spec = codec->spec; + unsigned int cfg; + + cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); + return get_defcfg_connect(cfg); +} + static int stac92hd71bxx_connected_ports(struct hda_codec *codec, hda_nid_t *nids, int num_nids) { @@ -4958,7 +4853,7 @@ static int stac92hd71bxx_connected_ports(struct hda_codec *codec, break; if (idx >= spec->num_pins) break; - def_conf = get_defcfg_connect(spec->pin_configs[idx]); + def_conf = stac_get_defcfg_connect(codec, idx); if (def_conf == AC_JACK_PORT_NONE) break; } @@ -4978,13 +4873,13 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, return 0; /* dig1pin case */ - if (get_defcfg_connect(spec->pin_configs[idx+1]) != AC_JACK_PORT_NONE) + if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE) return 2; /* dig0pin + dig2pin case */ - if (get_defcfg_connect(spec->pin_configs[idx+2]) != AC_JACK_PORT_NONE) + if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE) return 2; - if (get_defcfg_connect(spec->pin_configs[idx]) != AC_JACK_PORT_NONE) + if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) return 1; else return 0; @@ -5023,17 +4918,12 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) stac92hd71bxx_models, stac92hd71bxx_cfg_tbl); again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for" " STAC92HD71BXX, using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac92hd71bxx_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } if (spec->board_config > STAC_92HD71BXX_REF) { /* GPIO0 = EAPD */ @@ -5097,8 +4987,8 @@ again: /* disable VSW */ spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; unmute_init++; - stac_change_pin_config(codec, 0x0f, 0x40f000f0); - stac_change_pin_config(codec, 0x19, 0x40f000f3); + snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); + snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; spec->num_dmics = stac92hd71bxx_connected_ports(codec, stac92hd71bxx_dmic_nids, @@ -5147,7 +5037,7 @@ again: switch (spec->board_config) { case STAC_HP_M4: /* enable internal microphone */ - stac_change_pin_config(codec, 0x0e, 0x01813040); + snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); stac92xx_auto_set_pinctl(codec, 0x0e, AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); /* fallthru */ @@ -5163,7 +5053,7 @@ again: spec->num_dmuxes = 0; break; case STAC_HP_DV5: - stac_change_pin_config(codec, 0x0d, 0x90170010); + snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); break; }; @@ -5247,17 +5137,12 @@ static int patch_stac922x(struct hda_codec *codec) } again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " "using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac922x_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } spec->adc_nids = stac922x_adc_nids; spec->mux_nids = stac922x_mux_nids; @@ -5315,17 +5200,12 @@ static int patch_stac927x(struct hda_codec *codec) stac927x_models, stac927x_cfg_tbl); again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for" "STAC927x, using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac927x_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } spec->digbeep_nid = 0x23; spec->adc_nids = stac927x_adc_nids; @@ -5354,15 +5234,15 @@ static int patch_stac927x(struct hda_codec *codec) case 0x10280209: case 0x1028022e: /* correct the device field to SPDIF out */ - stac_change_pin_config(codec, 0x21, 0x01442070); + snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); break; }; /* configure the analog microphone on some laptops */ - stac_change_pin_config(codec, 0x0c, 0x90a79130); + snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); /* correct the front output jack as a hp out */ - stac_change_pin_config(codec, 0x0f, 0x0227011f); + snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); /* correct the front input jack as a mic */ - stac_change_pin_config(codec, 0x0e, 0x02a79130); + snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); /* fallthru */ case STAC_DELL_3ST: /* GPIO2 High = Enable EAPD */ @@ -5447,16 +5327,11 @@ static int patch_stac9205(struct hda_codec *codec) stac9205_models, stac9205_cfg_tbl); again: - if (spec->board_config < 0) { + if (spec->board_config < 0) snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); - err = stac92xx_save_bios_config_regs(codec); - } else - err = stac_save_pin_cfgs(codec, + else + stac92xx_set_config_regs(codec, stac9205_brd_tbl[spec->board_config]); - if (err < 0) { - stac92xx_free(codec); - return err; - } spec->digbeep_nid = 0x23; spec->adc_nids = stac9205_adc_nids; @@ -5484,8 +5359,8 @@ static int patch_stac9205(struct hda_codec *codec) switch (spec->board_config){ case STAC_9205_DELL_M43: /* Enable SPDIF in/out */ - stac_change_pin_config(codec, 0x1f, 0x01441030); - stac_change_pin_config(codec, 0x20, 0x1c410030); + snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); + snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); /* Enable unsol response for GPIO4/Dock HP connection */ err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); -- cgit v1.2.3 From 2f334f92cfb44d17b9f24a43f8998cca03f9a3dd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Feb 2009 14:37:42 +0100 Subject: ALSA: hda - Remove codec-specific pin save/restore functions Replace the accessor to pin defaults with the common code for caching. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 3 +-- sound/pci/hda/patch_cmedia.c | 12 ++++++------ sound/pci/hda/patch_via.c | 7 ++----- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2c58d7b05aba..53d0edaf04c7 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -1047,8 +1047,7 @@ static struct hda_amp_list ad1986a_loopbacks[] = { static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) { - unsigned int conf = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + unsigned int conf = snd_hda_codec_get_pincfg(codec, nid); return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; } diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index f3ebe837f2d5..c921264bbd71 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c @@ -680,13 +680,13 @@ static int patch_cmi9880(struct hda_codec *codec) struct auto_pin_cfg cfg; /* collect pin default configuration */ - port_e = snd_hda_codec_read(codec, 0x0f, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); - port_f = snd_hda_codec_read(codec, 0x10, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); + port_e = snd_hda_codec_get_pincfg(codec, 0x0f); + port_f = snd_hda_codec_get_pincfg(codec, 0x10); spec->front_panel = 1; if (get_defcfg_connect(port_e) == AC_JACK_PORT_NONE || get_defcfg_connect(port_f) == AC_JACK_PORT_NONE) { - port_g = snd_hda_codec_read(codec, 0x1f, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); - port_h = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); + port_g = snd_hda_codec_get_pincfg(codec, 0x1f); + port_h = snd_hda_codec_get_pincfg(codec, 0x20); spec->channel_modes = cmi9880_channel_modes; /* no front panel */ if (get_defcfg_connect(port_g) == AC_JACK_PORT_NONE || @@ -703,8 +703,8 @@ static int patch_cmi9880(struct hda_codec *codec) spec->multiout.max_channels = cmi9880_channel_modes[0].channels; } else { spec->input_mux = &cmi9880_basic_mux; - port_spdifi = snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); - port_spdifo = snd_hda_codec_read(codec, 0x12, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); + port_spdifi = snd_hda_codec_get_pincfg(codec, 0x13); + port_spdifo = snd_hda_codec_get_pincfg(codec, 0x12); if (get_defcfg_connect(port_spdifo) != AC_JACK_PORT_NONE) spec->multiout.dig_out_nid = CMI_DIG_OUT_NID; if (get_defcfg_connect(port_spdifi) != AC_JACK_PORT_NONE) diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 639b2ff510a6..b25a5cc637d6 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1308,16 +1308,13 @@ static void vt1708_set_pinconfig_connect(struct hda_codec *codec, hda_nid_t nid) unsigned int def_conf; unsigned char seqassoc; - def_conf = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + def_conf = snd_hda_codec_get_pincfg(codec, nid); seqassoc = (unsigned char) get_defcfg_association(def_conf); seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf); if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) { if (seqassoc == 0xff) { def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30)); - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, - def_conf >> 24); + snd_hda_codec_set_pincfg(codec, nid, def_conf); } } -- cgit v1.2.3 From 3d92e8f3ae9ba21cac30370eb254ed9dc20df043 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 22 Feb 2009 09:38:47 +0100 Subject: m68k: atari - Rename "mfp" to "st_mfp" http://kisskb.ellerman.id.au/kisskb/buildresult/72115/: | net/mac80211/ieee80211_i.h:327: error: syntax error before 'volatile' | net/mac80211/ieee80211_i.h:350: error: syntax error before '}' token | net/mac80211/ieee80211_i.h:455: error: field 'sta' has incomplete type | distcc[19430] ERROR: compile net/mac80211/main.c on sprygo/32 failed This is caused by | # define mfp ((*(volatile struct MFP*)MFP_BAS)) in arch/m68k/include/asm/atarihw.h, which conflicts with the new "mfp" enum in net/mac80211/ieee80211_i.h. Rename "mfp" to "st_mfp", as it's a way too generic name for a global #define. Signed-off-by: Geert Uytterhoeven Signed-off-by: Linus Torvalds --- arch/m68k/atari/ataints.c | 16 ++++++++-------- arch/m68k/atari/atakeyb.c | 4 ++-- arch/m68k/atari/config.c | 2 +- arch/m68k/atari/debug.c | 22 +++++++++++----------- arch/m68k/atari/time.c | 8 ++++---- arch/m68k/include/asm/atarihw.h | 4 ++-- arch/m68k/include/asm/atariints.h | 6 +++--- drivers/block/ataflop.c | 4 ++-- drivers/char/scc.h | 2 +- drivers/parport/parport_atari.c | 6 +++--- drivers/video/atafb.c | 22 +++++++++++----------- sound/oss/dmasound/dmasound_atari.c | 16 ++++++++-------- 12 files changed, 56 insertions(+), 56 deletions(-) (limited to 'sound') diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index dba4afabb444..39478dd08e67 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c @@ -187,8 +187,8 @@ __asm__ (__ALIGN_STR "\n" \ " jbra ret_from_interrupt\n" \ : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]), \ "n" (PT_OFF_SR), "n" (n), \ - "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &mfp.int_mk_a) \ - : (n & 16 ? &tt_mfp.int_mk_b : &mfp.int_mk_b)), \ + "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &st_mfp.int_mk_a) \ + : (n & 16 ? &tt_mfp.int_mk_b : &st_mfp.int_mk_b)), \ "m" (preempt_count()), "di" (HARDIRQ_OFFSET) \ ); \ for (;;); /* fake noreturn */ \ @@ -366,14 +366,14 @@ void __init atari_init_IRQ(void) /* Initialize the MFP(s) */ #ifdef ATARI_USE_SOFTWARE_EOI - mfp.vec_adr = 0x48; /* Software EOI-Mode */ + st_mfp.vec_adr = 0x48; /* Software EOI-Mode */ #else - mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ + st_mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ #endif - mfp.int_en_a = 0x00; /* turn off MFP-Ints */ - mfp.int_en_b = 0x00; - mfp.int_mk_a = 0xff; /* no Masking */ - mfp.int_mk_b = 0xff; + st_mfp.int_en_a = 0x00; /* turn off MFP-Ints */ + st_mfp.int_en_b = 0x00; + st_mfp.int_mk_a = 0xff; /* no Masking */ + st_mfp.int_mk_b = 0xff; if (ATARIHW_PRESENT(TT_MFP)) { #ifdef ATARI_USE_SOFTWARE_EOI diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c index a5f33c059979..4add96d13b19 100644 --- a/arch/m68k/atari/atakeyb.c +++ b/arch/m68k/atari/atakeyb.c @@ -609,10 +609,10 @@ int atari_keyb_init(void) ACIA_RHTID : 0); /* make sure the interrupt line is up */ - } while ((mfp.par_dt_reg & 0x10) == 0); + } while ((st_mfp.par_dt_reg & 0x10) == 0); /* enable ACIA Interrupts */ - mfp.active_edge &= ~0x10; + st_mfp.active_edge &= ~0x10; atari_turnon_irq(IRQ_MFP_ACIA); ikbd_self_test = 1; diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index 49c28cdbea5c..ae2d96e5d618 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -258,7 +258,7 @@ void __init config_atari(void) printk("STND_SHIFTER "); } } - if (hwreg_present(&mfp.par_dt_reg)) { + if (hwreg_present(&st_mfp.par_dt_reg)) { ATARIHW_SET(ST_MFP); printk("ST_MFP "); } diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c index 702b15ccfab7..28efdc33c1ae 100644 --- a/arch/m68k/atari/debug.c +++ b/arch/m68k/atari/debug.c @@ -34,9 +34,9 @@ static struct console atari_console_driver = { static inline void ata_mfp_out(char c) { - while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ + while (!(st_mfp.trn_stat & 0x80)) /* wait for tx buf empty */ barrier(); - mfp.usart_dta = c; + st_mfp.usart_dta = c; } static void atari_mfp_console_write(struct console *co, const char *str, @@ -91,7 +91,7 @@ static int ata_par_out(char c) /* This a some-seconds timeout in case no printer is connected */ unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; - while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */ + while ((st_mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */ ; if (!i) return 0; @@ -131,9 +131,9 @@ static void atari_par_console_write(struct console *co, const char *str, #if 0 int atari_mfp_console_wait_key(struct console *co) { - while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ + while (!(st_mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ barrier(); - return mfp.usart_dta; + return st_mfp.usart_dta; } int atari_scc_console_wait_key(struct console *co) @@ -175,12 +175,12 @@ static void __init atari_init_mfp_port(int cflag) baud = B9600; /* use default 9600bps for non-implemented rates */ baud -= B1200; /* baud_table[] starts at 1200bps */ - mfp.trn_stat &= ~0x01; /* disable TX */ - mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ - mfp.tim_ct_cd &= 0x70; /* stop timer D */ - mfp.tim_dt_d = baud_table[baud]; - mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ - mfp.trn_stat |= 0x01; /* enable TX */ + st_mfp.trn_stat &= ~0x01; /* disable TX */ + st_mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ + st_mfp.tim_ct_cd &= 0x70; /* stop timer D */ + st_mfp.tim_dt_d = baud_table[baud]; + st_mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ + st_mfp.trn_stat |= 0x01; /* enable TX */ } #define SCC_WRITE(reg, val) \ diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c index d076ff8d1b39..a0531f34c617 100644 --- a/arch/m68k/atari/time.c +++ b/arch/m68k/atari/time.c @@ -27,9 +27,9 @@ void __init atari_sched_init(irq_handler_t timer_routine) { /* set Timer C data Register */ - mfp.tim_dt_c = INT_TICKS; + st_mfp.tim_dt_c = INT_TICKS; /* start timer C, div = 1:100 */ - mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60; + st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 15) | 0x60; /* install interrupt service routine for MFP Timer C */ if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW, "timer", timer_routine)) @@ -46,11 +46,11 @@ unsigned long atari_gettimeoffset (void) unsigned long ticks, offset = 0; /* read MFP timer C current value */ - ticks = mfp.tim_dt_c; + ticks = st_mfp.tim_dt_c; /* The probability of underflow is less than 2% */ if (ticks > INT_TICKS - INT_TICKS / 50) /* Check for pending timer interrupt */ - if (mfp.int_pn_b & (1 << 5)) + if (st_mfp.int_pn_b & (1 << 5)) offset = TICK_SIZE; ticks = INT_TICKS - ticks; diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h index 1412b4ab202f..a714e1aa072a 100644 --- a/arch/m68k/include/asm/atarihw.h +++ b/arch/m68k/include/asm/atarihw.h @@ -113,7 +113,7 @@ extern struct atari_hw_present atari_hw_present; * of nops on various machines. Somebody claimed that the tstb takes 600 ns. */ #define MFPDELAY() \ - __asm__ __volatile__ ( "tstb %0" : : "m" (mfp.par_dt_reg) : "cc" ); + __asm__ __volatile__ ( "tstb %0" : : "m" (st_mfp.par_dt_reg) : "cc" ); /* Do cache push/invalidate for DMA read/write. This function obeys the * snooping on some machines (Medusa) and processors: The Medusa itself can @@ -565,7 +565,7 @@ struct MFP u_char char_dummy23; u_char usart_dta; }; -# define mfp ((*(volatile struct MFP*)MFP_BAS)) +# define st_mfp ((*(volatile struct MFP*)MFP_BAS)) /* TT's second MFP */ diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h index 5748e99f4e26..f597892e43a0 100644 --- a/arch/m68k/include/asm/atariints.h +++ b/arch/m68k/include/asm/atariints.h @@ -113,7 +113,7 @@ static inline int get_mfp_bit( unsigned irq, int type ) { unsigned char mask, *reg; mask = 1 << (irq & 7); - reg = (unsigned char *)&mfp.int_en_a + type*4 + + reg = (unsigned char *)&st_mfp.int_en_a + type*4 + ((irq & 8) >> 2) + (((irq-8) & 16) << 3); return( *reg & mask ); } @@ -123,7 +123,7 @@ static inline void set_mfp_bit( unsigned irq, int type ) { unsigned char mask, *reg; mask = 1 << (irq & 7); - reg = (unsigned char *)&mfp.int_en_a + type*4 + + reg = (unsigned char *)&st_mfp.int_en_a + type*4 + ((irq & 8) >> 2) + (((irq-8) & 16) << 3); __asm__ __volatile__ ( "orb %0,%1" : : "di" (mask), "m" (*reg) : "memory" ); @@ -134,7 +134,7 @@ static inline void clear_mfp_bit( unsigned irq, int type ) { unsigned char mask, *reg; mask = ~(1 << (irq & 7)); - reg = (unsigned char *)&mfp.int_en_a + type*4 + + reg = (unsigned char *)&st_mfp.int_en_a + type*4 + ((irq & 8) >> 2) + (((irq-8) & 16) << 3); if (type == MFP_PENDING || type == MFP_SERVICE) __asm__ __volatile__ ( "moveb %0,%1" diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 69e1df7dfa14..4234c11c1e4c 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -1730,7 +1730,7 @@ static int __init fd_test_drive_present( int drive ) timeout = jiffies + 2*HZ+HZ/2; while (time_before(jiffies, timeout)) - if (!(mfp.par_dt_reg & 0x20)) + if (!(st_mfp.par_dt_reg & 0x20)) break; status = FDC_READ( FDCREG_STATUS ); @@ -1747,7 +1747,7 @@ static int __init fd_test_drive_present( int drive ) /* dummy seek command to make WP bit accessible */ FDC_WRITE( FDCREG_DATA, 0 ); FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK ); - while( mfp.par_dt_reg & 0x20 ) + while( st_mfp.par_dt_reg & 0x20 ) ; status = FDC_READ( FDCREG_STATUS ); } diff --git a/drivers/char/scc.h b/drivers/char/scc.h index 93998f5baff5..341b1142bea8 100644 --- a/drivers/char/scc.h +++ b/drivers/char/scc.h @@ -387,7 +387,7 @@ struct scc_port { /* The SCC needs 3.5 PCLK cycles recovery time between to register * accesses. PCLK runs with 8 MHz on an Atari, so this delay is 3.5 * * 125 ns = 437.5 ns. This is too short for udelay(). - * 10/16/95: A tstb mfp.par_dt_reg takes 600ns (sure?) and thus should be + * 10/16/95: A tstb st_mfp.par_dt_reg takes 600ns (sure?) and thus should be * quite right */ diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c index ad4cdd256137..0b28fccec03f 100644 --- a/drivers/parport/parport_atari.c +++ b/drivers/parport/parport_atari.c @@ -84,7 +84,7 @@ parport_atari_frob_control(struct parport *p, unsigned char mask, static unsigned char parport_atari_read_status(struct parport *p) { - return ((mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) | + return ((st_mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) | PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR); } @@ -193,9 +193,9 @@ static int __init parport_atari_init(void) sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5); local_irq_restore(flags); /* MFP port I0 as input. */ - mfp.data_dir &= ~1; + st_mfp.data_dir &= ~1; /* MFP port I0 interrupt on high->low edge. */ - mfp.active_edge &= ~1; + st_mfp.active_edge &= ~1; p = parport_register_port((unsigned long)&sound_ym.wd_data, IRQ_MFP_BUSY, PARPORT_DMA_NONE, &parport_atari_ops); diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 8058572a7428..018850c116c6 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c @@ -841,7 +841,7 @@ static int tt_detect(void) tt_dmasnd.ctrl = DMASND_CTRL_OFF; udelay(20); /* wait a while for things to settle down */ } - mono_moni = (mfp.par_dt_reg & 0x80) == 0; + mono_moni = (st_mfp.par_dt_reg & 0x80) == 0; tt_get_par(&par); tt_encode_var(&atafb_predefined[0], &par); @@ -2035,7 +2035,7 @@ static int stste_detect(void) tt_dmasnd.ctrl = DMASND_CTRL_OFF; udelay(20); /* wait a while for things to settle down */ } - mono_moni = (mfp.par_dt_reg & 0x80) == 0; + mono_moni = (st_mfp.par_dt_reg & 0x80) == 0; stste_get_par(&par); stste_encode_var(&atafb_predefined[0], &par); @@ -2086,20 +2086,20 @@ static void st_ovsc_switch(void) return; local_irq_save(flags); - mfp.tim_ct_b = 0x10; - mfp.active_edge |= 8; - mfp.tim_ct_b = 0; - mfp.tim_dt_b = 0xf0; - mfp.tim_ct_b = 8; - while (mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */ + st_mfp.tim_ct_b = 0x10; + st_mfp.active_edge |= 8; + st_mfp.tim_ct_b = 0; + st_mfp.tim_dt_b = 0xf0; + st_mfp.tim_ct_b = 8; + while (st_mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */ ; - new = mfp.tim_dt_b; + new = st_mfp.tim_dt_b; do { udelay(LINE_DELAY); old = new; - new = mfp.tim_dt_b; + new = st_mfp.tim_dt_b; } while (old != new); - mfp.tim_ct_b = 0x10; + st_mfp.tim_ct_b = 0x10; udelay(SYNC_DELAY); if (atari_switches & ATARI_SWITCH_OVSC_IKBD) diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 57d9f154c88b..38931f2f6967 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c @@ -847,23 +847,23 @@ static int __init AtaIrqInit(void) of events. So all we need to keep the music playing is to provide the sound hardware with new data upon an interrupt from timer A. */ - mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ - mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ - mfp.tim_ct_a = 8; /* Turn on event counting. */ + st_mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ + st_mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ + st_mfp.tim_ct_a = 8; /* Turn on event counting. */ /* Register interrupt handler. */ if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", AtaInterrupt)) return 0; - mfp.int_en_a |= 0x20; /* Turn interrupt on. */ - mfp.int_mk_a |= 0x20; + st_mfp.int_en_a |= 0x20; /* Turn interrupt on. */ + st_mfp.int_mk_a |= 0x20; return 1; } #ifdef MODULE static void AtaIrqCleanUp(void) { - mfp.tim_ct_a = 0; /* stop timer */ - mfp.int_en_a &= ~0x20; /* turn interrupt off */ + st_mfp.tim_ct_a = 0; /* stop timer */ + st_mfp.int_en_a &= ~0x20; /* turn interrupt off */ free_irq(IRQ_MFP_TIMA, AtaInterrupt); } #endif /* MODULE */ @@ -1599,7 +1599,7 @@ static int __init dmasound_atari_init(void) is_falcon = 0; } else return -ENODEV; - if ((mfp.int_en_a & mfp.int_mk_a & 0x20) == 0) + if ((st_mfp.int_en_a & st_mfp.int_mk_a & 0x20) == 0) return dmasound_init(); else { printk("DMA sound driver: Timer A interrupt already in use\n"); -- cgit v1.2.3 From cc95948972576c3efa43c9ed05b4a265805a4c54 Mon Sep 17 00:00:00 2001 From: Michael Schwingen Date: Sun, 22 Feb 2009 18:58:45 +0100 Subject: ALSA: hda - add support for "Maxdata Favorit 100XS" (Intel HDA/ALC260) Signed-off-by: Michael Schwingen Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 130 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 169b3837af52..abddabc1efa8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -78,6 +78,7 @@ enum { ALC260_ACER, ALC260_WILL, ALC260_REPLACER_672V, + ALC260_FAVORIT100, #ifdef CONFIG_SND_DEBUG ALC260_TEST, #endif @@ -4537,6 +4538,26 @@ static struct hda_input_mux alc260_acer_capture_sources[2] = { }, }, }; + +/* Maxdata Favorit 100XS */ +static struct hda_input_mux alc260_favorit100_capture_sources[2] = { + { + .num_items = 2, + .items = { + { "Line/Mic", 0x0 }, + { "CD", 0x4 }, + }, + }, + { + .num_items = 3, + .items = { + { "Line/Mic", 0x0 }, + { "CD", 0x4 }, + { "Mixer", 0x5 }, + }, + }, +}; + /* * This is just place-holder, so there's something for alc_build_pcms to look * at when it calculates the maximum number of channels. ALC260 has no mixer @@ -4817,6 +4838,18 @@ static struct snd_kcontrol_new alc260_acer_mixer[] = { { } /* end */ }; +/* Maxdata Favorit 100XS: one output and one input (0x12) jack + */ +static struct snd_kcontrol_new alc260_favorit100_mixer[] = { + HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), + ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), + HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), + ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), + { } /* end */ +}; + /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. */ @@ -5188,6 +5221,89 @@ static struct hda_verb alc260_acer_init_verbs[] = { { } }; +/* Initialisation sequence for Maxdata Favorit 100XS + * (adapted from Acer init verbs). + */ +static struct hda_verb alc260_favorit100_init_verbs[] = { + /* GPIO 0 enables the output jack. + * Turn this on and rely on the standard mute + * methods whenever the user wants to turn these outputs off. + */ + {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, + {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, + {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, + /* Line/Mic input jack is connected to Mic1 pin */ + {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, + /* Ensure all other unused pins are disabled and muted. */ + {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + /* Disable digital (SPDIF) pins */ + {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, + {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, + + /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum + * bus when acting as outputs. + */ + {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, + {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, + + /* Start with output sum widgets muted and their output gains at min */ + {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + + /* Unmute Line-out pin widget amp left and right + * (no equiv mixer ctrl) + */ + {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + /* Unmute Mic1 and Line1 pin widget input buffers since they start as + * inputs. If the pin mode is changed by the user the pin mode control + * will take care of enabling the pin's input/output buffers as needed. + * Therefore there's no need to enable the input buffer at this + * stage. + */ + {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + + /* Mute capture amp left and right */ + {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + /* Set ADC connection select to match default mixer setting - mic + * (on mic1 pin) + */ + {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, + + /* Do similar with the second ADC: mute capture input amp and + * set ADC connection to mic to match ALSA's default state. + */ + {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, + + /* Mute all inputs to mixer widget (even unconnected ones) */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ + + { } +}; + static struct hda_verb alc260_will_verbs[] = { {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, @@ -5730,6 +5846,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { [ALC260_ACER] = "acer", [ALC260_WILL] = "will", [ALC260_REPLACER_672V] = "replacer", + [ALC260_FAVORIT100] = "favorit100", #ifdef CONFIG_SND_DEBUG [ALC260_TEST] = "test", #endif @@ -5739,6 +5856,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { static struct snd_pci_quirk alc260_cfg_tbl[] = { SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), + SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), @@ -5840,6 +5958,18 @@ static struct alc_config_preset alc260_presets[] = { .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), .input_mux = alc260_acer_capture_sources, }, + [ALC260_FAVORIT100] = { + .mixers = { alc260_favorit100_mixer }, + .init_verbs = { alc260_favorit100_init_verbs }, + .num_dacs = ARRAY_SIZE(alc260_dac_nids), + .dac_nids = alc260_dac_nids, + .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), + .adc_nids = alc260_dual_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc260_modes), + .channel_mode = alc260_modes, + .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), + .input_mux = alc260_favorit100_capture_sources, + }, [ALC260_WILL] = { .mixers = { alc260_will_mixer }, .init_verbs = { alc260_init_verbs, alc260_will_verbs }, -- cgit v1.2.3 From e8bf069c419c1dc0657e02636441fe1179a9db14 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sun, 22 Feb 2009 14:42:54 +0200 Subject: ALSA: aw2: do not grab every saa7146 based device Audiowerk2 driver snd-aw2 is bound to any saa7146 device as it does not check subsystem ids. Many DVB devices are saa7146 based, so aw2 driver grabs them as well. According to http://lkml.org/lkml/2008/10/15/311 aw2 devices have the subsystem ids set to 0, the saa7146 default. Fix conflicts with DVB devices by checking for subsystem ids = 0 specifically. Signed-off-by: Anssi Hannula Signed-off-by: Takashi Iwai --- sound/pci/aw2/aw2-alsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 3f00ddf450f8..c7c54e7748e9 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -165,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); static struct pci_device_id snd_aw2_ids[] = { - {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID, + {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0, 0, 0, 0}, {0} }; -- cgit v1.2.3 From ce71bfd1aa6d6a4069929eeceed254e13400ddf4 Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Sun, 22 Feb 2009 20:33:41 +0100 Subject: ALSA: ALS4000, slight mixer improvements - add 8kHz / 20 kHz low-pass filter switch control - add ALS4000 Mono capture route control - add annotations to specs pages - improve ALS4000 PM saved regs selection (remove SB dummy register, add missing ones) - add some missing ALS4000 register defines - constify two variables Signed-off-by: Andreas Mohr Signed-off-by: Takashi Iwai --- include/sound/sb.h | 4 +- sound/isa/sb/sb_mixer.c | 156 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 121 insertions(+), 39 deletions(-) (limited to 'sound') diff --git a/include/sound/sb.h b/include/sound/sb.h index 85f93c5fe1e4..4e62ee1e4115 100644 --- a/include/sound/sb.h +++ b/include/sound/sb.h @@ -249,6 +249,7 @@ struct snd_sb { #define SB_ALS4000_3D_AUTO_MUTE 0x52 #define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53 #define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54 +#define SB_ALS4000_CR3_CONFIGURATION 0xc3 /* bit 7 is Digital Loop Enable */ #define SB_ALS4000_QSOUND 0xdb /* IRQ setting bitmap */ @@ -330,7 +331,8 @@ enum { SB_MIX_DOUBLE, SB_MIX_INPUT_SW, SB_MIX_CAPTURE_PRO, - SB_MIX_CAPTURE_DT019X + SB_MIX_CAPTURE_DT019X, + SB_MIX_MONO_CAPTURE_ALS4K }; #define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \ diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 406a431af91e..475220bbcc96 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -182,7 +182,7 @@ static int snd_sbmixer_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_ static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[5] = { + static const char *texts[5] = { "CD", "Mic", "Line", "Synth", "Master" }; @@ -268,13 +268,74 @@ static int snd_dt019x_input_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl return change; } +/* + * ALS4000 mono recording control switch + */ + +static int snd_als4k_mono_capture_route_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + static const char *texts[3] = { + "L chan only", "R chan only", "L ch/2 + R ch/2" + }; + + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; + uinfo->count = 1; + uinfo->value.enumerated.items = 3; + if (uinfo->value.enumerated.item > 2) + uinfo->value.enumerated.item = 2; + strcpy(uinfo->value.enumerated.name, + texts[uinfo->value.enumerated.item]); + return 0; +} + +static int snd_als4k_mono_capture_route_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_sb *sb = snd_kcontrol_chip(kcontrol); + unsigned long flags; + unsigned char oval; + + spin_lock_irqsave(&sb->mixer_lock, flags); + oval = snd_sbmixer_read(sb, SB_ALS4000_MONO_IO_CTRL); + spin_unlock_irqrestore(&sb->mixer_lock, flags); + oval >>= 6; + if (oval > 2) + oval = 2; + + ucontrol->value.enumerated.item[0] = oval; + return 0; +} + +static int snd_als4k_mono_capture_route_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_sb *sb = snd_kcontrol_chip(kcontrol); + unsigned long flags; + int change; + unsigned char nval, oval; + + if (ucontrol->value.enumerated.item[0] > 2) + return -EINVAL; + spin_lock_irqsave(&sb->mixer_lock, flags); + oval = snd_sbmixer_read(sb, SB_ALS4000_MONO_IO_CTRL); + + nval = (oval & ~(3 << 6)) + | (ucontrol->value.enumerated.item[0] << 6); + change = nval != oval; + if (change) + snd_sbmixer_write(sb, SB_ALS4000_MONO_IO_CTRL, nval); + spin_unlock_irqrestore(&sb->mixer_lock, flags); + return change; +} + /* * SBPRO input multiplexer */ static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[3] = { + static const char *texts[3] = { "Mic", "CD", "Line" }; @@ -442,6 +503,12 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty .get = snd_dt019x_input_sw_get, .put = snd_dt019x_input_sw_put, }, + [SB_MIX_MONO_CAPTURE_ALS4K] = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .info = snd_als4k_mono_capture_route_info, + .get = snd_als4k_mono_capture_route_get, + .put = snd_als4k_mono_capture_route_put, + }, }; struct snd_kcontrol *ctl; int err; @@ -636,6 +703,8 @@ static struct sbmix_elem snd_dt019x_ctl_capture_source = }; static struct sbmix_elem *snd_dt019x_controls[] = { + /* ALS4000 below has some parts which we might be lacking, + * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ &snd_dt019x_ctl_master_play_vol, &snd_dt019x_ctl_pcm_play_vol, &snd_dt019x_ctl_synth_play_vol, @@ -666,18 +735,21 @@ static unsigned char snd_dt019x_init_values[][2] = { /* * ALS4000 specific mixer elements */ -/* FIXME: SB_ALS4000_MONO_IO_CTRL needs output select ctrl! */ static struct sbmix_elem snd_als4000_ctl_master_mono_playback_switch = SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1); -static struct sbmix_elem snd_als4000_ctl_master_mono_capture_route = - SB_SINGLE("Master Mono Capture Route", SB_ALS4000_MONO_IO_CTRL, 6, 0x03); -/* FIXME: mono playback switch also available on DT019X? */ +static struct sbmix_elem snd_als4k_ctl_master_mono_capture_route = { + .name = "Master Mono Capture Route", + .type = SB_MIX_MONO_CAPTURE_ALS4K + }; static struct sbmix_elem snd_als4000_ctl_mono_playback_switch = SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1); static struct sbmix_elem snd_als4000_ctl_mic_20db_boost = SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03); -static struct sbmix_elem snd_als4000_ctl_mixer_loopback = - SB_SINGLE("Analog Loopback", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); +static struct sbmix_elem snd_als4000_ctl_mixer_analog_loopback = + SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); +static struct sbmix_elem snd_als4000_ctl_mixer_digital_loopback = + SB_SINGLE("Digital Loopback Switch", + SB_ALS4000_CR3_CONFIGURATION, 7, 0x01); /* FIXME: functionality of 3D controls might be swapped, I didn't find * a description of how to identify what is supposed to be what */ static struct sbmix_elem snd_als4000_3d_control_switch = @@ -694,6 +766,9 @@ static struct sbmix_elem snd_als4000_3d_control_delay = SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f); static struct sbmix_elem snd_als4000_3d_control_poweroff_switch = SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01); +static struct sbmix_elem snd_als4000_ctl_3db_freq_control_switch = + SB_SINGLE("Master Playback 8kHz / 20kHz LPF Switch", + SB_ALS4000_FMDAC, 5, 0x01); #ifdef NOT_AVAILABLE static struct sbmix_elem snd_als4000_ctl_fmdac = SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01); @@ -702,35 +777,37 @@ static struct sbmix_elem snd_als4000_ctl_qsound = #endif static struct sbmix_elem *snd_als4000_controls[] = { - &snd_sb16_ctl_master_play_vol, - &snd_dt019x_ctl_pcm_play_switch, - &snd_sb16_ctl_pcm_play_vol, - &snd_sb16_ctl_synth_capture_route, - &snd_dt019x_ctl_synth_play_switch, - &snd_sb16_ctl_synth_play_vol, - &snd_sb16_ctl_cd_capture_route, - &snd_sb16_ctl_cd_play_switch, - &snd_sb16_ctl_cd_play_vol, - &snd_sb16_ctl_line_capture_route, - &snd_sb16_ctl_line_play_switch, - &snd_sb16_ctl_line_play_vol, - &snd_sb16_ctl_mic_capture_route, - &snd_als4000_ctl_mic_20db_boost, - &snd_sb16_ctl_auto_mic_gain, - &snd_sb16_ctl_mic_play_switch, - &snd_sb16_ctl_mic_play_vol, - &snd_sb16_ctl_pc_speaker_vol, - &snd_sb16_ctl_capture_vol, - &snd_sb16_ctl_play_vol, - &snd_als4000_ctl_master_mono_playback_switch, - &snd_als4000_ctl_master_mono_capture_route, - &snd_als4000_ctl_mono_playback_switch, - &snd_als4000_ctl_mixer_loopback, - &snd_als4000_3d_control_switch, - &snd_als4000_3d_control_ratio, - &snd_als4000_3d_control_freq, - &snd_als4000_3d_control_delay, - &snd_als4000_3d_control_poweroff_switch, + /* ALS4000a.PDF regs page */ + &snd_sb16_ctl_master_play_vol, /* MX30/31 12 */ + &snd_dt019x_ctl_pcm_play_switch, /* MX4C 16 */ + &snd_sb16_ctl_pcm_play_vol, /* MX32/33 12 */ + &snd_sb16_ctl_synth_capture_route, /* MX3D/3E 14 */ + &snd_dt019x_ctl_synth_play_switch, /* MX4C 16 */ + &snd_sb16_ctl_synth_play_vol, /* MX34/35 12/13 */ + &snd_sb16_ctl_cd_capture_route, /* MX3D/3E 14 */ + &snd_sb16_ctl_cd_play_switch, /* MX3C 14 */ + &snd_sb16_ctl_cd_play_vol, /* MX36/37 13 */ + &snd_sb16_ctl_line_capture_route, /* MX3D/3E 14 */ + &snd_sb16_ctl_line_play_switch, /* MX3C 14 */ + &snd_sb16_ctl_line_play_vol, /* MX38/39 13 */ + &snd_sb16_ctl_mic_capture_route, /* MX3D/3E 14 */ + &snd_als4000_ctl_mic_20db_boost, /* MX4D 16 */ + &snd_sb16_ctl_mic_play_switch, /* MX3C 14 */ + &snd_sb16_ctl_mic_play_vol, /* MX3A 13 */ + &snd_sb16_ctl_pc_speaker_vol, /* MX3B 14 */ + &snd_sb16_ctl_capture_vol, /* MX3F/40 15 */ + &snd_sb16_ctl_play_vol, /* MX41/42 15 */ + &snd_als4000_ctl_master_mono_playback_switch, /* MX4C 16 */ + &snd_als4k_ctl_master_mono_capture_route, /* MX4B 16 */ + &snd_als4000_ctl_mono_playback_switch, /* MX4C 16 */ + &snd_als4000_ctl_mixer_analog_loopback, /* MX4D 16 */ + &snd_als4000_ctl_mixer_digital_loopback, /* CR3 21 */ + &snd_als4000_3d_control_switch, /* MX50 17 */ + &snd_als4000_3d_control_ratio, /* MX50 17 */ + &snd_als4000_3d_control_freq, /* MX50 17 */ + &snd_als4000_3d_control_delay, /* MX51 18 */ + &snd_als4000_3d_control_poweroff_switch, /* MX51 18 */ + &snd_als4000_ctl_3db_freq_control_switch, /* MX4F 17 */ #ifdef NOT_AVAILABLE &snd_als4000_ctl_fmdac, &snd_als4000_ctl_qsound, @@ -905,13 +982,14 @@ static unsigned char dt019x_saved_regs[] = { }; static unsigned char als4000_saved_regs[] = { + /* please verify in dsheet whether regs to be added + are actually real H/W or just dummy */ SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, SB_DSP4_OUTPUT_SW, SB_DSP4_PCM_DEV, SB_DSP4_PCM_DEV + 1, SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, SB_DSP4_SYNTH_DEV, SB_DSP4_SYNTH_DEV + 1, SB_DSP4_CD_DEV, SB_DSP4_CD_DEV + 1, - SB_DSP4_MIC_AGC, SB_DSP4_MIC_DEV, SB_DSP4_SPEAKER_DEV, SB_DSP4_IGAIN_DEV, SB_DSP4_IGAIN_DEV + 1, @@ -919,8 +997,10 @@ static unsigned char als4000_saved_regs[] = { SB_DT019X_OUTPUT_SW2, SB_ALS4000_MONO_IO_CTRL, SB_ALS4000_MIC_IN_GAIN, + SB_ALS4000_FMDAC, SB_ALS4000_3D_SND_FX, SB_ALS4000_3D_TIME_DELAY, + SB_ALS4000_CR3_CONFIGURATION, }; static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) -- cgit v1.2.3 From 5370d96f85962769ea3df3a81cc885f257c51589 Mon Sep 17 00:00:00 2001 From: Steve Chen Date: Sat, 21 Feb 2009 08:05:04 -0600 Subject: ALSA: fix excessive background noise introduced by OSS emulation rate shrink Incorrect variable was used to get the next sample which caused S2 to be stuck with the same value resulting in loud background noise. Signed-off-by: Steve Chen Cc: Signed-off-by: Takashi Iwai --- sound/core/oss/rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c index a466443c4a26..2fa9299a440d 100644 --- a/sound/core/oss/rate.c +++ b/sound/core/oss/rate.c @@ -157,7 +157,7 @@ static void resample_shrink(struct snd_pcm_plugin *plugin, while (dst_frames1 > 0) { S1 = S2; if (src_frames1-- > 0) { - S1 = *src; + S2 = *src; src += src_step; } if (pos & ~R_MASK) { -- cgit v1.2.3 From 2d4663816064fabb68935f920bbd7ccdc7f9392d Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Mon, 23 Feb 2009 13:00:33 +1100 Subject: ALSA: hda - add another MacBook Pro 3,1 SSID Reference: Ubuntu bug #33245 https://bugs.launchpad.net/bugs/332456 Signed-off-by: Luke Yelavich Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ed8fcbd60003..f6571224b34e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7017,6 +7017,7 @@ static int patch_alc882(struct hda_codec *codec) case 0x106b3e00: /* iMac 24 Aluminium */ board_config = ALC885_IMAC24; break; + case 0x106b00a0: /* MacBookPro3,1 - Another revision */ case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ case 0x106b00a4: /* MacbookPro4,1 */ case 0x106b2c00: /* Macbook Pro rev3 */ -- cgit v1.2.3 From cc374c477c9bf95f409fed16426856d86a97394f Mon Sep 17 00:00:00 2001 From: Juan Jesus Garcia de Soria Date: Mon, 23 Feb 2009 08:11:59 +0100 Subject: ALSA: hda - Quirk for Acer Aspire 6530G The Acer Aspire 6530G needs the 4930G "model" for the front mic to work properly. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index f6571224b34e..a680be0d4534 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8470,6 +8470,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", ALC888_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", + ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), -- cgit v1.2.3 From e588ed8304f76cbb396ee85e657a58990298a675 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Fri, 20 Feb 2009 19:30:35 +0100 Subject: ALSA: hdsp - poll for iobox sleeping for 2 seconds before checking for the iobox is not enough on some systems. this patch increases the timeout, but polls the card during that time. it thus speeds up the module loading when the card has already been initialized, while being more robust on systems, which require a higher timeout than the predefined 2 seconds. Signed-off-by: Tim Blechmann Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdsp.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index bacfdd12619b..12c6b4305ec1 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -653,7 +653,6 @@ static unsigned int hdsp_read(struct hdsp *hdsp, int reg) static int hdsp_check_for_iobox (struct hdsp *hdsp) { - if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); @@ -661,7 +660,29 @@ static int hdsp_check_for_iobox (struct hdsp *hdsp) return -EIO; } return 0; +} +static int hdsp_wait_for_iobox(struct hdsp *hdsp, unsigned int loops, + unsigned int delay) +{ + unsigned int i; + + if (hdsp->io_type == H9652 || hdsp->io_type == H9632) + return 0; + + for (i = 0; i != loops; ++i) { + if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError) + msleep(delay); + else { + snd_printd("Hammerfall-DSP: iobox found after %ums!\n", + i * delay); + return 0; + } + } + + snd_printk("Hammerfall-DSP: no Digiface or Multiface connected!\n"); + hdsp->state &= ~HDSP_FirmwareLoaded; + return -EIO; } static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { @@ -5046,10 +5067,10 @@ static int __devinit snd_hdsp_create(struct snd_card *card, return err; if (!is_9652 && !is_9632) { - /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ - ssleep(2); + /* we wait a maximum of 10 seconds to let freshly + * inserted cardbus cards do their hardware init */ + err = hdsp_wait_for_iobox(hdsp, 1000, 10); - err = hdsp_check_for_iobox(hdsp); if (err < 0) return err; -- cgit v1.2.3 From f9ffc5d6f0161b66202f2df9ecc42d1be241020d Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Fri, 20 Feb 2009 19:38:16 +0100 Subject: ALSA: hdsp - whitespace cleanup Impact: remove trailing spaces Signed-off-by: Tim Blechmann Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdsp.c | 474 +++++++++++++++++++++++------------------------ 1 file changed, 237 insertions(+), 237 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 12c6b4305ec1..dc65fe1c9c65 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -113,7 +113,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); /* the meters are regular i/o-mapped registers, but offset considerably from the rest. the peak registers are reset - when read; the least-significant 4 bits are full-scale counters; + when read; the least-significant 4 bits are full-scale counters; the actual peak value is in the most-significant 24 bits. */ @@ -131,7 +131,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); 26*3 values are read in ss mode 14*3 in ds mode, with no gap between values */ -#define HDSP_9652_peakBase 7164 +#define HDSP_9652_peakBase 7164 #define HDSP_9652_rmsBase 4096 /* c.f. the hdsp_9632_meters_t struct */ @@ -173,12 +173,12 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); #define HDSP_SPDIFEmphasis (1<<10) /* 0=none, 1=on */ #define HDSP_SPDIFNonAudio (1<<11) /* 0=off, 1=on */ #define HDSP_SPDIFOpticalOut (1<<12) /* 1=use 1st ADAT connector for SPDIF, 0=do not */ -#define HDSP_SyncRef2 (1<<13) -#define HDSP_SPDIFInputSelect0 (1<<14) -#define HDSP_SPDIFInputSelect1 (1<<15) -#define HDSP_SyncRef0 (1<<16) +#define HDSP_SyncRef2 (1<<13) +#define HDSP_SPDIFInputSelect0 (1<<14) +#define HDSP_SPDIFInputSelect1 (1<<15) +#define HDSP_SyncRef0 (1<<16) #define HDSP_SyncRef1 (1<<17) -#define HDSP_AnalogExtensionBoard (1<<18) /* For H9632 cards */ +#define HDSP_AnalogExtensionBoard (1<<18) /* For H9632 cards */ #define HDSP_XLRBreakoutCable (1<<20) /* For H9632 cards */ #define HDSP_Midi0InterruptEnable (1<<22) #define HDSP_Midi1InterruptEnable (1<<23) @@ -314,7 +314,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); #define HDSP_TimecodeSync (1<<27) #define HDSP_AEBO (1<<28) /* H9632 specific Analog Extension Boards */ #define HDSP_AEBI (1<<29) /* 0 = present, 1 = absent */ -#define HDSP_midi0IRQPending (1<<30) +#define HDSP_midi0IRQPending (1<<30) #define HDSP_midi1IRQPending (1<<31) #define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2) @@ -391,7 +391,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); #define HDSP_CHANNEL_BUFFER_BYTES (4*HDSP_CHANNEL_BUFFER_SAMPLES) /* the size of the area we need to allocate for DMA transfers. the - size is the same regardless of the number of channels - the + size is the same regardless of the number of channels - the Multiface still uses the same memory area. Note that we allocate 1 more channel than is apparently needed @@ -460,7 +460,7 @@ struct hdsp { unsigned char qs_in_channels; /* quad speed mode for H9632 */ unsigned char ds_in_channels; unsigned char ss_in_channels; /* different for multiface/digiface */ - unsigned char qs_out_channels; + unsigned char qs_out_channels; unsigned char ds_out_channels; unsigned char ss_out_channels; @@ -502,9 +502,9 @@ static char channel_map_df_ss[HDSP_MAX_CHANNELS] = { static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ /* Analog */ - 0, 1, 2, 3, 4, 5, 6, 7, + 0, 1, 2, 3, 4, 5, 6, 7, /* ADAT 2 */ - 16, 17, 18, 19, 20, 21, 22, 23, + 16, 17, 18, 19, 20, 21, 22, 23, /* SPDIF */ 24, 25, -1, -1, -1, -1, -1, -1, -1, -1 @@ -525,11 +525,11 @@ static char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { /* SPDIF */ 8, 9, /* Analog */ - 10, 11, + 10, 11, /* AO4S-192 and AI4S-192 extension boards */ 12, 13, 14, 15, /* others don't exist */ - -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; @@ -539,7 +539,7 @@ static char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { /* SPDIF */ 8, 9, /* Analog */ - 10, 11, + 10, 11, /* AO4S-192 and AI4S-192 extension boards */ 12, 13, 14, 15, /* others don't exist */ @@ -587,7 +587,7 @@ static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_d static struct pci_device_id snd_hdsp_ids[] = { { .vendor = PCI_VENDOR_ID_XILINX, - .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, + .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, /* RME Hammerfall-DSP */ @@ -691,19 +691,19 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { unsigned long flags; if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { - + snd_printk ("Hammerfall-DSP: loading firmware\n"); hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); hdsp_write (hdsp, HDSP_fifoData, 0); - + if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); return -EIO; } - + hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); - + for (i = 0; i < 24413; ++i) { hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]); if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { @@ -713,7 +713,7 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { } ssleep(3); - + if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); return -EIO; @@ -726,15 +726,15 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { #endif hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); snd_printk ("Hammerfall-DSP: finished firmware loading\n"); - + } if (hdsp->state & HDSP_InitializationComplete) { snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); spin_lock_irqsave(&hdsp->lock, flags); snd_hdsp_set_defaults(hdsp); - spin_unlock_irqrestore(&hdsp->lock, flags); + spin_unlock_irqrestore(&hdsp->lock, flags); } - + hdsp->state |= HDSP_FirmwareLoaded; return 0; @@ -743,7 +743,7 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { static int hdsp_get_iobox_version (struct hdsp *hdsp) { if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { - + hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); hdsp_write (hdsp, HDSP_fifoData, 0); if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) @@ -759,7 +759,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT); } else { hdsp->io_type = Digiface; - } + } } else { /* firmware was already loaded, get iobox type */ if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) @@ -807,13 +807,13 @@ static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand) static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout) -{ +{ int i; /* the fifoStatus registers reports on how many words are available in the command FIFO. */ - + for (i = 0; i < timeout; i++) { if ((int)(hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count) @@ -845,11 +845,11 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short if (addr >= HDSP_MATRIX_MIXER_SIZE) return -1; - + if (hdsp->io_type == H9652 || hdsp->io_type == H9632) { /* from martin bjornsen: - + "You can only write dwords to the mixer memory which contain two mixer values in the low and high @@ -868,7 +868,7 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short hdsp->mixer_matrix[addr] = data; - + /* `addr' addresses a 16-bit wide address, but the address space accessed via hdsp_write uses byte offsets. put another way, addr @@ -877,17 +877,17 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short to access 0 to 2703 ... */ ad = addr/2; - - hdsp_write (hdsp, 4096 + (ad*4), - (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + + + hdsp_write (hdsp, 4096 + (ad*4), + (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + hdsp->mixer_matrix[addr&0x7fe]); - + return 0; } else { ad = (addr << 16) + data; - + if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) return -1; @@ -923,7 +923,7 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp) if (status & HDSP_SPDIFErrorFlag) return 0; - + switch (rate_bits) { case HDSP_spdifFrequency32KHz: return 32000; case HDSP_spdifFrequency44_1KHz: return 44100; @@ -931,13 +931,13 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp) case HDSP_spdifFrequency64KHz: return 64000; case HDSP_spdifFrequency88_2KHz: return 88200; case HDSP_spdifFrequency96KHz: return 96000; - case HDSP_spdifFrequency128KHz: + case HDSP_spdifFrequency128KHz: if (hdsp->io_type == H9632) return 128000; break; - case HDSP_spdifFrequency176_4KHz: + case HDSP_spdifFrequency176_4KHz: if (hdsp->io_type == H9632) return 176400; break; - case HDSP_spdifFrequency192KHz: + case HDSP_spdifFrequency192KHz: if (hdsp->io_type == H9632) return 192000; break; default: @@ -1048,7 +1048,7 @@ static void hdsp_set_dds_value(struct hdsp *hdsp, int rate) { u64 n; u32 r; - + if (rate >= 112000) rate /= 4; else if (rate >= 56000) @@ -1074,35 +1074,35 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) there is no need for it (e.g. during module initialization). */ - - if (!(hdsp->control_register & HDSP_ClockModeMaster)) { + + if (!(hdsp->control_register & HDSP_ClockModeMaster)) { if (called_internally) { /* request from ctl or card initialization */ snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); return -1; - } else { + } else { /* hw_param request while in AutoSync mode */ int external_freq = hdsp_external_sample_rate(hdsp); int spdif_freq = hdsp_spdif_sample_rate(hdsp); - + if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) - snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); + snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); else if (rate != external_freq) { snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); return -1; - } - } + } + } } current_rate = hdsp->system_sample_rate; /* Changing from a "single speed" to a "double speed" rate is not allowed if any substreams are open. This is because - such a change causes a shift in the location of + such a change causes a shift in the location of the DMA buffers and a reduction in the number of available - buffers. + buffers. Note that a similar but essentially insoluble problem exists for externally-driven rate changes. All we can do @@ -1110,7 +1110,7 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) if (rate > 96000 && hdsp->io_type != H9632) return -EINVAL; - + switch (rate) { case 32000: if (current_rate > 48000) @@ -1200,7 +1200,7 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) break; } } - + hdsp->system_sample_rate = rate; return 0; @@ -1266,16 +1266,16 @@ static int snd_hdsp_midi_output_write (struct hdsp_midi *hmidi) unsigned char buf[128]; /* Output is not interrupt driven */ - + spin_lock_irqsave (&hmidi->lock, flags); if (hmidi->output) { if (!snd_rawmidi_transmit_empty (hmidi->output)) { if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) { if (n_pending > (int)sizeof (buf)) n_pending = sizeof (buf); - + if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) { - for (i = 0; i < to_write; ++i) + for (i = 0; i < to_write; ++i) snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); } } @@ -1346,14 +1346,14 @@ static void snd_hdsp_midi_output_timer(unsigned long data) { struct hdsp_midi *hmidi = (struct hdsp_midi *) data; unsigned long flags; - + snd_hdsp_midi_output_write(hmidi); spin_lock_irqsave (&hmidi->lock, flags); /* this does not bump hmidi->istimer, because the kernel automatically removed the timer when it expired, and we are now adding it back, thus - leaving istimer wherever it was set before. + leaving istimer wherever it was set before. */ if (hmidi->istimer) { @@ -1522,7 +1522,7 @@ static int snd_hdsp_control_spdif_info(struct snd_kcontrol *kcontrol, struct snd static int snd_hdsp_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif); return 0; } @@ -1532,7 +1532,7 @@ static int snd_hdsp_control_spdif_put(struct snd_kcontrol *kcontrol, struct snd_ struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; u32 val; - + val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); spin_lock_irq(&hdsp->lock); change = val != hdsp->creg_spdif; @@ -1551,7 +1551,7 @@ static int snd_hdsp_control_spdif_stream_info(struct snd_kcontrol *kcontrol, str static int snd_hdsp_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif_stream); return 0; } @@ -1561,7 +1561,7 @@ static int snd_hdsp_control_spdif_stream_put(struct snd_kcontrol *kcontrol, stru struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; u32 val; - + val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); spin_lock_irq(&hdsp->lock); change = val != hdsp->creg_spdif_stream; @@ -1623,7 +1623,7 @@ static int snd_hdsp_info_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_ static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_spdif_in(hdsp); return 0; } @@ -1633,7 +1633,7 @@ static int snd_hdsp_put_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_e struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.enumerated.item[0] % ((hdsp->io_type == H9632) ? 4 : 3); @@ -1670,7 +1670,7 @@ static int hdsp_set_spdif_output(struct hdsp *hdsp, int out) static int snd_hdsp_get_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.integer.value[0] = hdsp_spdif_out(hdsp); return 0; } @@ -1680,7 +1680,7 @@ static int snd_hdsp_put_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_ struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -1714,7 +1714,7 @@ static int hdsp_set_spdif_professional(struct hdsp *hdsp, int val) static int snd_hdsp_get_spdif_professional(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.integer.value[0] = hdsp_spdif_professional(hdsp); return 0; } @@ -1724,7 +1724,7 @@ static int snd_hdsp_put_spdif_professional(struct snd_kcontrol *kcontrol, struct struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -1758,7 +1758,7 @@ static int hdsp_set_spdif_emphasis(struct hdsp *hdsp, int val) static int snd_hdsp_get_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.integer.value[0] = hdsp_spdif_emphasis(hdsp); return 0; } @@ -1768,7 +1768,7 @@ static int snd_hdsp_put_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -1802,7 +1802,7 @@ static int hdsp_set_spdif_nonaudio(struct hdsp *hdsp, int val) static int snd_hdsp_get_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.integer.value[0] = hdsp_spdif_nonaudio(hdsp); return 0; } @@ -1812,7 +1812,7 @@ static int snd_hdsp_put_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -1849,7 +1849,7 @@ static int snd_hdsp_info_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + switch (hdsp_spdif_sample_rate(hdsp)) { case 32000: ucontrol->value.enumerated.item[0] = 0; @@ -1879,7 +1879,7 @@ static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct ucontrol->value.enumerated.item[0] = 9; break; default: - ucontrol->value.enumerated.item[0] = 6; + ucontrol->value.enumerated.item[0] = 6; } return 0; } @@ -1903,7 +1903,7 @@ static int snd_hdsp_info_system_sample_rate(struct snd_kcontrol *kcontrol, struc static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp->system_sample_rate; return 0; } @@ -1920,7 +1920,7 @@ static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; + static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7 ; @@ -1933,7 +1933,7 @@ static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, str static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + switch (hdsp_external_sample_rate(hdsp)) { case 32000: ucontrol->value.enumerated.item[0] = 0; @@ -1961,9 +1961,9 @@ static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, stru break; case 192000: ucontrol->value.enumerated.item[0] = 9; - break; + break; default: - ucontrol->value.enumerated.item[0] = 6; + ucontrol->value.enumerated.item[0] = 6; } return 0; } @@ -1989,7 +1989,7 @@ static int hdsp_system_clock_mode(struct hdsp *hdsp) static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[] = {"Master", "Slave" }; - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = 2; @@ -2002,7 +2002,7 @@ static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_system_clock_mode(hdsp); return 0; } @@ -2039,7 +2039,7 @@ static int hdsp_clock_source(struct hdsp *hdsp) case 192000: return 9; default: - return 3; + return 3; } } else { return 0; @@ -2053,7 +2053,7 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode) case HDSP_CLOCK_SOURCE_AUTOSYNC: if (hdsp_external_sample_rate(hdsp) != 0) { if (!hdsp_set_rate(hdsp, hdsp_external_sample_rate(hdsp), 1)) { - hdsp->control_register &= ~HDSP_ClockModeMaster; + hdsp->control_register &= ~HDSP_ClockModeMaster; hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); return 0; } @@ -2064,7 +2064,7 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode) break; case HDSP_CLOCK_SOURCE_INTERNAL_44_1KHZ: rate = 44100; - break; + break; case HDSP_CLOCK_SOURCE_INTERNAL_48KHZ: rate = 48000; break; @@ -2099,13 +2099,13 @@ static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_ { static char *texts[] = {"AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", "Internal 192.0 KHz" }; struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; if (hdsp->io_type == H9632) uinfo->value.enumerated.items = 10; else - uinfo->value.enumerated.items = 7; + uinfo->value.enumerated.items = 7; if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); @@ -2115,7 +2115,7 @@ static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_ static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_clock_source(hdsp); return 0; } @@ -2125,7 +2125,7 @@ static int snd_hdsp_put_clock_source(struct snd_kcontrol *kcontrol, struct snd_c struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.enumerated.item[0]; @@ -2151,7 +2151,7 @@ static int snd_hdsp_put_clock_source(struct snd_kcontrol *kcontrol, struct snd_c static int snd_hdsp_get_clock_source_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.integer.value[0] = hdsp->clock_source_locked; return 0; } @@ -2186,7 +2186,7 @@ static int hdsp_da_gain(struct hdsp *hdsp) case HDSP_DAGainMinus10dBV: return 2; default: - return 1; + return 1; } } @@ -2201,8 +2201,8 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode) hdsp->control_register |= HDSP_DAGainPlus4dBu; break; case 2: - hdsp->control_register |= HDSP_DAGainMinus10dBV; - break; + hdsp->control_register |= HDSP_DAGainMinus10dBV; + break; default: return -1; @@ -2214,7 +2214,7 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode) static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = 3; @@ -2227,7 +2227,7 @@ static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_e static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_da_gain(hdsp); return 0; } @@ -2237,7 +2237,7 @@ static int snd_hdsp_put_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_el struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.enumerated.item[0]; @@ -2271,7 +2271,7 @@ static int hdsp_ad_gain(struct hdsp *hdsp) case HDSP_ADGainLowGain: return 2; default: - return 1; + return 1; } } @@ -2283,11 +2283,11 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode) hdsp->control_register |= HDSP_ADGainMinus10dBV; break; case 1: - hdsp->control_register |= HDSP_ADGainPlus4dBu; + hdsp->control_register |= HDSP_ADGainPlus4dBu; break; case 2: - hdsp->control_register |= HDSP_ADGainLowGain; - break; + hdsp->control_register |= HDSP_ADGainLowGain; + break; default: return -1; @@ -2299,7 +2299,7 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode) static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = 3; @@ -2312,7 +2312,7 @@ static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_e static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_ad_gain(hdsp); return 0; } @@ -2322,7 +2322,7 @@ static int snd_hdsp_put_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_el struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.enumerated.item[0]; @@ -2356,7 +2356,7 @@ static int hdsp_phone_gain(struct hdsp *hdsp) case HDSP_PhoneGainMinus12dB: return 2; default: - return 0; + return 0; } } @@ -2368,11 +2368,11 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode) hdsp->control_register |= HDSP_PhoneGain0dB; break; case 1: - hdsp->control_register |= HDSP_PhoneGainMinus6dB; + hdsp->control_register |= HDSP_PhoneGainMinus6dB; break; case 2: - hdsp->control_register |= HDSP_PhoneGainMinus12dB; - break; + hdsp->control_register |= HDSP_PhoneGainMinus12dB; + break; default: return -1; @@ -2384,7 +2384,7 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode) static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[] = {"0 dB", "-6 dB", "-12 dB"}; - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = 3; @@ -2397,7 +2397,7 @@ static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ct static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_phone_gain(hdsp); return 0; } @@ -2407,7 +2407,7 @@ static int snd_hdsp_put_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.enumerated.item[0]; @@ -2453,7 +2453,7 @@ static int hdsp_set_xlr_breakout_cable(struct hdsp *hdsp, int mode) static int snd_hdsp_get_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_xlr_breakout_cable(hdsp); return 0; } @@ -2463,7 +2463,7 @@ static int snd_hdsp_put_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -2509,7 +2509,7 @@ static int hdsp_set_aeb(struct hdsp *hdsp, int mode) static int snd_hdsp_get_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_aeb(hdsp); return 0; } @@ -2519,7 +2519,7 @@ static int snd_hdsp_put_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -2597,7 +2597,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd { static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" }; struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; @@ -2616,7 +2616,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd uinfo->value.enumerated.items = 0; break; } - + if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); @@ -2626,7 +2626,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_pref_sync_ref(hdsp); return 0; } @@ -2636,7 +2636,7 @@ static int snd_hdsp_put_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change, max; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; @@ -2685,7 +2685,7 @@ static int hdsp_autosync_ref(struct hdsp *hdsp) case HDSP_SelSyncRef_SPDIF: return HDSP_AUTOSYNC_FROM_SPDIF; case HDSP_SelSyncRefMask: - return HDSP_AUTOSYNC_FROM_NONE; + return HDSP_AUTOSYNC_FROM_NONE; case HDSP_SelSyncRef_ADAT1: return HDSP_AUTOSYNC_FROM_ADAT1; case HDSP_SelSyncRef_ADAT2: @@ -2701,7 +2701,7 @@ static int hdsp_autosync_ref(struct hdsp *hdsp) static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" }; - + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = 7; @@ -2714,7 +2714,7 @@ static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_autosync_ref(hdsp); return 0; } @@ -2748,7 +2748,7 @@ static int hdsp_set_line_output(struct hdsp *hdsp, int out) static int snd_hdsp_get_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + spin_lock_irq(&hdsp->lock); ucontrol->value.integer.value[0] = hdsp_line_out(hdsp); spin_unlock_irq(&hdsp->lock); @@ -2760,7 +2760,7 @@ static int snd_hdsp_put_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_e struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -2794,7 +2794,7 @@ static int hdsp_set_precise_pointer(struct hdsp *hdsp, int precise) static int snd_hdsp_get_precise_pointer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + spin_lock_irq(&hdsp->lock); ucontrol->value.integer.value[0] = hdsp->precise_ptr; spin_unlock_irq(&hdsp->lock); @@ -2806,7 +2806,7 @@ static int snd_hdsp_put_precise_pointer(struct snd_kcontrol *kcontrol, struct sn struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -2840,7 +2840,7 @@ static int hdsp_set_use_midi_tasklet(struct hdsp *hdsp, int use_tasklet) static int snd_hdsp_get_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + spin_lock_irq(&hdsp->lock); ucontrol->value.integer.value[0] = hdsp->use_midi_tasklet; spin_unlock_irq(&hdsp->lock); @@ -2852,7 +2852,7 @@ static int snd_hdsp_put_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct s struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; unsigned int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.integer.value[0] & 1; @@ -2894,12 +2894,12 @@ static int snd_hdsp_get_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem source = ucontrol->value.integer.value[0]; destination = ucontrol->value.integer.value[1]; - + if (source >= hdsp->max_channels) addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); else addr = hdsp_input_to_output_key(hdsp,source, destination); - + spin_lock_irq(&hdsp->lock); ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); spin_unlock_irq(&hdsp->lock); @@ -2947,7 +2947,7 @@ static int snd_hdsp_put_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[] = {"No Lock", "Lock", "Sync" }; + static char *texts[] = {"No Lock", "Lock", "Sync" }; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = 3; @@ -2992,7 +2992,7 @@ static int hdsp_spdif_sync_check(struct hdsp *hdsp) int status = hdsp_read(hdsp, HDSP_statusRegister); if (status & HDSP_SPDIFErrorFlag) return 0; - else { + else { if (status & HDSP_SPDIFSync) return 2; else @@ -3028,7 +3028,7 @@ static int hdsp_adatsync_sync_check(struct hdsp *hdsp) return 1; } else return 0; -} +} static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -3046,17 +3046,17 @@ static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struc } static int hdsp_adat_sync_check(struct hdsp *hdsp, int idx) -{ +{ int status = hdsp_read(hdsp, HDSP_statusRegister); - + if (status & (HDSP_Lock0>>idx)) { if (status & (HDSP_Sync0>>idx)) return 2; else - return 1; + return 1; } else return 0; -} +} static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -3074,7 +3074,7 @@ static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct sn break; case Multiface: case H9632: - if (offset >= 1) + if (offset >= 1) return -EINVAL; break; default: @@ -3136,7 +3136,7 @@ static int snd_hdsp_info_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ct static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - + ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp); return 0; } @@ -3146,7 +3146,7 @@ static int snd_hdsp_put_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); int change; int val; - + if (!snd_hdsp_use_is_exclusive(hdsp)) return -EBUSY; val = ucontrol->value.enumerated.item[0]; @@ -3191,7 +3191,7 @@ static struct snd_kcontrol_new snd_hdsp_controls[] = { .get = snd_hdsp_control_spdif_mask_get, .private_value = IEC958_AES0_NONAUDIO | IEC958_AES0_PROFESSIONAL | - IEC958_AES0_CON_EMPHASIS, + IEC958_AES0_CON_EMPHASIS, }, { .access = SNDRV_CTL_ELEM_ACCESS_READ, @@ -3209,7 +3209,7 @@ HDSP_SPDIF_OUT("IEC958 Output also on ADAT1", 0), HDSP_SPDIF_PROFESSIONAL("IEC958 Professional Bit", 0), HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0), HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), -/* 'Sample Clock Source' complies with the alsa control naming scheme */ +/* 'Sample Clock Source' complies with the alsa control naming scheme */ HDSP_CLOCK_SOURCE("Sample Clock Source", 0), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -3261,7 +3261,7 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp) return err; } } - + /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ if (hdsp->io_type == H9632) { for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { @@ -3280,7 +3280,7 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp) } /*------------------------------------------------------------ - /proc interface + /proc interface ------------------------------------------------------------*/ static void @@ -3319,7 +3319,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) } } } - + status = hdsp_read(hdsp, HDSP_statusRegister); status2 = hdsp_read(hdsp, HDSP_status2Register); @@ -3383,17 +3383,17 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) break; case HDSP_CLOCK_SOURCE_INTERNAL_192KHZ: clock_source = "Internal 192 kHz"; - break; + break; default: - clock_source = "Error"; + clock_source = "Error"; } snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); - + if (hdsp_system_clock_mode(hdsp)) system_clock_mode = "Slave"; else system_clock_mode = "Master"; - + switch (hdsp_pref_sync_ref (hdsp)) { case HDSP_SYNC_FROM_WORD: pref_sync_ref = "Word Clock"; @@ -3418,7 +3418,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) break; } snd_iprintf (buffer, "Preferred Sync Reference: %s\n", pref_sync_ref); - + switch (hdsp_autosync_ref (hdsp)) { case HDSP_AUTOSYNC_FROM_WORD: autosync_ref = "Word Clock"; @@ -3431,7 +3431,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) break; case HDSP_AUTOSYNC_FROM_NONE: autosync_ref = "None"; - break; + break; case HDSP_AUTOSYNC_FROM_ADAT1: autosync_ref = "ADAT1"; break; @@ -3446,14 +3446,14 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) break; } snd_iprintf (buffer, "AutoSync Reference: %s\n", autosync_ref); - + snd_iprintf (buffer, "AutoSync Frequency: %d\n", hdsp_external_sample_rate(hdsp)); - + snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No"); - + snd_iprintf(buffer, "\n"); switch (hdsp_spdif_in(hdsp)) { @@ -3473,7 +3473,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) snd_iprintf(buffer, "IEC958 input: ???\n"); break; } - + if (hdsp->control_register & HDSP_SPDIFOpticalOut) snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); else @@ -3531,13 +3531,13 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) snd_iprintf (buffer, "SPDIF: No Lock\n"); else snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); - + x = status2 & HDSP_wc_sync; if (status2 & HDSP_wc_lock) snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock"); else snd_iprintf (buffer, "Word Clock: No Lock\n"); - + x = status & HDSP_TimecodeSync; if (status & HDSP_TimecodeLock) snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock"); @@ -3545,11 +3545,11 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) snd_iprintf(buffer, "ADAT Sync: No Lock\n"); snd_iprintf(buffer, "\n"); - + /* Informations about H9632 specific controls */ if (hdsp->io_type == H9632) { char *tmp; - + switch (hdsp_ad_gain(hdsp)) { case 0: tmp = "-10 dBV"; @@ -3575,7 +3575,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) break; } snd_iprintf(buffer, "DA Gain : %s\n", tmp); - + switch (hdsp_phone_gain(hdsp)) { case 0: tmp = "0 dB"; @@ -3589,8 +3589,8 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) } snd_iprintf(buffer, "Phones Gain : %s\n", tmp); - snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); - + snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); + if (hdsp->control_register & HDSP_AnalogExtensionBoard) snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); else @@ -3653,18 +3653,18 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) /* set defaults: - SPDIF Input via Coax + SPDIF Input via Coax Master clock mode maximum latency (7 => 2^7 = 8192 samples, 64Kbyte buffer, which implies 2 4096 sample, 32Kbyte periods). - Enable line out. + Enable line out. */ - hdsp->control_register = HDSP_ClockModeMaster | - HDSP_SPDIFInputCoaxial | - hdsp_encode_latency(7) | + hdsp->control_register = HDSP_ClockModeMaster | + HDSP_SPDIFInputCoaxial | + hdsp_encode_latency(7) | HDSP_LineOut; - + hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); @@ -3682,7 +3682,7 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) hdsp_compute_period_size(hdsp); /* silence everything */ - + for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; @@ -3690,7 +3690,7 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) return -EIO; } - + /* H9632 specific defaults */ if (hdsp->io_type == H9632) { hdsp->control_register |= (HDSP_DAGainPlus4dBu | HDSP_ADGainPlus4dBu | HDSP_PhoneGain0dB); @@ -3708,12 +3708,12 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) static void hdsp_midi_tasklet(unsigned long arg) { struct hdsp *hdsp = (struct hdsp *)arg; - + if (hdsp->midi[0].pending) snd_hdsp_midi_input_read (&hdsp->midi[0]); if (hdsp->midi[1].pending) snd_hdsp_midi_input_read (&hdsp->midi[1]); -} +} static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) { @@ -3725,7 +3725,7 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) unsigned int midi0status; unsigned int midi1status; int schedule = 0; - + status = hdsp_read(hdsp, HDSP_statusRegister); audio = status & HDSP_audioIRQPending; @@ -3739,15 +3739,15 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff; midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; - + if (audio) { if (hdsp->capture_substream) snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); - + if (hdsp->playback_substream) snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); } - + if (midi0 && midi0status) { if (hdsp->use_midi_tasklet) { /* we disable interrupts for this input until processing is done */ @@ -3790,10 +3790,10 @@ static char *hdsp_channel_buffer_location(struct hdsp *hdsp, if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels)) return NULL; - + if ((mapped_channel = hdsp->channel_map[channel]) < 0) return NULL; - + if (stream == SNDRV_PCM_STREAM_CAPTURE) return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); else @@ -3986,7 +3986,7 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd) struct hdsp *hdsp = snd_pcm_substream_chip(substream); struct snd_pcm_substream *other; int running; - + if (hdsp_check_for_iobox (hdsp)) return -EIO; @@ -4080,10 +4080,10 @@ static struct snd_pcm_hardware snd_hdsp_playback_subinfo = .formats = SNDRV_PCM_FMTBIT_S32_LE, #endif .rates = (SNDRV_PCM_RATE_32000 | - SNDRV_PCM_RATE_44100 | - SNDRV_PCM_RATE_48000 | - SNDRV_PCM_RATE_64000 | - SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_64000 | + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000), .rate_min = 32000, .rate_max = 96000, @@ -4109,10 +4109,10 @@ static struct snd_pcm_hardware snd_hdsp_capture_subinfo = .formats = SNDRV_PCM_FMTBIT_S32_LE, #endif .rates = (SNDRV_PCM_RATE_32000 | - SNDRV_PCM_RATE_44100 | - SNDRV_PCM_RATE_48000 | - SNDRV_PCM_RATE_64000 | - SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_64000 | + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000), .rate_min = 32000, .rate_max = 96000, @@ -4191,7 +4191,7 @@ static int snd_hdsp_hw_rule_in_channels_rate(struct snd_pcm_hw_params *params, .max = hdsp->qs_in_channels, .integer = 1, }; - return snd_interval_refine(c, &t); + return snd_interval_refine(c, &t); } else if (r->min > 48000 && r->max <= 96000) { struct snd_interval t = { .min = hdsp->ds_in_channels, @@ -4222,7 +4222,7 @@ static int snd_hdsp_hw_rule_out_channels_rate(struct snd_pcm_hw_params *params, .max = hdsp->qs_out_channels, .integer = 1, }; - return snd_interval_refine(c, &t); + return snd_interval_refine(c, &t); } else if (r->min > 48000 && r->max <= 96000) { struct snd_interval t = { .min = hdsp->ds_out_channels, @@ -4339,8 +4339,8 @@ static int snd_hdsp_playback_open(struct snd_pcm_substream *substream) if (hdsp->io_type == H9632) { runtime->hw.channels_min = hdsp->qs_out_channels; runtime->hw.channels_max = hdsp->ss_out_channels; - } - + } + snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, snd_hdsp_hw_rule_out_channels, hdsp, SNDRV_PCM_HW_PARAM_CHANNELS, -1); @@ -4550,7 +4550,7 @@ static int hdsp_get_peak(struct hdsp *hdsp, struct hdsp_peak_rms __user *peak_rm hdsp->iobase + HDSP_playbackRmsLevel + i * 8 + 4, hdsp->iobase + HDSP_playbackRmsLevel + i * 8)) return -EFAULT; - if (copy_u64_le(&peak_rms->input_rms[i], + if (copy_u64_le(&peak_rms->input_rms[i], hdsp->iobase + HDSP_inputRmsLevel + i * 8 + 4, hdsp->iobase + HDSP_inputRmsLevel + i * 8)) return -EFAULT; @@ -4560,7 +4560,7 @@ static int hdsp_get_peak(struct hdsp *hdsp, struct hdsp_peak_rms __user *peak_rm static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg) { - struct hdsp *hdsp = (struct hdsp *)hw->private_data; + struct hdsp *hdsp = (struct hdsp *)hw->private_data; void __user *argp = (void __user *)arg; int err; @@ -4594,7 +4594,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne struct hdsp_config_info info; unsigned long flags; int i; - + err = hdsp_check_for_iobox(hdsp); if (err < 0) return err; @@ -4628,7 +4628,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp); info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp); info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); - + } if (hdsp->io_type == H9632 || hdsp->io_type == H9652) info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); @@ -4639,7 +4639,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne } case SNDRV_HDSP_IOCTL_GET_9632_AEB: { struct hdsp_9632_aeb h9632_aeb; - + if (hdsp->io_type != H9632) return -EINVAL; h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS; @@ -4650,7 +4650,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne case SNDRV_HDSP_IOCTL_GET_VERSION: { struct hdsp_version hdsp_version; int err; - + if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; if (hdsp->io_type == Undefined) { if ((err = hdsp_get_iobox_version(hdsp)) < 0) @@ -4666,7 +4666,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne struct hdsp_firmware __user *firmware; u32 __user *firmware_data; int err; - + if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ if (hdsp->io_type == Undefined) return -EINVAL; @@ -4679,25 +4679,25 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne if (get_user(firmware_data, &firmware->firmware_data)) return -EFAULT; - + if (hdsp_check_for_iobox (hdsp)) return -EIO; if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) return -EFAULT; - + hdsp->state |= HDSP_FirmwareCached; if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) return err; - + if (!(hdsp->state & HDSP_InitializationComplete)) { if ((err = snd_hdsp_enable_io(hdsp)) < 0) return err; - - snd_hdsp_initialize_channels(hdsp); + + snd_hdsp_initialize_channels(hdsp); snd_hdsp_initialize_midi_flush(hdsp); - + if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); return err; @@ -4744,16 +4744,16 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp) { struct snd_hwdep *hw; int err; - + if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0) return err; - + hdsp->hwdep = hw; hw->private_data = hdsp; strcpy(hw->name, "HDSP hwdep interface"); hw->ops.ioctl = snd_hdsp_hwdep_ioctl; - + return 0; } @@ -4786,24 +4786,24 @@ static void snd_hdsp_9652_enable_mixer (struct hdsp *hdsp) static int snd_hdsp_enable_io (struct hdsp *hdsp) { int i; - + if (hdsp_fifo_wait (hdsp, 0, 100)) { snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); return -EIO; } - + for (i = 0; i < hdsp->max_channels; ++i) { hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1); hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1); } - + return 0; } static void snd_hdsp_initialize_channels(struct hdsp *hdsp) { int status, aebi_channels, aebo_channels; - + switch (hdsp->io_type) { case Digiface: hdsp->card_name = "RME Hammerfall DSP + Digiface"; @@ -4816,7 +4816,7 @@ static void snd_hdsp_initialize_channels(struct hdsp *hdsp) hdsp->ss_in_channels = hdsp->ss_out_channels = H9652_SS_CHANNELS; hdsp->ds_in_channels = hdsp->ds_out_channels = H9652_DS_CHANNELS; break; - + case H9632: status = hdsp_read(hdsp, HDSP_statusRegister); /* HDSP_AEBx bits are low when AEB are connected */ @@ -4836,7 +4836,7 @@ static void snd_hdsp_initialize_channels(struct hdsp *hdsp) hdsp->ss_in_channels = hdsp->ss_out_channels = MULTIFACE_SS_CHANNELS; hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS; break; - + default: /* should never get here */ break; @@ -4852,12 +4852,12 @@ static void snd_hdsp_initialize_midi_flush (struct hdsp *hdsp) static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp) { int err; - + if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); return err; } - + if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); @@ -4888,19 +4888,19 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); return err; } - + if (!(hdsp->state & HDSP_InitializationComplete)) { strcpy(card->shortname, "Hammerfall DSP"); - sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, + sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, hdsp->port, hdsp->irq); - + if ((err = snd_card_register(card)) < 0) { snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); return err; } hdsp->state |= HDSP_InitializationComplete; } - + return 0; } @@ -4911,7 +4911,7 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) const char *fwfile; const struct firmware *fw; int err; - + if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; if (hdsp->io_type == Undefined) { @@ -4920,7 +4920,7 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; } - + /* caution: max length of firmware filename is 30! */ switch (hdsp->io_type) { case Multiface: @@ -4954,12 +4954,12 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) memcpy(hdsp->firmware_cache, fw->data, sizeof(hdsp->firmware_cache)); release_firmware(fw); - + hdsp->state |= HDSP_FirmwareCached; if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) return err; - + if (!(hdsp->state & HDSP_InitializationComplete)) { if ((err = snd_hdsp_enable_io(hdsp)) < 0) return err; @@ -5006,14 +5006,14 @@ static int __devinit snd_hdsp_create(struct snd_card *card, hdsp->max_channels = 26; hdsp->card = card; - + spin_lock_init(&hdsp->lock); tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp); - + pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); hdsp->firmware_rev &= 0xff; - + /* From Martin Bjoernsen : "It is important that the card's latency timer register in the PCI configuration space is set to a value much larger @@ -5022,7 +5022,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, to its maximum 255 to avoid problems with some computers." */ pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF); - + strcpy(card->driver, "H-DSP"); strcpy(card->mixername, "Xilinx FPGA"); @@ -5036,7 +5036,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, } else { hdsp->card_name = "RME HDSP 9632"; hdsp->max_channels = 16; - is_9632 = 1; + is_9632 = 1; } if ((err = pci_enable_device(pci)) < 0) @@ -5065,7 +5065,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) return err; - + if (!is_9652 && !is_9632) { /* we wait a maximum of 10 seconds to let freshly * inserted cardbus cards do their hardware init */ @@ -5092,35 +5092,35 @@ static int __devinit snd_hdsp_create(struct snd_card *card, return err; return 0; } else { - snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); + snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) hdsp->io_type = Multiface; - else + else hdsp->io_type = Digiface; } } - + if ((err = snd_hdsp_enable_io(hdsp)) != 0) return err; - + if (is_9652) hdsp->io_type = H9652; - + if (is_9632) hdsp->io_type = H9632; if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) return err; - + snd_hdsp_initialize_channels(hdsp); snd_hdsp_initialize_midi_flush(hdsp); - hdsp->state |= HDSP_FirmwareLoaded; + hdsp->state |= HDSP_FirmwareLoaded; if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) return err; - return 0; + return 0; } static int snd_hdsp_free(struct hdsp *hdsp) @@ -5136,13 +5136,13 @@ static int snd_hdsp_free(struct hdsp *hdsp) free_irq(hdsp->irq, (void *)hdsp); snd_hdsp_free_buffers(hdsp); - + if (hdsp->iobase) iounmap(hdsp->iobase); if (hdsp->port) pci_release_regions(hdsp->pci); - + pci_disable_device(hdsp->pci); return 0; } @@ -5187,7 +5187,7 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci, } strcpy(card->shortname, "Hammerfall DSP"); - sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, + sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, hdsp->port, hdsp->irq); if ((err = snd_card_register(card)) < 0) { -- cgit v1.2.3 From c17a1abae2f29047a0f57324240b01609489261b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Feb 2009 09:28:12 +0100 Subject: ALSA: hda - Use snd_hda_codec_get_pincfg() in the rest places Replace with snd_hda_codec_get_pincfg() in the places where available. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 3 +-- sound/pci/hda/hda_generic.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 6fa871f66a72..8ec2dfca9a6c 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3488,8 +3488,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, if (ignore_nids && is_in_nid_list(nid, ignore_nids)) continue; - def_conf = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_CONFIG_DEFAULT, 0); + def_conf = snd_hda_codec_get_pincfg(codec, nid); if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) continue; loc = get_defcfg_location(def_conf); diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 65745e96dc70..2c81a683e8f8 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -146,7 +146,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid if (node->type == AC_WID_PIN) { node->pin_caps = snd_hda_param_read(codec, node->nid, AC_PAR_PIN_CAP); node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); - node->def_cfg = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); + node->def_cfg = snd_hda_codec_get_pincfg(codec, node->nid); } if (node->wid_caps & AC_WCAP_OUT_AMP) { -- cgit v1.2.3 From 346ff70fdbe9093947b9494fe714c89cafcceade Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Feb 2009 09:42:57 +0100 Subject: ALSA: hda - Rename {override,cur}_pin with {user,driver}_pin Rename from override_pin and cur_pin with user_pin and driver_pin, respectively, to be a bit more intuitive. Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio.txt | 12 ++++++------ sound/pci/hda/hda_codec.c | 18 +++++++++--------- sound/pci/hda/hda_codec.h | 4 ++-- sound/pci/hda/hda_hwdep.c | 32 ++++++++++++++++---------------- 4 files changed, 33 insertions(+), 33 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt index 9c51e104546f..f590850c149f 100644 --- a/Documentation/sound/alsa/HD-Audio.txt +++ b/Documentation/sound/alsa/HD-Audio.txt @@ -371,16 +371,16 @@ hints:: not used. init_pin_configs:: Shows the initial pin default config values set by BIOS. -override_pin_configs:: - Shows the pin default config values to override the BIOS setup. - Writing this (with two numbers, NID and value) appends the new - value. The given will be used instead of the initial BIOS value at - the next reconfiguration time. -cur_pin_configs:: +driver_pin_configs:: Shows the pin default values set by the codec parser explicitly. This doesn't show all pin values but only the changed values by the parser. That is, if the parser doesn't change the pin default config values by itself, this will contain nothing. +user_pin_configs:: + Shows the pin default config values to override the BIOS setup. + Writing this (with two numbers, NID and value) appends the new + value. The given will be used instead of the initial BIOS value at + the next reconfiguration time. reconfig:: Triggers the codec re-configuration. When any value is written to this file, the driver re-initialize and parses the codec tree diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 8ec2dfca9a6c..df9453d0122e 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -755,7 +755,7 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, unsigned int cfg) { - return snd_hda_add_pincfg(codec, &codec->cur_pins, nid, cfg); + return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); } EXPORT_SYMBOL_HDA(snd_hda_codec_set_pincfg); @@ -764,11 +764,11 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) { struct hda_pincfg *pin; - pin = look_up_pincfg(codec, &codec->cur_pins, nid); + pin = look_up_pincfg(codec, &codec->driver_pins, nid); if (pin) return pin->cfg; #ifdef CONFIG_SND_HDA_HWDEP - pin = look_up_pincfg(codec, &codec->override_pins, nid); + pin = look_up_pincfg(codec, &codec->user_pins, nid); if (pin) return pin->cfg; #endif @@ -797,12 +797,12 @@ static void free_hda_cache(struct hda_cache_rec *cache); /* restore the initial pin cfgs and release all pincfg lists */ static void restore_init_pincfgs(struct hda_codec *codec) { - /* first free cur_pins and override_pins, then call restore_pincfg + /* first free driver_pins and user_pins, then call restore_pincfg * so that only the values in init_pins are restored */ - snd_array_free(&codec->cur_pins); + snd_array_free(&codec->driver_pins); #ifdef CONFIG_SND_HDA_HWDEP - snd_array_free(&codec->override_pins); + snd_array_free(&codec->user_pins); #endif restore_pincfgs(codec); snd_array_free(&codec->init_pins); @@ -874,7 +874,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->cur_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); if (codec->bus->modelname) { codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); if (!codec->modelname) { @@ -1463,8 +1463,8 @@ void snd_hda_codec_reset(struct hda_codec *codec) free_hda_cache(&codec->cmd_cache); init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); - /* free only cur_pins so that init_pins + override_pins are restored */ - snd_array_free(&codec->cur_pins); + /* free only driver_pins so that init_pins + user_pins are restored */ + snd_array_free(&codec->driver_pins); restore_pincfgs(codec); codec->num_pcms = 0; codec->pcm_info = NULL; diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 6d01a8058f0a..2ea628478a91 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -779,13 +779,13 @@ struct hda_codec { unsigned int spdif_in_enable; /* SPDIF input enable? */ hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ struct snd_array init_pins; /* initial (BIOS) pin configurations */ - struct snd_array cur_pins; /* current pin configurations */ + struct snd_array driver_pins; /* pin configs set by codec parser */ #ifdef CONFIG_SND_HDA_HWDEP struct snd_hwdep *hwdep; /* assigned hwdep device */ struct snd_array init_verbs; /* additional init verbs */ struct snd_array hints; /* additional hints */ - struct snd_array override_pins; /* default pin configs to override */ + struct snd_array user_pins; /* default pin configs to override */ #endif /* misc flags */ diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 71039a6dec28..c660383ef381 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -109,7 +109,7 @@ static void clear_hwdep_elements(struct hda_codec *codec) for (i = 0; i < codec->hints.used; i++, head++) kfree(*head); snd_array_free(&codec->hints); - snd_array_free(&codec->override_pins); + snd_array_free(&codec->user_pins); } static void hwdep_free(struct snd_hwdep *hwdep) @@ -142,7 +142,7 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); snd_array_init(&codec->hints, sizeof(char *), 32); - snd_array_init(&codec->override_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16); return 0; } @@ -340,29 +340,29 @@ static ssize_t init_pin_configs_show(struct device *dev, return pin_configs_show(codec, &codec->init_pins, buf); } -static ssize_t override_pin_configs_show(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t user_pin_configs_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct snd_hwdep *hwdep = dev_get_drvdata(dev); struct hda_codec *codec = hwdep->private_data; - return pin_configs_show(codec, &codec->override_pins, buf); + return pin_configs_show(codec, &codec->user_pins, buf); } -static ssize_t cur_pin_configs_show(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t driver_pin_configs_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct snd_hwdep *hwdep = dev_get_drvdata(dev); struct hda_codec *codec = hwdep->private_data; - return pin_configs_show(codec, &codec->cur_pins, buf); + return pin_configs_show(codec, &codec->driver_pins, buf); } #define MAX_PIN_CONFIGS 32 -static ssize_t override_pin_configs_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t user_pin_configs_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { struct snd_hwdep *hwdep = dev_get_drvdata(dev); struct hda_codec *codec = hwdep->private_data; @@ -373,7 +373,7 @@ static ssize_t override_pin_configs_store(struct device *dev, return -EINVAL; if (!nid) return -EINVAL; - err = snd_hda_add_pincfg(codec, &codec->override_pins, nid, cfg); + err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg); if (err < 0) return err; return count; @@ -397,8 +397,8 @@ static struct device_attribute codec_attrs[] = { CODEC_ATTR_WO(init_verbs), CODEC_ATTR_WO(hints), CODEC_ATTR_RO(init_pin_configs), - CODEC_ATTR_RW(override_pin_configs), - CODEC_ATTR_RO(cur_pin_configs), + CODEC_ATTR_RW(user_pin_configs), + CODEC_ATTR_RO(driver_pin_configs), CODEC_ATTR_WO(reconfig), CODEC_ATTR_WO(clear), }; -- cgit v1.2.3 From 5e7b8e0d87091ae21b291588817b5359a5e00795 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Feb 2009 09:45:59 +0100 Subject: ALSA: hda - Make user_pin overriding the driver setup Make user_pin overriding even the driver pincfg, e.g. the static / fixed pin config table in patch_sigmatel.c. Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio.txt | 3 ++- sound/pci/hda/hda_codec.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt index f590850c149f..a4e5ef87af6b 100644 --- a/Documentation/sound/alsa/HD-Audio.txt +++ b/Documentation/sound/alsa/HD-Audio.txt @@ -380,7 +380,8 @@ user_pin_configs:: Shows the pin default config values to override the BIOS setup. Writing this (with two numbers, NID and value) appends the new value. The given will be used instead of the initial BIOS value at - the next reconfiguration time. + the next reconfiguration time. Note that this config will override + even the driver pin configs, too. reconfig:: Triggers the codec re-configuration. When any value is written to this file, the driver re-initialize and parses the codec tree diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index df9453d0122e..a13480fa8e74 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -739,7 +739,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, hda_nid_t nid, unsigned int cfg) { struct hda_pincfg *pin; + unsigned int oldcfg; + oldcfg = snd_hda_codec_get_pincfg(codec, nid); pin = look_up_pincfg(codec, list, nid); if (!pin) { pin = snd_array_new(list); @@ -748,7 +750,13 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, pin->nid = nid; } pin->cfg = cfg; - set_pincfg(codec, nid, cfg); + + /* change only when needed; e.g. if the pincfg is already present + * in user_pins[], don't write it + */ + cfg = snd_hda_codec_get_pincfg(codec, nid); + if (oldcfg != cfg) + set_pincfg(codec, nid, cfg); return 0; } @@ -764,14 +772,14 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) { struct hda_pincfg *pin; - pin = look_up_pincfg(codec, &codec->driver_pins, nid); - if (pin) - return pin->cfg; #ifdef CONFIG_SND_HDA_HWDEP pin = look_up_pincfg(codec, &codec->user_pins, nid); if (pin) return pin->cfg; #endif + pin = look_up_pincfg(codec, &codec->driver_pins, nid); + if (pin) + return pin->cfg; pin = look_up_pincfg(codec, &codec->init_pins, nid); if (pin) return pin->cfg; -- cgit v1.2.3 From 13c989beba166b470b1e6b0fa117148bcbfa3dd1 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Feb 2009 11:33:34 +0100 Subject: ALSA: hda - Don't give over 0dB volume for AD1984A HP laptops Set the upper limit 0dB to the volume of mixer amp 0x20 for AD1984A HP laptops. The overloaded volume may damage the internal speaker. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2c58d7b05aba..b16802841468 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3986,6 +3986,14 @@ static int patch_ad1884a(struct hda_codec *codec) spec->multiout.dig_out_nid = 0; codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; codec->patch_ops.init = ad1884a_hp_init; + /* set the upper-limit for mixer amp to 0dB for avoiding the + * possible damage by overloading + */ + snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, + (0x17 << AC_AMPCAP_OFFSET_SHIFT) | + (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | + (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | + (1 << AC_AMPCAP_MUTE_SHIFT)); break; case AD1884A_THINKPAD: spec->mixers[0] = ad1984a_thinkpad_mixers; -- cgit v1.2.3 From a65d629ceb4cff5e7d5edadfd6bf1f64c370a517 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Feb 2009 16:57:04 +0100 Subject: ALSA: hda - Add pseudo device-locking for clear/reconfig Added the pseudo device-locking using card->shutdown flag to avoid the crash via clear/reconfig during operations. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 54 +++++++++++++++++++++++++++++++++++++++++++---- sound/pci/hda/hda_hwdep.c | 15 +++++++++++-- sound/pci/hda/hda_local.h | 2 +- 3 files changed, 64 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index a13480fa8e74..5dceee8a113b 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1445,9 +1445,52 @@ void snd_hda_ctls_clear(struct hda_codec *codec) snd_array_free(&codec->mixers); } -void snd_hda_codec_reset(struct hda_codec *codec) +/* pseudo device locking + * toggle card->shutdown to allow/disallow the device access (as a hack) + */ +static int hda_lock_devices(struct snd_card *card) { - int i; + spin_lock(&card->files_lock); + if (card->shutdown) { + spin_unlock(&card->files_lock); + return -EINVAL; + } + card->shutdown = 1; + spin_unlock(&card->files_lock); + return 0; +} + +static void hda_unlock_devices(struct snd_card *card) +{ + spin_lock(&card->files_lock); + card->shutdown = 0; + spin_unlock(&card->files_lock); +} + +int snd_hda_codec_reset(struct hda_codec *codec) +{ + struct snd_card *card = codec->bus->card; + int i, pcm; + + if (hda_lock_devices(card) < 0) + return -EBUSY; + /* check whether the codec isn't used by any mixer or PCM streams */ + if (!list_empty(&card->ctl_files)) { + hda_unlock_devices(card); + return -EBUSY; + } + for (pcm = 0; pcm < codec->num_pcms; pcm++) { + struct hda_pcm *cpcm = &codec->pcm_info[pcm]; + if (!cpcm->pcm) + continue; + if (cpcm->pcm->streams[0].substream_opened || + cpcm->pcm->streams[1].substream_opened) { + hda_unlock_devices(card); + return -EBUSY; + } + } + + /* OK, let it free */ #ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); @@ -1457,8 +1500,7 @@ void snd_hda_codec_reset(struct hda_codec *codec) /* relase PCMs */ for (i = 0; i < codec->num_pcms; i++) { if (codec->pcm_info[i].pcm) { - snd_device_free(codec->bus->card, - codec->pcm_info[i].pcm); + snd_device_free(card, codec->pcm_info[i].pcm); clear_bit(codec->pcm_info[i].device, codec->bus->pcm_dev_bits); } @@ -1479,6 +1521,10 @@ void snd_hda_codec_reset(struct hda_codec *codec) codec->preset = NULL; module_put(codec->owner); codec->owner = NULL; + + /* allow device access again */ + hda_unlock_devices(card); + return 0; } #endif /* CONFIG_SND_HDA_RECONFIG */ diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index c660383ef381..4af484b8240c 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -155,7 +155,13 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) static int clear_codec(struct hda_codec *codec) { - snd_hda_codec_reset(codec); + int err; + + err = snd_hda_codec_reset(codec); + if (err < 0) { + snd_printk(KERN_ERR "The codec is being used, can't free.\n"); + return err; + } clear_hwdep_elements(codec); return 0; } @@ -165,7 +171,12 @@ static int reconfig_codec(struct hda_codec *codec) int err; snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); - snd_hda_codec_reset(codec); + err = snd_hda_codec_reset(codec); + if (err < 0) { + snd_printk(KERN_ERR + "The codec is being used, can't reconfigure.\n"); + return err; + } err = snd_hda_codec_configure(codec); if (err < 0) return err; diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 84e2cf644fd7..4bd82a37a4c8 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -98,7 +98,7 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, const char *name); int snd_hda_add_vmaster(struct hda_codec *codec, char *name, unsigned int *tlv, const char **slaves); -void snd_hda_codec_reset(struct hda_codec *codec); +int snd_hda_codec_reset(struct hda_codec *codec); int snd_hda_codec_configure(struct hda_codec *codec); /* amp value bits */ -- cgit v1.2.3 From 1f9da5544073d38e05139f8ce9da24e78653c73e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 24 Feb 2009 15:31:02 +0100 Subject: ALSA: emu10k1 - Fix digital/analog switch on audigy2 ZS Fix the inverted logic of shared spdif switch. Reference: Novell bnc#478496 https://bugzilla.novell.com/show_bug.cgi?id=478496 Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emu10k1_main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 7958006a1d66..101a1c13a20d 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -1528,6 +1528,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0151_chip = 1, .spk71 = 1, .spdif_bug = 1, + .invert_shared_spdif = 1, /* digital/analog switch swapped */ .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]", -- cgit v1.2.3 From 873dc78a8676b7ba6260b1d74c50d8ea5025ecbe Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 25 Feb 2009 18:12:13 +0100 Subject: ALSA: hda - Clean up / fix quirks for HP laptops with AD1984A Use SND_PCI_QUIRK_MASK() to clean up / support better HP laptops with AD1984A codec. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 0253cb93aa7f..5bb48ee8b6c6 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3923,9 +3923,8 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x3070, "HP", AD1884A_MOBILE), - SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), - SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), + SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30e0, "HP laptop", AD1884A_LAPTOP), + SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), {} }; -- cgit v1.2.3 From f872a9194cb006994d47a58efc875218594e6072 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 26 Feb 2009 00:57:01 +0100 Subject: ALSA: hda - Clean up / fix quirk for Sony laptops with ALC262 Clean up / fix quirk entries for Sony laptops with ALC262 codec using NSD_PCI_QUIRK_MASK(). This also fixes the kernel bug #12780 http://bugme.linux-foundation.org/show_bug.cgi?id=12780 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 50ae8f33af5f..d670d33cfa17 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10824,10 +10824,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), - SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), - SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), - SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", - ALC262_SONY_ASSAMD), + SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", + ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", ALC262_TOSHIBA_RX1), SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), -- cgit v1.2.3 From 930738de602d2ceb0d1c1b368fe2a8d2a974ab72 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 26 Feb 2009 09:27:20 +0100 Subject: sound: virtuoso: add Xonar Essence STX support Add support for the Asus Xonar Essence STX sound card. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/ALSA-Configuration.txt | 2 +- sound/pci/Kconfig | 3 +- sound/pci/oxygen/virtuoso.c | 192 ++++++++++++++++++++++++ 3 files changed, 195 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 841a9365d5fd..1356d2a6772b 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt @@ -1824,7 +1824,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ------------------- Module for sound cards based on the Asus AV100/AV200 chips, - i.e., Xonar D1, DX, D2, D2X and HDAV1.3 (Deluxe). + i.e., Xonar D1, DX, D2, D2X, HDAV1.3 (Deluxe), and Essence STX. This module supports autoprobe and multiple cards. diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 82b9bddcdcd6..21d117ada84b 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -744,7 +744,8 @@ config SND_VIRTUOSO select SND_OXYGEN_LIB help Say Y here to include support for sound cards based on the - Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2 and D2X. + Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, and + Essence STX. Support for the HDAV1.3 (Deluxe) is very experimental. To compile this driver as a module, choose M here: the module diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 00dc97806f1b..bc5ce11c8b14 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -112,6 +112,34 @@ * CS4362A: AD0 <- 0 */ +/* + * Xonar Essence STX + * ----------------- + * + * CMI8788: + * + * I²C <-> PCM1792A + * + * GPI 0 <- external power present + * + * GPIO 0 -> enable output to speakers + * GPIO 1 -> route HP to front panel (0) or rear jack (1) + * GPIO 2 -> M0 of CS5381 + * GPIO 3 -> M1 of CS5381 + * GPIO 7 -> route output to speaker jacks (0) or HP (1) + * GPIO 8 -> route input jack to line-in (0) or mic-in (1) + * + * PCM1792A: + * + * AD0 <- 0 + * + * H6 daughterboard + * ---------------- + * + * GPIO 4 <- 0 + * GPIO 5 <- 0 + */ + #include #include #include @@ -152,6 +180,7 @@ enum { MODEL_DX, MODEL_HDAV, /* without daughterboard */ MODEL_HDAV_H6, /* with H6 daughterboard */ + MODEL_STX, }; static struct pci_device_id xonar_ids[] __devinitdata = { @@ -160,6 +189,7 @@ static struct pci_device_id xonar_ids[] __devinitdata = { { OXYGEN_PCI_SUBID(0x1043, 0x82b7), .driver_data = MODEL_D2X }, { OXYGEN_PCI_SUBID(0x1043, 0x8314), .driver_data = MODEL_HDAV }, { OXYGEN_PCI_SUBID(0x1043, 0x834f), .driver_data = MODEL_D1 }, + { OXYGEN_PCI_SUBID(0x1043, 0x835c), .driver_data = MODEL_STX }, { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, { } }; @@ -184,6 +214,9 @@ MODULE_DEVICE_TABLE(pci, xonar_ids); #define GPIO_HDAV_DB_H6 0x0000 #define GPIO_HDAV_DB_XX 0x0020 +#define GPIO_ST_HP_REAR 0x0002 +#define GPIO_ST_HP 0x0080 + #define I2C_DEVICE_PCM1796(i) (0x98 + ((i) << 1)) /* 10011, ADx=i, /W=0 */ #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ #define I2C_DEVICE_CS4362A 0x30 /* 001100, AD0=0, /W=0 */ @@ -497,6 +530,36 @@ static void xonar_hdav_init(struct oxygen *chip) snd_component_add(chip->card, "CS5381"); } +static void xonar_stx_init(struct oxygen *chip) +{ + struct xonar_data *data = chip->model_data; + + oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, + OXYGEN_2WIRE_LENGTH_8 | + OXYGEN_2WIRE_INTERRUPT_MASK | + OXYGEN_2WIRE_SPEED_FAST); + + data->anti_pop_delay = 100; + data->dacs = 1; + data->output_enable_bit = GPIO_DX_OUTPUT_ENABLE; + data->ext_power_reg = OXYGEN_GPI_DATA; + data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; + data->ext_power_bit = GPI_DX_EXT_POWER; + data->pcm1796_oversampling = PCM1796_OS_64; + + pcm1796_init(chip); + + oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, + GPIO_DX_INPUT_ROUTE | GPIO_ST_HP_REAR | GPIO_ST_HP); + oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, + GPIO_DX_INPUT_ROUTE | GPIO_ST_HP_REAR | GPIO_ST_HP); + + xonar_common_init(chip); + + snd_component_add(chip->card, "PCM1792A"); + snd_component_add(chip->card, "CS5381"); +} + static void xonar_disable_output(struct oxygen *chip) { struct xonar_data *data = chip->model_data; @@ -524,6 +587,11 @@ static void xonar_hdav_cleanup(struct oxygen *chip) xonar_disable_output(chip); } +static void xonar_st_cleanup(struct oxygen *chip) +{ + xonar_disable_output(chip); +} + static void xonar_d2_suspend(struct oxygen *chip) { xonar_d2_cleanup(chip); @@ -540,6 +608,11 @@ static void xonar_hdav_suspend(struct oxygen *chip) msleep(2); } +static void xonar_st_suspend(struct oxygen *chip) +{ + xonar_st_cleanup(chip); +} + static void xonar_d2_resume(struct oxygen *chip) { pcm1796_init(chip); @@ -567,6 +640,12 @@ static void xonar_hdav_resume(struct oxygen *chip) xonar_enable_output(chip); } +static void xonar_st_resume(struct oxygen *chip) +{ + pcm1796_init(chip); + xonar_enable_output(chip); +} + static void xonar_hdav_pcm_hardware_filter(unsigned int channel, struct snd_pcm_hardware *hardware) { @@ -746,6 +825,72 @@ static const struct snd_kcontrol_new front_panel_switch = { .private_value = GPIO_DX_FRONT_PANEL, }; +static int st_output_switch_info(struct snd_kcontrol *ctl, + struct snd_ctl_elem_info *info) +{ + static const char *const names[3] = { + "Speakers", "Headphones", "FP Headphones" + }; + + info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; + info->count = 1; + info->value.enumerated.items = 3; + if (info->value.enumerated.item >= 3) + info->value.enumerated.item = 2; + strcpy(info->value.enumerated.name, names[info->value.enumerated.item]); + return 0; +} + +static int st_output_switch_get(struct snd_kcontrol *ctl, + struct snd_ctl_elem_value *value) +{ + struct oxygen *chip = ctl->private_data; + u16 gpio; + + gpio = oxygen_read16(chip, OXYGEN_GPIO_DATA); + if (!(gpio & GPIO_ST_HP)) + value->value.enumerated.item[0] = 0; + else if (gpio & GPIO_ST_HP_REAR) + value->value.enumerated.item[0] = 1; + else + value->value.enumerated.item[0] = 2; + return 0; +} + + +static int st_output_switch_put(struct snd_kcontrol *ctl, + struct snd_ctl_elem_value *value) +{ + struct oxygen *chip = ctl->private_data; + u16 gpio_old, gpio; + + mutex_lock(&chip->mutex); + gpio_old = oxygen_read16(chip, OXYGEN_GPIO_DATA); + gpio = gpio_old; + switch (value->value.enumerated.item[0]) { + case 0: + gpio &= ~(GPIO_ST_HP | GPIO_ST_HP_REAR); + break; + case 1: + gpio |= GPIO_ST_HP | GPIO_ST_HP_REAR; + break; + case 2: + gpio = (gpio | GPIO_ST_HP) & ~GPIO_ST_HP_REAR; + break; + } + oxygen_write16(chip, OXYGEN_GPIO_DATA, gpio); + mutex_unlock(&chip->mutex); + return gpio != gpio_old; +} + +static const struct snd_kcontrol_new st_output_switch = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Analog Output", + .info = st_output_switch_info, + .get = st_output_switch_get, + .put = st_output_switch_put, +}; + static void xonar_line_mic_ac97_switch(struct oxygen *chip, unsigned int reg, unsigned int mute) { @@ -776,6 +921,15 @@ static int xonar_d1_control_filter(struct snd_kcontrol_new *template) return 0; } +static int xonar_st_control_filter(struct snd_kcontrol_new *template) +{ + if (!strncmp(template->name, "CD Capture ", 11)) + return 1; /* no CD input */ + if (!strcmp(template->name, "Stereo Upmixing")) + return 1; /* stereo only - we don't need upmixing */ + return 0; +} + static int xonar_d2_mixer_init(struct oxygen *chip) { return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); @@ -786,6 +940,11 @@ static int xonar_d1_mixer_init(struct oxygen *chip) return snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip)); } +static int xonar_st_mixer_init(struct oxygen *chip) +{ + return snd_ctl_add(chip->card, snd_ctl_new1(&st_output_switch, chip)); +} + static const struct oxygen_model model_xonar_d2 = { .longname = "Asus Virtuoso 200", .chip = "AV200", @@ -872,6 +1031,33 @@ static const struct oxygen_model model_xonar_hdav = { .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, }; +static const struct oxygen_model model_xonar_st = { + .longname = "Asus Virtuoso 100", + .chip = "AV200", + .init = xonar_stx_init, + .control_filter = xonar_st_control_filter, + .mixer_init = xonar_st_mixer_init, + .cleanup = xonar_st_cleanup, + .suspend = xonar_st_suspend, + .resume = xonar_st_resume, + .set_dac_params = set_pcm1796_params, + .set_adc_params = set_cs53x1_params, + .update_dac_volume = update_pcm1796_volume, + .update_dac_mute = update_pcm1796_mute, + .ac97_switch = xonar_line_mic_ac97_switch, + .dac_tlv = pcm1796_db_scale, + .model_data_size = sizeof(struct xonar_data), + .device_config = PLAYBACK_0_TO_I2S | + PLAYBACK_1_TO_SPDIF | + CAPTURE_0_FROM_I2S_2, + .dac_channels = 2, + .dac_volume_min = 255 - 2*60, + .dac_volume_max = 255, + .function_flags = OXYGEN_FUNCTION_2WIRE, + .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, + .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, +}; + static int __devinit get_xonar_model(struct oxygen *chip, const struct pci_device_id *id) { @@ -881,6 +1067,7 @@ static int __devinit get_xonar_model(struct oxygen *chip, [MODEL_D2] = &model_xonar_d2, [MODEL_D2X] = &model_xonar_d2, [MODEL_HDAV] = &model_xonar_hdav, + [MODEL_STX] = &model_xonar_st, }; static const char *const names[] = { [MODEL_D1] = "Xonar D1", @@ -889,6 +1076,7 @@ static int __devinit get_xonar_model(struct oxygen *chip, [MODEL_D2X] = "Xonar D2X", [MODEL_HDAV] = "Xonar HDAV1.3", [MODEL_HDAV_H6] = "Xonar HDAV1.3+H6", + [MODEL_STX] = "Xonar Essence STX", }; unsigned int model = id->driver_data; @@ -916,6 +1104,10 @@ static int __devinit get_xonar_model(struct oxygen *chip, return -ENODEV; } break; + case MODEL_STX: + oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, + GPIO_HDAV_DB_MASK); + break; } chip->model.shortname = names[model]; -- cgit v1.2.3 From 5d44aa4c7322e0cda6d71cc3f0dffaceea0daae5 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:29:29 +0100 Subject: sound/oss: fix sparse warnings: different signedness Impact: Change signature of 'set_volume_stereo' and 'set_volume_mono'. Fix this sparse warnings: sound/oss/pss.c:545:42: warning: incorrect type in argument 2 (different signedness) sound/oss/pss.c:546:42: warning: incorrect type in argument 3 (different signedness) sound/oss/pss.c:554:59: warning: incorrect type in argument 2 (different signedness) sound/oss/pss.c:560:59: warning: incorrect type in argument 2 (different signedness) sound/oss/pss.c:566:59: warning: incorrect type in argument 2 (different signedness) Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/oss/pss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/oss/pss.c b/sound/oss/pss.c index 16ed06950dc1..16517a5a1301 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c @@ -457,10 +457,9 @@ static void pss_mixer_reset(pss_confdata *devc) } } -static int set_volume_mono(unsigned __user *p, int *aleft) +static int set_volume_mono(unsigned __user *p, unsigned int *aleft) { - int left; - unsigned volume; + unsigned int left, volume; if (get_user(volume, p)) return -EFAULT; @@ -471,10 +470,11 @@ static int set_volume_mono(unsigned __user *p, int *aleft) return 0; } -static int set_volume_stereo(unsigned __user *p, int *aleft, int *aright) +static int set_volume_stereo(unsigned __user *p, + unsigned int *aleft, + unsigned int *aright) { - int left, right; - unsigned volume; + unsigned int left, right, volume; if (get_user(volume, p)) return -EFAULT; -- cgit v1.2.3 From e5bf48437370f3fc603e2dce12e8d3fb1a6a2457 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:29:47 +0100 Subject: sound/oss: fix sparse warning: symbol shadows an earlier one Impact: Move variable to a more inner scope. Fix this sparse warning: sound/oss/sequencer.c:235:29: warning: symbol 'err' shadows an earlier one sound/oss/sequencer.c:215:13: originally declared here Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/oss/sequencer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 5c215f787ca9..c79874696bec 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c @@ -212,7 +212,6 @@ int sequencer_write(int dev, struct file *file, const char __user *buf, int coun { unsigned char event_rec[EV_SZ], ev_code; int p = 0, c, ev_size; - int err; int mode = translate_mode(file); dev = dev >> 4; @@ -285,7 +284,7 @@ int sequencer_write(int dev, struct file *file, const char __user *buf, int coun { if (!midi_opened[event_rec[2]]) { - int mode; + int err, mode; int dev = event_rec[2]; if (dev >= max_mididev || midi_devs[dev]==NULL) -- cgit v1.2.3 From 619389882ba37121d0f2f7b08e4944e47b379118 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:26:48 +0100 Subject: ALSA: sound/usb/usx2y: fix sparse warning: Should it be static? Impact: Move declaration to header file. Fix this sparse warning: sound/usb/usx2y/usx2yhwdeppcm.c:739:5: warning: symbol 'usX2Y_hwdep_pcm_new' was not declared. Should it be static? Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/usb/usx2y/usX2Yhwdep.c | 3 --- sound/usb/usx2y/usx2yhwdeppcm.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 1558a5c4094f..fc650c800afc 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -30,9 +30,6 @@ #include "usbusx2y.h" #include "usX2Yhwdep.h" -int usX2Y_hwdep_pcm_new(struct snd_card *card); - - static int snd_us428ctls_vm_fault(struct vm_area_struct *area, struct vm_fault *vmf) { diff --git a/sound/usb/usx2y/usx2yhwdeppcm.h b/sound/usb/usx2y/usx2yhwdeppcm.h index c3382fdc386b..9c4fb84b2aa0 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.h +++ b/sound/usb/usx2y/usx2yhwdeppcm.h @@ -18,3 +18,5 @@ struct snd_usX2Y_hwdep_pcm_shm { volatile unsigned captured_iso_frames; int capture_iso_start; }; + +int usX2Y_hwdep_pcm_new(struct snd_card *card); -- cgit v1.2.3 From 3a755ec2e8af0024a06a5adbcc81c012eae61782 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:28:26 +0100 Subject: ALSA: sound/usb/usx2y: fix sparse warning: do-while statement is not a compound ... Fix this sparse warning: sound/usb/usx2y/usbusx2y.c:231:33: warning: do-while statement is not a compound statement Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/usb/usx2y/usbusx2y.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index 11639bd72a51..c545a02dee48 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -227,9 +227,9 @@ static void i_usX2Y_In04Int(struct urb *urb) if (usX2Y->US04) { if (0 == usX2Y->US04->submitted) - do + do { err = usb_submit_urb(usX2Y->US04->urb[usX2Y->US04->submitted++], GFP_ATOMIC); - while (!err && usX2Y->US04->submitted < usX2Y->US04->len); + } while (!err && usX2Y->US04->submitted < usX2Y->US04->len); } else if (us428ctls && us428ctls->p4outLast >= 0 && us428ctls->p4outLast < N_us428_p4out_BUFS) { if (us428ctls->p4outLast != us428ctls->p4outSent) { -- cgit v1.2.3 From d73d341d3995ae3c63a4b4543b7c308ebd1e58ea Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:29:15 +0100 Subject: ALSA: sound/drivers/vx: fix sparse warning: different signedness Fix this sparse warning: sound/drivers/vx/vx_uer.c:301:42: warning: incorrect type in argument 2 (different signedness) Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/drivers/vx/vx_uer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c index 0e1ba9b47904..b0560fec6bba 100644 --- a/sound/drivers/vx/vx_uer.c +++ b/sound/drivers/vx/vx_uer.c @@ -103,7 +103,7 @@ static void vx_write_one_cbit(struct vx_core *chip, int index, int val) * returns the frequency of UER, or 0 if not sync, * or a negative error code. */ -static int vx_read_uer_status(struct vx_core *chip, int *mode) +static int vx_read_uer_status(struct vx_core *chip, unsigned int *mode) { int val, freq; -- cgit v1.2.3 From 730d45f9130f81fd49009301e9dfbd19fe2b3e1f Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:28:59 +0100 Subject: ALSA: sound/pci/emu10k1: fix sparse warning: different signedness Fix this sparse warnings: sound/pci/emu10k1/emu10k1_main.c:723:66: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:724:68: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:748:74: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:751:66: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:759:73: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:760:73: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:837:50: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:845:50: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:881:50: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:889:57: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:890:57: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:895:60: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:897:60: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:899:60: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:910:56: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:914:57: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:918:56: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:922:57: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:924:58: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:936:60: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:1073:60: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:1088:60: warning: incorrect type in argument 3 (different signedness) sound/pci/emu10k1/emu10k1_main.c:1093:58: warning: incorrect type in argument 3 (different signedness) Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emu10k1_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 8343aecbd25f..e6836fc33880 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -711,8 +711,7 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filena static int emu1010_firmware_thread(void *data) { struct snd_emu10k1 *emu = data; - int tmp, tmp2; - int reg; + u32 tmp, tmp2, reg; int err; for (;;) { @@ -758,7 +757,7 @@ static int emu1010_firmware_thread(void *data) snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); - snd_printk(KERN_INFO "Audio Dock ver:%d.%d\n", + snd_printk(KERN_INFO "Audio Dock ver: %u.%u\n", tmp, tmp2); /* Sync clocking between 1010 and Dock */ /* Allow DLL to settle */ @@ -805,8 +804,7 @@ static int emu1010_firmware_thread(void *data) static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) { unsigned int i; - int tmp, tmp2; - int reg; + u32 tmp, tmp2, reg; int err; const char *filename = NULL; @@ -888,7 +886,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); - snd_printk(KERN_INFO "emu1010: Hana version: %d.%d\n", tmp, tmp2); + snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2); /* Enable 48Volt power to Audio Dock */ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); -- cgit v1.2.3 From 5d9b6c07831456b7a7d90eac31c853d60eaf8ab6 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Wed, 25 Feb 2009 22:28:45 +0100 Subject: ALSA: sound/pci/hda: fix sparse warning: different signedness Fix this sparse warning: sound/pci/hda/hda_codec.c:1544:19: warning: incorrect type in assignment (different signedness) sound/pci/hda/hda_codec.c:1544:19: expected unsigned long *vals sound/pci/hda/hda_codec.c:1544:19: got long * Signed-off-by: Hannes Eder Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_local.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 4bd82a37a4c8..03ee9dd04913 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -136,7 +136,7 @@ extern struct hda_ctl_ops snd_hda_bind_sw; /* for bind-switch */ struct hda_bind_ctls { struct hda_ctl_ops *ops; - long values[]; + unsigned long values[]; }; int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol, -- cgit v1.2.3 From 23f0c048ba59ad5c2f3fd85ed98360b631dbf6f8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 26 Feb 2009 13:03:58 +0100 Subject: ALSA: hda - Clean up the input pin setup in automatic mode Clean up the input-pin setup in automatic mode in patch_realtek.c. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 62 ++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d670d33cfa17..b3406302d069 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -760,6 +760,24 @@ static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, .private_value = nid | (mask<<16) } #endif /* CONFIG_SND_DEBUG */ +/* + * set up the input pin config (depending on the given auto-pin type) + */ +static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, + int auto_pin_type) +{ + unsigned int val = PIN_IN; + + if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { + unsigned int pincap; + pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; + if (pincap & AC_PINCAP_VREF_80) + val = PIN_VREF80; + } + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); +} + /* */ static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) @@ -4188,10 +4206,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc880_is_input_pin(nid)) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - i <= AUTO_PIN_FRONT_MIC ? - PIN_VREF80 : PIN_IN); + alc_set_input_pin(codec, nid, i); if (nid != ALC880_PIN_CD_NID) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, @@ -5657,10 +5672,7 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; if (nid >= 0x12) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - i <= AUTO_PIN_FRONT_MIC ? - PIN_VREF80 : PIN_IN); + alc_set_input_pin(codec, nid, i); if (nid != ALC260_PIN_CD_NID) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, @@ -7006,16 +7018,7 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) unsigned int vref; if (!nid) continue; - vref = PIN_IN; - if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { - unsigned int pincap; - pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); - if ((pincap >> AC_PINCAP_VREF_SHIFT) & - AC_PINCAP_VREF_80) - vref = PIN_VREF80; - } - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, vref); + alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, @@ -9100,10 +9103,7 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc883_is_input_pin(nid)) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - (i <= AUTO_PIN_FRONT_MIC ? - PIN_VREF80 : PIN_IN)); + alc_set_input_pin(codec, nid, i); if (nid != ALC883_PIN_CD_NID) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, @@ -13831,12 +13831,8 @@ static void alc861_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; - if (nid >= 0x0c && nid <= 0x11) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - i <= AUTO_PIN_FRONT_MIC ? - PIN_VREF80 : PIN_IN); - } + if (nid >= 0x0c && nid <= 0x11) + alc_set_input_pin(codec, nid, i); } } @@ -14803,10 +14799,7 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc861vd_is_input_pin(nid)) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - i <= AUTO_PIN_FRONT_MIC ? - PIN_VREF80 : PIN_IN); + alc_set_input_pin(codec, nid, i); if (nid != ALC861VD_PIN_CD_NID) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, @@ -16732,10 +16725,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc662_is_input_pin(nid)) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - (i <= AUTO_PIN_FRONT_MIC ? - PIN_VREF80 : PIN_IN)); + alc_set_input_pin(codec, nid, i); if (nid != ALC662_PIN_CD_NID) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, -- cgit v1.2.3 From 1607b8ea0a4cc20752978fadb027daafc8a2d93c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 26 Feb 2009 16:50:43 +0100 Subject: ALSA: hda - Add model=auto for STAC/IDT codecs Added the model=auto to STAC/IDT codecs to use the BIOS default setup explicitly. It can be used to disable the device-specific model quirk in the driver. Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 8 ++++++++ sound/pci/hda/patch_sigmatel.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 0e52d273ce96..a448bbefd488 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -280,6 +280,7 @@ STAC9200 gateway-m4 Gateway laptops with EAPD control gateway-m4-2 Gateway laptops with EAPD control panasonic Panasonic CF-74 + auto BIOS setup (default) STAC9205/9254 ============= @@ -288,6 +289,7 @@ STAC9205/9254 dell-m43 Dell Precision dell-m44 Dell Inspiron eapd Keep EAPD on (e.g. Gateway T1616) + auto BIOS setup (default) STAC9220/9221 ============= @@ -311,6 +313,7 @@ STAC9220/9221 dell-d82 Dell (unknown) dell-m81 Dell (unknown) dell-m82 Dell XPS M1210 + auto BIOS setup (default) STAC9202/9250/9251 ================== @@ -322,6 +325,7 @@ STAC9202/9250/9251 m3 Some Gateway MX series laptops m5 Some Gateway MX series laptops (MP6954) m6 Some Gateway NX series laptops + auto BIOS setup (default) STAC9227/9228/9229/927x ======================= @@ -331,6 +335,7 @@ STAC9227/9228/9229/927x 5stack D965 5stack + SPDIF dell-3stack Dell Dimension E520 dell-bios Fixes with Dell BIOS setup + auto BIOS setup (default) STAC92HD71B* ============ @@ -339,6 +344,7 @@ STAC92HD71B* dell-m4-2 Dell desktops dell-m4-3 Dell desktops hp-m4 HP dv laptops + auto BIOS setup (default) STAC92HD73* =========== @@ -348,11 +354,13 @@ STAC92HD73* dell-m6-dmic Dell desktops/laptops with digital mics dell-m6 Dell desktops/laptops with both type of mics dell-eq Dell desktops/laptops + auto BIOS setup (default) STAC92HD83* =========== ref Reference board mic-ref Reference board with power managment for ports + auto BIOS setup (default) STAC9872 ======== diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index da48d8c0b295..37ffd96a9ff2 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -43,6 +43,7 @@ enum { }; enum { + STAC_AUTO, STAC_REF, STAC_9200_OQO, STAC_9200_DELL_D21, @@ -62,6 +63,7 @@ enum { }; enum { + STAC_9205_AUTO, STAC_9205_REF, STAC_9205_DELL_M42, STAC_9205_DELL_M43, @@ -71,6 +73,7 @@ enum { }; enum { + STAC_92HD73XX_AUTO, STAC_92HD73XX_NO_JD, /* no jack-detection */ STAC_92HD73XX_REF, STAC_DELL_M6_AMIC, @@ -81,6 +84,7 @@ enum { }; enum { + STAC_92HD83XXX_AUTO, STAC_92HD83XXX_REF, STAC_92HD83XXX_PWR_REF, STAC_DELL_S14, @@ -88,6 +92,7 @@ enum { }; enum { + STAC_92HD71BXX_AUTO, STAC_92HD71BXX_REF, STAC_DELL_M4_1, STAC_DELL_M4_2, @@ -98,6 +103,7 @@ enum { }; enum { + STAC_925x_AUTO, STAC_925x_REF, STAC_M1, STAC_M1_2, @@ -110,6 +116,7 @@ enum { }; enum { + STAC_922X_AUTO, STAC_D945_REF, STAC_D945GTP3, STAC_D945GTP5, @@ -137,6 +144,7 @@ enum { }; enum { + STAC_927X_AUTO, STAC_D965_REF_NO_JD, /* no jack-detection */ STAC_D965_REF, STAC_D965_3ST, @@ -1488,6 +1496,7 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { }; static const char *stac9200_models[STAC_9200_MODELS] = { + [STAC_AUTO] = "auto", [STAC_REF] = "ref", [STAC_9200_OQO] = "oqo", [STAC_9200_DELL_D21] = "dell-d21", @@ -1633,6 +1642,7 @@ static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { }; static const char *stac925x_models[STAC_925x_MODELS] = { + [STAC_925x_AUTO] = "auto", [STAC_REF] = "ref", [STAC_M1] = "m1", [STAC_M1_2] = "m1-2", @@ -1692,6 +1702,7 @@ static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { }; static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { + [STAC_92HD73XX_AUTO] = "auto", [STAC_92HD73XX_NO_JD] = "no-jd", [STAC_92HD73XX_REF] = "ref", [STAC_DELL_M6_AMIC] = "dell-m6-amic", @@ -1748,6 +1759,7 @@ static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { }; static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { + [STAC_92HD83XXX_AUTO] = "auto", [STAC_92HD83XXX_REF] = "ref", [STAC_92HD83XXX_PWR_REF] = "mic-ref", [STAC_DELL_S14] = "dell-s14", @@ -1802,6 +1814,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { }; static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { + [STAC_92HD71BXX_AUTO] = "auto", [STAC_92HD71BXX_REF] = "ref", [STAC_DELL_M4_1] = "dell-m4-1", [STAC_DELL_M4_2] = "dell-m4-2", @@ -1973,6 +1986,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { }; static const char *stac922x_models[STAC_922X_MODELS] = { + [STAC_922X_AUTO] = "auto", [STAC_D945_REF] = "ref", [STAC_D945GTP5] = "5stack", [STAC_D945GTP3] = "3stack", @@ -2125,6 +2139,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { }; static const char *stac927x_models[STAC_927X_MODELS] = { + [STAC_927X_AUTO] = "auto", [STAC_D965_REF_NO_JD] = "ref-no-jd", [STAC_D965_REF] = "ref", [STAC_D965_3ST] = "3stack", @@ -2222,6 +2237,7 @@ static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { }; static const char *stac9205_models[STAC_9205_MODELS] = { + [STAC_9205_AUTO] = "auto", [STAC_9205_REF] = "ref", [STAC_9205_DELL_M42] = "dell-m42", [STAC_9205_DELL_M43] = "dell-m43", -- cgit v1.2.3 From bedfcebb4fb33fc9ebd395462e72afa103db0bec Mon Sep 17 00:00:00 2001 From: peerchen Date: Fri, 27 Feb 2009 17:03:19 +0800 Subject: ALSA: hda - Add the Device IDs for MCP89 and remove IDs of MCP7B Added the Device IDs for MCP89 HD audio controller. Removed the IDs of MCP7B cause this chipset had been cancelled. Signed-off-by: Peer Chen Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c5a5dc5698a2..47a5833feb7a 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2454,10 +2454,10 @@ static struct pci_device_id azx_ids[] = { { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, - { PCI_DEVICE(0x10de, 0x0bd4), .driver_data = AZX_DRIVER_NVIDIA }, - { PCI_DEVICE(0x10de, 0x0bd5), .driver_data = AZX_DRIVER_NVIDIA }, - { PCI_DEVICE(0x10de, 0x0bd6), .driver_data = AZX_DRIVER_NVIDIA }, - { PCI_DEVICE(0x10de, 0x0bd7), .driver_data = AZX_DRIVER_NVIDIA }, + { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, + { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, + { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, + { PCI_DEVICE(0x10de, 0x0d97), .driver_data = AZX_DRIVER_NVIDIA }, /* Teradici */ { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, /* AMD Generic, PCI class code and Vendor ID for HD Audio */ -- cgit v1.2.3 From 82af308f658cf2193e5058bbbfd37c3437cfb4e7 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 27 Feb 2009 09:27:44 +0100 Subject: sound: oxygen: zero-initialize model data Model drivers assume that model_data is zeroed, so we better use kzalloc() (like we did before when it was allocated together with the card structure). Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 6e1cdd2fd768..312251d39696 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -566,7 +566,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, goto err_pci_regions; if (chip->model.model_data_size) { - chip->model_data = kmalloc(chip->model.model_data_size, + chip->model_data = kzalloc(chip->model.model_data_size, GFP_KERNEL); if (!chip->model_data) { err = -ENOMEM; -- cgit v1.2.3 From ea18aa464452c3e6550320d247c0306aaa2d156f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 27 Feb 2009 17:36:33 +0100 Subject: ALSA: hda - Fix digital mic on dell-m4-1 and dell-m4-3 Fix num_dmuxes initialization for dell-m4-1 and dell-m4-3 models of IDT 92HD71bxx codec, which was wrongly set to zero. Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 8027edf3c8f2..3bc427645da8 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4989,7 +4989,7 @@ again: case STAC_DELL_M4_3: spec->num_dmics = 1; spec->num_smuxes = 0; - spec->num_dmuxes = 0; + spec->num_dmuxes = 1; break; default: spec->num_dmics = STAC92HD71BXX_NUM_DMICS; -- cgit v1.2.3 From bb543c969467f33c3a1a0ccfcfcd9a508cd81c54 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 27 Feb 2009 17:44:07 +0100 Subject: ALSA: hda - Add quirk for new HP xw series Added model=hp-bpc for new HP xw series (103c:170b). Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a680be0d4534..6c26afcb8262 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10557,6 +10557,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), + SND_PCI_QUIRK(0x103c, 0x170b, "HP xw*", ALC262_HP_BPC), SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), -- cgit v1.2.3 From 53eff7e1e0de1cde8e8cbe619f401d2578dde946 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 27 Feb 2009 17:49:44 +0100 Subject: ALSA: hda - Match all 103c:17xx devices for HP BPC model Use SND_PCI_QUIRK_MASK() to match all devices with 103c:17xx for HP BPC model. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e72b74efc697..0b4afa0a3519 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10807,7 +10807,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { ALC262_HP_BPC), SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", ALC262_HP_BPC), - SND_PCI_QUIRK(0x103c, 0x170b, "HP xw*", ALC262_HP_BPC), + SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", + ALC262_HP_BPC), SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), -- cgit v1.2.3 From c82c8abdeef53eb0bb0504becb4e91bbccceaee8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 27 Feb 2009 17:52:22 +0100 Subject: ALSA: hda - Fix an "unused variable" compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forgot to remove an unused variable. sound/pci/hda/patch_realtek.c: In function ‘alc882_auto_init_analog_input’: sound/pci/hda/patch_realtek.c:7018: warning: unused variable ‘vref’ Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0b4afa0a3519..1cc31ac03522 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7015,7 +7015,6 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; - unsigned int vref; if (!nid) continue; alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); -- cgit v1.2.3 From 38f1df27e3191d76e983cb9c6b4392582fd32fda Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 1 Mar 2009 10:55:44 +0100 Subject: ALSA: hda - Add probe_mask default for Toshiba laptop with ALC268 Some Toshiba laptops have another ALC268 codec on slot#3 that conflicts with the primary codec. The codec#3 is for the digital I/O, and should be fixed by the driver, but it'd need a bunch of changes. So, let's fix the probe problem temporarily by setting the default probe_mask value. Reference: kernel bugzilla #12735 http://bugzilla.kernel.org/show_bug.cgi?id=12735 Tested-by: Alexey Dobriyan Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c8d9178f47e5..5e909e0da04b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2095,6 +2095,8 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), + /* conflict of ALC268 in slot#3 (digital I/O); a temporary fix */ + SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba laptop", 0x03), {} }; -- cgit v1.2.3 From 892981ffbe9a5c4cbc9d75f423b145f32c765f9c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 08:04:35 +0100 Subject: ALSA: hda - Don't create a beep control for digital-only ALC268 When an ALC268 codec is set up as the digital-only (as found in Toshiba laptops), it shouldn't contain any beep control that conflict with the primary codec. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1cc31ac03522..c60c86acd9ba 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11915,7 +11915,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) if (spec->kctls.list) add_mixer(spec, spec->kctls.list); - if (spec->autocfg.speaker_pins[0] != 0x1d) + if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) add_mixer(spec, alc268_beep_mixer); add_verb(spec, alc268_volume_init_verbs); -- cgit v1.2.3 From 4c4531d64dd0442813c7307b860bf40a2aec51bc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 08:06:11 +0100 Subject: ALSA: hda - Remove Toshiba probe_mask quirk Revert the Toshiba probe_mask quirk for 2.6.29 kernel (commit 38f1df27e3191d76e983cb9c6b4392582fd32fda). In the current tree, the digital-only codec is handled properly so no codec conflict should occur. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 68a128fb487d..47a5833feb7a 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2095,8 +2095,6 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), - /* conflict of ALC268 in slot#3 (digital I/O); a temporary fix */ - SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba laptop", 0x03), /* forced codec slots */ SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), {} -- cgit v1.2.3 From d1f1af2dbf8207db590853a59bec465c4f68cfdc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 10:35:29 +0100 Subject: ALSA: hda - Intialize more codec fields in snd_hda_codec_reset() Initiailize forgotten fields in snd_hda_codec_reset(). Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 5dceee8a113b..3b44c789f23b 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1519,6 +1519,9 @@ int snd_hda_codec_reset(struct hda_codec *codec) codec->num_pcms = 0; codec->pcm_info = NULL; codec->preset = NULL; + memset(&codec->patch_ops, 0, sizeof(codec->patch_ops)); + codec->slave_dig_outs = NULL; + codec->spdif_status_reset = 0; module_put(codec->owner); codec->owner = NULL; -- cgit v1.2.3 From f93d461bcde6ac3db542361c00a7e4167f88176d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 10:44:15 +0100 Subject: ALSA: hda - Revert the codec probe at control-creation errors Revert the codec probe instead of returning the error to the driver when any error occurs at creating the control elements. The control element conflict can be non-fatal in many cases, especially if it comes from the digital-only codec. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3b44c789f23b..1be34ed9c0eb 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1434,7 +1434,6 @@ int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl) } EXPORT_SYMBOL_HDA(snd_hda_ctl_add); -#ifdef CONFIG_SND_HDA_RECONFIG /* Clear all controls assigned to the given codec */ void snd_hda_ctls_clear(struct hda_codec *codec) { @@ -1529,7 +1528,6 @@ int snd_hda_codec_reset(struct hda_codec *codec) hda_unlock_devices(card); return 0; } -#endif /* CONFIG_SND_HDA_RECONFIG */ /* create a virtual master control and add slaves */ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, @@ -2392,8 +2390,16 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) list_for_each_entry(codec, &bus->codec_list, list) { int err = snd_hda_codec_build_controls(codec); - if (err < 0) - return err; + if (err < 0) { + printk(KERN_ERR "hda_codec: cannot build controls" + "for #%d (error %d)\n", codec->addr, err); + err = snd_hda_codec_reset(codec); + if (err < 0) { + printk(KERN_ERR + "hda_codec: cannot revert codec\n"); + return err; + } + } } return 0; } -- cgit v1.2.3 From 6e655bf21697d2594243098a14e0699e8d4a4059 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 10:46:03 +0100 Subject: ALSA: hda - Don't return a fatal error at PCM-creation errors Don't return a fatal error to the driver but continue to probe when any error occurs at creating PCM streams for each codec. It's often non-fatal and keeping it would help debugging. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 1be34ed9c0eb..7c9ef5c18e77 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2833,8 +2833,16 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) if (!codec->patch_ops.build_pcms) return 0; err = codec->patch_ops.build_pcms(codec); - if (err < 0) - return err; + if (err < 0) { + printk(KERN_ERR "hda_codec: cannot build PCMs" + "for #%d (error %d)\n", codec->addr, err); + err = snd_hda_codec_reset(codec); + if (err < 0) { + printk(KERN_ERR + "hda_codec: cannot revert codec\n"); + return err; + } + } } for (pcm = 0; pcm < codec->num_pcms; pcm++) { struct hda_pcm *cpcm = &codec->pcm_info[pcm]; @@ -2846,11 +2854,15 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) if (!cpcm->pcm) { dev = get_empty_pcm_device(codec->bus, cpcm->pcm_type); if (dev < 0) - return 0; + continue; /* no fatal error */ cpcm->device = dev; err = snd_hda_attach_pcm(codec, cpcm); - if (err < 0) - return err; + if (err < 0) { + printk(KERN_ERR "hda_codec: cannot attach " + "PCM stream %d for codec #%d\n", + dev, codec->addr); + continue; /* no fatal error */ + } } } return 0; -- cgit v1.2.3 From 1713c0d508fbbb42aa5f90039195e5ac31a50625 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Fri, 27 Feb 2009 21:41:40 +0100 Subject: ALSA: opl3sa2 fix irq releasing and short name of card Two simple fixes: 1. Use the same pointer for the free_irq() and the request_irq() calls. 2. A short name of card is appended with '2' or '3' character depending on a detected chip. Remove the '2' character from the short name. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/opl3sa2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 06810dfb9d9a..19b2d0420a26 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -617,7 +617,7 @@ static void snd_opl3sa2_free(struct snd_card *card) { struct snd_opl3sa2 *chip = card->private_data; if (chip->irq >= 0) - free_irq(chip->irq, (void *)chip); + free_irq(chip->irq, card); release_and_free_resource(chip->res_port); } @@ -630,7 +630,7 @@ static struct snd_card *snd_opl3sa2_card_new(int dev) if (card == NULL) return NULL; strcpy(card->driver, "OPL3SA2"); - strcpy(card->shortname, "Yamaha OPL3-SA2"); + strcpy(card->shortname, "Yamaha OPL3-SA"); chip = card->private_data; spin_lock_init(&chip->reg_lock); chip->irq = -1; -- cgit v1.2.3 From eab2b553c3d3ed20698c4a9c7e049a60b804e2f5 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 2 Mar 2009 11:45:50 +0100 Subject: sound: usb-audio: fix rules check for 32-channel devices When storing the channel numbers used by a format, and if the device happens to support 32 channels, the code would try to store 1<<32 in a 32-bit value. Since no valid format can have zero channels, we can use 1<<(channels-1) instead of 1< Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 2b24496ddec7..f853b627cf43 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1783,7 +1783,7 @@ static int check_hw_params_convention(struct snd_usb_substream *subs) if (rates[f->format] && rates[f->format] != f->rates) goto __out; } - channels[f->format] |= (1 << f->channels); + channels[f->format] |= 1 << (f->channels - 1); rates[f->format] |= f->rates; /* needs knot? */ if (f->rates & SNDRV_PCM_RATE_KNOT) @@ -1810,7 +1810,7 @@ static int check_hw_params_convention(struct snd_usb_substream *subs) continue; for (i = 0; i < 32; i++) { if (f->rates & (1 << i)) - channels[i] |= (1 << f->channels); + channels[i] |= 1 << (f->channels - 1); } } cmaster = 0; -- cgit v1.2.3 From b1c86bb807448701400abc6eb8e958475ab5424b Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 2 Mar 2009 12:06:28 +0100 Subject: sound: usb-audio: fix queue length check for high speed devices When checking for the maximum queue length, we have to take into account that MAX_QUEUE is measured in milliseconds (i.e., frames) while the unit of urb_packs is whatever data packet interval the device uses (possibly less than one frame when using high speed devices). Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index f853b627cf43..defe9913cbb2 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1095,9 +1095,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri total_packs = 2 * packs_per_ms; } else { /* and we don't want too long a queue either */ - maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); - if (total_packs > maxpacks * packs_per_ms) - total_packs = maxpacks * packs_per_ms; + maxpacks = max(MAX_QUEUE * packs_per_ms, urb_packs * 2); + total_packs = min(total_packs, maxpacks); } } else { total_packs = MAX_URBS * urb_packs; -- cgit v1.2.3 From 43b62713f67d9f0655f3a61f5bd14d6297ddd3ce Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 14:25:17 +0100 Subject: ALSA: hda - Add hint string helper functions Added snd_hda_get_hint() and snd_hda_get_bool_hint() helper functions to retrieve a hint value. Internally, the hint is stored in a pair of two strings, key and val. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_hwdep.c | 112 ++++++++++++++++++++++++++++++++++++++++------ sound/pci/hda/hda_local.h | 17 +++++++ 2 files changed, 116 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 4af484b8240c..5e554de9cd9b 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -30,6 +30,12 @@ #include #include +/* hint string pair */ +struct hda_hint { + const char *key; + const char *val; /* contained in the same alloc as key */ +}; + /* * write/read an out-of-bound verb */ @@ -99,15 +105,15 @@ static int hda_hwdep_open(struct snd_hwdep *hw, struct file *file) static void clear_hwdep_elements(struct hda_codec *codec) { - char **head; int i; /* clear init verbs */ snd_array_free(&codec->init_verbs); /* clear hints */ - head = codec->hints.list; - for (i = 0; i < codec->hints.used; i++, head++) - kfree(*head); + for (i = 0; i < codec->hints.used; i++) { + struct hda_hint *hint = snd_array_elem(&codec->hints, i); + kfree(hint->key); /* we don't need to free hint->val */ + } snd_array_free(&codec->hints); snd_array_free(&codec->user_pins); } @@ -141,7 +147,7 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) #endif snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); - snd_array_init(&codec->hints, sizeof(char *), 32); + snd_array_init(&codec->hints, sizeof(struct hda_hint), 32); snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16); return 0; @@ -306,26 +312,81 @@ static ssize_t init_verbs_store(struct device *dev, return count; } +static struct hda_hint *get_hint(struct hda_codec *codec, const char *key) +{ + int i; + + for (i = 0; i < codec->hints.used; i++) { + struct hda_hint *hint = snd_array_elem(&codec->hints, i); + if (!strcmp(hint->key, key)) + return hint; + } + return NULL; +} + +static void remove_trail_spaces(char *str) +{ + char *p; + if (!*str) + return; + p = str + strlen(str) - 1; + for (; isspace(*p); p--) { + *p = 0; + if (p == str) + return; + } +} + +#define MAX_HINTS 1024 + static ssize_t hints_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct snd_hwdep *hwdep = dev_get_drvdata(dev); struct hda_codec *codec = hwdep->private_data; - char *p; - char **hint; + char *key, *val; + struct hda_hint *hint; - if (!*buf || isspace(*buf) || *buf == '#' || *buf == '\n') + while (isspace(*buf)) + buf++; + if (!*buf || *buf == '#' || *buf == '\n') return count; - p = kstrndup_noeol(buf, 1024); - if (!p) + if (*buf == '=') + return -EINVAL; + key = kstrndup_noeol(buf, 1024); + if (!key) return -ENOMEM; - hint = snd_array_new(&codec->hints); + /* extract key and val */ + val = strchr(key, '='); + if (!val) { + kfree(key); + return -EINVAL; + } + *val++ = 0; + while (isspace(*val)) + val++; + remove_trail_spaces(key); + remove_trail_spaces(val); + hint = get_hint(codec, key); + if (hint) { + /* replace */ + kfree(hint->key); + hint->key = key; + hint->val = val; + return count; + } + /* allocate a new hint entry */ + if (codec->hints.used >= MAX_HINTS) + hint = NULL; + else + hint = snd_array_new(&codec->hints); if (!hint) { - kfree(p); + kfree(key); return -ENOMEM; } - *hint = p; + hint->key = key; + hint->val = val; return count; } @@ -428,4 +489,29 @@ int snd_hda_hwdep_add_sysfs(struct hda_codec *codec) return 0; } +/* + * Look for hint string + */ +const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) +{ + struct hda_hint *hint = get_hint(codec, key); + return hint ? hint->val : NULL; +} +EXPORT_SYMBOL_HDA(snd_hda_get_hint); + +int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) +{ + const char *p = snd_hda_get_hint(codec, key); + if (!p || !*p) + return -ENOENT; + switch (toupper(*p)) { + case 'T': /* true */ + case 'Y': /* yes */ + case '1': + return 1; + } + return 0; +} +EXPORT_SYMBOL_HDA(snd_hda_get_bool_hint); + #endif /* CONFIG_SND_HDA_RECONFIG */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 03ee9dd04913..27428c718fd7 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -433,6 +433,23 @@ static inline int snd_hda_hwdep_add_sysfs(struct hda_codec *codec) } #endif +#ifdef CONFIG_SND_HDA_RECONFIG +const char *snd_hda_get_hint(struct hda_codec *codec, const char *key); +int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key); +#else +static inline +const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) +{ + return NULL; +} + +static inline +int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) +{ + return -ENOENT; +} +#endif + /* * power-management */ -- cgit v1.2.3 From ab1726f920275b52991b2eff7538ac6d313bf9a2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 17:09:25 +0100 Subject: ALSA: hda - Add show for init_verbs and hints sysfs entries Added the show method for init_verbs and hints hwdep sysfs entries. They show the current values. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_hwdep.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 5e554de9cd9b..1e3ccc740afc 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -290,6 +290,22 @@ static ssize_t type##_store(struct device *dev, \ CODEC_ACTION_STORE(reconfig); CODEC_ACTION_STORE(clear); +static ssize_t init_verbs_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct snd_hwdep *hwdep = dev_get_drvdata(dev); + struct hda_codec *codec = hwdep->private_data; + int i, len = 0; + for (i = 0; i < codec->init_verbs.used; i++) { + struct hda_verb *v = snd_array_elem(&codec->init_verbs, i); + len += snprintf(buf + len, PAGE_SIZE - len, + "0x%02x 0x%03x 0x%04x\n", + v->nid, v->verb, v->param); + } + return len; +} + static ssize_t init_verbs_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -312,6 +328,21 @@ static ssize_t init_verbs_store(struct device *dev, return count; } +static ssize_t hints_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct snd_hwdep *hwdep = dev_get_drvdata(dev); + struct hda_codec *codec = hwdep->private_data; + int i, len = 0; + for (i = 0; i < codec->hints.used; i++) { + struct hda_hint *hint = snd_array_elem(&codec->hints, i); + len += snprintf(buf + len, PAGE_SIZE - len, + "%s = %s\n", hint->key, hint->val); + } + return len; +} + static struct hda_hint *get_hint(struct hda_codec *codec, const char *key) { int i; @@ -466,8 +497,8 @@ static struct device_attribute codec_attrs[] = { CODEC_ATTR_RO(mfg), CODEC_ATTR_RW(name), CODEC_ATTR_RW(modelname), - CODEC_ATTR_WO(init_verbs), - CODEC_ATTR_WO(hints), + CODEC_ATTR_RW(init_verbs), + CODEC_ATTR_RW(hints), CODEC_ATTR_RO(init_pin_configs), CODEC_ATTR_RW(user_pin_configs), CODEC_ATTR_RO(driver_pin_configs), -- cgit v1.2.3 From d78d7a90adf793943cc29a414b6f4364a700aad5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 14:26:25 +0100 Subject: ALSA: hda - Create "Analog Loopback" controls optionally Don't create "Analog Loopback" controls as default since these controls are usually more harmful than useful for normal users. Only created when "loopback = yes" hint is given. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 56 ++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 13056429aa64..7381325b98ff 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -190,6 +190,7 @@ struct sigmatel_spec { unsigned int stream_delay; /* analog loopback */ + struct snd_kcontrol_new *aloopback_ctl; unsigned char aloopback_mask; unsigned char aloopback_shift; @@ -1013,8 +1014,6 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), - STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), - HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), @@ -1024,9 +1023,22 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { { } /* end */ }; -static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { +static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { + STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), + {} +}; + +static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), + {} +}; +static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { + STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), + {} +}; + +static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), @@ -1051,8 +1063,6 @@ static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { }; static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { - STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), - HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), @@ -1104,8 +1114,6 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { }; static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { - STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), - HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), @@ -1131,9 +1139,11 @@ static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { { } /* end */ }; -static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { - STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), +static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { + STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) +}; +static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), @@ -1151,8 +1161,6 @@ static struct snd_kcontrol_new stac925x_mixer[] = { }; static struct snd_kcontrol_new stac9205_mixer[] = { - STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), - HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), @@ -1161,6 +1169,11 @@ static struct snd_kcontrol_new stac9205_mixer[] = { { } /* end */ }; +static struct snd_kcontrol_new stac9205_loopback[] = { + STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), + {} +}; + /* This needs to be generated dynamically based on sequence */ static struct snd_kcontrol_new stac922x_mixer[] = { HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), @@ -1173,8 +1186,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = { static struct snd_kcontrol_new stac927x_mixer[] = { - STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), - HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), @@ -1186,6 +1197,11 @@ static struct snd_kcontrol_new stac927x_mixer[] = { { } /* end */ }; +static struct snd_kcontrol_new stac927x_loopback[] = { + STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), + {} +}; + static struct snd_kcontrol_new stac_dmux_mixer = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Digital Input Source", @@ -1312,6 +1328,13 @@ static int stac92xx_build_controls(struct hda_codec *codec) return err; } + if (spec->aloopback_ctl && + snd_hda_get_bool_hint(codec, "loopback") == 1) { + err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl); + if (err < 0) + return err; + } + stac92xx_free_kctls(codec); /* no longer needed */ /* create jack input elements */ @@ -4618,14 +4641,18 @@ again: case 0x3: /* 6 Channel */ spec->mixer = stac92hd73xx_6ch_mixer; spec->init = stac92hd73xx_6ch_core_init; + spec->aloopback_ctl = stac92hd73xx_6ch_loopback; break; case 0x4: /* 8 Channel */ spec->mixer = stac92hd73xx_8ch_mixer; spec->init = stac92hd73xx_8ch_core_init; + spec->aloopback_ctl = stac92hd73xx_8ch_loopback; break; case 0x5: /* 10 Channel */ spec->mixer = stac92hd73xx_10ch_mixer; spec->init = stac92hd73xx_10ch_core_init; + spec->aloopback_ctl = stac92hd73xx_10ch_loopback; + break; } spec->multiout.dac_nids = spec->dac_nids; @@ -5036,6 +5063,7 @@ again: if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) snd_hda_sequence_write_cache(codec, unmute_init); + spec->aloopback_ctl = stac92hd71bxx_loopback; spec->aloopback_mask = 0x50; spec->aloopback_shift = 0; @@ -5285,6 +5313,7 @@ static int patch_stac927x(struct hda_codec *codec) } spec->num_pwrs = 0; + spec->aloopback_ctl = stac927x_loopback; spec->aloopback_mask = 0x40; spec->aloopback_shift = 0; spec->eapd_switch = 1; @@ -5364,6 +5393,7 @@ static int patch_stac9205(struct hda_codec *codec) spec->init = stac9205_core_init; spec->mixer = stac9205_mixer; + spec->aloopback_ctl = stac9205_loopback; spec->aloopback_mask = 0x40; spec->aloopback_shift = 0; -- cgit v1.2.3 From 6565e4faca257fc51a4c55199d72e2701ba7e819 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Mar 2009 14:38:35 +0100 Subject: ALSA: hda - Add more hint options for IDT/Sigmatel codecs Allow more options to be set/reset via hwdep hint entry. hp_detect, gpio_mask, gpio_dir, gpio_data, eapd_mask and eapd_switch can be checked. For example, to disable hp_detect on the fly, # echo "hp_detect=0" > /sys/class/sound/hwC0D0/hints Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7381325b98ff..e9331561a484 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3949,6 +3949,36 @@ static void stac92xx_power_down(struct hda_codec *codec) static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, int enable); +/* override some hints from the hwdep entry */ +static void stac_store_hints(struct hda_codec *codec) +{ + struct sigmatel_spec *spec = codec->spec; + const char *p; + int val; + + val = snd_hda_get_bool_hint(codec, "hp_detect"); + if (val >= 0) + spec->hp_detect = val; + p = snd_hda_get_hint(codec, "gpio_mask"); + if (p) { + spec->gpio_mask = simple_strtoul(p, NULL, 0); + spec->eapd_mask = spec->gpio_dir = spec->gpio_data = + spec->gpio_mask; + } + p = snd_hda_get_hint(codec, "gpio_dir"); + if (p) + spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; + p = snd_hda_get_hint(codec, "gpio_data"); + if (p) + spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; + p = snd_hda_get_hint(codec, "eapd_mask"); + if (p) + spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask; + val = snd_hda_get_bool_hint(codec, "eapd_switch"); + if (val >= 0) + spec->eapd_switch = val; +} + static int stac92xx_init(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; @@ -3965,6 +3995,9 @@ static int stac92xx_init(struct hda_codec *codec) spec->adc_nids[i], 0, AC_VERB_SET_POWER_STATE, AC_PWRST_D3); + /* override some hints */ + stac_store_hints(codec); + /* set up GPIO */ gpio = spec->gpio_data; /* turn on EAPD statically when spec->eapd_switch isn't set. -- cgit v1.2.3 From 82ad39f9391fca1d3177bd9f6a5264eff5b5346a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 3 Mar 2009 15:00:35 +0100 Subject: ALSA: hda - Fix gcc compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's false positive, but annoying. sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’: sound/pci/hda/hda_codec.c:2772: warning: ‘dev’ may be used uninitialized in this function Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 7c9ef5c18e77..04cb1251e3e7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2776,13 +2776,10 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) for (i = 0; i < ARRAY_SIZE(audio_idx); i++) { dev = audio_idx[i]; if (!test_bit(dev, bus->pcm_dev_bits)) - break; - } - if (i >= ARRAY_SIZE(audio_idx)) { - snd_printk(KERN_WARNING "Too many audio devices\n"); - return -EAGAIN; + goto ok; } - break; + snd_printk(KERN_WARNING "Too many audio devices\n"); + return -EAGAIN; case HDA_PCM_TYPE_SPDIF: case HDA_PCM_TYPE_HDMI: case HDA_PCM_TYPE_MODEM: @@ -2797,6 +2794,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) snd_printk(KERN_WARNING "Invalid PCM type %d\n", type); return -EINVAL; } + ok: set_bit(dev, bus->pcm_dev_bits); return dev; } -- cgit v1.2.3 From 79d7d5333b598e9a559bf27833f0ad2b8bf6ad2c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Mar 2009 09:03:50 +0100 Subject: ALSA: hda - Fix HP dv6736 mic input Fix the mic input of HP dv6736 with Conexant 5051 codec chip. This laptop seems have no mic-switching per jack connection. A new model hp-dv6736 is introduced to match with the h/w implementation. Reference: Novell bnc#480753 https://bugzilla.novell.com/show_bug.cgi?id=480753 Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 1 + sound/pci/hda/patch_conexant.c | 63 +++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index a448bbefd488..80b796e4a80e 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -262,6 +262,7 @@ Conexant 5051 ============= laptop Basic Laptop config (default) hp HP Spartan laptop + hp-dv6736 HP dv6736 lenovo-x200 Lenovo X200 laptop STAC9200 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index b8de73ecfdeb..1938e92e1f03 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -72,6 +72,7 @@ struct conexant_spec { */ unsigned int cur_eapd; unsigned int hp_present; + unsigned int no_auto_mic; unsigned int need_dac_fix; /* capture */ @@ -1665,8 +1666,11 @@ static int cxt5051_hp_master_sw_put(struct snd_kcontrol *kcontrol, /* toggle input of built-in and mic jack appropriately */ static void cxt5051_portb_automic(struct hda_codec *codec) { + struct conexant_spec *spec = codec->spec; unsigned int present; + if (spec->no_auto_mic) + return; present = snd_hda_codec_read(codec, 0x17, 0, AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; @@ -1682,6 +1686,8 @@ static void cxt5051_portc_automic(struct hda_codec *codec) unsigned int present; hda_nid_t new_adc; + if (spec->no_auto_mic) + return; present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; @@ -1768,6 +1774,22 @@ static struct snd_kcontrol_new cxt5051_hp_mixers[] = { {} }; +static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = { + HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x00, HDA_INPUT), + HDA_CODEC_MUTE("Mic Switch", 0x14, 0x00, HDA_INPUT), + HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Master Playback Switch", + .info = cxt_eapd_info, + .get = cxt_eapd_get, + .put = cxt5051_hp_master_sw_put, + .private_value = 0x1a, + }, + + {} +}; + static struct hda_verb cxt5051_init_verbs[] = { /* Line in, Mic */ {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, @@ -1798,6 +1820,32 @@ static struct hda_verb cxt5051_init_verbs[] = { { } /* end */ }; +static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = { + /* Line in, Mic */ + {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, + {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, + {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0}, + {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0}, + /* SPK */ + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* HP, Amp */ + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* DAC1 */ + {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + /* Record selector: Int mic */ + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, + {0x14, AC_VERB_SET_CONNECT_SEL, 0x1}, + /* SPDIF route: PCM */ + {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, + /* EAPD */ + {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ + {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, + {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, + { } /* end */ +}; + static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { /* Line in, Mic */ {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, @@ -1849,6 +1897,7 @@ static int cxt5051_init(struct hda_codec *codec) enum { CXT5051_LAPTOP, /* Laptops w/ EAPD support */ CXT5051_HP, /* no docking */ + CXT5051_HP_DV6736, /* HP without mic switch */ CXT5051_LENOVO_X200, /* Lenovo X200 laptop */ CXT5051_MODELS }; @@ -1856,10 +1905,12 @@ enum { static const char *cxt5051_models[CXT5051_MODELS] = { [CXT5051_LAPTOP] = "laptop", [CXT5051_HP] = "hp", + [CXT5051_HP_DV6736] = "hp-dv6736", [CXT5051_LENOVO_X200] = "lenovo-x200", }; static struct snd_pci_quirk cxt5051_cfg_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736), SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", CXT5051_LAPTOP), SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), @@ -1896,20 +1947,22 @@ static int patch_cxt5051(struct hda_codec *codec) spec->cur_adc = 0; spec->cur_adc_idx = 0; + codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; + board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, cxt5051_models, cxt5051_cfg_tbl); switch (board_config) { case CXT5051_HP: - codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; spec->mixers[0] = cxt5051_hp_mixers; break; + case CXT5051_HP_DV6736: + spec->init_verbs[0] = cxt5051_hp_dv6736_init_verbs; + spec->mixers[0] = cxt5051_hp_dv6736_mixers; + spec->no_auto_mic = 1; + break; case CXT5051_LENOVO_X200: spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; - /* fallthru */ - default: - case CXT5051_LAPTOP: - codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; break; } -- cgit v1.2.3 From bd6afe3f34d41ed81e0c62a5a2181bb7bd51aebf Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 4 Mar 2009 11:30:25 +0100 Subject: ALSA: hda - Fix conflict of mixer controls on Sony VAIO VGN-AR71S The recent update enabled the model=sony-assamd for all ALC262 with PCI SSID 104d:90xx. But this includes the VAIO VGN-AR* that has the primary codec of STAC92xx and the secondary ALC262 as a slave digital-only codec. For this device, the model=auto must be chosen to work properly. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c60c86acd9ba..8c02f789e4fc 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10825,6 +10825,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), + SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", -- cgit v1.2.3 From 3ea0d7cf472c6118bb8c0842d606f5436251e179 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 4 Mar 2009 14:22:50 -0300 Subject: ALSA: hda - Add 4 channel mode for 3stack-hp model (ALC888) Add additional 4 channel mode for 3stack-hp models. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8c02f789e4fc..3696ff31838f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8068,24 +8068,45 @@ static struct hda_verb alc888_6st_dell_verbs[] = { { } }; +/* + * 2ch mode + */ static struct hda_verb alc888_3st_hp_2ch_init[] = { { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } + { } /* end */ }; +/* + * 4ch mode + */ +static struct hda_verb alc888_3st_hp_4ch_init[] = { + { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, + { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, + { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, + { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, + { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, + { } /* end */ +}; + +/* + * 6ch mode + */ static struct hda_verb alc888_3st_hp_6ch_init[] = { { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, + { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { } + { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, + { } /* end */ }; -static struct hda_channel_mode alc888_3st_hp_modes[2] = { +static struct hda_channel_mode alc888_3st_hp_modes[3] = { { 2, alc888_3st_hp_2ch_init }, + { 4, alc888_3st_hp_4ch_init }, { 6, alc888_3st_hp_6ch_init }, }; -- cgit v1.2.3 From 8718b700ccbcc3c6016d38a75e005293c3660f1c Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 4 Mar 2009 14:22:51 -0300 Subject: ALSA: hda - Add headphone automute support for 3stack-hp model (ALC888) Mute speaker outputs on headphone insertion for machines that use 3stack-hp model. Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3696ff31838f..251647d8b5b9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8056,16 +8056,42 @@ static struct hda_verb alc888_lenovo_sky_verbs[] = { { } /* end */ }; +static struct hda_verb alc888_6st_dell_verbs[] = { + {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, + { } +}; + +static void alc888_3st_hp_front_automute(struct hda_codec *codec) +{ + unsigned int present, bits; + + present = snd_hda_codec_read(codec, 0x1b, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + bits = present ? HDA_AMP_MUTE : 0; + snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, + HDA_AMP_MUTE, bits); + snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, + HDA_AMP_MUTE, bits); + snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, + HDA_AMP_MUTE, bits); +} + +static void alc888_3st_hp_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + switch (res >> 26) { + case ALC880_HP_EVENT: + alc888_3st_hp_front_automute(codec); + break; + } +} + static struct hda_verb alc888_3st_hp_verbs[] = { {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ - { } -}; - -static struct hda_verb alc888_6st_dell_verbs[] = { {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, - { } + { } /* end */ }; /* @@ -8950,6 +8976,8 @@ static struct alc_config_preset alc883_presets[] = { .channel_mode = alc888_3st_hp_modes, .need_dac_fix = 1, .input_mux = &alc883_capture_source, + .unsol_event = alc888_3st_hp_unsol_event, + .init_hook = alc888_3st_hp_front_automute, }, [ALC888_6ST_DELL] = { .mixers = { alc883_base_mixer, alc883_chmode_mixer }, -- cgit v1.2.3 From 7ec30f0e7768985ab2ef6334840e3fc8fa253421 Mon Sep 17 00:00:00 2001 From: Herton Ronaldo Krzesinski Date: Wed, 4 Mar 2009 14:22:52 -0300 Subject: ALSA: hda - Map 3stack-hp model (ALC888) for HP Educ.ar Added model=3stack-hp for HP Educ.ar desktop machine (103c:2a72). Signed-off-by: Herton Ronaldo Krzesinski Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 251647d8b5b9..91ef9f27b120 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8673,6 +8673,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), + SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), -- cgit v1.2.3 From c2503cd3be9eacb1dd06ec5b6fba8bb06aac12a8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Mar 2009 09:37:40 +0100 Subject: ALSA: hdsp - Ignore MIDI and PCM events in interrupts until initialized Ignore MIDI and PCM events in the interrupt handler until the device gets initialized properly. Otherwise you may get kernel panic by the access to uninitialized devices via hotplugging. Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdsp.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index dc65fe1c9c65..314e73531bd1 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -3740,6 +3740,9 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff; midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; + if (!(hdsp->state & HDSP_InitializationComplete)) + return IRQ_HANDLED; + if (audio) { if (hdsp->capture_substream) snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); -- cgit v1.2.3 From 37db623ae2a7bde234a8ed683d0d13d6f939199c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Mar 2009 09:40:16 +0100 Subject: ALSA: hda - Fix check of ALC888S-VC in alc888_coef_init() Fixed the wrong bits check to identify ALC888S-VC model in alc888_coef_init(). Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 91ef9f27b120..6325ea43cf08 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -982,7 +982,7 @@ static void alc888_coef_init(struct hda_codec *codec) snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); - if ((tmp & 0xf0) == 2) + if ((tmp & 0xf0) == 0x20) /* alc888S-VC */ snd_hda_codec_read(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0x830); -- cgit v1.2.3 From f03d3115a6bcb814019d945c50c2ef91e5f14477 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Mar 2009 14:18:16 +0100 Subject: ALSA: Fix sample rate of Lenovo Ideapad to 44.1kHz Noises can be heard on analog outputs of (some model of) Lenovo Ideapad due to the hardware problem, and the only workaround right now is to fix the sample rate to 44.1kHz. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6325ea43cf08..b794cba494c3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -12845,6 +12845,27 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, #define alc269_pcm_digital_playback alc880_pcm_digital_playback #define alc269_pcm_digital_capture alc880_pcm_digital_capture +static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { + .substreams = 1, + .channels_min = 2, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ + /* NID is set in alc_build_pcms */ + .ops = { + .open = alc880_playback_pcm_open, + .prepare = alc880_playback_pcm_prepare, + .cleanup = alc880_playback_pcm_cleanup + }, +}; + +static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { + .substreams = 1, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ + /* NID is set in alc_build_pcms */ +}; + /* * BIOS auto configuration */ @@ -13060,9 +13081,16 @@ static int patch_alc269(struct hda_codec *codec) setup_preset(spec, &alc269_presets[board_config]); spec->stream_name_analog = "ALC269 Analog"; - spec->stream_analog_playback = &alc269_pcm_analog_playback; - spec->stream_analog_capture = &alc269_pcm_analog_capture; - + if (codec->subsystem_id == 0x17aa3bf8) { + /* Due to a hardware problem on Lenovo Ideadpad, we need to + * fix the sample rate of analog I/O to 44.1kHz + */ + spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; + spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; + } else { + spec->stream_analog_playback = &alc269_pcm_analog_playback; + spec->stream_analog_capture = &alc269_pcm_analog_capture; + } spec->stream_name_digital = "ALC269 Digital"; spec->stream_digital_playback = &alc269_pcm_digital_playback; spec->stream_digital_capture = &alc269_pcm_digital_capture; -- cgit v1.2.3 From 14b97595e0e1f47b6f809e180e5bcd8dcd995690 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 09:42:07 +0100 Subject: ALSA: hda - Fix typos in slave controls in patch_sigmatel.c "Headphone Playback ..." appears twice in slave_vols[] and slave_sws[]. They should be "Headphone Playback2 ..." Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3bc427645da8..995b413078f5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1207,7 +1207,7 @@ static const char *slave_vols[] = { "LFE Playback Volume", "Side Playback Volume", "Headphone Playback Volume", - "Headphone Playback Volume", + "Headphone2 Playback Volume", "Speaker Playback Volume", "External Speaker Playback Volume", "Speaker2 Playback Volume", @@ -1221,7 +1221,7 @@ static const char *slave_sws[] = { "LFE Playback Switch", "Side Playback Switch", "Headphone Playback Switch", - "Headphone Playback Switch", + "Headphone2 Playback Switch", "Speaker Playback Switch", "External Speaker Playback Switch", "Speaker2 Playback Switch", -- cgit v1.2.3 From c50ff7c04225c945b13d410d50fde6ff6c59d7ee Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 09:43:58 +0100 Subject: ALSA: hda - Fix headphone-detect regression with multiple HP jacks The recent changes over the DAC detection mechanism in patch_sigmatel.c breaks the HP detection on the machines with multiple HP jacks. It's basically because of the workaround to support the multi-channel output. Since the HP detection is more important feature, disable the HP-swap workaroud temporarily. Reference: Novell bnc#482052 https://bugzilla.novell.com/show_bug.cgi?id=482052 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 995b413078f5..6094344fb223 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3516,6 +3516,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out if (! spec->autocfg.line_outs) return 0; /* can't find valid pin config */ +#if 0 /* FIXME: temporarily disabled */ /* If we have no real line-out pin and multiple hp-outs, HPs should * be set up as multi-channel outputs. */ @@ -3535,6 +3536,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; spec->autocfg.hp_outs = 0; } +#endif /* FIXME: temporarily disabled */ if (spec->autocfg.mono_out_pin) { int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); -- cgit v1.2.3 From dc04d1b4d2043e2fca2d94d6d5542b930f2bc5b3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 10:00:05 +0100 Subject: ALSA: hda - Create output controls according to pin types for IDT/STAC Improve the parser to pick up more intuitive control names for the outputs judging from the pin type, instead of fixed names assigned to channels. Also, revive the multi-HP workaround since this change fixes the problem with the multi-HP detection. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 141 +++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 69 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 2e0a599f8c12..edd2ed7ebb49 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3039,35 +3039,33 @@ static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) return 1; } -static int is_unique_dac(struct sigmatel_spec *spec, hda_nid_t nid) -{ - int i; - - if (spec->autocfg.line_outs != 1) - return 0; - if (spec->multiout.hp_nid == nid) - return 0; - for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) - if (spec->multiout.extra_out_nid[i] == nid) - return 0; - return 1; -} - -/* add playback controls from the parsed DAC table */ -static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, - const struct auto_pin_cfg *cfg) +/* Create output controls + * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) + */ +static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, + const hda_nid_t *pins, + const hda_nid_t *dac_nids, + int type) { struct sigmatel_spec *spec = codec->spec; static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; - hda_nid_t nid = 0; + static const char *hp_pfxs[] = { + "Headphone", "Headphone2", "Headphone3", "Headphone4" + }; + static const char *speaker_pfxs[] = { + "Speaker", "External Speaker", "Speaker2", "Speaker3" + }; + hda_nid_t nid; int i, err; unsigned int wid_caps; - for (i = 0; i < cfg->line_outs && spec->multiout.dac_nids[i]; i++) { - nid = spec->multiout.dac_nids[i]; - if (i == 2) { + for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { + nid = dac_nids[i]; + if (!nid) + continue; + if (type != AUTO_PIN_HP_OUT && i == 2) { /* Center/LFE */ err = create_controls(codec, "Center", nid, 1); if (err < 0) @@ -3088,23 +3086,43 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, } } else { - const char *name = chname[i]; - /* if it's a single DAC, assign a better name */ - if (!i && is_unique_dac(spec, nid)) { - switch (cfg->line_out_type) { - case AUTO_PIN_HP_OUT: - name = "Headphone"; - break; - case AUTO_PIN_SPEAKER_OUT: - name = "Speaker"; - break; - } + const char *name; + switch (type) { + case AUTO_PIN_HP_OUT: + name = hp_pfxs[i]; + break; + case AUTO_PIN_SPEAKER_OUT: + name = speaker_pfxs[i]; + break; + default: + name = chname[i]; + break; } err = create_controls(codec, name, nid, 3); if (err < 0) return err; + if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { + wid_caps = get_wcaps(codec, pins[i]); + if (wid_caps & AC_WCAP_UNSOL_CAP) + spec->hp_detect = 1; + } } } + return 0; +} + +/* add playback controls from the parsed DAC table */ +static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, + const struct auto_pin_cfg *cfg) +{ + struct sigmatel_spec *spec = codec->spec; + int err; + + err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins, + spec->multiout.dac_nids, + cfg->line_out_type); + if (err < 0) + return err; if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { err = stac92xx_add_control(spec, @@ -3139,40 +3157,18 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, struct auto_pin_cfg *cfg) { struct sigmatel_spec *spec = codec->spec; - hda_nid_t nid; - int i, err, nums; + int err; + + err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins, + spec->hp_dacs, AUTO_PIN_HP_OUT); + if (err < 0) + return err; + + err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, + spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT); + if (err < 0) + return err; - nums = 0; - for (i = 0; i < cfg->hp_outs; i++) { - static const char *pfxs[] = { - "Headphone", "Headphone2", "Headphone3", - }; - unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); - if (wid_caps & AC_WCAP_UNSOL_CAP) - spec->hp_detect = 1; - if (nums >= ARRAY_SIZE(pfxs)) - continue; - nid = spec->hp_dacs[i]; - if (!nid) - continue; - err = create_controls(codec, pfxs[nums++], nid, 3); - if (err < 0) - return err; - } - nums = 0; - for (i = 0; i < cfg->speaker_outs; i++) { - static const char *pfxs[] = { - "Speaker", "External Speaker", "Speaker2", - }; - if (nums >= ARRAY_SIZE(pfxs)) - continue; - nid = spec->speaker_dacs[i]; - if (!nid) - continue; - err = create_controls(codec, pfxs[nums++], nid, 3); - if (err < 0) - return err; - } return 0; } @@ -3505,6 +3501,7 @@ static void stac92xx_auto_init_hp_out(struct hda_codec *codec) static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) { struct sigmatel_spec *spec = codec->spec; + int hp_swap = 0; int err; if ((err = snd_hda_parse_pin_def_config(codec, @@ -3514,7 +3511,6 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out if (! spec->autocfg.line_outs) return 0; /* can't find valid pin config */ -#if 0 /* FIXME: temporarily disabled */ /* If we have no real line-out pin and multiple hp-outs, HPs should * be set up as multi-channel outputs. */ @@ -3533,8 +3529,8 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out spec->autocfg.line_outs = spec->autocfg.hp_outs; spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; spec->autocfg.hp_outs = 0; + hp_swap = 1; } -#endif /* FIXME: temporarily disabled */ if (spec->autocfg.mono_out_pin) { int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); @@ -3627,12 +3623,19 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out #endif err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); - if (err < 0) return err; - err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); + /* All output parsing done, now restore the swapped hp pins */ + if (hp_swap) { + memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, + sizeof(spec->autocfg.hp_pins)); + spec->autocfg.hp_outs = spec->autocfg.line_outs; + spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; + spec->autocfg.line_outs = 0; + } + err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); if (err < 0) return err; -- cgit v1.2.3 From 7a411ee01bf3114ba2a2ae013eaae4e3c41f8eb5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 10:08:14 +0100 Subject: ALSA: hda - Allow slave controls with non-zero indices Fix snd_hda_add_vmaster() to check the non-zero indices of slave controls. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 04cb1251e3e7..1885e7649101 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1552,15 +1552,20 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, for (s = slaves; *s; s++) { struct snd_kcontrol *sctl; - - sctl = snd_hda_find_mixer_ctl(codec, *s); - if (!sctl) { - snd_printdd("Cannot find slave %s, skipped\n", *s); - continue; + int i = 0; + for (;;) { + sctl = _snd_hda_find_mixer_ctl(codec, *s, i); + if (!sctl) { + if (!i) + snd_printdd("Cannot find slave %s, " + "skipped\n", *s); + break; + } + err = snd_ctl_add_slave(kctl, sctl); + if (err < 0) + return err; + i++; } - err = snd_ctl_add_slave(kctl, sctl); - if (err < 0) - return err; } return 0; } -- cgit v1.2.3 From 668b9652be33510a2a42b290dd335d34d38e2068 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 10:13:24 +0100 Subject: ALSA: hda - Create multiple HP / speaker controls with index Create multiple "Headphone" and "Speaker" controls with non-zero index numbers instead of "Headphone2", etc. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index edd2ed7ebb49..d19090fd2d13 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1227,10 +1227,7 @@ static const char *slave_vols[] = { "LFE Playback Volume", "Side Playback Volume", "Headphone Playback Volume", - "Headphone2 Playback Volume", "Speaker Playback Volume", - "External Speaker Playback Volume", - "Speaker2 Playback Volume", NULL }; @@ -1241,10 +1238,7 @@ static const char *slave_sws[] = { "LFE Playback Switch", "Side Playback Switch", "Headphone Playback Switch", - "Headphone2 Playback Switch", "Speaker Playback Switch", - "External Speaker Playback Switch", - "Speaker2 Playback Switch", "IEC958 Playback Switch", NULL }; @@ -2976,8 +2970,8 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) } /* create volume control/switch for the given prefx type */ -static int create_controls(struct hda_codec *codec, const char *pfx, - hda_nid_t nid, int chs) +static int create_controls_idx(struct hda_codec *codec, const char *pfx, + int idx, hda_nid_t nid, int chs) { struct sigmatel_spec *spec = codec->spec; char name[32]; @@ -3001,19 +2995,22 @@ static int create_controls(struct hda_codec *codec, const char *pfx, } sprintf(name, "%s Playback Volume", pfx); - err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, + err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, spec->volume_offset)); if (err < 0) return err; sprintf(name, "%s Playback Switch", pfx); - err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, + err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); if (err < 0) return err; return 0; } +#define create_controls(codec, pfx, nid, chs) \ + create_controls_idx(codec, pfx, 0, nid, chs) + static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) { if (spec->multiout.num_dacs > 4) { @@ -3051,12 +3048,6 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; - static const char *hp_pfxs[] = { - "Headphone", "Headphone2", "Headphone3", "Headphone4" - }; - static const char *speaker_pfxs[] = { - "Speaker", "External Speaker", "Speaker2", "Speaker3" - }; hda_nid_t nid; int i, err; unsigned int wid_caps; @@ -3087,18 +3078,22 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, } else { const char *name; + int idx; switch (type) { case AUTO_PIN_HP_OUT: - name = hp_pfxs[i]; + name = "Headphone"; + idx = i; break; case AUTO_PIN_SPEAKER_OUT: - name = speaker_pfxs[i]; + name = "Speaker"; + idx = i; break; default: name = chname[i]; + idx = 0; break; } - err = create_controls(codec, name, nid, 3); + err = create_controls_idx(codec, name, idx, nid, 3); if (err < 0) return err; if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { -- cgit v1.2.3 From ee58a7ca21b2acf0d7ad0e1eb2f8d916ecf9fadc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 12:00:24 +0100 Subject: ALSA: hda - Connect to primary DAC if no individual DAC is available In stac92xx_auto_fill_dac_nids[], connect to the primary DAC if no individual DAC is available for each pin. This ensures that the pin works somehow at least. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d19090fd2d13..ee119259183c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2871,6 +2871,16 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) return conn[j]; } } + /* if all DACs are already assigned, connect to the primary DAC */ + if (conn_len > 1) { + for (j = 0; j < conn_len; j++) { + if (conn[j] == spec->multiout.dac_nids[0]) { + snd_hda_codec_write_cache(codec, nid, 0, + AC_VERB_SET_CONNECT_SEL, j); + break; + } + } + } return 0; } -- cgit v1.2.3 From 139e071b0ff37800ed0a68b10c4bb325f51786eb Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 12:10:41 +0100 Subject: ALSA: hda - Assign HP and speaker DACs before mic/line-in Assign DACs to HP and speaker before mic-in/line-in shared outputs. This improves the usability as it results in more intuitive mixer names. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ee119259183c..123bcf7c3b24 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2921,6 +2921,26 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) add_spec_dacs(spec, dac); } + for (i = 0; i < cfg->hp_outs; i++) { + nid = cfg->hp_pins[i]; + dac = get_unassigned_dac(codec, nid); + if (dac) { + if (!spec->multiout.hp_nid) + spec->multiout.hp_nid = dac; + else + add_spec_extra_dacs(spec, dac); + } + spec->hp_dacs[i] = dac; + } + + for (i = 0; i < cfg->speaker_outs; i++) { + nid = cfg->speaker_pins[i]; + dac = get_unassigned_dac(codec, nid); + if (dac) + add_spec_extra_dacs(spec, dac); + spec->speaker_dacs[i] = dac; + } + /* add line-in as output */ nid = check_line_out_switch(codec); if (nid) { @@ -2948,26 +2968,6 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) } } - for (i = 0; i < cfg->hp_outs; i++) { - nid = cfg->hp_pins[i]; - dac = get_unassigned_dac(codec, nid); - if (dac) { - if (!spec->multiout.hp_nid) - spec->multiout.hp_nid = dac; - else - add_spec_extra_dacs(spec, dac); - } - spec->hp_dacs[i] = dac; - } - - for (i = 0; i < cfg->speaker_outs; i++) { - nid = cfg->speaker_pins[i]; - dac = get_unassigned_dac(codec, nid); - if (dac) - add_spec_extra_dacs(spec, dac); - spec->speaker_dacs[i] = dac; - } - snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", spec->multiout.num_dacs, spec->multiout.dac_nids[0], -- cgit v1.2.3 From 90f349d96e1dc05b1f7916958282c30760eeacd6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 14:30:08 +0100 Subject: ALSA: ac97 - Add patch entry for Conexant CX20468-31 chip Added the patch entry for Conexant CX20468-31 chip (4358:5430). Reference: Novell bnc#471265 https://bugzilla.novell.com/show_bug.cgi?id=471265 Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_codec.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index bc707b603852..44f2381b0aed 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -143,6 +143,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { { 0x43525970, 0xfffffff8, "CS4202", NULL, NULL }, { 0x43585421, 0xffffffff, "HSD11246", NULL, NULL }, // SmartMC II { 0x43585428, 0xfffffff8, "Cx20468", patch_conexant, NULL }, // SmartAMC fixme: the mask might be different +{ 0x43585430, 0xffffffff, "Cx20468-31", patch_conexant, NULL }, { 0x43585431, 0xffffffff, "Cx20551", patch_cx20551, NULL }, { 0x44543031, 0xfffffff0, "DT0398", NULL, NULL }, { 0x454d4328, 0xffffffff, "EM28028", NULL, NULL }, // same as TR28028? -- cgit v1.2.3 From 873591db59e66434fd0a484c92f69fc21100b33d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 9 Mar 2009 09:12:55 +0100 Subject: sound: oxygen: enable headphone output on Claro cards On the HT-Omega Claro (halo) sound cards, the headphone amplifier must be enabled explicitly by setting a GPIO bit. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen.c | 63 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index 1d8e2b29745d..72db4c39007f 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -1,5 +1,5 @@ /* - * C-Media CMI8788 driver for C-Media's reference design and for the X-Meridian + * C-Media CMI8788 driver for C-Media's reference design and similar models * * Copyright (c) Clemens Ladisch * @@ -26,6 +26,7 @@ * * GPIO 0 -> DFS0 of AK5385 * GPIO 1 -> DFS1 of AK5385 + * GPIO 8 -> enable headphone amplifier on HT-Omega models */ #include @@ -61,7 +62,8 @@ MODULE_PARM_DESC(enable, "enable card"); enum { MODEL_CMEDIA_REF, /* C-Media's reference design */ MODEL_MERIDIAN, /* AuzenTech X-Meridian */ - MODEL_HALO, /* HT-Omega Claro halo */ + MODEL_CLARO, /* HT-Omega Claro */ + MODEL_CLARO_HALO, /* HT-Omega Claro halo */ }; static struct pci_device_id oxygen_ids[] __devinitdata = { @@ -74,8 +76,8 @@ static struct pci_device_id oxygen_ids[] __devinitdata = { { OXYGEN_PCI_SUBID(0x147a, 0xa017), .driver_data = MODEL_CMEDIA_REF }, { OXYGEN_PCI_SUBID(0x1a58, 0x0910), .driver_data = MODEL_CMEDIA_REF }, { OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = MODEL_MERIDIAN }, - { OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CMEDIA_REF }, - { OXYGEN_PCI_SUBID(0x7284, 0x9781), .driver_data = MODEL_HALO }, + { OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CLARO }, + { OXYGEN_PCI_SUBID(0x7284, 0x9781), .driver_data = MODEL_CLARO_HALO }, { } }; MODULE_DEVICE_TABLE(pci, oxygen_ids); @@ -86,6 +88,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids); #define GPIO_AK5385_DFS_DOUBLE 0x0001 #define GPIO_AK5385_DFS_QUAD 0x0002 +#define GPIO_CLARO_HP 0x0100 + struct generic_data { u8 ak4396_ctl2; u16 saved_wm8785_registers[2]; @@ -196,16 +200,46 @@ static void meridian_init(struct oxygen *chip) ak5385_init(chip); } -static void halo_init(struct oxygen *chip) +static void claro_enable_hp(struct oxygen *chip) +{ + msleep(300); + oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_CLARO_HP); + oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_CLARO_HP); +} + +static void claro_init(struct oxygen *chip) +{ + ak4396_init(chip); + wm8785_init(chip); + claro_enable_hp(chip); +} + +static void claro_halo_init(struct oxygen *chip) { ak4396_init(chip); ak5385_init(chip); + claro_enable_hp(chip); } static void generic_cleanup(struct oxygen *chip) { } +static void claro_disable_hp(struct oxygen *chip) +{ + oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, GPIO_CLARO_HP); +} + +static void claro_cleanup(struct oxygen *chip) +{ + claro_disable_hp(chip); +} + +static void claro_suspend(struct oxygen *chip) +{ + claro_disable_hp(chip); +} + static void generic_resume(struct oxygen *chip) { ak4396_registers_init(chip); @@ -217,9 +251,10 @@ static void meridian_resume(struct oxygen *chip) ak4396_registers_init(chip); } -static void halo_resume(struct oxygen *chip) +static void claro_resume(struct oxygen *chip) { ak4396_registers_init(chip); + claro_enable_hp(chip); } static void set_ak4396_params(struct oxygen *chip, @@ -346,14 +381,22 @@ static int __devinit get_oxygen_model(struct oxygen *chip, CAPTURE_0_FROM_I2S_2 | CAPTURE_1_FROM_SPDIF; break; - case MODEL_HALO: - chip->model.init = halo_init; - chip->model.resume = halo_resume; + case MODEL_CLARO: + chip->model.init = claro_init; + chip->model.cleanup = claro_cleanup; + chip->model.suspend = claro_suspend; + chip->model.resume = claro_resume; + break; + case MODEL_CLARO_HALO: + chip->model.init = claro_halo_init; + chip->model.cleanup = claro_cleanup; + chip->model.suspend = claro_suspend; + chip->model.resume = claro_resume; chip->model.set_adc_params = set_ak5385_params; break; } if (id->driver_data == MODEL_MERIDIAN || - id->driver_data == MODEL_HALO) { + id->driver_data == MODEL_CLARO_HALO) { chip->model.misc_flags = OXYGEN_MISC_MIDI; chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT; } -- cgit v1.2.3 From ed3da3d9a0ef13c6fe1414ec73c9c1be12747b62 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 3 Mar 2009 17:00:15 +0100 Subject: ALSA: Rewrite hw_ptr updaters Clean up and improve snd_pcm_update_hw_ptr*() functions. snd_pcm_update_hw_ptr() tries to detect the unexpected hwptr jumps more strictly to avoid the position mess-up, which often results in the bad quality I/O with pulseaudio. The hw-ptr skip error messages are printed when xrun proc is set to non-zero. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 128 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 83 insertions(+), 45 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 921691080f35..86ac9ae9460e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -125,19 +125,27 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram } } +#ifdef CONFIG_SND_PCM_XRUN_DEBUG +#define xrun_debug(substream) ((substream)->pstr->xrun_debug) +#else +#define xrun_debug(substream) 0 +#endif + +#define dump_stack_on_xrun(substream) do { \ + if (xrun_debug(substream) > 1) \ + dump_stack(); \ + } while (0) + static void xrun(struct snd_pcm_substream *substream) { snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); -#ifdef CONFIG_SND_PCM_XRUN_DEBUG - if (substream->pstr->xrun_debug) { + if (xrun_debug(substream)) { snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", substream->pcm->card->number, substream->pcm->device, substream->stream ? 'c' : 'p'); - if (substream->pstr->xrun_debug > 1) - dump_stack(); + dump_stack_on_xrun(substream); } -#endif } static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, @@ -182,11 +190,21 @@ static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream return 0; } +#define hw_ptr_error(substream, fmt, args...) \ + do { \ + if (xrun_debug(substream)) { \ + if (printk_ratelimit()) { \ + snd_printd("hda_codec: " fmt, ##args); \ + } \ + dump_stack_on_xrun(substream); \ + } \ + } while (0) + static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_uframes_t pos; - snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt; + snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt, hw_base; snd_pcm_sframes_t delta; pos = snd_pcm_update_hw_ptr_pos(substream, runtime); @@ -194,36 +212,47 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs xrun(substream); return -EPIPE; } - if (runtime->period_size == runtime->buffer_size) - goto __next_buf; - new_hw_ptr = runtime->hw_ptr_base + pos; + hw_base = runtime->hw_ptr_base; + new_hw_ptr = hw_base + pos; hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; - - delta = hw_ptr_interrupt - new_hw_ptr; - if (delta > 0) { - if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { -#ifdef CONFIG_SND_PCM_XRUN_DEBUG - if (runtime->periods > 1 && substream->pstr->xrun_debug) { - snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); - if (substream->pstr->xrun_debug > 1) - dump_stack(); - } -#endif - return 0; + delta = new_hw_ptr - hw_ptr_interrupt; + if (hw_ptr_interrupt == runtime->boundary) + hw_ptr_interrupt = 0; + if (delta < 0) { + delta += runtime->buffer_size; + if (delta < 0) { + hw_ptr_error(substream, + "Unexpected hw_pointer value " + "(stream=%i, pos=%ld, intr_ptr=%ld)\n", + substream->stream, (long)pos, + (long)hw_ptr_interrupt); + /* rebase to interrupt position */ + hw_base = new_hw_ptr = hw_ptr_interrupt; + delta = 0; + } else { + hw_base += runtime->buffer_size; + if (hw_base == runtime->boundary) + hw_base = 0; + new_hw_ptr = hw_base + pos; } - __next_buf: - runtime->hw_ptr_base += runtime->buffer_size; - if (runtime->hw_ptr_base == runtime->boundary) - runtime->hw_ptr_base = 0; - new_hw_ptr = runtime->hw_ptr_base + pos; } - + if (delta > runtime->period_size) { + hw_ptr_error(substream, + "Lost interrupts? " + "(stream=%i, delta=%ld, intr_ptr=%ld)\n", + substream->stream, (long)delta, + (long)hw_ptr_interrupt); + /* rebase hw_ptr_interrupt */ + hw_ptr_interrupt = + new_hw_ptr - new_hw_ptr % runtime->period_size; + } if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && runtime->silence_size > 0) snd_pcm_playback_silence(substream, new_hw_ptr); + runtime->hw_ptr_base = hw_base; runtime->status->hw_ptr = new_hw_ptr; - runtime->hw_ptr_interrupt = new_hw_ptr - new_hw_ptr % runtime->period_size; + runtime->hw_ptr_interrupt = hw_ptr_interrupt; return snd_pcm_update_hw_ptr_post(substream, runtime); } @@ -233,7 +262,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_uframes_t pos; - snd_pcm_uframes_t old_hw_ptr, new_hw_ptr; + snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_base; snd_pcm_sframes_t delta; old_hw_ptr = runtime->status->hw_ptr; @@ -242,29 +271,38 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) xrun(substream); return -EPIPE; } - new_hw_ptr = runtime->hw_ptr_base + pos; - - delta = old_hw_ptr - new_hw_ptr; - if (delta > 0) { - if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { -#ifdef CONFIG_SND_PCM_XRUN_DEBUG - if (runtime->periods > 2 && substream->pstr->xrun_debug) { - snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); - if (substream->pstr->xrun_debug > 1) - dump_stack(); - } -#endif + hw_base = runtime->hw_ptr_base; + new_hw_ptr = hw_base + pos; + + delta = new_hw_ptr - old_hw_ptr; + if (delta < 0) { + delta += runtime->buffer_size; + if (delta < 0) { + hw_ptr_error(substream, + "Unexpected hw_pointer value [2] " + "(stream=%i, pos=%ld, old_ptr=%ld)\n", + substream->stream, (long)pos, + (long)old_hw_ptr); return 0; } - runtime->hw_ptr_base += runtime->buffer_size; - if (runtime->hw_ptr_base == runtime->boundary) - runtime->hw_ptr_base = 0; - new_hw_ptr = runtime->hw_ptr_base + pos; + hw_base += runtime->buffer_size; + if (hw_base == runtime->boundary) + hw_base = 0; + new_hw_ptr = hw_base + pos; + } + if (delta > runtime->period_size && runtime->periods > 1) { + hw_ptr_error(substream, + "hw_ptr skipping! " + "(pos=%ld, delta=%ld, period=%ld)\n", + (long)pos, (long)delta, + (long)runtime->period_size); + return 0; } if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && runtime->silence_size > 0) snd_pcm_playback_silence(substream, new_hw_ptr); + runtime->hw_ptr_base = hw_base; runtime->status->hw_ptr = new_hw_ptr; return snd_pcm_update_hw_ptr_post(substream, runtime); -- cgit v1.2.3 From 85122ea40c4fc82af5b66b8683f525c2c4a36d1a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 6 Mar 2009 16:30:07 +0100 Subject: ALSA: Remove unneeded snd_pcm_substream.timer_lock The timer callbacks are called in the protected status by the lock of the timer instance, so there is no need for an extra lock in the PCM substream. Signed-off-by: Takashi Iwai --- include/sound/pcm.h | 1 - sound/core/pcm.c | 1 - sound/core/pcm_timer.c | 6 ------ 3 files changed, 8 deletions(-) (limited to 'sound') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 40c5a6fa6bcd..e4f60076e6c4 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -364,7 +364,6 @@ struct snd_pcm_substream { /* -- timer section -- */ struct snd_timer *timer; /* timer */ unsigned timer_running: 1; /* time is running */ - spinlock_t timer_lock; /* -- next substream -- */ struct snd_pcm_substream *next; /* -- linked substreams -- */ diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 192a433a2403..37f567a68ef2 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -667,7 +667,6 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) spin_lock_init(&substream->self_group.lock); INIT_LIST_HEAD(&substream->self_group.substreams); list_add_tail(&substream->link_list, &substream->self_group.substreams); - spin_lock_init(&substream->timer_lock); atomic_set(&substream->mmap_count, 0); prev = substream; } diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c index 2c89c04f2916..ca8068b63d6c 100644 --- a/sound/core/pcm_timer.c +++ b/sound/core/pcm_timer.c @@ -85,25 +85,19 @@ static unsigned long snd_pcm_timer_resolution(struct snd_timer * timer) static int snd_pcm_timer_start(struct snd_timer * timer) { - unsigned long flags; struct snd_pcm_substream *substream; substream = snd_timer_chip(timer); - spin_lock_irqsave(&substream->timer_lock, flags); substream->timer_running = 1; - spin_unlock_irqrestore(&substream->timer_lock, flags); return 0; } static int snd_pcm_timer_stop(struct snd_timer * timer) { - unsigned long flags; struct snd_pcm_substream *substream; substream = snd_timer_chip(timer); - spin_lock_irqsave(&substream->timer_lock, flags); substream->timer_running = 0; - spin_unlock_irqrestore(&substream->timer_lock, flags); return 0; } -- cgit v1.2.3 From 7ebc8d56f407184a457dd5fc739cf39e423a25aa Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Fri, 2 Jan 2009 19:38:42 +0800 Subject: [ARM] pxa: move DMA registers definitions into 1. Driver code where pxa_request_dma() is called will most likely reference DMA registers as well, and it is really unnecessary to include pxa-regs.h just for this. Move the definitions into and make relevant drivers include it instead of . 2. Introduce DMAC_REGS_VIRT as the virtual address base for these DMA registers. This allows later processors to re-use the same IP while registers may start at different I/O address. Signed-off-by: Eric Miao --- arch/arm/mach-pxa/dma.c | 2 -- arch/arm/mach-pxa/include/mach/dma.h | 56 +++++++++++++++++++++++++++++ arch/arm/mach-pxa/include/mach/pxa-regs.h | 59 ------------------------------- drivers/media/video/pxa_camera.c | 1 - drivers/mmc/host/pxamci.c | 3 +- drivers/mtd/nand/pxa3xx_nand.c | 1 - drivers/spi/pxa2xx_spi.c | 2 -- sound/soc/pxa/pxa-ssp.c | 2 +- sound/soc/pxa/pxa2xx-ac97.c | 2 +- sound/soc/pxa/pxa2xx-i2s.c | 2 +- 10 files changed, 60 insertions(+), 70 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c index 4613bf1fe43c..01217e01f7d2 100644 --- a/arch/arm/mach-pxa/dma.c +++ b/arch/arm/mach-pxa/dma.c @@ -23,8 +23,6 @@ #include #include -#include - struct dma_channel { char *name; pxa_dma_prio prio; diff --git a/arch/arm/mach-pxa/include/mach/dma.h b/arch/arm/mach-pxa/include/mach/dma.h index 77607fe4bd65..b0812f59d3f8 100644 --- a/arch/arm/mach-pxa/include/mach/dma.h +++ b/arch/arm/mach-pxa/include/mach/dma.h @@ -12,6 +12,62 @@ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H +#include + +/* DMA Controller Registers Definitions */ +#define DMAC_REGS_VIRT io_p2v(0x40000000) +#define DMAC_REG(x) (*((volatile u32 *)(DMAC_REGS_VIRT + (x)))) + +#define DCSR(n) DMAC_REG((n) << 2) +#define DALGN DMAC_REG(0x00a0) /* DMA Alignment Register */ +#define DINT DMAC_REG(0x00f0) /* DMA Interrupt Register */ +#define DDADR(n) DMAC_REG(0x0200 + ((n) << 4)) +#define DSADR(n) DMAC_REG(0x0204 + ((n) << 4)) +#define DTADR(n) DMAC_REG(0x0208 + ((n) << 4)) +#define DCMD(n) DMAC_REG(0x020c + ((n) << 4)) +#define DRCMR(n) DMAC_REG((((n) < 64) ? 0x0100 : 0x1100) + \ + (((n) & 0x3f) << 2)) + +#define DCSR_RUN (1 << 31) /* Run Bit (read / write) */ +#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch (read / write) */ +#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable (read / write) */ +#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */ +#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */ +#define DCSR_ENDINTR (1 << 2) /* End Interrupt (read / write) */ +#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */ +#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */ + +#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) +#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable (R/W) */ +#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */ +#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */ +#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */ +#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */ +#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */ +#define DCSR_EORINTR (1 << 9) /* The end of Receive */ +#endif + +#define DRCMR_MAPVLD (1 << 7) /* Map Valid (read / write) */ +#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */ + +#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor (mask) */ +#define DDADR_STOP (1 << 0) /* Stop (read / write) */ + +#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */ +#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */ +#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */ +#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */ +#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */ +#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */ +#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */ +#define DCMD_BURST8 (1 << 16) /* 8 byte burst */ +#define DCMD_BURST16 (2 << 16) /* 16 byte burst */ +#define DCMD_BURST32 (3 << 16) /* 32 byte burst */ +#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */ +#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */ +#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */ +#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ + /* * Descriptor structure for PXA's DMA engine * Note: this structure must always be aligned to a 16-byte boundary. diff --git a/arch/arm/mach-pxa/include/mach/pxa-regs.h b/arch/arm/mach-pxa/include/mach/pxa-regs.h index 31d615aa7723..7d8db197615c 100644 --- a/arch/arm/mach-pxa/include/mach/pxa-regs.h +++ b/arch/arm/mach-pxa/include/mach/pxa-regs.h @@ -65,65 +65,6 @@ #define _PCMCIA1Attr _PCMCIAAttr (1) /* PCMCIA 1 Attribute */ #define _PCMCIA1Mem _PCMCIAMem (1) /* PCMCIA 1 Memory */ - - -/* - * DMA Controller - */ -#define DCSR(x) __REG2(0x40000000, (x) << 2) - -#define DCSR_RUN (1 << 31) /* Run Bit (read / write) */ -#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch (read / write) */ -#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable (read / write) */ -#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */ -#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */ -#define DCSR_ENDINTR (1 << 2) /* End Interrupt (read / write) */ -#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */ -#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */ - -#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) -#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable (R/W) */ -#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */ -#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */ -#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */ -#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */ -#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */ -#define DCSR_EORINTR (1 << 9) /* The end of Receive */ -#endif - -#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ -#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ - -#define DRCMR(n) (*(((n) < 64) ? \ - &__REG2(0x40000100, ((n) & 0x3f) << 2) : \ - &__REG2(0x40001100, ((n) & 0x3f) << 2))) - -#define DRCMR_MAPVLD (1 << 7) /* Map Valid (read / write) */ -#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */ - -#define DDADR(x) __REG2(0x40000200, (x) << 4) -#define DSADR(x) __REG2(0x40000204, (x) << 4) -#define DTADR(x) __REG2(0x40000208, (x) << 4) -#define DCMD(x) __REG2(0x4000020c, (x) << 4) - -#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor (mask) */ -#define DDADR_STOP (1 << 0) /* Stop (read / write) */ - -#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */ -#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */ -#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */ -#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */ -#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */ -#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */ -#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */ -#define DCMD_BURST8 (1 << 16) /* 8 byte burst */ -#define DCMD_BURST16 (2 << 16) /* 16 byte burst */ -#define DCMD_BURST32 (3 << 16) /* 32 byte burst */ -#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */ -#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */ -#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */ -#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ - /* * Real Time Clock */ diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index a1d6008efcbb..e3e6b29ea6d2 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c @@ -35,7 +35,6 @@ #include #include -#include #include #define PXA_CAM_VERSION_CODE KERNEL_VERSION(0, 0, 5) diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 9702ad3774cf..430095725f9f 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c @@ -30,9 +30,8 @@ #include -#include #include -#include +#include #include #include "pxamci.h" diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index cc55cbc2b308..61b69cc40009 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -22,7 +22,6 @@ #include #include -#include #include #define CHIP_DELAY_TIMEOUT (2 * HZ/10) diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index d0fc4ca2f656..d22fac27219a 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c @@ -34,8 +34,6 @@ #include #include -#include -#include #include #include #include diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 73cb6b4c2f2d..1dfdf66fb1f3 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 812c2b4d3e07..a4a655f7e304 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -20,8 +20,8 @@ #include #include -#include #include +#include #include "pxa2xx-pcm.h" #include "pxa2xx-ac97.h" diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 517991fb1099..223de890259e 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include -- cgit v1.2.3 From 5742964e916269e01a3467d2bff2601180b7da3d Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Mon, 19 Jan 2009 15:28:07 +0800 Subject: [ARM] pxa: remove unnecessary #include of pxa-regs.h and hardware.h pxa-regs.h and hardware.h are not intended for use directly in driver code, remove those unnecessary references. Signed-off-by: Eric Miao --- arch/arm/mach-pxa/cm-x2xx-pci.c | 1 - arch/arm/mach-pxa/himalaya.c | 2 -- arch/arm/mach-pxa/pwm.c | 1 - arch/arm/mach-pxa/ssp.c | 1 - drivers/input/keyboard/corgikbd.c | 2 -- drivers/input/keyboard/spitzkbd.c | 2 -- drivers/net/smc911x.h | 3 +-- drivers/net/smc91x.h | 2 -- drivers/pcmcia/pxa2xx_base.c | 1 - drivers/pcmcia/pxa2xx_cm_x255.c | 1 - drivers/pcmcia/pxa2xx_cm_x270.c | 1 - drivers/pcmcia/pxa2xx_e740.c | 2 -- drivers/pcmcia/pxa2xx_lubbock.c | 1 - drivers/pcmcia/pxa2xx_viper.c | 1 - drivers/video/pxafb.c | 1 - sound/arm/pxa2xx-ac97-lib.c | 1 - sound/arm/pxa2xx-ac97.c | 2 -- sound/arm/pxa2xx-pcm-lib.c | 3 +-- sound/soc/pxa/corgi.c | 2 -- sound/soc/pxa/e800_wm9712.c | 2 -- sound/soc/pxa/em-x270.c | 2 -- sound/soc/pxa/poodle.c | 2 -- sound/soc/pxa/spitz.c | 2 -- sound/soc/pxa/tosa.c | 2 -- 24 files changed, 2 insertions(+), 38 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c index 3156b25f6e9d..7873fa3d8fa4 100644 --- a/arch/arm/mach-pxa/cm-x2xx-pci.c +++ b/arch/arm/mach-pxa/cm-x2xx-pci.c @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c index 00884e5a6042..cea99fe65b97 100644 --- a/arch/arm/mach-pxa/himalaya.c +++ b/arch/arm/mach-pxa/himalaya.c @@ -26,8 +26,6 @@ #include #include -#include -#include #include "generic.h" diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c index 3ca7ffc6904b..fcdd374437a8 100644 --- a/arch/arm/mach-pxa/pwm.c +++ b/arch/arm/mach-pxa/pwm.c @@ -20,7 +20,6 @@ #include #include -#include /* PWM registers and bits definitions */ #define PWMCR (0x00) diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c index 6f42004db3ed..965e38c6bafe 100644 --- a/arch/arm/mach-pxa/ssp.c +++ b/arch/arm/mach-pxa/ssp.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #define TIMEOUT 100000 diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index c8ed065ea0cb..529121be8a98 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index c48b76a46a58..9a7371c93b3f 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c @@ -21,8 +21,6 @@ #include #include -#include -#include #include #define KB_ROWS 7 diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 870b4c33f108..611584ee7a01 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h @@ -226,8 +226,7 @@ static inline void SMC_outsl(struct smc911x_local *lp, int reg, * Use a DMA for RX and TX packets. */ #include -#include -#include +#include static dma_addr_t rx_dmabuf, tx_dmabuf; static int rx_dmalen, tx_dmalen; diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index c4ccd121bc9c..4d689b59c58c 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h @@ -494,8 +494,6 @@ struct smc_local { */ #include #include -#include -#include #ifdef SMC_insl #undef SMC_insl diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index bb9ddb9532e3..0227691860ae 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c index 7c8bcb476622..4ed64d8e95e7 100644 --- a/drivers/pcmcia/pxa2xx_cm_x255.c +++ b/drivers/pcmcia/pxa2xx_cm_x255.c @@ -16,7 +16,6 @@ #include #include -#include #include "soc_common.h" diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c index 6c3aac377126..a7b943d01e34 100644 --- a/drivers/pcmcia/pxa2xx_cm_x270.c +++ b/drivers/pcmcia/pxa2xx_cm_x270.c @@ -16,7 +16,6 @@ #include #include -#include #include "soc_common.h" diff --git a/drivers/pcmcia/pxa2xx_e740.c b/drivers/pcmcia/pxa2xx_e740.c index f663a011bf4a..d09c0dc4a31a 100644 --- a/drivers/pcmcia/pxa2xx_e740.c +++ b/drivers/pcmcia/pxa2xx_e740.c @@ -16,8 +16,6 @@ #include #include -#include -#include #include #include diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 37ec55df086e..6cbb1b1f7cfd 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "sa1111_generic.h" diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index dd10481be7bf..17871360fe99 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c @@ -26,7 +26,6 @@ #include -#include #include #include diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 48ff701d3a72..287aa1d2a13c 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 35afd0c33be5..718d06640dd4 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 85cf591d4e11..ccec48fc8e3f 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -20,8 +20,6 @@ #include #include -#include -#include #include #include diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index 75a0d746fb60..108b643229ba 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -12,8 +12,7 @@ #include #include -#include -#include +#include #include "pxa2xx-pcm.h" diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 1ba25a559524..ec930667feff 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 2e3386dfa0f0..ac294c797b7d 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include "../codecs/wm9712.h" diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index fe4a729ea648..949be9c2a01b 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c @@ -29,8 +29,6 @@ #include #include -#include -#include #include #include "../codecs/wm9712.h" diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 6e9827189fff..cad2c4c0ac95 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index a3b9e6bdf979..de8778fa8729 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include "../codecs/wm8750.h" #include "pxa2xx-pcm.h" diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index c77194f74c9b..050223d04e54 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -30,8 +30,6 @@ #include #include -#include -#include #include #include "../codecs/wm9712.h" -- cgit v1.2.3 From f5b1db634280ecaf3147ee996f26aad0ed4828c4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 16 Jan 2009 18:15:22 +0100 Subject: ALSA: add snd_ctl_add_slave_uncached() Added snd_ctl_add_slave_uncached() function to add a slave element with volatile controls. The values of normal slave elements are supposed to be cachable, i.e. they are changed only via the put callbacks. OTOH, when a slave element is volatile and its values may be changed by other reason (e.g. hardware status change), the values will get inconsistent. The new function allows the slave elements with volatile changes. When the slave is tied with this call, the native get callback is issued at each time so that the values are always updated. Signed-off-by: Takashi Iwai --- include/sound/control.h | 20 ++++++++++++++++++-- sound/core/vmaster.c | 46 +++++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/include/sound/control.h b/include/sound/control.h index 4721b4bba053..4cf8f7aaa13f 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -171,6 +171,22 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, */ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, const unsigned int *tlv); -int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); - +int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, + unsigned int flags); +/* optional flags for slave */ +#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0) + +static inline int +snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, 0); +} + +static inline int +snd_ctl_add_slave_uncached(struct snd_kcontrol *master, + struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); +} + #endif /* __SOUND_CONTROL_H */ diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 4cc57f902e2c..d51b198d06d9 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -50,18 +50,38 @@ struct link_slave { struct link_master *master; struct link_ctl_info info; int vals[2]; /* current values */ + unsigned int flags; struct snd_kcontrol slave; /* the copy of original control entry */ }; +static int slave_update(struct link_slave *slave) +{ + struct snd_ctl_elem_value *uctl; + int err, ch; + + uctl = kmalloc(sizeof(*uctl), GFP_KERNEL); + if (!uctl) + return -ENOMEM; + uctl->id = slave->slave.id; + err = slave->slave.get(&slave->slave, uctl); + for (ch = 0; ch < slave->info.count; ch++) + slave->vals[ch] = uctl->value.integer.value[ch]; + kfree(uctl); + return 0; +} + /* get the slave ctl info and save the initial values */ static int slave_init(struct link_slave *slave) { struct snd_ctl_elem_info *uinfo; - struct snd_ctl_elem_value *uctl; - int err, ch; + int err; - if (slave->info.count) - return 0; /* already initialized */ + if (slave->info.count) { + /* already initialized */ + if (slave->flags & SND_CTL_SLAVE_NEED_UPDATE) + return slave_update(slave); + return 0; + } uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); if (!uinfo) @@ -85,15 +105,7 @@ static int slave_init(struct link_slave *slave) slave->info.max_val = uinfo->value.integer.max; kfree(uinfo); - uctl = kmalloc(sizeof(*uctl), GFP_KERNEL); - if (!uctl) - return -ENOMEM; - uctl->id = slave->slave.id; - err = slave->slave.get(&slave->slave, uctl); - for (ch = 0; ch < slave->info.count; ch++) - slave->vals[ch] = uctl->value.integer.value[ch]; - kfree(uctl); - return 0; + return slave_update(slave); } /* initialize master volume */ @@ -229,7 +241,8 @@ static void slave_free(struct snd_kcontrol *kcontrol) * - logarithmic volume control (dB level), no linear volume * - master can only attenuate the volume, no gain */ -int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) +int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, + unsigned int flags) { struct link_master *master_link = snd_kcontrol_chip(master); struct link_slave *srec; @@ -241,6 +254,7 @@ int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) srec->slave = *slave; memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); srec->master = master_link; + srec->flags = flags; /* override callbacks */ slave->info = slave_info; @@ -254,8 +268,7 @@ int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) list_add_tail(&srec->list, &master_link->slaves); return 0; } - -EXPORT_SYMBOL(snd_ctl_add_slave); +EXPORT_SYMBOL(_snd_ctl_add_slave); /* * ctl callbacks for master controls @@ -367,5 +380,4 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, return kctl; } - EXPORT_SYMBOL(snd_ctl_make_virtual_master); -- cgit v1.2.3 From b0a8a8fd1b3bd6fbbb4b599191b859d41e12a002 Mon Sep 17 00:00:00 2001 From: Risto Suominen Date: Tue, 20 Jan 2009 22:01:13 +0200 Subject: ALSA: powermac - Correct HP detection and input selectors for PMac 5500 Correct headphone detection and input selectors for PowerMac 5500 (AWACS). Signed-off-by: Risto Suominen Signed-off-by: Takashi Iwai --- sound/ppc/awacs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 7bd33e6552ab..0258ccb8f431 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -767,6 +767,7 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip) #endif /* CONFIG_PM */ #define IS_PM7500 (machine_is_compatible("AAPL,7500")) +#define IS_PM5500 (machine_is_compatible("AAPL,e411")) #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) #define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) #define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ @@ -858,6 +859,7 @@ int __init snd_pmac_awacs_init(struct snd_pmac *chip) { int pm7500 = IS_PM7500; + int pm5500 = IS_PM5500; int beige = IS_BEIGE; int g4agp = IS_G4AGP; int imac; @@ -915,7 +917,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) /* set headphone-jack detection bit */ switch (chip->model) { case PMAC_AWACS: - chip->hp_stat_mask = pm7500 ? MASK_HDPCONN + chip->hp_stat_mask = pm7500 || pm5500 ? MASK_HDPCONN : MASK_LOCONN; break; case PMAC_SCREAMER: @@ -954,7 +956,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) return err; if (beige || g4agp) ; - else if (chip->model == PMAC_SCREAMER) + else if (chip->model == PMAC_SCREAMER || pm5500) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2), snd_pmac_screamer_mixers2); else if (!pm7500) -- cgit v1.2.3 From 573934bc038b0f47d17a5608e74b79dcd7c191ea Mon Sep 17 00:00:00 2001 From: Risto Suominen Date: Tue, 20 Jan 2009 22:01:14 +0200 Subject: ALSA: powermac - Correct volume controls for PowerBook G3 Lombard Correct volume controls for PowerBook G3 Lombard (Screamer). Signed-off-by: Risto Suominen Signed-off-by: Takashi Iwai --- sound/ppc/awacs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 0258ccb8f431..d89c23e135dc 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -773,6 +773,7 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip) #define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ || machine_is_compatible("PowerMac4,1")) #define IS_G4AGP (machine_is_compatible("PowerMac3,1")) +#define IS_LOMBARD (machine_is_compatible("PowerBook1,1")) static int imac1, imac2; @@ -862,6 +863,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) int pm5500 = IS_PM5500; int beige = IS_BEIGE; int g4agp = IS_G4AGP; + int lombard = IS_LOMBARD; int imac; int err, vol; @@ -972,7 +974,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers_beige), snd_pmac_screamer_mixers_beige); - else if (imac) + else if (imac || lombard) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers_imac), snd_pmac_screamer_mixers_imac); @@ -986,7 +988,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) snd_pmac_awacs_mixers_pmac); if (err < 0) return err; - chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp) + chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp || lombard) ? &snd_pmac_awacs_master_sw_imac : &snd_pmac_awacs_master_sw, chip); err = snd_ctl_add(chip->card, chip->master_sw_ctl); -- cgit v1.2.3 From 4d9e93b1adf2923c0a0cbc545d6e78dec3334faf Mon Sep 17 00:00:00 2001 From: Risto Suominen Date: Tue, 20 Jan 2009 22:01:15 +0200 Subject: ALSA: powermac - Correct volume controls and HP detection for PMac 8500/9500 Correct volume controls and headphone detection for PowerMac 8500/9500 (AWACS). Signed-off-by: Risto Suominen Signed-off-by: Takashi Iwai --- sound/ppc/awacs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index d89c23e135dc..9abbf645eb67 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -766,7 +766,9 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip) } #endif /* CONFIG_PM */ -#define IS_PM7500 (machine_is_compatible("AAPL,7500")) +#define IS_PM7500 (machine_is_compatible("AAPL,7500") \ + || machine_is_compatible("AAPL,8500") \ + || machine_is_compatible("AAPL,9500")) #define IS_PM5500 (machine_is_compatible("AAPL,e411")) #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) #define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) -- cgit v1.2.3 From ed336d3404a8fdeda1e3f1c189b5f83186675448 Mon Sep 17 00:00:00 2001 From: Risto Suominen Date: Tue, 20 Jan 2009 22:01:16 +0200 Subject: ALSA: powermac - Allow input from mic in iBook G3 Dual-USB Allow input from microphone on iBook G3 Dual-USB (Tumbler). Signed-off-by: Risto Suominen Signed-off-by: Takashi Iwai --- sound/ppc/pmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index af76ee862d27..bd8f92b1c224 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -1033,7 +1033,8 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) } if (of_device_is_compatible(sound, "tumbler")) { chip->model = PMAC_TUMBLER; - chip->can_capture = machine_is_compatible("PowerMac4,2"); + chip->can_capture = machine_is_compatible("PowerMac4,2") + || machine_is_compatible("PowerBook4,1"); chip->can_duplex = 0; // chip->can_byte_swap = 0; /* FIXME: check this */ chip->num_freqs = ARRAY_SIZE(tumbler_freqs); -- cgit v1.2.3 From dca7c74172fee0cf6ee1e303df093c31b5561039 Mon Sep 17 00:00:00 2001 From: Risto Suominen Date: Tue, 20 Jan 2009 22:01:17 +0200 Subject: ALSA: Add vmaster controls for Pmac 5500, iMac G3 SL, and PBook G3 Lombard Add virtual master controls for PowerMac 5500 (AWACS) and iMac G3 Slot-loading and PowerBook G3 Lombard (Screamer). Signed-off-by: Risto Suominen Signed-off-by: Takashi Iwai --- sound/ppc/Kconfig | 1 + sound/ppc/awacs.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 69 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig index 777de2b17178..bd2338ab2ced 100644 --- a/sound/ppc/Kconfig +++ b/sound/ppc/Kconfig @@ -13,6 +13,7 @@ config SND_POWERMAC tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" depends on I2C && INPUT && PPC_PMAC select SND_PCM + select SND_VMASTER help Say Y here to include support for the integrated sound device. diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 9abbf645eb67..80df9b1f651e 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -608,9 +608,12 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] __initdata = { AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0), }; -static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = { +static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] __initdata = { AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), - AWACS_VOLUME("Master Playback Volume", 5, 6, 1), +}; + +static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = { + AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), }; @@ -627,6 +630,10 @@ static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = { AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), }; +static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] __initdata = { + AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1), +}; + static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] __initdata = { AWACS_VOLUME("Master Playback Volume", 2, 6, 1), AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), @@ -645,12 +652,19 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] __initdata = { AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), }; +static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] __initdata = { + AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), +}; + static struct snd_kcontrol_new snd_pmac_awacs_master_sw __initdata = AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac __initdata = AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1); +static struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 __initdata = +AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1); + static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] __initdata = { AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0), }; @@ -868,6 +882,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip) int lombard = IS_LOMBARD; int imac; int err, vol; + struct snd_kcontrol *vmaster_sw, *vmaster_vol; + struct snd_kcontrol *master_vol, *speaker_vol; imac1 = IS_IMAC1; imac2 = IS_IMAC2; @@ -968,19 +984,35 @@ snd_pmac_awacs_init(struct snd_pmac *chip) snd_pmac_awacs_mixers2); if (err < 0) return err; + if (pm5500) { + err = build_mixers(chip, + ARRAY_SIZE(snd_pmac_awacs_mixers2_pmac5500), + snd_pmac_awacs_mixers2_pmac5500); + if (err < 0) + return err; + } if (pm7500) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500), snd_pmac_awacs_mixers_pmac7500); + else if (pm5500) + err = snd_ctl_add(chip->card, + (master_vol = snd_ctl_new1(snd_pmac_awacs_mixers_pmac5500, + chip))); else if (beige) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers_beige), snd_pmac_screamer_mixers_beige); - else if (imac || lombard) + else if (imac || lombard) { + err = snd_ctl_add(chip->card, + (master_vol = snd_ctl_new1(snd_pmac_screamer_mixers_lo, + chip))); + if (err < 0) + return err; err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers_imac), snd_pmac_screamer_mixers_imac); - else if (g4agp) + } else if (g4agp) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp), snd_pmac_screamer_mixers_g4agp); @@ -992,6 +1024,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip) return err; chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp || lombard) ? &snd_pmac_awacs_master_sw_imac + : pm5500 + ? &snd_pmac_awacs_master_sw_pmac5500 : &snd_pmac_awacs_master_sw, chip); err = snd_ctl_add(chip->card, chip->master_sw_ctl); if (err < 0) @@ -1023,8 +1057,9 @@ snd_pmac_awacs_init(struct snd_pmac *chip) #endif /* PMAC_AMP_AVAIL */ { /* route A = headphone, route C = speaker */ - err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol), - snd_pmac_awacs_speaker_vol); + err = snd_ctl_add(chip->card, + (speaker_vol = snd_ctl_new1(snd_pmac_awacs_speaker_vol, + chip))); if (err < 0) return err; chip->speaker_sw_ctl = snd_ctl_new1(imac1 @@ -1037,6 +1072,33 @@ snd_pmac_awacs_init(struct snd_pmac *chip) return err; } + if (pm5500 || imac || lombard) { + vmaster_sw = snd_ctl_make_virtual_master( + "Master Playback Switch", (unsigned int *) NULL); + err = snd_ctl_add_slave_uncached(vmaster_sw, + chip->master_sw_ctl); + if (err < 0) + return err; + err = snd_ctl_add_slave_uncached(vmaster_sw, + chip->speaker_sw_ctl); + if (err < 0) + return err; + err = snd_ctl_add(chip->card, vmaster_sw); + if (err < 0) + return err; + vmaster_vol = snd_ctl_make_virtual_master( + "Master Playback Volume", (unsigned int *) NULL); + err = snd_ctl_add_slave(vmaster_vol, master_vol); + if (err < 0) + return err; + err = snd_ctl_add_slave(vmaster_vol, speaker_vol); + if (err < 0) + return err; + err = snd_ctl_add(chip->card, vmaster_vol); + if (err < 0) + return err; + } + if (beige || g4agp) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), -- cgit v1.2.3 From 6da6711385165eff76411b77974eec13c5ef6486 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:02:46 +0100 Subject: ALSA: powermac - Add missing KERN_* prefix to printk Signed-off-by: Takashi Iwai --- sound/ppc/daca.c | 2 +- sound/ppc/pmac.c | 8 ++++---- sound/ppc/powermac.c | 2 +- sound/ppc/tumbler.c | 13 +++++++------ 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index 8a5b29031933..f8d478c2da62 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c @@ -82,7 +82,7 @@ static int daca_set_volume(struct pmac_daca *mix) data[1] |= mix->deemphasis ? 0x40 : 0; if (i2c_smbus_write_block_data(mix->i2c.client, DACA_REG_AVOL, 2, data) < 0) { - snd_printk("failed to set volume \n"); + snd_printk(KERN_ERR "failed to set volume \n"); return -EINVAL; } return 0; diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index bd8f92b1c224..9b4e9c316695 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -299,7 +299,7 @@ static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec, case SNDRV_PCM_TRIGGER_SUSPEND: spin_lock(&chip->reg_lock); rec->running = 0; - /*printk("stopped!!\n");*/ + /*printk(KERN_DEBUG "stopped!!\n");*/ snd_pmac_dma_stop(rec); for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) out_le16(&cp->command, DBDMA_STOP); @@ -334,7 +334,7 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip, } #endif count += rec->cur_period * rec->period_size; - /*printk("pointer=%d\n", count);*/ + /*printk(KERN_DEBUG "pointer=%d\n", count);*/ return bytes_to_frames(subs->runtime, count); } @@ -486,7 +486,7 @@ static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) if (! (stat & ACTIVE)) break; - /*printk("update frag %d\n", rec->cur_period);*/ + /*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/ st_le16(&cp->xfer_status, 0); st_le16(&cp->req_count, rec->period_size); /*st_le16(&cp->res_count, 0);*/ @@ -806,7 +806,7 @@ snd_pmac_ctrl_intr(int irq, void *devid) struct snd_pmac *chip = devid; int ctrl = in_le32(&chip->awacs->control); - /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/ + /*printk(KERN_DEBUG "pmac: control interrupt.. 0x%x\n", ctrl);*/ if (ctrl & MASK_PORTCHG) { /* do something when headphone is plugged/unplugged? */ if (chip->update_automute) diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index c936225771ba..e9b02d974350 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -110,7 +110,7 @@ static int __init snd_pmac_probe(struct platform_device *devptr) goto __error; break; default: - snd_printk("unsupported hardware %d\n", chip->model); + snd_printk(KERN_ERR "unsupported hardware %d\n", chip->model); err = -EINVAL; goto __error; } diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 3eb223385416..40222fcc0878 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -41,7 +41,7 @@ #undef DEBUG #ifdef DEBUG -#define DBG(fmt...) printk(fmt) +#define DBG(fmt...) printk(KERN_DEBUG fmt) #else #define DBG(fmt...) #endif @@ -240,7 +240,7 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix) if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6, block) < 0) { - snd_printk("failed to set volume \n"); + snd_printk(KERN_ERR "failed to set volume \n"); return -EINVAL; } return 0; @@ -350,7 +350,7 @@ static int tumbler_set_drc(struct pmac_tumbler *mix) if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, 2, val) < 0) { - snd_printk("failed to set DRC\n"); + snd_printk(KERN_ERR "failed to set DRC\n"); return -EINVAL; } return 0; @@ -386,7 +386,7 @@ static int snapper_set_drc(struct pmac_tumbler *mix) if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, 6, val) < 0) { - snd_printk("failed to set DRC\n"); + snd_printk(KERN_ERR "failed to set DRC\n"); return -EINVAL; } return 0; @@ -506,7 +506,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix, block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg, info->bytes, block) < 0) { - snd_printk("failed to set mono volume %d\n", info->index); + snd_printk(KERN_ERR "failed to set mono volume %d\n", + info->index); return -EINVAL; } return 0; @@ -643,7 +644,7 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r } if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg, 9, block) < 0) { - snd_printk("failed to set mono volume %d\n", reg); + snd_printk(KERN_ERR "failed to set mono volume %d\n", reg); return -EINVAL; } return 0; -- cgit v1.2.3 From 39661758631da37efbc961e57a4ddefad573cc52 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Wed, 25 Feb 2009 13:40:26 +0100 Subject: ALSA: snd-powermac: timeout reaches -1 If unsuccessful, timeout reaches -1 after the loop. Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/ppc/burgundy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index f860d39af36b..45a76297c38d 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c @@ -35,7 +35,7 @@ snd_pmac_burgundy_busy_wait(struct snd_pmac *chip) int timeout = 50; while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) udelay(1); - if (! timeout) + if (timeout < 0) printk(KERN_DEBUG "burgundy_busy_wait: timeout\n"); } -- cgit v1.2.3 From 79c7cdd5441f5d3900c1632adcc8cd2bee35c8da Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Feb 2009 14:47:19 +0100 Subject: ALSA: Add kernel-doc comments to vmaster stuff Signed-off-by: Takashi Iwai --- .../sound/alsa/DocBook/alsa-driver-api.tmpl | 4 +++ include/sound/control.h | 32 ++++++++++++++++++++++ sound/core/vmaster.c | 16 +++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl index 9d644f7e241e..115962827c81 100644 --- a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl +++ b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl @@ -71,6 +71,10 @@ !Esound/pci/ac97/ac97_codec.c !Esound/pci/ac97/ac97_pcm.c + Virtual Master Control API +!Esound/core/vmaster.c +!Iinclude/sound/control.h + MIDI API Raw MIDI API diff --git a/include/sound/control.h b/include/sound/control.h index 4cf8f7aaa13f..ef96f07aa03b 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -176,12 +176,44 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, /* optional flags for slave */ #define SND_CTL_SLAVE_NEED_UPDATE (1 << 0) +/** + * snd_ctl_add_slave - Add a virtual slave control + * @master: vmaster element + * @slave: slave element to add + * + * Add a virtual slave control to the given master element created via + * snd_ctl_create_virtual_master() beforehand. + * Returns zero if successful or a negative error code. + * + * All slaves must be the same type (returning the same information + * via info callback). The fucntion doesn't check it, so it's your + * responsibility. + * + * Also, some additional limitations: + * at most two channels, + * logarithmic volume control (dB level) thus no linear volume, + * master can only attenuate the volume without gain + */ static inline int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) { return _snd_ctl_add_slave(master, slave, 0); } +/** + * snd_ctl_add_slave_uncached - Add a virtual slave control + * @master: vmaster element + * @slave: slave element to add + * + * Add a virtual slave control to the given master. + * Unlike snd_ctl_add_slave(), the element added via this function + * is supposed to have volatile values, and get callback is called + * at each time quried from the master. + * + * When the control peeks the hardware values directly and the value + * can be changed by other means than the put callback of the element, + * this function should be used to keep the value always up-to-date. + */ static inline int snd_ctl_add_slave_uncached(struct snd_kcontrol *master, struct snd_kcontrol *slave) diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index d51b198d06d9..257624bd1997 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -340,8 +340,20 @@ static void master_free(struct snd_kcontrol *kcontrol) } -/* - * Create a virtual master control with the given name +/** + * snd_ctl_make_virtual_master - Create a virtual master control + * @name: name string of the control element to create + * @tlv: optional TLV int array for dB information + * + * Creates a virtual matster control with the given name string. + * Returns the created control element, or NULL for errors (ENOMEM). + * + * After creating a vmaster element, you can add the slave controls + * via snd_ctl_add_slave() or snd_ctl_add_slave_uncached(). + * + * The optional argument @tlv can be used to specify the TLV information + * for dB scale of the master control. It should be a single element + * with #SNDRV_CTL_TLVT_DB_SCALE type, and should be the max 0dB. */ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, const unsigned int *tlv) -- cgit v1.2.3 From 118dd6bfe7e0cddc8ab417ead19cc76000e92773 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Feb 2009 16:35:21 +0100 Subject: ALSA: Clean up snd_monitor_file management Use the standard linked list for snd_monitor_file management. Also, move the list deletion of shutdown_list element into snd_disconnect_release() (for simplification). Signed-off-by: Takashi Iwai --- include/sound/core.h | 6 +++--- sound/core/init.c | 42 +++++++++++++++--------------------------- 2 files changed, 18 insertions(+), 30 deletions(-) (limited to 'sound') diff --git a/include/sound/core.h b/include/sound/core.h index f632484bc743..bd4529e0c27e 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -97,9 +97,9 @@ struct snd_device { struct snd_monitor_file { struct file *file; - struct snd_monitor_file *next; const struct file_operations *disconnected_f_op; - struct list_head shutdown_list; + struct list_head shutdown_list; /* still need to shutdown */ + struct list_head list; /* link of monitor files */ }; /* main structure for soundcard */ @@ -134,7 +134,7 @@ struct snd_card { struct snd_info_entry *proc_id; /* the card id */ struct proc_dir_entry *proc_root_link; /* number link to real id */ - struct snd_monitor_file *files; /* all files associated to this card */ + struct list_head files_list; /* all files associated to this card */ struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown state */ spinlock_t files_lock; /* lock the files for this card */ diff --git a/sound/core/init.c b/sound/core/init.c index 0d5520c415d3..05c6da554cbf 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -195,6 +195,7 @@ struct snd_card *snd_card_new(int idx, const char *xid, INIT_LIST_HEAD(&card->controls); INIT_LIST_HEAD(&card->ctl_files); spin_lock_init(&card->files_lock); + INIT_LIST_HEAD(&card->files_list); init_waitqueue_head(&card->shutdown_sleep); #ifdef CONFIG_PM mutex_init(&card->power_lock); @@ -259,6 +260,7 @@ static int snd_disconnect_release(struct inode *inode, struct file *file) list_for_each_entry(_df, &shutdown_files, shutdown_list) { if (_df->file == file) { df = _df; + list_del_init(&df->shutdown_list); break; } } @@ -347,8 +349,7 @@ int snd_card_disconnect(struct snd_card *card) /* phase 2: replace file->f_op with special dummy operations */ spin_lock(&card->files_lock); - mfile = card->files; - while (mfile) { + list_for_each_entry(mfile, &card->files_list, list) { file = mfile->file; /* it's critical part, use endless loop */ @@ -361,8 +362,6 @@ int snd_card_disconnect(struct snd_card *card) mfile->file->f_op = &snd_shutdown_f_ops; fops_get(mfile->file->f_op); - - mfile = mfile->next; } spin_unlock(&card->files_lock); @@ -442,7 +441,7 @@ int snd_card_free_when_closed(struct snd_card *card) return ret; spin_lock(&card->files_lock); - if (card->files == NULL) + if (list_empty(&card->files_list)) free_now = 1; else card->free_on_last_close = 1; @@ -462,7 +461,7 @@ int snd_card_free(struct snd_card *card) return ret; /* wait, until all devices are ready for the free operation */ - wait_event(card->shutdown_sleep, card->files == NULL); + wait_event(card->shutdown_sleep, list_empty(&card->files_list)); snd_card_do_free(card); return 0; } @@ -809,15 +808,13 @@ int snd_card_file_add(struct snd_card *card, struct file *file) return -ENOMEM; mfile->file = file; mfile->disconnected_f_op = NULL; - mfile->next = NULL; spin_lock(&card->files_lock); if (card->shutdown) { spin_unlock(&card->files_lock); kfree(mfile); return -ENODEV; } - mfile->next = card->files; - card->files = mfile; + list_add(&mfile->list, &card->files_list); spin_unlock(&card->files_lock); return 0; } @@ -839,29 +836,20 @@ EXPORT_SYMBOL(snd_card_file_add); */ int snd_card_file_remove(struct snd_card *card, struct file *file) { - struct snd_monitor_file *mfile, *pfile = NULL; + struct snd_monitor_file *mfile, *found = NULL; int last_close = 0; spin_lock(&card->files_lock); - mfile = card->files; - while (mfile) { + list_for_each_entry(mfile, &card->files_list, list) { if (mfile->file == file) { - if (pfile) - pfile->next = mfile->next; - else - card->files = mfile->next; + list_del(&mfile->list); + if (mfile->disconnected_f_op) + fops_put(mfile->disconnected_f_op); + found = mfile; break; } - pfile = mfile; - mfile = mfile->next; - } - if (mfile && mfile->disconnected_f_op) { - fops_put(mfile->disconnected_f_op); - spin_lock(&shutdown_lock); - list_del(&mfile->shutdown_list); - spin_unlock(&shutdown_lock); } - if (card->files == NULL) + if (list_empty(&card->files_list)) last_close = 1; spin_unlock(&card->files_lock); if (last_close) { @@ -869,11 +857,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) if (card->free_on_last_close) snd_card_do_free(card); } - if (!mfile) { + if (!found) { snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); return -ENOENT; } - kfree(mfile); + kfree(found); return 0; } -- cgit v1.2.3 From f9d202833d0beac09ef1c6a41305151da4fe5d4c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Feb 2009 14:55:59 +0100 Subject: ALSA: rawmidi - Fix possible race in open The module refcount should be handled in the register_mutex to avoid possible races with module unloading. Signed-off-by: Takashi Iwai --- sound/core/rawmidi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 002777ba336a..60f33e9412ad 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -237,15 +237,16 @@ int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, rfile->input = rfile->output = NULL; mutex_lock(®ister_mutex); rmidi = snd_rawmidi_search(card, device); - mutex_unlock(®ister_mutex); if (rmidi == NULL) { - err = -ENODEV; - goto __error1; + mutex_unlock(®ister_mutex); + return -ENODEV; } if (!try_module_get(rmidi->card->module)) { - err = -EFAULT; - goto __error1; + mutex_unlock(®ister_mutex); + return -ENXIO; } + mutex_unlock(®ister_mutex); + if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) mutex_lock(&rmidi->open_mutex); if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { @@ -370,10 +371,9 @@ int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, snd_rawmidi_runtime_free(sinput); if (output != NULL) snd_rawmidi_runtime_free(soutput); - module_put(rmidi->card->module); if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) mutex_unlock(&rmidi->open_mutex); - __error1: + module_put(rmidi->card->module); return err; } -- cgit v1.2.3 From 9a1b64caac82aa02cb74587ffc798e6f42c6170a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Feb 2009 17:03:49 +0100 Subject: ALSA: rawmidi - Refactor rawmidi open/close codes Refactor rawmidi open/close code messes. Signed-off-by: Takashi Iwai --- include/sound/rawmidi.h | 1 - sound/core/rawmidi.c | 377 +++++++++++++++++++++++++----------------------- 2 files changed, 194 insertions(+), 184 deletions(-) (limited to 'sound') diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h index b550a416d075..c23c26585700 100644 --- a/include/sound/rawmidi.h +++ b/include/sound/rawmidi.h @@ -42,7 +42,6 @@ #define SNDRV_RAWMIDI_LFLG_INPUT (1<<1) #define SNDRV_RAWMIDI_LFLG_OPEN (3<<0) #define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) -#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) struct snd_rawmidi; struct snd_rawmidi_substream; diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 60f33e9412ad..473247c8e6d3 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -224,156 +224,143 @@ int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream) return 0; } -int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, - int mode, struct snd_rawmidi_file * rfile) +/* look for an available substream for the given stream direction; + * if a specific subdevice is given, try to assign it + */ +static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, + int stream, int mode, + struct snd_rawmidi_substream **sub_ret) { - struct snd_rawmidi *rmidi; - struct list_head *list1, *list2; - struct snd_rawmidi_substream *sinput = NULL, *soutput = NULL; - struct snd_rawmidi_runtime *input = NULL, *output = NULL; - int err; + struct snd_rawmidi_substream *substream; + struct snd_rawmidi_str *s = &rmidi->streams[stream]; + static unsigned int info_flags[2] = { + [SNDRV_RAWMIDI_STREAM_OUTPUT] = SNDRV_RAWMIDI_INFO_OUTPUT, + [SNDRV_RAWMIDI_STREAM_INPUT] = SNDRV_RAWMIDI_INFO_INPUT, + }; - if (rfile) - rfile->input = rfile->output = NULL; - mutex_lock(®ister_mutex); - rmidi = snd_rawmidi_search(card, device); - if (rmidi == NULL) { - mutex_unlock(®ister_mutex); - return -ENODEV; - } - if (!try_module_get(rmidi->card->module)) { - mutex_unlock(®ister_mutex); + if (!(rmidi->info_flags & info_flags[stream])) return -ENXIO; + if (subdevice >= 0 && subdevice >= s->substream_count) + return -ENODEV; + if (s->substream_opened >= s->substream_count) + return -EAGAIN; + + list_for_each_entry(substream, &s->substreams, list) { + if (substream->opened) { + if (stream == SNDRV_RAWMIDI_STREAM_INPUT || + !(mode & SNDRV_RAWMIDI_LFLG_APPEND)) + continue; + } + if (subdevice < 0 || subdevice == substream->number) { + *sub_ret = substream; + return 0; + } } - mutex_unlock(®ister_mutex); + return -EAGAIN; +} - if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) - mutex_lock(&rmidi->open_mutex); +/* open and do ref-counting for the given substream */ +static int open_substream(struct snd_rawmidi *rmidi, + struct snd_rawmidi_substream *substream, + int mode) +{ + int err; + + err = snd_rawmidi_runtime_create(substream); + if (err < 0) + return err; + err = substream->ops->open(substream); + if (err < 0) + return err; + substream->opened = 1; + if (substream->use_count++ == 0) + substream->active_sensing = 1; + if (mode & SNDRV_RAWMIDI_LFLG_APPEND) + substream->append = 1; + rmidi->streams[substream->stream].substream_opened++; + return 0; +} + +static void close_substream(struct snd_rawmidi *rmidi, + struct snd_rawmidi_substream *substream, + int cleanup); + +static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode, + struct snd_rawmidi_file *rfile) +{ + struct snd_rawmidi_substream *sinput = NULL, *soutput = NULL; + int err; + + rfile->input = rfile->output = NULL; if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { - if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) { - err = -ENXIO; - goto __error; - } - if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) { - err = -ENODEV; - goto __error; - } - if (rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened >= - rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) { - err = -EAGAIN; + err = assign_substream(rmidi, subdevice, + SNDRV_RAWMIDI_STREAM_INPUT, + mode, &sinput); + if (err < 0) goto __error; - } } if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { - if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT)) { - err = -ENXIO; - goto __error; - } - if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) { - err = -ENODEV; - goto __error; - } - if (rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened >= - rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) { - err = -EAGAIN; + err = assign_substream(rmidi, subdevice, + SNDRV_RAWMIDI_STREAM_OUTPUT, + mode, &soutput); + if (err < 0) goto __error; - } - } - list1 = rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams.next; - while (1) { - if (list1 == &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { - sinput = NULL; - if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { - err = -EAGAIN; - goto __error; - } - break; - } - sinput = list_entry(list1, struct snd_rawmidi_substream, list); - if ((mode & SNDRV_RAWMIDI_LFLG_INPUT) && sinput->opened) - goto __nexti; - if (subdevice < 0 || (subdevice >= 0 && subdevice == sinput->number)) - break; - __nexti: - list1 = list1->next; - } - list2 = rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams.next; - while (1) { - if (list2 == &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { - soutput = NULL; - if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { - err = -EAGAIN; - goto __error; - } - break; - } - soutput = list_entry(list2, struct snd_rawmidi_substream, list); - if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { - if (mode & SNDRV_RAWMIDI_LFLG_APPEND) { - if (soutput->opened && !soutput->append) - goto __nexto; - } else { - if (soutput->opened) - goto __nexto; - } - } - if (subdevice < 0 || (subdevice >= 0 && subdevice == soutput->number)) - break; - __nexto: - list2 = list2->next; } - if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { - if ((err = snd_rawmidi_runtime_create(sinput)) < 0) - goto __error; - input = sinput->runtime; - if ((err = sinput->ops->open(sinput)) < 0) + + if (sinput) { + err = open_substream(rmidi, sinput, mode); + if (err < 0) goto __error; - sinput->opened = 1; - rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened++; - } else { - sinput = NULL; } - if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { - if (soutput->opened) - goto __skip_output; - if ((err = snd_rawmidi_runtime_create(soutput)) < 0) { - if (mode & SNDRV_RAWMIDI_LFLG_INPUT) - sinput->ops->close(sinput); - goto __error; - } - output = soutput->runtime; - if ((err = soutput->ops->open(soutput)) < 0) { - if (mode & SNDRV_RAWMIDI_LFLG_INPUT) - sinput->ops->close(sinput); + if (soutput) { + err = open_substream(rmidi, soutput, mode); + if (err < 0) { + if (sinput) + close_substream(rmidi, sinput, 0); goto __error; } - __skip_output: - soutput->opened = 1; - if (mode & SNDRV_RAWMIDI_LFLG_APPEND) - soutput->append = 1; - if (soutput->use_count++ == 0) - soutput->active_sensing = 1; - rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened++; - } else { - soutput = NULL; - } - if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) - mutex_unlock(&rmidi->open_mutex); - if (rfile) { - rfile->rmidi = rmidi; - rfile->input = sinput; - rfile->output = soutput; } + + rfile->rmidi = rmidi; + rfile->input = sinput; + rfile->output = soutput; return 0; __error: - if (input != NULL) + if (sinput && sinput->runtime) snd_rawmidi_runtime_free(sinput); - if (output != NULL) + if (soutput && soutput->runtime) snd_rawmidi_runtime_free(soutput); - if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) - mutex_unlock(&rmidi->open_mutex); - module_put(rmidi->card->module); + return err; +} + +/* called from sound/core/seq/seq_midi.c */ +int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, + int mode, struct snd_rawmidi_file * rfile) +{ + struct snd_rawmidi *rmidi; + int err; + + if (snd_BUG_ON(!rfile)) + return -EINVAL; + + mutex_lock(®ister_mutex); + rmidi = snd_rawmidi_search(card, device); + if (rmidi == NULL) { + mutex_unlock(®ister_mutex); + return -ENODEV; + } + if (!try_module_get(rmidi->card->module)) { + mutex_unlock(®ister_mutex); + return -ENXIO; + } + mutex_unlock(®ister_mutex); + + mutex_lock(&rmidi->open_mutex); + err = rawmidi_open_priv(rmidi, subdevice, mode, rfile); + mutex_unlock(&rmidi->open_mutex); + if (err < 0) + module_put(rmidi->card->module); return err; } @@ -385,10 +372,13 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) unsigned short fflags; int err; struct snd_rawmidi *rmidi; - struct snd_rawmidi_file *rawmidi_file; + struct snd_rawmidi_file *rawmidi_file = NULL; wait_queue_t wait; struct snd_ctl_file *kctl; + if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) + return -EINVAL; /* invalid combination */ + if (maj == snd_major) { rmidi = snd_lookup_minor_data(iminor(inode), SNDRV_DEVICE_TYPE_RAWMIDI); @@ -402,24 +392,25 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) if (rmidi == NULL) return -ENODEV; - if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) - return -EINVAL; /* invalid combination */ + + if (!try_module_get(rmidi->card->module)) + return -ENXIO; + + mutex_lock(&rmidi->open_mutex); card = rmidi->card; err = snd_card_file_add(card, file); if (err < 0) - return -ENODEV; + goto __error_card; fflags = snd_rawmidi_file_flags(file); if ((file->f_flags & O_APPEND) || maj == SOUND_MAJOR) /* OSS emul? */ fflags |= SNDRV_RAWMIDI_LFLG_APPEND; - fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK; rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL); if (rawmidi_file == NULL) { - snd_card_file_remove(card, file); - return -ENOMEM; + err = -ENOMEM; + goto __error; } init_waitqueue_entry(&wait, current); add_wait_queue(&rmidi->open_wait, &wait); - mutex_lock(&rmidi->open_mutex); while (1) { subdevice = -1; read_lock(&card->ctl_files_rwlock); @@ -431,8 +422,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) } } read_unlock(&card->ctl_files_rwlock); - err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, - subdevice, fflags, rawmidi_file); + err = rawmidi_open_priv(rmidi, subdevice, fflags, rawmidi_file); if (err >= 0) break; if (err == -EAGAIN) { @@ -451,67 +441,89 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) break; } } + remove_wait_queue(&rmidi->open_wait, &wait); + if (err < 0) { + kfree(rawmidi_file); + goto __error; + } #ifdef CONFIG_SND_OSSEMUL if (rawmidi_file->input && rawmidi_file->input->runtime) rawmidi_file->input->runtime->oss = (maj == SOUND_MAJOR); if (rawmidi_file->output && rawmidi_file->output->runtime) rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR); #endif - remove_wait_queue(&rmidi->open_wait, &wait); - if (err >= 0) { - file->private_data = rawmidi_file; - } else { - snd_card_file_remove(card, file); - kfree(rawmidi_file); - } + file->private_data = rawmidi_file; mutex_unlock(&rmidi->open_mutex); + return 0; + + __error: + snd_card_file_remove(card, file); + __error_card: + mutex_unlock(&rmidi->open_mutex); + module_put(rmidi->card->module); return err; } -int snd_rawmidi_kernel_release(struct snd_rawmidi_file * rfile) +static void close_substream(struct snd_rawmidi *rmidi, + struct snd_rawmidi_substream *substream, + int cleanup) { - struct snd_rawmidi *rmidi; - struct snd_rawmidi_substream *substream; - struct snd_rawmidi_runtime *runtime; + rmidi->streams[substream->stream].substream_opened--; + if (--substream->use_count) + return; - if (snd_BUG_ON(!rfile)) - return -ENXIO; - rmidi = rfile->rmidi; - mutex_lock(&rmidi->open_mutex); - if (rfile->input != NULL) { - substream = rfile->input; - rfile->input = NULL; - runtime = substream->runtime; - snd_rawmidi_input_trigger(substream, 0); - substream->ops->close(substream); - if (runtime->private_free != NULL) - runtime->private_free(substream); - snd_rawmidi_runtime_free(substream); - substream->opened = 0; - rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened--; - } - if (rfile->output != NULL) { - substream = rfile->output; - rfile->output = NULL; - if (--substream->use_count == 0) { - runtime = substream->runtime; + if (cleanup) { + if (substream->stream == SNDRV_RAWMIDI_STREAM_INPUT) + snd_rawmidi_input_trigger(substream, 0); + else { if (substream->active_sensing) { unsigned char buf = 0xfe; - /* sending single active sensing message to shut the device up */ + /* sending single active sensing message + * to shut the device up + */ snd_rawmidi_kernel_write(substream, &buf, 1); } if (snd_rawmidi_drain_output(substream) == -ERESTARTSYS) snd_rawmidi_output_trigger(substream, 0); - substream->ops->close(substream); - if (runtime->private_free != NULL) - runtime->private_free(substream); - snd_rawmidi_runtime_free(substream); - substream->opened = 0; - substream->append = 0; } - rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened--; } + substream->ops->close(substream); + if (substream->runtime->private_free) + substream->runtime->private_free(substream); + snd_rawmidi_runtime_free(substream); + substream->opened = 0; + substream->append = 0; +} + +static void rawmidi_release_priv(struct snd_rawmidi_file *rfile) +{ + struct snd_rawmidi *rmidi; + + rmidi = rfile->rmidi; + mutex_lock(&rmidi->open_mutex); + if (rfile->input) { + close_substream(rmidi, rfile->input, 1); + rfile->input = NULL; + } + if (rfile->output) { + close_substream(rmidi, rfile->output, 1); + rfile->output = NULL; + } + rfile->rmidi = NULL; mutex_unlock(&rmidi->open_mutex); + wake_up(&rmidi->open_wait); +} + +/* called from sound/core/seq/seq_midi.c */ +int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile) +{ + struct snd_rawmidi *rmidi; + + if (snd_BUG_ON(!rfile)) + return -ENXIO; + + rmidi = rfile->rmidi; + rawmidi_release_priv(rfile); module_put(rmidi->card->module); return 0; } @@ -520,15 +532,14 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file) { struct snd_rawmidi_file *rfile; struct snd_rawmidi *rmidi; - int err; rfile = file->private_data; - err = snd_rawmidi_kernel_release(rfile); rmidi = rfile->rmidi; - wake_up(&rmidi->open_wait); + rawmidi_release_priv(rfile); kfree(rfile); snd_card_file_remove(rmidi->card, file); - return err; + module_put(rmidi->card->module); + return 0; } static int snd_rawmidi_info(struct snd_rawmidi_substream *substream, -- cgit v1.2.3 From ae6241fbf5c8863631532e8069037bae460607be Mon Sep 17 00:00:00 2001 From: Christoph Plattner Date: Sun, 8 Mar 2009 23:19:05 +0100 Subject: ALSA: hda - Added HP HDX16/HDX18 notebook support for HDA codecs (82HD71) Added codec recognition of HP HDX platforms and added support of the MUTE LED (orange/white). For this feature the CONFIG_SND_HDA_POWER_SAVE is needed to use event handling for mute control. Signed-off-by: Christoph Plattner Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 123bcf7c3b24..fb9f4ccba885 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -99,6 +99,7 @@ enum { STAC_DELL_M4_3, STAC_HP_M4, STAC_HP_DV5, + STAC_HP_HDX, STAC_92HD71BXX_MODELS }; @@ -1828,6 +1829,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { [STAC_DELL_M4_3] = dell_m4_3_pin_configs, [STAC_HP_M4] = NULL, [STAC_HP_DV5] = NULL, + [STAC_HP_HDX] = NULL, }; static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { @@ -1838,6 +1840,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { [STAC_DELL_M4_3] = "dell-m4-3", [STAC_HP_M4] = "hp-m4", [STAC_HP_DV5] = "hp-dv5", + [STAC_HP_HDX] = "hp-hdx", }; static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { @@ -1852,6 +1855,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "HP dv4-7", STAC_HP_DV5), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, "HP mini 1000", STAC_HP_M4), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, + "HP HDX", STAC_HP_HDX), /* HDX16 */ + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, + "HP HDX", STAC_HP_HDX), /* HDX18 */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, "unknown Dell", STAC_DELL_M4_1), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, @@ -4472,6 +4479,41 @@ static int stac92xx_resume(struct hda_codec *codec) return 0; } + +/* + * using power check for controlling mute led of HP HDX notebooks + * check for mute state only on Speakers (nid = 0x10) + * + * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise + * the LED is NOT working properly ! + */ + +#ifdef CONFIG_SND_HDA_POWER_SAVE +static int stac92xx_check_power_status (struct hda_codec * codec, hda_nid_t nid) +{ + struct sigmatel_spec *spec = codec->spec; + + /* only handle on HP HDX */ + if (spec->board_config != STAC_HP_HDX) + return 0; + + if (nid == 0x10) + { + if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & + HDA_AMP_MUTE) + spec->gpio_data &= ~0x08; /* orange */ + else + spec->gpio_data |= 0x08; /* white */ + + stac_gpio_set(codec, spec->gpio_mask, + spec->gpio_dir, + spec->gpio_data); + } + + return 0; +} +#endif + static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) { struct sigmatel_spec *spec = codec->spec; @@ -4493,6 +4535,9 @@ static struct hda_codec_ops stac92xx_patch_ops = { .suspend = stac92xx_suspend, .resume = stac92xx_resume, #endif +#ifdef CONFIG_SND_HDA_POWER_SAVE + .check_power_status = stac92xx_check_power_status, +#endif }; static int patch_stac9200(struct hda_codec *codec) @@ -5089,6 +5134,13 @@ again: /* no output amps */ spec->num_pwrs = 0; /* fallthru */ + case 0x111d76b2: /* Codec of HP HDX16/HDX18 */ + + /* orange/white mute led on GPIO3, orange=0, white=1 */ + spec->gpio_mask |= 0x08; + spec->gpio_dir |= 0x08; + spec->gpio_data |= 0x08; /* set to white */ + /* fallthru */ default: memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, sizeof(stac92hd71bxx_dmux_amixer)); @@ -5143,6 +5195,11 @@ again: snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); break; + case STAC_HP_HDX: + spec->num_dmics = 1; + spec->num_dmuxes = 1; + spec->num_smuxes = 1; + break; }; spec->multiout.dac_nids = spec->dac_nids; -- cgit v1.2.3 From 443e26d014c242623dd70cda054cc6e5ebf7993d Mon Sep 17 00:00:00 2001 From: Christoph Plattner Date: Tue, 10 Mar 2009 00:05:56 +0100 Subject: ALSA: hda - Rework on patch_sigmatel.c for HP HDX16/HDX18 Code rework, comments of mail tiwai@suse.de (2009-03-09) incorporated. Code tested on HP HDX16 (not tested on HDX18 yet). Signed-off-by: Christoph Plattner Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index fb9f4ccba885..d119feed42c9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4489,14 +4489,10 @@ static int stac92xx_resume(struct hda_codec *codec) */ #ifdef CONFIG_SND_HDA_POWER_SAVE -static int stac92xx_check_power_status (struct hda_codec * codec, hda_nid_t nid) +static int stac92xx_hp_hdx_check_power_status (struct hda_codec * codec, hda_nid_t nid) { struct sigmatel_spec *spec = codec->spec; - /* only handle on HP HDX */ - if (spec->board_config != STAC_HP_HDX) - return 0; - if (nid == 0x10) { if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & @@ -4535,9 +4531,6 @@ static struct hda_codec_ops stac92xx_patch_ops = { .suspend = stac92xx_suspend, .resume = stac92xx_resume, #endif -#ifdef CONFIG_SND_HDA_POWER_SAVE - .check_power_status = stac92xx_check_power_status, -#endif }; static int patch_stac9200(struct hda_codec *codec) @@ -5134,13 +5127,6 @@ again: /* no output amps */ spec->num_pwrs = 0; /* fallthru */ - case 0x111d76b2: /* Codec of HP HDX16/HDX18 */ - - /* orange/white mute led on GPIO3, orange=0, white=1 */ - spec->gpio_mask |= 0x08; - spec->gpio_dir |= 0x08; - spec->gpio_data |= 0x08; /* set to white */ - /* fallthru */ default: memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, sizeof(stac92hd71bxx_dmux_amixer)); @@ -5199,6 +5185,20 @@ again: spec->num_dmics = 1; spec->num_dmuxes = 1; spec->num_smuxes = 1; + /* + * For controlling MUTE LED on HP HDX16/HDX18 notebooks, + * the CONFIG_SND_HDA_POWER_SAVE is needed to be set. + */ +#ifdef CONFIG_SND_HDA_POWER_SAVE + /* orange/white mute led on GPIO3, orange=0, white=1 */ + spec->gpio_mask |= 0x08; + spec->gpio_dir |= 0x08; + spec->gpio_data |= 0x08; /* set to white */ + + /* register check_power_status callback. */ + codec->patch_ops.check_power_status = + stac92xx_hp_hdx_check_power_status; +#endif break; }; -- cgit v1.2.3 From 6fce61aeaf0dc1dfa306092539397ab903a9afc4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Mar 2009 07:48:57 +0100 Subject: ALSA: hda - Fix coding style issues in last two patches Also re-ordered the quirk entries per SSID. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d119feed42c9..72c87aa20bd9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1853,12 +1853,12 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "HP dv4-7", STAC_HP_DV5), SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, "HP dv4-7", STAC_HP_DV5), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, + "HP HDX", STAC_HP_HDX), /* HDX18 */ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, "HP mini 1000", STAC_HP_M4), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, - "HP HDX", STAC_HP_HDX), /* HDX16 */ - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, - "HP HDX", STAC_HP_HDX), /* HDX18 */ + "HP HDX", STAC_HP_HDX), /* HDX16 */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, "unknown Dell", STAC_DELL_M4_1), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, @@ -4489,20 +4489,20 @@ static int stac92xx_resume(struct hda_codec *codec) */ #ifdef CONFIG_SND_HDA_POWER_SAVE -static int stac92xx_hp_hdx_check_power_status (struct hda_codec * codec, hda_nid_t nid) +static int stac92xx_hp_hdx_check_power_status(struct hda_codec *codec, + hda_nid_t nid) { struct sigmatel_spec *spec = codec->spec; - - if (nid == 0x10) - { - if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & + + if (nid == 0x10) { + if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & HDA_AMP_MUTE) spec->gpio_data &= ~0x08; /* orange */ else spec->gpio_data |= 0x08; /* white */ - - stac_gpio_set(codec, spec->gpio_mask, - spec->gpio_dir, + + stac_gpio_set(codec, spec->gpio_mask, + spec->gpio_dir, spec->gpio_data); } @@ -5185,7 +5185,7 @@ again: spec->num_dmics = 1; spec->num_dmuxes = 1; spec->num_smuxes = 1; - /* + /* * For controlling MUTE LED on HP HDX16/HDX18 notebooks, * the CONFIG_SND_HDA_POWER_SAVE is needed to be set. */ @@ -5196,7 +5196,7 @@ again: spec->gpio_data |= 0x08; /* set to white */ /* register check_power_status callback. */ - codec->patch_ops.check_power_status = + codec->patch_ops.check_power_status = stac92xx_hp_hdx_check_power_status; #endif break; -- cgit v1.2.3 From dd5746a85cb21ea5b3afca0b569586a05aa56846 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Mar 2009 14:30:40 +0100 Subject: ALSA: hda - Create vmaster for conexant codecs Instead of binding volumes, create a virtual master volume for Conexant codecs. This allows separate HP and speaker volume controls. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 47 ++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 1938e92e1f03..e1476d6d8b39 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -58,6 +58,7 @@ struct conexant_spec { struct snd_kcontrol_new *mixers[5]; int num_mixers; + hda_nid_t vmaster_nid; const struct hda_verb *init_verbs[5]; /* initialization verbs * don't forget NULL @@ -462,6 +463,18 @@ static void conexant_free(struct hda_codec *codec) kfree(codec->spec); } +static const char *slave_vols[] = { + "Headphone Playback Volume", + "Speaker Playback Volume", + NULL +}; + +static const char *slave_sws[] = { + "Headphone Playback Switch", + "Speaker Playback Switch", + NULL +}; + static int conexant_build_controls(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; @@ -489,6 +502,26 @@ static int conexant_build_controls(struct hda_codec *codec) if (err < 0) return err; } + + /* if we have no master control, let's create it */ + if (spec->vmaster_nid && + !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { + unsigned int vmaster_tlv[4]; + snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, + HDA_OUTPUT, vmaster_tlv); + err = snd_hda_add_vmaster(codec, "Master Playback Volume", + vmaster_tlv, slave_vols); + if (err < 0) + return err; + } + if (spec->vmaster_nid && + !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { + err = snd_hda_add_vmaster(codec, "Master Playback Switch", + NULL, slave_sws); + if (err < 0) + return err; + } + return 0; } @@ -1182,16 +1215,6 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, return 1; } -/* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */ -static struct hda_bind_ctls cxt5047_bind_master_vol = { - .ops = &snd_hda_bind_vol, - .values = { - HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT), - HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), - 0 - }, -}; - /* mute internal speaker if HP is plugged */ static void cxt5047_hp_automute(struct hda_codec *codec) { @@ -1311,7 +1334,8 @@ static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), - HDA_BIND_VOL("Master Playback Volume", &cxt5047_bind_master_vol), + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), + HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Master Playback Switch", @@ -1631,6 +1655,7 @@ static int patch_cxt5047(struct hda_codec *codec) codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; #endif } + spec->vmaster_nid = 0x13; return 0; } -- cgit v1.2.3 From b880c74adf7e79b97de710a152ea82f292f9abc7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Mar 2009 14:41:05 +0100 Subject: ALSA: hda - Create "Capture Source" control dynamically in patch_conexant.c Create "Capture Source" control dynamically for Conexant codecs. If only one capture item is available, don't create such a control since it's just useless. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 61 ++++++++++++------------------------------ 1 file changed, 17 insertions(+), 44 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e1476d6d8b39..d5d736ff7c6c 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -463,6 +463,17 @@ static void conexant_free(struct hda_codec *codec) kfree(codec->spec); } +static struct snd_kcontrol_new cxt_capture_mixers[] = { + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Capture Source", + .info = conexant_mux_enum_info, + .get = conexant_mux_enum_get, + .put = conexant_mux_enum_put + }, + {} +}; + static const char *slave_vols[] = { "Headphone Playback Volume", "Speaker Playback Volume", @@ -522,6 +533,12 @@ static int conexant_build_controls(struct hda_codec *codec) return err; } + if (spec->input_mux) { + err = snd_hda_add_new_ctls(codec, cxt_capture_mixers); + if (err < 0) + return err; + } + return 0; } @@ -753,13 +770,6 @@ static void cxt5045_hp_unsol_event(struct hda_codec *codec, } static struct snd_kcontrol_new cxt5045_mixers[] = { - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = conexant_mux_enum_info, - .get = conexant_mux_enum_get, - .put = conexant_mux_enum_put - }, HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), @@ -793,13 +803,6 @@ static struct snd_kcontrol_new cxt5045_benq_mixers[] = { }; static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = conexant_mux_enum_info, - .get = conexant_mux_enum_get, - .put = conexant_mux_enum_put - }, HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), @@ -1170,20 +1173,6 @@ static struct hda_channel_mode cxt5047_modes[1] = { { 2, NULL }, }; -static struct hda_input_mux cxt5047_capture_source = { - .num_items = 1, - .items = { - { "Mic", 0x2 }, - } -}; - -static struct hda_input_mux cxt5047_hp_capture_source = { - .num_items = 1, - .items = { - { "ExtMic", 0x2 }, - } -}; - static struct hda_input_mux cxt5047_toshiba_capture_source = { .num_items = 2, .items = { @@ -1321,13 +1310,6 @@ static struct snd_kcontrol_new cxt5047_mixers[] = { }; static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = conexant_mux_enum_info, - .get = conexant_mux_enum_get, - .put = conexant_mux_enum_put - }, HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), @@ -1349,13 +1331,6 @@ static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { }; static struct snd_kcontrol_new cxt5047_hp_mixers[] = { - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = conexant_mux_enum_info, - .get = conexant_mux_enum_get, - .put = conexant_mux_enum_put - }, HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19,0x02,HDA_INPUT), HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), @@ -1614,7 +1589,6 @@ static int patch_cxt5047(struct hda_codec *codec) spec->num_adc_nids = 1; spec->adc_nids = cxt5047_adc_nids; spec->capsrc_nids = cxt5047_capsrc_nids; - spec->input_mux = &cxt5047_capture_source; spec->num_mixers = 1; spec->mixers[0] = cxt5047_mixers; spec->num_init_verbs = 1; @@ -1633,7 +1607,6 @@ static int patch_cxt5047(struct hda_codec *codec) codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; break; case CXT5047_LAPTOP_HP: - spec->input_mux = &cxt5047_hp_capture_source; spec->num_init_verbs = 2; spec->init_verbs[1] = cxt5047_hp_init_verbs; spec->mixers[0] = cxt5047_hp_mixers; -- cgit v1.2.3 From 3b628867f328cfe1ad4811d63961579874f87041 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Mar 2009 14:53:54 +0100 Subject: ALSA: hda - Remove superfluous verbs for Cxt5047 laptop-eapd model Remove superfluous verbs from cxt5047_toshiba_init_verbs[]. Also fix comments and minor coding style issues. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index d5d736ff7c6c..e9e47574c613 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1377,12 +1377,9 @@ static struct hda_verb cxt5047_init_verbs[] = { /* configuration for Toshiba Laptops */ static struct hda_verb cxt5047_toshiba_init_verbs[] = { - {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0 }, /* default on */ - /* pin sensing on HP and Mic jacks */ - {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, + {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */ /* Speaker routing */ - {0x1d, AC_VERB_SET_CONNECT_SEL,0x1}, + {0x1d, AC_VERB_SET_CONNECT_SEL, 0x1}, {} }; -- cgit v1.2.3 From 5b3a7440cbabdda07cfb3dcf4a07e0115a3dff9a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Mar 2009 15:10:55 +0100 Subject: ALSA: hda - Fix / clean up init verbs for Cxt5047 codec Fix the initial connections of output pins 0x13 and 0x1d for Conexant 5047 codec to point to the mixer amp properly. Removed unneeded (doubly) verbs from arrays, also removed the unneeded changing of widget 0x1c, which is now completely unused. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e9e47574c613..71822140294d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1165,7 +1165,7 @@ static int patch_cxt5045(struct hda_codec *codec) /* Conexant 5047 specific */ #define CXT5047_SPDIF_OUT 0x11 -static hda_nid_t cxt5047_dac_nids[2] = { 0x10, 0x1c }; +static hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */ static hda_nid_t cxt5047_adc_nids[1] = { 0x12 }; static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a }; @@ -1216,9 +1216,6 @@ static void cxt5047_hp_automute(struct hda_codec *codec) bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); - /* Mute/Unmute PCM 2 for good measure - some systems need this */ - snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, - HDA_AMP_MUTE, bits); } /* mute internal speaker if HP is plugged */ @@ -1233,9 +1230,6 @@ static void cxt5047_hp2_automute(struct hda_codec *codec) bits = spec->hp_present ? HDA_AMP_MUTE : 0; snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); - /* Mute/Unmute PCM 2 for good measure - some systems need this */ - snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, - HDA_AMP_MUTE, bits); } /* toggle input of built-in and mic jack appropriately */ @@ -1299,8 +1293,6 @@ static struct snd_kcontrol_new cxt5047_mixers[] = { HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("PCM-2 Volume", 0x1c, 0x00, HDA_OUTPUT), - HDA_CODEC_MUTE("PCM-2 Switch", 0x1c, 0x00, HDA_OUTPUT), HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), HDA_CODEC_MUTE("Speaker Playback Switch", 0x1d, 0x00, HDA_OUTPUT), HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), @@ -1356,8 +1348,8 @@ static struct hda_verb cxt5047_init_verbs[] = { {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 }, /* HP, Speaker */ {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, - {0x13, AC_VERB_SET_CONNECT_SEL,0x1}, - {0x1d, AC_VERB_SET_CONNECT_SEL,0x0}, + {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, /* mixer(0x19) */ + {0x1d, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mixer(0x19) */ /* Record selector: Mic */ {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, {0x19, AC_VERB_SET_AMP_GAIN_MUTE, @@ -1378,26 +1370,6 @@ static struct hda_verb cxt5047_init_verbs[] = { /* configuration for Toshiba Laptops */ static struct hda_verb cxt5047_toshiba_init_verbs[] = { {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */ - /* Speaker routing */ - {0x1d, AC_VERB_SET_CONNECT_SEL, 0x1}, - {} -}; - -/* configuration for HP Laptops */ -static struct hda_verb cxt5047_hp_init_verbs[] = { - /* pin sensing on HP jack */ - {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, - /* 0x13 is actually shared by both HP and speaker; - * setting the connection to 0 (=0x19) makes the master volume control - * working mysteriouslly... - */ - {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, - /* Record selector: Ext Mic */ - {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, - AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, - /* Speaker routing */ - {0x1d, AC_VERB_SET_CONNECT_SEL,0x1}, {} }; @@ -1604,8 +1576,6 @@ static int patch_cxt5047(struct hda_codec *codec) codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; break; case CXT5047_LAPTOP_HP: - spec->num_init_verbs = 2; - spec->init_verbs[1] = cxt5047_hp_init_verbs; spec->mixers[0] = cxt5047_hp_mixers; codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; codec->patch_ops.init = cxt5047_hp_init; -- cgit v1.2.3 From df481e41b963b7fc3d7e3543a0c7bb140a682146 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Mar 2009 15:35:35 +0100 Subject: ALSA: hda - Clean up Cxt5047 parser Clean up Conexant 5047 pareser code: - Split mixer elements to separate arrays to reduce the duplicated entires - Fix mixer element names to the standard ones - Remove unneeded cxt5047_hp2_unsol_event; the normal unsol_event handler works fine. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 89 +++++++++--------------------------------- 1 file changed, 19 insertions(+), 70 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 71822140294d..d60ccb5bb127 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1218,20 +1218,6 @@ static void cxt5047_hp_automute(struct hda_codec *codec) HDA_AMP_MUTE, bits); } -/* mute internal speaker if HP is plugged */ -static void cxt5047_hp2_automute(struct hda_codec *codec) -{ - struct conexant_spec *spec = codec->spec; - unsigned int bits; - - spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, - AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; - - bits = spec->hp_present ? HDA_AMP_MUTE : 0; - snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, - HDA_AMP_MUTE, bits); -} - /* toggle input of built-in and mic jack appropriately */ static void cxt5047_hp_automic(struct hda_codec *codec) { @@ -1269,47 +1255,14 @@ static void cxt5047_hp_unsol_event(struct hda_codec *codec, } } -/* unsolicited event for HP jack sensing - non-EAPD systems */ -static void cxt5047_hp2_unsol_event(struct hda_codec *codec, - unsigned int res) -{ - res >>= 26; - switch (res) { - case CONEXANT_HP_EVENT: - cxt5047_hp2_automute(codec); - break; - case CONEXANT_MIC_EVENT: - cxt5047_hp_automic(codec); - break; - } -} - -static struct snd_kcontrol_new cxt5047_mixers[] = { - HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Gain Volume", 0x1a, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Mic Gain Switch", 0x1a, 0x0, HDA_OUTPUT), +static struct snd_kcontrol_new cxt5047_base_mixers[] = { + HDA_CODEC_VOLUME("Mic Playback Volume", 0x19, 0x02, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x19, 0x02, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Boost", 0x1a, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x1d, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x13, 0x00, HDA_OUTPUT), - - {} -}; - -static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { - HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), - HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), - HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Master Playback Switch", @@ -1322,22 +1275,14 @@ static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { {} }; -static struct snd_kcontrol_new cxt5047_hp_mixers[] = { - HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19,0x02,HDA_INPUT), - HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), - HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), - HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), +static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = { + HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), + {} +}; + +static struct snd_kcontrol_new cxt5047_hp_only_mixers[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Master Playback Switch", - .info = cxt_eapd_info, - .get = cxt_eapd_get, - .put = cxt5047_hp_master_sw_put, - .private_value = 0x13, - }, { } /* end */ }; @@ -1559,7 +1504,7 @@ static int patch_cxt5047(struct hda_codec *codec) spec->adc_nids = cxt5047_adc_nids; spec->capsrc_nids = cxt5047_capsrc_nids; spec->num_mixers = 1; - spec->mixers[0] = cxt5047_mixers; + spec->mixers[0] = cxt5047_base_mixers; spec->num_init_verbs = 1; spec->init_verbs[0] = cxt5047_init_verbs; spec->spdif_route = 0; @@ -1573,18 +1518,22 @@ static int patch_cxt5047(struct hda_codec *codec) cxt5047_cfg_tbl); switch (board_config) { case CXT5047_LAPTOP: - codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; + spec->num_mixers = 2; + spec->mixers[1] = cxt5047_hp_spk_mixers; + codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; break; case CXT5047_LAPTOP_HP: - spec->mixers[0] = cxt5047_hp_mixers; + spec->num_mixers = 2; + spec->mixers[1] = cxt5047_hp_only_mixers; codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; codec->patch_ops.init = cxt5047_hp_init; break; case CXT5047_LAPTOP_EAPD: spec->input_mux = &cxt5047_toshiba_capture_source; + spec->num_mixers = 2; + spec->mixers[1] = cxt5047_hp_spk_mixers; spec->num_init_verbs = 2; spec->init_verbs[1] = cxt5047_toshiba_init_verbs; - spec->mixers[0] = cxt5047_toshiba_mixers; codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; break; #ifdef CONFIG_SND_DEBUG -- cgit v1.2.3 From 5d75bc557859805f00eeddb09d7cc8ffc7e5334e Mon Sep 17 00:00:00 2001 From: Gregorio Guidi Date: Thu, 12 Mar 2009 16:41:51 +0100 Subject: ALSA: hda - fix headphone settings and master volume (Conexant CX20551) Update the places where the 0x1d widget is used for Conexant 5047, fixing mismatch introduced after changing the connection. Signed-off-by: Gregorio Guidi Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index d60ccb5bb127..6cb184e9c2f1 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1196,7 +1196,7 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, * the headphone jack */ bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; - snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, + snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, HDA_AMP_MUTE, bits); bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; snd_hda_codec_amp_stereo(codec, 0x13, HDA_OUTPUT, 0, @@ -1214,7 +1214,7 @@ static void cxt5047_hp_automute(struct hda_codec *codec) AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; - snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, + snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, HDA_AMP_MUTE, bits); } @@ -1276,7 +1276,7 @@ static struct snd_kcontrol_new cxt5047_base_mixers[] = { }; static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = { - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), + HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT), HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), {} }; -- cgit v1.2.3 From 3b7523fc828e41b2988feb400704e01b67859d78 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 12 Mar 2009 16:45:01 +0100 Subject: ALSA: hda - Add comments for the previous fix for conexant codecs Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 6cb184e9c2f1..bc016fade192 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1196,6 +1196,10 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, * the headphone jack */ bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; + /* NOTE: Conexat codec needs the index for *OUTPUT* amp of + * pin widgets unlike other codecs. In this case, we need to + * set index 0x01 for the volume from the mixer amp 0x19. + */ snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, HDA_AMP_MUTE, bits); bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; @@ -1214,6 +1218,7 @@ static void cxt5047_hp_automute(struct hda_codec *codec) AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; + /* See the note in cxt5047_hp_master_sw_put */ snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, HDA_AMP_MUTE, bits); } @@ -1276,6 +1281,7 @@ static struct snd_kcontrol_new cxt5047_base_mixers[] = { }; static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = { + /* See the note in cxt5047_hp_master_sw_put */ HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT), HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), {} -- cgit v1.2.3 From 9421f9543b3a0a870499f64498406003de8214b4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 12 Mar 2009 17:06:07 +0100 Subject: ALSA: hda - Print multiple out-amp values of pin widgets on Conext codecs Add a flag to work around the non-standard amp-value handling on Conexant codecs. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.h | 3 +++ sound/pci/hda/hda_proc.c | 10 ++++++++-- sound/pci/hda/patch_conexant.c | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 2ea628478a91..079e1ab718d4 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -793,6 +793,9 @@ struct hda_codec { * status change * (e.g. Realtek codecs) */ + unsigned int pin_amp_workaround:1; /* pin out-amp takes index + * (e.g. Conexant codecs) + */ #ifdef CONFIG_SND_HDA_POWER_SAVE unsigned int power_on :1; /* current (global) power-state */ unsigned int power_transition :1; /* power-state in transition */ diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 144b85276d5a..93b25ba4d00b 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -554,8 +554,14 @@ static void print_codec_info(struct snd_info_entry *entry, snd_iprintf(buffer, " Amp-Out caps: "); print_amp_caps(buffer, codec, nid, HDA_OUTPUT); snd_iprintf(buffer, " Amp-Out vals: "); - print_amp_vals(buffer, codec, nid, HDA_OUTPUT, - wid_caps & AC_WCAP_STEREO, 1); + if (wid_type == AC_WID_PIN && + codec->pin_amp_workaround) + print_amp_vals(buffer, codec, nid, HDA_OUTPUT, + wid_caps & AC_WCAP_STEREO, + conn_len); + else + print_amp_vals(buffer, codec, nid, HDA_OUTPUT, + wid_caps & AC_WCAP_STEREO, 1); } switch (wid_type) { diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index bc016fade192..1f2ad76ca94b 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1066,6 +1066,7 @@ static int patch_cxt5045(struct hda_codec *codec) if (!spec) return -ENOMEM; codec->spec = spec; + codec->pin_amp_workaround = 1; spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids); @@ -1501,6 +1502,7 @@ static int patch_cxt5047(struct hda_codec *codec) if (!spec) return -ENOMEM; codec->spec = spec; + codec->pin_amp_workaround = 1; spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(cxt5047_dac_nids); @@ -1847,6 +1849,7 @@ static int patch_cxt5051(struct hda_codec *codec) if (!spec) return -ENOMEM; codec->spec = spec; + codec->pin_amp_workaround = 1; codec->patch_ops = conexant_patch_ops; codec->patch_ops.init = cxt5051_init; -- cgit v1.2.3 From 307282c8990c5658604b9fda8a64a9a07079b850 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 12 Mar 2009 18:17:58 +0100 Subject: ALSA: hda - Add model=vaio for STAC9872 Add the default pin config for model=vaio (in case of broken BIOS). Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 3 ++- sound/pci/hda/patch_sigmatel.c | 33 ++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index f9253ea3c19f..8eec05bc079e 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -368,4 +368,5 @@ STAC92HD83* STAC9872 ======== - N/A + vaio VAIO laptop without SPDIF + auto BIOS setup (default) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 72c87aa20bd9..e06fc7decd31 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -155,6 +155,12 @@ enum { STAC_927X_MODELS }; +enum { + STAC_9872_AUTO, + STAC_9872_VAIO, + STAC_9872_MODELS +}; + struct sigmatel_event { hda_nid_t nid; unsigned char type; @@ -5588,6 +5594,25 @@ static hda_nid_t stac9872_mux_nids[] = { 0x15 }; +static unsigned int stac9872_vaio_pin_configs[9] = { + 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, + 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, + 0x90a7013e +}; + +static const char *stac9872_models[STAC_9872_MODELS] = { + [STAC_9872_AUTO] = "auto", + [STAC_9872_VAIO] = "vaio", +}; + +static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { + [STAC_9872_VAIO] = stac9872_vaio_pin_configs, +}; + +static struct snd_pci_quirk stac9872_cfg_tbl[] = { + {} /* terminator */ +}; + static int patch_stac9872(struct hda_codec *codec) { struct sigmatel_spec *spec; @@ -5598,11 +5623,15 @@ static int patch_stac9872(struct hda_codec *codec) return -ENOMEM; codec->spec = spec; -#if 0 /* no model right now */ spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, stac9872_models, stac9872_cfg_tbl); -#endif + if (spec->board_config < 0) + snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9872, " + "using BIOS defaults\n"); + else + stac92xx_set_config_regs(codec, + stac9872_brd_tbl[spec->board_config]); spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); spec->pin_nids = stac9872_pin_nids; -- cgit v1.2.3 From bb6ac72fb19c6676eb8bafa8e3b8bf970a2294a2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Mar 2009 09:02:42 +0100 Subject: ALSA: hda - power up before codec initialization Change the power state of each widget before starting the initialization work so that all verbs are executed properly. Also, keep power-up during hwdep reconfiguration. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 15 ++++++++------- sound/pci/hda/hda_hwdep.c | 14 +++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 1885e7649101..cf6339436de1 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -842,6 +842,9 @@ static void snd_hda_codec_free(struct hda_codec *codec) kfree(codec); } +static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, + unsigned int power_state); + /** * snd_hda_codec_new - create a HDA codec * @bus: the bus to assign @@ -941,6 +944,11 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr if (bus->modelname) codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); + /* power-up all before initialization */ + hda_set_power_state(codec, + codec->afg ? codec->afg : codec->mfg, + AC_PWRST_D0); + if (do_init) { err = snd_hda_codec_configure(codec); if (err < 0) @@ -2413,19 +2421,12 @@ EXPORT_SYMBOL_HDA(snd_hda_build_controls); int snd_hda_codec_build_controls(struct hda_codec *codec) { int err = 0; - /* fake as if already powered-on */ - hda_keep_power_on(codec); - /* then fire up */ - hda_set_power_state(codec, - codec->afg ? codec->afg : codec->mfg, - AC_PWRST_D0); hda_exec_init_verbs(codec); /* continue to initialize... */ if (codec->patch_ops.init) err = codec->patch_ops.init(codec); if (!err && codec->patch_ops.build_controls) err = codec->patch_ops.build_controls(codec); - snd_hda_power_down(codec); if (err < 0) return err; return 0; diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 1e3ccc740afc..1c57505c2874 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -176,25 +176,29 @@ static int reconfig_codec(struct hda_codec *codec) { int err; + snd_hda_power_up(codec); snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); err = snd_hda_codec_reset(codec); if (err < 0) { snd_printk(KERN_ERR "The codec is being used, can't reconfigure.\n"); - return err; + goto error; } err = snd_hda_codec_configure(codec); if (err < 0) - return err; + goto error; /* rebuild PCMs */ err = snd_hda_codec_build_pcms(codec); if (err < 0) - return err; + goto error; /* rebuild mixers */ err = snd_hda_codec_build_controls(codec); if (err < 0) - return err; - return snd_card_register(codec->bus->card); + goto error; + err = snd_card_register(codec->bus->card); + error: + snd_hda_power_down(codec); + return err; } /* -- cgit v1.2.3 From 58d8395b74f78a2f4225c5faea8b5bffb8af1cf9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Mar 2009 17:04:34 +0100 Subject: ALSA: hda - Add another HP model with IDT92HD71bx codec HP laptops require GPIO0 on as EAPD. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e06fc7decd31..4da72403fc87 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1855,6 +1855,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { "DFI LanParty", STAC_92HD71BXX_REF), SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_92HD71BXX_REF), + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, + "HP", STAC_HP_DV5), SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, "HP dv4-7", STAC_HP_DV5), SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, -- cgit v1.2.3 From 9f5d790d1b0af8e3705df12fd5d49a1df2a45c47 Mon Sep 17 00:00:00 2001 From: Giuliano Pochini Date: Sun, 15 Mar 2009 21:33:34 +0100 Subject: ALSA: echoaudio: remove line-out volume from vmixer cards There is a long standing bug in the drivers for cards with a vmixer because I overlooked a detail in the c++ generic driver by echoaudio. Those cards do not have a line-out volume control. It is a virtual control provided by the generic driver. The bug is harmless because the DSP just ignores the command to change the volume. *NB:* It breaks alsa-tools/echomixer. A patch for it will follow. This patch removes the line-out volume control from vmixer-equipped cards. Signed-off-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- sound/pci/echoaudio/echoaudio.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 8dbc5c4ba421..4b70ea1e4c9f 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -950,6 +950,8 @@ static int __devinit snd_echo_new_pcm(struct echoaudio *chip) Control interface ******************************************************************************/ +#ifndef ECHOCARD_HAS_VMIXER + /******************* PCM output volume *******************/ static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) @@ -1001,18 +1003,6 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol, return changed; } -#ifdef ECHOCARD_HAS_VMIXER -/* On Vmixer cards this one controls the line-out volume */ -static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { - .name = "Line Playback Volume", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, - .info = snd_echo_output_gain_info, - .get = snd_echo_output_gain_get, - .put = snd_echo_output_gain_put, - .tlv = {.p = db_scale_output_gain}, -}; -#else static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { .name = "PCM Playback Volume", .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1022,6 +1012,7 @@ static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { .put = snd_echo_output_gain_put, .tlv = {.p = db_scale_output_gain}, }; + #endif @@ -2037,8 +2028,6 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, #ifdef ECHOCARD_HAS_VMIXER snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); - if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_output_gain, chip))) < 0) - goto ctl_error; if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) goto ctl_error; #else -- cgit v1.2.3 From 4c55bb0149b604901e4989d1ee0fddc53df8eb0c Mon Sep 17 00:00:00 2001 From: Giuliano Pochini Date: Sun, 15 Mar 2009 21:33:55 +0100 Subject: ALSA: echoaudio: remove line-out volume from vmixer cards With this patch the drivers do not set the vmixer volume anymore at startup because it is actually the output volume of the voices and ALSA mandates that the volume must be 0 by default. Signed-off-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- sound/pci/echoaudio/indigo_dsp.c | 12 ------------ sound/pci/echoaudio/indigodj_dsp.c | 12 ------------ sound/pci/echoaudio/indigoio_dsp.c | 12 ------------ sound/pci/echoaudio/mia_dsp.c | 12 ------------ 4 files changed, 48 deletions(-) (limited to 'sound') diff --git a/sound/pci/echoaudio/indigo_dsp.c b/sound/pci/echoaudio/indigo_dsp.c index f05e39f7aad9..0b2cd9c86277 100644 --- a/sound/pci/echoaudio/indigo_dsp.c +++ b/sound/pci/echoaudio/indigo_dsp.c @@ -63,18 +63,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) if ((err = init_line_levels(chip)) < 0) return err; - /* Default routing of the virtual channels: all vchannels are routed - to the stereo output */ - set_vmixer_gain(chip, 0, 0, 0); - set_vmixer_gain(chip, 1, 1, 0); - set_vmixer_gain(chip, 0, 2, 0); - set_vmixer_gain(chip, 1, 3, 0); - set_vmixer_gain(chip, 0, 4, 0); - set_vmixer_gain(chip, 1, 5, 0); - set_vmixer_gain(chip, 0, 6, 0); - set_vmixer_gain(chip, 1, 7, 0); - err = update_vmixer_level(chip); - DE_INIT(("init_hw done\n")); return err; } diff --git a/sound/pci/echoaudio/indigodj_dsp.c b/sound/pci/echoaudio/indigodj_dsp.c index 90730a5ecb42..08392916691e 100644 --- a/sound/pci/echoaudio/indigodj_dsp.c +++ b/sound/pci/echoaudio/indigodj_dsp.c @@ -63,18 +63,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) if ((err = init_line_levels(chip)) < 0) return err; - /* Default routing of the virtual channels: vchannels 0-3 and - vchannels 4-7 are routed to real channels 0-4 */ - set_vmixer_gain(chip, 0, 0, 0); - set_vmixer_gain(chip, 1, 1, 0); - set_vmixer_gain(chip, 2, 2, 0); - set_vmixer_gain(chip, 3, 3, 0); - set_vmixer_gain(chip, 0, 4, 0); - set_vmixer_gain(chip, 1, 5, 0); - set_vmixer_gain(chip, 2, 6, 0); - set_vmixer_gain(chip, 3, 7, 0); - err = update_vmixer_level(chip); - DE_INIT(("init_hw done\n")); return err; } diff --git a/sound/pci/echoaudio/indigoio_dsp.c b/sound/pci/echoaudio/indigoio_dsp.c index a7e09ec21079..0604c8a85223 100644 --- a/sound/pci/echoaudio/indigoio_dsp.c +++ b/sound/pci/echoaudio/indigoio_dsp.c @@ -63,18 +63,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) if ((err = init_line_levels(chip)) < 0) return err; - /* Default routing of the virtual channels: all vchannels are routed - to the stereo output */ - set_vmixer_gain(chip, 0, 0, 0); - set_vmixer_gain(chip, 1, 1, 0); - set_vmixer_gain(chip, 0, 2, 0); - set_vmixer_gain(chip, 1, 3, 0); - set_vmixer_gain(chip, 0, 4, 0); - set_vmixer_gain(chip, 1, 5, 0); - set_vmixer_gain(chip, 0, 6, 0); - set_vmixer_gain(chip, 1, 7, 0); - err = update_vmixer_level(chip); - DE_INIT(("init_hw done\n")); return err; } diff --git a/sound/pci/echoaudio/mia_dsp.c b/sound/pci/echoaudio/mia_dsp.c index 227386602f9b..f7abe1b60a1d 100644 --- a/sound/pci/echoaudio/mia_dsp.c +++ b/sound/pci/echoaudio/mia_dsp.c @@ -69,18 +69,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) if ((err = init_line_levels(chip))) return err; - /* Default routing of the virtual channels: vchannels 0-3 go to analog - outputs and vchannels 4-7 go to S/PDIF outputs */ - set_vmixer_gain(chip, 0, 0, 0); - set_vmixer_gain(chip, 1, 1, 0); - set_vmixer_gain(chip, 0, 2, 0); - set_vmixer_gain(chip, 1, 3, 0); - set_vmixer_gain(chip, 2, 4, 0); - set_vmixer_gain(chip, 3, 5, 0); - set_vmixer_gain(chip, 2, 6, 0); - set_vmixer_gain(chip, 3, 7, 0); - err = update_vmixer_level(chip); - DE_INIT(("init_hw done\n")); return err; } -- cgit v1.2.3 From b8dbed0f095263b9ced5bd2e6d54743a7fa13f1b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 16 Mar 2009 14:56:58 +0100 Subject: ALSA: snd-hda-intel: Fix ALC662/ALC663 Beep Amplifier Index ALC662/663 codecs have Beep Amplifier Index 0x04 not 0x05 in 0x0b NID. Confirmed by testing on real hardware. Signed-off-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b794cba494c3..672103d84ffc 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -16951,7 +16951,7 @@ static int patch_alc662(struct hda_codec *codec) if (!spec->cap_mixer) set_capture_mixer(spec); - set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); spec->vmaster_nid = 0x02; -- cgit v1.2.3 From b9591448e5160ccd353d8547ade018cfdf2b3e09 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 16 Mar 2009 15:25:00 +0100 Subject: ALSA: hda - Fix ALC662 beep again The previous commit breaks the (digital-) beep on ALC662. ALC662 has the connection index 0x05 while ALC662 and ALC272 have the index 0x04 for the beep widget. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 672103d84ffc..5ad0f8d72ddb 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -16951,7 +16951,10 @@ static int patch_alc662(struct hda_codec *codec) if (!spec->cap_mixer) set_capture_mixer(spec); - set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); + if (codec->vendor_id == 0x10ec0662) + set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); + else + set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); spec->vmaster_nid = 0x02; -- cgit v1.2.3 From db1dd4d376134eba0e08af523b61cc566a4ea1cd Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 6 Feb 2009 15:25:24 -0700 Subject: Use f_lock to protect f_flags Traditionally, changes to struct file->f_flags have been done under BKL protection, or with no protection at all. This patch causes all f_flags changes after file open/creation time to be done under protection of f_lock. This allows the removal of some BKL usage and fixes a number of longstanding (if microscopic) races. Reviewed-by: Christoph Hellwig Cc: Al Viro Signed-off-by: Jonathan Corbet --- drivers/char/tty_io.c | 5 ++--- drivers/usb/gadget/file_storage.c | 7 ++++++- fs/fcntl.c | 2 ++ fs/ioctl.c | 7 ++++--- fs/nfsd/vfs.c | 5 ++++- include/linux/fs.h | 2 +- ipc/mqueue.c | 2 ++ sound/core/oss/pcm_oss.c | 2 ++ sound/oss/au1550_ac97.c | 2 ++ sound/oss/audio.c | 2 ++ sound/oss/sh_dac_audio.c | 2 ++ sound/oss/swarm_cs4297a.c | 2 ++ sound/oss/vwsnd.c | 2 ++ 13 files changed, 33 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index bc84e125c6bc..224f271d8cbe 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -2162,13 +2162,12 @@ static int fionbio(struct file *file, int __user *p) if (get_user(nonblock, p)) return -EFAULT; - /* file->f_flags is still BKL protected in the fs layer - vomit */ - lock_kernel(); + spin_lock(&file->f_lock); if (nonblock) file->f_flags |= O_NONBLOCK; else file->f_flags &= ~O_NONBLOCK; - unlock_kernel(); + spin_unlock(&file->f_lock); return 0; } diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 1ab9dac7e12d..33bb76cef33c 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -1711,7 +1711,9 @@ static int do_write(struct fsg_dev *fsg) curlun->sense_data = SS_WRITE_PROTECTED; return -EINVAL; } + spin_lock(&curlun->filp->f_lock); curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait + spin_unlock(&curlun->filp->f_lock); /* Get the starting Logical Block Address and check that it's * not too big */ @@ -1728,8 +1730,11 @@ static int do_write(struct fsg_dev *fsg) curlun->sense_data = SS_INVALID_FIELD_IN_CDB; return -EINVAL; } - if (fsg->cmnd[1] & 0x08) // FUA + if (fsg->cmnd[1] & 0x08) { // FUA + spin_lock(&curlun->filp->f_lock); curlun->filp->f_flags |= O_SYNC; + spin_unlock(&curlun->filp->f_lock); + } } if (lba >= curlun->num_sectors) { curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; diff --git a/fs/fcntl.c b/fs/fcntl.c index bd215cc791da..04df8570a2d2 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -189,7 +189,9 @@ static int setfl(int fd, struct file * filp, unsigned long arg) } } + spin_lock(&filp->f_lock); filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK); + spin_unlock(&filp->f_lock); out: unlock_kernel(); return error; diff --git a/fs/ioctl.c b/fs/ioctl.c index 240ec63984cb..421aab465dab 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -404,10 +404,12 @@ static int ioctl_fionbio(struct file *filp, int __user *argp) if (O_NONBLOCK != O_NDELAY) flag |= O_NDELAY; #endif + spin_lock(&filp->f_lock); if (on) filp->f_flags |= flag; else filp->f_flags &= ~flag; + spin_unlock(&filp->f_lock); return error; } @@ -432,10 +434,12 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp, if (error) return error; + spin_lock(&filp->f_lock); if (on) filp->f_flags |= FASYNC; else filp->f_flags &= ~FASYNC; + spin_unlock(&filp->f_lock); return error; } @@ -499,10 +503,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, break; case FIONBIO: - /* BKL needed to avoid races tweaking f_flags */ - lock_kernel(); error = ioctl_fionbio(filp, argp); - unlock_kernel(); break; case FIOASYNC: diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 6e50aaa56ca2..c165a6403df0 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -998,8 +998,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, if (!EX_ISSYNC(exp)) stable = 0; - if (stable && !EX_WGATHER(exp)) + if (stable && !EX_WGATHER(exp)) { + spin_lock(&file->f_lock); file->f_flags |= O_SYNC; + spin_unlock(&file->f_lock); + } /* Write the data. */ oldfs = get_fs(); set_fs(KERNEL_DS); diff --git a/include/linux/fs.h b/include/linux/fs.h index 2011600d12c7..7428c6d35e65 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -848,7 +848,7 @@ struct file { #define f_dentry f_path.dentry #define f_vfsmnt f_path.mnt const struct file_operations *f_op; - spinlock_t f_lock; /* f_ep_links */ + spinlock_t f_lock; /* f_ep_links, f_flags */ atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 54b4077fed79..a8ddadbc7459 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1156,10 +1156,12 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, omqstat.mq_flags = filp->f_flags & O_NONBLOCK; if (u_mqstat) { audit_mq_getsetattr(mqdes, &mqstat); + spin_lock(&filp->f_lock); if (mqstat.mq_flags & O_NONBLOCK) filp->f_flags |= O_NONBLOCK; else filp->f_flags &= ~O_NONBLOCK; + spin_unlock(&filp->f_lock); inode->i_atime = inode->i_ctime = CURRENT_TIME; } diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 0a1798eafb0b..d4460f18e76c 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1895,7 +1895,9 @@ static int snd_pcm_oss_set_fragment(struct snd_pcm_oss_file *pcm_oss_file, unsig static int snd_pcm_oss_nonblock(struct file * file) { + spin_lock(&file->f_lock); file->f_flags |= O_NONBLOCK; + spin_unlock(&file->f_lock); return 0; } diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 81e1f443d094..4191acccbcdb 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c @@ -1627,7 +1627,9 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: + spin_lock(&file->f_lock); file->f_flags |= O_NONBLOCK; + spin_unlock(&file->f_lock); return 0; case SNDCTL_DSP_GETODELAY: diff --git a/sound/oss/audio.c b/sound/oss/audio.c index 89bd27a5e865..b69c05b7ea7b 100644 --- a/sound/oss/audio.c +++ b/sound/oss/audio.c @@ -433,7 +433,9 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, void __user *arg) return dma_ioctl(dev, cmd, arg); case SNDCTL_DSP_NONBLOCK: + spin_lock(&file->f_lock); file->f_flags |= O_NONBLOCK; + spin_unlock(&file->f_lock); return 0; case SNDCTL_DSP_GETCAPS: diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index e5d423994918..78cfb66e4c59 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c @@ -135,7 +135,9 @@ static int dac_audio_ioctl(struct inode *inode, struct file *file, return put_user(AFMT_U8, (int *)arg); case SNDCTL_DSP_NONBLOCK: + spin_lock(&file->f_lock); file->f_flags |= O_NONBLOCK; + spin_unlock(&file->f_lock); return 0; case SNDCTL_DSP_GETCAPS: diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 41562ecde5bb..1edab7b4ea83 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c @@ -2200,7 +2200,9 @@ static int cs4297a_ioctl(struct inode *inode, struct file *file, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: + spin_lock(&file->f_lock); file->f_flags |= O_NONBLOCK; + spin_unlock(&file->f_lock); return 0; case SNDCTL_DSP_GETODELAY: diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 78b8acc7c3b9..187f72750e8f 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c @@ -2673,7 +2673,9 @@ static int vwsnd_audio_do_ioctl(struct inode *inode, case SNDCTL_DSP_NONBLOCK: /* _SIO ('P',14) */ DBGX("SNDCTL_DSP_NONBLOCK\n"); + spin_lock(&file->f_lock); file->f_flags |= O_NONBLOCK; + spin_unlock(&file->f_lock); return 0; case SNDCTL_DSP_RESET: /* _SIO ('P', 0) */ -- cgit v1.2.3 From 60aa49243d09afc873f082567d2e3c16634ced84 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 1 Feb 2009 14:52:56 -0700 Subject: Rationalize fasync return values Most fasync implementations do something like: return fasync_helper(...); But fasync_helper() will return a positive value at times - a feature used in at least one place. Thus, a number of other drivers do: err = fasync_helper(...); if (err < 0) return err; return 0; In the interests of consistency and more concise code, it makes sense to map positive return values onto zero where ->fasync() is called. Cc: Al Viro Signed-off-by: Jonathan Corbet --- drivers/char/sonypi.c | 7 +------ drivers/gpu/drm/drm_fops.c | 6 +----- drivers/hid/usbhid/hiddev.c | 5 +---- drivers/ieee1394/dv1394.c | 6 +----- drivers/input/evdev.c | 5 +---- drivers/input/joydev.c | 5 +---- drivers/input/mousedev.c | 5 +---- drivers/input/serio/serio_raw.c | 4 +--- drivers/net/wan/cosa.c | 4 ++-- drivers/platform/x86/sony-laptop.c | 7 +------ drivers/scsi/sg.c | 4 +--- fs/fcntl.c | 2 ++ fs/ioctl.c | 2 +- fs/pipe.c | 16 +++------------- sound/core/control.c | 7 ++----- sound/core/pcm_native.c | 4 +--- sound/core/timer.c | 6 +----- 17 files changed, 22 insertions(+), 73 deletions(-) (limited to 'sound') diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index f4374437a033..fd3dced97776 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -888,12 +888,7 @@ found: static int sonypi_misc_fasync(int fd, struct file *filp, int on) { - int retval; - - retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async); - if (retval < 0) - return retval; - return 0; + return fasync_helper(fd, filp, on, &sonypi_device.fifo_async); } static int sonypi_misc_release(struct inode *inode, struct file *file) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index f52663ebe016..e13cb62bbaee 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -337,14 +337,10 @@ int drm_fasync(int fd, struct file *filp, int on) { struct drm_file *priv = filp->private_data; struct drm_device *dev = priv->minor->dev; - int retcode; DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(priv->minor->device)); - retcode = fasync_helper(fd, filp, on, &dev->buf_async); - if (retcode < 0) - return retcode; - return 0; + return fasync_helper(fd, filp, on, &dev->buf_async); } EXPORT_SYMBOL(drm_fasync); diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 4940e4d70c2d..3a7b4fe192a3 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -227,12 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) */ static int hiddev_fasync(int fd, struct file *file, int on) { - int retval; struct hiddev_list *list = file->private_data; - retval = fasync_helper(fd, file, on, &list->fasync); - - return retval < 0 ? retval : 0; + return fasync_helper(fd, file, on, &list->fasync); } diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 3838bc4acaba..cb15bfa38d70 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c @@ -1325,11 +1325,7 @@ static int dv1394_fasync(int fd, struct file *file, int on) struct video_card *video = file_to_video_card(file); - int retval = fasync_helper(fd, file, on, &video->fasync); - - if (retval < 0) - return retval; - return 0; + return fasync_helper(fd, file, on, &video->fasync); } static ssize_t dv1394_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index ed8baa0aec3c..7a7a026ba712 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -94,11 +94,8 @@ static void evdev_event(struct input_handle *handle, static int evdev_fasync(int fd, struct file *file, int on) { struct evdev_client *client = file->private_data; - int retval; - - retval = fasync_helper(fd, file, on, &client->fasync); - return retval < 0 ? retval : 0; + return fasync_helper(fd, file, on, &client->fasync); } static int evdev_flush(struct file *file, fl_owner_t id) diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 6f2366220a50..4224f0112849 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -159,12 +159,9 @@ static void joydev_event(struct input_handle *handle, static int joydev_fasync(int fd, struct file *file, int on) { - int retval; struct joydev_client *client = file->private_data; - retval = fasync_helper(fd, file, on, &client->fasync); - - return retval < 0 ? retval : 0; + return fasync_helper(fd, file, on, &client->fasync); } static void joydev_free(struct device *dev) diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index ef99a7e6d40c..17fd6d46d082 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -403,12 +403,9 @@ static void mousedev_event(struct input_handle *handle, static int mousedev_fasync(int fd, struct file *file, int on) { - int retval; struct mousedev_client *client = file->private_data; - retval = fasync_helper(fd, file, on, &client->fasync); - - return retval < 0 ? retval : 0; + return fasync_helper(fd, file, on, &client->fasync); } static void mousedev_free(struct device *dev) diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 06bbd0e74c6f..b03009bb7468 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c @@ -58,10 +58,8 @@ static unsigned int serio_raw_no; static int serio_raw_fasync(int fd, struct file *file, int on) { struct serio_raw_list *list = file->private_data; - int retval; - retval = fasync_helper(fd, file, on, &list->fasync); - return retval < 0 ? retval : 0; + return fasync_helper(fd, file, on, &list->fasync); } static struct serio_raw *serio_raw_locate(int minor) diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index d80b72e22dea..ce753e9c576b 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -993,8 +993,8 @@ static struct fasync_struct *fasync[256] = { NULL, }; static int cosa_fasync(struct inode *inode, struct file *file, int on) { int port = iminor(inode); - int rv = fasync_helper(inode, file, on, &fasync[port]); - return rv < 0 ? rv : 0; + + return fasync_helper(inode, file, on, &fasync[port]); } #endif diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 537959d07148..bc8996c849ac 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -1917,12 +1917,7 @@ static struct sonypi_compat_s sonypi_compat = { static int sonypi_misc_fasync(int fd, struct file *filp, int on) { - int retval; - - retval = fasync_helper(fd, filp, on, &sonypi_compat.fifo_async); - if (retval < 0) - return retval; - return 0; + return fasync_helper(fd, filp, on, &sonypi_compat.fifo_async); } static int sonypi_misc_release(struct inode *inode, struct file *file) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 516925d8b570..b4ef2f84ea32 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1154,7 +1154,6 @@ sg_poll(struct file *filp, poll_table * wait) static int sg_fasync(int fd, struct file *filp, int mode) { - int retval; Sg_device *sdp; Sg_fd *sfp; @@ -1163,8 +1162,7 @@ sg_fasync(int fd, struct file *filp, int mode) SCSI_LOG_TIMEOUT(3, printk("sg_fasync: %s, mode=%d\n", sdp->disk->disk_name, mode)); - retval = fasync_helper(fd, filp, mode, &sfp->async_qp); - return (retval < 0) ? retval : 0; + return fasync_helper(fd, filp, mode, &sfp->async_qp); } static int diff --git a/fs/fcntl.c b/fs/fcntl.c index 431bb6459273..d865ca66ccba 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -184,6 +184,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg) error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0); if (error < 0) goto out; + if (error > 0) + error = 0; } spin_lock(&filp->f_lock); filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK); diff --git a/fs/ioctl.c b/fs/ioctl.c index e8e89edba576..ac2d47e43926 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -432,7 +432,7 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp, else error = -ENOTTY; } - return error; + return error < 0 ? error : 0; } static int ioctl_fsfreeze(struct file *filp) diff --git a/fs/pipe.c b/fs/pipe.c index 14f502b89cf5..94ad15967cf9 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -667,10 +667,7 @@ pipe_read_fasync(int fd, struct file *filp, int on) retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_readers); mutex_unlock(&inode->i_mutex); - if (retval < 0) - return retval; - - return 0; + return retval; } @@ -684,10 +681,7 @@ pipe_write_fasync(int fd, struct file *filp, int on) retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_writers); mutex_unlock(&inode->i_mutex); - if (retval < 0) - return retval; - - return 0; + return retval; } @@ -706,11 +700,7 @@ pipe_rdwr_fasync(int fd, struct file *filp, int on) fasync_helper(-1, filp, 0, &pipe->fasync_readers); } mutex_unlock(&inode->i_mutex); - - if (retval < 0) - return retval; - - return 0; + return retval; } diff --git a/sound/core/control.c b/sound/core/control.c index 636b3b52ef8b..4b20fa2b7e6d 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1373,12 +1373,9 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat); static int snd_ctl_fasync(int fd, struct file * file, int on) { struct snd_ctl_file *ctl; - int err; + ctl = file->private_data; - err = fasync_helper(fd, file, on, &ctl->fasync); - if (err < 0) - return err; - return 0; + return fasync_helper(fd, file, on, &ctl->fasync); } /* diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index a789efc9df39..a75c194e629e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3246,9 +3246,7 @@ static int snd_pcm_fasync(int fd, struct file * file, int on) err = fasync_helper(fd, file, on, &runtime->fasync); out: unlock_kernel(); - if (err < 0) - return err; - return 0; + return err; } /* diff --git a/sound/core/timer.c b/sound/core/timer.c index 796532081e81..3f0050d0b71e 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1825,13 +1825,9 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, static int snd_timer_user_fasync(int fd, struct file * file, int on) { struct snd_timer_user *tu; - int err; tu = file->private_data; - err = fasync_helper(fd, file, on, &tu->fasync); - if (err < 0) - return err; - return 0; + return fasync_helper(fd, file, on, &tu->fasync); } static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, -- cgit v1.2.3 From 40f49e7ed77f1b753a7243c0137e4767a50ea8bd Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 17 Mar 2009 12:47:56 +0900 Subject: sh: dma: Make G2 DMA configurable. Follow the PVR2 DMAC change for G2 DMA. Signed-off-by: Paul Mundt --- arch/sh/drivers/dma/Kconfig | 11 +++++++++++ arch/sh/drivers/dma/Makefile | 2 +- sound/sh/Kconfig | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig index ae26610837b2..f13a05285a9d 100644 --- a/arch/sh/drivers/dma/Kconfig +++ b/arch/sh/drivers/dma/Kconfig @@ -67,4 +67,15 @@ config PVR2_DMA If in doubt, say N. +config G2_DMA + tristate "G2 Bus DMA support" + depends on SH_DREAMCAST + select SH_DMA_API + help + This enables support for the DMA controller for the Dreamcast's + G2 bus. Drivers that want this will generally enable this on + their own. + + If in doubt, say N. + endmenu diff --git a/arch/sh/drivers/dma/Makefile b/arch/sh/drivers/dma/Makefile index cff52cb6ac71..c6068137b46f 100644 --- a/arch/sh/drivers/dma/Makefile +++ b/arch/sh/drivers/dma/Makefile @@ -4,6 +4,6 @@ obj-$(CONFIG_SH_DMA_API) += dma-api.o dma-sysfs.o obj-$(CONFIG_SH_DMA) += dma-sh.o -obj-$(CONFIG_SH_DREAMCAST) += dma-g2.o obj-$(CONFIG_PVR2_DMA) += dma-pvr2.o +obj-$(CONFIG_G2_DMA) += dma-g2.o obj-$(CONFIG_SH_DMABRG) += dmabrg.o diff --git a/sound/sh/Kconfig b/sound/sh/Kconfig index cfc143985802..aed0f90c3919 100644 --- a/sound/sh/Kconfig +++ b/sound/sh/Kconfig @@ -15,6 +15,7 @@ config SND_AICA tristate "Dreamcast Yamaha AICA sound" depends on SH_DREAMCAST select SND_PCM + select G2_DMA help ALSA Sound driver for the SEGA Dreamcast console. -- cgit v1.2.3 From dde332b660cf0bc2baaba678b52768a0fb6e6da2 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Mon, 16 Mar 2009 21:32:25 +0100 Subject: ALSA: opl3sa2 - Fix NULL dereference when suspending snd_opl3sa2 Fix the OOPS during a opl3sa2 card suspend and resume if the driver is loaded but the card is not found. Signed-off-by: Krzysztof Helt Cc: Signed-off-by: Takashi Iwai --- sound/isa/opl3sa2.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 58c972b2af03..b848d1001864 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -550,21 +550,27 @@ static int __devinit snd_opl3sa2_mixer(struct snd_card *card) #ifdef CONFIG_PM static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state) { - struct snd_opl3sa2 *chip = card->private_data; + if (card) { + struct snd_opl3sa2 *chip = card->private_data; - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); - chip->wss->suspend(chip->wss); - /* power down */ - snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + chip->wss->suspend(chip->wss); + /* power down */ + snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); + } return 0; } static int snd_opl3sa2_resume(struct snd_card *card) { - struct snd_opl3sa2 *chip = card->private_data; + struct snd_opl3sa2 *chip; int i; + if (!card) + return 0; + + chip = card->private_data; /* power up */ snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); -- cgit v1.2.3 From 323a59613e5be6094c93261486de48a08d3a53f2 Mon Sep 17 00:00:00 2001 From: Dmitry Artamonow Date: Fri, 13 Mar 2009 01:03:49 +0100 Subject: ALSA: drop outdated and broken sa11xx-uda1341 driver It depends on L3 support from 2.4 kernel (CONFIG_L3) that never got merged into mainline. Since there's no way to use it on any of supported machines (iPaq h3100 or h3600), better drop it for now. It can be reimplemented later using ASoC infrastructure (there's already a driver for uda1341 codec in mainline, so only CPU and machine parts need to be written). Signed-off-by: Dmitry Artamonow Cc: Russell King Signed-off-by: Takashi Iwai --- include/sound/uda1341.h | 126 ------ sound/arm/Kconfig | 11 - sound/arm/Makefile | 3 - sound/arm/sa11xx-uda1341.c | 984 --------------------------------------------- sound/i2c/Makefile | 2 - sound/i2c/l3/Makefile | 8 - sound/i2c/l3/uda1341.c | 935 ------------------------------------------ 7 files changed, 2069 deletions(-) delete mode 100644 include/sound/uda1341.h delete mode 100644 sound/arm/sa11xx-uda1341.c delete mode 100644 sound/i2c/l3/Makefile delete mode 100644 sound/i2c/l3/uda1341.c (limited to 'sound') diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h deleted file mode 100644 index 110d5dc3a2be..000000000000 --- a/include/sound/uda1341.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * linux/include/linux/l3/uda1341.h - * - * Philips UDA1341 mixer device driver for ALSA - * - * Copyright (c) 2002 Tomas Kasparek - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License. - * - * History: - * - * 2002-03-13 Tomas Kasparek Initial release - based on uda1341.h from OSS - * 2002-03-30 Tomas Kasparek Proc filesystem support, complete mixer and DSP - * features support - */ - -#define UDA1341_ALSA_NAME "snd-uda1341" - -/* - * Default rate set after inicialization - */ -#define AUDIO_RATE_DEFAULT 44100 - -/* - * UDA1341 L3 address and command types - */ -#define UDA1341_L3ADDR 5 -#define UDA1341_DATA0 (UDA1341_L3ADDR << 2 | 0) -#define UDA1341_DATA1 (UDA1341_L3ADDR << 2 | 1) -#define UDA1341_STATUS (UDA1341_L3ADDR << 2 | 2) - -enum uda1341_onoff { - OFF=0, - ON, -}; - -enum uda1341_format { - I2S=0, - LSB16, - LSB18, - LSB20, - MSB, - LSB16MSB, - LSB18MSB, - LSB20MSB, -}; - -enum uda1341_fs { - F512=0, - F384, - F256, - Funused, -}; - -enum uda1341_peak { - BEFORE=0, - AFTER, -}; - -enum uda1341_filter { - FLAT=0, - MIN, - MIN2, - MAX, -}; - -enum uda1341_mixer { - DOUBLE, - LINE, - MIC, - MIXER, -}; - -enum uda1341_deemp { - NONE, - D32, - D44, - D48, -}; - -enum uda1341_config { - CMD_READ_REG = 0, - CMD_RESET, - CMD_FS, - CMD_FORMAT, - CMD_OGAIN, - CMD_IGAIN, - CMD_DAC, - CMD_ADC, - CMD_VOLUME, - CMD_BASS, - CMD_TREBBLE, - CMD_PEAK, - CMD_DEEMP, - CMD_MUTE, - CMD_FILTER, - CMD_CH1, - CMD_CH2, - CMD_MIC, - CMD_MIXER, - CMD_AGC, - CMD_IG, - CMD_AGC_TIME, - CMD_AGC_LEVEL, -#ifdef CONFIG_PM - CMD_SUSPEND, - CMD_RESUME, -#endif - CMD_LAST, -}; - -enum write_through { - //used in update_bits (write_cfg) to avoid l3_write - just update local copy of regs. - REGS_ONLY=0, - //update local regs and write value to uda1341 - do l3_write - FLUSH, -}; - -int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt); - -/* - * Local variables: - * indent-tabs-mode: t - * End: - */ diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index f8e6de48d816..885683a3b0bd 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig @@ -11,17 +11,6 @@ menuconfig SND_ARM if SND_ARM -config SND_SA11XX_UDA1341 - tristate "SA11xx UDA1341TS driver (iPaq H3600)" - depends on ARCH_SA1100 && L3 - select SND_PCM - help - Say Y here if you have a Compaq iPaq H3x00 handheld computer - and want to use its Philips UDA 1341 audio chip. - - To compile this driver as a module, choose M here: the module - will be called snd-sa11xx-uda1341. - config SND_ARMAACI tristate "ARM PrimeCell PL041 AC Link support" depends on ARM_AMBA diff --git a/sound/arm/Makefile b/sound/arm/Makefile index 2054de11de8a..5a549ed6c8aa 100644 --- a/sound/arm/Makefile +++ b/sound/arm/Makefile @@ -2,9 +2,6 @@ # Makefile for ALSA # -obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o -snd-sa11xx-uda1341-objs := sa11xx-uda1341.o - obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o snd-aaci-objs := aaci.o devdma.o diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c deleted file mode 100644 index 7101d3d8bae6..000000000000 --- a/sound/arm/sa11xx-uda1341.c +++ /dev/null @@ -1,984 +0,0 @@ -/* - * Driver for Philips UDA1341TS on Compaq iPAQ H3600 soundcard - * Copyright (C) 2002 Tomas Kasparek - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License. - * - * History: - * - * 2002-03-13 Tomas Kasparek initial release - based on h3600-uda1341.c from OSS - * 2002-03-20 Tomas Kasparek playback over ALSA is working - * 2002-03-28 Tomas Kasparek playback over OSS emulation is working - * 2002-03-29 Tomas Kasparek basic capture is working (native ALSA) - * 2002-03-29 Tomas Kasparek capture is working (OSS emulation) - * 2002-04-04 Tomas Kasparek better rates handling (allow non-standard rates) - * 2003-02-14 Brian Avery fixed full duplex mode, other updates - * 2003-02-20 Tomas Kasparek merged updates by Brian (except HAL) - * 2003-04-19 Jaroslav Kysela recoded DMA stuff to follow 2.4.18rmk3-hh24 kernel - * working suspend and resume - * 2003-04-28 Tomas Kasparek updated work by Jaroslav to compile it under 2.5.x again - * merged HAL layer (patches from Brian) - */ - -/*************************************************************************************************** -* -* To understand what Alsa Drivers should be doing look at "Writing an Alsa Driver" by Takashi Iwai -* available in the Alsa doc section on the website -* -* A few notes to make things clearer. The UDA1341 is hooked up to Serial port 4 on the SA1100. -* We are using SSP mode to talk to the UDA1341. The UDA1341 bit & wordselect clocks are generated -* by this UART. Unfortunately, the clock only runs if the transmit buffer has something in it. -* So, if we are just recording, we feed the transmit DMA stream a bunch of 0x0000 so that the -* transmit buffer is full and the clock keeps going. The zeroes come from FLUSH_BASE_PHYS which -* is a mem loc that always decodes to 0's w/ no off chip access. -* -* Some alsa terminology: -* frame => num_channels * sample_size e.g stereo 16 bit is 2 * 16 = 32 bytes -* period => the least number of bytes that will generate an interrupt e.g. we have a 1024 byte -* buffer and 4 periods in the runtime structure this means we'll get an int every 256 -* bytes or 4 times per buffer. -* A number of the sizes are in frames rather than bytes, use frames_to_bytes and -* bytes_to_frames to convert. The easiest way to tell the units is to look at the -* type i.e. runtime-> buffer_size is in frames and its type is snd_pcm_uframes_t -* -* Notes about the pointer fxn: -* The pointer fxn needs to return the offset into the dma buffer in frames. -* Interrupts must be blocked before calling the dma_get_pos fxn to avoid race with interrupts. -* -* Notes about pause/resume -* Implementing this would be complicated so it's skipped. The problem case is: -* A full duplex connection is going, then play is paused. At this point you need to start xmitting -* 0's to keep the record active which means you cant just freeze the dma and resume it later you'd -* need to save off the dma info, and restore it properly on a resume. Yeach! -* -* Notes about transfer methods: -* The async write calls fail. I probably need to implement something else to support them? -* -***************************************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_PM -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#undef DEBUG_MODE -#undef DEBUG_FUNCTION_NAMES -#include - -/* - * FIXME: Is this enough as autodetection of 2.4.X-rmkY-hhZ kernels? - * We use DMA stuff from 2.4.18-rmk3-hh24 here to be able to compile this - * module for Familiar 0.6.1 - */ - -/* {{{ Type definitions */ - -MODULE_AUTHOR("Tomas Kasparek "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("SA1100/SA1111 + UDA1341TS driver for ALSA"); -MODULE_SUPPORTED_DEVICE("{{UDA1341,iPAQ H3600 UDA1341TS}}"); - -static char *id; /* ID for this card */ - -module_param(id, charp, 0444); -MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard."); - -struct audio_stream { - char *id; /* identification string */ - int stream_id; /* numeric identification */ - dma_device_t dma_dev; /* device identifier for DMA */ -#ifdef HH_VERSION - dmach_t dmach; /* dma channel identification */ -#else - dma_regs_t *dma_regs; /* points to our DMA registers */ -#endif - unsigned int active:1; /* we are using this stream for transfer now */ - int period; /* current transfer period */ - int periods; /* current count of periods registerd in the DMA engine */ - int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */ - unsigned int old_offset; - spinlock_t dma_lock; /* for locking in DMA operations (see dma-sa1100.c in the kernel) */ - struct snd_pcm_substream *stream; -}; - -struct sa11xx_uda1341 { - struct snd_card *card; - struct l3_client *uda1341; - struct snd_pcm *pcm; - long samplerate; - struct audio_stream s[2]; /* playback & capture */ -}; - -static unsigned int rates[] = { - 8000, 10666, 10985, 14647, - 16000, 21970, 22050, 24000, - 29400, 32000, 44100, 48000, -}; - -static struct snd_pcm_hw_constraint_list hw_constraints_rates = { - .count = ARRAY_SIZE(rates), - .list = rates, - .mask = 0, -}; - -static struct platform_device *device; - -/* }}} */ - -/* {{{ Clock and sample rate stuff */ - -/* - * Stop-gap solution until rest of hh.org HAL stuff is merged. - */ -#define GPIO_H3600_CLK_SET0 GPIO_GPIO (12) -#define GPIO_H3600_CLK_SET1 GPIO_GPIO (13) - -#ifdef CONFIG_SA1100_H3XXX -#define clr_sa11xx_uda1341_egpio(x) clr_h3600_egpio(x) -#define set_sa11xx_uda1341_egpio(x) set_h3600_egpio(x) -#else -#error This driver could serve H3x00 handhelds only! -#endif - -static void sa11xx_uda1341_set_audio_clock(long val) -{ - switch (val) { - case 24000: case 32000: case 48000: /* 00: 12.288 MHz */ - GPCR = GPIO_H3600_CLK_SET0 | GPIO_H3600_CLK_SET1; - break; - - case 22050: case 29400: case 44100: /* 01: 11.2896 MHz */ - GPSR = GPIO_H3600_CLK_SET0; - GPCR = GPIO_H3600_CLK_SET1; - break; - - case 8000: case 10666: case 16000: /* 10: 4.096 MHz */ - GPCR = GPIO_H3600_CLK_SET0; - GPSR = GPIO_H3600_CLK_SET1; - break; - - case 10985: case 14647: case 21970: /* 11: 5.6245 MHz */ - GPSR = GPIO_H3600_CLK_SET0 | GPIO_H3600_CLK_SET1; - break; - } -} - -static void sa11xx_uda1341_set_samplerate(struct sa11xx_uda1341 *sa11xx_uda1341, long rate) -{ - int clk_div = 0; - int clk=0; - - /* We don't want to mess with clocks when frames are in flight */ - Ser4SSCR0 &= ~SSCR0_SSE; - /* wait for any frame to complete */ - udelay(125); - - /* - * We have the following clock sources: - * 4.096 MHz, 5.6245 MHz, 11.2896 MHz, 12.288 MHz - * Those can be divided either by 256, 384 or 512. - * This makes up 12 combinations for the following samplerates... - */ - if (rate >= 48000) - rate = 48000; - else if (rate >= 44100) - rate = 44100; - else if (rate >= 32000) - rate = 32000; - else if (rate >= 29400) - rate = 29400; - else if (rate >= 24000) - rate = 24000; - else if (rate >= 22050) - rate = 22050; - else if (rate >= 21970) - rate = 21970; - else if (rate >= 16000) - rate = 16000; - else if (rate >= 14647) - rate = 14647; - else if (rate >= 10985) - rate = 10985; - else if (rate >= 10666) - rate = 10666; - else - rate = 8000; - - /* Set the external clock generator */ - - sa11xx_uda1341_set_audio_clock(rate); - - /* Select the clock divisor */ - switch (rate) { - case 8000: - case 10985: - case 22050: - case 24000: - clk = F512; - clk_div = SSCR0_SerClkDiv(16); - break; - case 16000: - case 21970: - case 44100: - case 48000: - clk = F256; - clk_div = SSCR0_SerClkDiv(8); - break; - case 10666: - case 14647: - case 29400: - case 32000: - clk = F384; - clk_div = SSCR0_SerClkDiv(12); - break; - } - - /* FMT setting should be moved away when other FMTs are added (FIXME) */ - l3_command(sa11xx_uda1341->uda1341, CMD_FORMAT, (void *)LSB16); - - l3_command(sa11xx_uda1341->uda1341, CMD_FS, (void *)clk); - Ser4SSCR0 = (Ser4SSCR0 & ~0xff00) + clk_div + SSCR0_SSE; - sa11xx_uda1341->samplerate = rate; -} - -/* }}} */ - -/* {{{ HW init and shutdown */ - -static void sa11xx_uda1341_audio_init(struct sa11xx_uda1341 *sa11xx_uda1341) -{ - unsigned long flags; - - /* Setup DMA stuff */ - sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK].id = "UDA1341 out"; - sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK].stream_id = SNDRV_PCM_STREAM_PLAYBACK; - sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK].dma_dev = DMA_Ser4SSPWr; - - sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE].id = "UDA1341 in"; - sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE].stream_id = SNDRV_PCM_STREAM_CAPTURE; - sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE].dma_dev = DMA_Ser4SSPRd; - - /* Initialize the UDA1341 internal state */ - - /* Setup the uarts */ - local_irq_save(flags); - GAFR |= (GPIO_SSP_CLK); - GPDR &= ~(GPIO_SSP_CLK); - Ser4SSCR0 = 0; - Ser4SSCR0 = SSCR0_DataSize(16) + SSCR0_TI + SSCR0_SerClkDiv(8); - Ser4SSCR1 = SSCR1_SClkIactL + SSCR1_SClk1P + SSCR1_ExtClk; - Ser4SSCR0 |= SSCR0_SSE; - local_irq_restore(flags); - - /* Enable the audio power */ - - clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_CODEC_NRESET); - set_sa11xx_uda1341_egpio(IPAQ_EGPIO_AUDIO_ON); - set_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE); - - /* Wait for the UDA1341 to wake up */ - mdelay(1); //FIXME - was removed by Perex - Why? - - /* Initialize the UDA1341 internal state */ - l3_open(sa11xx_uda1341->uda1341); - - /* external clock configuration (after l3_open - regs must be initialized */ - sa11xx_uda1341_set_samplerate(sa11xx_uda1341, sa11xx_uda1341->samplerate); - - /* Wait for the UDA1341 to wake up */ - set_sa11xx_uda1341_egpio(IPAQ_EGPIO_CODEC_NRESET); - mdelay(1); - - /* make the left and right channels unswapped (flip the WS latch) */ - Ser4SSDR = 0; - - clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE); -} - -static void sa11xx_uda1341_audio_shutdown(struct sa11xx_uda1341 *sa11xx_uda1341) -{ - /* mute on */ - set_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE); - - /* disable the audio power and all signals leading to the audio chip */ - l3_close(sa11xx_uda1341->uda1341); - Ser4SSCR0 = 0; - clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_CODEC_NRESET); - - /* power off and mute off */ - /* FIXME - is muting off necesary??? */ - - clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_AUDIO_ON); - clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE); -} - -/* }}} */ - -/* {{{ DMA staff */ - -/* - * these are the address and sizes used to fill the xmit buffer - * so we can get a clock in record only mode - */ -#define FORCE_CLOCK_ADDR (dma_addr_t)FLUSH_BASE_PHYS -#define FORCE_CLOCK_SIZE 4096 // was 2048 - -// FIXME Why this value exactly - wrote comment -#define DMA_BUF_SIZE 8176 /* <= MAX_DMA_SIZE from asm/arch-sa1100/dma.h */ - -#ifdef HH_VERSION - -static int audio_dma_request(struct audio_stream *s, void (*callback)(void *, int)) -{ - int ret; - - ret = sa1100_request_dma(&s->dmach, s->id, s->dma_dev); - if (ret < 0) { - printk(KERN_ERR "unable to grab audio dma 0x%x\n", s->dma_dev); - return ret; - } - sa1100_dma_set_callback(s->dmach, callback); - return 0; -} - -static inline void audio_dma_free(struct audio_stream *s) -{ - sa1100_free_dma(s->dmach); - s->dmach = -1; -} - -#else - -static int audio_dma_request(struct audio_stream *s, void (*callback)(void *)) -{ - int ret; - - ret = sa1100_request_dma(s->dma_dev, s->id, callback, s, &s->dma_regs); - if (ret < 0) - printk(KERN_ERR "unable to grab audio dma 0x%x\n", s->dma_dev); - return ret; -} - -static void audio_dma_free(struct audio_stream *s) -{ - sa1100_free_dma(s->dma_regs); - s->dma_regs = 0; -} - -#endif - -static u_int audio_get_dma_pos(struct audio_stream *s) -{ - struct snd_pcm_substream *substream = s->stream; - struct snd_pcm_runtime *runtime = substream->runtime; - unsigned int offset; - unsigned long flags; - dma_addr_t addr; - - // this must be called w/ interrupts locked out see dma-sa1100.c in the kernel - spin_lock_irqsave(&s->dma_lock, flags); -#ifdef HH_VERSION - sa1100_dma_get_current(s->dmach, NULL, &addr); -#else - addr = sa1100_get_dma_pos((s)->dma_regs); -#endif - offset = addr - runtime->dma_addr; - spin_unlock_irqrestore(&s->dma_lock, flags); - - offset = bytes_to_frames(runtime,offset); - if (offset >= runtime->buffer_size) - offset = 0; - - return offset; -} - -/* - * this stops the dma and clears the dma ptrs - */ -static void audio_stop_dma(struct audio_stream *s) -{ - unsigned long flags; - - spin_lock_irqsave(&s->dma_lock, flags); - s->active = 0; - s->period = 0; - /* this stops the dma channel and clears the buffer ptrs */ -#ifdef HH_VERSION - sa1100_dma_flush_all(s->dmach); -#else - sa1100_clear_dma(s->dma_regs); -#endif - spin_unlock_irqrestore(&s->dma_lock, flags); -} - -static void audio_process_dma(struct audio_stream *s) -{ - struct snd_pcm_substream *substream = s->stream; - struct snd_pcm_runtime *runtime; - unsigned int dma_size; - unsigned int offset; - int ret; - - /* we are requested to process synchronization DMA transfer */ - if (s->tx_spin) { - if (snd_BUG_ON(s->stream_id != SNDRV_PCM_STREAM_PLAYBACK)) - return; - /* fill the xmit dma buffers and return */ -#ifdef HH_VERSION - sa1100_dma_set_spin(s->dmach, FORCE_CLOCK_ADDR, FORCE_CLOCK_SIZE); -#else - while (1) { - ret = sa1100_start_dma(s->dma_regs, FORCE_CLOCK_ADDR, FORCE_CLOCK_SIZE); - if (ret) - return; - } -#endif - return; - } - - /* must be set here - only valid for running streams, not for forced_clock dma fills */ - runtime = substream->runtime; - while (s->active && s->periods < runtime->periods) { - dma_size = frames_to_bytes(runtime, runtime->period_size); - if (s->old_offset) { - /* a little trick, we need resume from old position */ - offset = frames_to_bytes(runtime, s->old_offset - 1); - s->old_offset = 0; - s->periods = 0; - s->period = offset / dma_size; - offset %= dma_size; - dma_size = dma_size - offset; - if (!dma_size) - continue; /* special case */ - } else { - offset = dma_size * s->period; - snd_BUG_ON(dma_size > DMA_BUF_SIZE); - } -#ifdef HH_VERSION - ret = sa1100_dma_queue_buffer(s->dmach, s, runtime->dma_addr + offset, dma_size); - if (ret) - return; //FIXME -#else - ret = sa1100_start_dma((s)->dma_regs, runtime->dma_addr + offset, dma_size); - if (ret) { - printk(KERN_ERR "audio_process_dma: cannot queue DMA buffer (%i)\n", ret); - return; - } -#endif - - s->period++; - s->period %= runtime->periods; - s->periods++; - } -} - -#ifdef HH_VERSION -static void audio_dma_callback(void *data, int size) -#else -static void audio_dma_callback(void *data) -#endif -{ - struct audio_stream *s = data; - - /* - * If we are getting a callback for an active stream then we inform - * the PCM middle layer we've finished a period - */ - if (s->active) - snd_pcm_period_elapsed(s->stream); - - spin_lock(&s->dma_lock); - if (!s->tx_spin && s->periods > 0) - s->periods--; - audio_process_dma(s); - spin_unlock(&s->dma_lock); -} - -/* }}} */ - -/* {{{ PCM setting */ - -/* {{{ trigger & timer */ - -static int snd_sa11xx_uda1341_trigger(struct snd_pcm_substream *substream, int cmd) -{ - struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); - int stream_id = substream->pstr->stream; - struct audio_stream *s = &chip->s[stream_id]; - struct audio_stream *s1 = &chip->s[stream_id ^ 1]; - int err = 0; - - /* note local interrupts are already disabled in the midlevel code */ - spin_lock(&s->dma_lock); - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - /* now we need to make sure a record only stream has a clock */ - if (stream_id == SNDRV_PCM_STREAM_CAPTURE && !s1->active) { - /* we need to force fill the xmit DMA with zeros */ - s1->tx_spin = 1; - audio_process_dma(s1); - } - /* this case is when you were recording then you turn on a - * playback stream so we stop (also clears it) the dma first, - * clear the sync flag and then we let it turned on - */ - else { - s->tx_spin = 0; - } - - /* requested stream startup */ - s->active = 1; - audio_process_dma(s); - break; - case SNDRV_PCM_TRIGGER_STOP: - /* requested stream shutdown */ - audio_stop_dma(s); - - /* - * now we need to make sure a record only stream has a clock - * so if we're stopping a playback with an active capture - * we need to turn the 0 fill dma on for the xmit side - */ - if (stream_id == SNDRV_PCM_STREAM_PLAYBACK && s1->active) { - /* we need to force fill the xmit DMA with zeros */ - s->tx_spin = 1; - audio_process_dma(s); - } - /* - * we killed a capture only stream, so we should also kill - * the zero fill transmit - */ - else { - if (s1->tx_spin) { - s1->tx_spin = 0; - audio_stop_dma(s1); - } - } - - break; - case SNDRV_PCM_TRIGGER_SUSPEND: - s->active = 0; -#ifdef HH_VERSION - sa1100_dma_stop(s->dmach); -#else - //FIXME - DMA API -#endif - s->old_offset = audio_get_dma_pos(s) + 1; -#ifdef HH_VERSION - sa1100_dma_flush_all(s->dmach); -#else - //FIXME - DMA API -#endif - s->periods = 0; - break; - case SNDRV_PCM_TRIGGER_RESUME: - s->active = 1; - s->tx_spin = 0; - audio_process_dma(s); - if (stream_id == SNDRV_PCM_STREAM_CAPTURE && !s1->active) { - s1->tx_spin = 1; - audio_process_dma(s1); - } - break; - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: -#ifdef HH_VERSION - sa1100_dma_stop(s->dmach); -#else - //FIXME - DMA API -#endif - s->active = 0; - if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) { - if (s1->active) { - s->tx_spin = 1; - s->old_offset = audio_get_dma_pos(s) + 1; -#ifdef HH_VERSION - sa1100_dma_flush_all(s->dmach); -#else - //FIXME - DMA API -#endif - audio_process_dma(s); - } - } else { - if (s1->tx_spin) { - s1->tx_spin = 0; -#ifdef HH_VERSION - sa1100_dma_flush_all(s1->dmach); -#else - //FIXME - DMA API -#endif - } - } - break; - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - s->active = 1; - if (s->old_offset) { - s->tx_spin = 0; - audio_process_dma(s); - break; - } - if (stream_id == SNDRV_PCM_STREAM_CAPTURE && !s1->active) { - s1->tx_spin = 1; - audio_process_dma(s1); - } -#ifdef HH_VERSION - sa1100_dma_resume(s->dmach); -#else - //FIXME - DMA API -#endif - break; - default: - err = -EINVAL; - break; - } - spin_unlock(&s->dma_lock); - return err; -} - -static int snd_sa11xx_uda1341_prepare(struct snd_pcm_substream *substream) -{ - struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; - struct audio_stream *s = &chip->s[substream->pstr->stream]; - - /* set requested samplerate */ - sa11xx_uda1341_set_samplerate(chip, runtime->rate); - - /* set requestd format when available */ - /* set FMT here !!! FIXME */ - - s->period = 0; - s->periods = 0; - - return 0; -} - -static snd_pcm_uframes_t snd_sa11xx_uda1341_pointer(struct snd_pcm_substream *substream) -{ - struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); - return audio_get_dma_pos(&chip->s[substream->pstr->stream]); -} - -/* }}} */ - -static struct snd_pcm_hardware snd_sa11xx_uda1341_capture = -{ - .info = (SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ - SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |\ - SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ - SNDRV_PCM_RATE_KNOT), - .rate_min = 8000, - .rate_max = 48000, - .channels_min = 2, - .channels_max = 2, - .buffer_bytes_max = 64*1024, - .period_bytes_min = 64, - .period_bytes_max = DMA_BUF_SIZE, - .periods_min = 2, - .periods_max = 255, - .fifo_size = 0, -}; - -static struct snd_pcm_hardware snd_sa11xx_uda1341_playback = -{ - .info = (SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ - SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |\ - SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ - SNDRV_PCM_RATE_KNOT), - .rate_min = 8000, - .rate_max = 48000, - .channels_min = 2, - .channels_max = 2, - .buffer_bytes_max = 64*1024, - .period_bytes_min = 64, - .period_bytes_max = DMA_BUF_SIZE, - .periods_min = 2, - .periods_max = 255, - .fifo_size = 0, -}; - -static int snd_card_sa11xx_uda1341_open(struct snd_pcm_substream *substream) -{ - struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; - int stream_id = substream->pstr->stream; - int err; - - chip->s[stream_id].stream = substream; - - if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) - runtime->hw = snd_sa11xx_uda1341_playback; - else - runtime->hw = snd_sa11xx_uda1341_capture; - if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) - return err; - if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0) - return err; - - return 0; -} - -static int snd_card_sa11xx_uda1341_close(struct snd_pcm_substream *substream) -{ - struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); - - chip->s[substream->pstr->stream].stream = NULL; - return 0; -} - -/* {{{ HW params & free */ - -static int snd_sa11xx_uda1341_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_sa11xx_uda1341_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - -/* }}} */ - -static struct snd_pcm_ops snd_card_sa11xx_uda1341_playback_ops = { - .open = snd_card_sa11xx_uda1341_open, - .close = snd_card_sa11xx_uda1341_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sa11xx_uda1341_hw_params, - .hw_free = snd_sa11xx_uda1341_hw_free, - .prepare = snd_sa11xx_uda1341_prepare, - .trigger = snd_sa11xx_uda1341_trigger, - .pointer = snd_sa11xx_uda1341_pointer, -}; - -static struct snd_pcm_ops snd_card_sa11xx_uda1341_capture_ops = { - .open = snd_card_sa11xx_uda1341_open, - .close = snd_card_sa11xx_uda1341_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sa11xx_uda1341_hw_params, - .hw_free = snd_sa11xx_uda1341_hw_free, - .prepare = snd_sa11xx_uda1341_prepare, - .trigger = snd_sa11xx_uda1341_trigger, - .pointer = snd_sa11xx_uda1341_pointer, -}; - -static int __init snd_card_sa11xx_uda1341_pcm(struct sa11xx_uda1341 *sa11xx_uda1341, int device) -{ - struct snd_pcm *pcm; - int err; - - if ((err = snd_pcm_new(sa11xx_uda1341->card, "UDA1341 PCM", device, 1, 1, &pcm)) < 0) - return err; - - /* - * this sets up our initial buffers and sets the dma_type to isa. - * isa works but I'm not sure why (or if) it's the right choice - * this may be too large, trying it for now - */ - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - snd_dma_isa_data(), - 64*1024, 64*1024); - - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops); - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_sa11xx_uda1341_capture_ops); - pcm->private_data = sa11xx_uda1341; - pcm->info_flags = 0; - strcpy(pcm->name, "UDA1341 PCM"); - - sa11xx_uda1341_audio_init(sa11xx_uda1341); - - /* setup DMA controller */ - audio_dma_request(&sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK], audio_dma_callback); - audio_dma_request(&sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE], audio_dma_callback); - - sa11xx_uda1341->pcm = pcm; - - return 0; -} - -/* }}} */ - -/* {{{ module init & exit */ - -#ifdef CONFIG_PM - -static int snd_sa11xx_uda1341_suspend(struct platform_device *devptr, - pm_message_t state) -{ - struct snd_card *card = platform_get_drvdata(devptr); - struct sa11xx_uda1341 *chip = card->private_data; - - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); - snd_pcm_suspend_all(chip->pcm); -#ifdef HH_VERSION - sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach); - sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_CAPTURE].dmach); -#else - //FIXME -#endif - l3_command(chip->uda1341, CMD_SUSPEND, NULL); - sa11xx_uda1341_audio_shutdown(chip); - - return 0; -} - -static int snd_sa11xx_uda1341_resume(struct platform_device *devptr) -{ - struct snd_card *card = platform_get_drvdata(devptr); - struct sa11xx_uda1341 *chip = card->private_data; - - sa11xx_uda1341_audio_init(chip); - l3_command(chip->uda1341, CMD_RESUME, NULL); -#ifdef HH_VERSION - sa1100_dma_wakeup(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach); - sa1100_dma_wakeup(chip->s[SNDRV_PCM_STREAM_CAPTURE].dmach); -#else - //FIXME -#endif - snd_power_change_state(card, SNDRV_CTL_POWER_D0); - return 0; -} -#endif /* COMFIG_PM */ - -void snd_sa11xx_uda1341_free(struct snd_card *card) -{ - struct sa11xx_uda1341 *chip = card->private_data; - - audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); - audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); -} - -static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr) -{ - int err; - struct snd_card *card; - struct sa11xx_uda1341 *chip; - - /* register the soundcard */ - err = snd_card_create(-1, id, THIS_MODULE, - sizeof(struct sa11xx_uda1341), &card); - if (err < 0) - return err; - - chip = card->private_data; - spin_lock_init(&chip->s[0].dma_lock); - spin_lock_init(&chip->s[1].dma_lock); - - card->private_free = snd_sa11xx_uda1341_free; - chip->card = card; - chip->samplerate = AUDIO_RATE_DEFAULT; - - // mixer - if ((err = snd_chip_uda1341_mixer_new(card, &chip->uda1341))) - goto nodev; - - // PCM - if ((err = snd_card_sa11xx_uda1341_pcm(chip, 0)) < 0) - goto nodev; - - strcpy(card->driver, "UDA1341"); - strcpy(card->shortname, "H3600 UDA1341TS"); - sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); - - snd_card_set_dev(card, &devptr->dev); - - if ((err = snd_card_register(card)) == 0) { - printk(KERN_INFO "iPAQ audio support initialized\n"); - platform_set_drvdata(devptr, card); - return 0; - } - - nodev: - snd_card_free(card); - return err; -} - -static int __devexit sa11xx_uda1341_remove(struct platform_device *devptr) -{ - snd_card_free(platform_get_drvdata(devptr)); - platform_set_drvdata(devptr, NULL); - return 0; -} - -#define SA11XX_UDA1341_DRIVER "sa11xx_uda1341" - -static struct platform_driver sa11xx_uda1341_driver = { - .probe = sa11xx_uda1341_probe, - .remove = __devexit_p(sa11xx_uda1341_remove), -#ifdef CONFIG_PM - .suspend = snd_sa11xx_uda1341_suspend, - .resume = snd_sa11xx_uda1341_resume, -#endif - .driver = { - .name = SA11XX_UDA1341_DRIVER, - }, -}; - -static int __init sa11xx_uda1341_init(void) -{ - int err; - - if (!machine_is_h3xxx()) - return -ENODEV; - if ((err = platform_driver_register(&sa11xx_uda1341_driver)) < 0) - return err; - device = platform_device_register_simple(SA11XX_UDA1341_DRIVER, -1, NULL, 0); - if (!IS_ERR(device)) { - if (platform_get_drvdata(device)) - return 0; - platform_device_unregister(device); - err = -ENODEV; - } else - err = PTR_ERR(device); - platform_driver_unregister(&sa11xx_uda1341_driver); - return err; -} - -static void __exit sa11xx_uda1341_exit(void) -{ - platform_device_unregister(device); - platform_driver_unregister(&sa11xx_uda1341_driver); -} - -module_init(sa11xx_uda1341_init); -module_exit(sa11xx_uda1341_exit); - -/* }}} */ - -/* - * Local variables: - * indent-tabs-mode: t - * End: - */ diff --git a/sound/i2c/Makefile b/sound/i2c/Makefile index 37970666a453..36879bf88700 100644 --- a/sound/i2c/Makefile +++ b/sound/i2c/Makefile @@ -7,8 +7,6 @@ snd-i2c-objs := i2c.o snd-cs8427-objs := cs8427.o snd-tea6330t-objs := tea6330t.o -obj-$(CONFIG_L3) += l3/ - obj-$(CONFIG_SND) += other/ # Toplevel Module Dependency diff --git a/sound/i2c/l3/Makefile b/sound/i2c/l3/Makefile deleted file mode 100644 index 49455b8dcc04..000000000000 --- a/sound/i2c/l3/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# Makefile for ALSA -# - -snd-uda1341-objs := uda1341.o - -# Module Dependency -obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-uda1341.o diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c deleted file mode 100644 index 9840eb43648d..000000000000 --- a/sound/i2c/l3/uda1341.c +++ /dev/null @@ -1,935 +0,0 @@ -/* - * Philips UDA1341 mixer device driver - * Copyright (c) 2002 Tomas Kasparek - * - * Portions are Copyright (C) 2000 Lernout & Hauspie Speech Products, N.V. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License. - * - * History: - * - * 2002-03-13 Tomas Kasparek initial release - based on uda1341.c from OSS - * 2002-03-28 Tomas Kasparek basic mixer is working (volume, bass, treble) - * 2002-03-30 Tomas Kasparek proc filesystem support, complete mixer and DSP - * features support - * 2002-04-12 Tomas Kasparek proc interface update, code cleanup - * 2002-05-12 Tomas Kasparek another code cleanup - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include - -#include - -/* {{{ HW regs definition */ - -#define STAT0 0x00 -#define STAT1 0x80 -#define STAT_MASK 0x80 - -#define DATA0_0 0x00 -#define DATA0_1 0x40 -#define DATA0_2 0x80 -#define DATA_MASK 0xc0 - -#define IS_DATA0(x) ((x) >= data0_0 && (x) <= data0_2) -#define IS_DATA1(x) ((x) == data1) -#define IS_STATUS(x) ((x) == stat0 || (x) == stat1) -#define IS_EXTEND(x) ((x) >= ext0 && (x) <= ext6) - -/* }}} */ - - -static const char *peak_names[] = { - "before", - "after", -}; - -static const char *filter_names[] = { - "flat", - "min", - "min", - "max", -}; - -static const char *mixer_names[] = { - "double differential", - "input channel 1 (line in)", - "input channel 2 (microphone)", - "digital mixer", -}; - -static const char *deemp_names[] = { - "none", - "32 kHz", - "44.1 kHz", - "48 kHz", -}; - -enum uda1341_regs_names { - stat0, - stat1, - data0_0, - data0_1, - data0_2, - data1, - ext0, - ext1, - ext2, - empty, - ext4, - ext5, - ext6, - uda1341_reg_last, -}; - -static const char *uda1341_reg_names[] = { - "stat 0 ", - "stat 1 ", - "data 00", - "data 01", - "data 02", - "data 1 ", - "ext 0", - "ext 1", - "ext 2", - "empty", - "ext 4", - "ext 5", - "ext 6", -}; - -static const int uda1341_enum_items[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, //peak - before/after - 4, //deemp - none/32/44.1/48 - 0, - 4, //filter - flat/min/min/max - 0, 0, 0, - 4, //mixer - differ/line/mic/mixer - 0, 0, 0, 0, 0, -}; - -static const char ** uda1341_enum_names[] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - peak_names, //peak - before/after - deemp_names, //deemp - none/32/44.1/48 - NULL, - filter_names, //filter - flat/min/min/max - NULL, NULL, NULL, - mixer_names, //mixer - differ/line/mic/mixer - NULL, NULL, NULL, NULL, NULL, -}; - -typedef int uda1341_cfg[CMD_LAST]; - -struct uda1341 { - int (*write) (struct l3_client *uda1341, unsigned short reg, unsigned short val); - int (*read) (struct l3_client *uda1341, unsigned short reg); - unsigned char regs[uda1341_reg_last]; - int active; - spinlock_t reg_lock; - struct snd_card *card; - uda1341_cfg cfg; -#ifdef CONFIG_PM - unsigned char suspend_regs[uda1341_reg_last]; - uda1341_cfg suspend_cfg; -#endif -}; - -/* transfer 8bit integer into string with binary representation */ -static void int2str_bin8(uint8_t val, char *buf) -{ - const int size = sizeof(val) * 8; - int i; - - for (i= 0; i < size; i++){ - *(buf++) = (val >> (size - 1)) ? '1' : '0'; - val <<= 1; - } - *buf = '\0'; //end the string with zero -} - -/* {{{ HW manipulation routines */ - -static int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned short val) -{ - struct uda1341 *uda = clnt->driver_data; - unsigned char buf[2] = { 0xc0, 0xe0 }; // for EXT addressing - int err = 0; - - uda->regs[reg] = val; - - if (uda->active) { - if (IS_DATA0(reg)) { - err = l3_write(clnt, UDA1341_DATA0, (const unsigned char *)&val, 1); - } else if (IS_DATA1(reg)) { - err = l3_write(clnt, UDA1341_DATA1, (const unsigned char *)&val, 1); - } else if (IS_STATUS(reg)) { - err = l3_write(clnt, UDA1341_STATUS, (const unsigned char *)&val, 1); - } else if (IS_EXTEND(reg)) { - buf[0] |= (reg - ext0) & 0x7; //EXT address - buf[1] |= val; //EXT data - err = l3_write(clnt, UDA1341_DATA0, (const unsigned char *)buf, 2); - } - } else - printk(KERN_ERR "UDA1341 codec not active!\n"); - return err; -} - -static int snd_uda1341_codec_read(struct l3_client *clnt, unsigned short reg) -{ - unsigned char val; - int err; - - err = l3_read(clnt, reg, &val, 1); - if (err == 1) - // use just 6bits - the rest is address of the reg - return val & 63; - return err < 0 ? err : -EIO; -} - -static inline int snd_uda1341_valid_reg(struct l3_client *clnt, unsigned short reg) -{ - return reg < uda1341_reg_last; -} - -static int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg, - unsigned short mask, unsigned short shift, - unsigned short value, int flush) -{ - int change; - unsigned short old, new; - struct uda1341 *uda = clnt->driver_data; - -#if 0 - printk(KERN_DEBUG "update_bits: reg: %s mask: %d shift: %d val: %d\n", - uda1341_reg_names[reg], mask, shift, value); -#endif - - if (!snd_uda1341_valid_reg(clnt, reg)) - return -EINVAL; - spin_lock(&uda->reg_lock); - old = uda->regs[reg]; - new = (old & ~(mask << shift)) | (value << shift); - change = old != new; - if (change) { - if (flush) uda->write(clnt, reg, new); - uda->regs[reg] = new; - } - spin_unlock(&uda->reg_lock); - return change; -} - -static int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what, - unsigned short value, int flush) -{ - struct uda1341 *uda = clnt->driver_data; - int ret = 0; -#ifdef CONFIG_PM - int reg; -#endif - -#if 0 - printk(KERN_DEBUG "cfg_write what: %d value: %d\n", what, value); -#endif - - uda->cfg[what] = value; - - switch(what) { - case CMD_RESET: - ret = snd_uda1341_update_bits(clnt, data0_2, 1, 2, 1, flush); // MUTE - ret = snd_uda1341_update_bits(clnt, stat0, 1, 6, 1, flush); // RESET - ret = snd_uda1341_update_bits(clnt, stat0, 1, 6, 0, flush); // RESTORE - uda->cfg[CMD_RESET]=0; - break; - case CMD_FS: - ret = snd_uda1341_update_bits(clnt, stat0, 3, 4, value, flush); - break; - case CMD_FORMAT: - ret = snd_uda1341_update_bits(clnt, stat0, 7, 1, value, flush); - break; - case CMD_OGAIN: - ret = snd_uda1341_update_bits(clnt, stat1, 1, 6, value, flush); - break; - case CMD_IGAIN: - ret = snd_uda1341_update_bits(clnt, stat1, 1, 5, value, flush); - break; - case CMD_DAC: - ret = snd_uda1341_update_bits(clnt, stat1, 1, 0, value, flush); - break; - case CMD_ADC: - ret = snd_uda1341_update_bits(clnt, stat1, 1, 1, value, flush); - break; - case CMD_VOLUME: - ret = snd_uda1341_update_bits(clnt, data0_0, 63, 0, value, flush); - break; - case CMD_BASS: - ret = snd_uda1341_update_bits(clnt, data0_1, 15, 2, value, flush); - break; - case CMD_TREBBLE: - ret = snd_uda1341_update_bits(clnt, data0_1, 3, 0, value, flush); - break; - case CMD_PEAK: - ret = snd_uda1341_update_bits(clnt, data0_2, 1, 5, value, flush); - break; - case CMD_DEEMP: - ret = snd_uda1341_update_bits(clnt, data0_2, 3, 3, value, flush); - break; - case CMD_MUTE: - ret = snd_uda1341_update_bits(clnt, data0_2, 1, 2, value, flush); - break; - case CMD_FILTER: - ret = snd_uda1341_update_bits(clnt, data0_2, 3, 0, value, flush); - break; - case CMD_CH1: - ret = snd_uda1341_update_bits(clnt, ext0, 31, 0, value, flush); - break; - case CMD_CH2: - ret = snd_uda1341_update_bits(clnt, ext1, 31, 0, value, flush); - break; - case CMD_MIC: - ret = snd_uda1341_update_bits(clnt, ext2, 7, 2, value, flush); - break; - case CMD_MIXER: - ret = snd_uda1341_update_bits(clnt, ext2, 3, 0, value, flush); - break; - case CMD_AGC: - ret = snd_uda1341_update_bits(clnt, ext4, 1, 4, value, flush); - break; - case CMD_IG: - ret = snd_uda1341_update_bits(clnt, ext4, 3, 0, value & 0x3, flush); - ret = snd_uda1341_update_bits(clnt, ext5, 31, 0, value >> 2, flush); - break; - case CMD_AGC_TIME: - ret = snd_uda1341_update_bits(clnt, ext6, 7, 2, value, flush); - break; - case CMD_AGC_LEVEL: - ret = snd_uda1341_update_bits(clnt, ext6, 3, 0, value, flush); - break; -#ifdef CONFIG_PM - case CMD_SUSPEND: - for (reg = stat0; reg < uda1341_reg_last; reg++) - uda->suspend_regs[reg] = uda->regs[reg]; - for (reg = 0; reg < CMD_LAST; reg++) - uda->suspend_cfg[reg] = uda->cfg[reg]; - break; - case CMD_RESUME: - for (reg = stat0; reg < uda1341_reg_last; reg++) - snd_uda1341_codec_write(clnt, reg, uda->suspend_regs[reg]); - for (reg = 0; reg < CMD_LAST; reg++) - uda->cfg[reg] = uda->suspend_cfg[reg]; - break; -#endif - default: - ret = -EINVAL; - break; - } - - if (!uda->active) - printk(KERN_ERR "UDA1341 codec not active!\n"); - return ret; -} - -/* }}} */ - -/* {{{ Proc interface */ -#ifdef CONFIG_PROC_FS - -static const char *format_names[] = { - "I2S-bus", - "LSB 16bits", - "LSB 18bits", - "LSB 20bits", - "MSB", - "in LSB 16bits/out MSB", - "in LSB 18bits/out MSB", - "in LSB 20bits/out MSB", -}; - -static const char *fs_names[] = { - "512*fs", - "384*fs", - "256*fs", - "Unused - bad value!", -}; - -static const char* bass_values[][16] = { - {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", - "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat - {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB", - "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min - {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB", - "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min - {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB", - "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max -}; - -static const char *mic_sens_value[] = { - "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used", -}; - -static const unsigned short AGC_atime[] = { - 11, 16, 11, 16, 21, 11, 16, 21, -}; - -static const unsigned short AGC_dtime[] = { - 100, 100, 200, 200, 200, 400, 400, 400, -}; - -static const char *AGC_level[] = { - "-9.0", "-11.5", "-15.0", "-17.5", -}; - -static const char *ig_small_value[] = { - "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5", -}; - -/* - * this was computed as peak_value[i] = pow((63-i)*1.42,1.013) - * - * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2 - * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29 - * [61]=-2.78, [62] = -1.48, [63] = 0.0 - * I tried to compute it, but using but even using logarithm with base either 10 or 2 - * i was'n able to get values in the table from the formula. So I constructed another - * formula (see above) to interpolate the values as good as possible. If there is some - * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks. - * UDA1341TS datasheet is available at: - * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf - */ -static const char *peak_value[] = { - "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB", - "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB", - "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB", - "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB", - "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB", - "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB", - "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB", - "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB", - "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB", -}; - -static void snd_uda1341_proc_read(struct snd_info_entry *entry, - struct snd_info_buffer *buffer) -{ - struct l3_client *clnt = entry->private_data; - struct uda1341 *uda = clnt->driver_data; - int peak; - - peak = snd_uda1341_codec_read(clnt, UDA1341_DATA1); - if (peak < 0) - peak = 0; - - snd_iprintf(buffer, "%s\n\n", uda->card->longname); - - // for information about computed values see UDA1341TS datasheet pages 15 - 21 - snd_iprintf(buffer, "DAC power : %s\n", uda->cfg[CMD_DAC] ? "on" : "off"); - snd_iprintf(buffer, "ADC power : %s\n", uda->cfg[CMD_ADC] ? "on" : "off"); - snd_iprintf(buffer, "Clock frequency : %s\n", fs_names[uda->cfg[CMD_FS]]); - snd_iprintf(buffer, "Data format : %s\n\n", format_names[uda->cfg[CMD_FORMAT]]); - - snd_iprintf(buffer, "Filter mode : %s\n", filter_names[uda->cfg[CMD_FILTER]]); - snd_iprintf(buffer, "Mixer mode : %s\n", mixer_names[uda->cfg[CMD_MIXER]]); - snd_iprintf(buffer, "De-emphasis : %s\n", deemp_names[uda->cfg[CMD_DEEMP]]); - snd_iprintf(buffer, "Peak detection pos. : %s\n", uda->cfg[CMD_PEAK] ? "after" : "before"); - snd_iprintf(buffer, "Peak value : %s\n\n", peak_value[peak]); - - snd_iprintf(buffer, "Automatic Gain Ctrl : %s\n", uda->cfg[CMD_AGC] ? "on" : "off"); - snd_iprintf(buffer, "AGC attack time : %d ms\n", AGC_atime[uda->cfg[CMD_AGC_TIME]]); - snd_iprintf(buffer, "AGC decay time : %d ms\n", AGC_dtime[uda->cfg[CMD_AGC_TIME]]); - snd_iprintf(buffer, "AGC output level : %s dB\n\n", AGC_level[uda->cfg[CMD_AGC_LEVEL]]); - - snd_iprintf(buffer, "Mute : %s\n", uda->cfg[CMD_MUTE] ? "on" : "off"); - - if (uda->cfg[CMD_VOLUME] == 0) - snd_iprintf(buffer, "Volume : 0 dB\n"); - else if (uda->cfg[CMD_VOLUME] < 62) - snd_iprintf(buffer, "Volume : %d dB\n", -1*uda->cfg[CMD_VOLUME] +1); - else - snd_iprintf(buffer, "Volume : -INF dB\n"); - snd_iprintf(buffer, "Bass : %s\n", bass_values[uda->cfg[CMD_FILTER]][uda->cfg[CMD_BASS]]); - snd_iprintf(buffer, "Trebble : %d dB\n", uda->cfg[CMD_FILTER] ? 2*uda->cfg[CMD_TREBBLE] : 0); - snd_iprintf(buffer, "Input Gain (6dB) : %s\n", uda->cfg[CMD_IGAIN] ? "on" : "off"); - snd_iprintf(buffer, "Output Gain (6dB) : %s\n", uda->cfg[CMD_OGAIN] ? "on" : "off"); - snd_iprintf(buffer, "Mic sensitivity : %s\n", mic_sens_value[uda->cfg[CMD_MIC]]); - - - if(uda->cfg[CMD_CH1] < 31) - snd_iprintf(buffer, "Mixer gain channel 1: -%d.%c dB\n", - ((uda->cfg[CMD_CH1] >> 1) * 3) + (uda->cfg[CMD_CH1] & 1), - uda->cfg[CMD_CH1] & 1 ? '5' : '0'); - else - snd_iprintf(buffer, "Mixer gain channel 1: -INF dB\n"); - if(uda->cfg[CMD_CH2] < 31) - snd_iprintf(buffer, "Mixer gain channel 2: -%d.%c dB\n", - ((uda->cfg[CMD_CH2] >> 1) * 3) + (uda->cfg[CMD_CH2] & 1), - uda->cfg[CMD_CH2] & 1 ? '5' : '0'); - else - snd_iprintf(buffer, "Mixer gain channel 2: -INF dB\n"); - - if(uda->cfg[CMD_IG] > 5) - snd_iprintf(buffer, "Input Amp. Gain ch 2: %d.%c dB\n", - (uda->cfg[CMD_IG] >> 1) -3, uda->cfg[CMD_IG] & 1 ? '5' : '0'); - else - snd_iprintf(buffer, "Input Amp. Gain ch 2: %s dB\n", ig_small_value[uda->cfg[CMD_IG]]); -} - -static void snd_uda1341_proc_regs_read(struct snd_info_entry *entry, - struct snd_info_buffer *buffer) -{ - struct l3_client *clnt = entry->private_data; - struct uda1341 *uda = clnt->driver_data; - int reg; - char buf[12]; - - for (reg = 0; reg < uda1341_reg_last; reg ++) { - if (reg == empty) - continue; - int2str_bin8(uda->regs[reg], buf); - snd_iprintf(buffer, "%s = %s\n", uda1341_reg_names[reg], buf); - } - - int2str_bin8(snd_uda1341_codec_read(clnt, UDA1341_DATA1), buf); - snd_iprintf(buffer, "DATA1 = %s\n", buf); -} -#endif /* CONFIG_PROC_FS */ - -static void __devinit snd_uda1341_proc_init(struct snd_card *card, struct l3_client *clnt) -{ - struct snd_info_entry *entry; - - if (! snd_card_proc_new(card, "uda1341", &entry)) - snd_info_set_text_ops(entry, clnt, snd_uda1341_proc_read); - if (! snd_card_proc_new(card, "uda1341-regs", &entry)) - snd_info_set_text_ops(entry, clnt, snd_uda1341_proc_regs_read); -} - -/* }}} */ - -/* {{{ Mixer controls setting */ - -/* {{{ UDA1341 single functions */ - -#define UDA1341_SINGLE(xname, where, reg, shift, mask, invert) \ -{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_uda1341_info_single, \ - .get = snd_uda1341_get_single, .put = snd_uda1341_put_single, \ - .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \ -} - -static int snd_uda1341_info_single(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - int mask = (kcontrol->private_value >> 12) & 63; - - uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 1; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = mask; - return 0; -} - -static int snd_uda1341_get_single(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct l3_client *clnt = snd_kcontrol_chip(kcontrol); - struct uda1341 *uda = clnt->driver_data; - int where = kcontrol->private_value & 31; - int mask = (kcontrol->private_value >> 12) & 63; - int invert = (kcontrol->private_value >> 18) & 1; - - ucontrol->value.integer.value[0] = uda->cfg[where]; - if (invert) - ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; - - return 0; -} - -static int snd_uda1341_put_single(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct l3_client *clnt = snd_kcontrol_chip(kcontrol); - struct uda1341 *uda = clnt->driver_data; - int where = kcontrol->private_value & 31; - int reg = (kcontrol->private_value >> 5) & 15; - int shift = (kcontrol->private_value >> 9) & 7; - int mask = (kcontrol->private_value >> 12) & 63; - int invert = (kcontrol->private_value >> 18) & 1; - unsigned short val; - - val = (ucontrol->value.integer.value[0] & mask); - if (invert) - val = mask - val; - - uda->cfg[where] = val; - return snd_uda1341_update_bits(clnt, reg, mask, shift, val, FLUSH); -} - -/* }}} */ - -/* {{{ UDA1341 enum functions */ - -#define UDA1341_ENUM(xname, where, reg, shift, mask, invert) \ -{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_uda1341_info_enum, \ - .get = snd_uda1341_get_enum, .put = snd_uda1341_put_enum, \ - .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \ -} - -static int snd_uda1341_info_enum(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - int where = kcontrol->private_value & 31; - const char **texts; - - // this register we don't handle this way - if (!uda1341_enum_items[where]) - return -EINVAL; - - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = 1; - uinfo->value.enumerated.items = uda1341_enum_items[where]; - - if (uinfo->value.enumerated.item >= uda1341_enum_items[where]) - uinfo->value.enumerated.item = uda1341_enum_items[where] - 1; - - texts = uda1341_enum_names[where]; - strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); - return 0; -} - -static int snd_uda1341_get_enum(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct l3_client *clnt = snd_kcontrol_chip(kcontrol); - struct uda1341 *uda = clnt->driver_data; - int where = kcontrol->private_value & 31; - - ucontrol->value.enumerated.item[0] = uda->cfg[where]; - return 0; -} - -static int snd_uda1341_put_enum(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct l3_client *clnt = snd_kcontrol_chip(kcontrol); - struct uda1341 *uda = clnt->driver_data; - int where = kcontrol->private_value & 31; - int reg = (kcontrol->private_value >> 5) & 15; - int shift = (kcontrol->private_value >> 9) & 7; - int mask = (kcontrol->private_value >> 12) & 63; - - uda->cfg[where] = (ucontrol->value.enumerated.item[0] & mask); - - return snd_uda1341_update_bits(clnt, reg, mask, shift, uda->cfg[where], FLUSH); -} - -/* }}} */ - -/* {{{ UDA1341 2regs functions */ - -#define UDA1341_2REGS(xname, where, reg_1, reg_2, shift_1, shift_2, mask_1, mask_2, invert) \ -{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), .info = snd_uda1341_info_2regs, \ - .get = snd_uda1341_get_2regs, .put = snd_uda1341_put_2regs, \ - .private_value = where | (reg_1 << 5) | (reg_2 << 9) | (shift_1 << 13) | (shift_2 << 16) | \ - (mask_1 << 19) | (mask_2 << 25) | (invert << 31) \ -} - - -static int snd_uda1341_info_2regs(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - int mask_1 = (kcontrol->private_value >> 19) & 63; - int mask_2 = (kcontrol->private_value >> 25) & 63; - int mask; - - mask = (mask_2 + 1) * (mask_1 + 1) - 1; - uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 1; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = mask; - return 0; -} - -static int snd_uda1341_get_2regs(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct l3_client *clnt = snd_kcontrol_chip(kcontrol); - struct uda1341 *uda = clnt->driver_data; - int where = kcontrol->private_value & 31; - int mask_1 = (kcontrol->private_value >> 19) & 63; - int mask_2 = (kcontrol->private_value >> 25) & 63; - int invert = (kcontrol->private_value >> 31) & 1; - int mask; - - mask = (mask_2 + 1) * (mask_1 + 1) - 1; - - ucontrol->value.integer.value[0] = uda->cfg[where]; - if (invert) - ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; - return 0; -} - -static int snd_uda1341_put_2regs(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct l3_client *clnt = snd_kcontrol_chip(kcontrol); - struct uda1341 *uda = clnt->driver_data; - int where = kcontrol->private_value & 31; - int reg_1 = (kcontrol->private_value >> 5) & 15; - int reg_2 = (kcontrol->private_value >> 9) & 15; - int shift_1 = (kcontrol->private_value >> 13) & 7; - int shift_2 = (kcontrol->private_value >> 16) & 7; - int mask_1 = (kcontrol->private_value >> 19) & 63; - int mask_2 = (kcontrol->private_value >> 25) & 63; - int invert = (kcontrol->private_value >> 31) & 1; - int mask; - unsigned short val1, val2, val; - - val = ucontrol->value.integer.value[0]; - - mask = (mask_2 + 1) * (mask_1 + 1) - 1; - - val1 = val & mask_1; - val2 = (val / (mask_1 + 1)) & mask_2; - - if (invert) { - val1 = mask_1 - val1; - val2 = mask_2 - val2; - } - - uda->cfg[where] = invert ? mask - val : val; - - //FIXME - return value - snd_uda1341_update_bits(clnt, reg_1, mask_1, shift_1, val1, FLUSH); - return snd_uda1341_update_bits(clnt, reg_2, mask_2, shift_2, val2, FLUSH); -} - -/* }}} */ - -static struct snd_kcontrol_new snd_uda1341_controls[] = { - UDA1341_SINGLE("Master Playback Switch", CMD_MUTE, data0_2, 2, 1, 1), - UDA1341_SINGLE("Master Playback Volume", CMD_VOLUME, data0_0, 0, 63, 1), - - UDA1341_SINGLE("Bass Playback Volume", CMD_BASS, data0_1, 2, 15, 0), - UDA1341_SINGLE("Treble Playback Volume", CMD_TREBBLE, data0_1, 0, 3, 0), - - UDA1341_SINGLE("Input Gain Switch", CMD_IGAIN, stat1, 5, 1, 0), - UDA1341_SINGLE("Output Gain Switch", CMD_OGAIN, stat1, 6, 1, 0), - - UDA1341_SINGLE("Mixer Gain Channel 1 Volume", CMD_CH1, ext0, 0, 31, 1), - UDA1341_SINGLE("Mixer Gain Channel 2 Volume", CMD_CH2, ext1, 0, 31, 1), - - UDA1341_SINGLE("Mic Sensitivity Volume", CMD_MIC, ext2, 2, 7, 0), - - UDA1341_SINGLE("AGC Output Level", CMD_AGC_LEVEL, ext6, 0, 3, 0), - UDA1341_SINGLE("AGC Time Constant", CMD_AGC_TIME, ext6, 2, 7, 0), - UDA1341_SINGLE("AGC Time Constant Switch", CMD_AGC, ext4, 4, 1, 0), - - UDA1341_SINGLE("DAC Power", CMD_DAC, stat1, 0, 1, 0), - UDA1341_SINGLE("ADC Power", CMD_ADC, stat1, 1, 1, 0), - - UDA1341_ENUM("Peak detection", CMD_PEAK, data0_2, 5, 1, 0), - UDA1341_ENUM("De-emphasis", CMD_DEEMP, data0_2, 3, 3, 0), - UDA1341_ENUM("Mixer mode", CMD_MIXER, ext2, 0, 3, 0), - UDA1341_ENUM("Filter mode", CMD_FILTER, data0_2, 0, 3, 0), - - UDA1341_2REGS("Gain Input Amplifier Gain (channel 2)", CMD_IG, ext4, ext5, 0, 0, 3, 31, 0), -}; - -static void uda1341_free(struct l3_client *clnt) -{ - l3_detach_client(clnt); // calls kfree for driver_data (struct uda1341) - kfree(clnt); -} - -static int uda1341_dev_free(struct snd_device *device) -{ - struct l3_client *clnt = device->device_data; - uda1341_free(clnt); - return 0; -} - -int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clntp) -{ - static struct snd_device_ops ops = { - .dev_free = uda1341_dev_free, - }; - struct l3_client *clnt; - int idx, err; - - if (snd_BUG_ON(!card)) - return -EINVAL; - - clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); - if (clnt == NULL) - return -ENOMEM; - - if ((err = l3_attach_client(clnt, "l3-bit-sa1100-gpio", UDA1341_ALSA_NAME))) { - kfree(clnt); - return err; - } - - for (idx = 0; idx < ARRAY_SIZE(snd_uda1341_controls); idx++) { - if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1341_controls[idx], clnt))) < 0) { - uda1341_free(clnt); - return err; - } - } - - if ((err = snd_device_new(card, SNDRV_DEV_CODEC, clnt, &ops)) < 0) { - uda1341_free(clnt); - return err; - } - - *clntp = clnt; - strcpy(card->mixername, "UDA1341TS Mixer"); - ((struct uda1341 *)clnt->driver_data)->card = card; - - snd_uda1341_proc_init(card, clnt); - - return 0; -} - -/* }}} */ - -/* {{{ L3 operations */ - -static int uda1341_attach(struct l3_client *clnt) -{ - struct uda1341 *uda; - - uda = kzalloc(sizeof(*uda), 0, GFP_KERNEL); - if (!uda) - return -ENOMEM; - - /* init fixed parts of my copy of registers */ - uda->regs[stat0] = STAT0; - uda->regs[stat1] = STAT1; - - uda->regs[data0_0] = DATA0_0; - uda->regs[data0_1] = DATA0_1; - uda->regs[data0_2] = DATA0_2; - - uda->write = snd_uda1341_codec_write; - uda->read = snd_uda1341_codec_read; - - spin_lock_init(&uda->reg_lock); - - clnt->driver_data = uda; - return 0; -} - -static void uda1341_detach(struct l3_client *clnt) -{ - kfree(clnt->driver_data); -} - -static int -uda1341_command(struct l3_client *clnt, int cmd, void *arg) -{ - if (cmd != CMD_READ_REG) - return snd_uda1341_cfg_write(clnt, cmd, (int) arg, FLUSH); - - return snd_uda1341_codec_read(clnt, (int) arg); -} - -static int uda1341_open(struct l3_client *clnt) -{ - struct uda1341 *uda = clnt->driver_data; - - uda->active = 1; - - /* init default configuration */ - snd_uda1341_cfg_write(clnt, CMD_RESET, 0, REGS_ONLY); - snd_uda1341_cfg_write(clnt, CMD_FS, F256, FLUSH); // unknown state after reset - snd_uda1341_cfg_write(clnt, CMD_FORMAT, LSB16, FLUSH); // unknown state after reset - snd_uda1341_cfg_write(clnt, CMD_OGAIN, ON, FLUSH); // default off after reset - snd_uda1341_cfg_write(clnt, CMD_IGAIN, ON, FLUSH); // default off after reset - snd_uda1341_cfg_write(clnt, CMD_DAC, ON, FLUSH); // ??? default value after reset - snd_uda1341_cfg_write(clnt, CMD_ADC, ON, FLUSH); // ??? default value after reset - snd_uda1341_cfg_write(clnt, CMD_VOLUME, 20, FLUSH); // default 0dB after reset - snd_uda1341_cfg_write(clnt, CMD_BASS, 0, REGS_ONLY); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_TREBBLE, 0, REGS_ONLY); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_PEAK, AFTER, REGS_ONLY);// default value after reset - snd_uda1341_cfg_write(clnt, CMD_DEEMP, NONE, REGS_ONLY);// default value after reset - //at this moment should be QMUTED by h3600_audio_init - snd_uda1341_cfg_write(clnt, CMD_MUTE, OFF, REGS_ONLY); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_FILTER, MAX, FLUSH); // defaul flat after reset - snd_uda1341_cfg_write(clnt, CMD_CH1, 31, FLUSH); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_CH2, 4, FLUSH); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_MIC, 4, FLUSH); // default 0dB after reset - snd_uda1341_cfg_write(clnt, CMD_MIXER, MIXER, FLUSH); // default doub.dif.mode - snd_uda1341_cfg_write(clnt, CMD_AGC, OFF, FLUSH); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_IG, 0, FLUSH); // unknown state after reset - snd_uda1341_cfg_write(clnt, CMD_AGC_TIME, 0, FLUSH); // default value after reset - snd_uda1341_cfg_write(clnt, CMD_AGC_LEVEL, 0, FLUSH); // default value after reset - - return 0; -} - -static void uda1341_close(struct l3_client *clnt) -{ - struct uda1341 *uda = clnt->driver_data; - - uda->active = 0; -} - -/* }}} */ - -/* {{{ Module and L3 initialization */ - -static struct l3_ops uda1341_ops = { - .open = uda1341_open, - .command = uda1341_command, - .close = uda1341_close, -}; - -static struct l3_driver uda1341_driver = { - .name = UDA1341_ALSA_NAME, - .attach_client = uda1341_attach, - .detach_client = uda1341_detach, - .ops = &uda1341_ops, - .owner = THIS_MODULE, -}; - -static int __init uda1341_init(void) -{ - return l3_add_driver(&uda1341_driver); -} - -static void __exit uda1341_exit(void) -{ - l3_del_driver(&uda1341_driver); -} - -module_init(uda1341_init); -module_exit(uda1341_exit); - -MODULE_AUTHOR("Tomas Kasparek "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Philips UDA1341 CODEC driver for ALSA"); -MODULE_SUPPORTED_DEVICE("{{UDA1341,UDA1341TS}}"); - -EXPORT_SYMBOL(snd_chip_uda1341_mixer_new); - -/* }}} */ - -/* - * Local variables: - * indent-tabs-mode: t - * End: - */ -- cgit v1.2.3 From 09240cf429505891d6123ce14a29f58f2a60121e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Mar 2009 07:47:18 +0100 Subject: ALSA: hda - Fix DMA mask for ATI controllers ATI controllers (at least some SB0600 models) appear buggy to handle 64bit DMA. As a workaround, reset GCAP bit0 and let the driver to use only 32bit DMA on these controllers. Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 5e909e0da04b..643f0e499292 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2210,9 +2210,17 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, gcap = azx_readw(chip, GCAP); snd_printdd("chipset global capabilities = 0x%x\n", gcap); + /* ATI chips seems buggy about 64bit DMA addresses */ + if (chip->driver_type == AZX_DRIVER_ATI) + gcap &= ~0x01; + /* allow 64bit DMA address if supported by H/W */ if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); + else { + pci_set_dma_mask(pci, DMA_32BIT_MASK); + pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK); + } /* read number of streams from GCAP register instead of using * hardcoded value -- cgit v1.2.3 From c673ba1c23941173c16ff24c7cb34199e826c8b5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Mar 2009 07:49:14 +0100 Subject: ALSA: hda - Workaround for buggy DMA position on ATI controllers The position-buffer on ATI controllers are unreliable as well as on VIA chips, thus the same workaround for DMA position reading as VIA is useful for ATI. Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 643f0e499292..f3b5723c2859 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2059,26 +2059,31 @@ static int __devinit check_position_fix(struct azx *chip, int fix) { const struct snd_pci_quirk *q; - /* Check VIA HD Audio Controller exist */ - if (chip->pci->vendor == PCI_VENDOR_ID_VIA && - chip->pci->device == VIA_HDAC_DEVICE_ID) { + switch (fix) { + case POS_FIX_LPIB: + case POS_FIX_POSBUF: + return fix; + } + + /* Check VIA/ATI HD Audio Controller exist */ + switch (chip->driver_type) { + case AZX_DRIVER_VIA: + case AZX_DRIVER_ATI: chip->via_dmapos_patch = 1; /* Use link position directly, avoid any transfer problem. */ return POS_FIX_LPIB; } chip->via_dmapos_patch = 0; - if (fix == POS_FIX_AUTO) { - q = snd_pci_quirk_lookup(chip->pci, position_fix_list); - if (q) { - printk(KERN_INFO - "hda_intel: position_fix set to %d " - "for device %04x:%04x\n", - q->value, q->subvendor, q->subdevice); - return q->value; - } + q = snd_pci_quirk_lookup(chip->pci, position_fix_list); + if (q) { + printk(KERN_INFO + "hda_intel: position_fix set to %d " + "for device %04x:%04x\n", + q->value, q->subvendor, q->subdevice); + return q->value; } - return fix; + return POS_FIX_AUTO; } /* -- cgit v1.2.3 From ee5047102cf632351c418060bfbe3b6eb5c42e7b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 17 Mar 2009 14:30:31 +0100 Subject: ALSA: snd-hda-intel - add checks for invalid values to *query_supported_pcm() If ratesp or formatsp values are zero, wrong values are passed to ALSA's the PCM midlevel code. The bug is showed more later than expected. Also, clean a bit the code. Signed-off-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index cf6339436de1..b90a2400f53d 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2539,12 +2539,11 @@ EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format); static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, u32 *ratesp, u64 *formatsp, unsigned int *bpsp) { - int i; - unsigned int val, streams; + unsigned int i, val, wcaps; val = 0; - if (nid != codec->afg && - (get_wcaps(codec, nid) & AC_WCAP_FORMAT_OVRD)) { + wcaps = get_wcaps(codec, nid); + if (nid != codec->afg && (wcaps & AC_WCAP_FORMAT_OVRD)) { val = snd_hda_param_read(codec, nid, AC_PAR_PCM); if (val == -1) return -EIO; @@ -2558,15 +2557,20 @@ static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, if (val & (1 << i)) rates |= rate_bits[i].alsa_bits; } + if (rates == 0) { + snd_printk(KERN_ERR "hda_codec: rates == 0 " + "(nid=0x%x, val=0x%x, ovrd=%i)\n", + nid, val, + (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0); + return -EIO; + } *ratesp = rates; } if (formatsp || bpsp) { u64 formats = 0; - unsigned int bps; - unsigned int wcaps; + unsigned int streams, bps; - wcaps = get_wcaps(codec, nid); streams = snd_hda_param_read(codec, nid, AC_PAR_STREAM); if (streams == -1) return -EIO; @@ -2619,6 +2623,15 @@ static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, formats |= SNDRV_PCM_FMTBIT_U8; bps = 8; } + if (formats == 0) { + snd_printk(KERN_ERR "hda_codec: formats == 0 " + "(nid=0x%x, val=0x%x, ovrd=%i, " + "streams=0x%x)\n", + nid, val, + (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0, + streams); + return -EIO; + } if (formatsp) *formatsp = formats; if (bpsp) @@ -2734,12 +2747,16 @@ static int hda_pcm_default_cleanup(struct hda_pcm_stream *hinfo, static int set_pcm_default_values(struct hda_codec *codec, struct hda_pcm_stream *info) { + int err; + /* query support PCM information from the given NID */ if (info->nid && (!info->rates || !info->formats)) { - snd_hda_query_supported_pcm(codec, info->nid, + err = snd_hda_query_supported_pcm(codec, info->nid, info->rates ? NULL : &info->rates, info->formats ? NULL : &info->formats, info->maxbps ? NULL : &info->maxbps); + if (err < 0) + return err; } if (info->ops.open == NULL) info->ops.open = hda_pcm_default_open_close; -- cgit v1.2.3 From 36c7b833e5d2501142a371e4e75281d3a29fbd6b Mon Sep 17 00:00:00 2001 From: Viral Mehta Date: Tue, 10 Mar 2009 15:43:18 +0100 Subject: ALSA: oss-mixer - Fixes recording gain control At the time of initialization, SNDRV_MIXER_OSS_PRESENT_PVOLUME bit is not set for MIC (slot 7). So, the same should not be checked when an application tries to do gain control for audio recording devices. Just check slot->present for SNDRV_MIXER_OSS_PRESENT_CVOLUME independently. Verified with a simple application which opens /dev/dsp for recording and /dev/mixer for volume control. Have tested two usb audio mic devices. Signed-off-by: Viral Mehta Signed-off-by: Takashi Iwai --- sound/core/oss/mixer_oss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 4690b8b5681f..e570649184e2 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -692,6 +692,9 @@ static int snd_mixer_oss_put_volume1(struct snd_mixer_oss_file *fmixer, snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right); if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); + } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) { + snd_mixer_oss_put_volume1_vol(fmixer, pslot, + slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) { snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right); } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) { -- cgit v1.2.3 From 91054598f794fb5d8a0b1e747ff8e2e8fc2115b3 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 11 Mar 2009 20:11:40 +0100 Subject: ALSA: pcm_oss, fix locking typo s/mutex_lock/mutex_unlock/ on 2 fail paths in snd_pcm_oss_proc_write. Probably a typo, lock should be unlocked when leaving the function. Signed-off-by: Jiri Slaby Cc: Signed-off-by: Takashi Iwai --- sound/core/oss/pcm_oss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 0a1798eafb0b..699d2890535c 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2872,7 +2872,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, setup = kmalloc(sizeof(*setup), GFP_KERNEL); if (! setup) { buffer->error = -ENOMEM; - mutex_lock(&pstr->oss.setup_mutex); + mutex_unlock(&pstr->oss.setup_mutex); return; } if (pstr->oss.setup_list == NULL) @@ -2886,7 +2886,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, if (! template.task_name) { kfree(setup); buffer->error = -ENOMEM; - mutex_lock(&pstr->oss.setup_mutex); + mutex_unlock(&pstr->oss.setup_mutex); return; } } -- cgit v1.2.3 From 82f5d57163abed2e5ff271d03217b6f90c616eb8 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 11 Mar 2009 20:11:41 +0100 Subject: ALSA: mixart, fix lock imbalance There is an omitted unlock in one snd_mixart_hw_params fail path. Fix it. Signed-off-by: Jiri Slaby Cc: Signed-off-by: Takashi Iwai --- sound/pci/mixart/mixart.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index f23a73577c22..bb162507fe6c 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -607,6 +607,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, /* set the format to the board */ err = mixart_set_format(stream, format); if(err < 0) { + mutex_unlock(&mgr->setup_mutex); return err; } -- cgit v1.2.3 From 6af845e4eb36fb91b322aaf77ec1cab2220a48ad Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Mar 2009 14:00:06 +0100 Subject: ALSA: Fix vunmap and free order in snd_free_sgbuf_pages() In snd_free_sgbuf_pags(), vunmap() is called after releasing the SG pages, and it causes errors on Xen as Xen manages the pages differently. Although no significant errors have been reported on the actual hardware, this order should be fixed other way round, first vunmap() then free pages. Cc: Jan Beulich Cc: Signed-off-by: Takashi Iwai --- sound/core/sgbuf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index d4564edd61d7..4e7ec2b49873 100644 --- a/sound/core/sgbuf.c +++ b/sound/core/sgbuf.c @@ -38,6 +38,10 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) if (! sgbuf) return -EINVAL; + if (dmab->area) + vunmap(dmab->area); + dmab->area = NULL; + tmpb.dev.type = SNDRV_DMA_TYPE_DEV; tmpb.dev.dev = sgbuf->dev; for (i = 0; i < sgbuf->pages; i++) { @@ -48,9 +52,6 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT; snd_dma_free_pages(&tmpb); } - if (dmab->area) - vunmap(dmab->area); - dmab->area = NULL; kfree(sgbuf->table); kfree(sgbuf->page_table); -- cgit v1.2.3 From 1313e7041480f523a09dedc7ef2185d8ee94c163 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 18 Mar 2009 11:03:53 +0100 Subject: ALSA: snd-usb-caiaq: only warn once on streaming errors Limit the number of printed warnings to one in case of streaming errors. printk() happens to be expensive, especially in code called as often as here. Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-audio.c | 4 +++- sound/usb/caiaq/caiaq-device.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index fc6d571eeac6..577b1129de0e 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -114,6 +114,7 @@ static int stream_start(struct snd_usb_caiaqdev *dev) dev->output_panic = 0; dev->first_packet = 1; dev->streaming = 1; + dev->warned = 0; for (i = 0; i < N_URBS; i++) { ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); @@ -406,10 +407,11 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, break; } - if (dev->input_panic || dev->output_panic) { + if ((dev->input_panic || dev->output_panic) && !dev->warned) { debug("streaming error detected %s %s\n", dev->input_panic ? "(input)" : "", dev->output_panic ? "(output)" : ""); + dev->warned = 1; } } diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index 0560c327d996..098b194f7259 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -89,7 +89,7 @@ struct snd_usb_caiaqdev { int audio_out_buf_pos[MAX_STREAMS]; int period_in_count[MAX_STREAMS]; int period_out_count[MAX_STREAMS]; - int input_panic, output_panic; + int input_panic, output_panic, warned; char *audio_in_buf, *audio_out_buf; unsigned int samplerates; -- cgit v1.2.3 From 9311c9b4f12218b588e51806c44d290cfec678a3 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 18 Mar 2009 11:03:54 +0100 Subject: ALSA: snd-usb-caiaq: drop bogus iso packets Drop inbound packets that are smaller than expected. This has been observed at the very beginning of the streaming transaction. And when the hardware is in panic mode (which can only very rarely happen in case of massive EMI chaos), mute the input channels. Signed-off-by: Daniel Mack Tested-by: Mark Hills Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-audio.c | 6 ++++++ sound/usb/caiaq/caiaq-device.c | 2 ++ sound/usb/caiaq/caiaq-device.h | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index 577b1129de0e..08d51e0c9fea 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -377,6 +377,9 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, for (stream = 0; stream < dev->n_streams; stream++, i++) { sub = dev->sub_capture[stream]; + if (dev->input_panic) + usb_buf[i] = 0; + if (sub) { struct snd_pcm_runtime *rt = sub->runtime; char *audio_buf = rt->dma_area; @@ -398,6 +401,9 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, if (!dev->streaming) return; + if (iso->actual_length < dev->bpp) + return; + switch (dev->spec.data_alignment) { case 0: read_in_urb_mode0(dev, urb, iso); diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 5736669df2d5..336a93de0b30 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -251,6 +251,8 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, if (dev->audio_parm_answer != 1) debug("unable to set the device's audio params\n"); + else + dev->bpp = bpp; return dev->audio_parm_answer == 1 ? 0 : -EINVAL; } diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index 098b194f7259..4cce1ad7493d 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h @@ -91,7 +91,7 @@ struct snd_usb_caiaqdev { int period_out_count[MAX_STREAMS]; int input_panic, output_panic, warned; char *audio_in_buf, *audio_out_buf; - unsigned int samplerates; + unsigned int samplerates, bpp; struct snd_pcm_substream *sub_playback[MAX_STREAMS]; struct snd_pcm_substream *sub_capture[MAX_STREAMS]; -- cgit v1.2.3 From 28514fe5bbbdbc0f7c9700569378d55cafd061ea Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 18 Mar 2009 11:03:55 +0100 Subject: ALSA: snd-usb-caiaq: bump version number Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 336a93de0b30..771c523b3fcc 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,7 +42,7 @@ #endif MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.12"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," -- cgit v1.2.3 From a2328d0249fce44381289525bd580b37d2105963 Mon Sep 17 00:00:00 2001 From: Giuliano Pochini Date: Thu, 19 Mar 2009 00:09:03 +0100 Subject: ALSA: Echoaudio: add support for Indigo express cards This patch adds support for IndigoIOx and IndigoDJx. Signed-off-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 20 ++++++ sound/pci/echoaudio/Makefile | 4 ++ sound/pci/echoaudio/echoaudio.h | 3 + sound/pci/echoaudio/echoaudio_dsp.h | 9 ++- sound/pci/echoaudio/indigo_express_dsp.c | 119 +++++++++++++++++++++++++++++++ sound/pci/echoaudio/indigodjx.c | 107 +++++++++++++++++++++++++++ sound/pci/echoaudio/indigodjx_dsp.c | 68 ++++++++++++++++++ sound/pci/echoaudio/indigoiox.c | 109 ++++++++++++++++++++++++++++ sound/pci/echoaudio/indigoiox_dsp.c | 68 ++++++++++++++++++ 9 files changed, 505 insertions(+), 2 deletions(-) create mode 100644 sound/pci/echoaudio/indigo_express_dsp.c create mode 100644 sound/pci/echoaudio/indigodjx.c create mode 100644 sound/pci/echoaudio/indigodjx_dsp.c create mode 100644 sound/pci/echoaudio/indigoiox.c create mode 100644 sound/pci/echoaudio/indigoiox_dsp.c (limited to 'sound') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 82b9bddcdcd6..9387ab00a41b 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -400,6 +400,26 @@ config SND_INDIGODJ To compile this driver as a module, choose M here: the module will be called snd-indigodj +config SND_INDIGOIOX + tristate "(Echoaudio) Indigo IOx" + select FW_LOADER + select SND_PCM + help + Say 'Y' or 'M' to include support for Echoaudio Indigo IOx. + + To compile this driver as a module, choose M here: the module + will be called snd-indigoiox + +config SND_INDIGODJX + tristate "(Echoaudio) Indigo DJx" + select FW_LOADER + select SND_PCM + help + Say 'Y' or 'M' to include support for Echoaudio Indigo DJx. + + To compile this driver as a module, choose M here: the module + will be called snd-indigodjx + config SND_EMU10K1 tristate "Emu10k1 (SB Live!, Audigy, E-mu APS)" select FW_LOADER diff --git a/sound/pci/echoaudio/Makefile b/sound/pci/echoaudio/Makefile index 7b576aeb3f8d..1361de77e0cd 100644 --- a/sound/pci/echoaudio/Makefile +++ b/sound/pci/echoaudio/Makefile @@ -15,6 +15,8 @@ snd-echo3g-objs := echo3g.o snd-indigo-objs := indigo.o snd-indigoio-objs := indigoio.o snd-indigodj-objs := indigodj.o +snd-indigoiox-objs := indigoiox.o +snd-indigodjx-objs := indigodjx.o obj-$(CONFIG_SND_DARLA20) += snd-darla20.o obj-$(CONFIG_SND_GINA20) += snd-gina20.o @@ -28,3 +30,5 @@ obj-$(CONFIG_SND_ECHO3G) += snd-echo3g.o obj-$(CONFIG_SND_INDIGO) += snd-indigo.o obj-$(CONFIG_SND_INDIGOIO) += snd-indigoio.o obj-$(CONFIG_SND_INDIGODJ) += snd-indigodj.o +obj-$(CONFIG_SND_INDIGOIOX) += snd-indigoiox.o +obj-$(CONFIG_SND_INDIGODJX) += snd-indigodjx.o diff --git a/sound/pci/echoaudio/echoaudio.h b/sound/pci/echoaudio/echoaudio.h index 1c88e051abf2..f9490ae36c2e 100644 --- a/sound/pci/echoaudio/echoaudio.h +++ b/sound/pci/echoaudio/echoaudio.h @@ -189,6 +189,9 @@ #define INDIGO 0x0090 #define INDIGO_IO 0x00a0 #define INDIGO_DJ 0x00b0 +#define DC8 0x00c0 +#define INDIGO_IOX 0x00d0 +#define INDIGO_DJX 0x00e0 #define ECHO3G 0x0100 diff --git a/sound/pci/echoaudio/echoaudio_dsp.h b/sound/pci/echoaudio/echoaudio_dsp.h index e352f3ae292c..cb7d75a0a503 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.h +++ b/sound/pci/echoaudio/echoaudio_dsp.h @@ -576,8 +576,13 @@ SET_LAYLA24_FREQUENCY_REG command. #define E3G_ASIC_NOT_LOADED 0xffff #define E3G_BOX_TYPE_MASK 0xf0 -#define EXT_3GBOX_NC 0x01 -#define EXT_3GBOX_NOT_SET 0x02 +/* Indigo express control register values */ +#define INDIGO_EXPRESS_32000 0x02 +#define INDIGO_EXPRESS_44100 0x01 +#define INDIGO_EXPRESS_48000 0x00 +#define INDIGO_EXPRESS_DOUBLE_SPEED 0x10 +#define INDIGO_EXPRESS_QUAD_SPEED 0x04 +#define INDIGO_EXPRESS_CLOCK_MASK 0x17 /* diff --git a/sound/pci/echoaudio/indigo_express_dsp.c b/sound/pci/echoaudio/indigo_express_dsp.c new file mode 100644 index 000000000000..9ab625e15652 --- /dev/null +++ b/sound/pci/echoaudio/indigo_express_dsp.c @@ -0,0 +1,119 @@ +/************************************************************************ + +This file is part of Echo Digital Audio's generic driver library. +Copyright Echo Digital Audio Corporation (c) 1998 - 2005 +All rights reserved +www.echoaudio.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +************************************************************************* + + Translation from C++ and adaptation for use in ALSA-Driver + were made by Giuliano Pochini + +*************************************************************************/ + +static int set_sample_rate(struct echoaudio *chip, u32 rate) +{ + u32 clock, control_reg, old_control_reg; + + if (wait_handshake(chip)) + return -EIO; + + old_control_reg = le32_to_cpu(chip->comm_page->control_register); + control_reg = old_control_reg & ~INDIGO_EXPRESS_CLOCK_MASK; + + switch (rate) { + case 32000: + clock = INDIGO_EXPRESS_32000; + break; + case 44100: + clock = INDIGO_EXPRESS_44100; + break; + case 48000: + clock = INDIGO_EXPRESS_48000; + break; + case 64000: + clock = INDIGO_EXPRESS_32000|INDIGO_EXPRESS_DOUBLE_SPEED; + break; + case 88200: + clock = INDIGO_EXPRESS_44100|INDIGO_EXPRESS_DOUBLE_SPEED; + break; + case 96000: + clock = INDIGO_EXPRESS_48000|INDIGO_EXPRESS_DOUBLE_SPEED; + break; + default: + return -EINVAL; + } + + control_reg |= clock; + if (control_reg != old_control_reg) { + chip->comm_page->control_register = cpu_to_le32(control_reg); + chip->sample_rate = rate; + clear_handshake(chip); + return send_vector(chip, DSP_VC_UPDATE_CLOCKS); + } + return 0; +} + + + +/* This function routes the sound from a virtual channel to a real output */ +static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe, + int gain) +{ + int index; + + if (snd_BUG_ON(pipe >= num_pipes_out(chip) || + output >= num_busses_out(chip))) + return -EINVAL; + + if (wait_handshake(chip)) + return -EIO; + + chip->vmixer_gain[output][pipe] = gain; + index = output * num_pipes_out(chip) + pipe; + chip->comm_page->vmixer[index] = gain; + + DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain)); + return 0; +} + + + +/* Tell the DSP to read and update virtual mixer levels in comm page. */ +static int update_vmixer_level(struct echoaudio *chip) +{ + if (wait_handshake(chip)) + return -EIO; + clear_handshake(chip); + return send_vector(chip, DSP_VC_SET_VMIXER_GAIN); +} + + + +static u32 detect_input_clocks(const struct echoaudio *chip) +{ + return ECHO_CLOCK_BIT_INTERNAL; +} + + + +/* The IndigoIO has no ASIC. Just do nothing */ +static int load_asic(struct echoaudio *chip) +{ + return 0; +} diff --git a/sound/pci/echoaudio/indigodjx.c b/sound/pci/echoaudio/indigodjx.c new file mode 100644 index 000000000000..3482ef69f491 --- /dev/null +++ b/sound/pci/echoaudio/indigodjx.c @@ -0,0 +1,107 @@ +/* + * ALSA driver for Echoaudio soundcards. + * Copyright (C) 2009 Giuliano Pochini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define INDIGO_FAMILY +#define ECHOCARD_INDIGO_DJX +#define ECHOCARD_NAME "Indigo DJx" +#define ECHOCARD_HAS_SUPER_INTERLEAVE +#define ECHOCARD_HAS_VMIXER +#define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 + +/* Pipe indexes */ +#define PX_ANALOG_OUT 0 /* 8 */ +#define PX_DIGITAL_OUT 8 /* 0 */ +#define PX_ANALOG_IN 8 /* 0 */ +#define PX_DIGITAL_IN 8 /* 0 */ +#define PX_NUM 8 + +/* Bus indexes */ +#define BX_ANALOG_OUT 0 /* 4 */ +#define BX_DIGITAL_OUT 4 /* 0 */ +#define BX_ANALOG_IN 4 /* 0 */ +#define BX_DIGITAL_IN 4 /* 0 */ +#define BX_NUM 4 + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "echoaudio.h" + +MODULE_FIRMWARE("ea/loader_dsp.fw"); +MODULE_FIRMWARE("ea/indigo_djx_dsp.fw"); + +#define FW_361_LOADER 0 +#define FW_INDIGO_DJX_DSP 1 + +static const struct firmware card_fw[] = { + {0, "loader_dsp.fw"}, + {0, "indigo_djx_dsp.fw"} +}; + +static struct pci_device_id snd_echo_ids[] = { + {0x1057, 0x3410, 0xECC0, 0x00E0, 0, 0, 0}, /* Indigo DJx*/ + {0,} +}; + +static struct snd_pcm_hardware pcm_hardware_skel = { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_SYNC_START, + .formats = SNDRV_PCM_FMTBIT_U8 | + SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_3LE | + SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S32_BE, + .rates = SNDRV_PCM_RATE_32000 | + SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000, + .rate_min = 32000, + .rate_max = 96000, + .channels_min = 1, + .channels_max = 4, + .buffer_bytes_max = 262144, + .period_bytes_min = 32, + .period_bytes_max = 131072, + .periods_min = 2, + .periods_max = 220, +}; + +#include "indigodjx_dsp.c" +#include "indigo_express_dsp.c" +#include "echoaudio_dsp.c" +#include "echoaudio.c" diff --git a/sound/pci/echoaudio/indigodjx_dsp.c b/sound/pci/echoaudio/indigodjx_dsp.c new file mode 100644 index 000000000000..f591fc2ed960 --- /dev/null +++ b/sound/pci/echoaudio/indigodjx_dsp.c @@ -0,0 +1,68 @@ +/************************************************************************ + +This file is part of Echo Digital Audio's generic driver library. +Copyright Echo Digital Audio Corporation (c) 1998 - 2005 +All rights reserved +www.echoaudio.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +************************************************************************* + + Translation from C++ and adaptation for use in ALSA-Driver + were made by Giuliano Pochini + +*************************************************************************/ + +static int update_vmixer_level(struct echoaudio *chip); +static int set_vmixer_gain(struct echoaudio *chip, u16 output, + u16 pipe, int gain); + + +static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) +{ + int err; + + DE_INIT(("init_hw() - Indigo DJx\n")); + if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_DJX)) + return -ENODEV; + + err = init_dsp_comm_page(chip); + if (err < 0) { + DE_INIT(("init_hw - could not initialize DSP comm page\n")); + return err; + } + + chip->device_id = device_id; + chip->subdevice_id = subdevice_id; + chip->bad_board = TRUE; + chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJX_DSP]; + /* Since this card has no ASIC, mark it as loaded so everything + works OK */ + chip->asic_loaded = TRUE; + chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; + + err = load_firmware(chip); + if (err < 0) + return err; + chip->bad_board = FALSE; + + err = init_line_levels(chip); + if (err < 0) + return err; + + DE_INIT(("init_hw done\n")); + return err; +} diff --git a/sound/pci/echoaudio/indigoiox.c b/sound/pci/echoaudio/indigoiox.c new file mode 100644 index 000000000000..aebee27a40ff --- /dev/null +++ b/sound/pci/echoaudio/indigoiox.c @@ -0,0 +1,109 @@ +/* + * ALSA driver for Echoaudio soundcards. + * Copyright (C) 2009 Giuliano Pochini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define INDIGO_FAMILY +#define ECHOCARD_INDIGO_IOX +#define ECHOCARD_NAME "Indigo IOx" +#define ECHOCARD_HAS_MONITOR +#define ECHOCARD_HAS_SUPER_INTERLEAVE +#define ECHOCARD_HAS_VMIXER +#define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 + +/* Pipe indexes */ +#define PX_ANALOG_OUT 0 /* 8 */ +#define PX_DIGITAL_OUT 8 /* 0 */ +#define PX_ANALOG_IN 8 /* 2 */ +#define PX_DIGITAL_IN 10 /* 0 */ +#define PX_NUM 10 + +/* Bus indexes */ +#define BX_ANALOG_OUT 0 /* 2 */ +#define BX_DIGITAL_OUT 2 /* 0 */ +#define BX_ANALOG_IN 2 /* 2 */ +#define BX_DIGITAL_IN 4 /* 0 */ +#define BX_NUM 4 + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "echoaudio.h" + +MODULE_FIRMWARE("ea/loader_dsp.fw"); +MODULE_FIRMWARE("ea/indigo_iox_dsp.fw"); + +#define FW_361_LOADER 0 +#define FW_INDIGO_IOX_DSP 1 + +static const struct firmware card_fw[] = { + {0, "loader_dsp.fw"}, + {0, "indigo_iox_dsp.fw"} +}; + +static struct pci_device_id snd_echo_ids[] = { + {0x1057, 0x3410, 0xECC0, 0x00D0, 0, 0, 0}, /* Indigo IOx */ + {0,} +}; + +static struct snd_pcm_hardware pcm_hardware_skel = { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_SYNC_START, + .formats = SNDRV_PCM_FMTBIT_U8 | + SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_3LE | + SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S32_BE, + .rates = SNDRV_PCM_RATE_32000 | + SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000, + .rate_min = 32000, + .rate_max = 96000, + .channels_min = 1, + .channels_max = 8, + .buffer_bytes_max = 262144, + .period_bytes_min = 32, + .period_bytes_max = 131072, + .periods_min = 2, + .periods_max = 220, +}; + +#include "indigoiox_dsp.c" +#include "indigo_express_dsp.c" +#include "echoaudio_dsp.c" +#include "echoaudio.c" + diff --git a/sound/pci/echoaudio/indigoiox_dsp.c b/sound/pci/echoaudio/indigoiox_dsp.c new file mode 100644 index 000000000000..f357521c79e6 --- /dev/null +++ b/sound/pci/echoaudio/indigoiox_dsp.c @@ -0,0 +1,68 @@ +/************************************************************************ + +This file is part of Echo Digital Audio's generic driver library. +Copyright Echo Digital Audio Corporation (c) 1998 - 2005 +All rights reserved +www.echoaudio.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +************************************************************************* + + Translation from C++ and adaptation for use in ALSA-Driver + were made by Giuliano Pochini + +*************************************************************************/ + +static int update_vmixer_level(struct echoaudio *chip); +static int set_vmixer_gain(struct echoaudio *chip, u16 output, + u16 pipe, int gain); + + +static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) +{ + int err; + + DE_INIT(("init_hw() - Indigo IOx\n")); + if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IOX)) + return -ENODEV; + + err = init_dsp_comm_page(chip); + if (err < 0) { + DE_INIT(("init_hw - could not initialize DSP comm page\n")); + return err; + } + + chip->device_id = device_id; + chip->subdevice_id = subdevice_id; + chip->bad_board = TRUE; + chip->dsp_code_to_load = &card_fw[FW_INDIGO_IOX_DSP]; + /* Since this card has no ASIC, mark it as loaded so everything + works OK */ + chip->asic_loaded = TRUE; + chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; + + err = load_firmware(chip); + if (err < 0) + return err; + chip->bad_board = FALSE; + + err = init_line_levels(chip); + if (err < 0) + return err; + + DE_INIT(("init_hw done\n")); + return err; +} -- cgit v1.2.3 From cad377acf3d6af6279622048e96680e79e352183 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Mar 2009 09:55:15 +0100 Subject: ALSA: pcm - Fix a typo in error messages Fix a typo in error messages; forgotten after a copy&paste error. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 86ac9ae9460e..2ff25ed4d834 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -194,7 +194,7 @@ static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream do { \ if (xrun_debug(substream)) { \ if (printk_ratelimit()) { \ - snd_printd("hda_codec: " fmt, ##args); \ + snd_printd("PCM: " fmt, ##args); \ } \ dump_stack_on_xrun(substream); \ } \ -- cgit v1.2.3 From 98204646f2b15d368701265e4194b773a6f94600 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Mar 2009 09:59:21 +0100 Subject: ALSA: pcm - avoid unnecessary inline Remove unnecessary explicit inlininig of internal functions. Let compiler optimize. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 2ff25ed4d834..302654769faf 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -148,8 +148,9 @@ static void xrun(struct snd_pcm_substream *substream) } } -static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, - struct snd_pcm_runtime *runtime) +static snd_pcm_uframes_t +snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, + struct snd_pcm_runtime *runtime) { snd_pcm_uframes_t pos; @@ -167,8 +168,8 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substre return pos; } -static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream, - struct snd_pcm_runtime *runtime) +static int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream, + struct snd_pcm_runtime *runtime) { snd_pcm_uframes_t avail; @@ -200,7 +201,7 @@ static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream } \ } while (0) -static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) +static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_uframes_t pos; -- cgit v1.2.3 From 5f513e1197f27e9a0bcfec0feaac59f976f4a37e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Mar 2009 10:01:47 +0100 Subject: ALSA: pcm - Reset invalid position even without debug option Always reset the invalind hw_ptr position returned by the pointer callback. The behavior should be consitent independently from the debug option. Also, add the printk_ratelimit() check to avoid flooding debug prints. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 302654769faf..92ed6d819225 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -159,11 +159,15 @@ snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, pos = substream->ops->pointer(substream); if (pos == SNDRV_PCM_POS_XRUN) return pos; /* XRUN */ -#ifdef CONFIG_SND_DEBUG if (pos >= runtime->buffer_size) { - snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); + if (printk_ratelimit()) { + snd_printd(KERN_ERR "BUG: stream = %i, pos = 0x%lx, " + "buffer size = 0x%lx, period size = 0x%lx\n", + substream->stream, pos, runtime->buffer_size, + runtime->period_size); + } + pos = 0; } -#endif pos -= pos % runtime->min_align; return pos; } -- cgit v1.2.3 From ded652f7024bc2d7b6118b561a44187af30841b0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Mar 2009 10:08:49 +0100 Subject: ALSA: pcm - Fix delta calculation at boundary overlap When the hw_ptr_interrupt reaches the boundary, it must check whether the hw_base was already lapped and corret the delta value appropriately. Also, rebasing the hw_ptr needs a correction because buffer_size isn't always aligned to period_size. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 92ed6d819225..063c675177a9 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -221,8 +221,11 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) new_hw_ptr = hw_base + pos; hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; delta = new_hw_ptr - hw_ptr_interrupt; - if (hw_ptr_interrupt == runtime->boundary) - hw_ptr_interrupt = 0; + if (hw_ptr_interrupt >= runtime->boundary) { + hw_ptr_interrupt %= runtime->boundary; + if (!hw_base) /* hw_base was already lapped; recalc delta */ + delta = new_hw_ptr - hw_ptr_interrupt; + } if (delta < 0) { delta += runtime->buffer_size; if (delta < 0) { @@ -233,6 +236,8 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) (long)hw_ptr_interrupt); /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt; + /* align hw_base to buffer_size */ + hw_base -= hw_base % runtime->buffer_size; delta = 0; } else { hw_base += runtime->buffer_size; -- cgit v1.2.3 From 97b71c94d691728b82052e9c4d6286fbc9965d7f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 18 Mar 2009 15:09:13 +0100 Subject: ALSA: hda - Don't reset BDL unnecessarily So far, the prepare callback is called multiple times, BDL entries are reset and re-programmed at each time. This patch adds the check to avoid the reset of BDL entries when the same parameters are used. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 6bcf5af6edce..ba97795d89c4 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1076,8 +1076,7 @@ static int azx_setup_periods(struct azx *chip, azx_sd_writel(azx_dev, SD_BDLPL, 0); azx_sd_writel(azx_dev, SD_BDLPU, 0); - period_bytes = snd_pcm_lib_period_bytes(substream); - azx_dev->period_bytes = period_bytes; + period_bytes = azx_dev->period_bytes; periods = azx_dev->bufsize / period_bytes; /* program the initial BDL entries */ @@ -1124,9 +1123,6 @@ static int azx_setup_periods(struct azx *chip, error: snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", azx_dev->bufsize, period_bytes); - /* reset */ - azx_sd_writel(azx_dev, SD_BDLPL, 0); - azx_sd_writel(azx_dev, SD_BDLPU, 0); return -EINVAL; } @@ -1429,6 +1425,11 @@ static int azx_pcm_close(struct snd_pcm_substream *substream) static int azx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { + struct azx_dev *azx_dev = get_azx_dev(substream); + + azx_dev->bufsize = 0; + azx_dev->period_bytes = 0; + azx_dev->format_val = 0; return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } @@ -1443,6 +1444,9 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) azx_sd_writel(azx_dev, SD_BDLPL, 0); azx_sd_writel(azx_dev, SD_BDLPU, 0); azx_sd_writel(azx_dev, SD_CTL, 0); + azx_dev->bufsize = 0; + azx_dev->period_bytes = 0; + azx_dev->format_val = 0; hinfo->ops.cleanup(hinfo, apcm->codec, substream); @@ -1456,23 +1460,37 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) struct azx_dev *azx_dev = get_azx_dev(substream); struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; struct snd_pcm_runtime *runtime = substream->runtime; + unsigned int bufsize, period_bytes, format_val; + int err; - azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); - azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, - runtime->channels, - runtime->format, - hinfo->maxbps); - if (!azx_dev->format_val) { + format_val = snd_hda_calc_stream_format(runtime->rate, + runtime->channels, + runtime->format, + hinfo->maxbps); + if (!format_val) { snd_printk(KERN_ERR SFX "invalid format_val, rate=%d, ch=%d, format=%d\n", runtime->rate, runtime->channels, runtime->format); return -EINVAL; } + bufsize = snd_pcm_lib_buffer_bytes(substream); + period_bytes = snd_pcm_lib_period_bytes(substream); + snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", - azx_dev->bufsize, azx_dev->format_val); - if (azx_setup_periods(chip, substream, azx_dev) < 0) - return -EINVAL; + bufsize, format_val); + + if (bufsize != azx_dev->bufsize || + period_bytes != azx_dev->period_bytes || + format_val != azx_dev->format_val) { + azx_dev->bufsize = bufsize; + azx_dev->period_bytes = period_bytes; + azx_dev->format_val = format_val; + err = azx_setup_periods(chip, substream, azx_dev); + if (err < 0) + return err; + } + azx_setup_controller(chip, azx_dev); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; -- cgit v1.2.3 From 1dddab400b7ad028b21d7d5b060e4a068d6d3cd9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 18 Mar 2009 15:15:37 +0100 Subject: ALSA: hda - Don't reset stream at each prepare callback Don't reset the stream at each prepare callback but do it only once after the open. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index ba97795d89c4..8b2e4160de8d 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -859,13 +859,18 @@ static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev) SD_CTL_DMA_START | SD_INT_MASK); } -/* stop a stream */ -static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) +/* stop DMA */ +static void azx_stream_clear(struct azx *chip, struct azx_dev *azx_dev) { - /* stop DMA */ azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & ~(SD_CTL_DMA_START | SD_INT_MASK)); azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ +} + +/* stop a stream */ +static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) +{ + azx_stream_clear(chip, azx_dev); /* disable SIE */ azx_writeb(chip, INTCTL, azx_readb(chip, INTCTL) & ~(1 << azx_dev->index)); @@ -1126,18 +1131,14 @@ static int azx_setup_periods(struct azx *chip, return -EINVAL; } -/* - * set up the SD for streaming - */ -static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) +/* reset stream */ +static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev) { unsigned char val; int timeout; - /* make sure the run bit is zero for SD */ - azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & - ~SD_CTL_DMA_START); - /* reset stream */ + azx_stream_clear(chip, azx_dev); + azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) | SD_CTL_STREAM_RESET); udelay(3); @@ -1154,7 +1155,15 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) while (((val = azx_sd_readb(azx_dev, SD_CTL)) & SD_CTL_STREAM_RESET) && --timeout) ; +} +/* + * set up the SD for streaming + */ +static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) +{ + /* make sure the run bit is zero for SD */ + azx_stream_clear(chip, azx_dev); /* program the stream_tag */ azx_sd_writel(azx_dev, SD_CTL, (azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)| @@ -1399,6 +1408,8 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) runtime->private_data = azx_dev; snd_pcm_set_sync(substream); mutex_unlock(&chip->open_mutex); + + azx_stream_reset(chip, azx_dev); return 0; } -- cgit v1.2.3 From 07a1e81355245ca65ab16c7b4ae2332e52ed7acd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Mar 2009 17:08:19 +0100 Subject: ALSA: hda - Don't show the current connection for power widgets The power-widgets have no connection selection, so skip the check in proc output, too. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 93b25ba4d00b..639cf0edaa98 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -399,8 +399,10 @@ static void print_conn_list(struct snd_info_buffer *buffer, { int c, curr = -1; - if (conn_len > 1 && wid_type != AC_WID_AUD_MIX && - wid_type != AC_WID_VOL_KNB) + if (conn_len > 1 && + wid_type != AC_WID_AUD_MIX && + wid_type != AC_WID_VOL_KNB && + wid_type != AC_WID_POWER) curr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); snd_iprintf(buffer, " Connection: %d\n", conn_len); -- cgit v1.2.3 From c468ac29e63b9927275a94379d00b367f0f97c43 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 20 Mar 2009 10:08:11 +0100 Subject: ALSA: sound/ali5451: typo: s/resouces/resources/ Signed-off-by: Wolfram Sang Signed-off-by: Takashi Iwai --- sound/pci/ali5451/ali5451.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 1a0fd65ec280..9069c78c2dc7 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -2142,7 +2142,7 @@ static int __devinit snd_ali_resources(struct snd_ali *codec) { int err; - snd_ali_printk("resouces allocation ...\n"); + snd_ali_printk("resources allocation ...\n"); err = pci_request_regions(codec->pci, "ALI 5451"); if (err < 0) return err; @@ -2154,7 +2154,7 @@ static int __devinit snd_ali_resources(struct snd_ali *codec) return -EBUSY; } codec->irq = codec->pci->irq; - snd_ali_printk("resouces allocated.\n"); + snd_ali_printk("resources allocated.\n"); return 0; } static int snd_ali_dev_free(struct snd_device *device) -- cgit v1.2.3 From 2d864c499a77129dc6aa4f7552ddf2885e4a9c47 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Mar 2009 12:52:47 +0100 Subject: ALSA: hda - Detect digital-mic inputs on ALC663 / ALC272 Fix the detection of digital-mic inputs on ALC663 / ALC272 codecs in the auto-detection mode. The automatic mic switch via plugging isn't implemented yet, though. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 63 ++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5ad0f8d72ddb..b69d9864f6f3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -16725,26 +16725,58 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, return 0; } +/* return the index of the src widget from the connection list of the nid. + * return -1 if not found + */ +static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, + hda_nid_t src) +{ + hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; + int i, conns; + + conns = snd_hda_get_connections(codec, nid, conn_list, + ARRAY_SIZE(conn_list)); + if (conns < 0) + return -1; + for (i = 0; i < conns; i++) + if (conn_list[i] == src) + return i; + return -1; +} + +static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) +{ + unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + return (pincap & AC_PINCAP_IN) != 0; +} + /* create playback/capture controls for input pins */ -static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, +static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) { + struct alc_spec *spec = codec->spec; struct hda_input_mux *imux = &spec->private_imux[0]; int i, err, idx; for (i = 0; i < AUTO_PIN_LAST; i++) { - if (alc880_is_input_pin(cfg->input_pins[i])) { - idx = alc880_input_pin_idx(cfg->input_pins[i]); - err = new_analog_input(spec, cfg->input_pins[i], - auto_pin_cfg_labels[i], - idx, 0x0b); - if (err < 0) - return err; - imux->items[imux->num_items].label = - auto_pin_cfg_labels[i]; - imux->items[imux->num_items].index = - alc880_input_pin_idx(cfg->input_pins[i]); - imux->num_items++; + if (alc662_is_input_pin(codec, cfg->input_pins[i])) { + idx = alc662_input_pin_idx(codec, 0x0b, + cfg->input_pins[i]); + if (idx >= 0) { + err = new_analog_input(spec, cfg->input_pins[i], + auto_pin_cfg_labels[i], + idx, 0x0b); + if (err < 0) + return err; + } + idx = alc662_input_pin_idx(codec, 0x22, + cfg->input_pins[i]); + if (idx >= 0) { + imux->items[imux->num_items].label = + auto_pin_cfg_labels[i]; + imux->items[imux->num_items].index = idx; + imux->num_items++; + } } } return 0; @@ -16794,7 +16826,6 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec) alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); } -#define alc662_is_input_pin(nid) alc880_is_input_pin(nid) #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID static void alc662_auto_init_analog_input(struct hda_codec *codec) @@ -16804,7 +16835,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = spec->autocfg.input_pins[i]; - if (alc662_is_input_pin(nid)) { + if (alc662_is_input_pin(codec, nid)) { alc_set_input_pin(codec, nid, i); if (nid != ALC662_PIN_CD_NID) snd_hda_codec_write(codec, nid, 0, @@ -16844,7 +16875,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) "Headphone"); if (err < 0) return err; - err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); + err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); if (err < 0) return err; -- cgit v1.2.3 From 8b22d943c34b616eefbd6d2f8f197a53b1f29fd0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Mar 2009 16:26:15 +0100 Subject: ALSA: pcm - Safer boundary checks Make the boundary checks a bit safer. These caese are rare or theoretically won't happen, but nothing bad to keep the checks safer... Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 063c675177a9..fbb2e391591e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -222,8 +222,9 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; delta = new_hw_ptr - hw_ptr_interrupt; if (hw_ptr_interrupt >= runtime->boundary) { - hw_ptr_interrupt %= runtime->boundary; - if (!hw_base) /* hw_base was already lapped; recalc delta */ + hw_ptr_interrupt -= runtime->boundary; + if (hw_base < runtime->boundary / 2) + /* hw_base was already lapped; recalc delta */ delta = new_hw_ptr - hw_ptr_interrupt; } if (delta < 0) { @@ -241,7 +242,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = 0; } else { hw_base += runtime->buffer_size; - if (hw_base == runtime->boundary) + if (hw_base >= runtime->boundary) hw_base = 0; new_hw_ptr = hw_base + pos; } @@ -296,7 +297,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) return 0; } hw_base += runtime->buffer_size; - if (hw_base == runtime->boundary) + if (hw_base >= runtime->boundary) hw_base = 0; new_hw_ptr = hw_base + pos; } -- cgit v1.2.3 From 234b4346a064f8a2a488da10b3c1e640fb778a17 Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Mon, 23 Mar 2009 11:15:59 +0100 Subject: ALSA: hda - Add function id to proc output This patch does two things: Output Intel HDA Function Id in /proc/asound/cardX/codec#X Align Vendor/Subsystem/Revision Ids to 8 characters, front-padded with zeros Before: Vendor Id: 0x11d41884 Subsystem Id: 0x103c281a Revision Id: 0x100100 After: Function Id: 0x1 Vendor Id: 0x11d41884 Subsystem Id: 0x103c281a Revision Id: 0x0100100 As report on the Kernel Bugzilla #12888 Signed-off-by: Pascal de Bruijn Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 6 +++--- sound/pci/hda/hda_codec.h | 1 + sound/pci/hda/hda_proc.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b90a2400f53d..1b5575ecb0a4 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -647,9 +647,9 @@ static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); for (i = 0; i < total_nodes; i++, nid++) { - unsigned int func; - func = snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE); - switch (func & 0xff) { + codec->function_id = snd_hda_param_read(codec, nid, + AC_PAR_FUNCTION_TYPE) & 0xff; + switch (codec->function_id) { case AC_GRP_AUDIO_FUNCTION: codec->afg = nid; break; diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 079e1ab718d4..2fdecf4b0eb6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -739,6 +739,7 @@ struct hda_codec { hda_nid_t mfg; /* MFG node id */ /* ids */ + u32 function_id; u32 vendor_id; u32 subsystem_id; u32 revision_id; diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 639cf0edaa98..93d7499350c6 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -469,8 +469,9 @@ static void print_codec_info(struct snd_info_entry *entry, snd_iprintf(buffer, "Codec: %s\n", codec->name ? codec->name : "Not Set"); snd_iprintf(buffer, "Address: %d\n", codec->addr); - snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); - snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); + snd_iprintf(buffer, "Function Id: 0x%x\n", codec->function_id); + snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id); + snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id); snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); if (codec->mfg) -- cgit v1.2.3 From 52ca15b7c0c711eb37f5e4b769e8488e5c516d43 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Mar 2009 12:51:55 +0100 Subject: ALSA: hda - Avoid output amp manipulation to digital mic pins Don't set amp-out values to pins without PINCAP_OUT capability, which are usually assigned for digital mics on ALC663/ALC272. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b69d9864f6f3..965a531d2fba 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -16750,6 +16750,12 @@ static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) return (pincap & AC_PINCAP_IN) != 0; } +static int alc662_is_output_pin(struct hda_codec *codec, hda_nid_t nid) +{ + unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + return (pincap & AC_PINCAP_OUT) != 0; +} + /* create playback/capture controls for input pins */ static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) @@ -16837,7 +16843,8 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc662_is_input_pin(codec, nid)) { alc_set_input_pin(codec, nid, i); - if (nid != ALC662_PIN_CD_NID) + if (nid != ALC662_PIN_CD_NID && + alc662_is_output_pin(codec, nid)) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); -- cgit v1.2.3 From 1327a32b878b5ed2113c63557b6f4f949f821857 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Mar 2009 13:07:47 +0100 Subject: ALSA: hda - Cache pin-cap values Added snd_hda_query_pin_caps() to read and cache pin-cap values to avoid too frequently issuing the same verbs. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 16 ++++++++++++++++ sound/pci/hda/hda_generic.c | 2 +- sound/pci/hda/hda_local.h | 1 + sound/pci/hda/patch_realtek.c | 6 +++--- sound/pci/hda/patch_sigmatel.c | 7 +++---- 5 files changed, 24 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 1b5575ecb0a4..0f70d2d102e0 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1052,6 +1052,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); /* FIXME: more better hash key? */ #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) +#define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) #define INFO_AMP_CAPS (1<<0) #define INFO_AMP_VOL(ch) (1 << (1 + (ch))) @@ -1142,6 +1143,21 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, } EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); +u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_amp_info *info; + + info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid)); + if (!info) + return 0; + if (!info->head.val) { + info->amp_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + info->head.val |= INFO_AMP_CAPS; + } + return info->amp_caps; +} +EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); + /* * read the current volume to info * if the cache exists, read the cache value. diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 2c81a683e8f8..1d5797a96682 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -144,7 +144,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; if (node->type == AC_WID_PIN) { - node->pin_caps = snd_hda_param_read(codec, node->nid, AC_PAR_PIN_CAP); + node->pin_caps = snd_hda_query_pin_caps(codec, node->nid); node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); node->def_cfg = snd_hda_codec_get_pincfg(codec, node->nid); } diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 27428c718fd7..83349013b4df 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -411,6 +411,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, unsigned int caps); +u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); void snd_hda_ctls_clear(struct hda_codec *codec); diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 965a531d2fba..bf7e64e2c468 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -770,7 +770,7 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { unsigned int pincap; - pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + pincap = snd_hda_query_pin_caps(codec, nid); pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; if (pincap & AC_PINCAP_VREF_80) val = PIN_VREF80; @@ -16746,13 +16746,13 @@ static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) { - unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + unsigned int pincap = snd_hda_query_pin_caps(codec, nid); return (pincap & AC_PINCAP_IN) != 0; } static int alc662_is_output_pin(struct hda_codec *codec, hda_nid_t nid) { - unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + unsigned int pincap = snd_hda_query_pin_caps(codec, nid); return (pincap & AC_PINCAP_OUT) != 0; } diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4da72403fc87..b1c180a9e9be 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2537,8 +2537,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) { - unsigned int pincap = snd_hda_param_read(codec, nid, - AC_PAR_PIN_CAP); + unsigned int pincap = snd_hda_query_pin_caps(codec, nid); pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; if (pincap & AC_PINCAP_VREF_100) return AC_PINCTL_VREF_100; @@ -2799,7 +2798,7 @@ static hda_nid_t check_line_out_switch(struct hda_codec *codec) if (cfg->line_out_type != AUTO_PIN_LINE_OUT) return 0; nid = cfg->input_pins[AUTO_PIN_LINE]; - pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + pincap = snd_hda_query_pin_caps(codec, nid); if (pincap & AC_PINCAP_OUT) return nid; return 0; @@ -2822,7 +2821,7 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec) /* some laptops have an internal analog microphone * which can't be used as a output */ if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { - pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); + pincap = snd_hda_query_pin_caps(codec, nid); if (pincap & AC_PINCAP_OUT) return nid; } -- cgit v1.2.3 From e82c025b501a1ca62dec40989817dbb17c0b9167 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Mar 2009 15:17:38 +0100 Subject: ALSA: hda - Fix the wrong pin-cap check in patch_realtek.c The check for the amp-output must be done for widget-caps rather than pin-caps as implemented in the recent change... Simply a thinko. Also, add the similar checks to all places that put output-amp mutes in the initialization. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index bf7e64e2c468..8dcbb04e57b5 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4207,7 +4207,8 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc880_is_input_pin(nid)) { alc_set_input_pin(codec, nid, i); - if (nid != ALC880_PIN_CD_NID) + if (nid != ALC880_PIN_CD_NID && + (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); @@ -5673,7 +5674,8 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec) hda_nid_t nid = spec->autocfg.input_pins[i]; if (nid >= 0x12) { alc_set_input_pin(codec, nid, i); - if (nid != ALC260_PIN_CD_NID) + if (nid != ALC260_PIN_CD_NID && + (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); @@ -9153,7 +9155,8 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec) hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc883_is_input_pin(nid)) { alc_set_input_pin(codec, nid, i); - if (nid != ALC883_PIN_CD_NID) + if (nid != ALC883_PIN_CD_NID && + (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); @@ -14880,7 +14883,8 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec) hda_nid_t nid = spec->autocfg.input_pins[i]; if (alc861vd_is_input_pin(nid)) { alc_set_input_pin(codec, nid, i); - if (nid != ALC861VD_PIN_CD_NID) + if (nid != ALC861VD_PIN_CD_NID && + (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); @@ -16750,12 +16754,6 @@ static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) return (pincap & AC_PINCAP_IN) != 0; } -static int alc662_is_output_pin(struct hda_codec *codec, hda_nid_t nid) -{ - unsigned int pincap = snd_hda_query_pin_caps(codec, nid); - return (pincap & AC_PINCAP_OUT) != 0; -} - /* create playback/capture controls for input pins */ static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) @@ -16844,7 +16842,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) if (alc662_is_input_pin(codec, nid)) { alc_set_input_pin(codec, nid, i); if (nid != ALC662_PIN_CD_NID && - alc662_is_output_pin(codec, nid)) + (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); -- cgit v1.2.3 From a23b688f4d5c2490a50677b30011a677d8edf3d0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Mar 2009 15:21:36 +0100 Subject: ALSA: hda - Don't create empty/single-item input source In patch_realtek.c, don't create empty or single-item "Input Source" control elements that are simply superfluous. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 47 ++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8dcbb04e57b5..7a3c6db6d5be 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1595,8 +1595,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, snd_hda_mixer_amp_switch_put); } -#define DEFINE_CAPMIX(num) \ -static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ +#define _DEFINE_CAPMIX(num) \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ .name = "Capture Switch", \ @@ -1617,7 +1616,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ .get = alc_cap_vol_get, \ .put = alc_cap_vol_put, \ .tlv = { .c = alc_cap_vol_tlv }, \ - }, \ + } + +#define _DEFINE_CAPSRC(num) \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ /* .name = "Capture Source", */ \ @@ -1626,15 +1627,28 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ .info = alc_mux_enum_info, \ .get = alc_mux_enum_get, \ .put = alc_mux_enum_put, \ - }, \ - { } /* end */ \ + } + +#define DEFINE_CAPMIX(num) \ +static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ + _DEFINE_CAPMIX(num), \ + _DEFINE_CAPSRC(num), \ + { } /* end */ \ +} + +#define DEFINE_CAPMIX_NOSRC(num) \ +static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ + _DEFINE_CAPMIX(num), \ + { } /* end */ \ } /* up to three ADCs */ DEFINE_CAPMIX(1); DEFINE_CAPMIX(2); DEFINE_CAPMIX(3); - +DEFINE_CAPMIX_NOSRC(1); +DEFINE_CAPMIX_NOSRC(2); +DEFINE_CAPMIX_NOSRC(3); /* * ALC880 5-stack model @@ -4298,13 +4312,22 @@ static void alc880_auto_init(struct hda_codec *codec) static void set_capture_mixer(struct alc_spec *spec) { - static struct snd_kcontrol_new *caps[3] = { - alc_capture_mixer1, - alc_capture_mixer2, - alc_capture_mixer3, + static struct snd_kcontrol_new *caps[2][3] = { + { alc_capture_mixer_nosrc1, + alc_capture_mixer_nosrc2, + alc_capture_mixer_nosrc3 }, + { alc_capture_mixer1, + alc_capture_mixer2, + alc_capture_mixer3 }, }; - if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) - spec->cap_mixer = caps[spec->num_adc_nids - 1]; + if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { + int mux; + if (spec->input_mux && spec->input_mux->num_items > 1) + mux = 1; + else + mux = 0; + spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; + } } #define set_beep_amp(spec, nid, idx, dir) \ -- cgit v1.2.3 From 14bafe3278e5da952a6586a5a9a9d286566049ed Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Mar 2009 16:35:39 +0100 Subject: ALSA: hda - Use cached calls to get widget caps and pin caps Replace with the standard function calls to use caches for reading the widget caps and pin caps. hda_proc.c is still using the direct verbs to get raw values as much as possible. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 3 +-- sound/pci/hda/patch_sigmatel.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0f70d2d102e0..a4e5e5952115 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2321,8 +2321,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, * don't power down the widget if it controls * eapd and EAPD_BTLENABLE is set. */ - pincap = snd_hda_param_read(codec, nid, - AC_PAR_PIN_CAP); + pincap = snd_hda_query_pin_caps(codec, nid); if (pincap & AC_PINCAP_EAPD) { int eapd = snd_hda_codec_read(codec, nid, 0, diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b1c180a9e9be..b5e108aa8f63 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2869,8 +2869,7 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) conn_len = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS); for (j = 0; j < conn_len; j++) { - wcaps = snd_hda_param_read(codec, conn[j], - AC_PAR_AUDIO_WIDGET_CAP); + wcaps = get_wcaps(codec, conn[j]); wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* we check only analog outputs */ if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) -- cgit v1.2.3 From 9b6682ff4c69484b6955f89f7902e3dde2481bed Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Mar 2009 22:50:52 +0100 Subject: ALSA: hda - Add quirk for Acer Ferrari 5000 Add a quirk model=acer-aspire for Acer Ferrari 5000 with ALC883 codec. Note that model=auto doesn't work for this laptop because of broken BIOS (that doesn't set the subsystem id properly). Tested-by: Russ Dill Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7a3c6db6d5be..82097790f6f3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8677,6 +8677,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), + SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), -- cgit v1.2.3 From d497e3ab91a726ecd76028698e5ce298f75ab681 Mon Sep 17 00:00:00 2001 From: Michael Schmitz Date: Sun, 18 Jan 2009 03:17:33 +0100 Subject: m68k: section mismatch fixes: DMAsound for Atari add __initdata to driver presets struct Signed-off-By: Michael Schmitz Signed-off-by: Geert Uytterhoeven --- sound/oss/dmasound/dmasound_atari.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 38931f2f6967..1f4774123064 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c @@ -1524,7 +1524,7 @@ static SETTINGS def_soft = { .speed = 8000 } ; -static MACHINE machTT = { +static __initdata MACHINE machTT = { .name = "Atari", .name2 = "TT", .owner = THIS_MODULE, @@ -1553,7 +1553,7 @@ static MACHINE machTT = { .capabilities = DSP_CAP_BATCH /* As per SNDCTL_DSP_GETCAPS */ }; -static MACHINE machFalcon = { +static __initdata MACHINE machFalcon = { .name = "Atari", .name2 = "FALCON", .dma_alloc = AtaAlloc, -- cgit v1.2.3 From 877d03105d04b2c13e241130277fa69c8d2564f0 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Mon, 26 Jan 2009 11:06:57 +0100 Subject: trivial: Fix misspelling of firmware Fix misspelling of firmware. Signed-off-by: Nick Andrew Signed-off-by: Jiri Kosina --- Documentation/ia64/kvm.txt | 2 +- Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt | 2 +- arch/mips/sgi-ip27/ip27-smp.c | 2 +- arch/sparc/kernel/head_64.S | 2 +- drivers/net/sb1250-mac.c | 2 +- drivers/net/tg3.c | 2 +- drivers/net/wireless/ipw2x00/ipw2100.c | 2 +- drivers/net/wireless/ipw2x00/ipw2200.c | 2 +- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/libertas/cmd.c | 2 +- drivers/pci/pci.c | 2 +- drivers/platform/x86/thinkpad_acpi.c | 2 +- drivers/staging/otus/hal/hpmain.c | 2 +- drivers/usb/atm/ueagle-atm.c | 2 +- drivers/usb/serial/ChangeLog.history | 2 +- include/linux/libata.h | 2 +- kernel/power/disk.c | 4 ++-- sound/oss/pss.c | 2 +- sound/sh/aica.c | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) (limited to 'sound') diff --git a/Documentation/ia64/kvm.txt b/Documentation/ia64/kvm.txt index 84f7cb3d5bec..ffb5c80bec3e 100644 --- a/Documentation/ia64/kvm.txt +++ b/Documentation/ia64/kvm.txt @@ -42,7 +42,7 @@ Note: For step 2, please make sure that host page size == TARGET_PAGE_SIZE of qe hg clone http://xenbits.xensource.com/ext/efi-vfirmware.hg you can get the firmware's binary in the directory of efi-vfirmware.hg/binaries. - (3) Rename the firware you owned to Flash.fd, and copy it to /usr/local/share/qemu + (3) Rename the firmware you owned to Flash.fd, and copy it to /usr/local/share/qemu 4. Boot up Linux or Windows guests: 4.1 Create or install a image for guest boot. If you have xen experience, it should be easy. diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt index 6c238f59b2a9..249db3a15d15 100644 --- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt +++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt @@ -1,6 +1,6 @@ * Uploaded QE firmware - If a new firwmare has been uploaded to the QE (usually by the + If a new firmware has been uploaded to the QE (usually by the boot loader), then a 'firmware' child node should be added to the QE node. This node provides information on the uploaded firmware that device drivers may need. diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c index 5b47d6b65275..cbcd7eb83bd1 100644 --- a/arch/mips/sgi-ip27/ip27-smp.c +++ b/arch/mips/sgi-ip27/ip27-smp.c @@ -221,7 +221,7 @@ static void __init ip27_smp_setup(void) * Assumption to be fixed: we're always booted on logical / physical * processor 0. While we're always running on logical processor 0 * this still means this is physical processor zero; it might for - * example be disabled in the firwware. + * example be disabled in the firmware. */ alloc_cpupda(0, 0); } diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S index a46c3a21e26d..3a1b7bf03cff 100644 --- a/arch/sparc/kernel/head_64.S +++ b/arch/sparc/kernel/head_64.S @@ -686,7 +686,7 @@ tlb_fixup_done: * point. * * There used to be enormous complexity wrt. transferring - * over from the firwmare's trap table to the Linux kernel's. + * over from the firmware's trap table to the Linux kernel's. * For example, there was a chicken & egg problem wrt. building * the OBP page tables, yet needing to be on the Linux kernel * trap table (to translate PAGE_OFFSET addresses) in order to diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 88dd2e09832f..ce7551e17ba7 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c @@ -2299,7 +2299,7 @@ static int sbmac_init(struct platform_device *pldev, long long base) eaddr = sc->sbm_hwaddr; /* - * Read the ethernet address. The firwmare left this programmed + * Read the ethernet address. The firmware left this programmed * for us in the ethernet address register for each mac. */ diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f7efcecc4108..ed60b18addac 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -11225,7 +11225,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) return tg3_phy_init(tp); /* Reading the PHY ID register can conflict with ASF - * firwmare access to the PHY hardware. + * firmware access to the PHY hardware. */ err = 0; if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 115b70487502..f4e963ba768b 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c @@ -2362,7 +2362,7 @@ static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) i * sizeof(struct ipw2100_status)); #ifdef IPW2100_DEBUG_C3 - /* Halt the fimrware so we can get a good image */ + /* Halt the firmware so we can get a good image */ write_register(priv->net_dev, IPW_REG_RESET_REG, IPW_AUX_HOST_RESET_REG_STOP_MASTER); j = 5; diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index b3449948a25a..f6174fdc12bf 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c @@ -8844,7 +8844,7 @@ static int ipw_wx_set_mode(struct net_device *dev, #endif /* CONFIG_IPW2200_MONITOR */ /* Free the existing firmware and reset the fw_loaded - * flag so ipw_load() will bring in the new firmawre */ + * flag so ipw_load() will bring in the new firmware */ free_firmware(); priv->ieee->iw_mode = wrqu->mode; diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 663dc83be501..3889158b359c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c @@ -1337,7 +1337,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) /* api_ver should match the api version forming part of the * firmware filename ... but we don't check for that and only rely - * on the API version read from firware header from here on forward */ + * on the API version read from firmware header from here on forward */ if (api_ver < api_min || api_ver > api_max) { IWL_ERR(priv, "Driver unable to support your firmware API. " diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index a71b08ca7c71..9d5f97dd7c73 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -2562,7 +2562,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) /* api_ver should match the api version forming part of the * firmware filename ... but we don't check for that and only rely - * on the API version read from firware header from here on forward */ + * on the API version read from firmware header from here on forward */ if (api_ver < api_min || api_ver > api_max) { IWL_ERR(priv, "Driver unable to support your firmware API. " diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 639dd02d3d31..8c3605cdc64c 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1649,7 +1649,7 @@ static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) /** * @brief This function executes next command in command - * pending queue. It will put fimware back to PS mode + * pending queue. It will put firmware back to PS mode * if applicable. * * @param priv A pointer to struct lbs_private structure diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6d6120007af4..dab33a21d49a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -550,7 +550,7 @@ void pci_update_current_state(struct pci_dev *dev, pci_power_t state) * @dev: PCI device to handle. * @state: PCI power state (D0, D1, D2, D3hot) to put the device into. * - * Transition a device to a new power state, using the platform formware and/or + * Transition a device to a new power state, using the platform firmware and/or * the device's PCI PM registers. * * RETURN VALUE: diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index d2433204a40c..814cb6520673 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -5811,7 +5811,7 @@ static struct ibm_struct volume_driver_data = { * ThinkPads from this same time period (and earlier) probably lack the * tachometer as well. * - * Unfortunately a lot of ThinkPads with new-style ECs but whose firwmare + * Unfortunately a lot of ThinkPads with new-style ECs but whose firmware * was never fixed by IBM to report the EC firmware version string * probably support the tachometer (like the early X models), so * detecting it is quite hard. We need more data to know for sure. diff --git a/drivers/staging/otus/hal/hpmain.c b/drivers/staging/otus/hal/hpmain.c index 2e65c466aae8..dab278326931 100644 --- a/drivers/staging/otus/hal/hpmain.c +++ b/drivers/staging/otus/hal/hpmain.c @@ -152,7 +152,7 @@ u16_t zfHpInit(zdev_t* dev, u32_t frequency) else { #ifndef ZM_OTUS_LINUX_PHASE_2 - /* donwload the normal frimware */ + /* download the normal firmware */ if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage, (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS) { diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index b6483dd98acc..9cf9ff69e3e3 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -626,7 +626,7 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte goto err_fw_corrupted; /* - * Start to upload formware : send reset + * Start to upload firmware : send reset */ value = 1; ret = uea_send_modem_cmd(usb, F8051_USBCS, sizeof(value), &value); diff --git a/drivers/usb/serial/ChangeLog.history b/drivers/usb/serial/ChangeLog.history index c1b279939bbf..f13fd488ebec 100644 --- a/drivers/usb/serial/ChangeLog.history +++ b/drivers/usb/serial/ChangeLog.history @@ -715,7 +715,7 @@ io_edgeport.c Change Log comments: 0.2 (01/30/2000) greg kroah-hartman Milestone 1 release. - Device is found by USB subsystem, enumerated, fimware is downloaded + Device is found by USB subsystem, enumerated, firmware is downloaded and the descriptors are printed to the debug log, config is set, and green light starts to blink. Open port works, and data can be sent and received at the default settings of the UART. Loopback connector diff --git a/include/linux/libata.h b/include/linux/libata.h index 76262d83656b..b450a2628855 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -379,7 +379,7 @@ enum { ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands not multiple of 16 bytes */ - ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ + ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */ ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ /* DMA mask for user DMA control: User visible values; DO NOT diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 4a4a206b1979..9d1c1a0de350 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c @@ -265,7 +265,7 @@ static int create_image(int platform_mode) * hibernation_snapshot - quiesce devices and create the hibernation * snapshot image. * @platform_mode - if set, use the platform driver, if available, to - * prepare the platform frimware for the power transition. + * prepare the platform firmware for the power transition. * * Must be called with pm_mutex held */ @@ -378,7 +378,7 @@ static int resume_target_kernel(void) * hibernation_restore - quiesce devices and restore the hibernation * snapshot image. If successful, control returns in hibernation_snaphot() * @platform_mode - if set, use the platform driver, if available, to - * prepare the platform frimware for the transition. + * prepare the platform firmware for the transition. * * Must be called with pm_mutex held */ diff --git a/sound/oss/pss.c b/sound/oss/pss.c index 16517a5a1301..83f5ee236b12 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c @@ -46,7 +46,7 @@ * load the driver as it did in previous versions. * 04-07-1999: Anthony Barbachan * Added module parameter pss_firmware to allow the user to tell - * the driver where the fireware file is located. The default + * the driver where the firmware file is located. The default * setting is the previous hardcoded setting "/etc/sound/pss_synth". * 00-03-03: Christoph Hellwig * Adapted to module_init/module_exit diff --git a/sound/sh/aica.c b/sound/sh/aica.c index f551233c5a08..583a3693df75 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c @@ -565,7 +565,7 @@ static int load_aica_firmware(void) err = request_firmware(&fw_entry, "aica_firmware.bin", &pd->dev); if (unlikely(err)) return err; - /* write firware into memory */ + /* write firmware into memory */ spu_disable(); spu_memload(0, fw_entry->data, fw_entry->size); spu_enable(); -- cgit v1.2.3 From 692105b8ac5bcd75dc65f6a8f10bdbd0f0f34dcf Mon Sep 17 00:00:00 2001 From: Matt LaPlante Date: Mon, 26 Jan 2009 11:12:25 +0100 Subject: trivial: fix typos/grammar errors in Kconfig texts Signed-off-by: Matt LaPlante Acked-by: Randy Dunlap Signed-off-by: Jiri Kosina --- arch/arm/mach-omap1/Kconfig | 2 +- arch/avr32/Kconfig | 6 +++--- arch/blackfin/Kconfig | 6 +++--- arch/cris/Kconfig | 6 +++--- arch/cris/arch-v32/Kconfig | 2 +- arch/cris/arch-v32/drivers/Kconfig | 2 +- arch/cris/arch-v32/mach-fs/Kconfig | 2 +- arch/mips/Kconfig | 2 +- arch/powerpc/Kconfig | 2 +- arch/powerpc/platforms/Kconfig | 2 +- arch/powerpc/sysdev/bestcomm/Kconfig | 4 ++-- arch/sh/Kconfig | 4 ++-- arch/x86/Kconfig | 4 ++-- drivers/ata/Kconfig | 2 +- drivers/gpio/Kconfig | 6 +++--- drivers/hid/Kconfig | 2 +- drivers/input/Kconfig | 2 +- drivers/isdn/mISDN/Kconfig | 10 ++++++---- drivers/leds/Kconfig | 6 +++--- drivers/media/common/tuners/Kconfig | 2 +- drivers/media/dvb/frontends/Kconfig | 2 +- drivers/mfd/Kconfig | 2 +- drivers/misc/Kconfig | 6 +++--- drivers/mmc/host/Kconfig | 2 +- drivers/scsi/Kconfig | 4 ++-- drivers/serial/Kconfig | 2 +- drivers/staging/Kconfig | 4 ++-- drivers/staging/comedi/Kconfig | 4 ++-- drivers/staging/go7007/Kconfig | 4 ++-- drivers/staging/panel/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 2 +- drivers/usb/serial/Kconfig | 4 ++-- drivers/uwb/Kconfig | 4 ++-- drivers/xen/Kconfig | 2 +- fs/ext4/Kconfig | 2 +- fs/ubifs/Kconfig | 4 ++-- init/Kconfig | 6 +++--- kernel/trace/Kconfig | 9 ++++----- net/Kconfig | 2 +- net/ipv6/Kconfig | 18 +++++++++--------- net/mac80211/Kconfig | 2 +- net/netfilter/Kconfig | 2 +- net/phonet/Kconfig | 2 +- net/sunrpc/Kconfig | 2 +- net/wimax/Kconfig | 2 +- sound/soc/blackfin/Kconfig | 2 +- 46 files changed, 86 insertions(+), 85 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index 3f325d3718a9..cd8de89c5fad 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig @@ -109,7 +109,7 @@ config MACH_OMAP_PALMZ71 help Support for the Palm Zire71 PDA. To boot the kernel, you'll need a PalmOS compatible bootloader; check out - http://hackndev.com/palm/z71 for more informations. + http://hackndev.com/palm/z71 for more information. Say Y here if you have such a PDA, say N otherwise. config MACH_OMAP_PALMTT diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index 05fe3053dcae..414a8ad97f52 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig @@ -127,13 +127,13 @@ config BOARD_HAMMERHEAD select CPU_AT32AP7000 select USB_ARCH_HAS_HCD help - The Hammerhead platform is built around a AVR32 32-bit microcontroller from Atmel. + The Hammerhead platform is built around an AVR32 32-bit microcontroller from Atmel. It offers versatile peripherals, such as ethernet, usb device, usb host etc. - The board also incooperates a power supply and is a Power over Ethernet (PoE) Powered + The board also incorporates a power supply and is a Power over Ethernet (PoE) Powered Device (PD). - Additonally, a Cyclone III FPGA from Altera is integrated on the board. The FPGA is + Additionally, a Cyclone III FPGA from Altera is integrated on the board. The FPGA is mapped into the 32-bit AVR memory bus. The FPGA offers two DDR2 SDRAM interfaces, which will cover even the most exceptional need of memory bandwidth. Together with the onboard video decoder the board is ready for video processing. diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 0c1f86e3e44a..3640cdc38aac 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig @@ -777,7 +777,7 @@ config CACHELINE_ALIGNED_L1 default n if BF54x depends on !BF531 help - If enabled, cacheline_anligned data is linked + If enabled, cacheline_aligned data is linked into L1 data memory. (less latency) config SYSCALL_TAB_L1 @@ -957,7 +957,7 @@ config MPU memory they do not own. This comes at a performance penalty and is recommended only for debugging. -comment "Asynchonous Memory Configuration" +comment "Asynchronous Memory Configuration" menu "EBIU_AMGCTL Global Control" config C_AMCKEN @@ -989,7 +989,7 @@ config C_B3PEN default n choice - prompt"Enable Asynchonous Memory Banks" + prompt "Enable Asynchronous Memory Banks" default C_AMBEN_ALL config C_AMBEN diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 3462245fe9fb..7adac388a771 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig @@ -438,7 +438,7 @@ config ETRAX_SERIAL_PORT0_DMA1_IN help Enables the DMA1 input channel for ser0 (ttyS0). If you do not enable DMA, an interrupt for each character will be - used when receiveing data. + used when receiving data. Normally you want to use DMA, unless you use the DMA channel for something else. @@ -565,7 +565,7 @@ config ETRAX_SERIAL_PORT2_DMA7_IN help Enables the DMA7 input channel for ser2 (ttyS2). If you do not enable DMA, an interrupt for each character will be - used when receiveing data. + used when receiving data. Normally you want to use DMA, unless you use the DMA channel for something else. @@ -604,7 +604,7 @@ config ETRAX_SERIAL_PORT3_DMA3_IN help Enables the DMA3 input channel for ser3 (ttyS3). If you do not enable DMA, an interrupt for each character will be - used when receiveing data. + used when receiving data. Normally you want to use DMA, unless you use the DMA channel for something else. diff --git a/arch/cris/arch-v32/Kconfig b/arch/cris/arch-v32/Kconfig index 005ed2b3f7f4..21bbd93be34f 100644 --- a/arch/cris/arch-v32/Kconfig +++ b/arch/cris/arch-v32/Kconfig @@ -28,7 +28,7 @@ config ETRAX_NBR_LED_GRP_ONE help Select this if you want one Ethernet LED group. This LED group can be used for one or more Ethernet interfaces. However, it is - recomended that each Ethernet interface use a dedicated LED group. + recommended that each Ethernet interface use a dedicated LED group. config ETRAX_NBR_LED_GRP_TWO bool "Use two LED groups" diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig index 7a64fcef9d07..b9e328e688be 100644 --- a/arch/cris/arch-v32/drivers/Kconfig +++ b/arch/cris/arch-v32/drivers/Kconfig @@ -342,7 +342,7 @@ config ETRAX_SERIAL_PORT4_DMA9_IN help Enables the DMA9 input channel for ser4 (ttyS4). If you do not enable DMA, an interrupt for each character will be - used when receiveing data. + used when receiving data. Normally you want to use DMA, unless you use the DMA channel for something else. diff --git a/arch/cris/arch-v32/mach-fs/Kconfig b/arch/cris/arch-v32/mach-fs/Kconfig index f6d74475f1c6..774de82abef6 100644 --- a/arch/cris/arch-v32/mach-fs/Kconfig +++ b/arch/cris/arch-v32/mach-fs/Kconfig @@ -59,7 +59,7 @@ config ETRAX_SDRAM_GRP1_CONFIG depends on ETRAX_ARCH_V32 default "0" help - SDRAM configuration for group 1. The defult value is 0 + SDRAM configuration for group 1. The default value is 0 because group 1 is not used in the default configuration, described in the help for SDRAM_GRP0_CONFIG. diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 206cb7953b0c..92508c521673 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -136,7 +136,7 @@ config MACH_JAZZ help This a family of machines based on the MIPS R4030 chipset which was used by several vendors to build RISC/os and Windows NT workstations. - Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and + Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and Olivetti M700-10 workstations. config LASAT diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 74cc312c347c..2e2160c3de7c 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -342,7 +342,7 @@ config PHYP_DUMP help Hypervisor-assisted dump is meant to be a kdump replacement offering robustness and speed not possible without system - hypervisor assistence. + hypervisor assistance. If unsure, say "N" diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index 200b9cb900ea..9a8bb53d315d 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -298,7 +298,7 @@ config CPM config OF_RTC bool help - Uses information from the OF or flattened device tree to instatiate + Uses information from the OF or flattened device tree to instantiate platform devices for direct mapped RTC chips like the DS1742 or DS1743. source "arch/powerpc/sysdev/bestcomm/Kconfig" diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig index 0b192a1c429d..29e427085efb 100644 --- a/arch/powerpc/sysdev/bestcomm/Kconfig +++ b/arch/powerpc/sysdev/bestcomm/Kconfig @@ -9,8 +9,8 @@ config PPC_BESTCOMM select PPC_LIB_RHEAP help BestComm is the name of the communication coprocessor found - on the Freescale MPC5200 family of processor. It's usage is - optionnal for some drivers (like ATA), but required for + on the Freescale MPC5200 family of processor. Its usage is + optional for some drivers (like ATA), but required for others (like FEC). If you want to use drivers that require DMA operations, diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 8d50d527c595..2d52b515c241 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -640,10 +640,10 @@ config GUSA_RB depends on GUSA && CPU_SH3 || (CPU_SH4 && !CPU_SH4A) help Enabling this option will allow the kernel to implement some - atomic operations using a software implemention of load-locked/ + atomic operations using a software implementation of load-locked/ store-conditional (LLSC). On machines which do not have hardware LLSC, this should be more efficient than the other alternative of - disabling insterrupts around the atomic sequence. + disabling interrupts around the atomic sequence. endmenu diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 06c02c00d7d9..d7b5621382f6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1129,7 +1129,7 @@ config NODES_SHIFT depends on NEED_MULTIPLE_NODES ---help--- Specify the maximum number of NUMA Nodes available on the target - system. Increases memory reserved to accomodate various tables. + system. Increases memory reserved to accommodate various tables. config HAVE_ARCH_BOOTMEM def_bool y @@ -1307,7 +1307,7 @@ config MTRR_SANITIZER add writeback entries. Can be disabled with disable_mtrr_cleanup on the kernel command line. - The largest mtrr entry size for a continous block can be set with + The largest mtrr entry size for a continuous block can be set with mtrr_chunk_size. If unsure, say Y. diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 0bcf26464670..9120717c0701 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -86,7 +86,7 @@ config ATA_SFF For users with exclusively modern controllers like AHCI, Silicon Image 3124, or Marvell 6440, you may choose to - disable this uneeded SFF support. + disable this unneeded SFF support. If unsure, say Y. diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 3d2565441b36..edb02530e461 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -42,9 +42,9 @@ config DEBUG_GPIO depends on DEBUG_KERNEL help Say Y here to add some extra checks and diagnostics to GPIO calls. - The checks help ensure that GPIOs have been properly initialized - before they are used and that sleeping calls aren not made from - nonsleeping contexts. They can make bitbanged serial protocols + These checks help ensure that GPIOs have been properly initialized + before they are used, and that sleeping calls are not made from + non-sleeping contexts. They can make bitbanged serial protocols slower. The diagnostics help catch the type of setup errors that are most common when setting up new platforms or boards. diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index e85c8fe9ffcf..504cfaa6160f 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -243,7 +243,7 @@ config GREENASIA_FF select INPUT_FF_MEMLESS ---help--- Say Y here if you have a GreenAsia (Product ID 0x12) based game controller - (like MANTA Warior MM816 and SpeedLink Strike2 SL-6635) or adapter + (like MANTA Warrior MM816 and SpeedLink Strike2 SL-6635) or adapter and want to enable force feedback support for it. config HID_TOPSEED diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 5f9d860925a1..cd50c00ab20f 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -143,7 +143,7 @@ config INPUT_APMPOWER ---help--- Say Y here if you want suspend key events to trigger a user requested suspend through APM. This is useful on embedded - systems where such behviour is desired without userspace + systems where such behaviour is desired without userspace interaction. If unsure, say N. To compile this driver as a module, choose M here: the diff --git a/drivers/isdn/mISDN/Kconfig b/drivers/isdn/mISDN/Kconfig index 4938355c4072..1747a02a019a 100644 --- a/drivers/isdn/mISDN/Kconfig +++ b/drivers/isdn/mISDN/Kconfig @@ -14,13 +14,15 @@ config MISDN_DSP depends on MISDN help Enable support for digital audio processing capability. + This module may be used for special applications that require - cross connecting of bchannels, conferencing, dtmf decoding + cross connecting of bchannels, conferencing, dtmf decoding, echo cancelation, tone generation, and Blowfish encryption and - decryption. - It may use hardware features if available. + decryption. It may use hardware features if available. + E.g. it is required for PBX4Linux. Go to http://isdn.eversberg.eu - and get more informations about this module and it's usage. + and get more information about this module and its usage. + If unsure, say 'N'. config MISDN_L1OIP diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 556aeca0d860..d9db17624f12 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -100,7 +100,7 @@ config LEDS_HP6XX tristate "LED Support for the HP Jornada 6xx" depends on LEDS_CLASS && SH_HP6XX help - This option enables led support for the handheld + This option enables LED support for the handheld HP Jornada 620/660/680/690. config LEDS_PCA9532 @@ -108,7 +108,7 @@ config LEDS_PCA9532 depends on LEDS_CLASS && I2C && INPUT && EXPERIMENTAL help This option enables support for NXP pca9532 - led controller. It is generally only usefull + LED controller. It is generally only useful as a platform driver config LEDS_GPIO @@ -144,7 +144,7 @@ config LEDS_CLEVO_MAIL Positivo Mobile (Clevo M5x0V) If your model is not listed here you can try the "nodetect" - module paramter. + module parameter. To compile this driver as a module, choose M here: the module will be called leds-clevo-mail. diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig index 6f92beaa5ac8..da058c174049 100644 --- a/drivers/media/common/tuners/Kconfig +++ b/drivers/media/common/tuners/Kconfig @@ -147,7 +147,7 @@ config MEDIA_TUNER_XC5000 default m if DVB_FE_CUSTOMISE help A driver for the silicon tuner XC5000 from Xceive. - This device is only used inside a SiP called togther with a + This device is only used inside a SiP called together with a demodulator for now. config MEDIA_TUNER_MXL5005S diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index 00269560793a..baf808e9d6e1 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig @@ -439,7 +439,7 @@ config DVB_TUNER_DIB0070 default m if DVB_FE_CUSTOMISE help A driver for the silicon baseband tuner DiB0070 from DiBcom. - This device is only used inside a SiP called togther with a + This device is only used inside a SiP called together with a demodulator for now. comment "SEC control devices for DVB-S" diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 06a2b0f7737c..75f35dbb11dc 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -88,7 +88,7 @@ config MENELAUS help If you say yes here you get support for the Texas Instruments TWL92330/Menelaus Power Management chip. This include voltage - regulators, Dual slot memory card tranceivers, real-time clock + regulators, Dual slot memory card transceivers, real-time clock and other features that are often used in portable devices like cell phones and PDAs. diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 1c484084ed4f..7a1e948840e6 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -18,8 +18,8 @@ config ATMEL_PWM depends on AVR32 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 help This option enables device driver support for the PWM channels - on certain Atmel prcoessors. Pulse Width Modulation is used for - purposes including software controlled power-efficent backlights + on certain Atmel processors. Pulse Width Modulation is used for + purposes including software controlled power-efficient backlights on LCD displays, motor control, and waveform generation. config ATMEL_TCLIB @@ -142,7 +142,7 @@ config ATMEL_SSC tristate "Device driver for Atmel SSC peripheral" depends on AVR32 || ARCH_AT91 ---help--- - This option enables device driver support for Atmel Syncronized + This option enables device driver support for Atmel Synchronized Serial Communication peripheral (SSC). The SSC peripheral supports a wide variety of serial frame based diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 99d4b28d52ed..6fbb246c40bb 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -177,7 +177,7 @@ config MMC_SPI select CRC7 select CRC_ITU_T help - Some systems accss MMC/SD/SDIO cards using a SPI controller + Some systems access MMC/SD/SDIO cards using a SPI controller instead of using a "native" MMC/SD/SDIO controller. This has a disadvantage of being relatively high overhead, but a compensating advantage of working on many systems without dedicated MMC/SD/SDIO diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index e2f44e6c0bcb..20297c521e50 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -1380,7 +1380,7 @@ config SCSI_LPFC_DEBUG_FS bool "Emulex LightPulse Fibre Channel debugfs Support" depends on SCSI_LPFC && DEBUG_FS help - This makes debugging infomation from the lpfc driver + This makes debugging information from the lpfc driver available via the debugfs filesystem. config SCSI_SIM710 @@ -1388,7 +1388,7 @@ config SCSI_SIM710 depends on (EISA || MCA) && SCSI select SCSI_SPI_ATTRS ---help--- - This driver for NCR53c710 based SCSI host adapters. + This driver is for NCR53c710 based SCSI host adapters. It currently supports Compaq EISA cards and NCR MCA cards diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 9be11b0963f2..aa9d3a4c2d50 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -1374,7 +1374,7 @@ config SERIAL_BFIN_SPORT depends on BLACKFIN && EXPERIMENTAL select SERIAL_CORE help - Enble support SPORT emulate UART on Blackfin series. + Enable SPORT emulate UART on Blackfin series. To compile this driver as a module, choose M here: the module will be called bfin_sport_uart. diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 211af86a6c55..92981c2383ee 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -4,7 +4,7 @@ menuconfig STAGING ---help--- This option allows you to select a number of drivers that are not of the "normal" Linux kernel quality level. These drivers - are placed here in order to get a wider audience for use of + are placed here in order to get a wider audience to make use of them. Please note that these drivers are under heavy development, may or may not work, and may contain userspace interfaces that most likely will be changed in the near @@ -12,7 +12,7 @@ menuconfig STAGING Using any of these drivers will taint your kernel which might affect support options from both the community, and various - commercial support orginizations. + commercial support organizations. If you wish to work on these drivers, to help improve them, or to report problems you have with them, please see the diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index b47ca1e7e383..83a93a5c6392 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1,9 +1,9 @@ config COMEDI - tristate "Data Acquision support (comedi)" + tristate "Data acquisition support (comedi)" default N depends on m ---help--- - Enable support a wide range of data acquision devices + Enable support a wide range of data acquisition devices for Linux. config COMEDI_RT diff --git a/drivers/staging/go7007/Kconfig b/drivers/staging/go7007/Kconfig index f2cf7f66ae05..ca6ade6c4b47 100644 --- a/drivers/staging/go7007/Kconfig +++ b/drivers/staging/go7007/Kconfig @@ -10,7 +10,7 @@ config VIDEO_GO7007 select CRC32 default N ---help--- - This is a video4linux driver for some wierd device... + This is a video4linux driver for some weird device... To compile this driver as a module, choose M here: the module will be called go7007 @@ -20,7 +20,7 @@ config VIDEO_GO7007_USB depends on VIDEO_GO7007 && USB default N ---help--- - This is a video4linux driver for some wierd device... + This is a video4linux driver for some weird device... To compile this driver as a module, choose M here: the module will be called go7007-usb diff --git a/drivers/staging/panel/Kconfig b/drivers/staging/panel/Kconfig index c4b30f2a549b..3abe7c9d558d 100644 --- a/drivers/staging/panel/Kconfig +++ b/drivers/staging/panel/Kconfig @@ -110,7 +110,7 @@ config PANEL_LCD_BWIDTH ---help--- Most LCDs use a standard controller which supports hardware lines of 40 characters, although sometimes only 16, 20 or 24 of them are really wired - to the terminal. This results in some non-visible but adressable characters, + to the terminal. This results in some non-visible but addressable characters, and is the case for most parallel LCDs. Other LCDs, and some serial ones, however, use the same line width internally as what is visible. The KS0074 for example, uses 16 characters per line for 16 visible characters per line. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 770b3eaa9184..080bb1e4b847 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -392,7 +392,7 @@ config USB_GADGET_FSL_QE controllers having QE or CPM2, given minor tweaks. Set CONFIG_USB_GADGET to "m" to build this driver as a - dynmically linked module called "fsl_qe_udc". + dynamically linked module called "fsl_qe_udc". config USB_FSL_QE tristate diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index a65f9196b0a0..c480ea4c19f2 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -518,8 +518,8 @@ config USB_SERIAL_SIERRAWIRELESS help Say M here if you want to use Sierra Wireless devices. - Many deviecs have a feature known as TRU-Install, for those devices - to work properly the USB Storage Sierra feature must be enabled. + Many devices have a feature known as TRU-Install. For those devices + to work properly, the USB Storage Sierra feature must be enabled. To compile this driver as a module, choose M here: the module will be called sierra. diff --git a/drivers/uwb/Kconfig b/drivers/uwb/Kconfig index ca783127af36..bac8e7a6f17b 100644 --- a/drivers/uwb/Kconfig +++ b/drivers/uwb/Kconfig @@ -48,10 +48,10 @@ config UWB_WHCI help This driver enables the radio controller for WHCI cards. - WHCI is an specification developed by Intel + WHCI is a specification developed by Intel (http://www.intel.com/technology/comms/wusb/whci.htm) much in the spirit of USB's EHCI, but for UWB and Wireless USB - radio/host controllers connected via memmory mapping (eg: + radio/host controllers connected via memory mapping (eg: PCI). Most of these cards come also with a Wireless USB host controller. diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 526187c8a12d..8ac9cddac575 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -37,7 +37,7 @@ config XEN_COMPAT_XENFS The old xenstore userspace tools expect to find "xenbus" under /proc/xen, but "xenbus" is now found at the root of the xenfs filesystem. Selecting this causes the kernel to create - the compatibilty mount point /proc/xen if it is running on + the compatibility mount point /proc/xen if it is running on a xen platform. If in doubt, say yes. diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig index 7505482a08fa..418b6f3b0ae8 100644 --- a/fs/ext4/Kconfig +++ b/fs/ext4/Kconfig @@ -18,7 +18,7 @@ config EXT4_FS filesystem; while there will be some performance gains from the delayed allocation and inode table readahead, the best performance gains will require enabling ext4 features in the - filesystem, or formating a new filesystem as an ext4 + filesystem, or formatting a new filesystem as an ext4 filesystem initially. To compile this file system support as a module, choose M here. The diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig index e35b54d5059d..830e3f76f442 100644 --- a/fs/ubifs/Kconfig +++ b/fs/ubifs/Kconfig @@ -22,7 +22,7 @@ config UBIFS_FS_ADVANCED_COMPR depends on UBIFS_FS help This option allows to explicitly choose which compressions, if any, - are enabled in UBIFS. Removing compressors means inbility to read + are enabled in UBIFS. Removing compressors means inability to read existing file systems. If unsure, say 'N'. @@ -32,7 +32,7 @@ config UBIFS_FS_LZO depends on UBIFS_FS default y help - LZO compressor is generally faster then zlib but compresses worse. + LZO compressor is generally faster than zlib but compresses worse. Say 'Y' if unsure. config UBIFS_FS_ZLIB diff --git a/init/Kconfig b/init/Kconfig index 14c483d2b7c9..bcffc0e47647 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -687,7 +687,7 @@ config PID_NS depends on NAMESPACES && EXPERIMENTAL help Support process id namespaces. This allows having multiple - process with the same pid as long as they are in different + processes with the same pid as long as they are in different pid namespaces. This is a building block of containers. Unless you want to work with an experimental feature @@ -952,7 +952,7 @@ config COMPAT_BRK Randomizing heap placement makes heap exploits harder, but it also breaks ancient binaries (including anything libc5 based). This option changes the bootup default to heap randomization - disabled, and can be overriden runtime by setting + disabled, and can be overridden at runtime by setting /proc/sys/kernel/randomize_va_space to 2. On non-ancient distros (post-2000 ones) N is usually a safe choice. @@ -1110,7 +1110,7 @@ config INIT_ALL_POSSIBLE cpu_possible_map, some of them chose to initialize cpu_possible_map with all 1s, and others with all 0s. When they were centralised, it was better to provide this option than to break all the archs - and have several arch maintainers persuing me down dark alleys. + and have several arch maintainers pursuing me down dark alleys. config STOP_MACHINE bool diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 34e707e5ab87..504086ab4443 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -72,11 +72,10 @@ config FUNCTION_GRAPH_TRACER help Enable the kernel to trace a function at both its return and its entry. - It's first purpose is to trace the duration of functions and - draw a call graph for each thread with some informations like - the return value. - This is done by setting the current return address on the current - task structure into a stack of calls. + Its first purpose is to trace the duration of functions and + draw a call graph for each thread with some information like + the return value. This is done by setting the current return + address on the current task structure into a stack of calls. config IRQSOFF_TRACER bool "Interrupts-off Latency Tracer" diff --git a/net/Kconfig b/net/Kconfig index ec93e7e38b38..ce77db4fcec8 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -140,7 +140,7 @@ config NETFILTER_ADVANCED default y help If you say Y here you can select between all the netfilter modules. - If you say N the more ununsual ones will not be shown and the + If you say N the more unusual ones will not be shown and the basic ones needed by most people will default to 'M'. If unsure, say Y. diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index ec992159b5f8..ca8cb326d1d2 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig @@ -22,17 +22,17 @@ menuconfig IPV6 if IPV6 config IPV6_PRIVACY - bool "IPv6: Privacy Extensions support" + bool "IPv6: Privacy Extensions (RFC 3041) support" ---help--- Privacy Extensions for Stateless Address Autoconfiguration in IPv6 - support. With this option, additional periodically-alter - pseudo-random global-scope unicast address(es) will assigned to + support. With this option, additional periodically-altered + pseudo-random global-scope unicast address(es) will be assigned to your interface(s). - We use our standard pseudo random algorithm to generate randomized - interface identifier, instead of one described in RFC 3041. + We use our standard pseudo-random algorithm to generate the + randomized interface identifier, instead of one described in RFC 3041. - By default, kernel do not generate temporary addresses. + By default the kernel does not generate temporary addresses. To use temporary addresses, do echo 2 >/proc/sys/net/ipv6/conf/all/use_tempaddr @@ -43,9 +43,9 @@ config IPV6_ROUTER_PREF bool "IPv6: Router Preference (RFC 4191) support" ---help--- Router Preference is an optional extension to the Router - Advertisement message to improve the ability of hosts - to pick more appropriate router, especially when the hosts - is placed in a multi-homed network. + Advertisement message which improves the ability of hosts + to pick an appropriate router, especially when the hosts + are placed in a multi-homed network. If unsure, say N. diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 60c16162474c..f3d9ae350fb6 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig @@ -33,7 +33,7 @@ choice ---help--- This option selects the default rate control algorithm mac80211 will use. Note that this default can still be - overriden through the ieee80211_default_rc_algo module + overridden through the ieee80211_default_rc_algo module parameter if different algorithms are available. config MAC80211_RC_DEFAULT_PID diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 2c967e4f706c..bb279bf59a1b 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig @@ -52,7 +52,7 @@ config NF_CT_ACCT Please note that currently this option only sets a default state. You may change it at boot time with nf_conntrack.acct=0/1 kernel - paramater or by loading the nf_conntrack module with acct=0/1. + parameter or by loading the nf_conntrack module with acct=0/1. You may also disable/enable it on a running system with: sysctl net.netfilter.nf_conntrack_acct=0/1 diff --git a/net/phonet/Kconfig b/net/phonet/Kconfig index 51a5669573f2..6ec7d55b1769 100644 --- a/net/phonet/Kconfig +++ b/net/phonet/Kconfig @@ -6,7 +6,7 @@ config PHONET tristate "Phonet protocols family" help The Phone Network protocol (PhoNet) is a packet-oriented - communication protocol developped by Nokia for use with its modems. + communication protocol developed by Nokia for use with its modems. This is required for Maemo to use cellular data connectivity (if supported). It can also be used to control Nokia phones diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig index 5592883e1e4a..3f7faa9688ae 100644 --- a/net/sunrpc/Kconfig +++ b/net/sunrpc/Kconfig @@ -69,7 +69,7 @@ config RPCSEC_GSS_SPKM3 select CRYPTO_CBC help Choose Y here to enable Secure RPC using the SPKM3 public key - GSS-API mechansim (RFC 2025). + GSS-API mechanism (RFC 2025). Secure RPC calls with SPKM3 require an auxiliary userspace daemon which may be found in the Linux nfs-utils package diff --git a/net/wimax/Kconfig b/net/wimax/Kconfig index 18495cdcd10d..1b46747a5f5a 100644 --- a/net/wimax/Kconfig +++ b/net/wimax/Kconfig @@ -8,7 +8,7 @@ # # As well, enablement of the RFKILL code means we need the INPUT layer # support to inject events coming from hw rfkill switches. That -# dependency could be killed if input.h provided appropiate means to +# dependency could be killed if input.h provided appropriate means to # work when input is disabled. comment "WiMAX Wireless Broadband support requires CONFIG_INPUT enabled" diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index 0a2f8f9eff53..811596f4c092 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig @@ -42,7 +42,7 @@ config SND_BF5XX_AC97 You will also need to select the audio interfaces to support below. Note: - AC97 codecs which do not implment the slot-16 mode will not function + AC97 codecs which do not implement the slot-16 mode will not function properly with this driver. This driver is known to work with the Analog Devices line of AC97 codecs. -- cgit v1.2.3 From 9b76ede411145d7456ae5e467b65003ca7990b06 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 27 Feb 2009 11:51:24 -0300 Subject: V4L/DVB (10771): tea575x-tuner: convert it to V4L2 API Signed-off-by: Mauro Carvalho Chehab --- include/sound/tea575x-tuner.h | 8 +- sound/i2c/other/tea575x-tuner.c | 302 +++++++++++++++++++++++++++------------- sound/pci/Kconfig | 2 +- 3 files changed, 212 insertions(+), 100 deletions(-) (limited to 'sound') diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index 426899e529c5..5718a02d3afb 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -22,8 +22,9 @@ * */ -#include +#include #include +#include struct snd_tea575x; @@ -35,11 +36,10 @@ struct snd_tea575x_ops { struct snd_tea575x { struct snd_card *card; - struct video_device vd; /* video device */ - struct v4l2_file_operations fops; + struct video_device *vd; /* video device */ int dev_nr; /* requested device number + 1 */ - int vd_registered; /* video device is registered */ int tea5759; /* 5759 chip is present */ + int mute; /* Device is muted? */ unsigned int freq_fixup; /* crystal onboard */ unsigned int val; /* hw value */ unsigned long freq; /* frequency */ diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 9d98a6658ac9..d31c373e076d 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,13 @@ MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); MODULE_LICENSE("GPL"); +static int radio_nr = -1; +module_param(radio_nr, int, 0); + +#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) +#define FREQ_LO (87 * 16000) +#define FREQ_HI (108 * 16000) + /* * definitions */ @@ -53,6 +61,17 @@ MODULE_LICENSE("GPL"); #define TEA575X_BIT_DUMMY (1<<15) /* buffer */ #define TEA575X_BIT_FREQ_MASK 0x7fff +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + } +}; + /* * lowlevel part */ @@ -84,94 +103,146 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) * Linux Video interface */ -static long snd_tea575x_ioctl(struct file *file, - unsigned int cmd, unsigned long data) +static int vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *v) { struct snd_tea575x *tea = video_drvdata(file); - void __user *arg = (void __user *)data; - - switch(cmd) { - case VIDIOCGCAP: - { - struct video_capability v; - v.type = VID_TYPE_TUNER; - v.channels = 1; - v.audios = 1; - /* No we don't do pictures */ - v.maxwidth = 0; - v.maxheight = 0; - v.minwidth = 0; - v.minheight = 0; - strcpy(v.name, tea->tea5759 ? "TEA5759" : "TEA5757"); - if (copy_to_user(arg,&v,sizeof(v))) - return -EFAULT; - return 0; - } - case VIDIOCGTUNER: - { - struct video_tuner v; - if (copy_from_user(&v, arg,sizeof(v))!=0) - return -EFAULT; - if (v.tuner) /* Only 1 tuner */ - return -EINVAL; - v.rangelow = (87*16000); - v.rangehigh = (108*16000); - v.flags = VIDEO_TUNER_LOW; - v.mode = VIDEO_MODE_AUTO; - strcpy(v.name, "FM"); - v.signal = 0xFFFF; - if (copy_to_user(arg, &v, sizeof(v))) - return -EFAULT; - return 0; - } - case VIDIOCSTUNER: - { - struct video_tuner v; - if(copy_from_user(&v, arg, sizeof(v))) - return -EFAULT; - if(v.tuner!=0) - return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + + strcpy(v->card, tea->tea5759 ? "TEA5759" : "TEA5757"); + strlcpy(v->driver, "tea575x-tuner", sizeof(v->driver)); + strlcpy(v->card, "Maestro Radio", sizeof(v->card)); + sprintf(v->bus_info, "PCI"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; +} + +static int vidioc_g_tuner(struct file *file, void *priv, + struct v4l2_tuner *v) +{ + if (v->index > 0) + return -EINVAL; + + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + v->rangelow = FREQ_LO; + v->rangehigh = FREQ_HI; + v->rxsubchans = V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->capability = V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal = 0xffff; + return 0; +} + +static int vidioc_s_tuner(struct file *file, void *priv, + struct v4l2_tuner *v) +{ + if (v->index > 0) + return -EINVAL; + return 0; +} + +static int vidioc_g_frequency(struct file *file, void *priv, + struct v4l2_frequency *f) +{ + struct snd_tea575x *tea = video_drvdata(file); + + f->type = V4L2_TUNER_RADIO; + f->frequency = tea->freq; + return 0; +} + +static int vidioc_s_frequency(struct file *file, void *priv, + struct v4l2_frequency *f) +{ + struct snd_tea575x *tea = video_drvdata(file); + + if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) + return -EINVAL; + + tea->freq = f->frequency; + + snd_tea575x_set_freq(tea); + + return 0; +} + +static int vidioc_g_audio(struct file *file, void *priv, + struct v4l2_audio *a) +{ + if (a->index > 1) + return -EINVAL; + + strcpy(a->name, "Radio"); + a->capability = V4L2_AUDCAP_STEREO; + return 0; +} + +static int vidioc_s_audio(struct file *file, void *priv, + struct v4l2_audio *a) +{ + if (a->index != 0) + return -EINVAL; + return 0; +} + +static int vidioc_queryctrl(struct file *file, void *priv, + struct v4l2_queryctrl *qc) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); return 0; } - case VIDIOCGFREQ: - if(copy_to_user(arg, &tea->freq, sizeof(tea->freq))) - return -EFAULT; - return 0; - case VIDIOCSFREQ: - if(copy_from_user(&tea->freq, arg, sizeof(tea->freq))) - return -EFAULT; - snd_tea575x_set_freq(tea); - return 0; - case VIDIOCGAUDIO: - { - struct video_audio v; - memset(&v, 0, sizeof(v)); - strcpy(v.name, "Radio"); - if(copy_to_user(arg,&v, sizeof(v))) - return -EFAULT; + } + return -EINVAL; +} + +static int vidioc_g_ctrl(struct file *file, void *priv, + struct v4l2_control *ctrl) +{ + struct snd_tea575x *tea = video_drvdata(file); + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (tea->ops->mute) { + ctrl->value = tea->mute; return 0; } - case VIDIOCSAUDIO: - { - struct video_audio v; - if(copy_from_user(&v, arg, sizeof(v))) - return -EFAULT; - if (tea->ops->mute) - tea->ops->mute(tea, - (v.flags & - VIDEO_AUDIO_MUTE) ? 1 : 0); - if(v.audio) - return -EINVAL; + } + return -EINVAL; +} + +static int vidioc_s_ctrl(struct file *file, void *priv, + struct v4l2_control *ctrl) +{ + struct snd_tea575x *tea = video_drvdata(file); + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (tea->ops->mute) { + tea->ops->mute(tea, ctrl->value); + tea->mute = 1; return 0; } - default: - return -ENOIOCTLCMD; } + return -EINVAL; +} + +static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) +{ + *i = 0; + return 0; } -static void snd_tea575x_release(struct video_device *vfd) +static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) { + if (i != 0) + return -EINVAL; + return 0; } static int snd_tea575x_exclusive_open(struct file *file) @@ -189,50 +260,91 @@ static int snd_tea575x_exclusive_release(struct file *file) return 0; } +static const struct v4l2_file_operations tea575x_fops = { + .owner = THIS_MODULE, + .open = snd_tea575x_exclusive_open, + .release = snd_tea575x_exclusive_release, + .ioctl = video_ioctl2, +}; + +static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { + .vidioc_querycap = vidioc_querycap, + .vidioc_g_tuner = vidioc_g_tuner, + .vidioc_s_tuner = vidioc_s_tuner, + .vidioc_g_audio = vidioc_g_audio, + .vidioc_s_audio = vidioc_s_audio, + .vidioc_g_input = vidioc_g_input, + .vidioc_s_input = vidioc_s_input, + .vidioc_g_frequency = vidioc_g_frequency, + .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_s_ctrl = vidioc_s_ctrl, +}; + +static struct video_device tea575x_radio = { + .name = "tea575x-tuner", + .fops = &tea575x_fops, + .ioctl_ops = &tea575x_ioctl_ops, + .release = video_device_release, +}; + /* * initialize all the tea575x chips */ void snd_tea575x_init(struct snd_tea575x *tea) { + int retval; unsigned int val; + struct video_device *tea575x_radio_inst; val = tea->ops->read(tea); if (val == 0x1ffffff || val == 0) { - snd_printk(KERN_ERR "Cannot find TEA575x chip\n"); + snd_printk(KERN_ERR + "tea575x-tuner: Cannot find TEA575x chip\n"); return; } - memset(&tea->vd, 0, sizeof(tea->vd)); - strcpy(tea->vd.name, tea->tea5759 ? "TEA5759 radio" : "TEA5757 radio"); - tea->vd.release = snd_tea575x_release; - video_set_drvdata(&tea->vd, tea); - tea->vd.fops = &tea->fops; tea->in_use = 0; - tea->fops.owner = tea->card->module; - tea->fops.open = snd_tea575x_exclusive_open; - tea->fops.release = snd_tea575x_exclusive_release; - tea->fops.ioctl = snd_tea575x_ioctl; - if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { - snd_printk(KERN_ERR "unable to register tea575x tuner\n"); + tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40; + tea->freq = 90500 * 16; /* 90.5Mhz default */ + + tea575x_radio_inst = video_device_alloc(); + if (tea575x_radio_inst == NULL) { + printk(KERN_ERR "tea575x-tuner: not enough memory\n"); return; } - tea->vd_registered = 1; - tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40; - tea->freq = 90500 * 16; /* 90.5Mhz default */ + memcpy(tea575x_radio_inst, &tea575x_radio, sizeof(tea575x_radio)); + + strcpy(tea575x_radio.name, tea->tea5759 ? + "TEA5759 radio" : "TEA5757 radio"); + + video_set_drvdata(tea575x_radio_inst, tea); + + retval = video_register_device(tea575x_radio_inst, + VFL_TYPE_RADIO, radio_nr); + if (retval) { + printk(KERN_ERR "tea575x-tuner: can't register video device!\n"); + kfree(tea575x_radio_inst); + return; + } snd_tea575x_set_freq(tea); /* mute on init */ - if (tea->ops->mute) + if (tea->ops->mute) { tea->ops->mute(tea, 1); + tea->mute = 1; + } + tea->vd = tea575x_radio_inst; } void snd_tea575x_exit(struct snd_tea575x *tea) { - if (tea->vd_registered) { - video_unregister_device(&tea->vd); - tea->vd_registered = 0; + if (tea->vd) { + video_unregister_device(tea->vd); + tea->vd = NULL; } } diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index ca25e6179d76..93422e3a3f0c 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -507,7 +507,7 @@ config SND_FM801 config SND_FM801_TEA575X_BOOL bool "ForteMedia FM801 + TEA5757 tuner" depends on SND_FM801 - depends on VIDEO_V4L1=y || VIDEO_V4L1=SND_FM801 + depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_FM801 help Say Y here to include support for soundcards based on the ForteMedia FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media -- cgit v1.2.3 From 99b76233803beab302123d243eea9e41149804f3 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Wed, 25 Mar 2009 22:48:06 +0300 Subject: proc 2/2: remove struct proc_dir_entry::owner Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy as correctly noted at bug #12454. Someone can lookup entry with NULL ->owner, thus not pinning enything, and release it later resulting in module refcount underflow. We can keep ->owner and supply it at registration time like ->proc_fops and ->data. But this leaves ->owner as easy-manipulative field (just one C assignment) and somebody will forget to unpin previous/pin current module when switching ->owner. ->proc_fops is declared as "const" which should give some thoughts. ->read_proc/->write_proc were just fixed to not require ->owner for protection. rmmod'ed directories will be empty and return "." and ".." -- no harm. And directories with tricky enough readdir and lookup shouldn't be modular. We definitely don't want such modular code. Removing ->owner will also make PDE smaller. So, let's nuke it. Kudos to Jeff Layton for reminding about this, let's say, oversight. http://bugzilla.kernel.org/show_bug.cgi?id=12454 Signed-off-by: Alexey Dobriyan --- Documentation/DocBook/procfs_example.c | 9 --------- arch/alpha/kernel/srm_env.c | 5 ----- arch/blackfin/mm/sram-alloc.c | 1 - arch/ia64/kernel/palinfo.c | 2 -- arch/ia64/sn/kernel/sn2/prominfo_proc.c | 9 ++------- arch/powerpc/kernel/rtas_flash.c | 1 - arch/sparc/kernel/led.c | 1 - arch/x86/kernel/cpu/mtrr/if.c | 10 +--------- drivers/acpi/ac.c | 1 - drivers/acpi/battery.c | 1 - drivers/acpi/button.c | 3 --- drivers/acpi/fan.c | 2 -- drivers/acpi/processor_core.c | 2 -- drivers/acpi/sbs.c | 1 - drivers/acpi/thermal.c | 2 -- drivers/acpi/video.c | 5 ----- drivers/block/ps3vram.c | 2 -- drivers/char/ipmi/ipmi_msghandler.c | 12 ++++------- drivers/char/ipmi/ipmi_si_intf.c | 6 +++--- drivers/input/input.c | 2 -- drivers/isdn/hardware/eicon/divasi.c | 1 - drivers/media/video/cpia.c | 4 +--- drivers/message/i2o/i2o_proc.c | 2 -- drivers/net/bonding/bond_main.c | 35 ++------------------------------- drivers/net/irda/vlsi_ir.c | 7 ------- drivers/net/wireless/airo.c | 1 - drivers/platform/x86/asus_acpi.c | 3 --- drivers/platform/x86/thinkpad_acpi.c | 2 -- drivers/platform/x86/toshiba_acpi.c | 3 --- drivers/rtc/rtc-proc.c | 10 ++-------- drivers/s390/block/dasd_proc.c | 2 -- drivers/scsi/scsi_devinfo.c | 2 -- drivers/scsi/scsi_proc.c | 3 --- drivers/video/via/viafbdev.c | 5 ----- fs/afs/proc.c | 1 - fs/cifs/cifs_debug.c | 1 - fs/jfs/jfs_debug.c | 1 - fs/nfs/client.c | 2 -- fs/proc/inode.c | 19 +++--------------- fs/proc/proc_tty.c | 1 - fs/reiserfs/procfs.c | 5 +---- include/linux/ipmi_smi.h | 2 +- include/linux/proc_fs.h | 4 ---- net/appletalk/atalk_proc.c | 1 - net/atm/mpoa_proc.c | 1 - net/atm/proc.c | 1 - net/can/bcm.c | 4 ---- net/can/proc.c | 2 -- net/core/pktgen.c | 1 - net/irda/irproc.c | 1 - net/llc/llc_proc.c | 1 - net/sctp/protocol.c | 8 ++------ net/sunrpc/cache.c | 4 ---- net/sunrpc/stats.c | 10 ++-------- sound/core/info.c | 31 ++--------------------------- 55 files changed, 26 insertions(+), 232 deletions(-) (limited to 'sound') diff --git a/Documentation/DocBook/procfs_example.c b/Documentation/DocBook/procfs_example.c index 8c6396e4bf31..a5b11793b1e0 100644 --- a/Documentation/DocBook/procfs_example.c +++ b/Documentation/DocBook/procfs_example.c @@ -117,9 +117,6 @@ static int __init init_procfs_example(void) rv = -ENOMEM; goto out; } - - example_dir->owner = THIS_MODULE; - /* create jiffies using convenience function */ jiffies_file = create_proc_read_entry("jiffies", 0444, example_dir, @@ -130,8 +127,6 @@ static int __init init_procfs_example(void) goto no_jiffies; } - jiffies_file->owner = THIS_MODULE; - /* create foo and bar files using same callback * functions */ @@ -146,7 +141,6 @@ static int __init init_procfs_example(void) foo_file->data = &foo_data; foo_file->read_proc = proc_read_foobar; foo_file->write_proc = proc_write_foobar; - foo_file->owner = THIS_MODULE; bar_file = create_proc_entry("bar", 0644, example_dir); if(bar_file == NULL) { @@ -159,7 +153,6 @@ static int __init init_procfs_example(void) bar_file->data = &bar_data; bar_file->read_proc = proc_read_foobar; bar_file->write_proc = proc_write_foobar; - bar_file->owner = THIS_MODULE; /* create symlink */ symlink = proc_symlink("jiffies_too", example_dir, @@ -169,8 +162,6 @@ static int __init init_procfs_example(void) goto no_symlink; } - symlink->owner = THIS_MODULE; - /* everything OK */ printk(KERN_INFO "%s %s initialised\n", MODULE_NAME, MODULE_VERS); diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c index 78ad7cd1bbd6..d12af472e1c0 100644 --- a/arch/alpha/kernel/srm_env.c +++ b/arch/alpha/kernel/srm_env.c @@ -218,7 +218,6 @@ srm_env_init(void) BASE_DIR); goto cleanup; } - base_dir->owner = THIS_MODULE; /* * Create per-name subdirectory @@ -229,7 +228,6 @@ srm_env_init(void) BASE_DIR, NAMED_DIR); goto cleanup; } - named_dir->owner = THIS_MODULE; /* * Create per-number subdirectory @@ -241,7 +239,6 @@ srm_env_init(void) goto cleanup; } - numbered_dir->owner = THIS_MODULE; /* * Create all named nodes @@ -254,7 +251,6 @@ srm_env_init(void) goto cleanup; entry->proc_entry->data = (void *) entry; - entry->proc_entry->owner = THIS_MODULE; entry->proc_entry->read_proc = srm_env_read; entry->proc_entry->write_proc = srm_env_write; @@ -275,7 +271,6 @@ srm_env_init(void) entry->id = var_num; entry->proc_entry->data = (void *) entry; - entry->proc_entry->owner = THIS_MODULE; entry->proc_entry->read_proc = srm_env_read; entry->proc_entry->write_proc = srm_env_write; } diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c index 834cab7438a8..530d1393a232 100644 --- a/arch/blackfin/mm/sram-alloc.c +++ b/arch/blackfin/mm/sram-alloc.c @@ -854,7 +854,6 @@ static int __init sram_proc_init(void) printk(KERN_WARNING "unable to create /proc/sram\n"); return -1; } - ptr->owner = THIS_MODULE; ptr->read_proc = sram_proc_read; return 0; } diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c index e5c57f413ca2..a4f19c70aadd 100644 --- a/arch/ia64/kernel/palinfo.c +++ b/arch/ia64/kernel/palinfo.c @@ -1002,8 +1002,6 @@ create_palinfo_proc_entries(unsigned int cpu) *pdir = create_proc_read_entry( palinfo_entries[j].name, 0, cpu_dir, palinfo_read_entry, (void *)f.value); - if (*pdir) - (*pdir)->owner = THIS_MODULE; pdir++; } } diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c index 4dcce3d0e04c..e63328818643 100644 --- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c +++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c @@ -225,7 +225,6 @@ static struct proc_dir_entry *sgi_prominfo_entry; int __init prominfo_init(void) { struct proc_dir_entry **entp; - struct proc_dir_entry *p; cnodeid_t cnodeid; unsigned long nasid; int size; @@ -246,14 +245,10 @@ int __init prominfo_init(void) sprintf(name, "node%d", cnodeid); *entp = proc_mkdir(name, sgi_prominfo_entry); nasid = cnodeid_to_nasid(cnodeid); - p = create_proc_read_entry("fit", 0, *entp, read_fit_entry, + create_proc_read_entry("fit", 0, *entp, read_fit_entry, (void *)nasid); - if (p) - p->owner = THIS_MODULE; - p = create_proc_read_entry("version", 0, *entp, + create_proc_read_entry("version", 0, *entp, read_version_entry, (void *)nasid); - if (p) - p->owner = THIS_MODULE; entp++; } diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 149cb112cd1a..13011a96a977 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c @@ -669,7 +669,6 @@ static void remove_flash_pde(struct proc_dir_entry *dp) { if (dp) { kfree(dp->data); - dp->owner = NULL; remove_proc_entry(dp->name, dp->parent); } } diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c index adaaed4ea2fb..00d034ea2164 100644 --- a/arch/sparc/kernel/led.c +++ b/arch/sparc/kernel/led.c @@ -126,7 +126,6 @@ static int __init led_init(void) led = proc_create("led", 0, NULL, &led_proc_fops); if (!led) return -ENOMEM; - led->owner = THIS_MODULE; printk(KERN_INFO "led: version %s, Lars Kotthoff \n", diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 4c4214690dd1..fb73a52913a4 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c @@ -377,10 +377,6 @@ static const struct file_operations mtrr_fops = { .release = mtrr_close, }; - -static struct proc_dir_entry *proc_root_mtrr; - - static int mtrr_seq_show(struct seq_file *seq, void *offset) { char factor; @@ -423,11 +419,7 @@ static int __init mtrr_if_init(void) (!cpu_has(c, X86_FEATURE_CENTAUR_MCR))) return -ENODEV; - proc_root_mtrr = - proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops); - - if (proc_root_mtrr) - proc_root_mtrr->owner = THIS_MODULE; + proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops); return 0; } diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 9b917dac7732..88e42abf5d88 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -191,7 +191,6 @@ static int acpi_ac_add_fs(struct acpi_device *device) acpi_ac_dir); if (!acpi_device_dir(device)) return -ENODEV; - acpi_device_dir(device)->owner = THIS_MODULE; } /* 'state' [R] */ diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 69cbc57c2d1c..3bcb5bfc45d3 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -760,7 +760,6 @@ static int acpi_battery_add_fs(struct acpi_device *device) acpi_battery_dir); if (!acpi_device_dir(device)) return -ENODEV; - acpi_device_dir(device)->owner = THIS_MODULE; } for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 171fd914f435..c2f06069dcd4 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -200,12 +200,10 @@ static int acpi_button_add_fs(struct acpi_device *device) if (!entry) return -ENODEV; - entry->owner = THIS_MODULE; acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); if (!acpi_device_dir(device)) return -ENODEV; - acpi_device_dir(device)->owner = THIS_MODULE; /* 'info' [R] */ entry = proc_create_data(ACPI_BUTTON_FILE_INFO, @@ -522,7 +520,6 @@ static int __init acpi_button_init(void) acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); if (!acpi_button_dir) return -ENODEV; - acpi_button_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_button_driver); if (result < 0) { remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index eaaee1660bdf..8a02944bf92d 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -193,7 +193,6 @@ static int acpi_fan_add_fs(struct acpi_device *device) acpi_fan_dir); if (!acpi_device_dir(device)) return -ENODEV; - acpi_device_dir(device)->owner = THIS_MODULE; } /* 'status' [R/W] */ @@ -347,7 +346,6 @@ static int __init acpi_fan_init(void) acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); if (!acpi_fan_dir) return -ENODEV; - acpi_fan_dir->owner = THIS_MODULE; #endif result = acpi_bus_register_driver(&acpi_fan_driver); diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 0cc2fd31e376..fa2f7422d23d 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -359,7 +359,6 @@ static int acpi_processor_add_fs(struct acpi_device *device) if (!acpi_device_dir(device)) return -ENODEV; } - acpi_device_dir(device)->owner = THIS_MODULE; /* 'info' [R] */ entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, @@ -1137,7 +1136,6 @@ static int __init acpi_processor_init(void) acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); if (!acpi_processor_dir) return -ENOMEM; - acpi_processor_dir->owner = THIS_MODULE; /* * Check whether the system is DMI table. If yes, OSPM diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 6050ce481873..59afd52ccc12 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -488,7 +488,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir, if (!*dir) { return -ENODEV; } - (*dir)->owner = THIS_MODULE; } /* 'info' [R] */ diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 99e6f1f8ea45..c11f9aeca706 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -1506,7 +1506,6 @@ static int acpi_thermal_add_fs(struct acpi_device *device) acpi_thermal_dir); if (!acpi_device_dir(device)) return -ENODEV; - acpi_device_dir(device)->owner = THIS_MODULE; } /* 'state' [R] */ @@ -1875,7 +1874,6 @@ static int __init acpi_thermal_init(void) acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); if (!acpi_thermal_dir) return -ENODEV; - acpi_thermal_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_thermal_driver); if (result < 0) { diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bb5ed059114a..67cc36dc9b82 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -1125,8 +1125,6 @@ static int acpi_video_device_add_fs(struct acpi_device *device) if (!device_dir) return -ENOMEM; - device_dir->owner = THIS_MODULE; - /* 'info' [R] */ entry = proc_create_data("info", S_IRUGO, device_dir, &acpi_video_device_info_fops, acpi_driver_data(device)); @@ -1403,8 +1401,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) if (!device_dir) return -ENOMEM; - device_dir->owner = THIS_MODULE; - /* 'info' [R] */ entry = proc_create_data("info", S_IRUGO, device_dir, &acpi_video_bus_info_fops, @@ -2131,7 +2127,6 @@ static int __init acpi_video_init(void) acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); if (!acpi_video_dir) return -ENODEV; - acpi_video_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_video_bus); if (result < 0) { diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 393ed6760d78..8eddef373a91 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -551,8 +551,6 @@ static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev) dev_warn(&dev->core, "failed to create /proc entry\n"); return; } - - pde->owner = THIS_MODULE; pde->data = priv; } diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 7a88dfd4427b..e93fc8d22fb2 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -1944,7 +1944,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off, int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, read_proc_t *read_proc, - void *data, struct module *owner) + void *data) { int rv = 0; #ifdef CONFIG_PROC_FS @@ -1970,7 +1970,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, } else { file->data = data; file->read_proc = read_proc; - file->owner = owner; mutex_lock(&smi->proc_entry_lock); /* Stick it on the list. */ @@ -1993,23 +1992,21 @@ static int add_proc_entries(ipmi_smi_t smi, int num) smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root); if (!smi->proc_dir) rv = -ENOMEM; - else - smi->proc_dir->owner = THIS_MODULE; if (rv == 0) rv = ipmi_smi_add_proc_entry(smi, "stats", stat_file_read_proc, - smi, THIS_MODULE); + smi); if (rv == 0) rv = ipmi_smi_add_proc_entry(smi, "ipmb", ipmb_file_read_proc, - smi, THIS_MODULE); + smi); if (rv == 0) rv = ipmi_smi_add_proc_entry(smi, "version", version_file_read_proc, - smi, THIS_MODULE); + smi); #endif /* CONFIG_PROC_FS */ return rv; @@ -4265,7 +4262,6 @@ static int ipmi_init_msghandler(void) return -ENOMEM; } - proc_ipmi_root->owner = THIS_MODULE; #endif /* CONFIG_PROC_FS */ setup_timer(&ipmi_timer, ipmi_timeout, 0); diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 3000135f2ead..e58ea4cd55ce 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -2899,7 +2899,7 @@ static int try_smi_init(struct smi_info *new_smi) rv = ipmi_smi_add_proc_entry(new_smi->intf, "type", type_file_read_proc, - new_smi, THIS_MODULE); + new_smi); if (rv) { printk(KERN_ERR "ipmi_si: Unable to create proc entry: %d\n", @@ -2909,7 +2909,7 @@ static int try_smi_init(struct smi_info *new_smi) rv = ipmi_smi_add_proc_entry(new_smi->intf, "si_stats", stat_file_read_proc, - new_smi, THIS_MODULE); + new_smi); if (rv) { printk(KERN_ERR "ipmi_si: Unable to create proc entry: %d\n", @@ -2919,7 +2919,7 @@ static int try_smi_init(struct smi_info *new_smi) rv = ipmi_smi_add_proc_entry(new_smi->intf, "params", param_read_proc, - new_smi, THIS_MODULE); + new_smi); if (rv) { printk(KERN_ERR "ipmi_si: Unable to create proc entry: %d\n", diff --git a/drivers/input/input.c b/drivers/input/input.c index 1730d7331a5d..ec3db3ade118 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -903,8 +903,6 @@ static int __init input_proc_init(void) if (!proc_bus_input_dir) return -ENOMEM; - proc_bus_input_dir->owner = THIS_MODULE; - entry = proc_create("devices", 0, proc_bus_input_dir, &input_devices_fileops); if (!entry) diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c index f4969fe0a055..69e71ebe7841 100644 --- a/drivers/isdn/hardware/eicon/divasi.c +++ b/drivers/isdn/hardware/eicon/divasi.c @@ -118,7 +118,6 @@ static int DIVA_INIT_FUNCTION create_um_idi_proc(void) return (0); um_idi_proc_entry->read_proc = um_idi_proc_read; - um_idi_proc_entry->owner = THIS_MODULE; return (1); } diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index c3b0c8c63c76..43ab0adf3b61 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -1381,9 +1381,7 @@ static void proc_cpia_create(void) { cpia_proc_root = proc_mkdir("cpia", NULL); - if (cpia_proc_root) - cpia_proc_root->owner = THIS_MODULE; - else + if (!cpia_proc_root) LOG("Unable to initialise /proc/cpia\n"); } diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c index 9a36b5a7de57..7045c45da9b1 100644 --- a/drivers/message/i2o/i2o_proc.c +++ b/drivers/message/i2o/i2o_proc.c @@ -2037,8 +2037,6 @@ static int __init i2o_proc_fs_create(void) if (!i2o_proc_dir_root) return -1; - i2o_proc_dir_root->owner = THIS_MODULE; - list_for_each_entry(c, &i2o_controllers, list) i2o_proc_iop_add(i2o_proc_dir_root, c); diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 9c326a50a3ee..99610f358c40 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3444,25 +3444,12 @@ static void bond_remove_proc_entry(struct bonding *bond) */ static void bond_create_proc_dir(void) { - int len = strlen(DRV_NAME); - - for (bond_proc_dir = init_net.proc_net->subdir; bond_proc_dir; - bond_proc_dir = bond_proc_dir->next) { - if ((bond_proc_dir->namelen == len) && - !memcmp(bond_proc_dir->name, DRV_NAME, len)) { - break; - } - } - if (!bond_proc_dir) { bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net); - if (bond_proc_dir) { - bond_proc_dir->owner = THIS_MODULE; - } else { + if (!bond_proc_dir) printk(KERN_WARNING DRV_NAME ": Warning: cannot create /proc/net/%s\n", DRV_NAME); - } } } @@ -3471,25 +3458,7 @@ static void bond_create_proc_dir(void) */ static void bond_destroy_proc_dir(void) { - struct proc_dir_entry *de; - - if (!bond_proc_dir) { - return; - } - - /* verify that the /proc dir is empty */ - for (de = bond_proc_dir->subdir; de; de = de->next) { - /* ignore . and .. */ - if (*(de->name) != '.') { - break; - } - } - - if (de) { - if (bond_proc_dir->owner == THIS_MODULE) { - bond_proc_dir->owner = NULL; - } - } else { + if (bond_proc_dir) { remove_proc_entry(DRV_NAME, init_net.proc_net); bond_proc_dir = NULL; } diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 1243bc8e0035..ac0e4b6b6b66 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c @@ -1871,13 +1871,6 @@ static int __init vlsi_mod_init(void) * without procfs - it's not required for the driver to work. */ vlsi_proc_root = proc_mkdir(PROC_DIR, NULL); - if (vlsi_proc_root) { - /* protect registered procdir against module removal. - * Because we are in the module init path there's no race - * window after create_proc_entry (and no barrier needed). - */ - vlsi_proc_root->owner = THIS_MODULE; - } ret = pci_register_driver(&vlsi_irda_driver); diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 7e80aba8a148..31b1cc2b778a 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4494,7 +4494,6 @@ static int setup_proc_entry( struct net_device *dev, goto fail; apriv->proc_entry->uid = proc_uid; apriv->proc_entry->gid = proc_gid; - apriv->proc_entry->owner = THIS_MODULE; /* Setup the StatsDelta */ entry = proc_create_data("StatsDelta", diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index d63f26e666a4..ba1f7497e4b9 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c @@ -987,7 +987,6 @@ asus_proc_add(char *name, proc_writefunc *writefunc, proc->write_proc = writefunc; proc->read_proc = readfunc; proc->data = acpi_driver_data(device); - proc->owner = THIS_MODULE; proc->uid = asus_uid; proc->gid = asus_gid; return 0; @@ -1020,7 +1019,6 @@ static int asus_hotk_add_fs(struct acpi_device *device) if (proc) { proc->read_proc = proc_read_info; proc->data = acpi_driver_data(device); - proc->owner = THIS_MODULE; proc->uid = asus_uid; proc->gid = asus_gid; } else { @@ -1436,7 +1434,6 @@ static int __init asus_acpi_init(void) printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); return -ENODEV; } - asus_proc_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&asus_hotk_driver); if (result < 0) { diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index d2433204a40c..3dad27a385d3 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -6992,7 +6992,6 @@ static int __init ibm_init(struct ibm_init_struct *iibm) ret = -ENODEV; goto err_out; } - entry->owner = THIS_MODULE; entry->data = ibm; entry->read_proc = &dispatch_procfs_read; if (ibm->write) @@ -7405,7 +7404,6 @@ static int __init thinkpad_acpi_module_init(void) thinkpad_acpi_module_exit(); return -ENODEV; } - proc_dir->owner = THIS_MODULE; ret = platform_driver_register(&tpacpi_pdriver); if (ret) { diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 40e60fc2e596..9f187265db8e 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -679,8 +679,6 @@ static acpi_status __init add_device(void) toshiba_proc_dir, (read_proc_t *) dispatch_read, item); - if (proc) - proc->owner = THIS_MODULE; if (proc && item->write_func) proc->write_proc = (write_proc_t *) dispatch_write; } @@ -772,7 +770,6 @@ static int __init toshiba_acpi_init(void) toshiba_acpi_exit(); return -ENODEV; } else { - toshiba_proc_dir->owner = THIS_MODULE; status = add_device(); if (ACPI_FAILURE(status)) { toshiba_acpi_exit(); diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index 0c6257a034ff..c086fc30a84c 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c @@ -105,14 +105,8 @@ static const struct file_operations rtc_proc_fops = { void rtc_proc_add_device(struct rtc_device *rtc) { - if (rtc->id == 0) { - struct proc_dir_entry *ent; - - ent = proc_create_data("driver/rtc", 0, NULL, - &rtc_proc_fops, rtc); - if (ent) - ent->owner = rtc->owner; - } + if (rtc->id == 0) + proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc); } void rtc_proc_del_device(struct rtc_device *rtc) diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c index 2080ba6a69b0..654daa3cdfda 100644 --- a/drivers/s390/block/dasd_proc.c +++ b/drivers/s390/block/dasd_proc.c @@ -320,7 +320,6 @@ dasd_proc_init(void) dasd_proc_root_entry = proc_mkdir("dasd", NULL); if (!dasd_proc_root_entry) goto out_nodasd; - dasd_proc_root_entry->owner = THIS_MODULE; dasd_devices_entry = proc_create("devices", S_IFREG | S_IRUGO | S_IWUSR, dasd_proc_root_entry, @@ -334,7 +333,6 @@ dasd_proc_init(void) goto out_nostatistics; dasd_statistics_entry->read_proc = dasd_statistics_read; dasd_statistics_entry->write_proc = dasd_statistics_write; - dasd_statistics_entry->owner = THIS_MODULE; return 0; out_nostatistics: diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 099b5455bbce..b13481369642 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c @@ -596,8 +596,6 @@ int __init scsi_init_devinfo(void) error = -ENOMEM; goto out; } - - p->owner = THIS_MODULE; #endif /* CONFIG_SCSI_PROC_FS */ out: diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 82f7b2dd08a2..77fbddb507fd 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -115,8 +115,6 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht) if (!sht->proc_dir) printk(KERN_ERR "%s: proc_mkdir failed for %s\n", __func__, sht->proc_name); - else - sht->proc_dir->owner = sht->module; } mutex_unlock(&global_host_template_mutex); } @@ -163,7 +161,6 @@ void scsi_proc_host_add(struct Scsi_Host *shost) } p->write_proc = proc_scsi_write_proc; - p->owner = sht->module; } /** diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 37b433a08ce8..e327b84820d2 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -2059,25 +2059,21 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry) if (viafb_entry) { entry = create_proc_entry("dvp0", 0, *viafb_entry); if (entry) { - entry->owner = THIS_MODULE; entry->read_proc = viafb_dvp0_proc_read; entry->write_proc = viafb_dvp0_proc_write; } entry = create_proc_entry("dvp1", 0, *viafb_entry); if (entry) { - entry->owner = THIS_MODULE; entry->read_proc = viafb_dvp1_proc_read; entry->write_proc = viafb_dvp1_proc_write; } entry = create_proc_entry("dfph", 0, *viafb_entry); if (entry) { - entry->owner = THIS_MODULE; entry->read_proc = viafb_dfph_proc_read; entry->write_proc = viafb_dfph_proc_write; } entry = create_proc_entry("dfpl", 0, *viafb_entry); if (entry) { - entry->owner = THIS_MODULE; entry->read_proc = viafb_dfpl_proc_read; entry->write_proc = viafb_dfpl_proc_write; } @@ -2086,7 +2082,6 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry) viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { entry = create_proc_entry("vt1636", 0, *viafb_entry); if (entry) { - entry->owner = THIS_MODULE; entry->read_proc = viafb_vt1636_proc_read; entry->write_proc = viafb_vt1636_proc_write; } diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 7578c1ab9e0b..8630615e57fe 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -146,7 +146,6 @@ int afs_proc_init(void) proc_afs = proc_mkdir("fs/afs", NULL); if (!proc_afs) goto error_dir; - proc_afs->owner = THIS_MODULE; p = proc_create("cells", 0, proc_afs, &afs_proc_cells_fops); if (!p) diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 877e4d9a1159..7f19fefd3d45 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -404,7 +404,6 @@ cifs_proc_init(void) if (proc_fs_cifs == NULL) return; - proc_fs_cifs->owner = THIS_MODULE; proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops); #ifdef CONFIG_CIFS_STATS diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c index 6a73de84bcef..dd824d9b0b1a 100644 --- a/fs/jfs/jfs_debug.c +++ b/fs/jfs/jfs_debug.c @@ -90,7 +90,6 @@ void jfs_proc_init(void) if (!(base = proc_mkdir("fs/jfs", NULL))) return; - base->owner = THIS_MODULE; for (i = 0; i < NPROCENT; i++) proc_create(Entries[i].name, 0, base, Entries[i].proc_fops); diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 574158ae2398..2277421656e7 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1606,8 +1606,6 @@ int __init nfs_fs_proc_init(void) if (!proc_fs_nfs) goto error_0; - proc_fs_nfs->owner = THIS_MODULE; - /* a file of servers with which we're dealing */ p = proc_create("servers", S_IFREG|S_IRUGO, proc_fs_nfs, &nfs_server_list_fops); diff --git a/fs/proc/inode.c b/fs/proc/inode.c index e11dc22c6511..d78ade305541 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -58,11 +58,8 @@ static void proc_delete_inode(struct inode *inode) /* Let go of any associated proc directory entry */ de = PROC_I(inode)->pde; - if (de) { - if (de->owner) - module_put(de->owner); + if (de) de_put(de); - } if (PROC_I(inode)->sysctl) sysctl_head_put(PROC_I(inode)->sysctl); clear_inode(inode); @@ -449,12 +446,9 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, { struct inode * inode; - if (!try_module_get(de->owner)) - goto out_mod; - inode = iget_locked(sb, ino); if (!inode) - goto out_ino; + return NULL; if (inode->i_state & I_NEW) { inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; PROC_I(inode)->fd = 0; @@ -485,16 +479,9 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, } } unlock_new_inode(inode); - } else { - module_put(de->owner); + } else de_put(de); - } return inode; - -out_ino: - module_put(de->owner); -out_mod: - return NULL; } int proc_fill_super(struct super_block *s) diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index d153946d6d15..4a9e0f65ae60 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c @@ -152,7 +152,6 @@ void proc_tty_register_driver(struct tty_driver *driver) if (!ent) return; ent->read_proc = driver->ops->read_proc; - ent->owner = driver->owner; ent->data = driver; driver->proc_entry = ent; diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index d5066400638a..9229e5514a4e 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c @@ -492,7 +492,6 @@ int reiserfs_proc_info_init(struct super_block *sb) spin_lock_init(&__PINFO(sb).lock); REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root); if (REISERFS_SB(sb)->procdir) { - REISERFS_SB(sb)->procdir->owner = THIS_MODULE; REISERFS_SB(sb)->procdir->data = sb; add_file(sb, "version", show_version); add_file(sb, "super", show_super); @@ -556,9 +555,7 @@ int reiserfs_proc_info_global_init(void) { if (proc_info_root == NULL) { proc_info_root = proc_mkdir(proc_info_root_name, NULL); - if (proc_info_root) { - proc_info_root->owner = THIS_MODULE; - } else { + if (!proc_info_root) { reiserfs_warning(NULL, "cannot create /proc/%s", proc_info_root_name); return 1; diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 62b73668b602..f7c9c75a2775 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -230,6 +230,6 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) automatically be dstroyed when the interface is destroyed. */ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, read_proc_t *read_proc, - void *data, struct module *owner); + void *data); #endif /* __LINUX_IPMI_SMI_H */ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index b8bdb96eff78..fbfa3d44d33d 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -41,9 +41,6 @@ enum { * while parent/subdir create the directory structure (every * /proc file has a parent, but "subdir" is NULL for all * non-directory entries). - * - * "owner" is used to protect module - * from unloading while proc_dir_entry is in use */ typedef int (read_proc_t)(char *page, char **start, off_t off, @@ -70,7 +67,6 @@ struct proc_dir_entry { * somewhere. */ const struct file_operations *proc_fops; - struct module *owner; struct proc_dir_entry *next, *parent, *subdir; void *data; read_proc_t *read_proc; diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index 162199a2d74f..fd8e0847b254 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c @@ -281,7 +281,6 @@ int __init atalk_proc_init(void) atalk_proc_dir = proc_mkdir("atalk", init_net.proc_net); if (!atalk_proc_dir) goto out; - atalk_proc_dir->owner = THIS_MODULE; p = proc_create("interface", S_IRUGO, atalk_proc_dir, &atalk_seq_interface_fops); diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c index 4990541ef5da..1a0f5ccea9c4 100644 --- a/net/atm/mpoa_proc.c +++ b/net/atm/mpoa_proc.c @@ -281,7 +281,6 @@ int mpc_proc_init(void) printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); return -ENOMEM; } - p->owner = THIS_MODULE; return 0; } diff --git a/net/atm/proc.c b/net/atm/proc.c index 49487b313f22..e7b3b273907d 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c @@ -476,7 +476,6 @@ int __init atm_proc_init(void) atm_proc_root, e->proc_fops); if (!dirent) goto err_out_remove; - dirent->owner = THIS_MODULE; e->dirent = dirent; } ret = 0; diff --git a/net/can/bcm.c b/net/can/bcm.c index b7c7d4651136..95d7f32643ae 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1604,10 +1604,6 @@ static int __init bcm_module_init(void) /* create /proc/net/can-bcm directory */ proc_dir = proc_mkdir("can-bcm", init_net.proc_net); - - if (proc_dir) - proc_dir->owner = THIS_MODULE; - return 0; } diff --git a/net/can/proc.c b/net/can/proc.c index 520fef5e5398..1463653dbe34 100644 --- a/net/can/proc.c +++ b/net/can/proc.c @@ -473,8 +473,6 @@ void can_init_proc(void) return; } - can_dir->owner = THIS_MODULE; - /* own procfs entries from the AF_CAN core */ pde_version = can_create_proc_readentry(CAN_PROC_VERSION, 0644, can_proc_read_version, NULL); diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 32d419f5ac98..3779c1438c11 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3806,7 +3806,6 @@ static int __init pg_init(void) pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net); if (!pg_proc_dir) return -ENODEV; - pg_proc_dir->owner = THIS_MODULE; pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops); if (pe == NULL) { diff --git a/net/irda/irproc.c b/net/irda/irproc.c index 88e80a312732..8ff1861649e8 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -70,7 +70,6 @@ void __init irda_proc_register(void) proc_irda = proc_mkdir("irda", init_net.proc_net); if (proc_irda == NULL) return; - proc_irda->owner = THIS_MODULE; for (i = 0; i < ARRAY_SIZE(irda_dirs); i++) d = proc_create(irda_dirs[i].name, 0, proc_irda, diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c index b58bd7c6cdf8..d208b3396d94 100644 --- a/net/llc/llc_proc.c +++ b/net/llc/llc_proc.c @@ -236,7 +236,6 @@ int __init llc_proc_init(void) llc_proc_dir = proc_mkdir("llc", init_net.proc_net); if (!llc_proc_dir) goto out; - llc_proc_dir->owner = THIS_MODULE; p = proc_create("socket", S_IRUGO, llc_proc_dir, &llc_seq_socket_fops); if (!p) diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index cb198af8887c..8eb3e61cb701 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -106,12 +106,8 @@ static __init int sctp_proc_init(void) goto out_nomem; #ifdef CONFIG_PROC_FS if (!proc_net_sctp) { - struct proc_dir_entry *ent; - ent = proc_mkdir("sctp", init_net.proc_net); - if (ent) { - ent->owner = THIS_MODULE; - proc_net_sctp = ent; - } else + proc_net_sctp = proc_mkdir("sctp", init_net.proc_net); + if (!proc_net_sctp) goto out_free_percpu; } diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 4735caad26ed..20029a79a5de 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -313,7 +313,6 @@ static int create_cache_proc_entries(struct cache_detail *cd) cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc); if (cd->proc_ent == NULL) goto out_nomem; - cd->proc_ent->owner = cd->owner; cd->channel_ent = cd->content_ent = NULL; p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR, @@ -321,7 +320,6 @@ static int create_cache_proc_entries(struct cache_detail *cd) cd->flush_ent = p; if (p == NULL) goto out_nomem; - p->owner = cd->owner; if (cd->cache_request || cd->cache_parse) { p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, @@ -329,7 +327,6 @@ static int create_cache_proc_entries(struct cache_detail *cd) cd->channel_ent = p; if (p == NULL) goto out_nomem; - p->owner = cd->owner; } if (cd->cache_show) { p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR, @@ -337,7 +334,6 @@ static int create_cache_proc_entries(struct cache_detail *cd) cd->content_ent = p; if (p == NULL) goto out_nomem; - p->owner = cd->owner; } return 0; out_nomem: diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 085372ef4feb..1ef6e46d9da2 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -262,14 +262,8 @@ void rpc_proc_init(void) { dprintk("RPC: registering /proc/net/rpc\n"); - if (!proc_net_rpc) { - struct proc_dir_entry *ent; - ent = proc_mkdir("rpc", init_net.proc_net); - if (ent) { - ent->owner = THIS_MODULE; - proc_net_rpc = ent; - } - } + if (!proc_net_rpc) + proc_net_rpc = proc_mkdir("rpc", init_net.proc_net); } void diff --git a/sound/core/info.c b/sound/core/info.c index 70fa87189f36..35df614f6c55 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -154,11 +154,6 @@ EXPORT_SYMBOL(snd_seq_root); struct snd_info_entry *snd_oss_root; #endif -static inline void snd_info_entry_prepare(struct proc_dir_entry *de) -{ - de->owner = THIS_MODULE; -} - static void snd_remove_proc_entry(struct proc_dir_entry *parent, struct proc_dir_entry *de) { @@ -522,32 +517,11 @@ static const struct file_operations snd_info_entry_operations = .release = snd_info_entry_release, }; -/** - * snd_create_proc_entry - create a procfs entry - * @name: the name of the proc file - * @mode: the file permission bits, S_Ixxx - * @parent: the parent proc-directory entry - * - * Creates a new proc file entry with the given name and permission - * on the given directory. - * - * Returns the pointer of new instance or NULL on failure. - */ -static struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode, - struct proc_dir_entry *parent) -{ - struct proc_dir_entry *p; - p = create_proc_entry(name, mode, parent); - if (p) - snd_info_entry_prepare(p); - return p; -} - int __init snd_info_init(void) { struct proc_dir_entry *p; - p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL); + p = create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL); if (p == NULL) return -ENOMEM; snd_proc_root = p; @@ -974,12 +948,11 @@ int snd_info_register(struct snd_info_entry * entry) return -ENXIO; root = entry->parent == NULL ? snd_proc_root : entry->parent->p; mutex_lock(&info_mutex); - p = snd_create_proc_entry(entry->name, entry->mode, root); + p = create_proc_entry(entry->name, entry->mode, root); if (!p) { mutex_unlock(&info_mutex); return -ENOMEM; } - p->owner = entry->module; if (!S_ISDIR(entry->mode)) p->proc_fops = &snd_info_entry_operations; p->size = entry->size; -- cgit v1.2.3 From 1661c6155589f8faa1338f3cda696ea3f4cb2da1 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Tue, 24 Mar 2009 22:37:14 +0100 Subject: ALSA: opl3sa2: add ZV port control Add ZV port control switch. This patch is done after solution given in the ALSA bug #2872 report. The patch resolves the issue. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- sound/isa/opl3sa2.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index ef95279da7a3..0481a55334b9 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -481,6 +481,7 @@ OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1, OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), OPL3SA2_SINGLE_TLV("Mic Playback Volume", 0, 0x09, 0, 31, 1, db_scale_5bit_12db_max), +OPL3SA2_SINGLE("ZV Port Switch", 0, 0x02, 0, 1, 0), }; static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { -- cgit v1.2.3 From 7d2ac1036b7ff57f73ab64fd897867ddc07bcffe Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Sat, 28 Mar 2009 00:27:10 +0100 Subject: ALSA: move snd_powermac's probe function to .devinit.text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A pointer to snd_pmac_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (when having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late. An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver. Signed-off-by: Uwe Kleine-König Cc: Jaroslav Kysela Cc: Johannes Berg Cc: Rene Herman Cc: Andrew Morton Signed-off-by: Takashi Iwai --- sound/ppc/powermac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index 5a929069dce9..a2b69b8cff43 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -51,7 +51,7 @@ static struct platform_device *device; /* */ -static int __init snd_pmac_probe(struct platform_device *devptr) +static int __devinit snd_pmac_probe(struct platform_device *devptr) { struct snd_card *card; struct snd_pmac *chip; -- cgit v1.2.3 From ff2e7337b5b087620bdea9477f779413a7f096cb Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Wed, 1 Apr 2009 14:49:48 -0400 Subject: ALSA: Add 92HD81B1C device id Added device id in struct for codec 92HD81B1C (0x111d76d5). Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b5e108aa8f63..b34d78b88a85 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4895,6 +4895,7 @@ again: switch (codec->vendor_id) { case 0x111d7604: case 0x111d7605: + case 0x111d76d5: if (spec->board_config == STAC_92HD83XXX_PWR_REF) break; spec->num_pwrs = 0; @@ -5707,6 +5708,7 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = { { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, + { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx}, { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, -- cgit v1.2.3 From 8321fc0113a1be0cdfc9cbad1db1de74073acd8f Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:10 +0200 Subject: ALSA: snd-atmel-ac97c: cleanup register definitions This patch will remove traces of channel B registers, since they are not used by the AC97C driver. Channel B might be used for other purposes. The driver also adds channel status bits TXEMPTY and OVRUN and a AC97C_CH_MASK macro to ease clearing a channel settings. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.h b/sound/atmel/ac97c.h index c17bd5825980..ecbba5021c80 100644 --- a/sound/atmel/ac97c.h +++ b/sound/atmel/ac97c.h @@ -1,5 +1,5 @@ /* - * Register definitions for the Atmel AC97C controller + * Register definitions for Atmel AC97C * * Copyright (C) 2005-2009 Atmel Corporation * @@ -17,10 +17,6 @@ #define AC97C_CATHR 0x24 #define AC97C_CASR 0x28 #define AC97C_CAMR 0x2c -#define AC97C_CBRHR 0x30 -#define AC97C_CBTHR 0x34 -#define AC97C_CBSR 0x38 -#define AC97C_CBMR 0x3c #define AC97C_CORHR 0x40 #define AC97C_COTHR 0x44 #define AC97C_COSR 0x48 @@ -46,8 +42,10 @@ #define AC97C_MR_VRA (1 << 2) #define AC97C_CSR_TXRDY (1 << 0) +#define AC97C_CSR_TXEMPTY (1 << 1) #define AC97C_CSR_UNRUN (1 << 2) #define AC97C_CSR_RXRDY (1 << 4) +#define AC97C_CSR_OVRUN (1 << 5) #define AC97C_CSR_ENDTX (1 << 10) #define AC97C_CSR_ENDRX (1 << 14) @@ -61,11 +59,15 @@ #define AC97C_CMR_DMAEN (1 << 22) #define AC97C_SR_CAEVT (1 << 3) +#define AC97C_SR_COEVT (1 << 2) +#define AC97C_SR_WKUP (1 << 1) +#define AC97C_SR_SOF (1 << 0) +#define AC97C_CH_MASK(slot) \ + (0x7 << (3 * (AC97_SLOT_##slot - 3))) #define AC97C_CH_ASSIGN(slot, channel) \ (AC97C_CHANNEL_##channel << (3 * (AC97_SLOT_##slot - 3))) #define AC97C_CHANNEL_NONE 0x0 #define AC97C_CHANNEL_A 0x1 -#define AC97C_CHANNEL_B 0x2 #endif /* __SOUND_ATMEL_AC97C_H */ -- cgit v1.2.3 From d54bb9f0c57e39a9a7c8ba523f2c0c1a955d8efb Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:11 +0200 Subject: ALSA: snd-atmel-ac97c: remove dead break statements after return in switch case Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index dd72e00e5ae1..21be9c9fbd53 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -312,7 +312,6 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream) default: /* TODO: support more than two channels */ return -EINVAL; - break; } ac97c_writel(chip, OCA, word); @@ -374,7 +373,6 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream) default: /* TODO: support more than two channels */ return -EINVAL; - break; } ac97c_writel(chip, ICA, word); -- cgit v1.2.3 From 128ed6a9266daac5d7b0e082339742e16caf7caa Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:12 +0200 Subject: ALSA: snd-atmel-ac97c: do not overwrite OCA and ICA when assigning channels This patch will take care not to overwrite OCA and ICA registers when assigning input and output channels. It will also make sure the registers are at a known state when enabling a channel and clean up properly in case of an error. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 21be9c9fbd53..4e8f66d40812 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -1,5 +1,5 @@ /* - * Driver for the Atmel AC97C controller + * Driver for Atmel AC97C * * Copyright (C) 2005-2009 Atmel Corporation * @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -297,9 +298,11 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream) { struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; - unsigned long word = 0; + unsigned long word = ac97c_readl(chip, OCA); int retval; + word &= ~(AC97C_CH_MASK(PCM_LEFT) | AC97C_CH_MASK(PCM_RIGHT)); + /* assign channels to AC97C channel A */ switch (runtime->channels) { case 1: @@ -323,9 +326,13 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream) word |= AC97C_CMR_CEM_LITTLE; break; case SNDRV_PCM_FORMAT_S16_BE: /* fall through */ - default: word &= ~(AC97C_CMR_CEM_LITTLE); break; + default: + word = ac97c_readl(chip, OCA); + word &= ~(AC97C_CH_MASK(PCM_LEFT) | AC97C_CH_MASK(PCM_RIGHT)); + ac97c_writel(chip, OCA, word); + return -EINVAL; } ac97c_writel(chip, CAMR, word); @@ -358,9 +365,11 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream) { struct atmel_ac97c *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; - unsigned long word = 0; + unsigned long word = ac97c_readl(chip, ICA); int retval; + word &= ~(AC97C_CH_MASK(PCM_LEFT) | AC97C_CH_MASK(PCM_RIGHT)); + /* assign channels to AC97C channel A */ switch (runtime->channels) { case 1: @@ -384,9 +393,13 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream) word |= AC97C_CMR_CEM_LITTLE; break; case SNDRV_PCM_FORMAT_S16_BE: /* fall through */ - default: word &= ~(AC97C_CMR_CEM_LITTLE); break; + default: + word = ac97c_readl(chip, ICA); + word &= ~(AC97C_CH_MASK(PCM_LEFT) | AC97C_CH_MASK(PCM_RIGHT)); + ac97c_writel(chip, ICA, word); + return -EINVAL; } ac97c_writel(chip, CAMR, word); -- cgit v1.2.3 From c42eec0f193ed408118e20d85ea8c2e69c529993 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:13 +0200 Subject: ALSA: snd-atmel-ac97c: set correct size for buffer hardware parameter This patch will set a proper maximum bytes for the buffer, which is: channels * bytes per sample * maximum periods * maximum bytes per period. It also sets the minimum periods to 6, a value chosen from testing, with a minimum of 6 periods the system has good time to fill in new audio data without skipping. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 4e8f66d40812..c9bc3458fa2d 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -151,10 +151,10 @@ static struct snd_pcm_hardware atmel_ac97c_hw = { .rate_max = 48000, .channels_min = 1, .channels_max = 2, - .buffer_bytes_max = 64 * 4096, + .buffer_bytes_max = 2 * 2 * 64 * 2048, .period_bytes_min = 4096, .period_bytes_max = 4096, - .periods_min = 4, + .periods_min = 6, .periods_max = 64, }; -- cgit v1.2.3 From df163587eab15a24cc34cf8434a5657416f8a203 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:14 +0200 Subject: ALSA: snd-atmel-ac97c: enable interrupts to catch events for error reporting This patch will enable interrupts from AC97C and report about error conditions that occurs. On channel A both overrun and underrun will be enabled depending if playback and/or capture are enabled. On the control channel the overrun interrupt is enabled. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index c9bc3458fa2d..e8484cb9ac62 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -66,6 +66,7 @@ struct atmel_ac97c { /* Serialize access to opened variable */ spinlock_t lock; void __iomem *regs; + int irq; int opened; int reset_pin; }; @@ -335,8 +336,16 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream) return -EINVAL; } + /* Enable underrun interrupt on channel A */ + word |= AC97C_CSR_UNRUN; + ac97c_writel(chip, CAMR, word); + /* Enable channel A event interrupt */ + word = ac97c_readl(chip, IMR); + word |= AC97C_SR_CAEVT; + ac97c_writel(chip, IER, word); + /* set variable rate if needed */ if (runtime->rate != 48000) { word = ac97c_readl(chip, MR); @@ -402,8 +411,16 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream) return -EINVAL; } + /* Enable overrun interrupt on channel A */ + word |= AC97C_CSR_OVRUN; + ac97c_writel(chip, CAMR, word); + /* Enable channel A event interrupt */ + word = ac97c_readl(chip, IMR); + word |= AC97C_SR_CAEVT; + ac97c_writel(chip, IER, word); + /* set variable rate if needed */ if (runtime->rate != 48000) { word = ac97c_readl(chip, MR); @@ -554,6 +571,43 @@ static struct snd_pcm_ops atmel_ac97_capture_ops = { .pointer = atmel_ac97c_capture_pointer, }; +static irqreturn_t atmel_ac97c_interrupt(int irq, void *dev) +{ + struct atmel_ac97c *chip = (struct atmel_ac97c *)dev; + irqreturn_t retval = IRQ_NONE; + u32 sr = ac97c_readl(chip, SR); + u32 casr = ac97c_readl(chip, CASR); + u32 cosr = ac97c_readl(chip, COSR); + + if (sr & AC97C_SR_CAEVT) { + dev_info(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n", + casr & AC97C_CSR_OVRUN ? " OVRUN" : "", + casr & AC97C_CSR_RXRDY ? " RXRDY" : "", + casr & AC97C_CSR_UNRUN ? " UNRUN" : "", + casr & AC97C_CSR_TXEMPTY ? " TXEMPTY" : "", + casr & AC97C_CSR_TXRDY ? " TXRDY" : "", + !casr ? " NONE" : ""); + retval = IRQ_HANDLED; + } + + if (sr & AC97C_SR_COEVT) { + dev_info(&chip->pdev->dev, "codec channel event%s%s%s%s%s\n", + cosr & AC97C_CSR_OVRUN ? " OVRUN" : "", + cosr & AC97C_CSR_RXRDY ? " RXRDY" : "", + cosr & AC97C_CSR_TXEMPTY ? " TXEMPTY" : "", + cosr & AC97C_CSR_TXRDY ? " TXRDY" : "", + !cosr ? " NONE" : ""); + retval = IRQ_HANDLED; + } + + if (retval == IRQ_NONE) { + dev_err(&chip->pdev->dev, "spurious interrupt sr 0x%08x " + "casr 0x%08x cosr 0x%08x\n", sr, casr, cosr); + } + + return retval; +} + static int __devinit atmel_ac97c_pcm_new(struct atmel_ac97c *chip) { struct snd_pcm *pcm; @@ -701,6 +755,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) .read = atmel_ac97c_read, }; int retval; + int irq; regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) { @@ -714,6 +769,12 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) return -ENXIO; } + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_dbg(&pdev->dev, "could not get irq\n"); + return -ENXIO; + } + pclk = clk_get(&pdev->dev, "pclk"); if (IS_ERR(pclk)) { dev_dbg(&pdev->dev, "no peripheral clock\n"); @@ -730,6 +791,13 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) chip = get_chip(card); + retval = request_irq(irq, atmel_ac97c_interrupt, 0, "AC97C", chip); + if (retval) { + dev_dbg(&pdev->dev, "unable to request irq %d\n", irq); + goto err_request_irq; + } + chip->irq = irq; + spin_lock_init(&chip->lock); strcpy(card->driver, "Atmel AC97C"); @@ -758,6 +826,10 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) snd_card_set_dev(card, &pdev->dev); + /* Enable overrun interrupt from codec channel */ + ac97c_writel(chip, COMR, AC97C_CSR_OVRUN); + ac97c_writel(chip, IER, ac97c_readl(chip, IMR) | AC97C_SR_COEVT); + retval = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus); if (retval) { dev_dbg(&pdev->dev, "could not register on ac97 bus\n"); @@ -820,7 +892,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) retval = snd_card_register(card); if (retval) { dev_dbg(&pdev->dev, "could not register sound card\n"); - goto err_ac97_bus; + goto err_dma; } platform_set_drvdata(pdev, card); @@ -847,6 +919,8 @@ err_ac97_bus: iounmap(chip->regs); err_ioremap: + free_irq(irq, chip); +err_request_irq: snd_card_free(card); err_snd_card_new: clk_disable(pclk); @@ -898,6 +972,7 @@ static int __devexit atmel_ac97c_remove(struct platform_device *pdev) clk_disable(chip->pclk); clk_put(chip->pclk); iounmap(chip->regs); + free_irq(chip->irq, chip); if (test_bit(DMA_RX_CHAN_PRESENT, &chip->flags)) dma_release_channel(chip->dma.rx_chan); -- cgit v1.2.3 From 81baf3a7f686c5d22359cb06fc11d20907ba12f8 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:15 +0200 Subject: ALSA: snd-atmel-ac97c: do a proper reset of the external codec This patch will enable the AC97C before resetting the external codec, leaving the AC97C disabled will result in floating I/O lines that can affect the reset procedure. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index e8484cb9ac62..90527c14901e 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -730,17 +730,17 @@ static bool filter(struct dma_chan *chan, void *slave) static void atmel_ac97c_reset(struct atmel_ac97c *chip) { - ac97c_writel(chip, MR, AC97C_MR_WRST); + ac97c_writel(chip, MR, 0); + ac97c_writel(chip, MR, AC97C_MR_ENA); + ac97c_writel(chip, CAMR, 0); + ac97c_writel(chip, COMR, 0); if (gpio_is_valid(chip->reset_pin)) { gpio_set_value(chip->reset_pin, 0); /* AC97 v2.2 specifications says minimum 1 us. */ - udelay(10); + udelay(2); gpio_set_value(chip->reset_pin, 1); } - - udelay(1); - ac97c_writel(chip, MR, AC97C_MR_ENA); } static int __devinit atmel_ac97c_probe(struct platform_device *pdev) @@ -826,6 +826,8 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) snd_card_set_dev(card, &pdev->dev); + atmel_ac97c_reset(chip); + /* Enable overrun interrupt from codec channel */ ac97c_writel(chip, COMR, AC97C_CSR_OVRUN); ac97c_writel(chip, IER, ac97c_readl(chip, IMR) | AC97C_SR_COEVT); @@ -836,8 +838,6 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) goto err_ac97_bus; } - atmel_ac97c_reset(chip); - retval = atmel_ac97c_mixer_new(chip); if (retval) { dev_dbg(&pdev->dev, "could not register ac97 mixer\n"); -- cgit v1.2.3 From bd74a1843e06eef47bdb17452ed363255eb1d6e3 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:16 +0200 Subject: ALSA: snd-atmel-ac97c: cleanup registers when removing driver This patch will set the channel A and control channel mode register to zero before disabling the AC97C peripheral. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 90527c14901e..4df9ca400545 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -969,6 +969,10 @@ static int __devexit atmel_ac97c_remove(struct platform_device *pdev) if (gpio_is_valid(chip->reset_pin)) gpio_free(chip->reset_pin); + ac97c_writel(chip, CAMR, 0); + ac97c_writel(chip, COMR, 0); + ac97c_writel(chip, MR, 0); + clk_disable(chip->pclk); clk_put(chip->pclk); iounmap(chip->regs); -- cgit v1.2.3 From 23572856e0363a1d4dcf896f59860f86809da7fc Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:17 +0200 Subject: ALSA: snd-atmel-ac97c: replace bus_id with dev_name() This patch replaces the references to bus_id to the new dev_name() API. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/ac97c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 4df9ca400545..0c0f8771656a 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -856,7 +856,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) chip->dma.rx_chan = dma_request_channel(mask, filter, dws); dev_info(&chip->pdev->dev, "using %s for DMA RX\n", - chip->dma.rx_chan->dev->device.bus_id); + dev_name(&chip->dma.rx_chan->dev->device)); set_bit(DMA_RX_CHAN_PRESENT, &chip->flags); } @@ -872,7 +872,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) chip->dma.tx_chan = dma_request_channel(mask, filter, dws); dev_info(&chip->pdev->dev, "using %s for DMA TX\n", - chip->dma.tx_chan->dev->device.bus_id); + dev_name(&chip->dma.tx_chan->dev->device)); set_bit(DMA_TX_CHAN_PRESENT, &chip->flags); } -- cgit v1.2.3 From 60a56cce7acb6c66fc6c4fdfef0049e73cfdc8be Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 08:21:18 +0200 Subject: ALSA: snd-atmel-abdac: replace bus_id with dev_name() This patch replaces the references to bus_id to the new dev_name() API. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/abdac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c index 28b3c7f7cfe6..32064fafbc2e 100644 --- a/sound/atmel/abdac.c +++ b/sound/atmel/abdac.c @@ -502,7 +502,7 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev) platform_set_drvdata(pdev, card); dev_info(&pdev->dev, "Atmel ABDAC at 0x%p using %s\n", - dac->regs, dac->dma.chan->dev->device.bus_id); + dac->regs, dev_name(&dac->dma.chan->dev->device)); return retval; -- cgit v1.2.3 From fa075ed2dc80440bf3e9092d38a66c3227b174c1 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Thu, 2 Apr 2009 13:42:26 +0200 Subject: ALSA: snd-atmel-abdac: increase periods_min to 6 instead of 4 This patch increases periods_min to 6 from 4, this will remove any hickups where the buffer is not filled fast enough from user space. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Takashi Iwai --- sound/atmel/abdac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c index 32064fafbc2e..f2f41c854221 100644 --- a/sound/atmel/abdac.c +++ b/sound/atmel/abdac.c @@ -165,7 +165,7 @@ static struct snd_pcm_hardware atmel_abdac_hw = { .buffer_bytes_max = 64 * 4096, .period_bytes_min = 4096, .period_bytes_max = 4096, - .periods_min = 4, + .periods_min = 6, .periods_max = 64, }; -- cgit v1.2.3 From f3cd3f5d341dc5218d0138a67945182e83174af9 Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Thu, 2 Apr 2009 19:44:18 +0800 Subject: ALSA: hda - enable SPDIF output for Intel DX58SO board ALC889 has two SPDIF outputs: 0x06, 0x10. Board vendors can use either or both. DX58SO uses 0x10, but the driver assumes 0x06. The safe solution is to add 0x10 as slave output to the existing 0x06. Reported-by: Jeroen Van Breedam Tested-by: Jeroen Van Breedam Signed-off-by: Wu Fengguang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 82097790f6f3..f35e58a2d921 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8764,6 +8764,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { {} }; +static hda_nid_t alc883_slave_dig_outs[] = { + ALC1200_DIGOUT_NID, 0, +}; + static hda_nid_t alc1200_slave_dig_outs[] = { ALC883_DIGOUT_NID, 0, }; @@ -8809,6 +8813,7 @@ static struct alc_config_preset alc883_presets[] = { .dac_nids = alc883_dac_nids, .dig_out_nid = ALC883_DIGOUT_NID, .dig_in_nid = ALC883_DIGIN_NID, + .slave_dig_outs = alc883_slave_dig_outs, .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), .channel_mode = alc883_3ST_6ch_intel_modes, .need_dac_fix = 1, -- cgit v1.2.3 From 7c7cae17e04765692aa3d2bda5c771f909219f27 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 6 Apr 2009 14:38:43 -0700 Subject: ALSA: wavefront - Always use request_firmware() Always use request_firmware() for loading yss225_registers image. Signed-off-by: Takashi Iwai Signed-off-by: David Woodhouse --- firmware/Makefile | 1 + firmware/WHENCE | 12 + firmware/yamaha/yss225_registers.bin.ihex | 998 +++++++++++ sound/isa/Kconfig | 10 - sound/isa/wavefront/wavefront_fx.c | 16 - sound/isa/wavefront/yss225.c | 2739 ----------------------------- 6 files changed, 1011 insertions(+), 2765 deletions(-) create mode 100644 firmware/yamaha/yss225_registers.bin.ihex delete mode 100644 sound/isa/wavefront/yss225.c (limited to 'sound') diff --git a/firmware/Makefile b/firmware/Makefile index 4267f68164b5..a19e579f6aa1 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -63,6 +63,7 @@ fw-shipped-$(CONFIG_SXG) += sxg/saharadownloadB.sys \ sxg/saharadbgdownloadB.sys fw-shipped-$(CONFIG_SND_YMFPCI) += yamaha/ds1_ctrl.fw yamaha/ds1_dsp.fw \ yamaha/ds1e_ctrl.fw +fw-shipped-$(CONFIG_SND_WAVEFRONT) += yamaha/yss225_registers.bin fw-shipped-$(CONFIG_TEHUTI) += tehuti/bdx.bin fw-shipped-$(CONFIG_TIGON3) += tigon/tg3.bin tigon/tg3_tso.bin \ tigon/tg3_tso5.bin diff --git a/firmware/WHENCE b/firmware/WHENCE index c0a7c8f20c0e..ff41dbfb3a93 100644 --- a/firmware/WHENCE +++ b/firmware/WHENCE @@ -642,3 +642,15 @@ Licence: GPLv2 or later ARM assembly source code available at http://www.linuxtv.org/downloads/firmware/Boot.S -------------------------------------------------------------------------- + +Driver: wavefront - ISA WaveFront sound card + +File: yamaha/yss225_registers.bin + +Licence: Allegedly GPLv2+, but no source visible. + +Found in hex form in kernel source, with the following comment: + Copyright (c) 1998-2002 by Paul Davis + + +-------------------------------------------------------------------------- diff --git a/firmware/yamaha/yss225_registers.bin.ihex b/firmware/yamaha/yss225_registers.bin.ihex new file mode 100644 index 000000000000..6dd3d8c4de2b --- /dev/null +++ b/firmware/yamaha/yss225_registers.bin.ihex @@ -0,0 +1,998 @@ +:10000000FF000E100F00FF000E110F00FF000E1278 +:100010000F00FF000E130F00FF000E140F00FF0073 +:100020000E150F00FF000E160F00FF000E170F0039 +:10003000FF000E180F00FF000E190F00FF000E1A30 +:100040000F00FF000E1B0F00FF000E1C0F00FF0033 +:100050000E1D0F00FF000E1E0F00FF000E1F0F00F1 +:10006000FF000E200F00FF000E210F00FF000E22E8 +:100070000F00FF000E230F00FF000E240F00FF00F3 +:100080000E250F00FF000E260F00FF000E270F00A9 +:10009000FF000E280F00FF000E290F00FF000E2AA0 +:1000A0000F00FF000E2B0F00FF000E2C0F00FF00B3 +:1000B0000E2D0F00FF000E2E0F00FF000E2F0F0061 +:1000C000FF000E300F00FF000E310F00FF000E3258 +:1000D0000F00FF000E330F00FF000E340F00FF0073 +:1000E0000E350F00FF000E360F00FF000E370F0019 +:1000F000FF000E380F00FF000E390F00FF000E3A10 +:100100000F00FF000E3B0F00FF000E3C0F00FF0032 +:100110000E3D0F00FF000E3E0F00FF000E3F0F00D0 +:10012000FF000E400F00FF000E410F00FF000E42C7 +:100130000F00FF000E430F00FF000E440F00FF00F2 +:100140000E450F00FF000E460F00FF000E470F0088 +:10015000FF000E480F00FF000E490F00FF000E4A7F +:100160000F00FF000E4B0F00FF000E4C0F00FF00B2 +:100170000E4D0F00FF000E4E0F00FF000E4F0F0040 +:10018000FF000E500F00FF000E510F00FF000E5237 +:100190000F00FF000E530F00FF000E540F00FF0072 +:1001A0000E550F00FF000E560F00FF000E570F00F8 +:1001B000FF000E580F00FF000E590F00FF000E5AEF +:1001C0000F00FF000E5B0F00FF000E5C0F00FF0032 +:1001D0000E5D0F00FF000E5E0F00FF000E5F0F00B0 +:1001E000FF000E600F00FF000E610F00FF000E62A7 +:1001F0000F00FF000E630F00FF000E640F00FF00F2 +:100200000E650F00FF000E660F00FF000E670F0067 +:10021000FF000E680F00FF000E690F00FF000E6A5E +:100220000F00FF000E6B0F00FF000E6C0F00FF00B1 +:100230000E6D0F00FF000E6E0F00FF000E6F0F001F +:10024000FF000E700F00FF000E710F00FF000E7216 +:100250000F00FF000E730F00FF000E740F00FF0071 +:100260000E750F00FF000E760F00FF000E770F00D7 +:10027000FF000E780F00FF000E790F00FF000E7ACE +:100280000F00FF000E7B0F00FF000E7C0F00FF0031 +:100290000E7D0F00FF000E7E0F00FF000E7F0F008F +:1002A000FF000E800F00FF000E810F00FF000E8286 +:1002B0000F00FF000E830F00FF000E840F00FF00F1 +:1002C0000E850F00FF000E860F00FF000E870F0047 +:1002D000FF000E880F00FF000E890F00FF000E8A3E +:1002E0000F00FF000E8B0F00FF000E8C0F00FF00B1 +:1002F0000E8D0F00FF000E8E0F00FF000E8F0F00FF +:10030000FF000E900F00FF000E910F00FF000E92F5 +:100310000F00FF000E930F00FF000E940F00FF0070 +:100320000E950F00FF000E960F00FF000E970F00B6 +:10033000FF000E980F00FF000E990F00FF000E9AAD +:100340000F00FF000E9B0F00FF000E9C0F00FF0030 +:100350000E9D0F00FF000E9E0F00FF000E9F0F006E +:10036000FF000EA00F00FF000EA10F00FF000EA265 +:100370000F00FF000EA30F00FF000EA40F00FF00F0 +:100380000EA50F00FF000EA60F00FF000EA70F0026 +:10039000FF000EA80F00FF000EA90F00FF000EAA1D +:1003A0000F00FF000EAB0F00FF000EAC0F00FF00B0 +:1003B0000EAD0F00FF000EAE0F00FF000EAF0F00DE +:1003C000FF000EB00F00FF000EB10F00FF000EB2D5 +:1003D0000F00FF000EB30F00FF000EB40F00FF0070 +:1003E0000EB50F00FF000EB60F00FF000EB70F0096 +:1003F000FF000EB80F00FF000EB90F00FF000EBA8D +:100400000F00FF000EBB0F00FF000EBC0F00FF002F +:100410000EBD0F00FF000EBE0F00FF000EBF0F004D +:10042000FF000EC00F00FF000EC10F00FF000EC244 +:100430000F00FF000EC30F00FF000EC40F00FF00EF +:100440000EC50F00FF000EC60F00FF000EC70F0005 +:10045000FF000EC80F00FF000EC90F00FF000ECAFC +:100460000F00FF000ECB0F00FF000ECC0F00FF00AF +:100470000ECD0F00FF000ECE0F00FF000ECF0F00BD +:10048000FF000ED00F00FF000ED10F00FF000ED2B4 +:100490000F00FF000ED30F00FF000ED40F00FF006F +:1004A0000ED50F00FF000ED60F00FF000ED70F0075 +:1004B000FF000ED80F00FF000ED90F00FF000EDA6C +:1004C0000F00FF000EDB0F00FF000EDC0F00FF002F +:1004D0000EDD0F00FF000EDE0F00FF000EDF0F002D +:1004E000FF000EE00F00FF000EE10F00FF000EE224 +:1004F0000F00FF000EE30F00FF000EE40F00FF00EF +:100500000EE50F00FF000EE60F00FF000EE70F00E4 +:10051000FF000EE80F00FF000EE90F00FF000EEADB +:100520000F00FF000EEB0F00FF000EEC0F00FF00AE +:100530000EED0F00FF000EEE0F00FF000EEF0F009C +:10054000FF000EF00F00FF000EF10F00FF000EF293 +:100550000F00FF000EF30F00FF000EF40F00FF006E +:100560000EF50F00FF000EF60F00FF000EF70F0054 +:10057000FF000EF80F00FF000EF90F00FF000EFA4B +:100580000F00FF000EFB0F00FF000EFC0F00FF002E +:100590000EFD0F00FF000EFE0F00FF000EFF0F000C +:1005A000FF000E100F00FF000E110F00FF000E12D3 +:1005B0000F00FF000E130F00FF000E140F00FF00CE +:1005C0000E150F00FF000E160F00FF000E170F0094 +:1005D000FF000E180F00FF000E190F00FF000E1A8B +:1005E0000F00FF000E1B0F00FF000E1C0F00FF008E +:1005F0000E1D0F00FF000E1E0F00FF000E1F0F004C +:10060000FF000E200F00FF000E210F00FF000E2242 +:100610000F00FF000E230F00FF000E240F00FF004D +:100620000E250F00FF000E260F00FF000E270F0003 +:10063000FF000E280F00FF000E290F00FF000E2AFA +:100640000F00FF000E2B0F00FF000E2C0F00FF000D +:100650000E2D0F00FF000E2E0F00FF000E2F0F00BB +:10066000FF000E300F00FF000E310F00FF000E32B2 +:100670000F00FF000E330F00FF000E340F00FF00CD +:100680000E350F00FF000E360F00FF000E370F0073 +:10069000FF000E380F00FF000E390F00FF000E3A6A +:1006A0000F00FF000E3B0F00FF000E3C0F00FF008D +:1006B0000E3D0F00FF000E3E0F00FF000E3F0F002B +:1006C000FF000E400F00FF000E410F00FF000E4222 +:1006D0000F00FF000E430F00FF000E440F00FF004D +:1006E0000E450F00FF000E460F00FF000E470F00E3 +:1006F000FF000E480F00FF000E490F00FF000E4ADA +:100700000F00FF000E4B0F00FF000E4C0F00FF000C +:100710000E4D0F00FF000E4E0F00FF000E4F0F009A +:10072000FF000E500F00FF000E510F00FF000E5291 +:100730000F00FF000E530F00FF000E540F00FF00CC +:100740000E550F00FF000E560F00FF000E570F0052 +:10075000FF000E580F00FF000E590F00FF000E5A49 +:100760000F00FF000E5B0F00FF000E5C0F00FF008C +:100770000E5D0F00FF000E5E0F00FF000E5F0F000A +:10078000FF000E600F00FF000E610F00FF000E6201 +:100790000F00FF000E630F00FF000E640F00FF004C +:1007A0000E650F00FF000E660F00FF000E670F00C2 +:1007B000FF000E680F00FF000E690F00FF000E6AB9 +:1007C0000F00FF000E6B0F00FF000E6C0F00FF000C +:1007D0000E6D0F00FF000E6E0F00FF000E6F0F007A +:1007E000FF000E700F00FF000E710F00FF000E7271 +:1007F0000F00FF000E730F00FF000E740F00FF00CC +:100800000E750F00FF000E760F00FF000E770F0031 +:10081000FF000E780F00FF000E790F00FF000E7A28 +:100820000F00FF000E7B0F00FF000E7C0F00FF008B +:100830000E7D0F00FF000E7E0F00FF000E7F0F00E9 +:10084000FF000E800F00FF000E810F00FF000E82E0 +:100850000F00FF000E830F00FF000E840F00FF004B +:100860000E850F00FF000E860F00FF000E870F00A1 +:10087000FF000E880F00FF000E890F00FF000E8A98 +:100880000F00FF000E8B0F00FF000E8C0F00FF000B +:100890000E8D0F00FF000E8E0F00FF000E8F0F0059 +:1008A000FF000E900F00FF000E910F00FF000E9250 +:1008B0000F00FF000E930F00FF000E940F00FF00CB +:1008C0000E950F00FF000E960F00FF000E970F0011 +:1008D000FF000E980F00FF000E990F00FF000E9A08 +:1008E0000F00FF000E9B0F00FF000E9C0F00FF008B +:1008F0000E9D0F00FF000E9E0F00FF000E9F0F00C9 +:10090000FF000EA00F00FF000EA10F00FF000EA2BF +:100910000F00FF000EA30F00FF000EA40F00FF004A +:100920000EA50F00FF000EA60F00FF000EA70F0080 +:10093000FF000EA80F00FF000EA90F00FF000EAA77 +:100940000F00FF000EAB0F00FF000EAC0F00FF000A +:100950000EAD0F00FF000EAE0F00FF000EAF0F0038 +:10096000FF000EB00F00FF000EB10F00FF000EB22F +:100970000F00FF000EB30F00FF000EB40F00FF00CA +:100980000EB50F00FF000EB60F00FF000EB70F00F0 +:10099000FF000EB80F00FF000EB90F00FF000EBAE7 +:1009A0000F00FF000EBB0F00FF000EBC0F00FF008A +:1009B0000EBD0F00FF000EBE0F00FF000EBF0F00A8 +:1009C000FF000EC00F00FF000EC10F00FF000EC29F +:1009D0000F00FF000EC30F00FF000EC40F00FF004A +:1009E0000EC50F00FF000EC60F00FF000EC70F0060 +:1009F000FF000EC80F00FF000EC90F00FF000ECA57 +:100A00000F00FF000ECB0F00FF000ECC0F00FF0009 +:100A10000ECD0F00FF000ECE0F00FF000ECF0F0017 +:100A2000FF000ED00F00FF000ED10F00FF000ED20E +:100A30000F00FF000ED30F00FF000ED40F00FF00C9 +:100A40000ED50F00FF000ED60F00FF000ED70F00CF +:100A5000FF000ED80F00FF000ED90F00FF000EDAC6 +:100A60000F00FF000EDB0F00FF000EDC0F00FF0089 +:100A70000EDD0F00FF000EDE0F00FF000EDF0F0087 +:100A8000FF000EE00F00FF000EE10F00FF000EE27E +:100A90000F00FF000EE30F00FF000EE40F00FF0049 +:100AA0000EE50F00FF000EE60F00FF000EE70F003F +:100AB000FF000EE80F00FF000EE90F00FF000EEA36 +:100AC0000F00FF000EEB0F00FF000EEC0F00FF0009 +:100AD0000EED0F00FF000EEE0F00FF000EEF0F00F7 +:100AE000FF000EF00F00FF000EF10F00FF000EF2EE +:100AF0000F00FF000EF30F00FF000EF40F00FF00C9 +:100B00000EF50F00FF000EF60F00FF000EF70F00AE +:100B1000FF000EF80F00FF000EF90F00FF000EFAA5 +:100B20000F00FF000EFB0F00FF000EFC0F00FF0088 +:100B30000EFD0F00FF000EFE0F00FF000EFF0F0066 +:100B4000FF000802FF000B070A440D000C00FF0025 +:100B50000B070A420D000C00FF000B070A430D00B3 +:100B60000C00FF000B070A7C0D000C00FF000B07B8 +:100B70000A7E0D000C00FF000B070A460D000C005A +:100B8000FF000B070A490D000C00FF000B070A4786 +:100B90000D000C00FF000B070A4A0D000C00FF00BF +:100BA0000E100F00FF000E110F00FF000E120F00BD +:100BB000FF000E130F00FF000E140F00FF000E15B4 +:100BC0000F00FF000E160F00FF000E170F00FF00B2 +:100BD0000E180F00FF000E190F00FF000E1A0F0075 +:100BE000FF000E1B0F00FF000E1C0F00FF000E1D6C +:100BF0000F00FF000E1E0F00FF000E1F0F00FF0072 +:100C00000E200F00FF000E210F00FF000E220F002C +:100C1000FF000E230F00FF000E240F00FF000E2523 +:100C20000F00FF000E260F00FF000E270F00FF0031 +:100C30000E280F00FF000E290F00FF000E2A0F00E4 +:100C4000FF000E2B0F00FF000E2C0F00FF000E2DDB +:100C50000F00FF000E2E0F00FF000E2F0F00FF00F1 +:100C60000E300F00FF000E310F00FF000E320F009C +:100C7000FF000E330F00FF000E340F00FF000E3593 +:100C80000F00FF000E360F00FF000E370F00FF00B1 +:100C90000E380F00FF000E390F00FF000E3A0F0054 +:100CA000FF000E3B0F00FF000E3C0F00FF000E3D4B +:100CB0000F00FF000E3E0F00FF000E3F0F00FF0071 +:100CC0000E400F00FF000E410F00FF000E420F000C +:100CD000FF000E430F00FF000E440F00FF000E4503 +:100CE0000F00FF000E460F00FF000E470F00FF0031 +:100CF0000E480F00FF000E490F00FF000E4A0F00C4 +:100D0000FF000E4B0F00FF000E4C0F00FF000E4DBA +:100D10000F00FF000E4E0F00FF000E4F0F00FF00F0 +:100D20000E500F00FF000E510F00FF000E520F007B +:100D3000FF000E530F00FF000E540F00FF000E5572 +:100D40000F00FF000E560F00FF000E570F00FF00B0 +:100D50000E580F00FF000E590F00FF000E5A0F0033 +:100D6000FF000E5B0F00FF000E5C0F00FF000E5D2A +:100D70000F00FF000E5E0F00FF000E5F0F00FF0070 +:100D80000E600F00FF000E610F00FF000E620F00EB +:100D9000FF000E630F00FF000E640F00FF000E65E2 +:100DA0000F00FF000E660F00FF000E670F00FF0030 +:100DB0000E680F00FF000E690F00FF000E6A0F00A3 +:100DC000FF000E6B0F00FF000E6C0F00FF000E6D9A +:100DD0000F00FF000E6E0F00FF000E6F0F00FF00F0 +:100DE0000E700F00FF000E710F00FF000E720F005B +:100DF000FF000E730F00FF000E740F00FF000E7552 +:100E00000F00FF000E760F00FF000E770F00FF00AF +:100E10000E780F00FF000E790F00FF000E7A0F0012 +:100E2000FF000E7B0F00FF000E7C0F00FF000E7D09 +:100E30000F00FF000E7E0F00FF000E7F0F00FF006F +:100E40000E800F00FF000E810F00FF000E820F00CA +:100E5000FF000E830F00FF000E840F00FF000E85C1 +:100E60000F00FF000E860F00FF000E870F00FF002F +:100E70000E880F00FF000E890F00FF000E8A0F0082 +:100E8000FF000E8B0F00FF000E8C0F00FF000E8D79 +:100E90000F00FF000E8E0F00FF000E8F0F00FF00EF +:100EA0000E900F00FF000E910F00FF000E920F003A +:100EB000FF000E930F00FF000E940F00FF000E9531 +:100EC0000F00FF000E960F00FF000E970F00FF00AF +:100ED0000E980F00FF000E990F00FF000E9A0F00F2 +:100EE000FF000E9B0F00FF000E9C0F00FF000E9DE9 +:100EF0000F00FF000E9E0F00FF000E9F0F00FF006F +:100F00000EA00F00FF000EA10F00FF000EA20F00A9 +:100F1000FF000EA30F00FF000EA40F00FF000EA5A0 +:100F20000F00FF000EA60F00FF000EA70F00FF002E +:100F30000EA80F00FF000EA90F00FF000EAA0F0061 +:100F4000FF000EAB0F00FF000EAC0F00FF000EAD58 +:100F50000F00FF000EAE0F00FF000EAF0F00FF00EE +:100F60000EB00F00FF000EB10F00FF000EB20F0019 +:100F7000FF000EB30F00FF000EB40F00FF000EB510 +:100F80000F00FF000EB60F00FF000EB70F00FF00AE +:100F90000EB80F00FF000EB90F00FF000EBA0F00D1 +:100FA000FF000EBB0F00FF000EBC0F00FF000EBDC8 +:100FB0000F00FF000EBE0F00FF000EBF0F00FF006E +:100FC0000EC00F00FF000EC10F00FF000EC20F0089 +:100FD000FF000EC30F00FF000EC40F00FF000EC580 +:100FE0000F00FF000EC60F00FF000EC70F00FF002E +:100FF0000EC80F00FF000EC90F00FF000ECA0F0041 +:10100000FF000ECB0F00FF000ECC0F00FF000ECD37 +:101010000F00FF000ECE0F00FF000ECF0F00FF00ED +:101020000ED00F00FF000ED10F00FF000ED20F00F8 +:10103000FF000ED30F00FF000ED40F00FF000ED5EF +:101040000F00FF000ED60F00FF000ED70F00FF00AD +:101050000ED80F00FF000ED90F00FF000EDA0F00B0 +:10106000FF000EDB0F00FF000EDC0F00FF000EDDA7 +:101070000F00FF000EDE0F00FF000EDF0F00FF006D +:101080000EE00F00FF000EE10F00FF000EE20F0068 +:10109000FF000EE30F00FF000EE40F00FF000EE55F +:1010A0000F00FF000EE60F00FF000EE70F00FF002D +:1010B0000EE80F00FF000EE90F00FF000EEA0F0020 +:1010C000FF000EEB0F00FF000EEC0F00FF000EED17 +:1010D0000F00FF000EEE0F00FF000EEF0F00FF00ED +:1010E0000EF00F00FF000EF10F00FF000EF20F00D8 +:1010F000FF000EF30F00FF000EF40F00FF000EF5CF +:101100000F00FF000EF60F00FF000EF70F00FF00AC +:101110000EF80F00FF000EF90F00FF000EFA0F008F +:10112000FF000EFB0F00FF000EFC0F00FF000EFD86 +:101130000F00FF000EFE0F00FF000EFF0F0009055D +:101140000B000A000D010C7CFF000D000C1EFF00BF +:101150000D000C00FF000D000C00FF000D000CF551 +:10116000FF000D000C11FF000D000C20FF000D0012 +:101170000C32FF000D000C40FF000D000C13FF00AF +:101180000D000C00FF000D000C14FF000D020C768A +:10119000FF000D000C60FF000D000C80FF000D0231 +:1011A0000C00FF000D000C00FF000D000C00FF0004 +:1011B0000D020C00FF000D000C00FF000D000C00E4 +:1011C000FF000D000C00FF000D000C00FF000D00E3 +:1011D0000C00FF000D000C00FF000D000C00FF00D4 +:1011E0000D000C00FF000D000C00FF000D000C00B6 +:1011F000FF000D000C00FF000D000C00FF000D00B3 +:101200000C00FF000D000C00FF000D000C00FF00A3 +:101210000D000C00FF000D000C00FF000D000C0085 +:10122000FF000D000C00FF000D000C00FF000D0082 +:101230000C00FF000D000C00FF000D000C00FF0073 +:101240000D000C00FF000D000C00FF000D000C0055 +:10125000FF000D000C00FF000D000C00FF000D0052 +:101260000C00FF000D000C00FF000D000C00FF0043 +:101270000D000C00FF000D000C00FF000D000C0025 +:10128000FF000D000C00FF000D000C00FF000D0022 +:101290000C00FF000D000C00FF000D000C00FF0013 +:1012A0000D000C00FF000D000C00FF000D000C00F5 +:1012B000FF000D000C00FF000D000C00FF000D00F2 +:1012C0000C00FF000D000C18FF000D000C19FF00B2 +:1012D0000D010C1AFF000D010C20FF000D010C4048 +:1012E000FF000D010C17FF000D000C00FF000D01A9 +:1012F0000C80FF000D010C20FF000D000C10FF0002 +:101300000D010CA0FF000D030CD1FF000D000C001F +:10131000FF000D010CF2FF000D020C00FF000D009C +:101320000C13FF000D000C00FF000D000CF4FF007B +:101330000D020CE0FF000D000C15FF000D000C006D +:10134000FF000D000C16FF000D000C00FF000D004B +:101350000C17FF000D000C20FF000D000C00FF001B +:101360000D000C20FF000D000C50FF000D000C00C4 +:10137000FF000D000C40FF000D000C00FF000D00F1 +:101380000C71FF000D020C00FF000D000C60FF004F +:101390000D000C00FF000D000C92FF000D000C0072 +:1013A000FF000D000C80FF000D000C00FF000D0081 +:1013B0000CB3FF000D020C00FF000D000CA0FF009D +:1013C0000D000C00FF000D000CD4FF000D000C0000 +:1013D000FF000D000C40FF000D000C80FF000D0011 +:1013E0000CF5FF000D000C20FF000D000C70FF003D +:1013F0000D000CA0FF000D020C11FF000D000C16DB +:10140000FF000D000C00FF000D000C00FF000D00A0 +:101410000C00FF000D000C20FF000D020C00FF006F +:101420000D000C20FF000D000C10FF000D000C172C +:10143000FF000D000C1BFF000D000C1DFF000D0236 +:101440000CDFFF0009050B010A000D000C00FF0076 +:101450000D000C00FF000D000C00FF000D020C0041 +:10146000FF000D000C19FF000D000C1FFF000D0008 +:101470000C00FF000D000C00FF000D000C00FF0031 +:101480000D030CD8FF000D000C00FF000D020C2016 +:10149000FF000D000C19FF000D000C00FF000D00F7 +:1014A0000C00FF000D000C18FF000D010CC0FF0028 +:1014B0000D010CFAFF000D000C1AFF000D000C00CE +:1014C000FF000D000C00FF000D000C00FF000D00E0 +:1014D0000C00FF000D000C00FF000D000C00FF00D1 +:1014E0000D000C00FF000D000C00FF000D000C00B3 +:1014F000FF000D000C00FF000D000C00FF000D00B0 +:101500000C00FF000D000C00FF000D000C00FF00A0 +:101510000D000C00FF000D000C00FF000D000C0082 +:10152000FF000D000C00FF000D000C00FF000D007F +:101530000C00FF000D000C00FF000D000C00FF0070 +:101540000D000C00FF000D000C00FF000D000C0052 +:10155000FF000D000C00FF000D000C00FF000D004F +:101560000C00FF000D000C00FF000D000C00FF0040 +:101570000D000C00FF000D000C00FF000D000C0022 +:10158000FF000D000C00FF000D000C00FF000D001F +:101590000C00FF000D000C00FF000D000C00FF0010 +:1015A0000D000C00FF000D000C00FF000D000C00F2 +:1015B000FF000D000C00FF000D000C00FF000D00EF +:1015C0000C00FF000D000C00FF000D020C40FF009E +:1015D0000D020C60FF000D000C00FF000D000C0060 +:1015E000FF000D000C00FF000D020CC0FF000D02FB +:1015F0000C80FF000D000C00FF000D020CFBFF0033 +:101600000D020CA0FF000D000C00FF000D000C1BD4 +:10161000FF000D020CD7FF000D000C00FF000D02B3 +:101620000CF7FF000D030C20FF000D030C00FF0062 +:101630000D000C00FF000D000C1CFF000D030C3C06 +:10164000FF000D000C00FF000D030C3FFF000D001C +:101650000C00FF000D030CC0FF000D000C00FF008C +:101660000D030CDFFF000D000C00FF000D000C004F +:10167000FF000D030C5DFF000D000C00FF000D03CB +:101680000CC0FF000D000C00FF000D030C7DFF00DF +:101690000D000C00FF000D030CC0FF000D000C003E +:1016A000FF000D030C9EFF000D000C00FF000D035A +:1016B0000CC0FF000D000C00FF000D030CBEFF006E +:1016C0000D000C00FF000D030CC0FF000D000C000E +:1016D000FF000D000C00FF000D000C00FF000D00CE +:1016E0000C00FF000D000C1BFF000D000C00FF00A4 +:1016F0000D000C00FF000D000C00FF000D020CDBC4 +:10170000FF000D000C00FF000D020CDBFF000D00C0 +:101710000C00FF000D020CE0FF000D000C00FF00AC +:101720000D020CFBFF000D000C00FF000D020CC0B1 +:10173000FF000D020C40FF000D020CFBFF000D022C +:101740000C60FF000D000C1BFF0009050B020A00D6 +:101750000CC4FF000C00FF000C44FF000C07FF004E +:101760000C44FF000C00FF000C40FF000C25FF00A4 +:101770000C01FF000C06FF000CC4FF000C07FF006B +:101780000C40FF000C25FF000C01FF000C00FF00C7 +:101790000C46FF000C46FF000C00FF000C00FF0091 +:1017A0000C00FF000C00FF000C00FF000C00FF000D +:1017B0000C00FF000C00FF000C00FF000C00FF00FD +:1017C0000C00FF000C00FF000C00FF000C00FF00ED +:1017D0000C00FF000C00FF000C00FF000C00FF00DD +:1017E0000C00FF000C00FF000C00FF000C00FF00CD +:1017F0000C00FF000C00FF000C00FF000C00FF00BD +:101800000C00FF000C00FF000C00FF000C00FF00AC +:101810000C00FF000C00FF000C00FF000C00FF009C +:101820000C00FF000C00FF000C00FF000C00FF008C +:101830000C00FF000C00FF000C00FF000C00FF007C +:101840000C00FF000C00FF000C00FF000C00FF006C +:101850000C46FF000C07FF000C05FF000C05FF0005 +:101860000C05FF000C04FF000C07FF000C05FF0037 +:101870000C04FF000C07FF000C05FF000C44FF00E8 +:101880000C46FF000C44FF000C46FF000C46FF0016 +:101890000C07FF000C05FF000C44FF000C46FF0086 +:1018A0000C05FF000C46FF000C05FF000C46FF0076 +:1018B0000C05FF000C46FF000C05FF000C44FF0068 +:1018C0000C46FF000C05FF000C07FF000C44FF0056 +:1018D0000C46FF000C05FF000C07FF000C44FF0046 +:1018E0000C46FF000C05FF000C07FF000C44FF0036 +:1018F0000C46FF000C05FF000C07FF000C44FF0026 +:101900000C05FF000C05FF000C05FF000C44FF0058 +:101910000C05FF000C05FF000C05FF000C46FF0046 +:101920000C05FF000C46FF000C05FF000C46FF00F5 +:101930000C05FF000C46FF000C05FF000C46FF00E5 +:101940000C07FF000C46FF000C07FF000C44FF00D3 +:1019500009050B030A000C07FF000C40FF000C00F8 +:10196000FF000C00FF000C00FF000C47FF000C0004 +:10197000FF000C40FF000C00FF000C40FF000C06B5 +:10198000FF000C40FF000C00FF000C00FF000C00EB +:10199000FF000C00FF000C00FF000C00FF000C001B +:1019A000FF000C00FF000C00FF000C00FF000C000B +:1019B000FF000C00FF000C00FF000C00FF000C00FB +:1019C000FF000C00FF000C00FF000C00FF000C00EB +:1019D000FF000C00FF000C00FF000C00FF000C00DB +:1019E000FF000C00FF000C00FF000C00FF000C00CB +:1019F000FF000C00FF000C00FF000C00FF000C00BB +:101A0000FF000C00FF000C00FF000C00FF000C00AA +:101A1000FF000C00FF000C00FF000C00FF000C009A +:101A2000FF000C00FF000C00FF000C00FF000C008A +:101A3000FF000C00FF000C00FF000C00FF000C007A +:101A4000FF000C00FF000C00FF000C00FF000C006A +:101A5000FF000C00FF000C80FF000C80FF000CC09A +:101A6000FF000C00FF000C00FF000C40FF000C000A +:101A7000FF000C00FF000C00FF000C40FF000C00FA +:101A8000FF000C40FF000C00FF000C60FF000C008A +:101A9000FF000C70FF000C00FF000C40FF000C006A +:101AA000FF000C40FF000C00FF000C42FF000C0088 +:101AB000FF000C40FF000C00FF000C02FF000C00B8 +:101AC000FF000C40FF000C00FF000C00FF000C00AA +:101AD000FF000C40FF000C00FF000C00FF000C009A +:101AE000FF000C40FF000C00FF000C00FF000C008A +:101AF000FF000C40FF000C00FF000C00FF000C007A +:101B0000FF000C40FF000C00FF000C00FF000C0069 +:101B1000FF000C42FF000C00FF000C40FF000C0017 +:101B2000FF000C42FF000C00FF000C02FF000C0045 +:101B3000FF000C02FF000C00FF000C02FF000C0075 +:101B4000FF000C42FF000C00FF000CC0FF000C0067 +:101B5000FF000C40FF0009050B040A000C63FF00A6 +:101B60000C03FF000C26FF000C02FF000C2CFF00F2 +:101B70000C00FF000C24FF000C00FF000C2EFF00E7 +:101B80000C02FF000C02FF000C02FF000C00FF0023 +:101B90000C00FF000C00FF000C00FF000C00FF0019 +:101BA0000C00FF000C00FF000C00FF000C00FF0009 +:101BB0000C00FF000C00FF000C00FF000C00FF00F9 +:101BC0000C00FF000C00FF000C00FF000C00FF00E9 +:101BD0000C00FF000C00FF000C00FF000C00FF00D9 +:101BE0000C00FF000C00FF000C00FF000C00FF00C9 +:101BF0000C00FF000C00FF000C00FF000C00FF00B9 +:101C00000C00FF000C00FF000C00FF000C00FF00A8 +:101C10000C00FF000C00FF000C00FF000C00FF0098 +:101C20000C00FF000C00FF000C00FF000C00FF0088 +:101C30000C00FF000C00FF000C00FF000C00FF0078 +:101C40000C00FF000C00FF000C00FF000C00FF0068 +:101C50000C00FF000C00FF000C00FF000C00FF0058 +:101C60000C01FF000C20FF000C00FF000C60FF00C7 +:101C70000C00FF000C20FF000C00FF000C20FF00F8 +:101C80000C00FF000C20FF000C00FF000C20FF00E8 +:101C90000C00FF000C20FF000C00FF000C20FF00D8 +:101CA0000C00FF000C20FF000C00FF000C20FF00C8 +:101CB0000C00FF000C60FF000C00FF000C20FF0078 +:101CC0000C00FF000C60FF000C00FF000C20FF0068 +:101CD0000C00FF000C60FF000C00FF000C20FF0058 +:101CE0000C00FF000C60FF000C00FF000C20FF0048 +:101CF0000C00FF000C60FF000C00FF000C20FF0038 +:101D00000C00FF000C60FF000C00FF000C20FF0027 +:101D10000C00FF000C20FF000C00FF000C22FF0055 +:101D20000C02FF000C22FF000C02FF000C20FF0041 +:101D30000C00FF000C60FF000C00FF000C22FF00F5 +:101D40000C02FF000C62FF000C02FF000C20FF00E1 +:101D50000C01FF000C21FF000C01FF0009010B0624 +:101D60000A000D000C00FF000A020D000C00FF002D +:101D70000A040D000C00FF000A060D000C00FF0015 +:101D80000A080D000C00FF000A0A0D000C00FF00FD +:101D90000A0C0D000C00FF000A0E0D000C00FF00E5 +:101DA0000A100D000C00FF000A120D000C00FF00CD +:101DB0000A140D000C00FF000A160D000C00FF00B5 +:101DC0000A180D000C00FF000A1A0D000C00FF009D +:101DD0000A1C0D000C00FF000A1E0D000C00FF0085 +:101DE0000A200D000C00FF000A220D000C00FF006D +:101DF0000A240D000C00FF000A260D000C00FF0055 +:101E00000A280D000C00FF000A2A0D000C00FF003C +:101E10000A2C0D000C00FF000A2E0D000C00FF0024 +:101E20000A300D000C00FF000A320D000C00FF000C +:101E30000A340D000C00FF000A360D000C00FF00F4 +:101E40000A380D000C00FF000A3A0D000C00FF00DC +:101E50000A3C0D000C00FF000A3E0D000C00FF00C4 +:101E60000A400D000C00FF000A420D030C00FF00A9 +:101E70000A440D010C00FF000A460D0A0C21FF0068 +:101E80000A480D0D0C23FF000A4A0D230C1BFF000E +:101E90000A4C0D370C8FFF000A4E0D450C77FF00E2 +:101EA0000A500D520CE2FF000A520D1C0C92FF006A +:101EB0000A540D1C0C52FF000A560D070C00FF00BF +:101EC0000A580D2F0CC6FF000A5A0D0B0C00FF001C +:101ED0000A5C0D300C06FF000A5E0D170C00FF00B7 +:101EE0000A600D3D0CDAFF000A620D290C00FF00AC +:101EF0000A640D3E0C41FF000A660D390C00FF001C +:101F00000A680D4C0C48FF000A6A0D490C00FF00DE +:101F10000A6C0D4C0C6CFF000A6E0D110CD2FF0008 +:101F20000A700D160C0CFF000A720D000C00FF0069 +:101F30000A740D000C80FF000A760D0F0C00FF00E4 +:101F40000A780D000C80FF000A7A0D130C00FF00C8 +:101F50000A7C0D800C00FF000A7E0D800C80FF00C3 +:101F600009050B070A000D0F0CFFFF000D000C0008 +:101F7000FF000D080C00FF000D080C00FF000D0213 +:101F80000C00FF000D000C00FF000D000C00FF0016 +:101F90000D0F0CFFFF000D000C00FF000D000C00EA +:101FA000FF000D080C00FF000D080C00FF000D00E5 +:101FB0000C00FF000D0F0CFFFF000D000C00FF00D8 +:101FC0000D000C00FF000D0F0CFFFF000D0F0CFFAC +:101FD000FF000D000C00FF000D000C00FF000D00C5 +:101FE0000C00FF000D000C00FF000D000C00FF00B6 +:101FF0000D000C00FF000D000C00FF000D000C0098 +:10200000FF000D000C00FF000D000C00FF000D0094 +:102010000C00FF000D000C00FF000D000C00FF0085 +:102020000D000C00FF000D000C00FF000D000C0067 +:10203000FF000D000C00FF000D000C00FF000D0064 +:102040000C00FF000D000C00FF000D000C00FF0055 +:102050000D000C00FF000D000C00FF000D000C0037 +:10206000FF000D000C00FF000D000C00FF000D0034 +:102070000C00FF000D000C00FF000D000C00FF0025 +:102080000D000C00FF000D000C00FF000D000C0007 +:10209000FF000D000C00FF000D000C00FF000D0004 +:1020A0000C00FF000D000C00FF000D000C00FF00F5 +:1020B0000D000C00FF000D000C00FF000D000C00D7 +:1020C000FF000D000C00FF000D000C00FF000D00D4 +:1020D0000C00FF000D000C00FF000D000C00FF00C5 +:1020E0000D000C00FF000D000C00FF000D000C00A7 +:1020F000FF000D000C00FF000D000C00FF000D00A4 +:102100000C00FF000D000C00FF000D000C00FF0094 +:102110000D000C00FF000D000C00FF000D000C0076 +:10212000FF000D000C00FF000D0F0CFFFF000D0F56 +:102130000CFFFF000D0F0CFFFF000D0F0CFFFF0049 +:102140000D020CE9FF000D060C8CFF000D060C8C37 +:10215000FF000D0F0CFFFF000D1A0C75FF000D0D99 +:102160000C8BFF000D040CE9FF000D0B0C16FF009B +:102170000D1A0C38FF000D0D0CC8FF000D040C6F7C +:10218000FF000D0B0C91FF000D0F0CFFFF000D0663 +:102190000C40FF000D060C40FF000D020C8FFF00ED +:1021A0000D0F0CFFFF000D060C62FF000D060C6208 +:1021B000FF000D020C7BFF000D0F0CFFFF000D0652 +:1021C0000C97FF000D060C97FF000D020C52FF004C +:1021D0000D0F0CFFFF000D060CF6FF000D060CF6B0 +:1021E000FF000D020C19FF000D050C55FF000D0539 +:1021F0000C55FF000D050C55FF000D050C55FF009B +:102200000D050C55FF000D050C55FF000D050C5577 +:10221000FF000D050C55FF000D140CDAFF000D0D2D +:102220000C93FF000D040CDAFF000D050C93FF006A +:102230000D140CDAFF000D0D0C93FF000D040CDAE9 +:10224000FF000D050C93FF000D000C00FF000D00BA +:102250000C00FF000D000C00FF000D000C00FF0043 +:102260000D020C00FF000E010F00FF000E020F0018 +:10227000FF000E010F01FF000E020F00FF000E0114 +:102280000F02FF000E020F00FF000E010F03FF0000 +:102290000E020F00FF000E010F04FF000E020F00E0 +:1022A000FF000E010F05FF000E020F00FF000E01E0 +:1022B0000F06FF000E020F00FF000E010F07FF00C8 +:1022C0000E020F00FF000E010F08FF000E020F00AC +:1022D000FF000E010F09FF000E020F00FF000E01AC +:1022E0000F0AFF000E020F00FF000E010F0BFF0090 +:1022F0000E020F00FF000E010F0CFF000E020F0078 +:10230000FF000E010F0DFF000E020F00FF000E0177 +:102310000F0EFF000E020F00FF000E010F0FFF0057 +:102320000E020F00FF000EB00F20FF000EB10F20B5 +:10233000FF000EB20F20FF000EB30F20FF000EB4FF +:102340000F20FF000EB50F20FF000EB60F20FF007C +:102350000EB70F20FF000EB80F20FF000EB90F20A0 +:10236000FF000EBA0F20FF000EBB0F20FF000EBCB7 +:102370000F20FF000EBD0F20FF000EBE0F20FF003C +:102380000EBF0F20FF000EF00F20FF000EF10F20F8 +:10239000FF000EF20F20FF000EF30F20FF000EF4DF +:1023A0000F20FF000EF50F20FF000EF60F20FF009C +:1023B0000EF70F20FF000EF80F20FF000EF90F2080 +:1023C000FF000EFA0F20FF000EFB0F20FF000EFC97 +:1023D0000F20FF000EFD0F20FF000EFE0F20FF005C +:1023E0000EFF0F20FF000E100FFFFF000E110FFF5A +:1023F000FF000E120FFFFF000E130FFFFF000E1461 +:102400000FFFFF000E150FFFFF000E160FFFFF005E +:102410000E170FFFFF000E180FFFFF000E190FFF22 +:10242000FF000E1A0FFFFF000E1B0FFFFF000E1C18 +:102430000FFFFF000E1D0FFFFF000E1E0F40FF00DD +:102440000E1F0FFFFF000E200FFFFF000E210FFFDA +:10245000FF000E220FFFFF000E230FFFFF000E24D0 +:102460000FFFFF000E250FFFFF000E260FFFFF00DE +:102470000E270FFFFF000E280FFFFF000E290FFF92 +:10248000FF000E2A0FFFFF000E2B0FFFFF000E2C88 +:102490000FFFFF000E2D0FFFFF000E2E0F00FF009D +:1024A0000E2F0F00FF000E300F00FF000E310F0047 +:1024B000FF000E320F00FF000E330F00FF000E343E +:1024C0000F00FF000E350F00FF000E360F00FF005B +:1024D0000E370F00FF000E380F00FF000E390F00FF +:1024E000FF000E3A0F00FF000E3B0F00FF000E3CF6 +:1024F0000F00FF000E3D0F00FF000E3E0F00FF001B +:102500000E3F0F20FF000E400F00FF000E410F0096 +:10251000FF000E420F00FF000E430F00FF000E44AD +:102520000F00FF000E450F00FF000E460F00FF00DA +:102530000E470F00FF000E480F00FF000E490F006E +:10254000FF000E4A0F00FF000E4B0F00FF000E4C65 +:102550000F00FF000E4D0F00FF000E4E0F0EFF008C +:102560000E4F0F0EFF000E500F00FF000E510F0018 +:10257000FF000E520F00FF000E530F00FF000E541D +:102580000F00FF000E550F00FF000E560F00FF005A +:102590000E570F00FF000E580F00FF000E590F00DE +:1025A000FF000E5A0F00FF000E5B0F00FF000E5CD5 +:1025B0000F00FF000E5D0F00FF000E5E0F00FF001A +:1025C0000E5F0F00FF000E600F00FF000E610F0096 +:1025D000FF000E620F00FF000E630F00FF000E648D +:1025E0000F00FF000E650F00FF000E660F00FF00DA +:1025F0000E670F00FF000E680F00FF000E690F004E +:10260000FF000E6A0F00FF000E6B0F00FF000E6C44 +:102610000F40FF000E6D0F00FF000E6E0F40FF0019 +:102620000E6F0F40FF000E700FC0FF000E710FC045 +:10263000FF000E720FC0FF000E730FC0FF000E747C +:102640000FC0FF000E750FC0FF000E760FC0FF0019 +:102650000E770FC0FF000E780FC0FF000E790FC07D +:10266000FF000E7A0FC0FF000E7B0FC0FF000E7C34 +:102670000FC0FF000E7D0FC0FF000E7E0FC0FF00D9 +:102680000E7F0FC0FF000E800F00FF000E810F00B5 +:10269000FF000E820F00FF000E830F00FF000E846C +:1026A0000F00FF000E850F00FF000E860F00FF00D9 +:1026B0000E870F00FF000E880F00FF000E890F002D +:1026C000FF000E8A0F00FF000E8B0F00FF000E8C24 +:1026D0000F00FF000E8D0F00FF000E8E0F00FF0099 +:1026E0000E8F0F00FF000E900F00FF000E910F00E5 +:1026F000FF000E920F00FF000E930F00FF000E94DC +:102700000F00FF000E950F00FF000E960F00FF0058 +:102710000E970F00FF000E980F00FF000E990F009C +:10272000FF000E9A0F00FF000E9B0F00FF000E9C93 +:102730000F00FF000E9D0F00FF000E9E0F00FF0018 +:102740000E9F0F00FF000EA00F00FF000EA10F0054 +:10275000FF000EA20F00FF000EA30F00FF000EA44B +:102760000F00FF000EA50F00FF000EA60F00FF00D8 +:102770000EA70F00FF000EA80F00FF000EA90F000C +:10278000FF000EAA0F00FF000EAB0F00FF000EAC03 +:102790000F00FF000EAD0F00FF000EAE0F00FF0098 +:1027A0000EAF0F00FF000EC00F00FF000EC10F00A4 +:1027B000FF000EC20F00FF000EC30F00FF000EC48B +:1027C0000F00FF000EC50F00FF000EC60F00FF0038 +:1027D0000EC70F00FF000EC80F00FF000EC90F004C +:1027E000FF000ECA0F00FF000ECB0F00FF000ECC43 +:1027F0000F00FF000ECD0F00FF000ECE0F00FF00F8 +:102800000ECF0F00FF000ED00F00FF000ED10F0003 +:10281000FF000ED20F00FF000ED30F00FF000ED4FA +:102820000F00FF000ED50F00FF000ED60F00FF00B7 +:102830000ED70F00FF000ED80F00FF000ED90F00BB +:10284000FF000EDA0F00FF000EDB0F00FF000EDCB2 +:102850000F00FF000EDD0F00FF000EDE0F10FF0067 +:102860000EDF0F10FF000EE00F00FF000EE10F0063 +:10287000FF000EE20F00FF000EE30F00FF000EE46A +:102880000F00FF000EE50F00FF000EE60F00FF0037 +:102890000EE70F00FF000EE80F00FF000EE90F002B +:1028A000FF000EEA0F00FF000EEB0F00FF000EEC22 +:1028B0000F00FF000EED0F00FF000EEE0F00FF00F7 +:1028C0000EEF0F00FF000E010F000E020F01FF00C0 +:1028D0000E010F010E020F01FF000E010F020E028A +:1028E0000F01FF000E010F030E020F01FF000E018A +:1028F0000F040E020F01FF000E010F050E020F0163 +:10290000FF000E010F060E020F01FF000E010F0760 +:102910000E020F01FF000E010F080E020F01FF0053 +:102920000E010F090E020F01FF000E010F0A0E0229 +:102930000F01FF000E010F0B0E020F01FF000E0131 +:102940000F0C0E020F01FF000E010F0D0E020F0102 +:10295000FF000E010F0E0E020F01FF000E010F0F00 +:102960000E020F01FF0008020B070A460D000C00C3 +:10297000FF000B070A490D000C00FF000B000A4B7B +:102980000D030C11FF000B000A4D0D010C32FF006E +:102990000B070A460D000C00FF000B070A490D004B +:1029A0000C00FF000B070A400D000C00FF000B0796 +:1029B0000A410D000C00FF000B010A400D020C4003 +:1029C000FF000B010A410D020C60FF000B070A40DB +:1029D0000D000C00FF000B070A410D000C00FF006A +:1029E0000B070A470D000C00FF000B070A4A0D00F9 +:1029F0000C00FF000B000A470D010C00FF000B004C +:102A00000A4A0D010C20FF000B070A470D000C00BD +:102A1000FF000B070A4A0D000C00FF000B070A7CA1 +:102A20000D000C00FF000B070A7E0D000C00FF00DC +:102A30000B000A000D010C1CFF000B070A7C0D00A7 +:102A40000C00FF000B070A7E0D000C00FF000B07B7 +:102A50000A440D000C00FF000B000A440D010C009D +:102A6000FF000B070A440D000C00FF000B070A4291 +:102A70000D000C00FF000B070A430D000C00FF00C7 +:102A80000B000A420D010C1AFF000B000A430D0156 +:102A90000C20FF000B070A420D000C00FF000B0783 +:102AA0000A430D000C00FF000B070A400D000C004C +:102AB000FF000B070A410D000C00FF000B010A404C +:102AC0000D020C40FF000B010A410D020C60FF00DB +:102AD0000B070A400D000C00FF000B070A410D0018 +:102AE0000C00FF000B070A440D0F0CFFFF000B0743 +:102AF0000A420D000C00FF000B070A430D000C00FA +:102B0000FF000B070A400D000C00FF000B070A41F5 +:102B10000D000C00FF000B070A510D060C40FF00D2 +:102B20000B070A500D060C40FF000B070A4F0D0360 +:102B30000C81FF000B070A530D1A0C76FF000B07E0 +:102B40000A540D0D0C8BFF000B070A550D040CE900 +:102B5000FF000B070A560D0B0C17FF000B070A5757 +:102B60000D1A0C38FF000B070A580D0D0CC9FF0099 +:102B70000B070A590D040C6FFF000B070A5A0D0BC7 +:102B80000C91FF000B070A730D140CDAFF000B0702 +:102B90000A740D0D0C93FF000B070A750D040CD978 +:102BA000FF000B070A760D050C93FF000B070A7751 +:102BB0000D140CDAFF000B070A780D0D0C93FF00C3 +:102BC0000B070A790D040CD9FF000B070A7A0D05D3 +:102BD0000C93FF000B070A5E0D030C68FF000B0748 +:102BE0000A5C0D040C31FF000B070A5D0D040C316B +:102BF000FF000B070A620D030C52FF000B070A606F +:102C00000D040C76FF000B070A610D040C76FF0023 +:102C10000B070A660D030C2EFF000B070A640D0458 +:102C20000CDAFF000B070A650D040CDAFF000B0736 +:102C30000A6A0D020CF6FF000B070A680D050C620C +:102C4000FF000B070A690D050C62FF000B060A4620 +:102C50000D0A0C22FF000B060A480D0D0C24FF0084 +:102C60000B060A6E0D110CD3FF000B060A700D1532 +:102C70000CCBFF000B060A520D200C93FF000B0635 +:102C80000A540D200C54FF000B060A4A0D270C1D98 +:102C9000FF000B060A580D2F0CC8FF000B060A5C3C +:102CA0000D300C07FF000B060A4C0D370C90FF008F +:102CB0000B060A600D3D0CDBFF000B060A640D3E9F +:102CC0000C42FF000B060A4E0D450C78FF000B0668 +:102CD0000A680D4C0C48FF000B060A6C0D4C0C6C7E +:102CE000FF000B060A500D520CE2FF000B060A42D1 +:102CF0000D020CBAFF00FF000E1E0F14FF000EDEC7 +:102D00000F20FF000EDF0F20FF000B060A780D00DA +:102D10000C40FF000B070A030D0F0CFFFF000B0711 +:102D20000A0B0D0F0CFFFF000B070A020D000C0031 +:102D3000FF000B070A0A0D000C00FF000B070A46F4 +:102D40000D000C00FF000B070A490D000C000905DF +:102D50000B000A100D000C00FF000D000C00FF001E +:102D60000D020C00FF000D000C00FF000D000C0018 +:102D7000FF000D000C00FF000D000C00FF000D0017 +:102D80000C00FF000D000C00FF000D000C00FF0008 +:102D90000D000C00FF000D000C00FF000D000C00EA +:102DA000FF000D000C00FF000D000C00FF000D00E7 +:102DB0000C00FF000D000C00FF000D000C00FF00D8 +:102DC0000D000C00FF000D000C00FF000D000C00BA +:102DD000FF000D000C00FF000D000C00FF000D00B7 +:102DE0000C00FF000D000C00FF000D000C00FF00A8 +:102DF0000D000C00FF000D000C00FF000D000C008A +:102E0000FF000D000C00FF000D000C00FF000D0086 +:102E10000C00FF000D000C00FF000D000C00FF0077 +:102E20000D000C00FF000D000C00FF000D000C0059 +:102E3000FF000D000C00FF000D000C00FF000D0056 +:102E40000C00FF000D000C00FF000D000C00FF0047 +:102E50000D000C00FF000D000C00FF000D000C0029 +:102E6000FF000D000C00FF000D000C00FF000D0026 +:102E70000C00FF0009050B010A100D010CC0FF003A +:102E80000D010CFAFF000D000C1AFF000D000C00E4 +:102E9000FF000D000C00FF000D000C00FF000D00F6 +:102EA0000C00FF000D000C00FF000D000C00FF00E7 +:102EB0000D000C00FF000D000C00FF000D000C00C9 +:102EC000FF000D000C00FF000D000C00FF000D00C6 +:102ED0000C00FF000D000C00FF000D000C00FF00B7 +:102EE0000D000C00FF000D000C00FF000D000C0099 +:102EF000FF000D000C00FF000D000C00FF000D0096 +:102F00000C00FF000D000C00FF000D000C00FF0086 +:102F10000D000C00FF000D000C00FF000D000C0068 +:102F2000FF000D000C00FF000D000C00FF000D0065 +:102F30000C00FF000D000C00FF000D000C00FF0056 +:102F40000D000C00FF000D000C00FF000D000C0038 +:102F5000FF000D000C00FF000D000C00FF000D0035 +:102F60000C00FF000D000C00FF000D000C00FF0026 +:102F70000D000C00FF000D000C00FF000D000C0008 +:102F8000FF000D000C00FF000D000C00FF000D0005 +:102F90000C00FF000D000C00FF00FF00FF00090502 +:102FA0000B020A100C46FF000C46FF000C00FF004D +:102FB0000C00FF000C00FF000C00FF000C00FF00E5 +:102FC0000C00FF000C00FF000C00FF000C00FF00D5 +:102FD0000C00FF000C00FF000C00FF000C00FF00C5 +:102FE0000C00FF000C00FF000C00FF000C00FF00B5 +:102FF0000C00FF000C00FF000C00FF000C00FF00A5 +:103000000C00FF000C00FF000C00FF000C00FF0094 +:103010000C00FF000C00FF000C00FF000C00FF0084 +:103020000C00FF000C00FF000C00FF000C00FF0074 +:103030000C00FF000C00FF000C00FF000C00FF0064 +:103040000C00FF000C00FF000C00FF000C00FF0054 +:103050000C00FF000C00FF000C00FF000C00FF0044 +:103060000C00FF0009050B030A100C00FF000C0008 +:10307000FF000C00FF000C00FF000C00FF000C0024 +:10308000FF000C00FF000C00FF000C00FF000C0014 +:10309000FF000C00FF000C00FF000C00FF000C0004 +:1030A000FF000C00FF000C00FF000C00FF000C00F4 +:1030B000FF000C00FF000C00FF000C00FF000C00E4 +:1030C000FF000C00FF000C00FF000C00FF000C00D4 +:1030D000FF000C00FF000C00FF000C00FF000C00C4 +:1030E000FF000C00FF000C00FF000C00FF000C00B4 +:1030F000FF000C00FF000C00FF000C00FF000C00A4 +:10310000FF000C00FF000C00FF000C00FF000C0093 +:10311000FF000C00FF000C00FF000C00FF000C0083 +:10312000FF000C00FF000C00FF0009050B040A1053 +:103130000C00FF000C00FF000C00FF000C00FF0063 +:103140000C00FF000C00FF000C00FF000C00FF0053 +:103150000C00FF000C00FF000C00FF000C00FF0043 +:103160000C00FF000C00FF000C00FF000C00FF0033 +:103170000C00FF000C00FF000C00FF000C00FF0023 +:103180000C00FF000C00FF000C00FF000C00FF0013 +:103190000C00FF000C00FF000C00FF000C00FF0003 +:1031A0000C00FF000C00FF000C00FF000C00FF00F3 +:1031B0000C00FF000C00FF000C00FF000C00FF00E3 +:1031C0000C00FF000C00FF000C00FF000C00FF00D3 +:1031D0000C00FF000C00FF000C00FF000C00FF00C3 +:1031E0000C00FF000C00FF000C00FF000C00FF00B3 +:1031F00009010B060A100D000C00FF000A120D0059 +:103200000C00FF000A140D000C00FF000A160D0050 +:103210000C00FF000A180D000C00FF000A1A0D0038 +:103220000C00FF000A1C0D000C00FF000A1E0D0020 +:103230000C00FF000A200D000C00FF000A220D0008 +:103240000C00FF000A240D000C00FF000A260D00F0 +:103250000C00FF000A280D000C00FF000A2A0D00D8 +:103260000C00FF000A2C0D000C00FF000A2E0D00C0 +:103270000C00FF000A300D000C00FF000A320D00A8 +:103280000C00FF000A340D000C00FF000A360D0090 +:103290000C00FF000A380D000C00FF000A3A0D0078 +:1032A0000C00FF000A3C0D000C00FF000A3E0D0060 +:1032B0000C00FF0009050B070A100D0F0CFFFF00A3 +:1032C0000D0F0CFFFF000D000C00FF000D000C00A7 +:1032D000FF000D000C00FF000D000C00FF000D00B2 +:1032E0000C00FF000D000C00FF000D000C00FF00A3 +:1032F0000D000C00FF000D000C00FF000D000C0085 +:10330000FF000D000C00FF000D000C00FF000D0081 +:103310000C00FF000D000C00FF000D000C00FF0072 +:103320000D000C00FF000D000C00FF000D000C0054 +:10333000FF000D000C00FF000D000C00FF000D0051 +:103340000C00FF000D000C00FF000D000C00FF0042 +:103350000D000C00FF000D000C00FF000D000C0024 +:10336000FF000D000C00FF000D000C00FF000D0021 +:103370000C00FF000D000C00FF000D000C00FF0012 +:103380000D000C00FF000D000C00FF000D000C00F4 +:10339000FF000D000C00FF000D000C00FF000D00F1 +:1033A0000C00FF000D000C00FF000D000C00FF00E2 +:1033B0000D000C00FF000D000C00FF000D000C00C4 +:1033C000FF000D000C00FF000D000C00FF000D00C1 +:1033D0000C00FF000D000C00FF000E010F00FF00AD +:1033E0000E020F00FF000E010F01FF000E020F0082 +:1033F000FF000E010F02FF000E020F00FF000E0182 +:103400000F03FF000E020F00FF000E010F04FF006C +:103410000E020F00FF000E010F05FF000E020F004D +:10342000FF000E010F06FF000E020F00FF000E014D +:103430000F07FF000E020F00FF000EB00F20FF006D +:103440000EB10F20FF000EB20F20FF000EB30F20B1 +:10345000FF000EB40F20FF000EB50F20FF000EB6C8 +:103460000F20FF000EB70F20FF000EF00F20FF000F +:103470000EF10F20FF000EF20F20FF000EF30F20C1 +:10348000FF000EF40F20FF000EF50F20FF000EF6D8 +:103490000F20FF000EF70F20FF000E100FFFFF00A0 +:1034A0000E110FFFFF000E120FFFFF000E130FFF94 +:1034B000FF000E140FFFFF000E150FFFFF000E168A +:1034C0000FFFFF000E170FFFFF000E200FFFFF0082 +:1034D0000E210FFFFF000E220FFFFF000E230FFF34 +:1034E000FF000E240FFFFF000E250FFFFF000E262A +:1034F0000FFFFF000E270FFFFF000E300F00FF0031 +:103500000E310F00FF000E320F00FF000E330F00D0 +:10351000FF000E340F00FF000E350F00FF000E36C7 +:103520000F00FF000E370F00FF000E400F00FF00DE +:103530000E410F00FF000E420F00FF000E430F0070 +:10354000FF000E440F00FF000E450F00FF000E4667 +:103550000F00FF000E470F00FF000E500F00FF008E +:103560000E510F00FF000E520F00FF000E530F0010 +:10357000FF000E540F00FF000E550F00FF000E5607 +:103580000F00FF000E570F00FF000E600F00FF003E +:103590000E610F00FF000E620F00FF000E630F00B0 +:1035A000FF000E640F00FF000E650F00FF000E66A7 +:1035B0000F00FF000E670F00FF000E700FC0FF002E +:1035C0000E710FC0FF000E720FC0FF000E730FC010 +:1035D000FF000E740FC0FF000E750FC0FF000E76C7 +:1035E0000FC0FF000E770FC0FF000E800F00FF001E +:1035F0000E810F00FF000E820F00FF000E830F00F0 +:10360000FF000E840F00FF000E850F00FF000E86E6 +:103610000F00FF000E870F00FF000E900F00FF004D +:103620000E910F00FF000E920F00FF000E930F008F +:10363000FF000E940F00FF000E950F00FF000E9686 +:103640000F00FF000E970F00FF000EA00F00FF00FD +:103650000EA10F00FF000EA20F00FF000EA30F002F +:10366000FF000EA40F00FF000EA50F00FF000EA626 +:103670000F00FF000EA70F00FF000EC00F00FF009D +:103680000EC10F00FF000EC20F00FF000EC30F009F +:10369000FF000EC40F00FF000EC50F00FF000EC696 +:1036A0000F00FF000EC70F00FF000ED00F00FF003D +:1036B0000ED10F00FF000ED20F00FF000ED30F003F +:1036C000FF000ED40F00FF000ED50F00FF000ED636 +:1036D0000F00FF000ED70F00FF000EE00F00FF00ED +:1036E0000EE10F00FF000EE20F00FF000EE30F00DF +:1036F000FF000EE40F00FF000EE50F00FF000EE6D6 +:103700000F00FF000EE70F00FF000E010F00FF008B +:103710000E020F01FF000E010F01FF000E020F014C +:10372000FF000E010F02FF000E020F01FF000E014D +:103730000F03FF000E020F01FF000E010F04FF0038 +:103740000E020F01FF000E010F05FF000E020F0118 +:10375000FF000E010F06FF000E020F01FF000E0119 +:103760000F07FF000E020F01FF000B070A460D00B6 +:103770000C00FF000B070A490D000C00FF000B07AF +:103780000A450D0F0CFFFF000B070A480D0F0CFF39 +:10379000FF000B070A7B0D040CCCFF000B070A7D12 +:1037A0000D040CCCFF000B070A7C0D000C00FF0081 +:1037B0000B070A7E0D000C00FF000B070A460D00E8 +:1037C0000C00FF000B070A490D000C00FF000B075F +:1037D0000A470D000C00FF000B070A4A0D000C0001 +:1037E000FF000B070A4C0D000C00FF000B070A4EF0 +:1037F0000D000C00FF000B070A4C0D000C000B071E +:103800000A4E0D000C000B070A4C0D000C280B078C +:103810000A4E0D000C280B070A4C0D000C510B072B +:103820000A4E0D000C510B070A4C0D000C7A0B07C9 +:103830000A4E0D000C7A0B070A4C0D000CA30B0767 +:103840000A4E0D000CA30B070A4C0D000CCC0B0705 +:103850000A4E0D000CCC0B070A4C0D000CF50B07A3 +:103860000A4E0D000CF50B070A4C0D010C1E0B0740 +:103870000A4E0D010C1E0B070A4C0D010C470B07DD +:103880000A4E0D010C470B070A4C0D010C700B077B +:103890000A4E0D010C700B070A4C0D010C990B0719 +:1038A0000A4E0D010C990B070A4C0D010CC20B07B7 +:1038B0000A4E0D010CC20B070A4C0D010CEB0B0755 +:1038C0000A4E0D010CEB0B070A4C0D020C140B07F2 +:1038D0000A4E0D020C140B070A4C0D020C3D0B078F +:1038E0000A4E0D020C3D0B070A4C0D020C660B072D +:1038F0000A4E0D020C660B070A4C0D020C8F0B07CB +:103900000A4E0D020C8F0B070A4C0D020CB80B0768 +:103910000A4E0D020CB80B070A4C0D020CE10B0706 +:103920000A4E0D020CE10B070A4C0D030C0A0B07A3 +:103930000A4E0D030C0A0B070A4C0D030C330B0740 +:103940000A4E0D030C330B070A4C0D030C5C0B07DE +:103950000A4E0D030C5C0B070A4C0D030C850B077C +:103960000A4E0D030C850B070A4C0D030CAE0B071A +:103970000A4E0D030CAE0B070A4C0D030CD70B07B8 +:103980000A4E0D030CD70B070A4C0D040C000B0755 +:103990000A4E0D040C000B070A4C0D040C280B07F3 +:1039A0000A4E0D040C280B070A4C0D040C510B0792 +:1039B0000A4E0D040C510B070A4C0D040C7A0B0730 +:1039C0000A4E0D040C7A0B070A4C0D040CA30B07CE +:1039D0000A4E0D040CA30B070A4C0D040CCC0B076C +:1039E0000A4E0D040CCC0B070A4C0D040CF50B070A +:1039F0000A4E0D040CF50B070A4C0D050C1E0B07A7 +:103A00000A4E0D050C1E0B070A4C0D050C470B0743 +:103A10000A4E0D050C470B070A4C0D050C700B07E1 +:103A20000A4E0D050C700B070A4C0D050C990B077F +:103A30000A4E0D050C990B070A4C0D050CC20B071D +:103A40000A4E0D050CC20B070A4C0D050CEB0B07BB +:103A50000A4E0D050CEB0B070A4C0D060C140B0758 +:103A60000A4E0D060C140B070A4C0D060C3D0B07F5 +:103A70000A4E0D060C3D0B070A4C0D060C660B0793 +:103A80000A4E0D060C660B070A4C0D060C8F0B0731 +:103A90000A4E0D060C8F0B070A4C0D060CB80B07CF +:103AA0000A4E0D060CB80B070A4C0D060CE10B076D +:103AB0000A4E0D060CE10B070A4C0D070C0A0B070A +:103AC0000A4E0D070C0A0B070A4C0D070C330B07A7 +:103AD0000A4E0D070C330B070A4C0D070C5C0B0745 +:103AE0000A4E0D070C5C0B070A4C0D070C850B07E3 +:103AF0000A4E0D070C850B070A4C0D070CAE0B0781 +:103B00000A4E0D070CAE0B070A4C0D070CD70B071E +:103B10000A4E0D070CD70B070A4C0D080C000B07BB +:103B20000A4E0D080C000B070A4C0D080C280B0759 +:103B30000A4E0D080C280B070A4C0D080C510B07F8 +:103B40000A4E0D080C510B070A4C0D080C7A0B0796 +:103B50000A4E0D080C7A0B070A4C0D080CA30B0734 +:103B60000A4E0D080CA30B070A4C0D080CCC0B07D2 +:103B70000A4E0D080CCC0B070A4C0D080CF50B0770 +:103B80000A4E0D080CF50B070A4C0D090C1E0B070D +:103B90000A4E0D090C1E0B070A4C0D090C470B07AA +:103BA0000A4E0D090C470B070A4C0D090C700B0748 +:103BB0000A4E0D090C700B070A4C0D090C990B07E6 +:103BC0000A4E0D090C990B070A4C0D090CC20B0784 +:103BD0000A4E0D090CC20B070A4C0D090CEB0B0722 +:103BE0000A4E0D090CEB0B070A4C0D0A0C140B07BF +:103BF0000A4E0D0A0C140B070A4C0D0A0C3D0B075C +:103C00000A4E0D0A0C3D0B070A4C0D0A0C660B07F9 +:103C10000A4E0D0A0C660B070A4C0D0A0C8F0B0797 +:103C20000A4E0D0A0C8F0B070A4C0D0A0CB80B0735 +:103C30000A4E0D0A0CB80B070A4C0D0A0CE10B07D3 +:103C40000A4E0D0A0CE10B070A4C0D0B0C0A0B0770 +:103C50000A4E0D0B0C0A0B070A4C0D0B0C330B070D +:103C60000A4E0D0B0C330B070A4C0D0B0C5C0B07AB +:103C70000A4E0D0B0C5C0B070A4C0D0B0C850B0749 +:103C80000A4E0D0B0C850B070A4C0D0B0CAE0B07E7 +:103C90000A4E0D0B0CAE0B070A4C0D0B0CD70B0785 +:103CA0000A4E0D0B0CD70B070A4C0D0C0C000B0722 +:103CB0000A4E0D0C0C000B070A4C0D0C0C280B07C0 +:103CC0000A4E0D0C0C280B070A4C0D0C0C510B075F +:103CD0000A4E0D0C0C510B070A4C0D0C0C7A0B07FD +:103CE0000A4E0D0C0C7A0B070A4C0D0C0CA30B079B +:103CF0000A4E0D0C0CA30B070A4C0D0C0CCC0B0739 +:103D00000A4E0D0C0CCC0B070A4C0D0C0CF50B07D6 +:103D10000A4E0D0C0CF50B070A4C0D0D0C1E0B0773 +:103D20000A4E0D0D0C1E0B070A4C0D0D0C470B0710 +:103D30000A4E0D0D0C470B070A4C0D0D0C700B07AE +:103D40000A4E0D0D0C700B070A4C0D0D0C990B074C +:103D50000A4E0D0D0C990B070A4C0D0D0CC20B07EA +:103D60000A4E0D0D0CC20B070A4C0D0D0CEB0B0788 +:103D70000A4E0D0D0CEB0B070A4C0D0E0C140B0725 +:103D80000A4E0D0E0C140B070A4C0D0E0C3D0B07C2 +:103D90000A4E0D0E0C3D0B070A4C0D0E0C660B0760 +:103DA0000A4E0D0E0C660B070A4C0D0E0C8F0B07FE +:103DB0000A4E0D0E0C8F0B070A4C0D0E0CB80B079C +:103DC0000A4E0D0E0CB80B070A4C0D0E0CE10B073A +:103DD0000A4E0D0E0CE10B070A4C0D0F0C0A0B07D7 +:103DE0000A4E0D0F0C0A0B070A4C0D0F0C330B0774 +:103DF0000A4E0D0F0C330B070A4C0D0F0C5C0B0712 +:103E00000A4E0D0F0C5C0B070A4C0D0F0C850B07AF +:103E10000A4E0D0F0C850B070A4C0D0F0CAE0B074D +:103E20000A4E0D0F0CAE0B070A4C0D0F0CD70B07EB +:103E30000A4E0D0F0CD70B070A4C0D0F0CFF0B078A +:0A3E40000A4E0D0F0CFF0800FF00F2 +:00000001FF diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index c5c9a9218ff6..c6942a4de99b 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -395,16 +395,6 @@ config SND_WAVEFRONT To compile this driver as a module, choose M here: the module will be called snd-wavefront. -config SND_WAVEFRONT_FIRMWARE_IN_KERNEL - bool "In-kernel firmware for Wavefront" - depends on SND_WAVEFRONT - default y - help - Say Y here to include the static firmware for FX DSP built in - the kernel for the Wavefront driver. If you choose N here, - you need to install the firmware files from the - alsa-firmware package. - config SND_MSND_PINNACLE tristate "Turtle Beach MultiSound Pinnacle/Fiji driver" depends on X86 && EXPERIMENTAL diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index dfc449a2194e..a4345fc07561 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -34,14 +34,6 @@ #define WAIT_IDLE 0xff -#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL -#include "yss225.c" -static const struct firmware yss225_registers_firmware = { - .data = (u8 *)yss225_registers, - .size = sizeof yss225_registers -}; -#endif - static int wavefront_fx_idle (snd_wavefront_t *dev) @@ -260,16 +252,12 @@ snd_wavefront_fx_start (snd_wavefront_t *dev) if (dev->fx_initialized) return 0; -#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL - firmware = &yss225_registers_firmware; -#else err = request_firmware(&firmware, "yamaha/yss225_registers.bin", dev->card->dev); if (err < 0) { err = -1; goto out; } -#endif for (i = 0; i + 1 < firmware->size; i += 2) { if (firmware->data[i] >= 8 && firmware->data[i] < 16) { @@ -292,12 +280,8 @@ snd_wavefront_fx_start (snd_wavefront_t *dev) err = 0; out: -#ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL release_firmware(firmware); -#endif return err; } -#ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL MODULE_FIRMWARE("yamaha/yss225_registers.bin"); -#endif diff --git a/sound/isa/wavefront/yss225.c b/sound/isa/wavefront/yss225.c deleted file mode 100644 index 9f6be3ff8ecf..000000000000 --- a/sound/isa/wavefront/yss225.c +++ /dev/null @@ -1,2739 +0,0 @@ -/* - * Copyright (c) 1998-2002 by Paul Davis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* weird stuff, derived from port I/O tracing with dosemu */ - -static const struct { - unsigned char addr; - unsigned char data; -} yss225_registers[] __devinitdata = { -/* Set all bits for all channels on the MOD unit to zero */ -{ WAIT_IDLE }, { 0xe, 0x10 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x11 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x12 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x13 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x14 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x15 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x16 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x17 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x18 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x19 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x20 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x21 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x22 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x23 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x24 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x25 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x26 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x27 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x28 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x29 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x30 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x31 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x32 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x33 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x34 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x35 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x36 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x37 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x38 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x39 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x40 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x41 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x42 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x43 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x44 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x45 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x46 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x47 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x48 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x49 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x50 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x51 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x52 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x53 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x54 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x55 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x56 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x57 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x58 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x59 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x60 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x61 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x62 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x63 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x64 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x65 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x66 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x67 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x68 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x69 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x70 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x71 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x72 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x73 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x74 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x75 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x76 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x77 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x78 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x79 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x80 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x81 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x82 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x83 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x84 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x85 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x86 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x87 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x88 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x89 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x90 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x91 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x92 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x93 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x94 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x95 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x96 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x97 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x98 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x99 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xaa }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xab }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xac }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xad }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xae }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xaf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xba }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbe }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xca }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xce }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xda }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xde }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xea }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xeb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xec }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xed }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xee }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xef }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfa }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfe }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xff }, { 0xf, 0x00 }, - -/* XXX But why do this twice? */ -{ WAIT_IDLE }, { 0xe, 0x10 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x11 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x12 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x13 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x14 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x15 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x16 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x17 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x18 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x19 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x20 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x21 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x22 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x23 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x24 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x25 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x26 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x27 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x28 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x29 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x30 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x31 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x32 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x33 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x34 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x35 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x36 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x37 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x38 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x39 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x40 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x41 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x42 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x43 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x44 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x45 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x46 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x47 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x48 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x49 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x50 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x51 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x52 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x53 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x54 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x55 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x56 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x57 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x58 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x59 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x60 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x61 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x62 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x63 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x64 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x65 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x66 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x67 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x68 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x69 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x70 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x71 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x72 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x73 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x74 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x75 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x76 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x77 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x78 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x79 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x80 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x81 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x82 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x83 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x84 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x85 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x86 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x87 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x88 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x89 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x90 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x91 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x92 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x93 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x94 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x95 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x96 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x97 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x98 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x99 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xaa }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xab }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xac }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xad }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xae }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xaf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xba }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbe }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xca }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xce }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xda }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xde }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xea }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xeb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xec }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xed }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xee }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xef }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfa }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfe }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xff }, { 0xf, 0x00 }, - -/* mute on */ -{ WAIT_IDLE }, { 0x8, 0x02 }, - -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x44 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x42 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x43 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x7c }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x7e }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x46 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x49 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x47 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x4a }, { 0xd, 0x00 }, { 0xc, 0x00 }, - -/* either because of stupidity by TB's programmers, or because it - actually does something, rezero the MOD page. */ -{ WAIT_IDLE }, { 0xe, 0x10 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x11 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x12 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x13 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x14 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x15 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x16 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x17 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x18 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x19 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x1f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x20 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x21 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x22 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x23 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x24 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x25 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x26 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x27 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x28 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x29 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x2f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x30 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x31 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x32 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x33 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x34 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x35 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x36 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x37 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x38 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x39 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x3f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x40 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x41 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x42 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x43 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x44 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x45 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x46 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x47 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x48 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x49 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x4f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x50 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x51 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x52 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x53 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x54 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x55 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x56 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x57 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x58 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x59 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x5f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x60 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x61 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x62 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x63 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x64 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x65 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x66 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x67 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x68 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x69 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x6f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x70 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x71 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x72 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x73 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x74 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x75 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x76 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x77 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x78 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x79 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x7f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x80 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x81 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x82 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x83 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x84 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x85 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x86 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x87 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x88 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x89 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x8f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x90 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x91 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x92 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x93 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x94 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x95 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x96 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x97 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x98 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x99 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9a }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9b }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9c }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9d }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9e }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0x9f }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xa9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xaa }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xab }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xac }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xad }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xae }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xaf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xb9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xba }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbe }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xbf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xc9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xca }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xce }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xcf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xd9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xda }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xde }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xdf }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xe9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xea }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xeb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xec }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xed }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xee }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xef }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf0 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf1 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf2 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf3 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf4 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf5 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf6 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf7 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf8 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xf9 }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfa }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfb }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfc }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfd }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xfe }, { 0xf, 0x00 }, -{ WAIT_IDLE }, { 0xe, 0xff }, { 0xf, 0x00 }, - -/* load page zero */ -{ 0x9, 0x05 }, { 0xb, 0x00 }, { 0xa, 0x00 }, - -{ 0xd, 0x01 }, { 0xc, 0x7c }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1e }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xf5 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x11 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x32 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x13 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x14 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x76 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x18 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x19 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0x1a }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0x17 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x10 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0xa0 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xd1 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0xf2 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x13 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xf4 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xe0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x15 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x16 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x17 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x50 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x71 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x92 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xb3 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xa0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xd4 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xf5 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x70 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0xa0 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x11 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x16 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x10 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x17 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1b }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1d }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xdf }, { WAIT_IDLE }, - -/* Now load page one */ -{ 0x9, 0x05 }, { 0xb, 0x01 }, { 0xa, 0x00 }, - -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x19 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1f }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xd8 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x19 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x18 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0xfa }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1a }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xfb }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xa0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1b }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xd7 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xf7 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1c }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x3c }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x3f }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xdf }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x5d }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x7d }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0x9e }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xbe }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x03 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1b }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xdb }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xdb }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xe0 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xfb }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xfb }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1b }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x02 }, { 0xa, 0x00 }, - -{ 0xc, 0xc4 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x25 }, { WAIT_IDLE }, -{ 0xc, 0x01 }, { WAIT_IDLE }, -{ 0xc, 0x06 }, { WAIT_IDLE }, -{ 0xc, 0xc4 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x25 }, { WAIT_IDLE }, -{ 0xc, 0x01 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x04 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x04 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x05 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x44 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x03 }, { 0xa, 0x00 }, - -{ 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x47 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x06 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x70 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x42 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x42 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x42 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x42 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x40 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x04 }, { 0xa, 0x00 }, - -{ 0xc, 0x63 }, { WAIT_IDLE }, -{ 0xc, 0x03 }, { WAIT_IDLE }, -{ 0xc, 0x26 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x2c }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x24 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x2e }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x01 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x22 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x22 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x22 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x62 }, { WAIT_IDLE }, -{ 0xc, 0x02 }, { WAIT_IDLE }, -{ 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xc, 0x01 }, { WAIT_IDLE }, -{ 0xc, 0x21 }, { WAIT_IDLE }, -{ 0xc, 0x01 }, { WAIT_IDLE }, - -/* Load memory area (page six) */ -{ 0x9, 0x01 }, { 0xb, 0x06 }, - -{ 0xa, 0x00 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x02 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x04 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x06 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x08 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x0a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x0c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x0e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x10 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x12 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x14 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x16 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x18 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x1a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x1c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x1e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x20 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x22 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x24 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x26 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x28 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x2a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x2c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x2e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x30 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x32 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x34 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x36 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x38 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x3a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x3c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x3e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x40 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x42 }, { 0xd, 0x03 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x44 }, { 0xd, 0x01 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x46 }, { 0xd, 0x0a }, { 0xc, 0x21 }, { WAIT_IDLE }, -{ 0xa, 0x48 }, { 0xd, 0x0d }, { 0xc, 0x23 }, { WAIT_IDLE }, -{ 0xa, 0x4a }, { 0xd, 0x23 }, { 0xc, 0x1b }, { WAIT_IDLE }, -{ 0xa, 0x4c }, { 0xd, 0x37 }, { 0xc, 0x8f }, { WAIT_IDLE }, -{ 0xa, 0x4e }, { 0xd, 0x45 }, { 0xc, 0x77 }, { WAIT_IDLE }, -{ 0xa, 0x50 }, { 0xd, 0x52 }, { 0xc, 0xe2 }, { WAIT_IDLE }, -{ 0xa, 0x52 }, { 0xd, 0x1c }, { 0xc, 0x92 }, { WAIT_IDLE }, -{ 0xa, 0x54 }, { 0xd, 0x1c }, { 0xc, 0x52 }, { WAIT_IDLE }, -{ 0xa, 0x56 }, { 0xd, 0x07 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x58 }, { 0xd, 0x2f }, { 0xc, 0xc6 }, { WAIT_IDLE }, -{ 0xa, 0x5a }, { 0xd, 0x0b }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x5c }, { 0xd, 0x30 }, { 0xc, 0x06 }, { WAIT_IDLE }, -{ 0xa, 0x5e }, { 0xd, 0x17 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x60 }, { 0xd, 0x3d }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xa, 0x62 }, { 0xd, 0x29 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x64 }, { 0xd, 0x3e }, { 0xc, 0x41 }, { WAIT_IDLE }, -{ 0xa, 0x66 }, { 0xd, 0x39 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x68 }, { 0xd, 0x4c }, { 0xc, 0x48 }, { WAIT_IDLE }, -{ 0xa, 0x6a }, { 0xd, 0x49 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x6c }, { 0xd, 0x4c }, { 0xc, 0x6c }, { WAIT_IDLE }, -{ 0xa, 0x6e }, { 0xd, 0x11 }, { 0xc, 0xd2 }, { WAIT_IDLE }, -{ 0xa, 0x70 }, { 0xd, 0x16 }, { 0xc, 0x0c }, { WAIT_IDLE }, -{ 0xa, 0x72 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x74 }, { 0xd, 0x00 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xa, 0x76 }, { 0xd, 0x0f }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x78 }, { 0xd, 0x00 }, { 0xc, 0x80 }, { WAIT_IDLE }, -{ 0xa, 0x7a }, { 0xd, 0x13 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x7c }, { 0xd, 0x80 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x7e }, { 0xd, 0x80 }, { 0xc, 0x80 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x07 }, { 0xa, 0x00 }, - -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x08 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x08 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x08 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x08 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0xe9 }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x8c }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x8c }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x1a }, { 0xc, 0x75 }, { WAIT_IDLE }, -{ 0xd, 0x0d }, { 0xc, 0x8b }, { WAIT_IDLE }, -{ 0xd, 0x04 }, { 0xc, 0xe9 }, { WAIT_IDLE }, -{ 0xd, 0x0b }, { 0xc, 0x16 }, { WAIT_IDLE }, -{ 0xd, 0x1a }, { 0xc, 0x38 }, { WAIT_IDLE }, -{ 0xd, 0x0d }, { 0xc, 0xc8 }, { WAIT_IDLE }, -{ 0xd, 0x04 }, { 0xc, 0x6f }, { WAIT_IDLE }, -{ 0xd, 0x0b }, { 0xc, 0x91 }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x8f }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x62 }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x62 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x7b }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x97 }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0x97 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x52 }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0xf6 }, { WAIT_IDLE }, -{ 0xd, 0x06 }, { 0xc, 0xf6 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x19 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x55 }, { WAIT_IDLE }, -{ 0xd, 0x14 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xd, 0x0d }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xd, 0x04 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xd, 0x14 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xd, 0x0d }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xd, 0x04 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xd, 0x05 }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, - -/* Now setup the MOD area. */ -{ 0xe, 0x01 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x02 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x03 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x04 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x05 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x06 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x07 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x08 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x09 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0a }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0b }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0c }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0d }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0e }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0f }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, - -{ 0xe, 0xb0 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb1 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb2 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb3 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb4 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb5 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb6 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb7 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb8 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb9 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xba }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xbb }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xbc }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xbd }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xbe }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xbf }, { 0xf, 0x20 }, { WAIT_IDLE }, - -{ 0xe, 0xf0 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf1 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf2 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf3 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf4 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf5 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf6 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf7 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf8 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf9 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xfa }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xfb }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xfc }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xfd }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xfe }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xff }, { 0xf, 0x20 }, { WAIT_IDLE }, - -{ 0xe, 0x10 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x11 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x12 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x13 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x14 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x15 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x16 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x17 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x18 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x19 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x1a }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x1b }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x1c }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x1d }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x1e }, { 0xf, 0x40 }, { WAIT_IDLE }, -{ 0xe, 0x1f }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x20 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x21 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x22 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x23 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x24 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x25 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x26 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x27 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x28 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x29 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x2a }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x2b }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x2c }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x2d }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x2e }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x2f }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x30 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x31 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x32 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x33 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x34 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x35 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x36 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x37 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x38 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x39 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x3a }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x3b }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x3c }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x3d }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x3e }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x3f }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0x40 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x41 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x42 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x43 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x44 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x45 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x46 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x47 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x48 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x49 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x4a }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x4b }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x4c }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x4d }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x4e }, { 0xf, 0x0e }, { WAIT_IDLE }, -{ 0xe, 0x4f }, { 0xf, 0x0e }, { WAIT_IDLE }, -{ 0xe, 0x50 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x51 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x52 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x53 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x54 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x55 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x56 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x57 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x58 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x59 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x5a }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x5b }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x5c }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x5d }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x5e }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x5f }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x60 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x61 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x62 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x63 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x64 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x65 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x66 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x67 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x68 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x69 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x6a }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x6b }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x6c }, { 0xf, 0x40 }, { WAIT_IDLE }, -{ 0xe, 0x6d }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x6e }, { 0xf, 0x40 }, { WAIT_IDLE }, -{ 0xe, 0x6f }, { 0xf, 0x40 }, { WAIT_IDLE }, -{ 0xe, 0x70 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x71 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x72 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x73 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x74 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x75 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x76 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x77 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x78 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x79 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x7a }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x7b }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x7c }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x7d }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x7e }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x7f }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x80 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x81 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x82 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x83 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x84 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x85 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x86 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x87 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x88 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x89 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x8a }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x8b }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x8c }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x8d }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x8e }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x8f }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x90 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x91 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x92 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x93 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x94 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x95 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x96 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x97 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x98 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x99 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x9a }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x9b }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x9c }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x9d }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x9e }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x9f }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa8 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa9 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xaa }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xab }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xac }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xad }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xae }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xaf }, { 0xf, 0x00 }, { WAIT_IDLE }, - -{ 0xe, 0xc0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc8 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc9 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xca }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xcb }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xcc }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xcd }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xce }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xcf }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd8 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd9 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xda }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xdb }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xdc }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xdd }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xde }, { 0xf, 0x10 }, { WAIT_IDLE }, -{ 0xe, 0xdf }, { 0xf, 0x10 }, { WAIT_IDLE }, -{ 0xe, 0xe0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe8 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe9 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xea }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xeb }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xec }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xed }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xee }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xef }, { 0xf, 0x00 }, { WAIT_IDLE }, - -{ 0xe, 0x01 }, { 0xf, 0x00 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x01 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x02 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x03 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x04 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x05 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x06 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x07 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x08 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x09 }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0a }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0b }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0c }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0d }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0e }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x0f }, { 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, - -/* mute on */ -{ 0x8, 0x02 }, - -/* Now set the coefficients and so forth for the programs above */ -{ 0xb, 0x07 }, { 0xa, 0x46 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x49 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x4b }, { 0xd, 0x03 }, { 0xc, 0x11 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x4d }, { 0xd, 0x01 }, { 0xc, 0x32 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x46 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x49 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x40 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x41 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x01 }, { 0xa, 0x40 }, { 0xd, 0x02 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xb, 0x01 }, { 0xa, 0x41 }, { 0xd, 0x02 }, { 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x40 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x41 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x47 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x4a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x47 }, { 0xd, 0x01 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x4a }, { 0xd, 0x01 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x47 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x4a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x00 }, { 0xd, 0x01 }, { 0xc, 0x1c }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x44 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x44 }, { 0xd, 0x01 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x44 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x42 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x43 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x42 }, { 0xd, 0x01 }, { 0xc, 0x1a }, { WAIT_IDLE }, -{ 0xb, 0x00 }, { 0xa, 0x43 }, { 0xd, 0x01 }, { 0xc, 0x20 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x42 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x43 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x40 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x41 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x01 }, { 0xa, 0x40 }, { 0xd, 0x02 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xb, 0x01 }, { 0xa, 0x41 }, { 0xd, 0x02 }, { 0xc, 0x60 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x40 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x41 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x44 }, { 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x42 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x43 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x40 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x41 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x51 }, { 0xd, 0x06 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x50 }, { 0xd, 0x06 }, { 0xc, 0x40 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x4f }, { 0xd, 0x03 }, { 0xc, 0x81 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x53 }, { 0xd, 0x1a }, { 0xc, 0x76 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x54 }, { 0xd, 0x0d }, { 0xc, 0x8b }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x55 }, { 0xd, 0x04 }, { 0xc, 0xe9 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x56 }, { 0xd, 0x0b }, { 0xc, 0x17 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x57 }, { 0xd, 0x1a }, { 0xc, 0x38 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x58 }, { 0xd, 0x0d }, { 0xc, 0xc9 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x59 }, { 0xd, 0x04 }, { 0xc, 0x6f }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x5a }, { 0xd, 0x0b }, { 0xc, 0x91 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x73 }, { 0xd, 0x14 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x74 }, { 0xd, 0x0d }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x75 }, { 0xd, 0x04 }, { 0xc, 0xd9 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x76 }, { 0xd, 0x05 }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x77 }, { 0xd, 0x14 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x78 }, { 0xd, 0x0d }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x79 }, { 0xd, 0x04 }, { 0xc, 0xd9 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7a }, { 0xd, 0x05 }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x5e }, { 0xd, 0x03 }, { 0xc, 0x68 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x5c }, { 0xd, 0x04 }, { 0xc, 0x31 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x5d }, { 0xd, 0x04 }, { 0xc, 0x31 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x62 }, { 0xd, 0x03 }, { 0xc, 0x52 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x60 }, { 0xd, 0x04 }, { 0xc, 0x76 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x61 }, { 0xd, 0x04 }, { 0xc, 0x76 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x66 }, { 0xd, 0x03 }, { 0xc, 0x2e }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x64 }, { 0xd, 0x04 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x65 }, { 0xd, 0x04 }, { 0xc, 0xda }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x6a }, { 0xd, 0x02 }, { 0xc, 0xf6 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x68 }, { 0xd, 0x05 }, { 0xc, 0x62 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x69 }, { 0xd, 0x05 }, { 0xc, 0x62 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x46 }, { 0xd, 0x0a }, { 0xc, 0x22 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x48 }, { 0xd, 0x0d }, { 0xc, 0x24 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x6e }, { 0xd, 0x11 }, { 0xc, 0xd3 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x70 }, { 0xd, 0x15 }, { 0xc, 0xcb }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x52 }, { 0xd, 0x20 }, { 0xc, 0x93 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x54 }, { 0xd, 0x20 }, { 0xc, 0x54 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x4a }, { 0xd, 0x27 }, { 0xc, 0x1d }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x58 }, { 0xd, 0x2f }, { 0xc, 0xc8 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x5c }, { 0xd, 0x30 }, { 0xc, 0x07 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x4c }, { 0xd, 0x37 }, { 0xc, 0x90 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x60 }, { 0xd, 0x3d }, { 0xc, 0xdb }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x64 }, { 0xd, 0x3e }, { 0xc, 0x42 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x4e }, { 0xd, 0x45 }, { 0xc, 0x78 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x68 }, { 0xd, 0x4c }, { 0xc, 0x48 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x6c }, { 0xd, 0x4c }, { 0xc, 0x6c }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x50 }, { 0xd, 0x52 }, { 0xc, 0xe2 }, { WAIT_IDLE }, -{ 0xb, 0x06 }, { 0xa, 0x42 }, { 0xd, 0x02 }, { 0xc, 0xba }, { WAIT_IDLE }, - -/* Some settings (?) */ -{ WAIT_IDLE }, { 0xe, 0x1e }, { 0xf, 0x14 }, -{ WAIT_IDLE }, { 0xe, 0xde }, { 0xf, 0x20 }, -{ WAIT_IDLE }, { 0xe, 0xdf }, { 0xf, 0x20 }, - -/* some more coefficients */ -{ WAIT_IDLE }, { 0xb, 0x06 }, { 0xa, 0x78 }, { 0xd, 0x00 }, { 0xc, 0x40 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x03 }, { 0xd, 0x0f }, { 0xc, 0xff }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x0b }, { 0xd, 0x0f }, { 0xc, 0xff }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x02 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x0a }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x46 }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ WAIT_IDLE }, { 0xb, 0x07 }, { 0xa, 0x49 }, { 0xd, 0x00 }, { 0xc, 0x00 }, - -/* Now, for some strange reason, lets reload every page - and all the coefficients over again. I have *NO* idea - why this is done. I do know that no sound is produced - is this phase is omitted. */ -{ 0x9, 0x05 }, { 0xb, 0x00 }, { 0xa, 0x10 }, - -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x02 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x01 }, { 0xa, 0x10 }, - -{ 0xd, 0x01 }, { 0xc, 0xc0 }, { WAIT_IDLE }, -{ 0xd, 0x01 }, { 0xc, 0xfa }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x1a }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, - -{ WAIT_IDLE }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x02 }, { 0xa, 0x10 }, - -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x46 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x03 }, { 0xa, 0x10 }, - -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x04 }, { 0xa, 0x10 }, - -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xc, 0x00 }, { WAIT_IDLE }, - -/* Page six v.2 */ -{ 0x9, 0x01 }, { 0xb, 0x06 }, - -{ 0xa, 0x10 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x12 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x14 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x16 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x18 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x1a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x1c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x1e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x20 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x22 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x24 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x26 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x28 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x2a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x2c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x2e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x30 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x32 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x34 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x36 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x38 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x3a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x3c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xa, 0x3e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, - -{ 0x9, 0x05 }, { 0xb, 0x07 }, { 0xa, 0x10 }, - -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, - -{ 0xe, 0x01 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x02 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x03 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x04 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x05 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x06 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x07 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xb0 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb1 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb2 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb3 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb4 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb5 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb6 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xb7 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf0 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf1 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf2 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf3 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf4 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf5 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf6 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0xf7 }, { 0xf, 0x20 }, { WAIT_IDLE }, -{ 0xe, 0x10 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x11 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x12 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x13 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x14 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x15 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x16 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x17 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x20 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x21 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x22 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x23 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x24 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x25 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x26 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x27 }, { 0xf, 0xff }, { WAIT_IDLE }, -{ 0xe, 0x30 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x31 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x32 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x33 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x34 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x35 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x36 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x37 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x40 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x41 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x42 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x43 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x44 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x45 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x46 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x47 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x50 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x51 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x52 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x53 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x54 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x55 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x56 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x57 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x60 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x61 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x62 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x63 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x64 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x65 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x66 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x67 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x70 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x71 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x72 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x73 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x74 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x75 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x76 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x77 }, { 0xf, 0xc0 }, { WAIT_IDLE }, -{ 0xe, 0x80 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x81 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x82 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x83 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x84 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x85 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x86 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x87 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x90 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x91 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x92 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x93 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x94 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x95 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x96 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x97 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xa7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xc7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xd7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe0 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe1 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe2 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe3 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe4 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe5 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe6 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0xe7 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x00 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x02 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x03 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x04 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x05 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x06 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, -{ 0xe, 0x01 }, { 0xf, 0x07 }, { WAIT_IDLE }, -{ 0xe, 0x02 }, { 0xf, 0x01 }, { WAIT_IDLE }, - -{ 0xb, 0x07 }, { 0xa, 0x46 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x49 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x45 }, { 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x48 }, { 0xd, 0x0f }, { 0xc, 0xff }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7b }, { 0xd, 0x04 }, { 0xc, 0xcc }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7d }, { 0xd, 0x04 }, { 0xc, 0xcc }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x7e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x46 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x49 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x47 }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x4a }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0x00 }, { WAIT_IDLE }, - -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x00 }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x00 }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x01 }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x01 }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x01 }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x01 }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x01 }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x01 }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x01 }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x01 }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x01 }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x01 }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x01 }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x01 }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x02 }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x02 }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x02 }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x02 }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x02 }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x02 }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x02 }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x02 }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x02 }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x02 }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x02 }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x02 }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x03 }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x03 }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x03 }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x03 }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x03 }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x03 }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x03 }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x03 }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x03 }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x03 }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x03 }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x03 }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x04 }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x04 }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x05 }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x05 }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x05 }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x05 }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x05 }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x05 }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x05 }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x05 }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x05 }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x05 }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x05 }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x05 }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x06 }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x06 }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x06 }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x06 }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x06 }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x06 }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x06 }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x06 }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x06 }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x06 }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x06 }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x06 }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x07 }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x07 }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x07 }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x07 }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x07 }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x07 }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x07 }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x07 }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x07 }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x07 }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x07 }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x07 }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x08 }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x08 }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x09 }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x09 }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x09 }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x09 }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x09 }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x09 }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x09 }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x09 }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x09 }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x09 }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x09 }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x09 }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0a }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0a }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0a }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0a }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0a }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0a }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0a }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0a }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0a }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0a }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0a }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0a }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0b }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0b }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0b }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0b }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0b }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0b }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0b }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0b }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0b }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0b }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0b }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0b }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0x00 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0x28 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0x51 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0x7a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0xa3 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0xcc }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0c }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0c }, { 0xc, 0xf5 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0d }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0d }, { 0xc, 0x1e }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0d }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0d }, { 0xc, 0x47 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0d }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0d }, { 0xc, 0x70 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0d }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0d }, { 0xc, 0x99 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0d }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0d }, { 0xc, 0xc2 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0d }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0d }, { 0xc, 0xeb }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0e }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0e }, { 0xc, 0x14 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0e }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0e }, { 0xc, 0x3d }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0e }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0e }, { 0xc, 0x66 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0e }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0e }, { 0xc, 0x8f }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0e }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0e }, { 0xc, 0xb8 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0e }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0e }, { 0xc, 0xe1 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0x0a }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0x33 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0x5c }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0x85 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0xae }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0xd7 }, -{ 0xb, 0x07 }, { 0xa, 0x4c }, { 0xd, 0x0f }, { 0xc, 0xff }, -{ 0xb, 0x07 }, { 0xa, 0x4e }, { 0xd, 0x0f }, { 0xc, 0xff }, - -/* mute off */ -{ 0x8, 0x00 }, { WAIT_IDLE } -}; -- cgit v1.2.3 From 488fe1665fd90f204fbc825b90060b9e0394e4be Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 3 Apr 2009 09:41:40 +0200 Subject: sound: usb-audio: show sample format width in proc file When listing the device's sample formats in the stream? proc file, the sample format number itself is rather obscure, so we better show the format width, too. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c2db0f959681..175c7d1da5cf 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -2147,7 +2147,8 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s fp = list_entry(p, struct audioformat, list); snd_iprintf(buffer, " Interface %d\n", fp->iface); snd_iprintf(buffer, " Altset %d\n", fp->altsetting); - snd_iprintf(buffer, " Format: %#x\n", fp->format); + snd_iprintf(buffer, " Format: %#x (%d bits)\n", + fp->format, snd_pcm_format_width(fp->format)); snd_iprintf(buffer, " Channels: %d\n", fp->channels); snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", fp->endpoint & USB_ENDPOINT_NUMBER_MASK, -- cgit v1.2.3 From 4608eb089b41386e96bd1410326073a6c1c221ba Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 3 Apr 2009 09:42:42 +0200 Subject: sound: usb-audio: remove check_hw_params_convention() This removes the check_hw_params_convention() function because 1) it is not necessary, as the hw_rule_* functions also work correctly (i.e., as no-ops) when the device supports all combinations of the audio format parameters; and 2) it would become too complex when adding a fourth altsetting-dependent hardware parameter, as this would require another three loops to check dependecies with rate/channels/format. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 135 ++++++++------------------------------------------- 1 file changed, 19 insertions(+), 116 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 175c7d1da5cf..b7fa0b0b713d 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1736,97 +1736,6 @@ static int hw_rule_format(struct snd_pcm_hw_params *params, return changed; } -#define MAX_MASK 64 - -/* - * check whether the registered audio formats need special hw-constraints - */ -static int check_hw_params_convention(struct snd_usb_substream *subs) -{ - int i; - u32 *channels; - u32 *rates; - u32 cmaster, rmaster; - u32 rate_min = 0, rate_max = 0; - struct list_head *p; - int err = 1; - - channels = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL); - rates = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL); - if (!channels || !rates) { - err = -ENOMEM; - goto __out; - } - - list_for_each(p, &subs->fmt_list) { - struct audioformat *f; - f = list_entry(p, struct audioformat, list); - /* unconventional channels? */ - if (f->channels > 32) - goto __out; - /* continuous rate min/max matches? */ - if (f->rates & SNDRV_PCM_RATE_CONTINUOUS) { - if (rate_min && f->rate_min != rate_min) - goto __out; - if (rate_max && f->rate_max != rate_max) - goto __out; - rate_min = f->rate_min; - rate_max = f->rate_max; - } - /* combination of continuous rates and fixed rates? */ - if (rates[f->format] & SNDRV_PCM_RATE_CONTINUOUS) { - if (f->rates != rates[f->format]) - goto __out; - } - if (f->rates & SNDRV_PCM_RATE_CONTINUOUS) { - if (rates[f->format] && rates[f->format] != f->rates) - goto __out; - } - channels[f->format] |= 1 << (f->channels - 1); - rates[f->format] |= f->rates; - /* needs knot? */ - if (f->rates & SNDRV_PCM_RATE_KNOT) - goto __out; - } - /* check whether channels and rates match for all formats */ - cmaster = rmaster = 0; - for (i = 0; i < MAX_MASK; i++) { - if (cmaster != channels[i] && cmaster && channels[i]) - goto __out; - if (rmaster != rates[i] && rmaster && rates[i]) - goto __out; - if (channels[i]) - cmaster = channels[i]; - if (rates[i]) - rmaster = rates[i]; - } - /* check whether channels match for all distinct rates */ - memset(channels, 0, MAX_MASK * sizeof(u32)); - list_for_each(p, &subs->fmt_list) { - struct audioformat *f; - f = list_entry(p, struct audioformat, list); - if (f->rates & SNDRV_PCM_RATE_CONTINUOUS) - continue; - for (i = 0; i < 32; i++) { - if (f->rates & (1 << i)) - channels[i] |= 1 << (f->channels - 1); - } - } - cmaster = 0; - for (i = 0; i < 32; i++) { - if (cmaster != channels[i] && cmaster && channels[i]) - goto __out; - if (channels[i]) - cmaster = channels[i]; - } - err = 0; - - __out: - kfree(channels); - kfree(rates); - return err; -} - /* * If the device supports unusual bit rates, does the request meet these? */ @@ -1909,32 +1818,26 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre 1000, /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); - err = check_hw_params_convention(subs); - if (err < 0) + if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + hw_rule_rate, subs, + SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_CHANNELS, + -1)) < 0) + return err; + if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + hw_rule_channels, subs, + SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_RATE, + -1)) < 0) + return err; + if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, + hw_rule_format, subs, + SNDRV_PCM_HW_PARAM_RATE, + SNDRV_PCM_HW_PARAM_CHANNELS, + -1)) < 0) + return err; + if ((err = snd_usb_pcm_check_knot(runtime, subs)) < 0) return err; - else if (err) { - hwc_debug("setting extra hw constraints...\n"); - if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, - hw_rule_rate, subs, - SNDRV_PCM_HW_PARAM_FORMAT, - SNDRV_PCM_HW_PARAM_CHANNELS, - -1)) < 0) - return err; - if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, - hw_rule_channels, subs, - SNDRV_PCM_HW_PARAM_FORMAT, - SNDRV_PCM_HW_PARAM_RATE, - -1)) < 0) - return err; - if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, - hw_rule_format, subs, - SNDRV_PCM_HW_PARAM_RATE, - SNDRV_PCM_HW_PARAM_CHANNELS, - -1)) < 0) - return err; - if ((err = snd_usb_pcm_check_knot(runtime, subs)) < 0) - return err; - } return 0; } -- cgit v1.2.3 From 744b89e542b9a16c9afb8a88f623fbe059c88ccb Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 3 Apr 2009 09:45:01 +0200 Subject: sound: usb-audio: save data packet interval in audioformat structure The data packet interval needs to be available in the audioformat structure, together with the other audio format parameters, so that it can be used to influence ALSA hardware parameters. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index b7fa0b0b713d..3f974a64c55e 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -121,6 +121,7 @@ struct audioformat { unsigned char attributes; /* corresponding attributes of cs endpoint */ unsigned char endpoint; /* endpoint */ unsigned char ep_attr; /* endpoint attributes */ + unsigned char datainterval; /* log_2 of data packet interval */ unsigned int maxpacksize; /* max. packet size */ unsigned int rates; /* rate bitmasks */ unsigned int rate_min, rate_max; /* min/max rates */ @@ -1350,12 +1351,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) subs->datapipe = usb_sndisocpipe(dev, ep); else subs->datapipe = usb_rcvisocpipe(dev, ep); - if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH && - get_endpoint(alts, 0)->bInterval >= 1 && - get_endpoint(alts, 0)->bInterval <= 4) - subs->datainterval = get_endpoint(alts, 0)->bInterval - 1; - else - subs->datainterval = 0; + subs->datainterval = fmt->datainterval; subs->syncpipe = subs->syncinterval = 0; subs->maxpacksize = fmt->maxpacksize; subs->fill_max = 0; @@ -2070,6 +2066,9 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s } snd_iprintf(buffer, "\n"); } + if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) + snd_iprintf(buffer, " Data packet interval: %d us\n", + 125 * (1 << fp->datainterval)); // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); } @@ -2563,6 +2562,17 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp return 0; } +static unsigned char parse_datainterval(struct snd_usb_audio *chip, + struct usb_host_interface *alts) +{ + if (snd_usb_get_speed(chip->dev) == USB_SPEED_HIGH && + get_endpoint(alts, 0)->bInterval >= 1 && + get_endpoint(alts, 0)->bInterval <= 4) + return get_endpoint(alts, 0)->bInterval - 1; + else + return 0; +} + static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, int iface, int altno); static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) @@ -2668,6 +2678,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) fp->altset_idx = i; fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; + fp->datainterval = parse_datainterval(chip, alts); fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) @@ -2859,6 +2870,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, return -EINVAL; } alts = &iface->altsetting[fp->altset_idx]; + fp->datainterval = parse_datainterval(chip, alts); fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); usb_set_interface(chip->dev, fp->iface, 0); init_usb_pitch(chip->dev, fp->iface, alts, fp); @@ -2953,6 +2965,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, fp->iface = altsd->bInterfaceNumber; fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; + fp->datainterval = 0; fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); switch (fp->maxpacksize) { @@ -3020,6 +3033,7 @@ static int create_ua1000_quirk(struct snd_usb_audio *chip, fp->iface = altsd->bInterfaceNumber; fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; + fp->datainterval = parse_datainterval(chip, alts); fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]); @@ -3072,6 +3086,7 @@ static int create_ua101_quirk(struct snd_usb_audio *chip, fp->iface = altsd->bInterfaceNumber; fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; + fp->datainterval = parse_datainterval(chip, alts); fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); fp->rate_max = fp->rate_min = combine_triple(&alts->extra[15]); -- cgit v1.2.3 From a7d9c0990d5503775784fef7ff44d74d7e3294fd Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 3 Apr 2009 09:48:26 +0200 Subject: sound: usb-audio: allow period sizes less than 1 ms To enable periods shorter than 1 ms, we have to make sure that short periods are only available for alternate settings that have a small enough data packet interval. Furthermore, the code that aligns URBs to USB frames is now superfluous. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 106 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 86 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 3f974a64c55e..823296d7d578 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -171,7 +171,6 @@ struct snd_usb_substream { unsigned int curframesize; /* current packet size in frames (for capture) */ unsigned int fill_max: 1; /* fill max packet size always */ unsigned int fmt_type; /* USB audio format type (1-3) */ - unsigned int packs_per_ms; /* packets per millisecond (for playback) */ unsigned int running: 1; /* running status */ @@ -608,9 +607,7 @@ static int prepare_playback_urb(struct snd_usb_substream *subs, break; } } - /* finish at the frame boundary at/after the period boundary */ - if (period_elapsed && - (i & (subs->packs_per_ms - 1)) == subs->packs_per_ms - 1) + if (period_elapsed) /* finish at the period boundary */ break; } if (subs->hwptr_done + offs > runtime->buffer_size) { @@ -1068,7 +1065,6 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri packs_per_ms = 8 >> subs->datainterval; else packs_per_ms = 1; - subs->packs_per_ms = packs_per_ms; if (is_playback) { urb_packs = max(nrpacks, 1); @@ -1088,18 +1084,17 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri minsize -= minsize >> 3; minsize = max(minsize, 1u); total_packs = (period_bytes + minsize - 1) / minsize; - /* round up to multiple of packs_per_ms */ - total_packs = (total_packs + packs_per_ms - 1) - & ~(packs_per_ms - 1); /* we need at least two URBs for queueing */ - if (total_packs < 2 * packs_per_ms) { - total_packs = 2 * packs_per_ms; + if (total_packs < 2) { + total_packs = 2; } else { /* and we don't want too long a queue either */ maxpacks = max(MAX_QUEUE * packs_per_ms, urb_packs * 2); total_packs = min(total_packs, maxpacks); } } else { + while (urb_packs > 1 && urb_packs * maxsize >= period_bytes) + urb_packs >>= 1; total_packs = MAX_URBS * urb_packs; } subs->nurbs = (total_packs + urb_packs - 1) / urb_packs; @@ -1564,11 +1559,15 @@ static struct snd_pcm_hardware snd_usb_hardware = #define hwc_debug(fmt, args...) /**/ #endif -static int hw_check_valid_format(struct snd_pcm_hw_params *params, struct audioformat *fp) +static int hw_check_valid_format(struct snd_usb_substream *subs, + struct snd_pcm_hw_params *params, + struct audioformat *fp) { struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); struct snd_interval *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + struct snd_interval *pt = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_TIME); + unsigned int ptime; /* check the format */ if (!snd_mask_test(fmts, fp->format)) { @@ -1589,6 +1588,14 @@ static int hw_check_valid_format(struct snd_pcm_hw_params *params, struct audiof hwc_debug(" > check: rate_max %d < min %d\n", fp->rate_max, it->min); return 0; } + /* check whether the period time is >= the data packet interval */ + if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) { + ptime = 125 * (1 << fp->datainterval); + if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { + hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); + return 0; + } + } return 1; } @@ -1607,7 +1614,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params, list_for_each(p, &subs->fmt_list) { struct audioformat *fp; fp = list_entry(p, struct audioformat, list); - if (!hw_check_valid_format(params, fp)) + if (!hw_check_valid_format(subs, params, fp)) continue; if (changed++) { if (rmin > fp->rate_min) @@ -1661,7 +1668,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params, list_for_each(p, &subs->fmt_list) { struct audioformat *fp; fp = list_entry(p, struct audioformat, list); - if (!hw_check_valid_format(params, fp)) + if (!hw_check_valid_format(subs, params, fp)) continue; if (changed++) { if (rmin > fp->channels) @@ -1714,7 +1721,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params, list_for_each(p, &subs->fmt_list) { struct audioformat *fp; fp = list_entry(p, struct audioformat, list); - if (!hw_check_valid_format(params, fp)) + if (!hw_check_valid_format(subs, params, fp)) continue; fbits |= (1ULL << fp->format); } @@ -1732,6 +1739,44 @@ static int hw_rule_format(struct snd_pcm_hw_params *params, return changed; } +static int hw_rule_period_time(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_usb_substream *subs = rule->private; + struct audioformat *fp; + struct snd_interval *it; + unsigned char min_datainterval; + unsigned int pmin; + int changed; + + it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_TIME); + hwc_debug("hw_rule_period_time: (%u,%u)\n", it->min, it->max); + min_datainterval = 0xff; + list_for_each_entry(fp, &subs->fmt_list, list) { + if (!hw_check_valid_format(subs, params, fp)) + continue; + min_datainterval = min(min_datainterval, fp->datainterval); + } + if (min_datainterval == 0xff) { + hwc_debug(" --> get emtpy\n"); + it->empty = 1; + return -EINVAL; + } + pmin = 125 * (1 << min_datainterval); + changed = 0; + if (it->min < pmin) { + it->min = pmin; + it->openmin = 0; + changed = 1; + } + if (snd_interval_checkempty(it)) { + it->empty = 1; + return -EINVAL; + } + hwc_debug(" --> (%u,%u) (changed = %d)\n", it->min, it->max, changed); + return changed; +} + /* * If the device supports unusual bit rates, does the request meet these? */ @@ -1777,6 +1822,8 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime, static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs) { struct list_head *p; + unsigned int pt, ptmin; + int param_period_time_if_needed; int err; runtime->hw.formats = subs->formats; @@ -1786,6 +1833,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre runtime->hw.channels_min = 256; runtime->hw.channels_max = 0; runtime->hw.rates = 0; + ptmin = UINT_MAX; /* check min/max rates and channels */ list_for_each(p, &subs->fmt_list) { struct audioformat *fp; @@ -1804,34 +1852,52 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre runtime->hw.period_bytes_min = runtime->hw.period_bytes_max = fp->frame_size; } + pt = 125 * (1 << fp->datainterval); + ptmin = min(ptmin, pt); } - /* set the period time minimum 1ms */ - /* FIXME: high-speed mode allows 125us minimum period, but many parts - * in the current code assume the 1ms period. - */ + param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; + if (snd_usb_get_speed(subs->dev) != USB_SPEED_HIGH) + /* full speed devices have fixed data packet interval */ + ptmin = 1000; + if (ptmin == 1000) + /* if period time doesn't go below 1 ms, no rules needed */ + param_period_time_if_needed = -1; snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, - 1000, - /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); + ptmin, UINT_MAX); if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, hw_rule_rate, subs, SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_CHANNELS, + param_period_time_if_needed, -1)) < 0) return err; if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, hw_rule_channels, subs, SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_RATE, + param_period_time_if_needed, -1)) < 0) return err; if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, hw_rule_format, subs, SNDRV_PCM_HW_PARAM_RATE, SNDRV_PCM_HW_PARAM_CHANNELS, + param_period_time_if_needed, -1)) < 0) return err; + if (param_period_time_if_needed >= 0) { + err = snd_pcm_hw_rule_add(runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_TIME, + hw_rule_period_time, subs, + SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_CHANNELS, + SNDRV_PCM_HW_PARAM_RATE, + -1); + if (err < 0) + return err; + } if ((err = snd_usb_pcm_check_knot(runtime, subs)) < 0) return err; return 0; -- cgit v1.2.3 From bca68467b59a24396554d8dd5979ee363c174854 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Mon, 6 Apr 2009 18:42:42 +0900 Subject: ALSA: hda - add missing comma in ad1884_slave_vols Signed-off-by: Akinobu Mita Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 5bb48ee8b6c6..38ad3f7b040f 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3256,7 +3256,7 @@ static const char *ad1884_slave_vols[] = { "Mic Playback Volume", "CD Playback Volume", "Internal Mic Playback Volume", - "Docking Mic Playback Volume" + "Docking Mic Playback Volume", /* "Beep Playback Volume", */ "IEC958 Playback Volume", NULL -- cgit v1.2.3 From d2e8e52976b9d0a34db529b06952d5187b78af8c Mon Sep 17 00:00:00 2001 From: Deepika Makhija Date: Sat, 4 Apr 2009 18:08:28 +0530 Subject: ALSA: oss - volume control for CSWITCH and CROUTE Added an else part to check SNDRV_MIXER_OSS_PRESENT_CVOLUME for MIC (slot 7) in commit 36c7b833e5d2501142a371e4e75281d3a29fbd6b Similarly, checks and volume control is required for SNDRV_MIXER_OSS_PRESENT_CSWITCH and SNDRV_MIXER_OSS_PRESENT_CROUTE as well. Signed-off-by: Deepika Makhija Signed-off-by: Viral Mehta Signed-off-by: Takashi Iwai --- sound/core/oss/mixer_oss.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index e570649184e2..5dcd8a526970 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -703,19 +703,27 @@ static int snd_mixer_oss_put_volume1(struct snd_mixer_oss_file *fmixer, if (left || right) { if (slot->present & SNDRV_MIXER_OSS_PRESENT_PSWITCH) snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PSWITCH], left, right, 0); + if (slot->present & SNDRV_MIXER_OSS_PRESENT_CSWITCH) + snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CSWITCH], left, right, 0); if (slot->present & SNDRV_MIXER_OSS_PRESENT_GSWITCH) snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GSWITCH], left, right, 0); if (slot->present & SNDRV_MIXER_OSS_PRESENT_PROUTE) snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PROUTE], left, right, 1); + if (slot->present & SNDRV_MIXER_OSS_PRESENT_CROUTE) + snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CROUTE], left, right, 1); if (slot->present & SNDRV_MIXER_OSS_PRESENT_GROUTE) snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GROUTE], left, right, 1); } else { if (slot->present & SNDRV_MIXER_OSS_PRESENT_PSWITCH) { snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PSWITCH], left, right, 0); + } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_CSWITCH) { + snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CSWITCH], left, right, 0); } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GSWITCH) { snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GSWITCH], left, right, 0); } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_PROUTE) { snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PROUTE], left, right, 1); + } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_CROUTE) { + snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CROUTE], left, right, 1); } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GROUTE) { snd_mixer_oss_put_volume1_sw(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GROUTE], left, right, 1); } -- cgit v1.2.3 From fd60cc897a6a5093acd9d6554013e679fcc6c5a1 Mon Sep 17 00:00:00 2001 From: Matthew Ranostay Date: Mon, 6 Apr 2009 09:30:46 -0400 Subject: ALSA: hda - Add VREF powerdown sequence for another board Add powerdown sequence for VREF using a shared jack when the headphone is present and the microphone isn't on. Signed-off-by: Matthew Ranostay Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b34d78b88a85..61996a2f45df 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4413,6 +4413,24 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) if (spec->num_pwrs > 0) stac92xx_pin_sense(codec, event->nid); stac92xx_report_jack(codec, event->nid); + + switch (codec->subsystem_id) { + case 0x103c308f: + if (event->nid == 0xb) { + int pin = AC_PINCTL_IN_EN; + + if (get_pin_presence(codec, 0xa) + && get_pin_presence(codec, 0xb)) + pin |= AC_PINCTL_VREF_80; + if (!get_pin_presence(codec, 0xb)) + pin |= AC_PINCTL_VREF_80; + + /* toggle VREF state based on mic + hp pin + * status + */ + stac92xx_auto_set_pinctl(codec, 0x0a, pin); + } + } break; case STAC_VREF_EVENT: data = snd_hda_codec_read(codec, codec->afg, 0, -- cgit v1.2.3 From 284901a90a9e0b812ca3f5f852cbbfb60d10249d Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Mon, 6 Apr 2009 19:01:15 -0700 Subject: dma-mapping: replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32) Replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32) Signed-off-by: Yang Hongyang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/arm/mach-davinci/board-evm.c | 4 ++-- arch/arm/mach-davinci/usb.c | 4 ++-- arch/arm/mach-kirkwood/common.c | 2 +- arch/arm/mach-orion5x/common.c | 2 +- arch/arm/plat-iop/adma.c | 2 +- arch/avr32/boards/hammerhead/flash.c | 4 ++-- arch/avr32/mach-at32ap/at32ap700x.c | 8 +++---- arch/ia64/kernel/pci-dma.c | 2 +- arch/mips/alchemy/common/platform.c | 30 +++++++++++++-------------- arch/mips/alchemy/devboards/pb1200/platform.c | 4 ++-- arch/mips/nxp/pnx833x/common/platform.c | 12 +++++------ arch/mips/nxp/pnx8550/common/platform.c | 8 +++---- arch/mips/pmc-sierra/msp71xx/msp_usb.c | 8 +++---- arch/powerpc/kernel/dma.c | 2 +- arch/powerpc/kernel/of_platform.c | 2 +- arch/powerpc/platforms/iseries/iommu.c | 4 ++-- arch/powerpc/platforms/ps3/system-bus.c | 2 +- arch/x86/include/asm/dma-mapping.h | 4 ++-- arch/x86/kernel/pci-dma.c | 4 ++-- arch/x86/kernel/pci-nommu.c | 2 +- drivers/ata/ahci.c | 6 +++--- drivers/ata/pata_cs5520.c | 4 ++-- drivers/ata/pata_ixp4xx_cf.c | 2 +- drivers/ata/pdc_adma.c | 4 ++-- drivers/ata/sata_inic162x.c | 4 ++-- drivers/ata/sata_mv.c | 6 +++--- drivers/ata/sata_qstor.c | 6 +++--- drivers/ata/sata_sil24.c | 6 +++--- drivers/ata/sata_vsc.c | 4 ++-- drivers/atm/he.c | 2 +- drivers/atm/lanai.c | 4 ++-- drivers/block/DAC960.c | 8 +++---- drivers/block/cciss.c | 2 +- drivers/block/sx8.c | 2 +- drivers/block/umem.c | 2 +- drivers/crypto/hifn_795x.c | 2 +- drivers/crypto/ixp4xx_crypto.c | 2 +- drivers/dma/ioat.c | 4 ++-- drivers/firmware/dcdbas.c | 2 +- drivers/ide/cs5520.c | 2 +- drivers/ide/setup-pci.c | 2 +- drivers/ieee1394/pcilynx.c | 2 +- drivers/infiniband/hw/amso1100/c2.c | 2 +- drivers/infiniband/hw/ipath/ipath_driver.c | 4 ++-- drivers/infiniband/hw/mthca/mthca_main.c | 4 ++-- drivers/infiniband/hw/nes/nes.c | 4 ++-- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/pluto2/pluto2.c | 2 +- drivers/media/video/bt8xx/bttv-driver.c | 2 +- drivers/media/video/cx88/cx88-alsa.c | 2 +- drivers/media/video/cx88/cx88-mpeg.c | 2 +- drivers/media/video/cx88/cx88-video.c | 2 +- drivers/media/video/meye.c | 2 +- drivers/media/video/saa7134/saa7134-core.c | 2 +- drivers/memstick/host/jmb38x_ms.c | 2 +- drivers/message/fusion/mptbase.c | 4 ++-- drivers/message/i2o/memory.c | 2 +- drivers/message/i2o/pci.c | 2 +- drivers/misc/tifm_7xx1.c | 2 +- drivers/mmc/host/sdhci-pci.c | 2 +- drivers/net/8139cp.c | 6 +++--- drivers/net/acenic.c | 2 +- drivers/net/amd8111e.c | 2 +- drivers/net/atl1e/atl1e_main.c | 4 ++-- drivers/net/atlx/atl1.c | 2 +- drivers/net/atlx/atl2.c | 4 ++-- drivers/net/bnx2.c | 2 +- drivers/net/bnx2x_main.c | 2 +- drivers/net/cassini.c | 2 +- drivers/net/chelsio/cxgb2.c | 2 +- drivers/net/cxgb3/cxgb3_main.c | 2 +- drivers/net/e100.c | 2 +- drivers/net/e1000/e1000_main.c | 4 ++-- drivers/net/e1000e/netdev.c | 8 +++---- drivers/net/enic/enic_main.c | 4 ++-- drivers/net/hp100.c | 2 +- drivers/net/igb/igb_main.c | 4 ++-- drivers/net/ioc3-eth.c | 2 +- drivers/net/ipg.c | 2 +- drivers/net/ixgb/ixgb_main.c | 4 ++-- drivers/net/ixgbe/ixgbe_main.c | 8 +++---- drivers/net/jme.c | 4 ++-- drivers/net/mlx4/main.c | 4 ++-- drivers/net/myri10ge/myri10ge.c | 4 ++-- drivers/net/niu.c | 4 ++-- drivers/net/ns83820.c | 2 +- drivers/net/qla3xxx.c | 4 ++-- drivers/net/qlge/qlge_main.c | 4 ++-- drivers/net/r6040.c | 4 ++-- drivers/net/r8169.c | 8 +++---- drivers/net/s2io.c | 2 +- drivers/net/sc92031.c | 4 ++-- drivers/net/sis190.c | 2 +- drivers/net/sis900.c | 2 +- drivers/net/skge.c | 4 ++-- drivers/net/sky2.c | 2 +- drivers/net/smsc9420.c | 2 +- drivers/net/sungem.c | 2 +- drivers/net/tehuti.c | 4 ++-- drivers/net/tehuti.h | 4 ---- drivers/net/tg3.c | 10 ++++----- drivers/net/tlan.c | 2 +- drivers/net/tokenring/lanstreamer.c | 2 +- drivers/net/tulip/dmfe.c | 2 +- drivers/net/tulip/uli526x.c | 2 +- drivers/net/tulip/winbond-840.c | 2 +- drivers/net/typhoon.c | 2 +- drivers/net/via-rhine.c | 2 +- drivers/net/wan/wanxl.c | 4 ++-- drivers/net/wireless/adm8211.c | 4 ++-- drivers/net/wireless/ath5k/base.c | 2 +- drivers/net/wireless/b43/dma.c | 8 +++---- drivers/net/wireless/b43legacy/dma.c | 8 +++---- drivers/net/wireless/ipw2x00/ipw2100.c | 2 +- drivers/net/wireless/ipw2x00/ipw2200.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl3945-base.c | 4 ++-- drivers/net/wireless/prism54/islpci_hotplug.c | 2 +- drivers/net/wireless/rt2x00/rt2x00pci.c | 2 +- drivers/pci/intel-iommu.c | 8 +++---- drivers/rapidio/rio-scan.c | 4 ++-- drivers/scsi/3w-9xxx.c | 4 ++-- drivers/scsi/3w-xxxx.h | 2 +- drivers/scsi/BusLogic.c | 6 +++--- drivers/scsi/a100u2w.c | 2 +- drivers/scsi/aacraid/aachba.c | 4 ++-- drivers/scsi/aacraid/commsup.c | 6 +++--- drivers/scsi/aacraid/linit.c | 6 +++--- drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 6 +++--- drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 4 ++-- drivers/scsi/aic94xx/aic94xx_init.c | 4 ++-- drivers/scsi/arcmsr/arcmsr_hba.c | 2 +- drivers/scsi/atp870u.c | 2 +- drivers/scsi/dpt_i2o.c | 6 +++--- drivers/scsi/eata.c | 2 +- drivers/scsi/gdth.c | 4 ++-- drivers/scsi/hptiop.c | 2 +- drivers/scsi/initio.c | 2 +- drivers/scsi/ipr.c | 2 +- drivers/scsi/ips.c | 2 +- drivers/scsi/lasi700.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/megaraid.c | 4 ++-- drivers/scsi/megaraid/megaraid_mbox.c | 4 ++-- drivers/scsi/megaraid/megaraid_sas.c | 4 ++-- drivers/scsi/mvsas.c | 6 +++--- drivers/scsi/nsp32.c | 2 +- drivers/scsi/qla1280.c | 4 ++-- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- drivers/scsi/qla4xxx/ql4_os.c | 4 ++-- drivers/scsi/sni_53c710.c | 2 +- drivers/scsi/stex.c | 4 ++-- drivers/scsi/sym53c8xx_2/sym_glue.c | 2 +- drivers/scsi/sym53c8xx_2/sym_hipd.h | 2 +- drivers/staging/agnx/pci.c | 4 ++-- drivers/staging/altpciechdma/altpciechdma.c | 4 ++-- drivers/staging/sxg/sxg.c | 4 ++-- drivers/usb/host/ehci-ps3.c | 2 +- drivers/usb/host/ohci-ps3.c | 2 +- drivers/uwb/whci.c | 4 ++-- include/linux/dma-mapping.h | 2 +- lib/swiotlb.c | 2 +- sound/pci/ad1889.c | 4 ++-- sound/pci/au88x0/au88x0.c | 4 ++-- sound/pci/aw2/aw2-alsa.c | 4 ++-- sound/pci/ca0106/ca0106_main.c | 4 ++-- sound/pci/cs5535audio/cs5535audio.c | 4 ++-- sound/pci/mixart/mixart.c | 2 +- sound/pci/pcxhr/pcxhr.c | 2 +- sound/soc/blackfin/bf5xx-ac97-pcm.c | 4 ++-- sound/soc/blackfin/bf5xx-i2s-pcm.c | 4 ++-- sound/soc/omap/omap-pcm.c | 2 +- sound/soc/pxa/pxa2xx-pcm.c | 4 ++-- sound/soc/s3c24xx/s3c24xx-pcm.c | 2 +- 173 files changed, 309 insertions(+), 313 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-evm.c index 38b6a9ce2a93..0b97a528902b 100644 --- a/arch/arm/mach-davinci/board-evm.c +++ b/arch/arm/mach-davinci/board-evm.c @@ -118,7 +118,7 @@ static struct resource ide_resources[] = { }, }; -static u64 ide_dma_mask = DMA_32BIT_MASK; +static u64 ide_dma_mask = DMA_BIT_MASK(32); static struct platform_device ide_dev = { .name = "palm_bk3710", @@ -127,7 +127,7 @@ static struct platform_device ide_dev = { .num_resources = ARRAY_SIZE(ide_resources), .dev = { .dma_mask = &ide_dma_mask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, }; diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c index 69680784448a..2429b79f6da2 100644 --- a/arch/arm/mach-davinci/usb.c +++ b/arch/arm/mach-davinci/usb.c @@ -64,7 +64,7 @@ static struct resource usb_resources[] = { }, }; -static u64 usb_dmamask = DMA_32BIT_MASK; +static u64 usb_dmamask = DMA_BIT_MASK(32); static struct platform_device usb_dev = { .name = "musb_hdrc", @@ -72,7 +72,7 @@ static struct platform_device usb_dev = { .dev = { .platform_data = &usb_data, .dma_mask = &usb_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .resource = usb_resources, .num_resources = ARRAY_SIZE(usb_resources), diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index c691848714d9..16dc9ea08393 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -508,7 +508,7 @@ static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = { .dram = &kirkwood_mbus_dram_info, }; -static u64 kirkwood_xor_dmamask = DMA_32BIT_MASK; +static u64 kirkwood_xor_dmamask = DMA_BIT_MASK(32); /***************************************************************************** diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index e8d42e8cb465..6af99ddabdfb 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c @@ -463,7 +463,7 @@ static struct platform_device orion5x_xor_shared = { .resource = orion5x_xor_shared_resources, }; -static u64 orion5x_xor_dmamask = DMA_32BIT_MASK; +static u64 orion5x_xor_dmamask = DMA_BIT_MASK(32); static struct resource orion5x_xor0_resources[] = { [0] = { diff --git a/arch/arm/plat-iop/adma.c b/arch/arm/plat-iop/adma.c index a2a94f6d2e7c..3c127aabe214 100644 --- a/arch/arm/plat-iop/adma.c +++ b/arch/arm/plat-iop/adma.c @@ -119,7 +119,7 @@ static struct resource iop3xx_aau_resources[] = { } }; -static u64 iop3xx_adma_dmamask = DMA_32BIT_MASK; +static u64 iop3xx_adma_dmamask = DMA_BIT_MASK(32); static struct iop_adma_platform_data iop3xx_dma_0_data = { .hw_id = DMA0_ID, diff --git a/arch/avr32/boards/hammerhead/flash.c b/arch/avr32/boards/hammerhead/flash.c index 559bbcb03f9b..776c3cb9b6e4 100644 --- a/arch/avr32/boards/hammerhead/flash.c +++ b/arch/avr32/boards/hammerhead/flash.c @@ -280,13 +280,13 @@ static struct resource hh_fpga0_resource[] = { }, }; -static u64 hh_fpga0_dma_mask = DMA_32BIT_MASK; +static u64 hh_fpga0_dma_mask = DMA_BIT_MASK(32); static struct platform_device hh_fpga0_device = { .name = "hh_fpga", .id = 0, .dev = { .dma_mask = &hh_fpga0_dma_mask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .resource = hh_fpga0_resource, .num_resources = ARRAY_SIZE(hh_fpga0_resource), diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 7cc653798327..eb9d4dc2e86d 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c @@ -60,26 +60,26 @@ * don't ... tc, smc, pio, rtc, watchdog, pwm, ps2, and more. */ #define DEFINE_DEV(_name, _id) \ -static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \ +static u64 _name##_id##_dma_mask = DMA_BIT_MASK(32); \ static struct platform_device _name##_id##_device = { \ .name = #_name, \ .id = _id, \ .dev = { \ .dma_mask = &_name##_id##_dma_mask, \ - .coherent_dma_mask = DMA_32BIT_MASK, \ + .coherent_dma_mask = DMA_BIT_MASK(32), \ }, \ .resource = _name##_id##_resource, \ .num_resources = ARRAY_SIZE(_name##_id##_resource), \ } #define DEFINE_DEV_DATA(_name, _id) \ -static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \ +static u64 _name##_id##_dma_mask = DMA_BIT_MASK(32); \ static struct platform_device _name##_id##_device = { \ .name = #_name, \ .id = _id, \ .dev = { \ .dma_mask = &_name##_id##_dma_mask, \ .platform_data = &_name##_id##_data, \ - .coherent_dma_mask = DMA_32BIT_MASK, \ + .coherent_dma_mask = DMA_BIT_MASK(32), \ }, \ .resource = _name##_id##_resource, \ .num_resources = ARRAY_SIZE(_name##_id##_resource), \ diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c index 8f34f3ddb83b..f82b0ee6bb1f 100644 --- a/arch/ia64/kernel/pci-dma.c +++ b/arch/ia64/kernel/pci-dma.c @@ -37,7 +37,7 @@ int force_iommu __read_mostly; to i386. */ struct device fallback_dev = { .init_name = "fallback device", - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .dma_mask = &fallback_dev.coherent_dma_mask, }; diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 5c76c6448e04..117f99f70649 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -80,14 +80,14 @@ static struct resource au1xxx_usb_ohci_resources[] = { }; /* The dmamask must be set for OHCI to work */ -static u64 ohci_dmamask = DMA_32BIT_MASK; +static u64 ohci_dmamask = DMA_BIT_MASK(32); static struct platform_device au1xxx_usb_ohci_device = { .name = "au1xxx-ohci", .id = 0, .dev = { .dma_mask = &ohci_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), .resource = au1xxx_usb_ohci_resources, @@ -109,14 +109,14 @@ static struct resource au1100_lcd_resources[] = { } }; -static u64 au1100_lcd_dmamask = DMA_32BIT_MASK; +static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); static struct platform_device au1100_lcd_device = { .name = "au1100-lcd", .id = 0, .dev = { .dma_mask = &au1100_lcd_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(au1100_lcd_resources), .resource = au1100_lcd_resources, @@ -138,14 +138,14 @@ static struct resource au1xxx_usb_ehci_resources[] = { }, }; -static u64 ehci_dmamask = DMA_32BIT_MASK; +static u64 ehci_dmamask = DMA_BIT_MASK(32); static struct platform_device au1xxx_usb_ehci_device = { .name = "au1xxx-ehci", .id = 0, .dev = { .dma_mask = &ehci_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources), .resource = au1xxx_usb_ehci_resources, @@ -165,14 +165,14 @@ static struct resource au1xxx_usb_gdt_resources[] = { }, }; -static u64 udc_dmamask = DMA_32BIT_MASK; +static u64 udc_dmamask = DMA_BIT_MASK(32); static struct platform_device au1xxx_usb_gdt_device = { .name = "au1xxx-udc", .id = 0, .dev = { .dma_mask = &udc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources), .resource = au1xxx_usb_gdt_resources, @@ -192,14 +192,14 @@ static struct resource au1xxx_usb_otg_resources[] = { }, }; -static u64 uoc_dmamask = DMA_32BIT_MASK; +static u64 uoc_dmamask = DMA_BIT_MASK(32); static struct platform_device au1xxx_usb_otg_device = { .name = "au1xxx-uoc", .id = 0, .dev = { .dma_mask = &uoc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources), .resource = au1xxx_usb_otg_resources, @@ -218,20 +218,20 @@ static struct resource au1200_lcd_resources[] = { } }; -static u64 au1200_lcd_dmamask = DMA_32BIT_MASK; +static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32); static struct platform_device au1200_lcd_device = { .name = "au1200-lcd", .id = 0, .dev = { .dma_mask = &au1200_lcd_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(au1200_lcd_resources), .resource = au1200_lcd_resources, }; -static u64 au1xxx_mmc_dmamask = DMA_32BIT_MASK; +static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32); extern struct au1xmmc_platform_data au1xmmc_platdata[2]; @@ -263,7 +263,7 @@ static struct platform_device au1200_mmc0_device = { .id = 0, .dev = { .dma_mask = &au1xxx_mmc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &au1xmmc_platdata[0], }, .num_resources = ARRAY_SIZE(au1200_mmc0_resources), @@ -299,7 +299,7 @@ static struct platform_device au1200_mmc1_device = { .id = 1, .dev = { .dma_mask = &au1xxx_mmc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &au1xmmc_platdata[1], }, .num_resources = ARRAY_SIZE(au1200_mmc1_resources), diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c index 0d68e1985ffd..b93dff4a6789 100644 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ b/arch/mips/alchemy/devboards/pb1200/platform.c @@ -119,14 +119,14 @@ static struct resource ide_resources[] = { } }; -static u64 ide_dmamask = DMA_32BIT_MASK; +static u64 ide_dmamask = DMA_BIT_MASK(32); static struct platform_device ide_device = { .name = "au1200-ide", .id = 0, .dev = { .dma_mask = &ide_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(ide_resources), .resource = ide_resources diff --git a/arch/mips/nxp/pnx833x/common/platform.c b/arch/mips/nxp/pnx833x/common/platform.c index b1ccbcc18f78..01f8345a2069 100644 --- a/arch/mips/nxp/pnx833x/common/platform.c +++ b/arch/mips/nxp/pnx833x/common/platform.c @@ -42,7 +42,7 @@ #include #include -static u64 uart_dmamask = DMA_32BIT_MASK; +static u64 uart_dmamask = DMA_BIT_MASK(32); static struct resource pnx833x_uart_resources[] = { [0] = { @@ -101,14 +101,14 @@ static struct platform_device pnx833x_uart_device = { .id = -1, .dev = { .dma_mask = &uart_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = pnx8xxx_ports, }, .num_resources = ARRAY_SIZE(pnx833x_uart_resources), .resource = pnx833x_uart_resources, }; -static u64 ehci_dmamask = DMA_32BIT_MASK; +static u64 ehci_dmamask = DMA_BIT_MASK(32); static struct resource pnx833x_usb_ehci_resources[] = { [0] = { @@ -128,7 +128,7 @@ static struct platform_device pnx833x_usb_ehci_device = { .id = -1, .dev = { .dma_mask = &ehci_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(pnx833x_usb_ehci_resources), .resource = pnx833x_usb_ehci_resources, @@ -198,7 +198,7 @@ static struct platform_device pnx833x_i2c1_device = { }; #endif -static u64 ethernet_dmamask = DMA_32BIT_MASK; +static u64 ethernet_dmamask = DMA_BIT_MASK(32); static struct resource pnx833x_ethernet_resources[] = { [0] = { @@ -218,7 +218,7 @@ static struct platform_device pnx833x_ethernet_device = { .id = -1, .dev = { .dma_mask = ðernet_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(pnx833x_ethernet_resources), .resource = pnx833x_ethernet_resources, diff --git a/arch/mips/nxp/pnx8550/common/platform.c b/arch/mips/nxp/pnx8550/common/platform.c index 21d2955359b3..5264cc09a27b 100644 --- a/arch/mips/nxp/pnx8550/common/platform.c +++ b/arch/mips/nxp/pnx8550/common/platform.c @@ -92,16 +92,16 @@ struct pnx8xxx_port pnx8xxx_ports[] = { }; /* The dmamask must be set for OHCI to work */ -static u64 ohci_dmamask = DMA_32BIT_MASK; +static u64 ohci_dmamask = DMA_BIT_MASK(32); -static u64 uart_dmamask = DMA_32BIT_MASK; +static u64 uart_dmamask = DMA_BIT_MASK(32); static struct platform_device pnx8550_usb_ohci_device = { .name = "pnx8550-ohci", .id = -1, .dev = { .dma_mask = &ohci_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources), .resource = pnx8550_usb_ohci_resources, @@ -112,7 +112,7 @@ static struct platform_device pnx8550_uart_device = { .id = -1, .dev = { .dma_mask = &uart_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = pnx8xxx_ports, }, .num_resources = ARRAY_SIZE(pnx8550_uart_resources), diff --git a/arch/mips/pmc-sierra/msp71xx/msp_usb.c b/arch/mips/pmc-sierra/msp71xx/msp_usb.c index f7ca4f582331..0ee01e359dd8 100644 --- a/arch/mips/pmc-sierra/msp71xx/msp_usb.c +++ b/arch/mips/pmc-sierra/msp71xx/msp_usb.c @@ -49,14 +49,14 @@ static struct resource msp_usbhost_resources [] = { }, }; -static u64 msp_usbhost_dma_mask = DMA_32BIT_MASK; +static u64 msp_usbhost_dma_mask = DMA_BIT_MASK(32); static struct platform_device msp_usbhost_device = { .name = "pmcmsp-ehci", .id = 0, .dev = { .dma_mask = &msp_usbhost_dma_mask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(msp_usbhost_resources), .resource = msp_usbhost_resources, @@ -77,14 +77,14 @@ static struct resource msp_usbdev_resources [] = { }, }; -static u64 msp_usbdev_dma_mask = DMA_32BIT_MASK; +static u64 msp_usbdev_dma_mask = DMA_BIT_MASK(32); static struct platform_device msp_usbdev_device = { .name = "msp71xx_udc", .id = 0, .dev = { .dma_mask = &msp_usbdev_dma_mask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(msp_usbdev_resources), .resource = msp_usbdev_resources, diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 1c5c8a6fc129..53c7788cba78 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c @@ -94,7 +94,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask) * done via some global so platforms can set the limit in case * they have limited DMA windows */ - return mask >= DMA_32BIT_MASK; + return mask >= DMA_BIT_MASK(32); #else return 1; #endif diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 3f37a6e62771..87df428e3588 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c @@ -76,7 +76,7 @@ struct of_device* of_platform_device_create(struct device_node *np, return NULL; dev->dma_mask = 0xffffffffUL; - dev->dev.coherent_dma_mask = DMA_32BIT_MASK; + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); dev->dev.bus = &of_platform_bus_type; diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index 6ed75bffc8ab..ff43f1fd8343 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c @@ -202,7 +202,7 @@ static struct iommu_table vio_iommu_table; void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag) { return iommu_alloc_coherent(NULL, &vio_iommu_table, size, dma_handle, - DMA_32BIT_MASK, flag, -1); + DMA_BIT_MASK(32), flag, -1); } EXPORT_SYMBOL_GPL(iseries_hv_alloc); @@ -217,7 +217,7 @@ dma_addr_t iseries_hv_map(void *vaddr, size_t size, { return iommu_map_page(NULL, &vio_iommu_table, virt_to_page(vaddr), (unsigned long)vaddr % PAGE_SIZE, size, - DMA_32BIT_MASK, direction, NULL); + DMA_BIT_MASK(32), direction, NULL); } void iseries_hv_unmap(dma_addr_t dma_handle, size_t size, diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index a705fffbb498..9a73d0238639 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -689,7 +689,7 @@ static void ps3_ioc0_unmap_sg(struct device *_dev, struct scatterlist *sg, static int ps3_dma_supported(struct device *_dev, u64 mask) { - return mask >= DMA_32BIT_MASK; + return mask >= DMA_BIT_MASK(32); } static struct dma_mapping_ops ps3_sb_dma_ops = { diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index cea7b74963e9..10a6be94eb77 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h @@ -238,7 +238,7 @@ static inline unsigned long dma_alloc_coherent_mask(struct device *dev, dma_mask = dev->coherent_dma_mask; if (!dma_mask) - dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK; + dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_BIT_MASK(32); return dma_mask; } @@ -250,7 +250,7 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) if (dma_mask <= DMA_24BIT_MASK) gfp |= GFP_DMA; #ifdef CONFIG_X86_64 - if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) + if (dma_mask <= DMA_BIT_MASK(32) && !(gfp & GFP_DMA)) gfp |= GFP_DMA32; #endif return gfp; diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 0cf2d900422b..136a01d52db0 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c @@ -40,7 +40,7 @@ EXPORT_SYMBOL(bad_dma_address); to older i386. */ struct device x86_dma_fallback_dev = { .init_name = "fallback device", - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask, }; EXPORT_SYMBOL(x86_dma_fallback_dev); @@ -148,7 +148,7 @@ again: if (!is_buffer_dma_capable(dma_mask, addr, size)) { __free_pages(page, get_order(size)); - if (dma_mask < DMA_32BIT_MASK && !(flag & GFP_DMA)) { + if (dma_mask < DMA_BIT_MASK(32) && !(flag & GFP_DMA)) { flag = (flag & ~GFP_DMA32) | GFP_DMA; goto again; } diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c index c6d703b39326..71d412a09f30 100644 --- a/arch/x86/kernel/pci-nommu.c +++ b/arch/x86/kernel/pci-nommu.c @@ -15,7 +15,7 @@ static int check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) { if (hwdev && !is_buffer_dma_capable(*hwdev->dma_mask, bus, size)) { - if (*hwdev->dma_mask >= DMA_32BIT_MASK) + if (*hwdev->dma_mask >= DMA_BIT_MASK(32)) printk(KERN_ERR "nommu_%s: overflow %Lx+%zu of device mask %Lx\n", name, (long long)bus, size, diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 207d775c3c27..f75dac57dc2b 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -2408,7 +2408,7 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac) !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) { - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "64-bit DMA enable failed\n"); @@ -2416,13 +2416,13 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac) } } } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index db6a96984f3f..0df83cf74233 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c @@ -203,11 +203,11 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi return -ENODEV; } - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n"); return -ENODEV; } - if (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR DRV_NAME ": unable to configure consistent DMA mask.\n"); return -ENODEV; } diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 19fdecf319a6..ba54b089f98c 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c @@ -157,7 +157,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) return -ENOMEM; /* acquire resources and fill host */ - pdev->dev.coherent_dma_mask = DMA_32BIT_MASK; + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000); data->cs1 = devm_ioremap(&pdev->dev, cs1->start, 0x1000); diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 39588178d028..6c65b0776a2c 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c @@ -607,13 +607,13 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) { int rc; - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 305a4f825f53..8d890cc5a7ee 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c @@ -861,14 +861,14 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } /* Set dma_mask. This devices doesn't support 64bit addressing. */ - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 45e0fe191afc..5af3ea19d3c5 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -3916,7 +3916,7 @@ static int pci_go_64(struct pci_dev *pdev) if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) { - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "64-bit DMA enable failed\n"); @@ -3924,13 +3924,13 @@ static int pci_go_64(struct pci_dev *pdev) } } } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index 7b37c27d7972..326c0cfc29b3 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c @@ -587,7 +587,7 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) { - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "64-bit DMA enable failed\n"); @@ -595,13 +595,13 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) } } } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 37730bc2f09f..77aa8d7ecec4 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c @@ -1300,7 +1300,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) { - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "64-bit DMA enable failed\n"); @@ -1308,13 +1308,13 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } } } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index ed70bd28fa2c..8b2a278b2547 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c @@ -399,10 +399,10 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev, /* * Use 32 bit DMA mask, because 64 bit address support is poor. */ - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) return rc; - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) return rc; diff --git a/drivers/atm/he.c b/drivers/atm/he.c index bdbad7edf682..2de64065aa1b 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -358,7 +358,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) if (pci_enable_device(pci_dev)) return -EIO; - if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK) != 0) { + if (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)) != 0) { printk(KERN_WARNING "he: no suitable dma available\n"); err = -EIO; goto init_one_failure; diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index 8733a2ea04c2..cf97c34cbaf1 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c @@ -1957,12 +1957,12 @@ static int __devinit lanai_pci_start(struct lanai_dev *lanai) return -ENXIO; } pci_set_master(pci); - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) != 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) != 0) { printk(KERN_WARNING DEV_LABEL "(itf %d): No suitable DMA available.\n", lanai->number); return -EBUSY; } - if (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) != 0) { + if (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) != 0) { printk(KERN_WARNING DEV_LABEL "(itf %d): No suitable DMA available.\n", lanai->number); return -EBUSY; diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 5496865b297e..f22ed6cc69f2 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -1169,9 +1169,9 @@ static bool DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T int i; - if (pci_set_dma_mask(Controller->PCIDevice, DMA_32BIT_MASK)) + if (pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(32))) return DAC960_Failure(Controller, "DMA mask out of range"); - Controller->BounceBufferLimit = DMA_32BIT_MASK; + Controller->BounceBufferLimit = DMA_BIT_MASK(32); if ((hw_type == DAC960_PD_Controller) || (hw_type == DAC960_P_Controller)) { CommandMailboxesSize = 0; @@ -1374,8 +1374,8 @@ static bool DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T if (!pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(64))) Controller->BounceBufferLimit = DMA_BIT_MASK(64); - else if (!pci_set_dma_mask(Controller->PCIDevice, DMA_32BIT_MASK)) - Controller->BounceBufferLimit = DMA_32BIT_MASK; + else if (!pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(32))) + Controller->BounceBufferLimit = DMA_BIT_MASK(32); else return DAC960_Failure(Controller, "DMA mask out of range"); diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 149a611e8fe5..a6c55432819b 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -3639,7 +3639,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, /* configure PCI DMA stuff */ if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) dac = 1; - else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) + else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) dac = 0; else { printk(KERN_ERR "cciss: no suitable DMA available\n"); diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index db5783ace1e4..ff0448e4bf03 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c @@ -1597,7 +1597,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) pci_dac = 1; } else { #endif - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { printk(KERN_ERR DRV_NAME "(%s): DMA mask failure\n", pci_name(pdev)); diff --git a/drivers/block/umem.c b/drivers/block/umem.c index e93e99c9103c..9744d59a69f2 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -830,7 +830,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n"); if (pci_set_dma_mask(dev, DMA_BIT_MASK(64)) && - pci_set_dma_mask(dev, DMA_32BIT_MASK)) { + pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { dev_printk(KERN_WARNING, &dev->dev, "NO suitable DMA found\n"); return -ENOMEM; } diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c index 4d85402a9e4a..2bef086fb342 100644 --- a/drivers/crypto/hifn_795x.c +++ b/drivers/crypto/hifn_795x.c @@ -2575,7 +2575,7 @@ static int hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id) return err; pci_set_master(pdev); - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) goto err_out_disable_pci_device; diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index af9761ccf9f1..f9f05d7a707d 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -209,7 +209,7 @@ static struct platform_device pseudo_dev = { .id = 0, .num_resources = 0, .dev = { - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .release = dev_release, } }; diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index 22e9f1911111..2225bb6ba3d1 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c @@ -100,13 +100,13 @@ static int __devinit ioat_probe(struct pci_dev *pdev, err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) goto err_set_dma_mask; err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) goto err_set_dma_mask; diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 3009e0171e54..18d65fb42ee7 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c @@ -545,7 +545,7 @@ static int __devinit dcdbas_probe(struct platform_device *dev) * BIOS SMI calls require buffer addresses be in 32-bit address space. * This is done by setting the DMA mask below. */ - dcdbas_pdev->dev.coherent_dma_mask = DMA_32BIT_MASK; + dcdbas_pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); dcdbas_pdev->dev.dma_mask = &dcdbas_pdev->dev.coherent_dma_mask; error = sysfs_create_group(&dev->dev.kobj, &dcdbas_attr_group); diff --git a/drivers/ide/cs5520.c b/drivers/ide/cs5520.c index 58fb90e5b763..87987a7d36c9 100644 --- a/drivers/ide/cs5520.c +++ b/drivers/ide/cs5520.c @@ -122,7 +122,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic return -ENODEV; } pci_set_master(dev); - if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "%s: No suitable DMA available.\n", d->name); return -ENODEV; diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index a19dbccd7617..7a3a12d6e638 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -208,7 +208,7 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) * a DMA mask field to the struct ide_port_info if we need it * (or let lower level driver set the DMA mask) */ - ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(dev, DMA_BIT_MASK(32)); if (ret < 0) { printk(KERN_ERR "%s %s: can't set DMA mask\n", d->name, pci_name(dev)); diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index 38f712036201..9555fd253865 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c @@ -1171,7 +1171,7 @@ static int __devinit add_card(struct pci_dev *dev, error = -ENXIO; - if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) + if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) FAIL("DMA address limits not supported for PCILynx hardware"); if (pci_enable_device(dev)) FAIL("failed to enable PCILynx hardware"); diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c index 54d2e0760abf..0cfbb6d2f762 100644 --- a/drivers/infiniband/hw/amso1100/c2.c +++ b/drivers/infiniband/hw/amso1100/c2.c @@ -995,7 +995,7 @@ static int __devinit c2_probe(struct pci_dev *pcidev, goto bail2; } } else { - ret = pci_set_dma_mask(pcidev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)); if (ret < 0) { printk(KERN_ERR PFX "32b DMA configuration failed\n"); goto bail2; diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 77b2fb5b7c35..04e88b600558 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c @@ -477,7 +477,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, * do not setup 64 bit maps on systems with 2GB or less * memory installed. */ - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) { dev_info(&pdev->dev, "Unable to set DMA mask for unit %u: %d\n", @@ -486,7 +486,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, } else { ipath_dbg("No 64bit DMA mask, used 32 bit mask\n"); - ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) dev_info(&pdev->dev, "Unable to set DMA consistent mask " diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 5d234204f7b7..1d83cf7caf38 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c @@ -1019,7 +1019,7 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask.\n"); - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting.\n"); goto err_free_res; @@ -1029,7 +1029,7 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) if (err) { dev_warn(&pdev->dev, "Warning: couldn't set 64-bit " "consistent PCI DMA mask.\n"); - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "Can't set consistent PCI DMA mask, " "aborting.\n"); diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c index 7446810446e1..cbde0cfe27e0 100644 --- a/drivers/infiniband/hw/nes/nes.c +++ b/drivers/infiniband/hw/nes/nes.c @@ -489,12 +489,12 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i goto bail2; } } else { - ret = pci_set_dma_mask(pcidev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)); if (ret < 0) { printk(KERN_ERR PFX "32b DMA mask configuration failed\n"); goto bail2; } - ret = pci_set_consistent_dma_mask(pcidev, DMA_32BIT_MASK); + ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32)); if (ret) { printk(KERN_ERR PFX "32b DMA consistent mask configuration failed\n"); goto bail2; diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 5b20cf5a29f0..971a8b18f6dd 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -662,7 +662,7 @@ static int __devinit dm1105_probe(struct pci_dev *pdev, if (ret < 0) goto err_kfree; - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret < 0) goto err_pci_disable_device; diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index ee89623be85a..598eaf8acc6e 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c @@ -616,7 +616,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, /* enable interrupts */ pci_write_config_dword(pdev, 0x6c, 0x8000); - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret < 0) goto err_pci_disable_device; diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 74f619d6cc93..23b7499b3185 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -4317,7 +4317,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, btv->c.nr); return -EIO; } - if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", btv->c.nr); return -EIO; diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index ce98d955231a..0ccdf36626e3 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -745,7 +745,7 @@ static int __devinit snd_cx88_create(struct snd_card *card, return err; } - if (!pci_dma_supported(pci,DMA_32BIT_MASK)) { + if (!pci_dma_supported(pci,DMA_BIT_MASK(32))) { dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name); err = -EIO; cx88_core_put(core,pci); diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index b295b76737e3..da4e3912cd37 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -455,7 +455,7 @@ static int cx8802_init_common(struct cx8802_dev *dev) if (pci_enable_device(dev->pci)) return -EIO; pci_set_master(dev->pci); - if (!pci_dma_supported(dev->pci,DMA_32BIT_MASK)) { + if (!pci_dma_supported(dev->pci,DMA_BIT_MASK(32))) { printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name); return -EIO; } diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index ec0425d9043a..b993d42fe73c 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1832,7 +1832,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0)); pci_set_master(pci_dev); - if (!pci_dma_supported(pci_dev,DMA_32BIT_MASK)) { + if (!pci_dma_supported(pci_dev,DMA_BIT_MASK(32))) { printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name); err = -EIO; goto fail_core; diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 2ad11f0999c6..1d66855a379a 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -117,7 +117,7 @@ static int ptable_alloc(void) memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable)); /* give only 32 bit DMA addresses */ - if (dma_set_mask(&meye.mchip_dev->dev, DMA_32BIT_MASK)) + if (dma_set_mask(&meye.mchip_dev->dev, DMA_BIT_MASK(32))) return -1; meye.mchip_ptable_toc = dma_alloc_coherent(&meye.mchip_dev->dev, diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 0bb09f1723d1..2def6fec814b 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -911,7 +911,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0)); pci_set_master(pci_dev); - if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) { + if (!pci_dma_supported(pci_dev, DMA_BIT_MASK(32))) { printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); err = -EIO; goto fail1; diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index 2fb95a5b72eb..f4a162a4bece 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c @@ -877,7 +877,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev, int pci_dev_busy = 0; int rc, cnt; - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) return rc; diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 98026016a935..d0d126c69354 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -1539,8 +1539,8 @@ mpt_mapresources(MPT_ADAPTER *ioc) dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", ioc->name)); - } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK) - && !pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) + && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", ioc->name)); diff --git a/drivers/message/i2o/memory.c b/drivers/message/i2o/memory.c index 9a08d8e45516..292b41e49fbd 100644 --- a/drivers/message/i2o/memory.c +++ b/drivers/message/i2o/memory.c @@ -187,7 +187,7 @@ int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, size_t len) mutex_lock(&mem_lock); if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_BIT_MASK(64))) { dma_64 = 1; - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { mutex_unlock(&mem_lock); return -ENOMEM; } diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index ed17ac5af3e0..35ba2ae38b42 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c @@ -334,7 +334,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, return rc; } - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "i2o: no suitable DMA found for %s\n", pci_name(pdev)); rc = -ENODEV; diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index be5672a98702..a6ef18259da0 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c @@ -324,7 +324,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, int pci_dev_busy = 0; int rc; - rc = pci_set_dma_mask(dev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(dev, DMA_BIT_MASK(32)); if (rc) return rc; diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index 406da9a8d453..c5b316e22371 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c @@ -380,7 +380,7 @@ static int sdhci_pci_enable_dma(struct sdhci_host *host) "doesn't fully claim to support it.\n"); } - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) return ret; diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index d08475a7f676..02330f3d5a55 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -1530,7 +1530,7 @@ static void cp_get_ethtool_stats (struct net_device *dev, /* begin NIC statistics dump */ cpw32(StatsAddr + 4, (u64)dma >> 32); - cpw32(StatsAddr, ((u64)dma & DMA_32BIT_MASK) | DumpStats); + cpw32(StatsAddr, ((u64)dma & DMA_BIT_MASK(32)) | DumpStats); cpr32(StatsAddr); for (i = 0; i < 1000; i++) { @@ -1935,13 +1935,13 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) } else { pci_using_dac = 0; - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_err(&pdev->dev, "No usable DMA configuration, aborting.\n"); goto err_out_res; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_err(&pdev->dev, "No usable consistent DMA configuration, " diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 9509c17b3667..57bc71527850 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c @@ -1163,7 +1163,7 @@ static int __devinit ace_init(struct net_device *dev) */ if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { ap->pci_using_dac = 1; - } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { ap->pci_using_dac = 0; } else { ecode = -ENODEV; diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index cb9c95d3ed0a..19831bd64016 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -1871,7 +1871,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev, } /* Initialize DMA */ - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) { printk(KERN_ERR "amd8111e: DMA not supported," "exiting.\n"); goto err_free_reg; diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c index c758884728a5..fb57b750866b 100644 --- a/drivers/net/atl1e/atl1e_main.c +++ b/drivers/net/atl1e/atl1e_main.c @@ -2326,8 +2326,8 @@ static int __devinit atl1e_probe(struct pci_dev *pdev, * various kernel subsystems to support the mechanics required by a * fixed-high-32-bit system. */ - if ((pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) || - (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) != 0)) { + if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) || + (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)) { dev_err(&pdev->dev, "No usable DMA configuration,aborting\n"); goto err_dma; } diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 43fc1b2ca3cd..0ab22540bf59 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c @@ -2929,7 +2929,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev, * various kernel subsystems to support the mechanics required by a * fixed-high-32-bit system. */ - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "no usable DMA configuration\n"); goto err_dma; diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index 9fe06c3f4097..c734b1983ec1 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c @@ -1358,8 +1358,8 @@ static int __devinit atl2_probe(struct pci_dev *pdev, * until the kernel has the proper infrastructure to support 64-bit DMA * on these devices. */ - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) && - pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) && + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR "atl2: No usable DMA configuration, aborting\n"); goto err_dma; } diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 5fd57703c65a..9d268be0b670 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -7538,7 +7538,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) "pci_set_consistent_dma_mask failed, aborting.\n"); goto err_out_unmap; } - } else if ((rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) != 0) { + } else if ((rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) { dev_err(&pdev->dev, "System does not support DMA, aborting.\n"); goto err_out_unmap; } diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 03e01243b45e..ad5ef25add3e 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c @@ -10988,7 +10988,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, goto err_out_release; } - } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) { + } else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { printk(KERN_ERR PFX "System does not support DMA," " aborting\n"); rc = -EIO; diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index c2895240e467..f5222764061c 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -5085,7 +5085,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev, } } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "No usable DMA configuration, " "aborting.\n"); diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 57cfbc369f51..fa06994f9737 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c @@ -1066,7 +1066,7 @@ static int __devinit init_one(struct pci_dev *pdev, goto out_disable_pdev; } - } else if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) != 0) { + } else if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) { CH_ERR("%s: no usable DMA configuration\n", pci_name(pdev)); goto out_disable_pdev; } diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index ec35d3b82409..ab0e5febef83 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c @@ -3046,7 +3046,7 @@ static int __devinit init_one(struct pci_dev *pdev, "coherent allocations\n"); goto out_disable_device; } - } else if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) != 0) { + } else if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) { dev_err(&pdev->dev, "no usable DMA configuration\n"); goto out_disable_device; } diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 0504db9ad643..5c0b457c7868 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2604,7 +2604,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, goto err_out_disable_pdev; } - if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { + if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); goto err_out_free_res; } diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index caa71dffb3d0..ddc5c533e89c 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -966,9 +966,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev, !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { pci_using_dac = 1; } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { E1000_ERR("No usable DMA configuration, " "aborting\n"); diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 4a61160052a3..409b58cad0e5 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -2203,7 +2203,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) /* Setup the HW Tx Head and Tail descriptor pointers */ tdba = tx_ring->dma; tdlen = tx_ring->count * sizeof(struct e1000_tx_desc); - ew32(TDBAL, (tdba & DMA_32BIT_MASK)); + ew32(TDBAL, (tdba & DMA_BIT_MASK(32))); ew32(TDBAH, (tdba >> 32)); ew32(TDLEN, tdlen); ew32(TDH, 0); @@ -2459,7 +2459,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) * the Base and Length of the Rx Descriptor Ring */ rdba = rx_ring->dma; - ew32(RDBAL, (rdba & DMA_32BIT_MASK)); + ew32(RDBAL, (rdba & DMA_BIT_MASK(32))); ew32(RDBAH, (rdba >> 32)); ew32(RDLEN, rdlen); ew32(RDH, 0); @@ -4769,10 +4769,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, if (!err) pci_using_dac = 1; } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { err = pci_set_consistent_dma_mask(pdev, - DMA_32BIT_MASK); + DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "No usable DMA " "configuration, aborting\n"); diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 5b87105ac9e0..9080f07da8fe 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1687,13 +1687,13 @@ static int __devinit enic_probe(struct pci_dev *pdev, err = pci_set_dma_mask(pdev, DMA_BIT_MASK(40)); if (err) { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR PFX "No usable DMA configuration, aborting.\n"); goto err_out_release_regions; } - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR PFX "Unable to obtain 32-bit DMA " diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index ad8be7e78290..de3f49f991a3 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -580,7 +580,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, * Also, we can have EISA Busmaster cards (not tested), * so beware !!! - Jean II */ if((bus == HP100_BUS_PCI) && - (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK))) { + (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)))) { /* Gracefully fallback to shared memory */ goto busmasterfail; } diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 82278beaac83..6b0697c565b9 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c @@ -1160,9 +1160,9 @@ static int __devinit igb_probe(struct pci_dev *pdev, if (!err) pci_using_dac = 1; } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "No usable DMA " "configuration, aborting\n"); diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 43be0b01f12c..cbc63ff13add 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -1236,7 +1236,7 @@ static int __devinit ioc3_probe(struct pci_dev *pdev, goto out; } } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR "%s: No usable DMA configuration, " "aborting.\n", pci_name(pdev)); diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index ed9ded939d96..43019461b776 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c @@ -2242,7 +2242,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(40)); if (rc < 0) { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc < 0) { printk(KERN_ERR "%s: DMA config failed.\n", pci_name(pdev)); diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 0ac51758bc6c..4a0826b8f6f2 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c @@ -369,8 +369,8 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) !(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))) { pci_using_dac = 1; } else { - if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) || - (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { + if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) || + (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) { printk(KERN_ERR "ixgb: No usable DMA configuration, aborting\n"); goto err_dma_mask; diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 126735ca6d7f..9ef128ae6458 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -1643,7 +1643,7 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) tdba = ring->dma; tdlen = ring->count * sizeof(union ixgbe_adv_tx_desc); IXGBE_WRITE_REG(hw, IXGBE_TDBAL(j), - (tdba & DMA_32BIT_MASK)); + (tdba & DMA_BIT_MASK(32))); IXGBE_WRITE_REG(hw, IXGBE_TDBAH(j), (tdba >> 32)); IXGBE_WRITE_REG(hw, IXGBE_TDLEN(j), tdlen); IXGBE_WRITE_REG(hw, IXGBE_TDH(j), 0); @@ -1782,7 +1782,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) for (i = 0; i < adapter->num_rx_queues; i++) { rdba = adapter->rx_ring[i].dma; j = adapter->rx_ring[i].reg_idx; - IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_32BIT_MASK)); + IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); @@ -4513,9 +4513,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { pci_using_dac = 1; } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "No usable DMA " "configuration, aborting\n"); diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 860dcd98a07c..ece35040288c 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c @@ -2600,8 +2600,8 @@ jme_pci_dma64(struct pci_dev *pdev) if (!pci_set_consistent_dma_mask(pdev, DMA_40BIT_MASK)) return 1; - if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) - if (!pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) + if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) + if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) return 0; return -1; diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index fed53fbaf545..102bac90a302 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c @@ -1079,7 +1079,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask.\n"); - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting.\n"); goto err_release_bar2; @@ -1089,7 +1089,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) if (err) { dev_warn(&pdev->dev, "Warning: couldn't set 64-bit " "consistent PCI DMA mask.\n"); - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "Can't set consistent PCI DMA mask, " "aborting.\n"); diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 27655466dbeb..9eed126a82f0 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -1130,7 +1130,7 @@ myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, __be32 low; low = src->addr_low; - src->addr_low = htonl(DMA_32BIT_MASK); + src->addr_low = htonl(DMA_BIT_MASK(32)); myri10ge_pio_copy(dst, src, 4 * sizeof(*src)); mb(); myri10ge_pio_copy(dst + 4, src + 4, 4 * sizeof(*src)); @@ -3798,7 +3798,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) dev_err(&pdev->dev, "64-bit pci address mask was refused, " "trying 32-bit\n"); - status = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + status = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); } if (status != 0) { dev_err(&pdev->dev, "Error %d setting DMA mask\n", status); diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 02c37e2f08a9..73cac6c78cb6 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c @@ -9889,8 +9889,8 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, goto err_out_release_parent; } } - if (err || dma_mask == DMA_32BIT_MASK) { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + if (err || dma_mask == DMA_BIT_MASK(32)) { + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, PFX "No usable DMA configuration, " "aborting.\n"); diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index e30ab06e7103..d531614a90b5 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c @@ -1975,7 +1975,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, if (sizeof(dma_addr_t) == 8 && !pci_set_dma_mask(pci_dev, DMA_BIT_MASK(64))) { using_dac = 1; - } else if (!pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { + } else if (!pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32))) { using_dac = 0; } else { dev_warn(&pci_dev->dev, "pci_set_dma_mask failed!\n"); diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index aef047e4515a..cadc32c94c1e 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c @@ -3937,9 +3937,9 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { pci_using_dac = 1; err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); - } else if (!(err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { + } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { pci_using_dac = 0; - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } if (err) { diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 0add30d38d62..c92ced247947 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -3730,9 +3730,9 @@ static int __devinit ql_init_device(struct pci_dev *pdev, set_bit(QL_DMA64, &qdev->flags); err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } if (err) { diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 0a37f9902a07..5e8540b6ffa1 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c @@ -1085,13 +1085,13 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, goto err_out; /* this should always be supported */ - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR DRV_NAME ": 32-bit PCI DMA addresses" "not supported by the card\n"); goto err_out; } - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR DRV_NAME ": 32-bit PCI DMA addresses" "not supported by the card\n"); diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index fe676d38d342..0b6e8c896835 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -1148,7 +1148,7 @@ static void rtl8169_update_counters(struct net_device *dev) return; RTL_W32(CounterAddrHigh, (u64)paddr >> 32); - cmd = (u64)paddr & DMA_32BIT_MASK; + cmd = (u64)paddr & DMA_BIT_MASK(32); RTL_W32(CounterAddrLow, cmd); RTL_W32(CounterAddrLow, cmd | CounterDump); @@ -2050,7 +2050,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) tp->cp_cmd |= PCIDAC; dev->features |= NETIF_F_HIGHDMA; } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc < 0) { if (netif_msg_probe(tp)) { dev_err(&pdev->dev, @@ -2343,9 +2343,9 @@ static void rtl_set_rx_tx_desc_registers(struct rtl8169_private *tp, * Switching from MMIO to I/O access fixes the issue as well. */ RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr) >> 32); - RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr) & DMA_32BIT_MASK); + RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr) & DMA_BIT_MASK(32)); RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr) >> 32); - RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr) & DMA_32BIT_MASK); + RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr) & DMA_BIT_MASK(32)); } static u16 rtl_rw_cpluscmd(void __iomem *ioaddr) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 7c8d5613a1da..1a4979f27fb5 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -7786,7 +7786,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) pci_disable_device(pdev); return -ENOMEM; } - } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 32bit DMA\n"); } else { pci_disable_device(pdev); diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index c13cbf099b88..18821f217e19 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c @@ -1427,11 +1427,11 @@ static int __devinit sc92031_probe(struct pci_dev *pdev, pci_set_master(pdev); - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (unlikely(err < 0)) goto out_set_dma_mask; - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (unlikely(err < 0)) goto out_set_dma_mask; diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index a9732686134b..55ccd51d247e 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -1467,7 +1467,7 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) goto err_pci_disable_2; } - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc < 0) { net_probe(tp, KERN_ERR "%s: DMA configuration failed.\n", pci_name(pdev)); diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 8a70de72ea2c..2d4617b3e208 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c @@ -432,7 +432,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev, ret = pci_enable_device(pci_dev); if(ret) return ret; - i = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK); + i = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); if(i){ printk(KERN_ERR "sis900.c: architecture does not support " "32bit PCI busmaster DMA\n"); diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 18a7b662aff1..b8978d4af1b7 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -3915,9 +3915,9 @@ static int __devinit skge_probe(struct pci_dev *pdev, if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { using_dac = 1; err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); - } else if (!(err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { + } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { using_dac = 0; - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } if (err) { diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index da570f44b12b..a2ff9cb1e7ac 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -4383,7 +4383,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, goto err_out_free_regions; } } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "no usable DMA configuration\n"); goto err_out_free_regions; diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index 5959ae86e57d..60abdb1081ad 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c @@ -1598,7 +1598,7 @@ smsc9420_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_free_netdev_2; } - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR "No usable DMA configuration, aborting.\n"); goto out_free_regions_3; } diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 2312d10f3b54..d2dfe0ab5106 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -3045,7 +3045,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { pci_using_dac = 1; } else { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR PFX "No usable DMA configuration, " "aborting.\n"); diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index d77a0918a325..7f4a9683ba1e 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c @@ -1945,8 +1945,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) !(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))) { pci_using_dac = 1; } else { - if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) || - (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { + if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) || + (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) { printk(KERN_ERR "tehuti: No usable DMA configuration" ", aborting\n"); goto err_dma; diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h index 121dda917fdc..4fc875e5dcdd 100644 --- a/drivers/net/tehuti.h +++ b/drivers/net/tehuti.h @@ -99,10 +99,6 @@ #define READ_REG(pp, reg) readl(pp->pBdxRegs + reg) #define WRITE_REG(pp, reg, val) writel(val, pp->pBdxRegs + reg) -#ifndef DMA_32BIT_MASK -# define DMA_32BIT_MASK 0x00000000ffffffffULL -#endif - #ifndef NET_IP_ALIGN # define NET_IP_ALIGN 2 #endif diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 5ba91d7f7587..6a736dda3ee2 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -13228,7 +13228,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, * do DMA address check in tg3_start_xmit(). */ if (tp->tg3_flags2 & TG3_FLG2_IS_5788) - persist_dma_mask = dma_mask = DMA_32BIT_MASK; + persist_dma_mask = dma_mask = DMA_BIT_MASK(32); else if (tp->tg3_flags & TG3_FLAG_40BIT_DMA_BUG) { persist_dma_mask = dma_mask = DMA_BIT_MASK(40); #ifdef CONFIG_HIGHMEM @@ -13238,7 +13238,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, persist_dma_mask = dma_mask = DMA_BIT_MASK(64); /* Configure DMA attributes. */ - if (dma_mask > DMA_32BIT_MASK) { + if (dma_mask > DMA_BIT_MASK(32)) { err = pci_set_dma_mask(pdev, dma_mask); if (!err) { dev->features |= NETIF_F_HIGHDMA; @@ -13251,8 +13251,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, } } } - if (err || dma_mask == DMA_32BIT_MASK) { - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + if (err || dma_mask == DMA_BIT_MASK(32)) { + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_ERR PFX "No usable DMA configuration, " "aborting.\n"); @@ -13393,7 +13393,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", dev->name, tp->dma_rwctrl, - (pdev->dma_mask == DMA_32BIT_MASK) ? 32 : + (pdev->dma_mask == DMA_BIT_MASK(32)) ? 32 : (((u64) pdev->dma_mask == DMA_BIT_MASK(40)) ? 40 : 64)); return 0; diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index 68b967b585aa..aa6964922d5e 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c @@ -570,7 +570,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, priv->adapter = &board_info[ent->driver_data]; - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n"); goto err_out_free_dev; diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index f309b8f703bd..2e70ee8f1459 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c @@ -267,7 +267,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, #endif #endif - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { printk(KERN_ERR "%s: No suitable PCI mapping available.\n", dev->name); diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index e2c9d0f5a755..f2e669974c78 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c @@ -383,7 +383,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, return -ENOMEM; SET_NETDEV_DEV(dev, &pdev->dev); - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); err = -ENODEV; diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index c227db079621..8761a5a5bd79 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c @@ -282,7 +282,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, return -ENOMEM; SET_NETDEV_DEV(dev, &pdev->dev); - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); err = -ENODEV; goto err_out_free; diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index c61a01b029af..264e61404f34 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c @@ -375,7 +375,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, irq = pdev->irq; - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n", pci_name(pdev)); return -EIO; diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 9dd4f76a2ff5..cf25eb41b1ce 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c @@ -2406,7 +2406,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto error_out_disable; } - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if(err < 0) { printk(ERR_PFX "%s: No usable DMA configuration\n", pci_name(pdev)); diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 880eaf07413b..45daba726b66 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c @@ -686,7 +686,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, goto err_out; /* this should always be supported */ - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { printk(KERN_ERR "32-bit PCI DMA addresses not supported by " "the card!?\n"); diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index 887acb0dc807..850d70d7b05d 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c @@ -633,8 +633,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, /* FIXME when PCI/DMA subsystems are fixed. We set both dma_mask and consistent_dma_mask back to 32 bits to indicate the card can do 32-bit DMA addressing */ - if (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) || - pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) || + pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR "wanXL: No usable DMA configuration\n"); wanxl_pci_remove_one(pdev); return -EIO; diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index fc0897fb2239..f71821795018 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c @@ -1804,8 +1804,8 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, return err; /* someone else grabbed it? don't disable it */ } - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || - pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR "%s (adm8211): No suitable DMA available\n", pci_name(pdev)); goto err_free_reg; diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 5d57d774e466..a08bc8a4fb69 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c @@ -445,7 +445,7 @@ ath5k_pci_probe(struct pci_dev *pdev, } /* XXX 32-bit addressing only */ - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) { dev_err(&pdev->dev, "32-bit DMA not available\n"); goto err_dis; diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 461d680d2cec..de1964f7d9e0 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -777,7 +777,7 @@ static u64 supported_dma_mask(struct b43_wldev *dev) b43_write32(dev, mmio_base + B43_DMA32_TXCTL, B43_DMA32_TXADDREXT_MASK); tmp = b43_read32(dev, mmio_base + B43_DMA32_TXCTL); if (tmp & B43_DMA32_TXADDREXT_MASK) - return DMA_32BIT_MASK; + return DMA_BIT_MASK(32); return DMA_30BIT_MASK; } @@ -786,7 +786,7 @@ static enum b43_dmatype dma_mask_to_engine_type(u64 dmamask) { if (dmamask == DMA_30BIT_MASK) return B43_DMA_30BIT; - if (dmamask == DMA_32BIT_MASK) + if (dmamask == DMA_BIT_MASK(32)) return B43_DMA_32BIT; if (dmamask == DMA_BIT_MASK(64)) return B43_DMA_64BIT; @@ -1000,11 +1000,11 @@ static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask) if (!err) break; if (mask == DMA_BIT_MASK(64)) { - mask = DMA_32BIT_MASK; + mask = DMA_BIT_MASK(32); fallback = 1; continue; } - if (mask == DMA_32BIT_MASK) { + if (mask == DMA_BIT_MASK(32)) { mask = DMA_30BIT_MASK; fallback = 1; continue; diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index 61bb91266aa8..1d3e0d239314 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c @@ -854,7 +854,7 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev) tmp = b43legacy_read32(dev, mmio_base + B43legacy_DMA32_TXCTL); if (tmp & B43legacy_DMA32_TXADDREXT_MASK) - return DMA_32BIT_MASK; + return DMA_BIT_MASK(32); return DMA_30BIT_MASK; } @@ -863,7 +863,7 @@ static enum b43legacy_dmatype dma_mask_to_engine_type(u64 dmamask) { if (dmamask == DMA_30BIT_MASK) return B43legacy_DMA_30BIT; - if (dmamask == DMA_32BIT_MASK) + if (dmamask == DMA_BIT_MASK(32)) return B43legacy_DMA_32BIT; if (dmamask == DMA_BIT_MASK(64)) return B43legacy_DMA_64BIT; @@ -1043,11 +1043,11 @@ static int b43legacy_dma_set_mask(struct b43legacy_wldev *dev, u64 mask) if (!err) break; if (mask == DMA_BIT_MASK(64)) { - mask = DMA_32BIT_MASK; + mask = DMA_BIT_MASK(32); fallback = 1; continue; } - if (mask == DMA_32BIT_MASK) { + if (mask == DMA_BIT_MASK(32)) { mask = DMA_30BIT_MASK; fallback = 1; continue; diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index f4e963ba768b..97e5647ff050 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c @@ -6207,7 +6207,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, pci_set_master(pci_dev); pci_set_drvdata(pci_dev, priv); - err = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); if (err) { printk(KERN_WARNING DRV_NAME "Error calling pci_set_dma_mask.\n"); diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index e17a4593e1f5..bd4dbcfe1bbe 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c @@ -11631,9 +11631,9 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n"); goto out_pci_disable_device; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 9d5f97dd7c73..ce729281ff62 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -4998,9 +4998,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e pci_set_master(pdev); - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { IWL_WARN(priv, "No suitable DMA available.\n"); goto out_pci_disable_device; diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index 9a72b1e3e163..30876728d7e6 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c @@ -120,7 +120,7 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id) } /* enable PCI DMA */ - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR "%s: 32-bit PCI DMA not supported", DRV_NAME); goto do_pci_disable_device; } diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index e616c20d4a78..43fa0f849003 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c @@ -288,7 +288,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) if (pci_set_mwi(pci_dev)) ERROR_PROBE("MWI not available.\n"); - if (dma_set_mask(&pci_dev->dev, DMA_32BIT_MASK)) { + if (dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32))) { ERROR_PROBE("PCI DMA not supported.\n"); retval = -EIO; goto exit_disable_device; diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 09dc98b84553..fb3a3f3fca7a 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -56,7 +56,7 @@ #define DOMAIN_MAX_ADDR(gaw) ((((u64)1) << gaw) - 1) #define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT) -#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK) +#define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32)) #define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) /* global iommu list, set NULL for ignored DMAR units */ @@ -2080,15 +2080,15 @@ __intel_alloc_iova(struct device *dev, struct dmar_domain *domain, struct pci_dev *pdev = to_pci_dev(dev); struct iova *iova = NULL; - if (dma_mask <= DMA_32BIT_MASK || dmar_forcedac) + if (dma_mask <= DMA_BIT_MASK(32) || dmar_forcedac) iova = iommu_alloc_iova(domain, size, dma_mask); else { /* * First try to allocate an io virtual address in - * DMA_32BIT_MASK and if that fails then try allocating + * DMA_BIT_MASK(32) and if that fails then try allocating * from higher range */ - iova = iommu_alloc_iova(domain, size, DMA_32BIT_MASK); + iova = iommu_alloc_iova(domain, size, DMA_BIT_MASK(32)); if (!iova) iova = iommu_alloc_iova(domain, size, dma_mask); } diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 5c13f61bfb1b..74d0bfa3f310 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -381,9 +381,9 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, rdev->dev.release = rio_release_dev; rio_dev_get(rdev); - rdev->dma_mask = DMA_32BIT_MASK; + rdev->dma_mask = DMA_BIT_MASK(32); rdev->dev.dma_mask = &rdev->dma_mask; - rdev->dev.coherent_dma_mask = DMA_32BIT_MASK; + rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); if ((rdev->pef & RIO_PEF_INB_DOORBELL) && (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 6697652740b8..fdb14ec4fd47 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2018,8 +2018,8 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) - || pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) + || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); retval = -ENODEV; goto out_disable_device; diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h index 0742e6846656..8e71e5e122b3 100644 --- a/drivers/scsi/3w-xxxx.h +++ b/drivers/scsi/3w-xxxx.h @@ -234,7 +234,7 @@ static unsigned char tw_sense_table[][4] = #define TW_IOCTL_TIMEOUT 25 /* 25 seconds */ #define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */ #define TW_IOCTL_CHRDEV_FREE -1 -#define TW_DMA_MASK DMA_32BIT_MASK +#define TW_DMA_MASK DMA_BIT_MASK(32) #define TW_MAX_CDB_LEN 16 /* Bitmask macros to eliminate bitfields */ diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 2d689af24664..1ddcf4031d4c 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c @@ -667,7 +667,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd if (pci_enable_device(PCI_Device)) continue; - if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK )) + if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32) )) continue; Bus = PCI_Device->bus->number; @@ -834,7 +834,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd if (pci_enable_device(PCI_Device)) continue; - if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK)) + if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32))) continue; Bus = PCI_Device->bus->number; @@ -888,7 +888,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda if (pci_enable_device(PCI_Device)) continue; - if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK)) + if (pci_set_dma_mask(PCI_Device, DMA_BIT_MASK(32))) continue; Bus = PCI_Device->bus->number; diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index 964769f66eac..208d6df9ed59 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c @@ -1094,7 +1094,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, if (pci_enable_device(pdev)) goto out; - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "Unable to set 32bit DMA " "on inia100 adapter, ignoring.\n"); goto out_disable_device; diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index e83ef8aaa98c..280261c451d6 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1407,8 +1407,8 @@ int aac_get_adapter_info(struct aac_dev* dev) if (!dev->in_reset) printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n", dev->name, dev->id); - } else if (!pci_set_dma_mask(dev->pdev, DMA_32BIT_MASK) && - !pci_set_consistent_dma_mask(dev->pdev, DMA_32BIT_MASK)) { + } else if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(32)) && + !pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(32))) { printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n", dev->name, dev->id); dev->dac_support = 0; diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index d24c2670040b..3b69c2d98dd6 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1210,14 +1210,14 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_31BIT_MASK)))) goto out; } else { - if (((retval = pci_set_dma_mask(aac->pdev, DMA_32BIT_MASK))) || - ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_32BIT_MASK)))) + if (((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(32)))) || + ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_BIT_MASK(32))))) goto out; } if ((retval = (*(aac_get_driver_ident(index)->init))(aac))) goto out; if (quirks & AAC_QUIRK_31BIT) - if ((retval = pci_set_dma_mask(aac->pdev, DMA_32BIT_MASK))) + if ((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(32)))) goto out; if (jafo) { aac->thread = kthread_run(aac_command_thread, aac, aac->name); diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index c507719c0d44..3c3ed4b3311a 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1095,8 +1095,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, goto out; error = -ENODEV; - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || - pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) goto out_disable_pdev; /* * If the quirk31 bit is set, the adapter needs adapter @@ -1154,7 +1154,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, * address space. */ if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) goto out_deinit; aac->maximum_num_channels = aac_drivers[index].channels; diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index c583d89f569a..8f686122d54e 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c @@ -197,13 +197,13 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (required_mask > DMA_BIT_MASK(39) && dma_set_mask(dev, DMA_BIT_MASK(64)) == 0) ahd->flags |= AHD_64BIT_ADDRESSING; - else if (required_mask > DMA_32BIT_MASK && + else if (required_mask > DMA_BIT_MASK(32) && dma_set_mask(dev, DMA_BIT_MASK(39)) == 0) ahd->flags |= AHD_39BIT_ADDRESSING; else - dma_set_mask(dev, DMA_32BIT_MASK); + dma_set_mask(dev, DMA_BIT_MASK(32)); } else { - dma_set_mask(dev, DMA_32BIT_MASK); + dma_set_mask(dev, DMA_BIT_MASK(32)); } ahd->dev_softc = pci; error = ahd_pci_config(ahd, entry); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 00f5b9868574..78fc70c24e07 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -241,10 +241,10 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (sizeof(dma_addr_t) > 4 && ahc->features & AHC_LARGE_SCBS && dma_set_mask(dev, mask_39bit) == 0 - && dma_get_required_mask(dev) > DMA_32BIT_MASK) { + && dma_get_required_mask(dev) > DMA_BIT_MASK(32)) { ahc->flags |= AHC_39BIT_ADDRESSING; } else { - if (dma_set_mask(dev, DMA_32BIT_MASK)) { + if (dma_set_mask(dev, DMA_BIT_MASK(32))) { ahc_free(ahc); printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); return (-ENODEV); diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 7edbe4309c61..996f7224f90e 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -793,8 +793,8 @@ static int __devinit asd_pci_probe(struct pci_dev *dev, if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64))) ; - else if (!pci_set_dma_mask(dev, DMA_32BIT_MASK) - && !pci_set_consistent_dma_mask(dev, DMA_32BIT_MASK)) + else if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32)) + && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32))) ; else { asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index e95b72dd34b1..80aac01b5a6f 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -395,7 +395,7 @@ static int arcmsr_probe(struct pci_dev *pdev, error = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (error) { - error = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (error) { printk(KERN_WARNING "scsi%d: No suitable DMA mask available\n", diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 20ca0a6374b5..b137e561f5bc 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -2568,7 +2568,7 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (pci_enable_device(pdev)) goto err_eio; - if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_INFO "atp870u: use 32bit DMA mask.\n"); } else { printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 75a94e438fa5..b6af63ca980b 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -1015,14 +1015,14 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev */ if (sizeof(dma_addr_t) > 4 && pci_set_dma_mask(pDev, DMA_BIT_MASK(64)) == 0) { - if (dma_get_required_mask(&pDev->dev) > DMA_32BIT_MASK) + if (dma_get_required_mask(&pDev->dev) > DMA_BIT_MASK(32)) dma64 = 1; } - if (!dma64 && pci_set_dma_mask(pDev, DMA_32BIT_MASK) != 0) + if (!dma64 && pci_set_dma_mask(pDev, DMA_BIT_MASK(32)) != 0) return -EINVAL; /* adapter only supports message blocks below 4GB */ - pci_set_consistent_dma_mask(pDev, DMA_32BIT_MASK); + pci_set_consistent_dma_mask(pDev, DMA_BIT_MASK(32)); base_addr0_phys = pci_resource_start(pDev,0); hba_map0_area_size = pci_resource_len(pDev,0); diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 976cdd5c94ef..be5099dd94b5 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -1426,7 +1426,7 @@ static int port_detect(unsigned long port_base, unsigned int j, if (ha->pdev) { pci_set_master(ha->pdev); - if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) + if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) printk("%s: warning, pci_set_dma_mask failed.\n", ha->board_name); } diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 4982344f1f09..185e6bc4dd40 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -5023,7 +5023,7 @@ static int __devinit gdth_pci_probe_one(gdth_pci_str *pcistr, /* 64-bit DMA only supported from FW >= x.43 */ if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) || !ha->dma64_support) { - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "GDT-PCI %d: " "Unable to set 32-bit DMA\n", ha->hanum); goto out_free_coal_stat; @@ -5032,7 +5032,7 @@ static int __devinit gdth_pci_probe_one(gdth_pci_str *pcistr, shp->max_cmd_len = 16; if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum); - } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + } else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "GDT-PCI %d: " "Unable to set 64/32-bit DMA\n", ha->hanum); goto out_free_coal_stat; diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index a13d78150cb5..c596ab5f05c3 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -959,7 +959,7 @@ static int __devinit hptiop_probe(struct pci_dev *pcidev, /* Enable 64bit DMA if possible */ if (pci_set_dma_mask(pcidev, DMA_BIT_MASK(64))) { - if (pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pcidev, DMA_BIT_MASK(32))) { printk(KERN_ERR "hptiop: fail to set dma_mask\n"); goto disable_pci_device; } diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 5529518ff2fa..89a59484be02 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -2856,7 +2856,7 @@ static int initio_probe_one(struct pci_dev *pdev, reg = 0; bios_seg = (bios_seg << 8) + ((u16) ((reg & 0xFF00) >> 8)); - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "i91u: Could not set 32 bit DMA mask\n"); error = -ENODEV; goto out_disable_device; diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index def473f0a98f..c09d77591f92 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -7498,7 +7498,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev, pci_set_master(pdev); - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc < 0) { dev_err(&pdev->dev, "Failed to set PCI DMA mask\n"); goto cleanup_nomem; diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 45296a975f8b..f83a116955f2 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -7051,7 +7051,7 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) !pci_set_dma_mask(ha->pcidev, DMA_BIT_MASK(64))) { (ha)->flags |= IPS_HA_ENH_SG; } else { - if (pci_set_dma_mask(ha->pcidev, DMA_32BIT_MASK) != 0) { + if (pci_set_dma_mask(ha->pcidev, DMA_BIT_MASK(32)) != 0) { printk(KERN_WARNING "Unable to set DMA Mask\n"); return ips_abort_init(ha, index); } diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c index f23c4ca9a2ee..b3d31315ac32 100644 --- a/drivers/scsi/lasi700.c +++ b/drivers/scsi/lasi700.c @@ -108,7 +108,7 @@ lasi700_probe(struct parisc_device *dev) } hostdata->dev = &dev->dev; - dma_set_mask(&dev->dev, DMA_32BIT_MASK); + dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); hostdata->base = ioremap_nocache(base, 0x100); hostdata->differential = 0; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index c255b4d94b1b..06874e6009ea 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -2661,7 +2661,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) pci_try_set_mwi(pdev); if (pci_set_dma_mask(phba->pcidev, DMA_BIT_MASK(64)) != 0) - if (pci_set_dma_mask(phba->pcidev, DMA_32BIT_MASK) != 0) + if (pci_set_dma_mask(phba->pcidev, DMA_BIT_MASK(32)) != 0) goto out_idr_remove; /* diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 112991d46d95..49eb0612d5af 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -2021,7 +2021,7 @@ make_local_pdev(adapter_t *adapter, struct pci_dev **pdev) memcpy(*pdev, adapter->dev, sizeof(struct pci_dev)); - if( pci_set_dma_mask(*pdev, DMA_32BIT_MASK) != 0 ) { + if( pci_set_dma_mask(*pdev, DMA_BIT_MASK(32)) != 0 ) { kfree(*pdev); return -1; } @@ -4796,7 +4796,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); adapter->has_64bit_addr = 1; } else { - pci_set_dma_mask(pdev, DMA_32BIT_MASK); + pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); adapter->has_64bit_addr = 0; } diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index b2c19449119d..234f0b7eb21c 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -473,7 +473,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) // Setup the default DMA mask. This would be changed later on // depending on hardware capabilities - if (pci_set_dma_mask(adapter->pdev, DMA_32BIT_MASK) != 0) { + if (pci_set_dma_mask(adapter->pdev, DMA_BIT_MASK(32)) != 0) { con_log(CL_ANN, (KERN_WARNING "megaraid: pci_set_dma_mask failed:%d\n", __LINE__)); @@ -904,7 +904,7 @@ megaraid_init_mbox(adapter_t *adapter) con_log(CL_ANN, (KERN_WARNING "megaraid: DMA mask for 64-bit failed\n")); - if (pci_set_dma_mask (adapter->pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask (adapter->pdev, DMA_BIT_MASK(32))) { con_log(CL_ANN, (KERN_WARNING "megaraid: 32-bit DMA mask failed\n")); goto out_free_sysfs_res; diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 713de85771f3..7dc3d1894b1a 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c @@ -2499,11 +2499,11 @@ megasas_set_dma_mask(struct pci_dev *pdev) if (IS_DMA64) { if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) { - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) goto fail_set_dma_mask; } } else { - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) goto fail_set_dma_mask; } return 0; diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c index d8093a288438..e4acebd10d1b 100644 --- a/drivers/scsi/mvsas.c +++ b/drivers/scsi/mvsas.c @@ -878,7 +878,7 @@ static int pci_go_64(struct pci_dev *pdev) if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (rc) { - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "64-bit DMA enable failed\n"); @@ -886,13 +886,13 @@ static int pci_go_64(struct pci_dev *pdev) } } } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit DMA enable failed\n"); return rc; } - rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc) { dev_printk(KERN_ERR, &pdev->dev, "32-bit consistent DMA enable failed\n"); diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index d06ec5aa6924..2be7d5b018d2 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -2672,7 +2672,7 @@ static int nsp32_detect(struct pci_dev *pdev) /* * setup DMA */ - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { nsp32_msg (KERN_ERR, "failed to set PCI DMA mask"); goto scsi_unregister; } diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 18f7f98ba571..687dcf2d0154 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -4276,7 +4276,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) #ifdef QLA_64BIT_PTR if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(64))) { - if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "scsi(%li): Unable to set a " "suitable DMA mask - aborting\n", ha->host_no); error = -ENODEV; @@ -4286,7 +4286,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n", ha->host_no); #else - if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "scsi(%li): Unable to set a " "suitable DMA mask - aborting\n", ha->host_no); error = -ENODEV; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index f60e136b5e1b..e4fdcdad80d0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1188,8 +1188,8 @@ qla2x00_config_dma_addressing(struct qla_hw_data *ha) } } - dma_set_mask(&ha->pdev->dev, DMA_32BIT_MASK); - pci_set_consistent_dma_mask(ha->pdev, DMA_32BIT_MASK); + dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); + pci_set_consistent_dma_mask(ha->pdev, DMA_BIT_MASK(32)); } static void diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index d427fab7a183..ec9da6ce8489 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -1375,10 +1375,10 @@ static void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha) "Failed to set 64 bit PCI consistent mask; " "using 32 bit.\n"); retval = pci_set_consistent_dma_mask(ha->pdev, - DMA_32BIT_MASK); + DMA_BIT_MASK(32)); } } else - retval = pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK); + retval = pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32)); } static int qla4xxx_slave_alloc(struct scsi_device *sdev) diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c index 77f0b2cdaa94..37b3359e863e 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c @@ -83,7 +83,7 @@ static int __init snirm710_probe(struct platform_device *dev) } hostdata->dev = &dev->dev; - dma_set_mask(&dev->dev, DMA_32BIT_MASK); + dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); hostdata->base = ioremap_nocache(base, 0x100); hostdata->differential = 0; diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 7cb8063c4355..8d2a95c4e5b5 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -1398,9 +1398,9 @@ static int stex_set_dma_mask(struct pci_dev * pdev) if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) return 0; - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (!ret) - ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); return ret; } diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 23e782015880..583966ec8266 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -1349,7 +1349,7 @@ static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt, if ((SYM_CONF_DMA_ADDRESSING_MODE > 0) && (np->features & FE_DAC) && !pci_set_dma_mask(pdev, DMA_DAC_MASK)) { set_dac(np); - } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { + } else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { printf_warning("%s: No suitable DMA available\n", sym_name(np)); goto attach_failed; } diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h index b707abe90821..9ebc8706b6bf 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h @@ -1080,7 +1080,7 @@ int sym_hcb_attach(struct Scsi_Host *shost, struct sym_fw *fw, struct sym_nvram */ #if SYM_CONF_DMA_ADDRESSING_MODE == 0 -#define DMA_DAC_MASK DMA_32BIT_MASK +#define DMA_DAC_MASK DMA_BIT_MASK(32) #define sym_build_sge(np, data, badd, len) \ do { \ (data)->addr = cpu_to_scr(badd); \ diff --git a/drivers/staging/agnx/pci.c b/drivers/staging/agnx/pci.c index 4ff4c1601423..25c0ffd2faa0 100644 --- a/drivers/staging/agnx/pci.c +++ b/drivers/staging/agnx/pci.c @@ -477,8 +477,8 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev, return err; } - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || - pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { printk(KERN_ERR PFX "No suitable DMA available\n"); goto err_free_reg; } diff --git a/drivers/staging/altpciechdma/altpciechdma.c b/drivers/staging/altpciechdma/altpciechdma.c index 6a4d0b8e0960..5869e1484a95 100644 --- a/drivers/staging/altpciechdma/altpciechdma.c +++ b/drivers/staging/altpciechdma/altpciechdma.c @@ -855,9 +855,9 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id) printk(KERN_DEBUG "Using a 64-bit DMA mask.\n"); } else #endif - if (!pci_set_dma_mask(dev, DMA_32BIT_MASK)) { + if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { printk(KERN_DEBUG "Could not set 64-bit DMA mask.\n"); - pci_set_consistent_dma_mask(dev, DMA_32BIT_MASK); + pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32)); /* use 32-bit DMA */ printk(KERN_DEBUG "Using a 32-bit DMA mask.\n"); } else { diff --git a/drivers/staging/sxg/sxg.c b/drivers/staging/sxg/sxg.c index a77e1eee5693..891f6e334672 100644 --- a/drivers/staging/sxg/sxg.c +++ b/drivers/staging/sxg/sxg.c @@ -937,13 +937,13 @@ static int sxg_entry_probe(struct pci_dev *pcidev, if (!(err = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64)))) { DBG_ERROR("pci_set_dma_mask(DMA_BIT_MASK(64)) successful\n"); } else { - if ((err = pci_set_dma_mask(pcidev, DMA_32BIT_MASK))) { + if ((err = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)))) { DBG_ERROR ("No usable DMA configuration, aborting err[%x]\n", err); return err; } - DBG_ERROR("pci_set_dma_mask(DMA_32BIT_MASK) successful\n"); + DBG_ERROR("pci_set_dma_mask(DMA_BIT_MASK(32)) successful\n"); } DBG_ERROR("Call pci_request_regions\n"); diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 9c9da35abc6c..1ba9f9a8c308 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c @@ -81,7 +81,7 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev) int result; struct usb_hcd *hcd; unsigned int virq; - static u64 dummy_mask = DMA_32BIT_MASK; + static u64 dummy_mask = DMA_BIT_MASK(32); if (usb_disabled()) { result = -ENODEV; diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index 3c1a3b5f89f1..3d1910317328 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c @@ -80,7 +80,7 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev) int result; struct usb_hcd *hcd; unsigned int virq; - static u64 dummy_mask = DMA_32BIT_MASK; + static u64 dummy_mask = DMA_BIT_MASK(32); if (usb_disabled()) { result = -ENODEV; diff --git a/drivers/uwb/whci.c b/drivers/uwb/whci.c index 79bb06c7a76b..2e2784627ad6 100644 --- a/drivers/uwb/whci.c +++ b/drivers/uwb/whci.c @@ -162,8 +162,8 @@ static int whci_probe(struct pci_dev *pci, const struct pci_device_id *id) err = -ENXIO; if (!pci_set_dma_mask(pci, DMA_BIT_MASK(64))) pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); - else if (!pci_set_dma_mask(pci, DMA_32BIT_MASK)) - pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK); + else if (!pci_set_dma_mask(pci, DMA_BIT_MASK(32))) + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); else goto error_dma; diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index d7d090d21031..8083b6a36a38 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -115,7 +115,7 @@ static inline u64 dma_get_mask(struct device *dev) { if (dev && dev->dma_mask && *dev->dma_mask) return *dev->dma_mask; - return DMA_32BIT_MASK; + return DMA_BIT_MASK(32); } extern u64 dma_get_required_mask(struct device *dev); diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 32e2bd3b1142..2b0b5a7d2ced 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -549,7 +549,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t dev_addr; void *ret; int order = get_order(size); - u64 dma_mask = DMA_32BIT_MASK; + u64 dma_mask = DMA_BIT_MASK(32); if (hwdev && hwdev->coherent_dma_mask) dma_mask = hwdev->coherent_dma_mask; diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index d1f242bd0ac5..8f5098f92c37 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -909,8 +909,8 @@ snd_ad1889_create(struct snd_card *card, return err; /* check PCI availability (32bit DMA) */ - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index 9ec122383eef..7b72c88e449d 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c @@ -151,8 +151,8 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) // check PCI availability (DMA). if ((err = pci_enable_device(pci)) < 0) return err; - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { printk(KERN_ERR "error to set DMA mask\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 8eea29fc42fe..4d34bb0d99d3 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -279,8 +279,8 @@ static int __devinit snd_aw2_create(struct snd_card *card, pci_set_master(pci); /* check PCI availability (32bit DMA) */ - if ((pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) || - (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0)) { + if ((pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) || + (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0)) { printk(KERN_ERR "aw2: Impossible to set 32bit mask DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index df757575798a..bfac30f7929f 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -1589,8 +1589,8 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card, err = pci_enable_device(pci); if (err < 0) return err; - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { printk(KERN_ERR "error to set 32bit mask DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index c89ed1f5bc2b..05f56e04849b 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c @@ -285,8 +285,8 @@ static int __devinit snd_cs5535audio_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { printk(KERN_WARNING "unable to get 32bit dma\n"); err = -ENXIO; goto pcifail; diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index c1eb84a14c42..82bc5b9e7629 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1291,7 +1291,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, pci_set_master(pci); /* check if we can restrict PCI DMA transfers to 32 bits */ - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 80e064a3efff..833e9c7b27c7 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1449,7 +1449,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, pci_set_master(pci); /* check if we can restrict PCI DMA transfers to 32 bits */ - if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { snd_printk(KERN_ERR "architecture does not support " "32bit PCI busmaster DMA\n"); pci_disable_device(pci); diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 8cfed1a5dcbe..cf0dfb7ca221 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -413,7 +413,7 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) sport_done(sport_handle); } -static u64 bf5xx_pcm_dmamask = DMA_32BIT_MASK; +static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); int bf5xx_pcm_ac97_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) @@ -424,7 +424,7 @@ int bf5xx_pcm_ac97_new(struct snd_card *card, struct snd_soc_dai *dai, if (!card->dev->dma_mask) card->dev->dma_mask = &bf5xx_pcm_dmamask; if (!card->dev->coherent_dma_mask) - card->dev->coherent_dma_mask = DMA_32BIT_MASK; + card->dev->coherent_dma_mask = DMA_BIT_MASK(32); if (dai->playback.channels_min) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 1318c4f627b7..62fbb8459569 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c @@ -245,7 +245,7 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) sport_done(sport_handle); } -static u64 bf5xx_pcm_dmamask = DMA_32BIT_MASK; +static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); int bf5xx_pcm_i2s_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) @@ -256,7 +256,7 @@ int bf5xx_pcm_i2s_new(struct snd_card *card, struct snd_soc_dai *dai, if (!card->dev->dma_mask) card->dev->dma_mask = &bf5xx_pcm_dmamask; if (!card->dev->coherent_dma_mask) - card->dev->coherent_dma_mask = DMA_32BIT_MASK; + card->dev->coherent_dma_mask = DMA_BIT_MASK(32); if (dai->playback.channels_min) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 8e1431cb46bb..1bdbb0427183 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c @@ -327,7 +327,7 @@ int omap_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, if (!card->dev->dma_mask) card->dev->dma_mask = &omap_pcm_dmamask; if (!card->dev->coherent_dma_mask) - card->dev->coherent_dma_mask = DMA_32BIT_MASK; + card->dev->coherent_dma_mask = DMA_BIT_MASK(32); if (dai->playback.channels_min) { ret = omap_pcm_preallocate_dma_buffer(pcm, diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 53b9fb127a6d..d38e39575f51 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -81,7 +81,7 @@ static struct snd_pcm_ops pxa2xx_pcm_ops = { .mmap = pxa2xx_pcm_mmap, }; -static u64 pxa2xx_pcm_dmamask = DMA_32BIT_MASK; +static u64 pxa2xx_pcm_dmamask = DMA_BIT_MASK(32); static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) @@ -91,7 +91,7 @@ static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, if (!card->dev->dma_mask) card->dev->dma_mask = &pxa2xx_pcm_dmamask; if (!card->dev->coherent_dma_mask) - card->dev->coherent_dma_mask = DMA_32BIT_MASK; + card->dev->coherent_dma_mask = DMA_BIT_MASK(32); if (dai->playback.channels_min) { ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index a9d68fa2b34a..169ddad31575 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c @@ -419,7 +419,7 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm) } } -static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK; +static u64 s3c24xx_pcm_dmamask = DMA_BIT_MASK(32); static int s3c24xx_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) -- cgit v1.2.3 From 929a22a558429bd22001d6b41cf31c233c68a5e2 Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Mon, 6 Apr 2009 19:01:16 -0700 Subject: dma-mapping: replace all DMA_31BIT_MASK macro with DMA_BIT_MASK(31) Replace all DMA_31BIT_MASK macro with DMA_BIT_MASK(31) Signed-off-by: Yang Hongyang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/scsi/aacraid/commsup.c | 4 ++-- drivers/scsi/aacraid/linit.c | 4 ++-- drivers/usb/host/ehci-pci.c | 2 +- sound/pci/ali5451/ali5451.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 3b69c2d98dd6..956261f25181 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1206,8 +1206,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) aac->fsa_dev = NULL; quirks = aac_get_driver_ident(index)->quirks; if (quirks & AAC_QUIRK_31BIT) { - if (((retval = pci_set_dma_mask(aac->pdev, DMA_31BIT_MASK))) || - ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_31BIT_MASK)))) + if (((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(31)))) || + ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_BIT_MASK(31))))) goto out; } else { if (((retval = pci_set_dma_mask(aac->pdev, DMA_BIT_MASK(32)))) || diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 3c3ed4b3311a..9b97c3e016fe 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1103,8 +1103,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, * to driver communication memory to be allocated below 2gig */ if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) - if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || - pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(31)) || + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(31))) goto out_disable_pdev; pci_set_master(pdev); diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index abb9a7706ec7..5aa8bce90e1f 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -108,7 +108,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) case 0x00d8: /* CK8 */ case 0x00e8: /* CK8S */ if (pci_set_consistent_dma_mask(pdev, - DMA_31BIT_MASK) < 0) + DMA_BIT_MASK(31)) < 0) ehci_warn(ehci, "can't enable NVidia " "workaround for >2GB RAM\n"); break; diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 4edf270a7809..c551006e2920 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -2186,8 +2186,8 @@ static int __devinit snd_ali_create(struct snd_card *card, if (err < 0) return err; /* check, if we can restrict PCI DMA transfers to 31 bits */ - if (pci_set_dma_mask(pci, DMA_31BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_31BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) { snd_printk(KERN_ERR "architecture does not support " "31bit PCI busmaster DMA\n"); pci_disable_device(pci); -- cgit v1.2.3 From 28b767967763835d8526f6baedc25a8a86052640 Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Mon, 6 Apr 2009 19:01:17 -0700 Subject: dma-mapping: replace all DMA_30BIT_MASK macro with DMA_BIT_MASK(30) Replace all DMA_30BIT_MASK macro with DMA_BIT_MASK(30) Signed-off-by: Yang Hongyang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/b44.c | 14 +++++++------- drivers/net/wireless/b43/dma.c | 6 +++--- drivers/net/wireless/b43legacy/dma.c | 6 +++--- sound/pci/sis7019.c | 2 +- sound/pci/trident/trident_main.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 17b2750d21de..b70b81ec34c3 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -660,7 +660,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) /* Hardware bug work-around, the chip is unable to do PCI DMA to/from anything above 1GB :-( */ if (ssb_dma_mapping_error(bp->sdev, mapping) || - mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) { + mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)) { /* Sigh... */ if (!ssb_dma_mapping_error(bp->sdev, mapping)) ssb_dma_unmap_single(bp->sdev, mapping, @@ -673,7 +673,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) RX_PKT_BUF_SZ, DMA_FROM_DEVICE); if (ssb_dma_mapping_error(bp->sdev, mapping) || - mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) { + mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)) { if (!ssb_dma_mapping_error(bp->sdev, mapping)) ssb_dma_unmap_single(bp->sdev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); dev_kfree_skb_any(skb); @@ -965,7 +965,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) } mapping = ssb_dma_map_single(bp->sdev, skb->data, len, DMA_TO_DEVICE); - if (ssb_dma_mapping_error(bp->sdev, mapping) || mapping + len > DMA_30BIT_MASK) { + if (ssb_dma_mapping_error(bp->sdev, mapping) || mapping + len > DMA_BIT_MASK(30)) { struct sk_buff *bounce_skb; /* Chip can't handle DMA to/from >1GB, use bounce buffer */ @@ -979,7 +979,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) mapping = ssb_dma_map_single(bp->sdev, bounce_skb->data, len, DMA_TO_DEVICE); - if (ssb_dma_mapping_error(bp->sdev, mapping) || mapping + len > DMA_30BIT_MASK) { + if (ssb_dma_mapping_error(bp->sdev, mapping) || mapping + len > DMA_BIT_MASK(30)) { if (!ssb_dma_mapping_error(bp->sdev, mapping)) ssb_dma_unmap_single(bp->sdev, mapping, len, DMA_TO_DEVICE); @@ -1204,7 +1204,7 @@ static int b44_alloc_consistent(struct b44 *bp, gfp_t gfp) DMA_BIDIRECTIONAL); if (ssb_dma_mapping_error(bp->sdev, rx_ring_dma) || - rx_ring_dma + size > DMA_30BIT_MASK) { + rx_ring_dma + size > DMA_BIT_MASK(30)) { kfree(rx_ring); goto out_err; } @@ -1231,7 +1231,7 @@ static int b44_alloc_consistent(struct b44 *bp, gfp_t gfp) DMA_TO_DEVICE); if (ssb_dma_mapping_error(bp->sdev, tx_ring_dma) || - tx_ring_dma + size > DMA_30BIT_MASK) { + tx_ring_dma + size > DMA_BIT_MASK(30)) { kfree(tx_ring); goto out_err; } @@ -2180,7 +2180,7 @@ static int __devinit b44_init_one(struct ssb_device *sdev, "Failed to powerup the bus\n"); goto err_out_free_dev; } - err = ssb_dma_set_mask(sdev, DMA_30BIT_MASK); + err = ssb_dma_set_mask(sdev, DMA_BIT_MASK(30)); if (err) { dev_err(sdev->dev, "Required 30BIT DMA mask unsupported by the system.\n"); diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index de1964f7d9e0..e228c1de6e11 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -779,12 +779,12 @@ static u64 supported_dma_mask(struct b43_wldev *dev) if (tmp & B43_DMA32_TXADDREXT_MASK) return DMA_BIT_MASK(32); - return DMA_30BIT_MASK; + return DMA_BIT_MASK(30); } static enum b43_dmatype dma_mask_to_engine_type(u64 dmamask) { - if (dmamask == DMA_30BIT_MASK) + if (dmamask == DMA_BIT_MASK(30)) return B43_DMA_30BIT; if (dmamask == DMA_BIT_MASK(32)) return B43_DMA_32BIT; @@ -1005,7 +1005,7 @@ static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask) continue; } if (mask == DMA_BIT_MASK(32)) { - mask = DMA_30BIT_MASK; + mask = DMA_BIT_MASK(30); fallback = 1; continue; } diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index 1d3e0d239314..2f90fb9f5367 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c @@ -856,12 +856,12 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev) if (tmp & B43legacy_DMA32_TXADDREXT_MASK) return DMA_BIT_MASK(32); - return DMA_30BIT_MASK; + return DMA_BIT_MASK(30); } static enum b43legacy_dmatype dma_mask_to_engine_type(u64 dmamask) { - if (dmamask == DMA_30BIT_MASK) + if (dmamask == DMA_BIT_MASK(30)) return B43legacy_DMA_30BIT; if (dmamask == DMA_BIT_MASK(32)) return B43legacy_DMA_32BIT; @@ -1048,7 +1048,7 @@ static int b43legacy_dma_set_mask(struct b43legacy_wldev *dev, u64 mask) continue; } if (mask == DMA_BIT_MASK(32)) { - mask = DMA_30BIT_MASK; + mask = DMA_BIT_MASK(30); fallback = 1; continue; } diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index baf6d8e3dabc..1a5ff0611072 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -1300,7 +1300,7 @@ static int __devinit sis_chip_create(struct snd_card *card, if (rc) goto error_out; - if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { printk(KERN_ERR "sis7019: architecture does not support " "30-bit PCI busmaster DMA"); goto error_out_enabled; diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index a9da9c184660..6d943f6f6b70 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -3559,8 +3559,8 @@ int __devinit snd_trident_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 30 bits */ - if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_30BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; -- cgit v1.2.3 From ce0b620160e6d15a7f5b4b00cd7b8bd956d427d1 Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Mon, 6 Apr 2009 19:01:17 -0700 Subject: dma-mapping: replace all DMA_28BIT_MASK macro with DMA_BIT_MASK(28) Replace all DMA_28BIT_MASK macro with DMA_BIT_MASK(28) Signed-off-by: Yang Hongyang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/wan/wanxl.c | 4 ++-- sound/pci/als300.c | 4 ++-- sound/pci/emu10k1/emu10k1x.c | 4 ++-- sound/pci/es1968.c | 4 ++-- sound/pci/ice1712/ice1712.c | 4 ++-- sound/pci/maestro3.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index 850d70d7b05d..8130b79a8a99 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c @@ -586,8 +586,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, We set both dma_mask and consistent_dma_mask to 28 bits and pray pci_alloc_consistent() will use this info. It should work on most platforms */ - if (pci_set_consistent_dma_mask(pdev, DMA_28BIT_MASK) || - pci_set_dma_mask(pdev, DMA_28BIT_MASK)) { + if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) || + pci_set_dma_mask(pdev, DMA_BIT_MASK(28))) { printk(KERN_ERR "wanXL: No usable DMA configuration\n"); return -EIO; } diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 009b4c8225a5..3aa35af7ca91 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -689,8 +689,8 @@ static int __devinit snd_als300_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; - if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { printk(KERN_ERR "error setting 28bit DMA mask\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 31542adc6b7e..1970f0e70f37 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -897,8 +897,8 @@ static int __devinit snd_emu10k1x_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; - if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { snd_printk(KERN_ERR "error to set 28bit mask DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index dc97e8116141..a11f453a6b6d 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -2539,8 +2539,8 @@ static int __devinit snd_es1968_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 28 bits */ - if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 3dd63f1cda53..0d0cdbdb4486 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -2533,8 +2533,8 @@ static int __devinit snd_ice1712_create(struct snd_card *card, if (err < 0) return err; /* check, if we can restrict PCI DMA transfers to 28 bits */ - if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 70141548f251..75283fbb4b3f 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -2530,8 +2530,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, return -EIO; /* check, if we can restrict PCI DMA transfers to 28 bits */ - if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; -- cgit v1.2.3 From 2f4f27d42a301ed147e50c2edbcd27bb8990bc8e Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Mon, 6 Apr 2009 19:01:18 -0700 Subject: dma-mapping: replace all DMA_24BIT_MASK macro with DMA_BIT_MASK(24) Replace all DMA_24BIT_MASK macro with DMA_BIT_MASK(24) Signed-off-by: Yang Hongyang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ia64/kernel/pci-dma.c | 2 +- arch/x86/include/asm/dma-mapping.h | 4 ++-- arch/x86/kernel/pci-dma.c | 2 +- drivers/base/isa.c | 2 +- drivers/pnp/card.c | 2 +- drivers/pnp/core.c | 2 +- sound/pci/als4000.c | 4 ++-- sound/pci/azt3328.c | 4 ++-- sound/pci/es1938.c | 4 ++-- sound/pci/sonicvibes.c | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c index f82b0ee6bb1f..eb987386f691 100644 --- a/arch/ia64/kernel/pci-dma.c +++ b/arch/ia64/kernel/pci-dma.c @@ -75,7 +75,7 @@ int iommu_dma_supported(struct device *dev, u64 mask) /* Copied from i386. Doesn't make much sense, because it will only work for pci_alloc_coherent. The caller just has to use GFP_DMA in this case. */ - if (mask < DMA_24BIT_MASK) + if (mask < DMA_BIT_MASK(24)) return 0; /* Tell the device to use SAC when IOMMU force is on. This diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index 10a6be94eb77..f82fdc412c64 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h @@ -238,7 +238,7 @@ static inline unsigned long dma_alloc_coherent_mask(struct device *dev, dma_mask = dev->coherent_dma_mask; if (!dma_mask) - dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_BIT_MASK(32); + dma_mask = (gfp & GFP_DMA) ? DMA_BIT_MASK(24) : DMA_BIT_MASK(32); return dma_mask; } @@ -247,7 +247,7 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) { unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp); - if (dma_mask <= DMA_24BIT_MASK) + if (dma_mask <= DMA_BIT_MASK(24)) gfp |= GFP_DMA; #ifdef CONFIG_X86_64 if (dma_mask <= DMA_BIT_MASK(32) && !(gfp & GFP_DMA)) diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 136a01d52db0..745579bc8256 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c @@ -243,7 +243,7 @@ int dma_supported(struct device *dev, u64 mask) /* Copied from i386. Doesn't make much sense, because it will only work for pci_alloc_coherent. The caller just has to use GFP_DMA in this case. */ - if (mask < DMA_24BIT_MASK) + if (mask < DMA_BIT_MASK(24)) return 0; /* Tell the device to use SAC when IOMMU force is on. This diff --git a/drivers/base/isa.c b/drivers/base/isa.c index 479694b6cbe3..91dba65d7264 100644 --- a/drivers/base/isa.c +++ b/drivers/base/isa.c @@ -141,7 +141,7 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev) isa_dev->dev.release = isa_dev_release; isa_dev->id = id; - isa_dev->dev.coherent_dma_mask = DMA_24BIT_MASK; + isa_dev->dev.coherent_dma_mask = DMA_BIT_MASK(24); isa_dev->dev.dma_mask = &isa_dev->dev.coherent_dma_mask; error = device_register(&isa_dev->dev); diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index efea128f02da..4a651f69e17c 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -167,7 +167,7 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnp card->dev.parent = &card->protocol->dev; dev_set_name(&card->dev, "%02x:%02x", card->protocol->number, card->number); - card->dev.coherent_dma_mask = DMA_24BIT_MASK; + card->dev.coherent_dma_mask = DMA_BIT_MASK(24); card->dev.dma_mask = &card->dev.coherent_dma_mask; dev_id = pnp_add_card_id(card, pnpid); diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index 14814f231739..5dba90995d9e 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c @@ -137,7 +137,7 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid INIT_LIST_HEAD(&dev->options); dev->protocol = protocol; dev->number = id; - dev->dma_mask = DMA_24BIT_MASK; + dev->dma_mask = DMA_BIT_MASK(24); dev->dev.parent = &dev->protocol->dev; dev->dev.bus = &pnp_bus_type; diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 542a0c65a92c..3dbacde1a5af 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -872,8 +872,8 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci, return err; } /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index e9e9b5821d41..f290bc56178f 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -2125,8 +2125,8 @@ snd_azf3328_create(struct snd_card *card, chip->irq = -1; /* check if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { snd_printk(KERN_ERR "architecture does not support " "24bit PCI busmaster DMA\n" ); diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index dd63b132fb8e..fbd2ac09aa34 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1608,8 +1608,8 @@ static int __devinit snd_es1938_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index d989215f3556..7dc60ad4772e 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -1264,8 +1264,8 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || - pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { + if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; -- cgit v1.2.3 From 7816238a539bf56311f04e7ff17076f66d5c902a Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 7 Apr 2009 00:45:51 -0700 Subject: sparc: Fix section mismatch warnings in cs4231 sound driver. Signed-off-by: David S. Miller --- sound/sparc/cs4231.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 7d93fa705ccf..8d13d933087d 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -703,7 +703,7 @@ static int snd_cs4231_timer_stop(struct snd_timer *timer) return 0; } -static void __init snd_cs4231_init(struct snd_cs4231 *chip) +static void __devinit snd_cs4231_init(struct snd_cs4231 *chip) { unsigned long flags; @@ -1020,7 +1020,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer( return bytes_to_frames(substream->runtime, ptr); } -static int __init snd_cs4231_probe(struct snd_cs4231 *chip) +static int __devinit snd_cs4231_probe(struct snd_cs4231 *chip) { unsigned long flags; int i; @@ -1219,7 +1219,7 @@ static struct snd_pcm_ops snd_cs4231_capture_ops = { .pointer = snd_cs4231_capture_pointer, }; -static int __init snd_cs4231_pcm(struct snd_card *card) +static int __devinit snd_cs4231_pcm(struct snd_card *card) { struct snd_cs4231 *chip = card->private_data; struct snd_pcm *pcm; @@ -1248,7 +1248,7 @@ static int __init snd_cs4231_pcm(struct snd_card *card) return 0; } -static int __init snd_cs4231_timer(struct snd_card *card) +static int __devinit snd_cs4231_timer(struct snd_card *card) { struct snd_cs4231 *chip = card->private_data; struct snd_timer *timer; @@ -1499,7 +1499,7 @@ static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \ ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) } -static struct snd_kcontrol_new snd_cs4231_controls[] __initdata = { +static struct snd_kcontrol_new snd_cs4231_controls[] __devinitdata = { CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, @@ -1538,7 +1538,7 @@ CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1), CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1) }; -static int __init snd_cs4231_mixer(struct snd_card *card) +static int __devinit snd_cs4231_mixer(struct snd_card *card) { struct snd_cs4231 *chip = card->private_data; int err, idx; @@ -1559,7 +1559,7 @@ static int __init snd_cs4231_mixer(struct snd_card *card) static int dev; -static int __init cs4231_attach_begin(struct snd_card **rcard) +static int __devinit cs4231_attach_begin(struct snd_card **rcard) { struct snd_card *card; struct snd_cs4231 *chip; @@ -1590,7 +1590,7 @@ static int __init cs4231_attach_begin(struct snd_card **rcard) return 0; } -static int __init cs4231_attach_finish(struct snd_card *card) +static int __devinit cs4231_attach_finish(struct snd_card *card) { struct snd_cs4231 *chip = card->private_data; int err; @@ -1794,9 +1794,9 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = { .dev_free = snd_cs4231_sbus_dev_free, }; -static int __init snd_cs4231_sbus_create(struct snd_card *card, - struct of_device *op, - int dev) +static int __devinit snd_cs4231_sbus_create(struct snd_card *card, + struct of_device *op, + int dev) { struct snd_cs4231 *chip = card->private_data; int err; @@ -1960,9 +1960,9 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = { .dev_free = snd_cs4231_ebus_dev_free, }; -static int __init snd_cs4231_ebus_create(struct snd_card *card, - struct of_device *op, - int dev) +static int __devinit snd_cs4231_ebus_create(struct snd_card *card, + struct of_device *op, + int dev) { struct snd_cs4231 *chip = card->private_data; int err; -- cgit v1.2.3 From fa00e046b41663cbda9b1affc0594669e5f14219 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 10 Apr 2009 12:20:45 +0200 Subject: [ALSA] hda_intel: fix unexpected ring buffer positions I found two issues with ICH7-M (it should be related to other HDA chipsets as well): - the ring buffer position is not reset when stream restarts (after xrun) - solved by moving azx_stream_reset() call from open() to prepare() callback and reset posbuf to zero (it might be filled with hw later than position() callback is called) - irq_ignore flag should be set also when ring buffer memory area is not changed in prepare() callback - this patch replaces irq_ignore with more universal check based on jiffies clock Signed-off-by: Jaroslav Kysela --- sound/pci/hda/hda_intel.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 30829ee920c3..6d3b927e0f84 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -312,6 +312,9 @@ struct azx_dev { unsigned int period_bytes; /* size of the period in bytes */ unsigned int frags; /* number for period in the play buffer */ unsigned int fifo_size; /* FIFO size */ + unsigned int start_flag: 1; /* stream full start flag */ + unsigned long start_jiffies; /* start + minimum jiffies */ + unsigned long min_jiffies; /* minimum jiffies before position is valid */ void __iomem *sd_addr; /* stream descriptor pointer */ @@ -330,7 +333,6 @@ struct azx_dev { unsigned int opened :1; unsigned int running :1; unsigned int irq_pending :1; - unsigned int irq_ignore :1; /* * For VIA: * A flag to ensure DMA position is 0 @@ -975,7 +977,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) struct azx *chip = dev_id; struct azx_dev *azx_dev; u32 status; - int i; + int i, ok; spin_lock(&chip->reg_lock); @@ -991,18 +993,14 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); if (!azx_dev->substream || !azx_dev->running) continue; - /* ignore the first dummy IRQ (due to pos_adj) */ - if (azx_dev->irq_ignore) { - azx_dev->irq_ignore = 0; - continue; - } /* check whether this IRQ is really acceptable */ - if (azx_position_ok(chip, azx_dev)) { + ok = azx_position_ok(chip, azx_dev); + if (ok == 1) { azx_dev->irq_pending = 0; spin_unlock(&chip->reg_lock); snd_pcm_period_elapsed(azx_dev->substream); spin_lock(&chip->reg_lock); - } else if (chip->bus && chip->bus->workq) { + } else if (ok == 0 && chip->bus && chip->bus->workq) { /* bogus IRQ, process it later */ azx_dev->irq_pending = 1; queue_work(chip->bus->workq, @@ -1088,7 +1086,6 @@ static int azx_setup_periods(struct azx *chip, bdl = (u32 *)azx_dev->bdl.area; ofs = 0; azx_dev->frags = 0; - azx_dev->irq_ignore = 0; pos_adj = bdl_pos_adj[chip->dev_index]; if (pos_adj > 0) { struct snd_pcm_runtime *runtime = substream->runtime; @@ -1109,7 +1106,6 @@ static int azx_setup_periods(struct azx *chip, &bdl, ofs, pos_adj, 1); if (ofs < 0) goto error; - azx_dev->irq_ignore = 1; } } else pos_adj = 0; @@ -1155,6 +1151,9 @@ static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev) while (((val = azx_sd_readb(azx_dev, SD_CTL)) & SD_CTL_STREAM_RESET) && --timeout) ; + + /* reset first position - may not be synced with hw at this time */ + *azx_dev->posbuf = 0; } /* @@ -1409,7 +1408,6 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) snd_pcm_set_sync(substream); mutex_unlock(&chip->open_mutex); - azx_stream_reset(chip, azx_dev); return 0; } @@ -1474,6 +1472,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) unsigned int bufsize, period_bytes, format_val; int err; + azx_stream_reset(chip, azx_dev); format_val = snd_hda_calc_stream_format(runtime->rate, runtime->channels, runtime->format, @@ -1502,6 +1501,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) return err; } + azx_dev->min_jiffies = (runtime->period_size * HZ) / + (runtime->rate * 2); azx_setup_controller(chip, azx_dev); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; @@ -1518,13 +1519,14 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) struct azx *chip = apcm->chip; struct azx_dev *azx_dev; struct snd_pcm_substream *s; - int start, nsync = 0, sbits = 0; + int rstart = 0, start, nsync = 0, sbits = 0; int nwait, timeout; switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + rstart = 1; case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_RESUME: - case SNDRV_PCM_TRIGGER_START: start = 1; break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: @@ -1554,6 +1556,10 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) if (s->pcm->card != substream->pcm->card) continue; azx_dev = get_azx_dev(s); + if (rstart) { + azx_dev->start_flag = 1; + azx_dev->start_jiffies = jiffies + azx_dev->min_jiffies; + } if (start) azx_stream_start(chip, azx_dev); else @@ -1703,6 +1709,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) { unsigned int pos; + if (azx_dev->start_flag && + time_before_eq(jiffies, azx_dev->start_jiffies)) + return -1; /* bogus (too early) interrupt */ + azx_dev->start_flag = 0; + pos = azx_get_position(chip, azx_dev); if (chip->position_fix == POS_FIX_AUTO) { if (!pos) { -- cgit v1.2.3 From bbf6ad1399e9516b0a95de3ad58ffbaed670e4cc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 10 Apr 2009 12:28:58 +0200 Subject: [ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffies Some drivers like Intel8x0 or Intel HDA are broken for some hardware variants. This patch adds more strict buffer position checks based on jiffies when internal hw_ptr is updated. Enable xrun_debug to see mangling of wrong positions. As a side effect, the hw_ptr interrupt update routine might do slightly better job when many interrupts are lost. Signed-off-by: Jaroslav Kysela --- include/sound/pcm.h | 3 ++- sound/core/pcm_lib.c | 47 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 8904b1900d7f..c17296891617 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -268,7 +268,8 @@ struct snd_pcm_runtime { int overrange; snd_pcm_uframes_t avail_max; snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ - snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/ + snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ + unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ /* -- HW params -- */ snd_pcm_access_t access; /* access mode */ diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index fbb2e391591e..63d088f2265f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -209,9 +209,11 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_uframes_t pos; - snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt, hw_base; - snd_pcm_sframes_t delta; + snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_ptr_interrupt, hw_base; + snd_pcm_sframes_t hdelta, delta; + unsigned long jdelta; + old_hw_ptr = runtime->status->hw_ptr; pos = snd_pcm_update_hw_ptr_pos(substream, runtime); if (pos == SNDRV_PCM_POS_XRUN) { xrun(substream); @@ -247,7 +249,30 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) new_hw_ptr = hw_base + pos; } } - if (delta > runtime->period_size) { + hdelta = new_hw_ptr - old_hw_ptr; + jdelta = jiffies - runtime->hw_ptr_jiffies; + if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { + delta = jdelta / + (((runtime->period_size * HZ) / runtime->rate) + + HZ/100); + hw_ptr_error(substream, + "hw_ptr skipping! [Q] " + "(pos=%ld, delta=%ld, period=%ld, " + "jdelta=%lu/%lu/%lu)\n", + (long)pos, (long)hdelta, + (long)runtime->period_size, jdelta, + ((hdelta * HZ) / runtime->rate), delta); + hw_ptr_interrupt = runtime->hw_ptr_interrupt + + runtime->period_size * delta; + if (hw_ptr_interrupt >= runtime->boundary) + hw_ptr_interrupt -= runtime->boundary; + /* rebase to interrupt position */ + hw_base = new_hw_ptr = hw_ptr_interrupt; + /* align hw_base to buffer_size */ + hw_base -= hw_base % runtime->buffer_size; + delta = 0; + } + if (delta > runtime->period_size + runtime->period_size / 2) { hw_ptr_error(substream, "Lost interrupts? " "(stream=%i, delta=%ld, intr_ptr=%ld)\n", @@ -263,6 +288,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) runtime->hw_ptr_base = hw_base; runtime->status->hw_ptr = new_hw_ptr; + runtime->hw_ptr_jiffies = jiffies; runtime->hw_ptr_interrupt = hw_ptr_interrupt; return snd_pcm_update_hw_ptr_post(substream, runtime); @@ -275,6 +301,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) snd_pcm_uframes_t pos; snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_base; snd_pcm_sframes_t delta; + unsigned long jdelta; old_hw_ptr = runtime->status->hw_ptr; pos = snd_pcm_update_hw_ptr_pos(substream, runtime); @@ -286,14 +313,15 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) new_hw_ptr = hw_base + pos; delta = new_hw_ptr - old_hw_ptr; + jdelta = jiffies - runtime->hw_ptr_jiffies; if (delta < 0) { delta += runtime->buffer_size; if (delta < 0) { hw_ptr_error(substream, "Unexpected hw_pointer value [2] " - "(stream=%i, pos=%ld, old_ptr=%ld)\n", + "(stream=%i, pos=%ld, old_ptr=%ld, jdelta=%li)\n", substream->stream, (long)pos, - (long)old_hw_ptr); + (long)old_hw_ptr, jdelta); return 0; } hw_base += runtime->buffer_size; @@ -301,12 +329,13 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) hw_base = 0; new_hw_ptr = hw_base + pos; } - if (delta > runtime->period_size && runtime->periods > 1) { + if (((delta * HZ) / runtime->rate) > jdelta + HZ/100) { hw_ptr_error(substream, "hw_ptr skipping! " - "(pos=%ld, delta=%ld, period=%ld)\n", + "(pos=%ld, delta=%ld, period=%ld, jdelta=%lu/%lu)\n", (long)pos, (long)delta, - (long)runtime->period_size); + (long)runtime->period_size, jdelta, + ((delta * HZ) / runtime->rate)); return 0; } if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && @@ -315,6 +344,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) runtime->hw_ptr_base = hw_base; runtime->status->hw_ptr = new_hw_ptr; + runtime->hw_ptr_jiffies = jiffies; return snd_pcm_update_hw_ptr_post(substream, runtime); } @@ -1441,6 +1471,7 @@ static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream, runtime->status->hw_ptr %= runtime->buffer_size; else runtime->status->hw_ptr = 0; + runtime->hw_ptr_jiffies = jiffies; snd_pcm_stream_unlock_irqrestore(substream, flags); return 0; } -- cgit v1.2.3 From 920e4ae31cb113328e617f4a0663fb17d7b09124 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 13 Apr 2009 20:45:42 +0200 Subject: [ALSA] intel8x0: an attempt to make ac97_clock measurement more reliable - use monotonic posix clock to measure time - try to avoid reading zero from PICB (position in current buffer) register - show also measured samples - when clock is near 41000 or 44100, use exactly these values (they appears to be reference clocks for hardware manufacturers) Signed-off-by: Jaroslav Kysela --- sound/pci/intel8x0.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 57648810eaf1..c86ff499460b 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2661,8 +2661,9 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) struct snd_pcm_substream *subs; struct ichdev *ichdev; unsigned long port; - unsigned long pos, t; - struct timeval start_time, stop_time; + unsigned long pos, pos1, t; + int civ, timeout = 1000; + struct timespec start_time, stop_time; if (chip->ac97_bus->clock != 48000) return; /* specified in module option */ @@ -2693,16 +2694,27 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) iputbyte(chip, port + ICH_REG_OFF_CR, ICH_IOCE); iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); } - do_gettimeofday(&start_time); + do_posix_clock_monotonic_gettime(&start_time); spin_unlock_irq(&chip->reg_lock); msleep(50); spin_lock_irq(&chip->reg_lock); /* check the position */ + do { + civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); + pos1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); + if (pos1 == 0) { + udelay(10); + continue; + } + if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && + pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) + break; + } while (timeout--); pos = ichdev->fragsize1; - pos -= igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << ichdev->pos_shift; + pos -= pos1 << ichdev->pos_shift; pos += ichdev->position; chip->in_measurement = 0; - do_gettimeofday(&stop_time); + do_posix_clock_monotonic_gettime(&stop_time); /* stop */ if (chip->device_type == DEVICE_ALI) { iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); @@ -2717,19 +2729,26 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) iputbyte(chip, port + ICH_REG_OFF_CR, ICH_RESETREGS); spin_unlock_irq(&chip->reg_lock); + pos /= 4; t = stop_time.tv_sec - start_time.tv_sec; t *= 1000000; - t += stop_time.tv_usec - start_time.tv_usec; - printk(KERN_INFO "%s: measured %lu usecs\n", __func__, t); + t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000; + printk(KERN_INFO "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); if (t == 0) { - snd_printk(KERN_ERR "?? calculation error..\n"); + snd_printk(KERN_ERR "intel8x0: ?? calculation error..\n"); return; } - pos = (pos / 4) * 1000; + pos *= 1000; pos = (pos / t) * 1000 + ((pos % t) * 1000) / t; if (pos < 40000 || pos >= 60000) /* abnormal value. hw problem? */ printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos); + else if (pos > 40500 || pos < 41500) + /* first exception - 41000Hz reference clock */ + chip->ac97_bus->clock = 41000; + else if (pos > 43600 || pos < 44600) + /* second exception - 44100HZ reference clock */ + chip->ac97_bus->clock = 44100; else if (pos < 47500 || pos > 48500) /* not 48000Hz, tuning the clock.. */ chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; -- cgit v1.2.3 From da2436a23c038055b1da6fe30b6ea2886b1e07b0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 13 Apr 2009 21:31:25 +0200 Subject: [ALSA] intel8x0: do not use zero value from PICB register It seems that the zero value from the PICB (position in current buffer) register is not reliable. Use jiffies to correct returned value from the ring buffer pointer callback. Signed-off-by: Jaroslav Kysela --- sound/pci/intel8x0.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index c86ff499460b..6962f94d1bea 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -355,6 +355,9 @@ struct ichdev { unsigned int fragsize1; unsigned int position; unsigned int pos_shift; + unsigned int last_pos; + unsigned long last_pos_jiffies; + unsigned int jiffy_to_bytes; int frags; int lvi; int lvi_frag; @@ -838,7 +841,10 @@ static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd ichdev->suspended = 0; /* fallthru */ case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: val = ICH_IOCE | ICH_STARTBM; + ichdev->last_pos = ichdev->position; + ichdev->last_pos_jiffies = jiffies; break; case SNDRV_PCM_TRIGGER_SUSPEND: ichdev->suspended = 1; @@ -849,9 +855,6 @@ static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd case SNDRV_PCM_TRIGGER_PAUSE_PUSH: val = ICH_IOCE; break; - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - val = ICH_IOCE | ICH_STARTBM; - break; default: return -EINVAL; } @@ -1045,6 +1048,7 @@ static int snd_intel8x0_pcm_prepare(struct snd_pcm_substream *substream) ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; } snd_intel8x0_setup_periods(chip, ichdev); + ichdev->jiffy_to_bytes = (runtime->rate * 4 * ichdev->pos_shift) / HZ; return 0; } @@ -1053,7 +1057,7 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs struct intel8x0 *chip = snd_pcm_substream_chip(substream); struct ichdev *ichdev = get_ichdev(substream); size_t ptr1, ptr; - int civ, timeout = 100; + int civ, timeout = 10; unsigned int position; spin_lock(&chip->reg_lock); @@ -1069,9 +1073,19 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) break; } while (timeout--); - ptr1 <<= ichdev->pos_shift; - ptr = ichdev->fragsize1 - ptr1; - ptr += position; + if (ptr1 != 0) { + ptr1 <<= ichdev->pos_shift; + ptr = ichdev->fragsize1 - ptr1; + ptr += position; + ichdev->last_pos = ptr; + ichdev->last_pos_jiffies = jiffies; + } else { + ptr1 = jiffies - ichdev->last_pos_jiffies; + if (ptr1) + ptr1 -= 1; + ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes; + ptr %= ichdev->size; + } spin_unlock(&chip->reg_lock); if (ptr >= ichdev->size) return 0; @@ -2710,9 +2724,13 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) break; } while (timeout--); - pos = ichdev->fragsize1; - pos -= pos1 << ichdev->pos_shift; - pos += ichdev->position; + if (pos1 == 0) { /* oops, this value is not reliable */ + pos = 0; + } else { + pos = ichdev->fragsize1; + pos -= pos1 << ichdev->pos_shift; + pos += ichdev->position; + } chip->in_measurement = 0; do_posix_clock_monotonic_gettime(&stop_time); /* stop */ @@ -2729,6 +2747,11 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) iputbyte(chip, port + ICH_REG_OFF_CR, ICH_RESETREGS); spin_unlock_irq(&chip->reg_lock); + if (pos == 0) { + snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); + return; + } + pos /= 4; t = stop_time.tv_sec - start_time.tv_sec; t *= 1000000; -- cgit v1.2.3 From e930438c42e744ef1f8bfdbb338253c9f384df42 Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Mon, 13 Apr 2009 14:40:14 -0700 Subject: Replace all DMA_nBIT_MASK macro with DMA_BIT_MASK(n) This is the second go through of the old DMA_nBIT_MASK macro,and there're not so many of them left,so I put them into one patch.I hope this is the last round. After this the definition of the old DMA_nBIT_MASK macro could be removed. Signed-off-by: Yang Hongyang Cc: Russell King Cc: Tony Lindgren Cc: "David S. Miller" Cc: James Bottomley Cc: Greg KH Cc: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/arm/mach-omap2/usb-musb.c | 8 ++++---- arch/ia64/kernel/pci-swiotlb.c | 2 +- drivers/atm/solos-pci.c | 2 +- drivers/block/cciss.c | 2 +- drivers/net/atl1c/atl1c_main.c | 4 ++-- drivers/net/benet/be_main.c | 4 ++-- drivers/net/jme.c | 8 ++++---- drivers/net/wireless/ath9k/pci.c | 4 ++-- drivers/net/wireless/p54/p54pci.c | 4 ++-- drivers/scsi/3w-9xxx.c | 8 ++++---- drivers/scsi/aacraid/aachba.c | 2 +- drivers/scsi/mpt2sas/mpt2sas_base.c | 10 +++++----- drivers/staging/b3dfg/b3dfg.c | 2 +- drivers/usb/otg/nop-usb-xceiv.c | 4 ++-- sound/pci/hda/hda_intel.c | 8 ++++---- 15 files changed, 36 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index fc74e913c415..34a56a136efd 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c @@ -131,14 +131,14 @@ static struct musb_hdrc_platform_data musb_plat = { .power = 50, /* up to 100 mA */ }; -static u64 musb_dmamask = DMA_32BIT_MASK; +static u64 musb_dmamask = DMA_BIT_MASK(32); static struct platform_device musb_device = { .name = "musb_hdrc", .id = -1, .dev = { .dma_mask = &musb_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &musb_plat, }, .num_resources = ARRAY_SIZE(musb_resources), @@ -146,14 +146,14 @@ static struct platform_device musb_device = { }; #ifdef CONFIG_NOP_USB_XCEIV -static u64 nop_xceiv_dmamask = DMA_32BIT_MASK; +static u64 nop_xceiv_dmamask = DMA_BIT_MASK(32); static struct platform_device nop_xceiv_device = { .name = "nop_usb_xceiv", .id = -1, .dev = { .dma_mask = &nop_xceiv_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = NULL, }, }; diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c index 573f02c39a00..285aae8431c6 100644 --- a/arch/ia64/kernel/pci-swiotlb.c +++ b/arch/ia64/kernel/pci-swiotlb.c @@ -16,7 +16,7 @@ EXPORT_SYMBOL(swiotlb); static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp) { - if (dev->coherent_dma_mask != DMA_64BIT_MASK) + if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) gfp |= GFP_DMA; return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); } diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index be204308cc1b..9359613addc5 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -1059,7 +1059,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) goto out; } - err = pci_set_dma_mask(dev, DMA_32BIT_MASK); + err = pci_set_dma_mask(dev, DMA_BIT_MASK(32)); if (err) { dev_warn(&dev->dev, "Failed to set 32-bit DMA mask\n"); goto out; diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 0ef6f08aa6ea..4d4d5e0d3fa6 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -3505,7 +3505,7 @@ static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, u /* The Inbound Post Queue only accepts 32-bit physical addresses for the CCISS commands, so they must be allocated from the lower 4GiB of memory. */ - err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { iounmap(vaddr); return -ENOMEM; diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index deb7b53167ee..83a12125b94e 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c @@ -2532,8 +2532,8 @@ static int __devinit atl1c_probe(struct pci_dev *pdev, * various kernel subsystems to support the mechanics required by a * fixed-high-32-bit system. */ - if ((pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) || - (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) != 0)) { + if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) || + (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)) { dev_err(&pdev->dev, "No usable DMA configuration,aborting\n"); goto err_dma; } diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 9b75aa630062..30d0c81c989e 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c @@ -1821,11 +1821,11 @@ static int __devinit be_probe(struct pci_dev *pdev, be_msix_enable(adapter); - status = pci_set_dma_mask(pdev, DMA_64BIT_MASK); + status = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (!status) { netdev->features |= NETIF_F_HIGHDMA; } else { - status = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + status = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (status) { dev_err(&pdev->dev, "Could not set PCI DMA Mask\n"); goto free_netdev; diff --git a/drivers/net/jme.c b/drivers/net/jme.c index ece35040288c..621a7c0c46ba 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c @@ -2591,13 +2591,13 @@ static int jme_pci_dma64(struct pci_dev *pdev) { if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 && - !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) - if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) + !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) + if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) return 1; if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 && - !pci_set_dma_mask(pdev, DMA_40BIT_MASK)) - if (!pci_set_consistent_dma_mask(pdev, DMA_40BIT_MASK)) + !pci_set_dma_mask(pdev, DMA_BIT_MASK(40))) + if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40))) return 1; if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c index 6dbc58580abb..168411d322a2 100644 --- a/drivers/net/wireless/ath9k/pci.c +++ b/drivers/net/wireless/ath9k/pci.c @@ -93,14 +93,14 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (pci_enable_device(pdev)) return -EIO; - ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) { printk(KERN_ERR "ath9k: 32-bit DMA not available\n"); goto bad; } - ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) { printk(KERN_ERR "ath9k: 32-bit DMA consistent " diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index e3569a0a952d..b1610ea4bb3d 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c @@ -492,8 +492,8 @@ static int __devinit p54p_probe(struct pci_dev *pdev, goto err_disable_dev; } - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || - pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { dev_err(&pdev->dev, "No suitable DMA available\n"); goto err_free_reg; } diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index fdb14ec4fd47..8b7983aba8f7 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2234,10 +2234,10 @@ static int twa_resume(struct pci_dev *pdev) pci_set_master(pdev); pci_try_set_mwi(pdev); - if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) - || pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) - || pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) + || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) + || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); retval = -ENODEV; goto out_disable_device; diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 280261c451d6..2a889853a106 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1378,7 +1378,7 @@ int aac_get_adapter_info(struct aac_dev* dev) if (dev->nondasd_support && !dev->in_reset) printk(KERN_INFO "%s%d: Non-DASD support enabled.\n",dev->name, dev->id); - if (dma_get_required_mask(&dev->pdev->dev) > DMA_32BIT_MASK) + if (dma_get_required_mask(&dev->pdev->dev) > DMA_BIT_MASK(32)) dev->needs_dac = 1; dev->dac_support = 0; if ((sizeof(dma_addr_t) > 4) && dev->needs_dac && diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 52427a8324f5..a91f5143ceac 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -855,9 +855,9 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) if (sizeof(dma_addr_t) > 4) { const uint64_t required_mask = dma_get_required_mask(&pdev->dev); - if ((required_mask > DMA_32BIT_MASK) && !pci_set_dma_mask(pdev, - DMA_64BIT_MASK) && !pci_set_consistent_dma_mask(pdev, - DMA_64BIT_MASK)) { + if ((required_mask > DMA_BIT_MASK(32)) && !pci_set_dma_mask(pdev, + DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(pdev, + DMA_BIT_MASK(64))) { ioc->base_add_sg_single = &_base_add_sg_single_64; ioc->sge_size = sizeof(Mpi2SGESimple64_t); desc = "64"; @@ -865,8 +865,8 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) } } - if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK) - && !pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { + if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) + && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { ioc->base_add_sg_single = &_base_add_sg_single_32; ioc->sge_size = sizeof(Mpi2SGESimple32_t); desc = "32"; diff --git a/drivers/staging/b3dfg/b3dfg.c b/drivers/staging/b3dfg/b3dfg.c index 0348072b3ab5..75ebe338c6f2 100644 --- a/drivers/staging/b3dfg/b3dfg.c +++ b/drivers/staging/b3dfg/b3dfg.c @@ -1000,7 +1000,7 @@ static int __devinit b3dfg_probe(struct pci_dev *pdev, pci_set_master(pdev); - r = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + r = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (r) { dev_err(&pdev->dev, "no usable DMA configuration\n"); goto err_free_res; diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index 4b933f646f2e..c567168f89af 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c @@ -36,14 +36,14 @@ struct nop_usb_xceiv { struct device *dev; }; -static u64 nop_xceiv_dmamask = DMA_32BIT_MASK; +static u64 nop_xceiv_dmamask = DMA_BIT_MASK(32); static struct platform_device nop_xceiv_device = { .name = "nop_usb_xceiv", .id = -1, .dev = { .dma_mask = &nop_xceiv_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, + .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = NULL, }, }; diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 30829ee920c3..7ba8db5d4c42 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2260,11 +2260,11 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, gcap &= ~0x01; /* allow 64bit DMA address if supported by H/W */ - if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) - pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); + if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); else { - pci_set_dma_mask(pci, DMA_32BIT_MASK); - pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK); + pci_set_dma_mask(pci, DMA_BIT_MASK(32)); + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); } /* read number of streams from GCAP register instead of using -- cgit v1.2.3 From ef44a1ec6eeef189998f84e7230e1d3535b01074 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Fri, 10 Apr 2009 09:43:08 +0800 Subject: ALSA: sound/core: use memdup_user() Remove open-coded memdup_user(). Signed-off-by: Li Zefan Signed-off-by: Takashi Iwai --- sound/core/control.c | 35 +++++++---------- sound/core/pcm_compat.c | 11 ++---- sound/core/pcm_native.c | 93 +++++++++++++++++---------------------------- sound/core/seq/seq_compat.c | 9 ++--- sound/core/timer.c | 11 ++---- 5 files changed, 60 insertions(+), 99 deletions(-) (limited to 'sound') diff --git a/sound/core/control.c b/sound/core/control.c index 4b20fa2b7e6d..17b8d47a5cd0 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -723,14 +723,11 @@ static int snd_ctl_elem_read_user(struct snd_card *card, { struct snd_ctl_elem_value *control; int result; - - control = kmalloc(sizeof(*control), GFP_KERNEL); - if (control == NULL) - return -ENOMEM; - if (copy_from_user(control, _control, sizeof(*control))) { - kfree(control); - return -EFAULT; - } + + control = memdup_user(_control, sizeof(*control)); + if (IS_ERR(control)) + return PTR_ERR(control); + snd_power_lock(card); result = snd_power_wait(card, SNDRV_CTL_POWER_D0); if (result >= 0) @@ -784,13 +781,10 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file, struct snd_card *card; int result; - control = kmalloc(sizeof(*control), GFP_KERNEL); - if (control == NULL) - return -ENOMEM; - if (copy_from_user(control, _control, sizeof(*control))) { - kfree(control); - return -EFAULT; - } + control = memdup_user(_control, sizeof(*control)); + if (IS_ERR(control)) + return PTR_ERR(control); + card = file->card; snd_power_lock(card); result = snd_power_wait(card, SNDRV_CTL_POWER_D0); @@ -916,13 +910,10 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, if (op_flag > 0) { if (size > 1024 * 128) /* sane value */ return -EINVAL; - new_data = kmalloc(size, GFP_KERNEL); - if (new_data == NULL) - return -ENOMEM; - if (copy_from_user(new_data, tlv, size)) { - kfree(new_data); - return -EFAULT; - } + + new_data = memdup_user(tlv, size); + if (IS_ERR(new_data)) + return PTR_ERR(new_data); change = ue->tlv_data_size != size; if (!change) change = memcmp(ue->tlv_data, new_data, size); diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 36d7a5998234..08bfed594a83 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -232,14 +232,11 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, if (! (runtime = substream->runtime)) return -ENOTTY; - data = kmalloc(sizeof(*data), GFP_KERNEL); - if (data == NULL) - return -ENOMEM; /* only fifo_size is different, so just copy all */ - if (copy_from_user(data, data32, sizeof(*data32))) { - err = -EFAULT; - goto error; - } + data = memdup_user(data32, sizeof(*data32)); + if (IS_ERR(data)) + return PTR_ERR(data); + if (refine) err = snd_pcm_hw_refine(substream, data); else diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index a151fb01ba82..fc6f98e257df 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -327,21 +327,16 @@ static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params; int err; - params = kmalloc(sizeof(*params), GFP_KERNEL); - if (!params) { - err = -ENOMEM; - goto out; - } - if (copy_from_user(params, _params, sizeof(*params))) { - err = -EFAULT; - goto out; - } + params = memdup_user(_params, sizeof(*params)); + if (IS_ERR(params)) + return PTR_ERR(params); + err = snd_pcm_hw_refine(substream, params); if (copy_to_user(_params, params, sizeof(*params))) { if (!err) err = -EFAULT; } -out: + kfree(params); return err; } @@ -465,21 +460,16 @@ static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params; int err; - params = kmalloc(sizeof(*params), GFP_KERNEL); - if (!params) { - err = -ENOMEM; - goto out; - } - if (copy_from_user(params, _params, sizeof(*params))) { - err = -EFAULT; - goto out; - } + params = memdup_user(_params, sizeof(*params)); + if (IS_ERR(params)) + return PTR_ERR(params); + err = snd_pcm_hw_params(substream, params); if (copy_to_user(_params, params, sizeof(*params))) { if (!err) err = -EFAULT; } -out: + kfree(params); return err; } @@ -2593,13 +2583,11 @@ static int snd_pcm_playback_ioctl1(struct file *file, return -EFAULT; if (copy_from_user(&xfern, _xfern, sizeof(xfern))) return -EFAULT; - bufs = kmalloc(sizeof(void *) * runtime->channels, GFP_KERNEL); - if (bufs == NULL) - return -ENOMEM; - if (copy_from_user(bufs, xfern.bufs, sizeof(void *) * runtime->channels)) { - kfree(bufs); - return -EFAULT; - } + + bufs = memdup_user(xfern.bufs, + sizeof(void *) * runtime->channels); + if (IS_ERR(bufs)) + return PTR_ERR(bufs); result = snd_pcm_lib_writev(substream, bufs, xfern.frames); kfree(bufs); __put_user(result, &_xfern->result); @@ -2675,13 +2663,11 @@ static int snd_pcm_capture_ioctl1(struct file *file, return -EFAULT; if (copy_from_user(&xfern, _xfern, sizeof(xfern))) return -EFAULT; - bufs = kmalloc(sizeof(void *) * runtime->channels, GFP_KERNEL); - if (bufs == NULL) - return -ENOMEM; - if (copy_from_user(bufs, xfern.bufs, sizeof(void *) * runtime->channels)) { - kfree(bufs); - return -EFAULT; - } + + bufs = memdup_user(xfern.bufs, + sizeof(void *) * runtime->channels); + if (IS_ERR(bufs)) + return PTR_ERR(bufs); result = snd_pcm_lib_readv(substream, bufs, xfern.frames); kfree(bufs); __put_user(result, &_xfern->result); @@ -3312,18 +3298,12 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, int err; params = kmalloc(sizeof(*params), GFP_KERNEL); - if (!params) { - err = -ENOMEM; - goto out; - } - oparams = kmalloc(sizeof(*oparams), GFP_KERNEL); - if (!oparams) { - err = -ENOMEM; - goto out; - } + if (!params) + return -ENOMEM; - if (copy_from_user(oparams, _oparams, sizeof(*oparams))) { - err = -EFAULT; + oparams = memdup_user(_oparams, sizeof(*oparams)); + if (IS_ERR(oparams)) { + err = PTR_ERR(oparams); goto out; } snd_pcm_hw_convert_from_old_params(params, oparams); @@ -3333,9 +3313,10 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, if (!err) err = -EFAULT; } + + kfree(oparams); out: kfree(params); - kfree(oparams); return err; } @@ -3347,17 +3328,12 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, int err; params = kmalloc(sizeof(*params), GFP_KERNEL); - if (!params) { - err = -ENOMEM; - goto out; - } - oparams = kmalloc(sizeof(*oparams), GFP_KERNEL); - if (!oparams) { - err = -ENOMEM; - goto out; - } - if (copy_from_user(oparams, _oparams, sizeof(*oparams))) { - err = -EFAULT; + if (!params) + return -ENOMEM; + + oparams = memdup_user(_oparams, sizeof(*oparams)); + if (IS_ERR(oparams)) { + err = PTR_ERR(oparams); goto out; } snd_pcm_hw_convert_from_old_params(params, oparams); @@ -3367,9 +3343,10 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, if (!err) err = -EFAULT; } + + kfree(oparams); out: kfree(params); - kfree(oparams); return err; } #endif /* CONFIG_SND_SUPPORT_OLD_API */ diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c index 38693f47c262..c956fe462569 100644 --- a/sound/core/seq/seq_compat.c +++ b/sound/core/seq/seq_compat.c @@ -48,12 +48,11 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned struct snd_seq_port_info *data; mm_segment_t fs; - data = kmalloc(sizeof(*data), GFP_KERNEL); - if (! data) - return -ENOMEM; + data = memdup_user(data32, sizeof(*data32)); + if (IS_ERR(data)) + return PTR_ERR(data); - if (copy_from_user(data, data32, sizeof(*data32)) || - get_user(data->flags, &data32->flags) || + if (get_user(data->flags, &data32->flags) || get_user(data->time_queue, &data32->time_queue)) goto error; data->kernel = NULL; diff --git a/sound/core/timer.c b/sound/core/timer.c index 3f0050d0b71e..8f8b17ac074d 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1395,13 +1395,10 @@ static int snd_timer_user_ginfo(struct file *file, struct list_head *p; int err = 0; - ginfo = kmalloc(sizeof(*ginfo), GFP_KERNEL); - if (! ginfo) - return -ENOMEM; - if (copy_from_user(ginfo, _ginfo, sizeof(*ginfo))) { - kfree(ginfo); - return -EFAULT; - } + ginfo = memdup_user(_ginfo, sizeof(*ginfo)); + if (IS_ERR(ginfo)) + return PTR_ERR(ginfo); + tid = ginfo->tid; memset(ginfo, 0, sizeof(*ginfo)); ginfo->tid = tid; -- cgit v1.2.3 From 68425adcc419bfe90776f59e66b8c4cdb6e1b1f3 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Fri, 10 Apr 2009 09:43:36 +0800 Subject: ALSA: sound/isa: use memdup_user() Remove open-coded memdup_user(). Signed-off-by: Li Zefan Signed-off-by: Takashi Iwai --- sound/isa/sb/sb16_csp.c | 19 ++++++++++--------- sound/isa/wavefront/wavefront_fx.c | 14 +++++--------- sound/isa/wavefront/wavefront_synth.c | 11 +++++------ 3 files changed, 20 insertions(+), 24 deletions(-) (limited to 'sound') diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 49037d074c71..bdc8dde4e4a2 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -684,15 +684,16 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags) { - int err = -ENOMEM; - unsigned char *kbuf = kmalloc(size, GFP_KERNEL); - if (kbuf) { - if (copy_from_user(kbuf, buf, size)) - err = -EFAULT; - else - err = snd_sb_csp_load(p, kbuf, size, load_flags); - kfree(kbuf); - } + int err; + unsigned char *kbuf; + + kbuf = memdup_user(buf, size); + if (IS_ERR(kbuf)) + return PTR_ERR(kbuf); + + err = snd_sb_csp_load(p, kbuf, size, load_flags); + + kfree(kbuf); return err; } diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index dfc449a2194e..5e6870baa296 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -210,15 +210,11 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file, "> 512 bytes to FX\n"); return -EIO; } - page_data = kmalloc(r.data[2] * sizeof(short), GFP_KERNEL); - if (!page_data) - return -ENOMEM; - if (copy_from_user (page_data, - (unsigned char __user *) r.data[3], - r.data[2] * sizeof(short))) { - kfree(page_data); - return -EFAULT; - } + page_data = memdup_user((unsigned char __user *) + r.data[3], + r.data[2] * sizeof(short)); + if (IS_ERR(page_data)) + return PTR_ERR(page_data); pd = page_data; } diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index beb312cca75b..5d4ff48c4345 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -1664,12 +1664,11 @@ snd_wavefront_synth_ioctl (struct snd_hwdep *hw, struct file *file, break; case WFCTL_WFCMD: - wc = kmalloc(sizeof(*wc), GFP_KERNEL); - if (! wc) - return -ENOMEM; - if (copy_from_user (wc, argp, sizeof (*wc))) - err = -EFAULT; - else if (wavefront_synth_control (acard, wc) < 0) + wc = memdup_user(argp, sizeof(*wc)); + if (IS_ERR(wc)) + return PTR_ERR(wc); + + if (wavefront_synth_control (acard, wc) < 0) err = -EIO; else if (copy_to_user (argp, wc, sizeof (*wc))) err = -EFAULT; -- cgit v1.2.3 From 85385c1551d509e9e377b7be07ea0e755fb2c3ce Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Fri, 10 Apr 2009 09:43:59 +0800 Subject: ALSA: sound/usb: use memdup_user() Remove open-coded memdup_user(). Signed-off-by: Li Zefan Signed-off-by: Takashi Iwai --- sound/usb/usx2y/us122l.c | 10 +++------- sound/usb/usx2y/usX2Yhwdep.c | 13 ++++++------- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 98276aafefe6..012ff1f6f8af 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -349,14 +349,10 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS) return -ENOTTY; - cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); - if (!cfg) - return -ENOMEM; + cfg = memdup_user((void *)arg, sizeof(*cfg)); + if (IS_ERR(cfg)) + return PTR_ERR(cfg); - if (copy_from_user(cfg, (void *)arg, sizeof(*cfg))) { - err = -EFAULT; - goto free; - } if (cfg->version != USB_STREAM_INTERFACE_VERSION) { err = -ENXIO; goto free; diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 4af8740db717..f3d8f71265dd 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -203,13 +203,12 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { struct usb_device* dev = priv->chip.dev; - char *buf = kmalloc(dsp->length, GFP_KERNEL); - if (!buf) - return -ENOMEM; - if (copy_from_user(buf, dsp->image, dsp->length)) { - kfree(buf); - return -EFAULT; - } + char *buf; + + buf = memdup_user(dsp->image, dsp->length); + if (IS_ERR(buf)) + return PTR_ERR(buf); + err = usb_set_interface(dev, 0, 1); if (err) snd_printk(KERN_ERR "usb_set_interface error \n"); -- cgit v1.2.3 From 336500f0305dc1552e8d01a60b409a7db781ca28 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Fri, 10 Apr 2009 09:44:31 +0800 Subject: ALSA: sound/pci: use memdup_user() Remove open-coded memdup_user(). Signed-off-by: Li Zefan Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emufx.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 191e1cd9997d..4b302d86f5f2 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -2493,24 +2493,17 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un case SNDRV_EMU10K1_IOCTL_CODE_POKE: if (!capable(CAP_SYS_ADMIN)) return -EPERM; - icode = kmalloc(sizeof(*icode), GFP_KERNEL); - if (icode == NULL) - return -ENOMEM; - if (copy_from_user(icode, argp, sizeof(*icode))) { - kfree(icode); - return -EFAULT; - } + + icode = memdup_user(argp, sizeof(*icode)); + if (IS_ERR(icode)) + return PTR_ERR(icode); res = snd_emu10k1_icode_poke(emu, icode); kfree(icode); return res; case SNDRV_EMU10K1_IOCTL_CODE_PEEK: - icode = kmalloc(sizeof(*icode), GFP_KERNEL); - if (icode == NULL) - return -ENOMEM; - if (copy_from_user(icode, argp, sizeof(*icode))) { - kfree(icode); - return -EFAULT; - } + icode = memdup_user(argp, sizeof(*icode)); + if (IS_ERR(icode)) + return PTR_ERR(icode); res = snd_emu10k1_icode_peek(emu, icode); if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) { kfree(icode); @@ -2519,24 +2512,16 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un kfree(icode); return res; case SNDRV_EMU10K1_IOCTL_PCM_POKE: - ipcm = kmalloc(sizeof(*ipcm), GFP_KERNEL); - if (ipcm == NULL) - return -ENOMEM; - if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { - kfree(ipcm); - return -EFAULT; - } + ipcm = memdup_user(argp, sizeof(*ipcm)); + if (IS_ERR(ipcm)) + return PTR_ERR(ipcm); res = snd_emu10k1_ipcm_poke(emu, ipcm); kfree(ipcm); return res; case SNDRV_EMU10K1_IOCTL_PCM_PEEK: - ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL); - if (ipcm == NULL) - return -ENOMEM; - if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { - kfree(ipcm); - return -EFAULT; - } + ipcm = memdup_user(argp, sizeof(*ipcm)); + if (IS_ERR(ipcm)) + return PTR_ERR(ipcm); res = snd_emu10k1_ipcm_peek(emu, ipcm); if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) { kfree(ipcm); -- cgit v1.2.3 From e431cf45687d1ccb7c7d818defc2af34bd783db2 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Sat, 28 Mar 2009 21:19:49 +0100 Subject: ALSA: snd-usb-caiaq: clean up header includes Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/caiaq-audio.c | 8 +------- sound/usb/caiaq/caiaq-control.c | 6 +----- sound/usb/caiaq/caiaq-device.c | 13 +++---------- sound/usb/caiaq/caiaq-input.c | 6 ------ sound/usb/caiaq/caiaq-midi.c | 9 +-------- 5 files changed, 6 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index 08d51e0c9fea..cf3733110862 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -16,17 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include -#include -#include -#include #include -#include #include -#include #include -#include -#include #include "caiaq-device.h" #include "caiaq-audio.h" diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index e92c2bbf4fe9..bb21fcf0726e 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -18,14 +18,10 @@ */ #include -#include #include +#include #include -#include #include -#include -#include -#include #include "caiaq-device.h" #include "caiaq-control.h" diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index cf573a982fdc..89f8b68058e1 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -19,27 +19,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include #include #include +#include +#include #include -#include -#include -#include #include +#include #include -#include -#include #include "caiaq-device.h" #include "caiaq-audio.h" #include "caiaq-midi.h" #include "caiaq-control.h" - -#ifdef CONFIG_SND_USB_CAIAQ_INPUT #include "caiaq-input.h" -#endif MODULE_AUTHOR("Daniel Mack "); MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/caiaq-input.c index f743847a5e5a..4451775f82e6 100644 --- a/sound/usb/caiaq/caiaq-input.c +++ b/sound/usb/caiaq/caiaq-input.c @@ -17,14 +17,8 @@ */ #include -#include -#include -#include #include #include -#include -#include -#include #include #include "caiaq-device.h" #include "caiaq-input.h" diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c index f19fd360c936..79424c198912 100644 --- a/sound/usb/caiaq/caiaq-midi.c +++ b/sound/usb/caiaq/caiaq-midi.c @@ -16,21 +16,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include #include -#include -#include -#include #include +#include #include #include "caiaq-device.h" #include "caiaq-midi.h" - static int snd_usb_caiaq_midi_input_open(struct snd_rawmidi_substream *substream) { return 0; -- cgit v1.2.3 From 936e7d03394bc6238091db10d060326622c87ed7 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 1 Apr 2009 19:05:39 +0200 Subject: ALSA: snd-usb-caiaq: rename files to remove redundant information in file pathes Cleanup only, no functional change. Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/Makefile | 4 +- sound/usb/caiaq/audio.c | 700 ++++++++++++++++++++++++++++++++++++++++ sound/usb/caiaq/audio.h | 7 + sound/usb/caiaq/caiaq-audio.c | 700 ---------------------------------------- sound/usb/caiaq/caiaq-audio.h | 7 - sound/usb/caiaq/caiaq-control.c | 332 ------------------- sound/usb/caiaq/caiaq-control.h | 6 - sound/usb/caiaq/caiaq-device.c | 521 ------------------------------ sound/usb/caiaq/caiaq-device.h | 131 -------- sound/usb/caiaq/caiaq-input.c | 357 -------------------- sound/usb/caiaq/caiaq-input.h | 8 - sound/usb/caiaq/caiaq-midi.c | 173 ---------- sound/usb/caiaq/caiaq-midi.h | 8 - sound/usb/caiaq/control.c | 332 +++++++++++++++++++ sound/usb/caiaq/control.h | 6 + sound/usb/caiaq/device.c | 521 ++++++++++++++++++++++++++++++ sound/usb/caiaq/device.h | 131 ++++++++ sound/usb/caiaq/input.c | 358 ++++++++++++++++++++ sound/usb/caiaq/input.h | 8 + sound/usb/caiaq/midi.c | 173 ++++++++++ sound/usb/caiaq/midi.h | 8 + 21 files changed, 2246 insertions(+), 2245 deletions(-) create mode 100644 sound/usb/caiaq/audio.c create mode 100644 sound/usb/caiaq/audio.h delete mode 100644 sound/usb/caiaq/caiaq-audio.c delete mode 100644 sound/usb/caiaq/caiaq-audio.h delete mode 100644 sound/usb/caiaq/caiaq-control.c delete mode 100644 sound/usb/caiaq/caiaq-control.h delete mode 100644 sound/usb/caiaq/caiaq-device.c delete mode 100644 sound/usb/caiaq/caiaq-device.h delete mode 100644 sound/usb/caiaq/caiaq-input.c delete mode 100644 sound/usb/caiaq/caiaq-input.h delete mode 100644 sound/usb/caiaq/caiaq-midi.c delete mode 100644 sound/usb/caiaq/caiaq-midi.h create mode 100644 sound/usb/caiaq/control.c create mode 100644 sound/usb/caiaq/control.h create mode 100644 sound/usb/caiaq/device.c create mode 100644 sound/usb/caiaq/device.h create mode 100644 sound/usb/caiaq/input.c create mode 100644 sound/usb/caiaq/input.h create mode 100644 sound/usb/caiaq/midi.c create mode 100644 sound/usb/caiaq/midi.h (limited to 'sound') diff --git a/sound/usb/caiaq/Makefile b/sound/usb/caiaq/Makefile index 23dadd5a11cd..388999653aaa 100644 --- a/sound/usb/caiaq/Makefile +++ b/sound/usb/caiaq/Makefile @@ -1,4 +1,4 @@ -snd-usb-caiaq-y := caiaq-device.o caiaq-audio.o caiaq-midi.o caiaq-control.o -snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += caiaq-input.o +snd-usb-caiaq-y := device.o audio.o midi.o control.o +snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += input.o obj-$(CONFIG_SND_USB_CAIAQ) += snd-usb-caiaq.o diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c new file mode 100644 index 000000000000..3f45c0fe61ab --- /dev/null +++ b/sound/usb/caiaq/audio.c @@ -0,0 +1,700 @@ +/* + * Copyright (c) 2006-2008 Daniel Mack, Karsten Wiese + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include +#include + +#include "device.h" +#include "audio.h" + +#define N_URBS 32 +#define CLOCK_DRIFT_TOLERANCE 5 +#define FRAMES_PER_URB 8 +#define BYTES_PER_FRAME 512 +#define CHANNELS_PER_STREAM 2 +#define BYTES_PER_SAMPLE 3 +#define BYTES_PER_SAMPLE_USB 4 +#define MAX_BUFFER_SIZE (128*1024) +#define MAX_ENDPOINT_SIZE 512 + +#define ENDPOINT_CAPTURE 2 +#define ENDPOINT_PLAYBACK 6 + +#define MAKE_CHECKBYTE(dev,stream,i) \ + (stream << 1) | (~(i / (dev->n_streams * BYTES_PER_SAMPLE_USB)) & 1) + +static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER), + .formats = SNDRV_PCM_FMTBIT_S24_3BE, + .rates = (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_96000), + .rate_min = 44100, + .rate_max = 0, /* will overwrite later */ + .channels_min = CHANNELS_PER_STREAM, + .channels_max = CHANNELS_PER_STREAM, + .buffer_bytes_max = MAX_BUFFER_SIZE, + .period_bytes_min = 128, + .period_bytes_max = MAX_BUFFER_SIZE, + .periods_min = 1, + .periods_max = 1024, +}; + +static void +activate_substream(struct snd_usb_caiaqdev *dev, + struct snd_pcm_substream *sub) +{ + if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) + dev->sub_playback[sub->number] = sub; + else + dev->sub_capture[sub->number] = sub; +} + +static void +deactivate_substream(struct snd_usb_caiaqdev *dev, + struct snd_pcm_substream *sub) +{ + unsigned long flags; + spin_lock_irqsave(&dev->spinlock, flags); + + if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) + dev->sub_playback[sub->number] = NULL; + else + dev->sub_capture[sub->number] = NULL; + + spin_unlock_irqrestore(&dev->spinlock, flags); +} + +static int +all_substreams_zero(struct snd_pcm_substream **subs) +{ + int i; + for (i = 0; i < MAX_STREAMS; i++) + if (subs[i] != NULL) + return 0; + return 1; +} + +static int stream_start(struct snd_usb_caiaqdev *dev) +{ + int i, ret; + + debug("%s(%p)\n", __func__, dev); + + if (dev->streaming) + return -EINVAL; + + memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); + memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); + dev->input_panic = 0; + dev->output_panic = 0; + dev->first_packet = 1; + dev->streaming = 1; + dev->warned = 0; + + for (i = 0; i < N_URBS; i++) { + ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); + if (ret) { + log("unable to trigger read #%d! (ret %d)\n", i, ret); + dev->streaming = 0; + return -EPIPE; + } + } + + return 0; +} + +static void stream_stop(struct snd_usb_caiaqdev *dev) +{ + int i; + + debug("%s(%p)\n", __func__, dev); + if (!dev->streaming) + return; + + dev->streaming = 0; + + for (i = 0; i < N_URBS; i++) { + usb_kill_urb(dev->data_urbs_in[i]); + usb_kill_urb(dev->data_urbs_out[i]); + } +} + +static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream) +{ + struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); + debug("%s(%p)\n", __func__, substream); + substream->runtime->hw = dev->pcm_info; + snd_pcm_limit_hw_rates(substream->runtime); + return 0; +} + +static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream) +{ + struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); + + debug("%s(%p)\n", __func__, substream); + if (all_substreams_zero(dev->sub_playback) && + all_substreams_zero(dev->sub_capture)) { + /* when the last client has stopped streaming, + * all sample rates are allowed again */ + stream_stop(dev); + dev->pcm_info.rates = dev->samplerates; + } + + return 0; +} + +static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub, + struct snd_pcm_hw_params *hw_params) +{ + debug("%s(%p)\n", __func__, sub); + return snd_pcm_lib_malloc_pages(sub, params_buffer_bytes(hw_params)); +} + +static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) +{ + struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); + debug("%s(%p)\n", __func__, sub); + deactivate_substream(dev, sub); + return snd_pcm_lib_free_pages(sub); +} + +/* this should probably go upstream */ +#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12 +#error "Change this table" +#endif + +static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, + 48000, 64000, 88200, 96000, 176400, 192000 }; + +static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) +{ + int bytes_per_sample, bpp, ret, i; + int index = substream->number; + struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + + debug("%s(%p)\n", __func__, substream); + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1; + else + dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE; + + if (dev->streaming) + return 0; + + /* the first client that opens a stream defines the sample rate + * setting for all subsequent calls, until the last client closed. */ + for (i=0; i < ARRAY_SIZE(rates); i++) + if (runtime->rate == rates[i]) + dev->pcm_info.rates = 1 << i; + + snd_pcm_limit_hw_rates(runtime); + + bytes_per_sample = BYTES_PER_SAMPLE; + if (dev->spec.data_alignment == 2) + bytes_per_sample++; + + bpp = ((runtime->rate / 8000) + CLOCK_DRIFT_TOLERANCE) + * bytes_per_sample * CHANNELS_PER_STREAM * dev->n_streams; + + if (bpp > MAX_ENDPOINT_SIZE) + bpp = MAX_ENDPOINT_SIZE; + + ret = snd_usb_caiaq_set_audio_params(dev, runtime->rate, + runtime->sample_bits, bpp); + if (ret) + return ret; + + ret = stream_start(dev); + if (ret) + return ret; + + dev->output_running = 0; + wait_event_timeout(dev->prepare_wait_queue, dev->output_running, HZ); + if (!dev->output_running) { + stream_stop(dev); + return -EPIPE; + } + + return 0; +} + +static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream *sub, int cmd) +{ + struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + activate_substream(dev, sub); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + deactivate_substream(dev, sub); + break; + default: + return -EINVAL; + } + + return 0; +} + +static snd_pcm_uframes_t +snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) +{ + int index = sub->number; + struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); + + if (dev->input_panic || dev->output_panic) + return SNDRV_PCM_POS_XRUN; + + if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) + return bytes_to_frames(sub->runtime, + dev->audio_out_buf_pos[index]); + else + return bytes_to_frames(sub->runtime, + dev->audio_in_buf_pos[index]); +} + +/* operators for both playback and capture */ +static struct snd_pcm_ops snd_usb_caiaq_ops = { + .open = snd_usb_caiaq_substream_open, + .close = snd_usb_caiaq_substream_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_usb_caiaq_pcm_hw_params, + .hw_free = snd_usb_caiaq_pcm_hw_free, + .prepare = snd_usb_caiaq_pcm_prepare, + .trigger = snd_usb_caiaq_pcm_trigger, + .pointer = snd_usb_caiaq_pcm_pointer +}; + +static void check_for_elapsed_periods(struct snd_usb_caiaqdev *dev, + struct snd_pcm_substream **subs) +{ + int stream, pb, *cnt; + struct snd_pcm_substream *sub; + + for (stream = 0; stream < dev->n_streams; stream++) { + sub = subs[stream]; + if (!sub) + continue; + + pb = frames_to_bytes(sub->runtime, + sub->runtime->period_size); + cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? + &dev->period_out_count[stream] : + &dev->period_in_count[stream]; + + if (*cnt >= pb) { + snd_pcm_period_elapsed(sub); + *cnt %= pb; + } + } +} + +static void read_in_urb_mode0(struct snd_usb_caiaqdev *dev, + const struct urb *urb, + const struct usb_iso_packet_descriptor *iso) +{ + unsigned char *usb_buf = urb->transfer_buffer + iso->offset; + struct snd_pcm_substream *sub; + int stream, i; + + if (all_substreams_zero(dev->sub_capture)) + return; + + for (i = 0; i < iso->actual_length;) { + for (stream = 0; stream < dev->n_streams; stream++, i++) { + sub = dev->sub_capture[stream]; + if (sub) { + struct snd_pcm_runtime *rt = sub->runtime; + char *audio_buf = rt->dma_area; + int sz = frames_to_bytes(rt, rt->buffer_size); + audio_buf[dev->audio_in_buf_pos[stream]++] + = usb_buf[i]; + dev->period_in_count[stream]++; + if (dev->audio_in_buf_pos[stream] == sz) + dev->audio_in_buf_pos[stream] = 0; + } + } + } +} + +static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, + const struct urb *urb, + const struct usb_iso_packet_descriptor *iso) +{ + unsigned char *usb_buf = urb->transfer_buffer + iso->offset; + unsigned char check_byte; + struct snd_pcm_substream *sub; + int stream, i; + + for (i = 0; i < iso->actual_length;) { + if (i % (dev->n_streams * BYTES_PER_SAMPLE_USB) == 0) { + for (stream = 0; + stream < dev->n_streams; + stream++, i++) { + if (dev->first_packet) + continue; + + check_byte = MAKE_CHECKBYTE(dev, stream, i); + + if ((usb_buf[i] & 0x3f) != check_byte) + dev->input_panic = 1; + + if (usb_buf[i] & 0x80) + dev->output_panic = 1; + } + } + dev->first_packet = 0; + + for (stream = 0; stream < dev->n_streams; stream++, i++) { + sub = dev->sub_capture[stream]; + if (dev->input_panic) + usb_buf[i] = 0; + + if (sub) { + struct snd_pcm_runtime *rt = sub->runtime; + char *audio_buf = rt->dma_area; + int sz = frames_to_bytes(rt, rt->buffer_size); + audio_buf[dev->audio_in_buf_pos[stream]++] = + usb_buf[i]; + dev->period_in_count[stream]++; + if (dev->audio_in_buf_pos[stream] == sz) + dev->audio_in_buf_pos[stream] = 0; + } + } + } +} + +static void read_in_urb(struct snd_usb_caiaqdev *dev, + const struct urb *urb, + const struct usb_iso_packet_descriptor *iso) +{ + if (!dev->streaming) + return; + + if (iso->actual_length < dev->bpp) + return; + + switch (dev->spec.data_alignment) { + case 0: + read_in_urb_mode0(dev, urb, iso); + break; + case 2: + read_in_urb_mode2(dev, urb, iso); + break; + } + + if ((dev->input_panic || dev->output_panic) && !dev->warned) { + debug("streaming error detected %s %s\n", + dev->input_panic ? "(input)" : "", + dev->output_panic ? "(output)" : ""); + dev->warned = 1; + } +} + +static void fill_out_urb(struct snd_usb_caiaqdev *dev, + struct urb *urb, + const struct usb_iso_packet_descriptor *iso) +{ + unsigned char *usb_buf = urb->transfer_buffer + iso->offset; + struct snd_pcm_substream *sub; + int stream, i; + + for (i = 0; i < iso->length;) { + for (stream = 0; stream < dev->n_streams; stream++, i++) { + sub = dev->sub_playback[stream]; + if (sub) { + struct snd_pcm_runtime *rt = sub->runtime; + char *audio_buf = rt->dma_area; + int sz = frames_to_bytes(rt, rt->buffer_size); + usb_buf[i] = + audio_buf[dev->audio_out_buf_pos[stream]]; + dev->period_out_count[stream]++; + dev->audio_out_buf_pos[stream]++; + if (dev->audio_out_buf_pos[stream] == sz) + dev->audio_out_buf_pos[stream] = 0; + } else + usb_buf[i] = 0; + } + + /* fill in the check bytes */ + if (dev->spec.data_alignment == 2 && + i % (dev->n_streams * BYTES_PER_SAMPLE_USB) == + (dev->n_streams * CHANNELS_PER_STREAM)) + for (stream = 0; stream < dev->n_streams; stream++, i++) + usb_buf[i] = MAKE_CHECKBYTE(dev, stream, i); + } +} + +static void read_completed(struct urb *urb) +{ + struct snd_usb_caiaq_cb_info *info = urb->context; + struct snd_usb_caiaqdev *dev; + struct urb *out; + int frame, len, send_it = 0, outframe = 0; + + if (urb->status || !info) + return; + + dev = info->dev; + + if (!dev->streaming) + return; + + out = dev->data_urbs_out[info->index]; + + /* read the recently received packet and send back one which has + * the same layout */ + for (frame = 0; frame < FRAMES_PER_URB; frame++) { + if (urb->iso_frame_desc[frame].status) + continue; + + len = urb->iso_frame_desc[outframe].actual_length; + out->iso_frame_desc[outframe].length = len; + out->iso_frame_desc[outframe].actual_length = 0; + out->iso_frame_desc[outframe].offset = BYTES_PER_FRAME * frame; + + if (len > 0) { + spin_lock(&dev->spinlock); + fill_out_urb(dev, out, &out->iso_frame_desc[outframe]); + read_in_urb(dev, urb, &urb->iso_frame_desc[frame]); + spin_unlock(&dev->spinlock); + check_for_elapsed_periods(dev, dev->sub_playback); + check_for_elapsed_periods(dev, dev->sub_capture); + send_it = 1; + } + + outframe++; + } + + if (send_it) { + out->number_of_packets = FRAMES_PER_URB; + out->transfer_flags = URB_ISO_ASAP; + usb_submit_urb(out, GFP_ATOMIC); + } + + /* re-submit inbound urb */ + for (frame = 0; frame < FRAMES_PER_URB; frame++) { + urb->iso_frame_desc[frame].offset = BYTES_PER_FRAME * frame; + urb->iso_frame_desc[frame].length = BYTES_PER_FRAME; + urb->iso_frame_desc[frame].actual_length = 0; + } + + urb->number_of_packets = FRAMES_PER_URB; + urb->transfer_flags = URB_ISO_ASAP; + usb_submit_urb(urb, GFP_ATOMIC); +} + +static void write_completed(struct urb *urb) +{ + struct snd_usb_caiaq_cb_info *info = urb->context; + struct snd_usb_caiaqdev *dev = info->dev; + + if (!dev->output_running) { + dev->output_running = 1; + wake_up(&dev->prepare_wait_queue); + } +} + +static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret) +{ + int i, frame; + struct urb **urbs; + struct usb_device *usb_dev = dev->chip.dev; + unsigned int pipe; + + pipe = (dir == SNDRV_PCM_STREAM_PLAYBACK) ? + usb_sndisocpipe(usb_dev, ENDPOINT_PLAYBACK) : + usb_rcvisocpipe(usb_dev, ENDPOINT_CAPTURE); + + urbs = kmalloc(N_URBS * sizeof(*urbs), GFP_KERNEL); + if (!urbs) { + log("unable to kmalloc() urbs, OOM!?\n"); + *ret = -ENOMEM; + return NULL; + } + + for (i = 0; i < N_URBS; i++) { + urbs[i] = usb_alloc_urb(FRAMES_PER_URB, GFP_KERNEL); + if (!urbs[i]) { + log("unable to usb_alloc_urb(), OOM!?\n"); + *ret = -ENOMEM; + return urbs; + } + + urbs[i]->transfer_buffer = + kmalloc(FRAMES_PER_URB * BYTES_PER_FRAME, GFP_KERNEL); + if (!urbs[i]->transfer_buffer) { + log("unable to kmalloc() transfer buffer, OOM!?\n"); + *ret = -ENOMEM; + return urbs; + } + + for (frame = 0; frame < FRAMES_PER_URB; frame++) { + struct usb_iso_packet_descriptor *iso = + &urbs[i]->iso_frame_desc[frame]; + + iso->offset = BYTES_PER_FRAME * frame; + iso->length = BYTES_PER_FRAME; + } + + urbs[i]->dev = usb_dev; + urbs[i]->pipe = pipe; + urbs[i]->transfer_buffer_length = FRAMES_PER_URB + * BYTES_PER_FRAME; + urbs[i]->context = &dev->data_cb_info[i]; + urbs[i]->interval = 1; + urbs[i]->transfer_flags = URB_ISO_ASAP; + urbs[i]->number_of_packets = FRAMES_PER_URB; + urbs[i]->complete = (dir == SNDRV_PCM_STREAM_CAPTURE) ? + read_completed : write_completed; + } + + *ret = 0; + return urbs; +} + +static void free_urbs(struct urb **urbs) +{ + int i; + + if (!urbs) + return; + + for (i = 0; i < N_URBS; i++) { + if (!urbs[i]) + continue; + + usb_kill_urb(urbs[i]); + kfree(urbs[i]->transfer_buffer); + usb_free_urb(urbs[i]); + } + + kfree(urbs); +} + +int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) +{ + int i, ret; + + dev->n_audio_in = max(dev->spec.num_analog_audio_in, + dev->spec.num_digital_audio_in) / + CHANNELS_PER_STREAM; + dev->n_audio_out = max(dev->spec.num_analog_audio_out, + dev->spec.num_digital_audio_out) / + CHANNELS_PER_STREAM; + dev->n_streams = max(dev->n_audio_in, dev->n_audio_out); + + debug("dev->n_audio_in = %d\n", dev->n_audio_in); + debug("dev->n_audio_out = %d\n", dev->n_audio_out); + debug("dev->n_streams = %d\n", dev->n_streams); + + if (dev->n_streams > MAX_STREAMS) { + log("unable to initialize device, too many streams.\n"); + return -EINVAL; + } + + ret = snd_pcm_new(dev->chip.card, dev->product_name, 0, + dev->n_audio_out, dev->n_audio_in, &dev->pcm); + + if (ret < 0) { + log("snd_pcm_new() returned %d\n", ret); + return ret; + } + + dev->pcm->private_data = dev; + strcpy(dev->pcm->name, dev->product_name); + + memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); + memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); + + memcpy(&dev->pcm_info, &snd_usb_caiaq_pcm_hardware, + sizeof(snd_usb_caiaq_pcm_hardware)); + + /* setup samplerates */ + dev->samplerates = dev->pcm_info.rates; + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): + dev->samplerates |= SNDRV_PCM_RATE_192000; + /* fall thru */ + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): + dev->samplerates |= SNDRV_PCM_RATE_88200; + break; + } + + snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_PLAYBACK, + &snd_usb_caiaq_ops); + snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, + &snd_usb_caiaq_ops); + + snd_pcm_lib_preallocate_pages_for_all(dev->pcm, + SNDRV_DMA_TYPE_CONTINUOUS, + snd_dma_continuous_data(GFP_KERNEL), + MAX_BUFFER_SIZE, MAX_BUFFER_SIZE); + + dev->data_cb_info = + kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS, + GFP_KERNEL); + + if (!dev->data_cb_info) + return -ENOMEM; + + for (i = 0; i < N_URBS; i++) { + dev->data_cb_info[i].dev = dev; + dev->data_cb_info[i].index = i; + } + + dev->data_urbs_in = alloc_urbs(dev, SNDRV_PCM_STREAM_CAPTURE, &ret); + if (ret < 0) { + kfree(dev->data_cb_info); + free_urbs(dev->data_urbs_in); + return ret; + } + + dev->data_urbs_out = alloc_urbs(dev, SNDRV_PCM_STREAM_PLAYBACK, &ret); + if (ret < 0) { + kfree(dev->data_cb_info); + free_urbs(dev->data_urbs_in); + free_urbs(dev->data_urbs_out); + return ret; + } + + return 0; +} + +void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev) +{ + debug("%s(%p)\n", __func__, dev); + stream_stop(dev); + free_urbs(dev->data_urbs_in); + free_urbs(dev->data_urbs_out); + kfree(dev->data_cb_info); +} + diff --git a/sound/usb/caiaq/audio.h b/sound/usb/caiaq/audio.h new file mode 100644 index 000000000000..8ab1f8d9529e --- /dev/null +++ b/sound/usb/caiaq/audio.h @@ -0,0 +1,7 @@ +#ifndef CAIAQ_AUDIO_H +#define CAIAQ_AUDIO_H + +int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev); +void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev); + +#endif /* CAIAQ_AUDIO_H */ diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c deleted file mode 100644 index cf3733110862..000000000000 --- a/sound/usb/caiaq/caiaq-audio.c +++ /dev/null @@ -1,700 +0,0 @@ -/* - * Copyright (c) 2006-2008 Daniel Mack, Karsten Wiese - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include - -#include "caiaq-device.h" -#include "caiaq-audio.h" - -#define N_URBS 32 -#define CLOCK_DRIFT_TOLERANCE 5 -#define FRAMES_PER_URB 8 -#define BYTES_PER_FRAME 512 -#define CHANNELS_PER_STREAM 2 -#define BYTES_PER_SAMPLE 3 -#define BYTES_PER_SAMPLE_USB 4 -#define MAX_BUFFER_SIZE (128*1024) -#define MAX_ENDPOINT_SIZE 512 - -#define ENDPOINT_CAPTURE 2 -#define ENDPOINT_PLAYBACK 6 - -#define MAKE_CHECKBYTE(dev,stream,i) \ - (stream << 1) | (~(i / (dev->n_streams * BYTES_PER_SAMPLE_USB)) & 1) - -static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { - .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER), - .formats = SNDRV_PCM_FMTBIT_S24_3BE, - .rates = (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | - SNDRV_PCM_RATE_96000), - .rate_min = 44100, - .rate_max = 0, /* will overwrite later */ - .channels_min = CHANNELS_PER_STREAM, - .channels_max = CHANNELS_PER_STREAM, - .buffer_bytes_max = MAX_BUFFER_SIZE, - .period_bytes_min = 128, - .period_bytes_max = MAX_BUFFER_SIZE, - .periods_min = 1, - .periods_max = 1024, -}; - -static void -activate_substream(struct snd_usb_caiaqdev *dev, - struct snd_pcm_substream *sub) -{ - if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) - dev->sub_playback[sub->number] = sub; - else - dev->sub_capture[sub->number] = sub; -} - -static void -deactivate_substream(struct snd_usb_caiaqdev *dev, - struct snd_pcm_substream *sub) -{ - unsigned long flags; - spin_lock_irqsave(&dev->spinlock, flags); - - if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) - dev->sub_playback[sub->number] = NULL; - else - dev->sub_capture[sub->number] = NULL; - - spin_unlock_irqrestore(&dev->spinlock, flags); -} - -static int -all_substreams_zero(struct snd_pcm_substream **subs) -{ - int i; - for (i = 0; i < MAX_STREAMS; i++) - if (subs[i] != NULL) - return 0; - return 1; -} - -static int stream_start(struct snd_usb_caiaqdev *dev) -{ - int i, ret; - - debug("%s(%p)\n", __func__, dev); - - if (dev->streaming) - return -EINVAL; - - memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); - memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); - dev->input_panic = 0; - dev->output_panic = 0; - dev->first_packet = 1; - dev->streaming = 1; - dev->warned = 0; - - for (i = 0; i < N_URBS; i++) { - ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); - if (ret) { - log("unable to trigger read #%d! (ret %d)\n", i, ret); - dev->streaming = 0; - return -EPIPE; - } - } - - return 0; -} - -static void stream_stop(struct snd_usb_caiaqdev *dev) -{ - int i; - - debug("%s(%p)\n", __func__, dev); - if (!dev->streaming) - return; - - dev->streaming = 0; - - for (i = 0; i < N_URBS; i++) { - usb_kill_urb(dev->data_urbs_in[i]); - usb_kill_urb(dev->data_urbs_out[i]); - } -} - -static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream) -{ - struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); - debug("%s(%p)\n", __func__, substream); - substream->runtime->hw = dev->pcm_info; - snd_pcm_limit_hw_rates(substream->runtime); - return 0; -} - -static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream) -{ - struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); - - debug("%s(%p)\n", __func__, substream); - if (all_substreams_zero(dev->sub_playback) && - all_substreams_zero(dev->sub_capture)) { - /* when the last client has stopped streaming, - * all sample rates are allowed again */ - stream_stop(dev); - dev->pcm_info.rates = dev->samplerates; - } - - return 0; -} - -static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub, - struct snd_pcm_hw_params *hw_params) -{ - debug("%s(%p)\n", __func__, sub); - return snd_pcm_lib_malloc_pages(sub, params_buffer_bytes(hw_params)); -} - -static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) -{ - struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); - debug("%s(%p)\n", __func__, sub); - deactivate_substream(dev, sub); - return snd_pcm_lib_free_pages(sub); -} - -/* this should probably go upstream */ -#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12 -#error "Change this table" -#endif - -static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, - 48000, 64000, 88200, 96000, 176400, 192000 }; - -static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) -{ - int bytes_per_sample, bpp, ret, i; - int index = substream->number; - struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; - - debug("%s(%p)\n", __func__, substream); - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1; - else - dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE; - - if (dev->streaming) - return 0; - - /* the first client that opens a stream defines the sample rate - * setting for all subsequent calls, until the last client closed. */ - for (i=0; i < ARRAY_SIZE(rates); i++) - if (runtime->rate == rates[i]) - dev->pcm_info.rates = 1 << i; - - snd_pcm_limit_hw_rates(runtime); - - bytes_per_sample = BYTES_PER_SAMPLE; - if (dev->spec.data_alignment == 2) - bytes_per_sample++; - - bpp = ((runtime->rate / 8000) + CLOCK_DRIFT_TOLERANCE) - * bytes_per_sample * CHANNELS_PER_STREAM * dev->n_streams; - - if (bpp > MAX_ENDPOINT_SIZE) - bpp = MAX_ENDPOINT_SIZE; - - ret = snd_usb_caiaq_set_audio_params(dev, runtime->rate, - runtime->sample_bits, bpp); - if (ret) - return ret; - - ret = stream_start(dev); - if (ret) - return ret; - - dev->output_running = 0; - wait_event_timeout(dev->prepare_wait_queue, dev->output_running, HZ); - if (!dev->output_running) { - stream_stop(dev); - return -EPIPE; - } - - return 0; -} - -static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream *sub, int cmd) -{ - struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); - - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - activate_substream(dev, sub); - break; - case SNDRV_PCM_TRIGGER_STOP: - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - deactivate_substream(dev, sub); - break; - default: - return -EINVAL; - } - - return 0; -} - -static snd_pcm_uframes_t -snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) -{ - int index = sub->number; - struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); - - if (dev->input_panic || dev->output_panic) - return SNDRV_PCM_POS_XRUN; - - if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) - return bytes_to_frames(sub->runtime, - dev->audio_out_buf_pos[index]); - else - return bytes_to_frames(sub->runtime, - dev->audio_in_buf_pos[index]); -} - -/* operators for both playback and capture */ -static struct snd_pcm_ops snd_usb_caiaq_ops = { - .open = snd_usb_caiaq_substream_open, - .close = snd_usb_caiaq_substream_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_usb_caiaq_pcm_hw_params, - .hw_free = snd_usb_caiaq_pcm_hw_free, - .prepare = snd_usb_caiaq_pcm_prepare, - .trigger = snd_usb_caiaq_pcm_trigger, - .pointer = snd_usb_caiaq_pcm_pointer -}; - -static void check_for_elapsed_periods(struct snd_usb_caiaqdev *dev, - struct snd_pcm_substream **subs) -{ - int stream, pb, *cnt; - struct snd_pcm_substream *sub; - - for (stream = 0; stream < dev->n_streams; stream++) { - sub = subs[stream]; - if (!sub) - continue; - - pb = frames_to_bytes(sub->runtime, - sub->runtime->period_size); - cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? - &dev->period_out_count[stream] : - &dev->period_in_count[stream]; - - if (*cnt >= pb) { - snd_pcm_period_elapsed(sub); - *cnt %= pb; - } - } -} - -static void read_in_urb_mode0(struct snd_usb_caiaqdev *dev, - const struct urb *urb, - const struct usb_iso_packet_descriptor *iso) -{ - unsigned char *usb_buf = urb->transfer_buffer + iso->offset; - struct snd_pcm_substream *sub; - int stream, i; - - if (all_substreams_zero(dev->sub_capture)) - return; - - for (i = 0; i < iso->actual_length;) { - for (stream = 0; stream < dev->n_streams; stream++, i++) { - sub = dev->sub_capture[stream]; - if (sub) { - struct snd_pcm_runtime *rt = sub->runtime; - char *audio_buf = rt->dma_area; - int sz = frames_to_bytes(rt, rt->buffer_size); - audio_buf[dev->audio_in_buf_pos[stream]++] - = usb_buf[i]; - dev->period_in_count[stream]++; - if (dev->audio_in_buf_pos[stream] == sz) - dev->audio_in_buf_pos[stream] = 0; - } - } - } -} - -static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, - const struct urb *urb, - const struct usb_iso_packet_descriptor *iso) -{ - unsigned char *usb_buf = urb->transfer_buffer + iso->offset; - unsigned char check_byte; - struct snd_pcm_substream *sub; - int stream, i; - - for (i = 0; i < iso->actual_length;) { - if (i % (dev->n_streams * BYTES_PER_SAMPLE_USB) == 0) { - for (stream = 0; - stream < dev->n_streams; - stream++, i++) { - if (dev->first_packet) - continue; - - check_byte = MAKE_CHECKBYTE(dev, stream, i); - - if ((usb_buf[i] & 0x3f) != check_byte) - dev->input_panic = 1; - - if (usb_buf[i] & 0x80) - dev->output_panic = 1; - } - } - dev->first_packet = 0; - - for (stream = 0; stream < dev->n_streams; stream++, i++) { - sub = dev->sub_capture[stream]; - if (dev->input_panic) - usb_buf[i] = 0; - - if (sub) { - struct snd_pcm_runtime *rt = sub->runtime; - char *audio_buf = rt->dma_area; - int sz = frames_to_bytes(rt, rt->buffer_size); - audio_buf[dev->audio_in_buf_pos[stream]++] = - usb_buf[i]; - dev->period_in_count[stream]++; - if (dev->audio_in_buf_pos[stream] == sz) - dev->audio_in_buf_pos[stream] = 0; - } - } - } -} - -static void read_in_urb(struct snd_usb_caiaqdev *dev, - const struct urb *urb, - const struct usb_iso_packet_descriptor *iso) -{ - if (!dev->streaming) - return; - - if (iso->actual_length < dev->bpp) - return; - - switch (dev->spec.data_alignment) { - case 0: - read_in_urb_mode0(dev, urb, iso); - break; - case 2: - read_in_urb_mode2(dev, urb, iso); - break; - } - - if ((dev->input_panic || dev->output_panic) && !dev->warned) { - debug("streaming error detected %s %s\n", - dev->input_panic ? "(input)" : "", - dev->output_panic ? "(output)" : ""); - dev->warned = 1; - } -} - -static void fill_out_urb(struct snd_usb_caiaqdev *dev, - struct urb *urb, - const struct usb_iso_packet_descriptor *iso) -{ - unsigned char *usb_buf = urb->transfer_buffer + iso->offset; - struct snd_pcm_substream *sub; - int stream, i; - - for (i = 0; i < iso->length;) { - for (stream = 0; stream < dev->n_streams; stream++, i++) { - sub = dev->sub_playback[stream]; - if (sub) { - struct snd_pcm_runtime *rt = sub->runtime; - char *audio_buf = rt->dma_area; - int sz = frames_to_bytes(rt, rt->buffer_size); - usb_buf[i] = - audio_buf[dev->audio_out_buf_pos[stream]]; - dev->period_out_count[stream]++; - dev->audio_out_buf_pos[stream]++; - if (dev->audio_out_buf_pos[stream] == sz) - dev->audio_out_buf_pos[stream] = 0; - } else - usb_buf[i] = 0; - } - - /* fill in the check bytes */ - if (dev->spec.data_alignment == 2 && - i % (dev->n_streams * BYTES_PER_SAMPLE_USB) == - (dev->n_streams * CHANNELS_PER_STREAM)) - for (stream = 0; stream < dev->n_streams; stream++, i++) - usb_buf[i] = MAKE_CHECKBYTE(dev, stream, i); - } -} - -static void read_completed(struct urb *urb) -{ - struct snd_usb_caiaq_cb_info *info = urb->context; - struct snd_usb_caiaqdev *dev; - struct urb *out; - int frame, len, send_it = 0, outframe = 0; - - if (urb->status || !info) - return; - - dev = info->dev; - - if (!dev->streaming) - return; - - out = dev->data_urbs_out[info->index]; - - /* read the recently received packet and send back one which has - * the same layout */ - for (frame = 0; frame < FRAMES_PER_URB; frame++) { - if (urb->iso_frame_desc[frame].status) - continue; - - len = urb->iso_frame_desc[outframe].actual_length; - out->iso_frame_desc[outframe].length = len; - out->iso_frame_desc[outframe].actual_length = 0; - out->iso_frame_desc[outframe].offset = BYTES_PER_FRAME * frame; - - if (len > 0) { - spin_lock(&dev->spinlock); - fill_out_urb(dev, out, &out->iso_frame_desc[outframe]); - read_in_urb(dev, urb, &urb->iso_frame_desc[frame]); - spin_unlock(&dev->spinlock); - check_for_elapsed_periods(dev, dev->sub_playback); - check_for_elapsed_periods(dev, dev->sub_capture); - send_it = 1; - } - - outframe++; - } - - if (send_it) { - out->number_of_packets = FRAMES_PER_URB; - out->transfer_flags = URB_ISO_ASAP; - usb_submit_urb(out, GFP_ATOMIC); - } - - /* re-submit inbound urb */ - for (frame = 0; frame < FRAMES_PER_URB; frame++) { - urb->iso_frame_desc[frame].offset = BYTES_PER_FRAME * frame; - urb->iso_frame_desc[frame].length = BYTES_PER_FRAME; - urb->iso_frame_desc[frame].actual_length = 0; - } - - urb->number_of_packets = FRAMES_PER_URB; - urb->transfer_flags = URB_ISO_ASAP; - usb_submit_urb(urb, GFP_ATOMIC); -} - -static void write_completed(struct urb *urb) -{ - struct snd_usb_caiaq_cb_info *info = urb->context; - struct snd_usb_caiaqdev *dev = info->dev; - - if (!dev->output_running) { - dev->output_running = 1; - wake_up(&dev->prepare_wait_queue); - } -} - -static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret) -{ - int i, frame; - struct urb **urbs; - struct usb_device *usb_dev = dev->chip.dev; - unsigned int pipe; - - pipe = (dir == SNDRV_PCM_STREAM_PLAYBACK) ? - usb_sndisocpipe(usb_dev, ENDPOINT_PLAYBACK) : - usb_rcvisocpipe(usb_dev, ENDPOINT_CAPTURE); - - urbs = kmalloc(N_URBS * sizeof(*urbs), GFP_KERNEL); - if (!urbs) { - log("unable to kmalloc() urbs, OOM!?\n"); - *ret = -ENOMEM; - return NULL; - } - - for (i = 0; i < N_URBS; i++) { - urbs[i] = usb_alloc_urb(FRAMES_PER_URB, GFP_KERNEL); - if (!urbs[i]) { - log("unable to usb_alloc_urb(), OOM!?\n"); - *ret = -ENOMEM; - return urbs; - } - - urbs[i]->transfer_buffer = - kmalloc(FRAMES_PER_URB * BYTES_PER_FRAME, GFP_KERNEL); - if (!urbs[i]->transfer_buffer) { - log("unable to kmalloc() transfer buffer, OOM!?\n"); - *ret = -ENOMEM; - return urbs; - } - - for (frame = 0; frame < FRAMES_PER_URB; frame++) { - struct usb_iso_packet_descriptor *iso = - &urbs[i]->iso_frame_desc[frame]; - - iso->offset = BYTES_PER_FRAME * frame; - iso->length = BYTES_PER_FRAME; - } - - urbs[i]->dev = usb_dev; - urbs[i]->pipe = pipe; - urbs[i]->transfer_buffer_length = FRAMES_PER_URB - * BYTES_PER_FRAME; - urbs[i]->context = &dev->data_cb_info[i]; - urbs[i]->interval = 1; - urbs[i]->transfer_flags = URB_ISO_ASAP; - urbs[i]->number_of_packets = FRAMES_PER_URB; - urbs[i]->complete = (dir == SNDRV_PCM_STREAM_CAPTURE) ? - read_completed : write_completed; - } - - *ret = 0; - return urbs; -} - -static void free_urbs(struct urb **urbs) -{ - int i; - - if (!urbs) - return; - - for (i = 0; i < N_URBS; i++) { - if (!urbs[i]) - continue; - - usb_kill_urb(urbs[i]); - kfree(urbs[i]->transfer_buffer); - usb_free_urb(urbs[i]); - } - - kfree(urbs); -} - -int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) -{ - int i, ret; - - dev->n_audio_in = max(dev->spec.num_analog_audio_in, - dev->spec.num_digital_audio_in) / - CHANNELS_PER_STREAM; - dev->n_audio_out = max(dev->spec.num_analog_audio_out, - dev->spec.num_digital_audio_out) / - CHANNELS_PER_STREAM; - dev->n_streams = max(dev->n_audio_in, dev->n_audio_out); - - debug("dev->n_audio_in = %d\n", dev->n_audio_in); - debug("dev->n_audio_out = %d\n", dev->n_audio_out); - debug("dev->n_streams = %d\n", dev->n_streams); - - if (dev->n_streams > MAX_STREAMS) { - log("unable to initialize device, too many streams.\n"); - return -EINVAL; - } - - ret = snd_pcm_new(dev->chip.card, dev->product_name, 0, - dev->n_audio_out, dev->n_audio_in, &dev->pcm); - - if (ret < 0) { - log("snd_pcm_new() returned %d\n", ret); - return ret; - } - - dev->pcm->private_data = dev; - strcpy(dev->pcm->name, dev->product_name); - - memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); - memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); - - memcpy(&dev->pcm_info, &snd_usb_caiaq_pcm_hardware, - sizeof(snd_usb_caiaq_pcm_hardware)); - - /* setup samplerates */ - dev->samplerates = dev->pcm_info.rates; - switch (dev->chip.usb_id) { - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): - dev->samplerates |= SNDRV_PCM_RATE_192000; - /* fall thru */ - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): - dev->samplerates |= SNDRV_PCM_RATE_88200; - break; - } - - snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_PLAYBACK, - &snd_usb_caiaq_ops); - snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, - &snd_usb_caiaq_ops); - - snd_pcm_lib_preallocate_pages_for_all(dev->pcm, - SNDRV_DMA_TYPE_CONTINUOUS, - snd_dma_continuous_data(GFP_KERNEL), - MAX_BUFFER_SIZE, MAX_BUFFER_SIZE); - - dev->data_cb_info = - kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS, - GFP_KERNEL); - - if (!dev->data_cb_info) - return -ENOMEM; - - for (i = 0; i < N_URBS; i++) { - dev->data_cb_info[i].dev = dev; - dev->data_cb_info[i].index = i; - } - - dev->data_urbs_in = alloc_urbs(dev, SNDRV_PCM_STREAM_CAPTURE, &ret); - if (ret < 0) { - kfree(dev->data_cb_info); - free_urbs(dev->data_urbs_in); - return ret; - } - - dev->data_urbs_out = alloc_urbs(dev, SNDRV_PCM_STREAM_PLAYBACK, &ret); - if (ret < 0) { - kfree(dev->data_cb_info); - free_urbs(dev->data_urbs_in); - free_urbs(dev->data_urbs_out); - return ret; - } - - return 0; -} - -void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev) -{ - debug("%s(%p)\n", __func__, dev); - stream_stop(dev); - free_urbs(dev->data_urbs_in); - free_urbs(dev->data_urbs_out); - kfree(dev->data_cb_info); -} - diff --git a/sound/usb/caiaq/caiaq-audio.h b/sound/usb/caiaq/caiaq-audio.h deleted file mode 100644 index 8ab1f8d9529e..000000000000 --- a/sound/usb/caiaq/caiaq-audio.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CAIAQ_AUDIO_H -#define CAIAQ_AUDIO_H - -int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev); -void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev); - -#endif /* CAIAQ_AUDIO_H */ diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c deleted file mode 100644 index bb21fcf0726e..000000000000 --- a/sound/usb/caiaq/caiaq-control.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) 2007 Daniel Mack - * friendly supported by NI. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include - -#include "caiaq-device.h" -#include "caiaq-control.h" - -#define CNT_INTVAL 0x10000 - -static int control_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); - struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); - int pos = kcontrol->private_value; - int is_intval = pos & CNT_INTVAL; - unsigned int id = dev->chip.usb_id; - - uinfo->count = 1; - pos &= ~CNT_INTVAL; - - if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) - && (pos == 0)) { - /* current input mode of A8DJ */ - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = 2; - return 0; - } - - if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ) - && (pos == 0)) { - /* current input mode of A4DJ */ - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = 1; - return 0; - } - - if (is_intval) { - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = 64; - } else { - uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = 1; - } - - return 0; -} - -static int control_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); - struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); - int pos = kcontrol->private_value; - - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { - /* A4DJ has only one control */ - /* do not expose hardware input mode 0 */ - ucontrol->value.integer.value[0] = dev->control_state[0] - 1; - return 0; - } - - if (pos & CNT_INTVAL) - ucontrol->value.integer.value[0] - = dev->control_state[pos & ~CNT_INTVAL]; - else - ucontrol->value.integer.value[0] - = !!(dev->control_state[pos / 8] & (1 << pos % 8)); - - return 0; -} - -static int control_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); - struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); - int pos = kcontrol->private_value; - - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { - /* A4DJ has only one control */ - /* do not expose hardware input mode 0 */ - dev->control_state[0] = ucontrol->value.integer.value[0] + 1; - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, - dev->control_state, sizeof(dev->control_state)); - return 1; - } - - if (pos & CNT_INTVAL) { - dev->control_state[pos & ~CNT_INTVAL] - = ucontrol->value.integer.value[0]; - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, - dev->control_state, sizeof(dev->control_state)); - } else { - if (ucontrol->value.integer.value[0]) - dev->control_state[pos / 8] |= 1 << (pos % 8); - else - dev->control_state[pos / 8] &= ~(1 << (pos % 8)); - - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, - dev->control_state, sizeof(dev->control_state)); - } - - return 1; -} - -static struct snd_kcontrol_new kcontrol_template __devinitdata = { - .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, - .index = 0, - .info = control_info, - .get = control_get, - .put = control_put, - /* name and private_value filled later */ -}; - -struct caiaq_controller { - char *name; - int index; -}; - -static struct caiaq_controller ak1_controller[] = { - { "LED left", 2 }, - { "LED middle", 1 }, - { "LED right", 0 }, - { "LED ring", 3 } -}; - -static struct caiaq_controller rk2_controller[] = { - { "LED 1", 5 }, - { "LED 2", 4 }, - { "LED 3", 3 }, - { "LED 4", 2 }, - { "LED 5", 1 }, - { "LED 6", 0 }, - { "LED pedal", 6 }, - { "LED 7seg_1b", 8 }, - { "LED 7seg_1c", 9 }, - { "LED 7seg_2a", 10 }, - { "LED 7seg_2b", 11 }, - { "LED 7seg_2c", 12 }, - { "LED 7seg_2d", 13 }, - { "LED 7seg_2e", 14 }, - { "LED 7seg_2f", 15 }, - { "LED 7seg_2g", 16 }, - { "LED 7seg_3a", 17 }, - { "LED 7seg_3b", 18 }, - { "LED 7seg_3c", 19 }, - { "LED 7seg_3d", 20 }, - { "LED 7seg_3e", 21 }, - { "LED 7seg_3f", 22 }, - { "LED 7seg_3g", 23 } -}; - -static struct caiaq_controller rk3_controller[] = { - { "LED 7seg_1a", 0 + 0 }, - { "LED 7seg_1b", 0 + 1 }, - { "LED 7seg_1c", 0 + 2 }, - { "LED 7seg_1d", 0 + 3 }, - { "LED 7seg_1e", 0 + 4 }, - { "LED 7seg_1f", 0 + 5 }, - { "LED 7seg_1g", 0 + 6 }, - { "LED 7seg_1p", 0 + 7 }, - - { "LED 7seg_2a", 8 + 0 }, - { "LED 7seg_2b", 8 + 1 }, - { "LED 7seg_2c", 8 + 2 }, - { "LED 7seg_2d", 8 + 3 }, - { "LED 7seg_2e", 8 + 4 }, - { "LED 7seg_2f", 8 + 5 }, - { "LED 7seg_2g", 8 + 6 }, - { "LED 7seg_2p", 8 + 7 }, - - { "LED 7seg_3a", 16 + 0 }, - { "LED 7seg_3b", 16 + 1 }, - { "LED 7seg_3c", 16 + 2 }, - { "LED 7seg_3d", 16 + 3 }, - { "LED 7seg_3e", 16 + 4 }, - { "LED 7seg_3f", 16 + 5 }, - { "LED 7seg_3g", 16 + 6 }, - { "LED 7seg_3p", 16 + 7 }, - - { "LED 7seg_4a", 24 + 0 }, - { "LED 7seg_4b", 24 + 1 }, - { "LED 7seg_4c", 24 + 2 }, - { "LED 7seg_4d", 24 + 3 }, - { "LED 7seg_4e", 24 + 4 }, - { "LED 7seg_4f", 24 + 5 }, - { "LED 7seg_4g", 24 + 6 }, - { "LED 7seg_4p", 24 + 7 }, - - { "LED 1", 32 + 0 }, - { "LED 2", 32 + 1 }, - { "LED 3", 32 + 2 }, - { "LED 4", 32 + 3 }, - { "LED 5", 32 + 4 }, - { "LED 6", 32 + 5 }, - { "LED 7", 32 + 6 }, - { "LED 8", 32 + 7 }, - { "LED pedal", 32 + 8 } -}; - -static struct caiaq_controller kore_controller[] = { - { "LED F1", 8 | CNT_INTVAL }, - { "LED F2", 12 | CNT_INTVAL }, - { "LED F3", 0 | CNT_INTVAL }, - { "LED F4", 4 | CNT_INTVAL }, - { "LED F5", 11 | CNT_INTVAL }, - { "LED F6", 15 | CNT_INTVAL }, - { "LED F7", 3 | CNT_INTVAL }, - { "LED F8", 7 | CNT_INTVAL }, - { "LED touch1", 10 | CNT_INTVAL }, - { "LED touch2", 14 | CNT_INTVAL }, - { "LED touch3", 2 | CNT_INTVAL }, - { "LED touch4", 6 | CNT_INTVAL }, - { "LED touch5", 9 | CNT_INTVAL }, - { "LED touch6", 13 | CNT_INTVAL }, - { "LED touch7", 1 | CNT_INTVAL }, - { "LED touch8", 5 | CNT_INTVAL }, - { "LED left", 18 | CNT_INTVAL }, - { "LED right", 22 | CNT_INTVAL }, - { "LED up", 16 | CNT_INTVAL }, - { "LED down", 20 | CNT_INTVAL }, - { "LED stop", 23 | CNT_INTVAL }, - { "LED play", 21 | CNT_INTVAL }, - { "LED record", 19 | CNT_INTVAL }, - { "LED listen", 17 | CNT_INTVAL }, - { "LED lcd", 30 | CNT_INTVAL }, - { "LED menu", 28 | CNT_INTVAL }, - { "LED sound", 31 | CNT_INTVAL }, - { "LED esc", 29 | CNT_INTVAL }, - { "LED view", 27 | CNT_INTVAL }, - { "LED enter", 24 | CNT_INTVAL }, - { "LED control", 26 | CNT_INTVAL } -}; - -static struct caiaq_controller a8dj_controller[] = { - { "Current input mode", 0 | CNT_INTVAL }, - { "GND lift for TC Vinyl mode", 24 + 0 }, - { "GND lift for TC CD/Line mode", 24 + 1 }, - { "GND lift for phono mode", 24 + 2 }, - { "Software lock", 40 } -}; - -static struct caiaq_controller a4dj_controller[] = { - { "Current input mode", 0 | CNT_INTVAL } -}; - -static int __devinit add_controls(struct caiaq_controller *c, int num, - struct snd_usb_caiaqdev *dev) -{ - int i, ret; - struct snd_kcontrol *kc; - - for (i = 0; i < num; i++, c++) { - kcontrol_template.name = c->name; - kcontrol_template.private_value = c->index; - kc = snd_ctl_new1(&kcontrol_template, dev); - ret = snd_ctl_add(dev->chip.card, kc); - if (ret < 0) - return ret; - } - - return 0; -} - -int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) -{ - int ret = 0; - - switch (dev->chip.usb_id) { - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): - ret = add_controls(ak1_controller, - ARRAY_SIZE(ak1_controller), dev); - break; - - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): - ret = add_controls(rk2_controller, - ARRAY_SIZE(rk2_controller), dev); - break; - - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): - ret = add_controls(rk3_controller, - ARRAY_SIZE(rk3_controller), dev); - break; - - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): - ret = add_controls(kore_controller, - ARRAY_SIZE(kore_controller), dev); - break; - - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): - ret = add_controls(a8dj_controller, - ARRAY_SIZE(a8dj_controller), dev); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): - ret = add_controls(a4dj_controller, - ARRAY_SIZE(a4dj_controller), dev); - break; - } - - return ret; -} - diff --git a/sound/usb/caiaq/caiaq-control.h b/sound/usb/caiaq/caiaq-control.h deleted file mode 100644 index 2e7ab1aa4fb3..000000000000 --- a/sound/usb/caiaq/caiaq-control.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CAIAQ_CONTROL_H -#define CAIAQ_CONTROL_H - -int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev); - -#endif /* CAIAQ_CONTROL_H */ diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c deleted file mode 100644 index 89f8b68058e1..000000000000 --- a/sound/usb/caiaq/caiaq-device.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - * caiaq.c: ALSA driver for caiaq/NativeInstruments devices - * - * Copyright (c) 2007 Daniel Mack - * Karsten Wiese - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "caiaq-device.h" -#include "caiaq-audio.h" -#include "caiaq-midi.h" -#include "caiaq-control.h" -#include "caiaq-input.h" - -MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," - "{Native Instruments, RigKontrol3}," - "{Native Instruments, Kore Controller}," - "{Native Instruments, Kore Controller 2}," - "{Native Instruments, Audio Kontrol 1}," - "{Native Instruments, Audio 4 DJ}," - "{Native Instruments, Audio 8 DJ}," - "{Native Instruments, Session I/O}," - "{Native Instruments, GuitarRig mobile}"); - -static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ -static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ -static int snd_card_used[SNDRV_CARDS]; - -module_param_array(index, int, NULL, 0444); -MODULE_PARM_DESC(index, "Index value for the caiaq sound device"); -module_param_array(id, charp, NULL, 0444); -MODULE_PARM_DESC(id, "ID string for the caiaq soundcard."); -module_param_array(enable, bool, NULL, 0444); -MODULE_PARM_DESC(enable, "Enable the caiaq soundcard."); - -enum { - SAMPLERATE_44100 = 0, - SAMPLERATE_48000 = 1, - SAMPLERATE_96000 = 2, - SAMPLERATE_192000 = 3, - SAMPLERATE_88200 = 4, - SAMPLERATE_INVALID = 0xff -}; - -enum { - DEPTH_NONE = 0, - DEPTH_16 = 1, - DEPTH_24 = 2, - DEPTH_32 = 3 -}; - -static struct usb_device_id snd_usb_id_table[] = { - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_RIGKONTROL2 - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_RIGKONTROL3 - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_KORECONTROLLER - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_KORECONTROLLER2 - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_AK1 - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_AUDIO8DJ - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_SESSIONIO - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_GUITARRIGMOBILE - }, - { - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = USB_VID_NATIVEINSTRUMENTS, - .idProduct = USB_PID_AUDIO4DJ - }, - { /* terminator */ } -}; - -static void usb_ep1_command_reply_dispatch (struct urb* urb) -{ - int ret; - struct snd_usb_caiaqdev *dev = urb->context; - unsigned char *buf = urb->transfer_buffer; - - if (urb->status || !dev) { - log("received EP1 urb->status = %i\n", urb->status); - return; - } - - switch(buf[0]) { - case EP1_CMD_GET_DEVICE_INFO: - memcpy(&dev->spec, buf+1, sizeof(struct caiaq_device_spec)); - dev->spec.fw_version = le16_to_cpu(dev->spec.fw_version); - debug("device spec (firmware %d): audio: %d in, %d out, " - "MIDI: %d in, %d out, data alignment %d\n", - dev->spec.fw_version, - dev->spec.num_analog_audio_in, - dev->spec.num_analog_audio_out, - dev->spec.num_midi_in, - dev->spec.num_midi_out, - dev->spec.data_alignment); - - dev->spec_received++; - wake_up(&dev->ep1_wait_queue); - break; - case EP1_CMD_AUDIO_PARAMS: - dev->audio_parm_answer = buf[1]; - wake_up(&dev->ep1_wait_queue); - break; - case EP1_CMD_MIDI_READ: - snd_usb_caiaq_midi_handle_input(dev, buf[1], buf + 3, buf[2]); - break; - case EP1_CMD_READ_IO: - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) { - if (urb->actual_length > sizeof(dev->control_state)) - urb->actual_length = sizeof(dev->control_state); - memcpy(dev->control_state, buf + 1, urb->actual_length); - wake_up(&dev->ep1_wait_queue); - break; - } -#ifdef CONFIG_SND_USB_CAIAQ_INPUT - case EP1_CMD_READ_ERP: - case EP1_CMD_READ_ANALOG: - snd_usb_caiaq_input_dispatch(dev, buf, urb->actual_length); -#endif - break; - } - - dev->ep1_in_urb.actual_length = 0; - ret = usb_submit_urb(&dev->ep1_in_urb, GFP_ATOMIC); - if (ret < 0) - log("unable to submit urb. OOM!?\n"); -} - -int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, - unsigned char command, - const unsigned char *buffer, - int len) -{ - int actual_len; - struct usb_device *usb_dev = dev->chip.dev; - - if (!usb_dev) - return -EIO; - - if (len > EP1_BUFSIZE - 1) - len = EP1_BUFSIZE - 1; - - if (buffer && len > 0) - memcpy(dev->ep1_out_buf+1, buffer, len); - - dev->ep1_out_buf[0] = command; - return usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, 1), - dev->ep1_out_buf, len+1, &actual_len, 200); -} - -int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, - int rate, int depth, int bpp) -{ - int ret; - char tmp[5]; - - switch (rate) { - case 44100: tmp[0] = SAMPLERATE_44100; break; - case 48000: tmp[0] = SAMPLERATE_48000; break; - case 88200: tmp[0] = SAMPLERATE_88200; break; - case 96000: tmp[0] = SAMPLERATE_96000; break; - case 192000: tmp[0] = SAMPLERATE_192000; break; - default: return -EINVAL; - } - - switch (depth) { - case 16: tmp[1] = DEPTH_16; break; - case 24: tmp[1] = DEPTH_24; break; - default: return -EINVAL; - } - - tmp[2] = bpp & 0xff; - tmp[3] = bpp >> 8; - tmp[4] = 1; /* packets per microframe */ - - debug("setting audio params: %d Hz, %d bits, %d bpp\n", - rate, depth, bpp); - - dev->audio_parm_answer = -1; - ret = snd_usb_caiaq_send_command(dev, EP1_CMD_AUDIO_PARAMS, - tmp, sizeof(tmp)); - - if (ret) - return ret; - - if (!wait_event_timeout(dev->ep1_wait_queue, - dev->audio_parm_answer >= 0, HZ)) - return -EPIPE; - - if (dev->audio_parm_answer != 1) - debug("unable to set the device's audio params\n"); - else - dev->bpp = bpp; - - return dev->audio_parm_answer == 1 ? 0 : -EINVAL; -} - -int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, - int digital, int analog, int erp) -{ - char tmp[3] = { digital, analog, erp }; - return snd_usb_caiaq_send_command(dev, EP1_CMD_AUTO_MSG, - tmp, sizeof(tmp)); -} - -static void __devinit setup_card(struct snd_usb_caiaqdev *dev) -{ - int ret; - char val[4]; - - /* device-specific startup specials */ - switch (dev->chip.usb_id) { - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): - /* RigKontrol2 - display centered dash ('-') */ - val[0] = 0x00; - val[1] = 0x00; - val[2] = 0x01; - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 3); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): - /* RigKontrol2 - display two centered dashes ('--') */ - val[0] = 0x00; - val[1] = 0x40; - val[2] = 0x40; - val[3] = 0x00; - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 4); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): - /* Audio Kontrol 1 - make USB-LED stop blinking */ - val[0] = 0x00; - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 1); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): - /* Audio 8 DJ - trigger read of current settings */ - dev->control_state[0] = 0xff; - snd_usb_caiaq_set_auto_msg(dev, 1, 0, 0); - snd_usb_caiaq_send_command(dev, EP1_CMD_READ_IO, NULL, 0); - - if (!wait_event_timeout(dev->ep1_wait_queue, - dev->control_state[0] != 0xff, HZ)) - return; - - /* fix up some defaults */ - if ((dev->control_state[1] != 2) || - (dev->control_state[2] != 3) || - (dev->control_state[4] != 2)) { - dev->control_state[1] = 2; - dev->control_state[2] = 3; - dev->control_state[4] = 2; - snd_usb_caiaq_send_command(dev, - EP1_CMD_WRITE_IO, dev->control_state, 6); - } - - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): - /* Audio 4 DJ - default input mode to phono */ - dev->control_state[0] = 2; - snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, - dev->control_state, 1); - break; - } - - if (dev->spec.num_analog_audio_out + - dev->spec.num_analog_audio_in + - dev->spec.num_digital_audio_out + - dev->spec.num_digital_audio_in > 0) { - ret = snd_usb_caiaq_audio_init(dev); - if (ret < 0) - log("Unable to set up audio system (ret=%d)\n", ret); - } - - if (dev->spec.num_midi_in + - dev->spec.num_midi_out > 0) { - ret = snd_usb_caiaq_midi_init(dev); - if (ret < 0) - log("Unable to set up MIDI system (ret=%d)\n", ret); - } - -#ifdef CONFIG_SND_USB_CAIAQ_INPUT - ret = snd_usb_caiaq_input_init(dev); - if (ret < 0) - log("Unable to set up input system (ret=%d)\n", ret); -#endif - - /* finally, register the card and all its sub-instances */ - ret = snd_card_register(dev->chip.card); - if (ret < 0) { - log("snd_card_register() returned %d\n", ret); - snd_card_free(dev->chip.card); - } - - ret = snd_usb_caiaq_control_init(dev); - if (ret < 0) - log("Unable to set up control system (ret=%d)\n", ret); -} - -static int create_card(struct usb_device* usb_dev, struct snd_card **cardp) -{ - int devnum; - int err; - struct snd_card *card; - struct snd_usb_caiaqdev *dev; - - for (devnum = 0; devnum < SNDRV_CARDS; devnum++) - if (enable[devnum] && !snd_card_used[devnum]) - break; - - if (devnum >= SNDRV_CARDS) - return -ENODEV; - - err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, - sizeof(struct snd_usb_caiaqdev), &card); - if (err < 0) - return err; - - dev = caiaqdev(card); - dev->chip.dev = usb_dev; - dev->chip.card = card; - dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), - le16_to_cpu(usb_dev->descriptor.idProduct)); - spin_lock_init(&dev->spinlock); - snd_card_set_dev(card, &usb_dev->dev); - - *cardp = card; - return 0; -} - -static int __devinit init_card(struct snd_usb_caiaqdev *dev) -{ - char *c; - struct usb_device *usb_dev = dev->chip.dev; - struct snd_card *card = dev->chip.card; - int err, len; - - if (usb_set_interface(usb_dev, 0, 1) != 0) { - log("can't set alt interface.\n"); - return -EIO; - } - - usb_init_urb(&dev->ep1_in_urb); - usb_init_urb(&dev->midi_out_urb); - - usb_fill_bulk_urb(&dev->ep1_in_urb, usb_dev, - usb_rcvbulkpipe(usb_dev, 0x1), - dev->ep1_in_buf, EP1_BUFSIZE, - usb_ep1_command_reply_dispatch, dev); - - usb_fill_bulk_urb(&dev->midi_out_urb, usb_dev, - usb_sndbulkpipe(usb_dev, 0x1), - dev->midi_out_buf, EP1_BUFSIZE, - snd_usb_caiaq_midi_output_done, dev); - - init_waitqueue_head(&dev->ep1_wait_queue); - init_waitqueue_head(&dev->prepare_wait_queue); - - if (usb_submit_urb(&dev->ep1_in_urb, GFP_KERNEL) != 0) - return -EIO; - - err = snd_usb_caiaq_send_command(dev, EP1_CMD_GET_DEVICE_INFO, NULL, 0); - if (err) - return err; - - if (!wait_event_timeout(dev->ep1_wait_queue, dev->spec_received, HZ)) - return -ENODEV; - - usb_string(usb_dev, usb_dev->descriptor.iManufacturer, - dev->vendor_name, CAIAQ_USB_STR_LEN); - - usb_string(usb_dev, usb_dev->descriptor.iProduct, - dev->product_name, CAIAQ_USB_STR_LEN); - - usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, - dev->serial, CAIAQ_USB_STR_LEN); - - /* terminate serial string at first white space occurence */ - c = strchr(dev->serial, ' '); - if (c) - *c = '\0'; - - strcpy(card->driver, MODNAME); - strcpy(card->shortname, dev->product_name); - - len = snprintf(card->longname, sizeof(card->longname), - "%s %s (serial %s, ", - dev->vendor_name, dev->product_name, dev->serial); - - if (len < sizeof(card->longname) - 2) - len += usb_make_path(usb_dev, card->longname + len, - sizeof(card->longname) - len); - - card->longname[len++] = ')'; - card->longname[len] = '\0'; - setup_card(dev); - return 0; -} - -static int __devinit snd_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - int ret; - struct snd_card *card; - struct usb_device *device = interface_to_usbdev(intf); - - ret = create_card(device, &card); - - if (ret < 0) - return ret; - - usb_set_intfdata(intf, card); - ret = init_card(caiaqdev(card)); - if (ret < 0) { - log("unable to init card! (ret=%d)\n", ret); - snd_card_free(card); - return ret; - } - - return 0; -} - -static void snd_disconnect(struct usb_interface *intf) -{ - struct snd_usb_caiaqdev *dev; - struct snd_card *card = usb_get_intfdata(intf); - - debug("%s(%p)\n", __func__, intf); - - if (!card) - return; - - dev = caiaqdev(card); - snd_card_disconnect(card); - -#ifdef CONFIG_SND_USB_CAIAQ_INPUT - snd_usb_caiaq_input_free(dev); -#endif - snd_usb_caiaq_audio_free(dev); - - usb_kill_urb(&dev->ep1_in_urb); - usb_kill_urb(&dev->midi_out_urb); - - snd_card_free(card); - usb_reset_device(interface_to_usbdev(intf)); -} - - -MODULE_DEVICE_TABLE(usb, snd_usb_id_table); -static struct usb_driver snd_usb_driver = { - .name = MODNAME, - .probe = snd_probe, - .disconnect = snd_disconnect, - .id_table = snd_usb_id_table, -}; - -static int __init snd_module_init(void) -{ - return usb_register(&snd_usb_driver); -} - -static void __exit snd_module_exit(void) -{ - usb_deregister(&snd_usb_driver); -} - -module_init(snd_module_init) -module_exit(snd_module_exit) - diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h deleted file mode 100644 index 4cce1ad7493d..000000000000 --- a/sound/usb/caiaq/caiaq-device.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef CAIAQ_DEVICE_H -#define CAIAQ_DEVICE_H - -#include "../usbaudio.h" - -#define USB_VID_NATIVEINSTRUMENTS 0x17cc - -#define USB_PID_RIGKONTROL2 0x1969 -#define USB_PID_RIGKONTROL3 0x1940 -#define USB_PID_KORECONTROLLER 0x4711 -#define USB_PID_KORECONTROLLER2 0x4712 -#define USB_PID_AK1 0x0815 -#define USB_PID_AUDIO4DJ 0x0839 -#define USB_PID_AUDIO8DJ 0x1978 -#define USB_PID_SESSIONIO 0x1915 -#define USB_PID_GUITARRIGMOBILE 0x0d8d - -#define EP1_BUFSIZE 64 -#define CAIAQ_USB_STR_LEN 0xff -#define MAX_STREAMS 32 - -//#define SND_USB_CAIAQ_DEBUG - -#define MODNAME "snd-usb-caiaq" -#define log(x...) snd_printk(KERN_WARNING MODNAME" log: " x) - -#ifdef SND_USB_CAIAQ_DEBUG -#define debug(x...) snd_printk(KERN_WARNING MODNAME " debug: " x) -#else -#define debug(x...) do { } while(0) -#endif - -#define EP1_CMD_GET_DEVICE_INFO 0x1 -#define EP1_CMD_READ_ERP 0x2 -#define EP1_CMD_READ_ANALOG 0x3 -#define EP1_CMD_READ_IO 0x4 -#define EP1_CMD_WRITE_IO 0x5 -#define EP1_CMD_MIDI_READ 0x6 -#define EP1_CMD_MIDI_WRITE 0x7 -#define EP1_CMD_AUDIO_PARAMS 0x9 -#define EP1_CMD_AUTO_MSG 0xb -#define EP1_CMD_DIMM_LEDS 0xc - -struct caiaq_device_spec { - unsigned short fw_version; - unsigned char hw_subtype; - unsigned char num_erp; - unsigned char num_analog_in; - unsigned char num_digital_in; - unsigned char num_digital_out; - unsigned char num_analog_audio_out; - unsigned char num_analog_audio_in; - unsigned char num_digital_audio_out; - unsigned char num_digital_audio_in; - unsigned char num_midi_out; - unsigned char num_midi_in; - unsigned char data_alignment; -} __attribute__ ((packed)); - -struct snd_usb_caiaq_cb_info; - -struct snd_usb_caiaqdev { - struct snd_usb_audio chip; - - struct urb ep1_in_urb; - struct urb midi_out_urb; - struct urb **data_urbs_in; - struct urb **data_urbs_out; - struct snd_usb_caiaq_cb_info *data_cb_info; - - unsigned char ep1_in_buf[EP1_BUFSIZE]; - unsigned char ep1_out_buf[EP1_BUFSIZE]; - unsigned char midi_out_buf[EP1_BUFSIZE]; - - struct caiaq_device_spec spec; - spinlock_t spinlock; - wait_queue_head_t ep1_wait_queue; - wait_queue_head_t prepare_wait_queue; - int spec_received, audio_parm_answer; - int midi_out_active; - - char vendor_name[CAIAQ_USB_STR_LEN]; - char product_name[CAIAQ_USB_STR_LEN]; - char serial[CAIAQ_USB_STR_LEN]; - - int n_streams, n_audio_in, n_audio_out; - int streaming, first_packet, output_running; - int audio_in_buf_pos[MAX_STREAMS]; - int audio_out_buf_pos[MAX_STREAMS]; - int period_in_count[MAX_STREAMS]; - int period_out_count[MAX_STREAMS]; - int input_panic, output_panic, warned; - char *audio_in_buf, *audio_out_buf; - unsigned int samplerates, bpp; - - struct snd_pcm_substream *sub_playback[MAX_STREAMS]; - struct snd_pcm_substream *sub_capture[MAX_STREAMS]; - - /* Controls */ - unsigned char control_state[64]; - - /* Linux input */ -#ifdef CONFIG_SND_USB_CAIAQ_INPUT - struct input_dev *input_dev; - char phys[64]; /* physical device path */ - unsigned short keycode[64]; -#endif - - /* ALSA */ - struct snd_pcm *pcm; - struct snd_pcm_hardware pcm_info; - struct snd_rawmidi *rmidi; - struct snd_rawmidi_substream *midi_receive_substream; - struct snd_rawmidi_substream *midi_out_substream; -}; - -struct snd_usb_caiaq_cb_info { - struct snd_usb_caiaqdev *dev; - int index; -}; - -#define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) - -int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp); -int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp); -int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, - unsigned char command, - const unsigned char *buffer, - int len); - -#endif /* CAIAQ_DEVICE_H */ diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/caiaq-input.c deleted file mode 100644 index 4451775f82e6..000000000000 --- a/sound/usb/caiaq/caiaq-input.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2006,2007 Daniel Mack, Tim Ruetz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include "caiaq-device.h" -#include "caiaq-input.h" - -static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; -static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, - KEY_5, KEY_6, KEY_7 }; -static unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, - KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 }; - -static unsigned short keycode_kore[] = { - KEY_FN_F1, /* "menu" */ - KEY_FN_F7, /* "lcd backlight */ - KEY_FN_F2, /* "control" */ - KEY_FN_F3, /* "enter" */ - KEY_FN_F4, /* "view" */ - KEY_FN_F5, /* "esc" */ - KEY_FN_F6, /* "sound" */ - KEY_FN_F8, /* array spacer, never triggered. */ - KEY_RIGHT, - KEY_DOWN, - KEY_UP, - KEY_LEFT, - KEY_SOUND, /* "listen" */ - KEY_RECORD, - KEY_PLAYPAUSE, - KEY_STOP, - BTN_4, /* 8 softkeys */ - BTN_3, - BTN_2, - BTN_1, - BTN_8, - BTN_7, - BTN_6, - BTN_5, - KEY_BRL_DOT4, /* touch sensitive knobs */ - KEY_BRL_DOT3, - KEY_BRL_DOT2, - KEY_BRL_DOT1, - KEY_BRL_DOT8, - KEY_BRL_DOT7, - KEY_BRL_DOT6, - KEY_BRL_DOT5 -}; - -#define DEG90 (range / 2) -#define DEG180 (range) -#define DEG270 (DEG90 + DEG180) -#define DEG360 (DEG180 * 2) -#define HIGH_PEAK (268) -#define LOW_PEAK (-7) - -/* some of these devices have endless rotation potentiometers - * built in which use two tapers, 90 degrees phase shifted. - * this algorithm decodes them to one single value, ranging - * from 0 to 999 */ -static unsigned int decode_erp(unsigned char a, unsigned char b) -{ - int weight_a, weight_b; - int pos_a, pos_b; - int ret; - int range = HIGH_PEAK - LOW_PEAK; - int mid_value = (HIGH_PEAK + LOW_PEAK) / 2; - - weight_b = abs(mid_value - a) - (range / 2 - 100) / 2; - - if (weight_b < 0) - weight_b = 0; - - if (weight_b > 100) - weight_b = 100; - - weight_a = 100 - weight_b; - - if (a < mid_value) { - /* 0..90 and 270..360 degrees */ - pos_b = b - LOW_PEAK + DEG270; - if (pos_b >= DEG360) - pos_b -= DEG360; - } else - /* 90..270 degrees */ - pos_b = HIGH_PEAK - b + DEG90; - - - if (b > mid_value) - /* 0..180 degrees */ - pos_a = a - LOW_PEAK; - else - /* 180..360 degrees */ - pos_a = HIGH_PEAK - a + DEG180; - - /* interpolate both slider values, depending on weight factors */ - /* 0..99 x DEG360 */ - ret = pos_a * weight_a + pos_b * weight_b; - - /* normalize to 0..999 */ - ret *= 10; - ret /= DEG360; - - if (ret < 0) - ret += 1000; - - if (ret >= 1000) - ret -= 1000; - - return ret; -} - -#undef DEG90 -#undef DEG180 -#undef DEG270 -#undef DEG360 -#undef HIGH_PEAK -#undef LOW_PEAK - - -static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, - const unsigned char *buf, - unsigned int len) -{ - struct input_dev *input_dev = dev->input_dev; - - switch (dev->chip.usb_id) { - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): - input_report_abs(input_dev, ABS_X, (buf[4] << 8) | buf[5]); - input_report_abs(input_dev, ABS_Y, (buf[0] << 8) | buf[1]); - input_report_abs(input_dev, ABS_Z, (buf[2] << 8) | buf[3]); - input_sync(input_dev); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): - input_report_abs(input_dev, ABS_X, (buf[0] << 8) | buf[1]); - input_report_abs(input_dev, ABS_Y, (buf[2] << 8) | buf[3]); - input_report_abs(input_dev, ABS_Z, (buf[4] << 8) | buf[5]); - input_sync(input_dev); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): - input_report_abs(input_dev, ABS_X, (buf[0] << 8) | buf[1]); - input_report_abs(input_dev, ABS_Y, (buf[2] << 8) | buf[3]); - input_report_abs(input_dev, ABS_Z, (buf[4] << 8) | buf[5]); - input_sync(input_dev); - break; - } -} - -static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev, - const char *buf, unsigned int len) -{ - struct input_dev *input_dev = dev->input_dev; - int i; - - switch (dev->chip.usb_id) { - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): - i = decode_erp(buf[0], buf[1]); - input_report_abs(input_dev, ABS_X, i); - input_sync(input_dev); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): - i = decode_erp(buf[7], buf[5]); - input_report_abs(input_dev, ABS_HAT0X, i); - i = decode_erp(buf[12], buf[14]); - input_report_abs(input_dev, ABS_HAT0Y, i); - i = decode_erp(buf[15], buf[13]); - input_report_abs(input_dev, ABS_HAT1X, i); - i = decode_erp(buf[0], buf[2]); - input_report_abs(input_dev, ABS_HAT1Y, i); - i = decode_erp(buf[3], buf[1]); - input_report_abs(input_dev, ABS_HAT2X, i); - i = decode_erp(buf[8], buf[10]); - input_report_abs(input_dev, ABS_HAT2Y, i); - i = decode_erp(buf[11], buf[9]); - input_report_abs(input_dev, ABS_HAT3X, i); - i = decode_erp(buf[4], buf[6]); - input_report_abs(input_dev, ABS_HAT3Y, i); - input_sync(input_dev); - break; - } -} - -static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *dev, - char *buf, unsigned int len) -{ - struct input_dev *input_dev = dev->input_dev; - unsigned short *keycode = input_dev->keycode; - int i; - - if (!keycode) - return; - - if (input_dev->id.product == USB_PID_RIGKONTROL2) - for (i = 0; i < len; i++) - buf[i] = ~buf[i]; - - for (i = 0; i < input_dev->keycodemax && i < len * 8; i++) - input_report_key(input_dev, keycode[i], - buf[i / 8] & (1 << (i % 8))); - - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER) || - dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2)) - input_report_abs(dev->input_dev, ABS_MISC, 255 - buf[4]); - - input_sync(input_dev); -} - -void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, - char *buf, - unsigned int len) -{ - if (!dev->input_dev || len < 1) - return; - - switch (buf[0]) { - case EP1_CMD_READ_ANALOG: - snd_caiaq_input_read_analog(dev, buf + 1, len - 1); - break; - case EP1_CMD_READ_ERP: - snd_caiaq_input_read_erp(dev, buf + 1, len - 1); - break; - case EP1_CMD_READ_IO: - snd_caiaq_input_read_io(dev, buf + 1, len - 1); - break; - } -} - -int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) -{ - struct usb_device *usb_dev = dev->chip.dev; - struct input_dev *input; - int i, ret; - - input = input_allocate_device(); - if (!input) - return -ENOMEM; - - usb_make_path(usb_dev, dev->phys, sizeof(dev->phys)); - strlcat(dev->phys, "/input0", sizeof(dev->phys)); - - input->name = dev->product_name; - input->phys = dev->phys; - usb_to_input_id(usb_dev, &input->id); - input->dev.parent = &usb_dev->dev; - - switch (dev->chip.usb_id) { - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): - input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); - input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | - BIT_MASK(ABS_Z); - BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk2)); - memcpy(dev->keycode, keycode_rk2, sizeof(keycode_rk2)); - input->keycodemax = ARRAY_SIZE(keycode_rk2); - input_set_abs_params(input, ABS_X, 0, 4096, 0, 10); - input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); - input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); - snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): - input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); - input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | - BIT_MASK(ABS_Z); - BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk3)); - memcpy(dev->keycode, keycode_rk3, sizeof(keycode_rk3)); - input->keycodemax = ARRAY_SIZE(keycode_rk3); - input_set_abs_params(input, ABS_X, 0, 1024, 0, 10); - input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10); - input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10); - snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): - input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); - input->absbit[0] = BIT_MASK(ABS_X); - BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_ak1)); - memcpy(dev->keycode, keycode_ak1, sizeof(keycode_ak1)); - input->keycodemax = ARRAY_SIZE(keycode_ak1); - input_set_abs_params(input, ABS_X, 0, 999, 0, 10); - snd_usb_caiaq_set_auto_msg(dev, 1, 0, 5); - break; - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): - input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); - input->absbit[0] = BIT_MASK(ABS_HAT0X) | BIT_MASK(ABS_HAT0Y) | - BIT_MASK(ABS_HAT1X) | BIT_MASK(ABS_HAT1Y) | - BIT_MASK(ABS_HAT2X) | BIT_MASK(ABS_HAT2Y) | - BIT_MASK(ABS_HAT3X) | BIT_MASK(ABS_HAT3Y) | - BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | - BIT_MASK(ABS_Z); - input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); - BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_kore)); - memcpy(dev->keycode, keycode_kore, sizeof(keycode_kore)); - input->keycodemax = ARRAY_SIZE(keycode_kore); - input_set_abs_params(input, ABS_HAT0X, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT0Y, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT1X, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT1Y, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT2X, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT2Y, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT3X, 0, 999, 0, 10); - input_set_abs_params(input, ABS_HAT3Y, 0, 999, 0, 10); - input_set_abs_params(input, ABS_X, 0, 4096, 0, 10); - input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); - input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); - input_set_abs_params(input, ABS_MISC, 0, 255, 0, 1); - snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5); - break; - default: - /* no input methods supported on this device */ - input_free_device(input); - return 0; - } - - input->keycode = dev->keycode; - input->keycodesize = sizeof(unsigned short); - for (i = 0; i < input->keycodemax; i++) - __set_bit(dev->keycode[i], input->keybit); - - ret = input_register_device(input); - if (ret < 0) { - input_free_device(input); - return ret; - } - - dev->input_dev = input; - return 0; -} - -void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev) -{ - if (!dev || !dev->input_dev) - return; - - input_unregister_device(dev->input_dev); - dev->input_dev = NULL; -} - diff --git a/sound/usb/caiaq/caiaq-input.h b/sound/usb/caiaq/caiaq-input.h deleted file mode 100644 index ced535577864..000000000000 --- a/sound/usb/caiaq/caiaq-input.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CAIAQ_INPUT_H -#define CAIAQ_INPUT_H - -void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, char *buf, unsigned int len); -int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev); -void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev); - -#endif diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c deleted file mode 100644 index 79424c198912..000000000000 --- a/sound/usb/caiaq/caiaq-midi.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2006,2007 Daniel Mack - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include - -#include "caiaq-device.h" -#include "caiaq-midi.h" - -static int snd_usb_caiaq_midi_input_open(struct snd_rawmidi_substream *substream) -{ - return 0; -} - -static int snd_usb_caiaq_midi_input_close(struct snd_rawmidi_substream *substream) -{ - return 0; -} - -static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) -{ - struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; - - if (!dev) - return; - - dev->midi_receive_substream = up ? substream : NULL; -} - - -static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substream) -{ - return 0; -} - -static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) -{ - struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; - if (dev->midi_out_active) { - usb_kill_urb(&dev->midi_out_urb); - dev->midi_out_active = 0; - } - return 0; -} - -static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, - struct snd_rawmidi_substream *substream) -{ - int len, ret; - - dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; - dev->midi_out_buf[1] = 0; /* port */ - len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, - EP1_BUFSIZE - 3); - - if (len <= 0) - return; - - dev->midi_out_buf[2] = len; - dev->midi_out_urb.transfer_buffer_length = len+3; - - ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); - if (ret < 0) - log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," - "ret=%d, len=%d\n", - substream, ret, len); - else - dev->midi_out_active = 1; -} - -static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) -{ - struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; - - if (up) { - dev->midi_out_substream = substream; - if (!dev->midi_out_active) - snd_usb_caiaq_midi_send(dev, substream); - } else { - dev->midi_out_substream = NULL; - } -} - - -static struct snd_rawmidi_ops snd_usb_caiaq_midi_output = -{ - .open = snd_usb_caiaq_midi_output_open, - .close = snd_usb_caiaq_midi_output_close, - .trigger = snd_usb_caiaq_midi_output_trigger, -}; - -static struct snd_rawmidi_ops snd_usb_caiaq_midi_input = -{ - .open = snd_usb_caiaq_midi_input_open, - .close = snd_usb_caiaq_midi_input_close, - .trigger = snd_usb_caiaq_midi_input_trigger, -}; - -void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, - int port, const char *buf, int len) -{ - if (!dev->midi_receive_substream) - return; - - snd_rawmidi_receive(dev->midi_receive_substream, buf, len); -} - -int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) -{ - int ret; - struct snd_rawmidi *rmidi; - - ret = snd_rawmidi_new(device->chip.card, device->product_name, 0, - device->spec.num_midi_out, - device->spec.num_midi_in, - &rmidi); - - if (ret < 0) - return ret; - - strcpy(rmidi->name, device->product_name); - - rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX; - rmidi->private_data = device; - - if (device->spec.num_midi_out > 0) { - rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT; - snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, - &snd_usb_caiaq_midi_output); - } - - if (device->spec.num_midi_in > 0) { - rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT; - snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, - &snd_usb_caiaq_midi_input); - } - - device->rmidi = rmidi; - - return 0; -} - -void snd_usb_caiaq_midi_output_done(struct urb* urb) -{ - struct snd_usb_caiaqdev *dev = urb->context; - - dev->midi_out_active = 0; - if (urb->status != 0) - return; - - if (!dev->midi_out_substream) - return; - - snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); -} - diff --git a/sound/usb/caiaq/caiaq-midi.h b/sound/usb/caiaq/caiaq-midi.h deleted file mode 100644 index 9d16db027fc3..000000000000 --- a/sound/usb/caiaq/caiaq-midi.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CAIAQ_MIDI_H -#define CAIAQ_MIDI_H - -int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); -void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); -void snd_usb_caiaq_midi_output_done(struct urb* urb); - -#endif /* CAIAQ_MIDI_H */ diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c new file mode 100644 index 000000000000..537102ba6b9d --- /dev/null +++ b/sound/usb/caiaq/control.c @@ -0,0 +1,332 @@ +/* + * Copyright (c) 2007 Daniel Mack + * friendly supported by NI. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +#include "device.h" +#include "control.h" + +#define CNT_INTVAL 0x10000 + +static int control_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); + struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); + int pos = kcontrol->private_value; + int is_intval = pos & CNT_INTVAL; + unsigned int id = dev->chip.usb_id; + + uinfo->count = 1; + pos &= ~CNT_INTVAL; + + if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) + && (pos == 0)) { + /* current input mode of A8DJ */ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 2; + return 0; + } + + if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ) + && (pos == 0)) { + /* current input mode of A4DJ */ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; + } + + if (is_intval) { + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 64; + } else { + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + } + + return 0; +} + +static int control_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); + struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); + int pos = kcontrol->private_value; + + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + ucontrol->value.integer.value[0] = dev->control_state[0] - 1; + return 0; + } + + if (pos & CNT_INTVAL) + ucontrol->value.integer.value[0] + = dev->control_state[pos & ~CNT_INTVAL]; + else + ucontrol->value.integer.value[0] + = !!(dev->control_state[pos / 8] & (1 << pos % 8)); + + return 0; +} + +static int control_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); + struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); + int pos = kcontrol->private_value; + + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + dev->control_state[0] = ucontrol->value.integer.value[0] + 1; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, sizeof(dev->control_state)); + return 1; + } + + if (pos & CNT_INTVAL) { + dev->control_state[pos & ~CNT_INTVAL] + = ucontrol->value.integer.value[0]; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, sizeof(dev->control_state)); + } else { + if (ucontrol->value.integer.value[0]) + dev->control_state[pos / 8] |= 1 << (pos % 8); + else + dev->control_state[pos / 8] &= ~(1 << (pos % 8)); + + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, sizeof(dev->control_state)); + } + + return 1; +} + +static struct snd_kcontrol_new kcontrol_template __devinitdata = { + .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .index = 0, + .info = control_info, + .get = control_get, + .put = control_put, + /* name and private_value filled later */ +}; + +struct caiaq_controller { + char *name; + int index; +}; + +static struct caiaq_controller ak1_controller[] = { + { "LED left", 2 }, + { "LED middle", 1 }, + { "LED right", 0 }, + { "LED ring", 3 } +}; + +static struct caiaq_controller rk2_controller[] = { + { "LED 1", 5 }, + { "LED 2", 4 }, + { "LED 3", 3 }, + { "LED 4", 2 }, + { "LED 5", 1 }, + { "LED 6", 0 }, + { "LED pedal", 6 }, + { "LED 7seg_1b", 8 }, + { "LED 7seg_1c", 9 }, + { "LED 7seg_2a", 10 }, + { "LED 7seg_2b", 11 }, + { "LED 7seg_2c", 12 }, + { "LED 7seg_2d", 13 }, + { "LED 7seg_2e", 14 }, + { "LED 7seg_2f", 15 }, + { "LED 7seg_2g", 16 }, + { "LED 7seg_3a", 17 }, + { "LED 7seg_3b", 18 }, + { "LED 7seg_3c", 19 }, + { "LED 7seg_3d", 20 }, + { "LED 7seg_3e", 21 }, + { "LED 7seg_3f", 22 }, + { "LED 7seg_3g", 23 } +}; + +static struct caiaq_controller rk3_controller[] = { + { "LED 7seg_1a", 0 + 0 }, + { "LED 7seg_1b", 0 + 1 }, + { "LED 7seg_1c", 0 + 2 }, + { "LED 7seg_1d", 0 + 3 }, + { "LED 7seg_1e", 0 + 4 }, + { "LED 7seg_1f", 0 + 5 }, + { "LED 7seg_1g", 0 + 6 }, + { "LED 7seg_1p", 0 + 7 }, + + { "LED 7seg_2a", 8 + 0 }, + { "LED 7seg_2b", 8 + 1 }, + { "LED 7seg_2c", 8 + 2 }, + { "LED 7seg_2d", 8 + 3 }, + { "LED 7seg_2e", 8 + 4 }, + { "LED 7seg_2f", 8 + 5 }, + { "LED 7seg_2g", 8 + 6 }, + { "LED 7seg_2p", 8 + 7 }, + + { "LED 7seg_3a", 16 + 0 }, + { "LED 7seg_3b", 16 + 1 }, + { "LED 7seg_3c", 16 + 2 }, + { "LED 7seg_3d", 16 + 3 }, + { "LED 7seg_3e", 16 + 4 }, + { "LED 7seg_3f", 16 + 5 }, + { "LED 7seg_3g", 16 + 6 }, + { "LED 7seg_3p", 16 + 7 }, + + { "LED 7seg_4a", 24 + 0 }, + { "LED 7seg_4b", 24 + 1 }, + { "LED 7seg_4c", 24 + 2 }, + { "LED 7seg_4d", 24 + 3 }, + { "LED 7seg_4e", 24 + 4 }, + { "LED 7seg_4f", 24 + 5 }, + { "LED 7seg_4g", 24 + 6 }, + { "LED 7seg_4p", 24 + 7 }, + + { "LED 1", 32 + 0 }, + { "LED 2", 32 + 1 }, + { "LED 3", 32 + 2 }, + { "LED 4", 32 + 3 }, + { "LED 5", 32 + 4 }, + { "LED 6", 32 + 5 }, + { "LED 7", 32 + 6 }, + { "LED 8", 32 + 7 }, + { "LED pedal", 32 + 8 } +}; + +static struct caiaq_controller kore_controller[] = { + { "LED F1", 8 | CNT_INTVAL }, + { "LED F2", 12 | CNT_INTVAL }, + { "LED F3", 0 | CNT_INTVAL }, + { "LED F4", 4 | CNT_INTVAL }, + { "LED F5", 11 | CNT_INTVAL }, + { "LED F6", 15 | CNT_INTVAL }, + { "LED F7", 3 | CNT_INTVAL }, + { "LED F8", 7 | CNT_INTVAL }, + { "LED touch1", 10 | CNT_INTVAL }, + { "LED touch2", 14 | CNT_INTVAL }, + { "LED touch3", 2 | CNT_INTVAL }, + { "LED touch4", 6 | CNT_INTVAL }, + { "LED touch5", 9 | CNT_INTVAL }, + { "LED touch6", 13 | CNT_INTVAL }, + { "LED touch7", 1 | CNT_INTVAL }, + { "LED touch8", 5 | CNT_INTVAL }, + { "LED left", 18 | CNT_INTVAL }, + { "LED right", 22 | CNT_INTVAL }, + { "LED up", 16 | CNT_INTVAL }, + { "LED down", 20 | CNT_INTVAL }, + { "LED stop", 23 | CNT_INTVAL }, + { "LED play", 21 | CNT_INTVAL }, + { "LED record", 19 | CNT_INTVAL }, + { "LED listen", 17 | CNT_INTVAL }, + { "LED lcd", 30 | CNT_INTVAL }, + { "LED menu", 28 | CNT_INTVAL }, + { "LED sound", 31 | CNT_INTVAL }, + { "LED esc", 29 | CNT_INTVAL }, + { "LED view", 27 | CNT_INTVAL }, + { "LED enter", 24 | CNT_INTVAL }, + { "LED control", 26 | CNT_INTVAL } +}; + +static struct caiaq_controller a8dj_controller[] = { + { "Current input mode", 0 | CNT_INTVAL }, + { "GND lift for TC Vinyl mode", 24 + 0 }, + { "GND lift for TC CD/Line mode", 24 + 1 }, + { "GND lift for phono mode", 24 + 2 }, + { "Software lock", 40 } +}; + +static struct caiaq_controller a4dj_controller[] = { + { "Current input mode", 0 | CNT_INTVAL } +}; + +static int __devinit add_controls(struct caiaq_controller *c, int num, + struct snd_usb_caiaqdev *dev) +{ + int i, ret; + struct snd_kcontrol *kc; + + for (i = 0; i < num; i++, c++) { + kcontrol_template.name = c->name; + kcontrol_template.private_value = c->index; + kc = snd_ctl_new1(&kcontrol_template, dev); + ret = snd_ctl_add(dev->chip.card, kc); + if (ret < 0) + return ret; + } + + return 0; +} + +int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) +{ + int ret = 0; + + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): + ret = add_controls(ak1_controller, + ARRAY_SIZE(ak1_controller), dev); + break; + + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): + ret = add_controls(rk2_controller, + ARRAY_SIZE(rk2_controller), dev); + break; + + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + ret = add_controls(rk3_controller, + ARRAY_SIZE(rk3_controller), dev); + break; + + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): + ret = add_controls(kore_controller, + ARRAY_SIZE(kore_controller), dev); + break; + + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): + ret = add_controls(a8dj_controller, + ARRAY_SIZE(a8dj_controller), dev); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + ret = add_controls(a4dj_controller, + ARRAY_SIZE(a4dj_controller), dev); + break; + } + + return ret; +} + diff --git a/sound/usb/caiaq/control.h b/sound/usb/caiaq/control.h new file mode 100644 index 000000000000..2e7ab1aa4fb3 --- /dev/null +++ b/sound/usb/caiaq/control.h @@ -0,0 +1,6 @@ +#ifndef CAIAQ_CONTROL_H +#define CAIAQ_CONTROL_H + +int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev); + +#endif /* CAIAQ_CONTROL_H */ diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c new file mode 100644 index 000000000000..6d517705da0e --- /dev/null +++ b/sound/usb/caiaq/device.c @@ -0,0 +1,521 @@ +/* + * caiaq.c: ALSA driver for caiaq/NativeInstruments devices + * + * Copyright (c) 2007 Daniel Mack + * Karsten Wiese + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "device.h" +#include "audio.h" +#include "midi.h" +#include "control.h" +#include "input.h" + +MODULE_AUTHOR("Daniel Mack "); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," + "{Native Instruments, RigKontrol3}," + "{Native Instruments, Kore Controller}," + "{Native Instruments, Kore Controller 2}," + "{Native Instruments, Audio Kontrol 1}," + "{Native Instruments, Audio 4 DJ}," + "{Native Instruments, Audio 8 DJ}," + "{Native Instruments, Session I/O}," + "{Native Instruments, GuitarRig mobile}"); + +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ +static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ +static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static int snd_card_used[SNDRV_CARDS]; + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for the caiaq sound device"); +module_param_array(id, charp, NULL, 0444); +MODULE_PARM_DESC(id, "ID string for the caiaq soundcard."); +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable the caiaq soundcard."); + +enum { + SAMPLERATE_44100 = 0, + SAMPLERATE_48000 = 1, + SAMPLERATE_96000 = 2, + SAMPLERATE_192000 = 3, + SAMPLERATE_88200 = 4, + SAMPLERATE_INVALID = 0xff +}; + +enum { + DEPTH_NONE = 0, + DEPTH_16 = 1, + DEPTH_24 = 2, + DEPTH_32 = 3 +}; + +static struct usb_device_id snd_usb_id_table[] = { + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_RIGKONTROL2 + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_RIGKONTROL3 + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_KORECONTROLLER + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_KORECONTROLLER2 + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_AK1 + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_AUDIO8DJ + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_SESSIONIO + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_GUITARRIGMOBILE + }, + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = USB_VID_NATIVEINSTRUMENTS, + .idProduct = USB_PID_AUDIO4DJ + }, + { /* terminator */ } +}; + +static void usb_ep1_command_reply_dispatch (struct urb* urb) +{ + int ret; + struct snd_usb_caiaqdev *dev = urb->context; + unsigned char *buf = urb->transfer_buffer; + + if (urb->status || !dev) { + log("received EP1 urb->status = %i\n", urb->status); + return; + } + + switch(buf[0]) { + case EP1_CMD_GET_DEVICE_INFO: + memcpy(&dev->spec, buf+1, sizeof(struct caiaq_device_spec)); + dev->spec.fw_version = le16_to_cpu(dev->spec.fw_version); + debug("device spec (firmware %d): audio: %d in, %d out, " + "MIDI: %d in, %d out, data alignment %d\n", + dev->spec.fw_version, + dev->spec.num_analog_audio_in, + dev->spec.num_analog_audio_out, + dev->spec.num_midi_in, + dev->spec.num_midi_out, + dev->spec.data_alignment); + + dev->spec_received++; + wake_up(&dev->ep1_wait_queue); + break; + case EP1_CMD_AUDIO_PARAMS: + dev->audio_parm_answer = buf[1]; + wake_up(&dev->ep1_wait_queue); + break; + case EP1_CMD_MIDI_READ: + snd_usb_caiaq_midi_handle_input(dev, buf[1], buf + 3, buf[2]); + break; + case EP1_CMD_READ_IO: + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) { + if (urb->actual_length > sizeof(dev->control_state)) + urb->actual_length = sizeof(dev->control_state); + memcpy(dev->control_state, buf + 1, urb->actual_length); + wake_up(&dev->ep1_wait_queue); + break; + } +#ifdef CONFIG_SND_USB_CAIAQ_INPUT + case EP1_CMD_READ_ERP: + case EP1_CMD_READ_ANALOG: + snd_usb_caiaq_input_dispatch(dev, buf, urb->actual_length); +#endif + break; + } + + dev->ep1_in_urb.actual_length = 0; + ret = usb_submit_urb(&dev->ep1_in_urb, GFP_ATOMIC); + if (ret < 0) + log("unable to submit urb. OOM!?\n"); +} + +int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, + unsigned char command, + const unsigned char *buffer, + int len) +{ + int actual_len; + struct usb_device *usb_dev = dev->chip.dev; + + if (!usb_dev) + return -EIO; + + if (len > EP1_BUFSIZE - 1) + len = EP1_BUFSIZE - 1; + + if (buffer && len > 0) + memcpy(dev->ep1_out_buf+1, buffer, len); + + dev->ep1_out_buf[0] = command; + return usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, 1), + dev->ep1_out_buf, len+1, &actual_len, 200); +} + +int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, + int rate, int depth, int bpp) +{ + int ret; + char tmp[5]; + + switch (rate) { + case 44100: tmp[0] = SAMPLERATE_44100; break; + case 48000: tmp[0] = SAMPLERATE_48000; break; + case 88200: tmp[0] = SAMPLERATE_88200; break; + case 96000: tmp[0] = SAMPLERATE_96000; break; + case 192000: tmp[0] = SAMPLERATE_192000; break; + default: return -EINVAL; + } + + switch (depth) { + case 16: tmp[1] = DEPTH_16; break; + case 24: tmp[1] = DEPTH_24; break; + default: return -EINVAL; + } + + tmp[2] = bpp & 0xff; + tmp[3] = bpp >> 8; + tmp[4] = 1; /* packets per microframe */ + + debug("setting audio params: %d Hz, %d bits, %d bpp\n", + rate, depth, bpp); + + dev->audio_parm_answer = -1; + ret = snd_usb_caiaq_send_command(dev, EP1_CMD_AUDIO_PARAMS, + tmp, sizeof(tmp)); + + if (ret) + return ret; + + if (!wait_event_timeout(dev->ep1_wait_queue, + dev->audio_parm_answer >= 0, HZ)) + return -EPIPE; + + if (dev->audio_parm_answer != 1) + debug("unable to set the device's audio params\n"); + else + dev->bpp = bpp; + + return dev->audio_parm_answer == 1 ? 0 : -EINVAL; +} + +int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, + int digital, int analog, int erp) +{ + char tmp[3] = { digital, analog, erp }; + return snd_usb_caiaq_send_command(dev, EP1_CMD_AUTO_MSG, + tmp, sizeof(tmp)); +} + +static void __devinit setup_card(struct snd_usb_caiaqdev *dev) +{ + int ret; + char val[4]; + + /* device-specific startup specials */ + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): + /* RigKontrol2 - display centered dash ('-') */ + val[0] = 0x00; + val[1] = 0x00; + val[2] = 0x01; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 3); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + /* RigKontrol2 - display two centered dashes ('--') */ + val[0] = 0x00; + val[1] = 0x40; + val[2] = 0x40; + val[3] = 0x00; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 4); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): + /* Audio Kontrol 1 - make USB-LED stop blinking */ + val[0] = 0x00; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 1); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): + /* Audio 8 DJ - trigger read of current settings */ + dev->control_state[0] = 0xff; + snd_usb_caiaq_set_auto_msg(dev, 1, 0, 0); + snd_usb_caiaq_send_command(dev, EP1_CMD_READ_IO, NULL, 0); + + if (!wait_event_timeout(dev->ep1_wait_queue, + dev->control_state[0] != 0xff, HZ)) + return; + + /* fix up some defaults */ + if ((dev->control_state[1] != 2) || + (dev->control_state[2] != 3) || + (dev->control_state[4] != 2)) { + dev->control_state[1] = 2; + dev->control_state[2] = 3; + dev->control_state[4] = 2; + snd_usb_caiaq_send_command(dev, + EP1_CMD_WRITE_IO, dev->control_state, 6); + } + + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + /* Audio 4 DJ - default input mode to phono */ + dev->control_state[0] = 2; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, 1); + break; + } + + if (dev->spec.num_analog_audio_out + + dev->spec.num_analog_audio_in + + dev->spec.num_digital_audio_out + + dev->spec.num_digital_audio_in > 0) { + ret = snd_usb_caiaq_audio_init(dev); + if (ret < 0) + log("Unable to set up audio system (ret=%d)\n", ret); + } + + if (dev->spec.num_midi_in + + dev->spec.num_midi_out > 0) { + ret = snd_usb_caiaq_midi_init(dev); + if (ret < 0) + log("Unable to set up MIDI system (ret=%d)\n", ret); + } + +#ifdef CONFIG_SND_USB_CAIAQ_INPUT + ret = snd_usb_caiaq_input_init(dev); + if (ret < 0) + log("Unable to set up input system (ret=%d)\n", ret); +#endif + + /* finally, register the card and all its sub-instances */ + ret = snd_card_register(dev->chip.card); + if (ret < 0) { + log("snd_card_register() returned %d\n", ret); + snd_card_free(dev->chip.card); + } + + ret = snd_usb_caiaq_control_init(dev); + if (ret < 0) + log("Unable to set up control system (ret=%d)\n", ret); +} + +static int create_card(struct usb_device* usb_dev, struct snd_card **cardp) +{ + int devnum; + int err; + struct snd_card *card; + struct snd_usb_caiaqdev *dev; + + for (devnum = 0; devnum < SNDRV_CARDS; devnum++) + if (enable[devnum] && !snd_card_used[devnum]) + break; + + if (devnum >= SNDRV_CARDS) + return -ENODEV; + + err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, + sizeof(struct snd_usb_caiaqdev), &card); + if (err < 0) + return err; + + dev = caiaqdev(card); + dev->chip.dev = usb_dev; + dev->chip.card = card; + dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), + le16_to_cpu(usb_dev->descriptor.idProduct)); + spin_lock_init(&dev->spinlock); + snd_card_set_dev(card, &usb_dev->dev); + + *cardp = card; + return 0; +} + +static int __devinit init_card(struct snd_usb_caiaqdev *dev) +{ + char *c; + struct usb_device *usb_dev = dev->chip.dev; + struct snd_card *card = dev->chip.card; + int err, len; + + if (usb_set_interface(usb_dev, 0, 1) != 0) { + log("can't set alt interface.\n"); + return -EIO; + } + + usb_init_urb(&dev->ep1_in_urb); + usb_init_urb(&dev->midi_out_urb); + + usb_fill_bulk_urb(&dev->ep1_in_urb, usb_dev, + usb_rcvbulkpipe(usb_dev, 0x1), + dev->ep1_in_buf, EP1_BUFSIZE, + usb_ep1_command_reply_dispatch, dev); + + usb_fill_bulk_urb(&dev->midi_out_urb, usb_dev, + usb_sndbulkpipe(usb_dev, 0x1), + dev->midi_out_buf, EP1_BUFSIZE, + snd_usb_caiaq_midi_output_done, dev); + + init_waitqueue_head(&dev->ep1_wait_queue); + init_waitqueue_head(&dev->prepare_wait_queue); + + if (usb_submit_urb(&dev->ep1_in_urb, GFP_KERNEL) != 0) + return -EIO; + + err = snd_usb_caiaq_send_command(dev, EP1_CMD_GET_DEVICE_INFO, NULL, 0); + if (err) + return err; + + if (!wait_event_timeout(dev->ep1_wait_queue, dev->spec_received, HZ)) + return -ENODEV; + + usb_string(usb_dev, usb_dev->descriptor.iManufacturer, + dev->vendor_name, CAIAQ_USB_STR_LEN); + + usb_string(usb_dev, usb_dev->descriptor.iProduct, + dev->product_name, CAIAQ_USB_STR_LEN); + + usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, + dev->serial, CAIAQ_USB_STR_LEN); + + /* terminate serial string at first white space occurence */ + c = strchr(dev->serial, ' '); + if (c) + *c = '\0'; + + strcpy(card->driver, MODNAME); + strcpy(card->shortname, dev->product_name); + + len = snprintf(card->longname, sizeof(card->longname), + "%s %s (serial %s, ", + dev->vendor_name, dev->product_name, dev->serial); + + if (len < sizeof(card->longname) - 2) + len += usb_make_path(usb_dev, card->longname + len, + sizeof(card->longname) - len); + + card->longname[len++] = ')'; + card->longname[len] = '\0'; + setup_card(dev); + return 0; +} + +static int __devinit snd_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + int ret; + struct snd_card *card; + struct usb_device *device = interface_to_usbdev(intf); + + ret = create_card(device, &card); + + if (ret < 0) + return ret; + + usb_set_intfdata(intf, card); + ret = init_card(caiaqdev(card)); + if (ret < 0) { + log("unable to init card! (ret=%d)\n", ret); + snd_card_free(card); + return ret; + } + + return 0; +} + +static void snd_disconnect(struct usb_interface *intf) +{ + struct snd_usb_caiaqdev *dev; + struct snd_card *card = usb_get_intfdata(intf); + + debug("%s(%p)\n", __func__, intf); + + if (!card) + return; + + dev = caiaqdev(card); + snd_card_disconnect(card); + +#ifdef CONFIG_SND_USB_CAIAQ_INPUT + snd_usb_caiaq_input_free(dev); +#endif + snd_usb_caiaq_audio_free(dev); + + usb_kill_urb(&dev->ep1_in_urb); + usb_kill_urb(&dev->midi_out_urb); + + snd_card_free(card); + usb_reset_device(interface_to_usbdev(intf)); +} + + +MODULE_DEVICE_TABLE(usb, snd_usb_id_table); +static struct usb_driver snd_usb_driver = { + .name = MODNAME, + .probe = snd_probe, + .disconnect = snd_disconnect, + .id_table = snd_usb_id_table, +}; + +static int __init snd_module_init(void) +{ + return usb_register(&snd_usb_driver); +} + +static void __exit snd_module_exit(void) +{ + usb_deregister(&snd_usb_driver); +} + +module_init(snd_module_init) +module_exit(snd_module_exit) + diff --git a/sound/usb/caiaq/device.h b/sound/usb/caiaq/device.h new file mode 100644 index 000000000000..4cce1ad7493d --- /dev/null +++ b/sound/usb/caiaq/device.h @@ -0,0 +1,131 @@ +#ifndef CAIAQ_DEVICE_H +#define CAIAQ_DEVICE_H + +#include "../usbaudio.h" + +#define USB_VID_NATIVEINSTRUMENTS 0x17cc + +#define USB_PID_RIGKONTROL2 0x1969 +#define USB_PID_RIGKONTROL3 0x1940 +#define USB_PID_KORECONTROLLER 0x4711 +#define USB_PID_KORECONTROLLER2 0x4712 +#define USB_PID_AK1 0x0815 +#define USB_PID_AUDIO4DJ 0x0839 +#define USB_PID_AUDIO8DJ 0x1978 +#define USB_PID_SESSIONIO 0x1915 +#define USB_PID_GUITARRIGMOBILE 0x0d8d + +#define EP1_BUFSIZE 64 +#define CAIAQ_USB_STR_LEN 0xff +#define MAX_STREAMS 32 + +//#define SND_USB_CAIAQ_DEBUG + +#define MODNAME "snd-usb-caiaq" +#define log(x...) snd_printk(KERN_WARNING MODNAME" log: " x) + +#ifdef SND_USB_CAIAQ_DEBUG +#define debug(x...) snd_printk(KERN_WARNING MODNAME " debug: " x) +#else +#define debug(x...) do { } while(0) +#endif + +#define EP1_CMD_GET_DEVICE_INFO 0x1 +#define EP1_CMD_READ_ERP 0x2 +#define EP1_CMD_READ_ANALOG 0x3 +#define EP1_CMD_READ_IO 0x4 +#define EP1_CMD_WRITE_IO 0x5 +#define EP1_CMD_MIDI_READ 0x6 +#define EP1_CMD_MIDI_WRITE 0x7 +#define EP1_CMD_AUDIO_PARAMS 0x9 +#define EP1_CMD_AUTO_MSG 0xb +#define EP1_CMD_DIMM_LEDS 0xc + +struct caiaq_device_spec { + unsigned short fw_version; + unsigned char hw_subtype; + unsigned char num_erp; + unsigned char num_analog_in; + unsigned char num_digital_in; + unsigned char num_digital_out; + unsigned char num_analog_audio_out; + unsigned char num_analog_audio_in; + unsigned char num_digital_audio_out; + unsigned char num_digital_audio_in; + unsigned char num_midi_out; + unsigned char num_midi_in; + unsigned char data_alignment; +} __attribute__ ((packed)); + +struct snd_usb_caiaq_cb_info; + +struct snd_usb_caiaqdev { + struct snd_usb_audio chip; + + struct urb ep1_in_urb; + struct urb midi_out_urb; + struct urb **data_urbs_in; + struct urb **data_urbs_out; + struct snd_usb_caiaq_cb_info *data_cb_info; + + unsigned char ep1_in_buf[EP1_BUFSIZE]; + unsigned char ep1_out_buf[EP1_BUFSIZE]; + unsigned char midi_out_buf[EP1_BUFSIZE]; + + struct caiaq_device_spec spec; + spinlock_t spinlock; + wait_queue_head_t ep1_wait_queue; + wait_queue_head_t prepare_wait_queue; + int spec_received, audio_parm_answer; + int midi_out_active; + + char vendor_name[CAIAQ_USB_STR_LEN]; + char product_name[CAIAQ_USB_STR_LEN]; + char serial[CAIAQ_USB_STR_LEN]; + + int n_streams, n_audio_in, n_audio_out; + int streaming, first_packet, output_running; + int audio_in_buf_pos[MAX_STREAMS]; + int audio_out_buf_pos[MAX_STREAMS]; + int period_in_count[MAX_STREAMS]; + int period_out_count[MAX_STREAMS]; + int input_panic, output_panic, warned; + char *audio_in_buf, *audio_out_buf; + unsigned int samplerates, bpp; + + struct snd_pcm_substream *sub_playback[MAX_STREAMS]; + struct snd_pcm_substream *sub_capture[MAX_STREAMS]; + + /* Controls */ + unsigned char control_state[64]; + + /* Linux input */ +#ifdef CONFIG_SND_USB_CAIAQ_INPUT + struct input_dev *input_dev; + char phys[64]; /* physical device path */ + unsigned short keycode[64]; +#endif + + /* ALSA */ + struct snd_pcm *pcm; + struct snd_pcm_hardware pcm_info; + struct snd_rawmidi *rmidi; + struct snd_rawmidi_substream *midi_receive_substream; + struct snd_rawmidi_substream *midi_out_substream; +}; + +struct snd_usb_caiaq_cb_info { + struct snd_usb_caiaqdev *dev; + int index; +}; + +#define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) + +int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp); +int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp); +int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, + unsigned char command, + const unsigned char *buffer, + int len); + +#endif /* CAIAQ_DEVICE_H */ diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c new file mode 100644 index 000000000000..a48d309bd94c --- /dev/null +++ b/sound/usb/caiaq/input.c @@ -0,0 +1,358 @@ +/* + * Copyright (c) 2006,2007 Daniel Mack, Tim Ruetz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include + +#include "device.h" +#include "input.h" + +static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; +static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, + KEY_5, KEY_6, KEY_7 }; +static unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, + KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 }; + +static unsigned short keycode_kore[] = { + KEY_FN_F1, /* "menu" */ + KEY_FN_F7, /* "lcd backlight */ + KEY_FN_F2, /* "control" */ + KEY_FN_F3, /* "enter" */ + KEY_FN_F4, /* "view" */ + KEY_FN_F5, /* "esc" */ + KEY_FN_F6, /* "sound" */ + KEY_FN_F8, /* array spacer, never triggered. */ + KEY_RIGHT, + KEY_DOWN, + KEY_UP, + KEY_LEFT, + KEY_SOUND, /* "listen" */ + KEY_RECORD, + KEY_PLAYPAUSE, + KEY_STOP, + BTN_4, /* 8 softkeys */ + BTN_3, + BTN_2, + BTN_1, + BTN_8, + BTN_7, + BTN_6, + BTN_5, + KEY_BRL_DOT4, /* touch sensitive knobs */ + KEY_BRL_DOT3, + KEY_BRL_DOT2, + KEY_BRL_DOT1, + KEY_BRL_DOT8, + KEY_BRL_DOT7, + KEY_BRL_DOT6, + KEY_BRL_DOT5 +}; + +#define DEG90 (range / 2) +#define DEG180 (range) +#define DEG270 (DEG90 + DEG180) +#define DEG360 (DEG180 * 2) +#define HIGH_PEAK (268) +#define LOW_PEAK (-7) + +/* some of these devices have endless rotation potentiometers + * built in which use two tapers, 90 degrees phase shifted. + * this algorithm decodes them to one single value, ranging + * from 0 to 999 */ +static unsigned int decode_erp(unsigned char a, unsigned char b) +{ + int weight_a, weight_b; + int pos_a, pos_b; + int ret; + int range = HIGH_PEAK - LOW_PEAK; + int mid_value = (HIGH_PEAK + LOW_PEAK) / 2; + + weight_b = abs(mid_value - a) - (range / 2 - 100) / 2; + + if (weight_b < 0) + weight_b = 0; + + if (weight_b > 100) + weight_b = 100; + + weight_a = 100 - weight_b; + + if (a < mid_value) { + /* 0..90 and 270..360 degrees */ + pos_b = b - LOW_PEAK + DEG270; + if (pos_b >= DEG360) + pos_b -= DEG360; + } else + /* 90..270 degrees */ + pos_b = HIGH_PEAK - b + DEG90; + + + if (b > mid_value) + /* 0..180 degrees */ + pos_a = a - LOW_PEAK; + else + /* 180..360 degrees */ + pos_a = HIGH_PEAK - a + DEG180; + + /* interpolate both slider values, depending on weight factors */ + /* 0..99 x DEG360 */ + ret = pos_a * weight_a + pos_b * weight_b; + + /* normalize to 0..999 */ + ret *= 10; + ret /= DEG360; + + if (ret < 0) + ret += 1000; + + if (ret >= 1000) + ret -= 1000; + + return ret; +} + +#undef DEG90 +#undef DEG180 +#undef DEG270 +#undef DEG360 +#undef HIGH_PEAK +#undef LOW_PEAK + + +static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, + const unsigned char *buf, + unsigned int len) +{ + struct input_dev *input_dev = dev->input_dev; + + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): + input_report_abs(input_dev, ABS_X, (buf[4] << 8) | buf[5]); + input_report_abs(input_dev, ABS_Y, (buf[0] << 8) | buf[1]); + input_report_abs(input_dev, ABS_Z, (buf[2] << 8) | buf[3]); + input_sync(input_dev); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + input_report_abs(input_dev, ABS_X, (buf[0] << 8) | buf[1]); + input_report_abs(input_dev, ABS_Y, (buf[2] << 8) | buf[3]); + input_report_abs(input_dev, ABS_Z, (buf[4] << 8) | buf[5]); + input_sync(input_dev); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): + input_report_abs(input_dev, ABS_X, (buf[0] << 8) | buf[1]); + input_report_abs(input_dev, ABS_Y, (buf[2] << 8) | buf[3]); + input_report_abs(input_dev, ABS_Z, (buf[4] << 8) | buf[5]); + input_sync(input_dev); + break; + } +} + +static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev, + const char *buf, unsigned int len) +{ + struct input_dev *input_dev = dev->input_dev; + int i; + + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): + i = decode_erp(buf[0], buf[1]); + input_report_abs(input_dev, ABS_X, i); + input_sync(input_dev); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): + i = decode_erp(buf[7], buf[5]); + input_report_abs(input_dev, ABS_HAT0X, i); + i = decode_erp(buf[12], buf[14]); + input_report_abs(input_dev, ABS_HAT0Y, i); + i = decode_erp(buf[15], buf[13]); + input_report_abs(input_dev, ABS_HAT1X, i); + i = decode_erp(buf[0], buf[2]); + input_report_abs(input_dev, ABS_HAT1Y, i); + i = decode_erp(buf[3], buf[1]); + input_report_abs(input_dev, ABS_HAT2X, i); + i = decode_erp(buf[8], buf[10]); + input_report_abs(input_dev, ABS_HAT2Y, i); + i = decode_erp(buf[11], buf[9]); + input_report_abs(input_dev, ABS_HAT3X, i); + i = decode_erp(buf[4], buf[6]); + input_report_abs(input_dev, ABS_HAT3Y, i); + input_sync(input_dev); + break; + } +} + +static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *dev, + char *buf, unsigned int len) +{ + struct input_dev *input_dev = dev->input_dev; + unsigned short *keycode = input_dev->keycode; + int i; + + if (!keycode) + return; + + if (input_dev->id.product == USB_PID_RIGKONTROL2) + for (i = 0; i < len; i++) + buf[i] = ~buf[i]; + + for (i = 0; i < input_dev->keycodemax && i < len * 8; i++) + input_report_key(input_dev, keycode[i], + buf[i / 8] & (1 << (i % 8))); + + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER) || + dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2)) + input_report_abs(dev->input_dev, ABS_MISC, 255 - buf[4]); + + input_sync(input_dev); +} + +void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, + char *buf, + unsigned int len) +{ + if (!dev->input_dev || len < 1) + return; + + switch (buf[0]) { + case EP1_CMD_READ_ANALOG: + snd_caiaq_input_read_analog(dev, buf + 1, len - 1); + break; + case EP1_CMD_READ_ERP: + snd_caiaq_input_read_erp(dev, buf + 1, len - 1); + break; + case EP1_CMD_READ_IO: + snd_caiaq_input_read_io(dev, buf + 1, len - 1); + break; + } +} + +int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) +{ + struct usb_device *usb_dev = dev->chip.dev; + struct input_dev *input; + int i, ret; + + input = input_allocate_device(); + if (!input) + return -ENOMEM; + + usb_make_path(usb_dev, dev->phys, sizeof(dev->phys)); + strlcat(dev->phys, "/input0", sizeof(dev->phys)); + + input->name = dev->product_name; + input->phys = dev->phys; + usb_to_input_id(usb_dev, &input->id); + input->dev.parent = &usb_dev->dev; + + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): + input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); + input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | + BIT_MASK(ABS_Z); + BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk2)); + memcpy(dev->keycode, keycode_rk2, sizeof(keycode_rk2)); + input->keycodemax = ARRAY_SIZE(keycode_rk2); + input_set_abs_params(input, ABS_X, 0, 4096, 0, 10); + input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); + input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); + snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): + input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); + input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | + BIT_MASK(ABS_Z); + BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk3)); + memcpy(dev->keycode, keycode_rk3, sizeof(keycode_rk3)); + input->keycodemax = ARRAY_SIZE(keycode_rk3); + input_set_abs_params(input, ABS_X, 0, 1024, 0, 10); + input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10); + input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10); + snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): + input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); + input->absbit[0] = BIT_MASK(ABS_X); + BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_ak1)); + memcpy(dev->keycode, keycode_ak1, sizeof(keycode_ak1)); + input->keycodemax = ARRAY_SIZE(keycode_ak1); + input_set_abs_params(input, ABS_X, 0, 999, 0, 10); + snd_usb_caiaq_set_auto_msg(dev, 1, 0, 5); + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): + input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); + input->absbit[0] = BIT_MASK(ABS_HAT0X) | BIT_MASK(ABS_HAT0Y) | + BIT_MASK(ABS_HAT1X) | BIT_MASK(ABS_HAT1Y) | + BIT_MASK(ABS_HAT2X) | BIT_MASK(ABS_HAT2Y) | + BIT_MASK(ABS_HAT3X) | BIT_MASK(ABS_HAT3Y) | + BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | + BIT_MASK(ABS_Z); + input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); + BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_kore)); + memcpy(dev->keycode, keycode_kore, sizeof(keycode_kore)); + input->keycodemax = ARRAY_SIZE(keycode_kore); + input_set_abs_params(input, ABS_HAT0X, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT0Y, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT1X, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT1Y, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT2X, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT2Y, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT3X, 0, 999, 0, 10); + input_set_abs_params(input, ABS_HAT3Y, 0, 999, 0, 10); + input_set_abs_params(input, ABS_X, 0, 4096, 0, 10); + input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); + input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); + input_set_abs_params(input, ABS_MISC, 0, 255, 0, 1); + snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5); + break; + default: + /* no input methods supported on this device */ + input_free_device(input); + return 0; + } + + input->keycode = dev->keycode; + input->keycodesize = sizeof(unsigned short); + for (i = 0; i < input->keycodemax; i++) + __set_bit(dev->keycode[i], input->keybit); + + ret = input_register_device(input); + if (ret < 0) { + input_free_device(input); + return ret; + } + + dev->input_dev = input; + return 0; +} + +void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev) +{ + if (!dev || !dev->input_dev) + return; + + input_unregister_device(dev->input_dev); + dev->input_dev = NULL; +} + diff --git a/sound/usb/caiaq/input.h b/sound/usb/caiaq/input.h new file mode 100644 index 000000000000..ced535577864 --- /dev/null +++ b/sound/usb/caiaq/input.h @@ -0,0 +1,8 @@ +#ifndef CAIAQ_INPUT_H +#define CAIAQ_INPUT_H + +void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, char *buf, unsigned int len); +int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev); +void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev); + +#endif diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c new file mode 100644 index 000000000000..8fa8cd88d763 --- /dev/null +++ b/sound/usb/caiaq/midi.c @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2006,2007 Daniel Mack + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include + +#include "device.h" +#include "midi.h" + +static int snd_usb_caiaq_midi_input_open(struct snd_rawmidi_substream *substream) +{ + return 0; +} + +static int snd_usb_caiaq_midi_input_close(struct snd_rawmidi_substream *substream) +{ + return 0; +} + +static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) +{ + struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; + + if (!dev) + return; + + dev->midi_receive_substream = up ? substream : NULL; +} + + +static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substream) +{ + return 0; +} + +static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) +{ + struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; + if (dev->midi_out_active) { + usb_kill_urb(&dev->midi_out_urb); + dev->midi_out_active = 0; + } + return 0; +} + +static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, + struct snd_rawmidi_substream *substream) +{ + int len, ret; + + dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; + dev->midi_out_buf[1] = 0; /* port */ + len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, + EP1_BUFSIZE - 3); + + if (len <= 0) + return; + + dev->midi_out_buf[2] = len; + dev->midi_out_urb.transfer_buffer_length = len+3; + + ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); + if (ret < 0) + log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," + "ret=%d, len=%d\n", + substream, ret, len); + else + dev->midi_out_active = 1; +} + +static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) +{ + struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; + + if (up) { + dev->midi_out_substream = substream; + if (!dev->midi_out_active) + snd_usb_caiaq_midi_send(dev, substream); + } else { + dev->midi_out_substream = NULL; + } +} + + +static struct snd_rawmidi_ops snd_usb_caiaq_midi_output = +{ + .open = snd_usb_caiaq_midi_output_open, + .close = snd_usb_caiaq_midi_output_close, + .trigger = snd_usb_caiaq_midi_output_trigger, +}; + +static struct snd_rawmidi_ops snd_usb_caiaq_midi_input = +{ + .open = snd_usb_caiaq_midi_input_open, + .close = snd_usb_caiaq_midi_input_close, + .trigger = snd_usb_caiaq_midi_input_trigger, +}; + +void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, + int port, const char *buf, int len) +{ + if (!dev->midi_receive_substream) + return; + + snd_rawmidi_receive(dev->midi_receive_substream, buf, len); +} + +int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) +{ + int ret; + struct snd_rawmidi *rmidi; + + ret = snd_rawmidi_new(device->chip.card, device->product_name, 0, + device->spec.num_midi_out, + device->spec.num_midi_in, + &rmidi); + + if (ret < 0) + return ret; + + strcpy(rmidi->name, device->product_name); + + rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX; + rmidi->private_data = device; + + if (device->spec.num_midi_out > 0) { + rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT; + snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, + &snd_usb_caiaq_midi_output); + } + + if (device->spec.num_midi_in > 0) { + rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT; + snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, + &snd_usb_caiaq_midi_input); + } + + device->rmidi = rmidi; + + return 0; +} + +void snd_usb_caiaq_midi_output_done(struct urb* urb) +{ + struct snd_usb_caiaqdev *dev = urb->context; + + dev->midi_out_active = 0; + if (urb->status != 0) + return; + + if (!dev->midi_out_substream) + return; + + snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); +} + diff --git a/sound/usb/caiaq/midi.h b/sound/usb/caiaq/midi.h new file mode 100644 index 000000000000..9d16db027fc3 --- /dev/null +++ b/sound/usb/caiaq/midi.h @@ -0,0 +1,8 @@ +#ifndef CAIAQ_MIDI_H +#define CAIAQ_MIDI_H + +int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); +void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); +void snd_usb_caiaq_midi_output_done(struct urb* urb); + +#endif /* CAIAQ_MIDI_H */ -- cgit v1.2.3 From 9d59065cd6fae841ca56c281189d5b8d0817d35f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 14 Apr 2009 16:13:58 +0200 Subject: ALSA: add private_data to struct snd_jack Added private_data and private_free fields to struct snd_jack so that the caller can assign the data. It'll be helpful for avoiding the double-free of the jack instance. Signed-off-by: Takashi Iwai --- include/sound/jack.h | 2 ++ sound/core/jack.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'sound') diff --git a/include/sound/jack.h b/include/sound/jack.h index 6b013c6f6a04..f236e426a706 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -50,6 +50,8 @@ struct snd_jack { int type; const char *id; char name[100]; + void *private_data; + void (*private_free)(struct snd_jack *); }; #ifdef CONFIG_SND_JACK diff --git a/sound/core/jack.c b/sound/core/jack.c index c8254c667c62..d54d1a05fe65 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -35,6 +35,9 @@ static int snd_jack_dev_free(struct snd_device *device) { struct snd_jack *jack = device->device_data; + if (jack->private_free) + jack->private_free(jack); + /* If the input device is registered with the input subsystem * then we need to use a different deallocator. */ if (jack->registered) -- cgit v1.2.3 From 95c0909961bc5ff18c78b2ab0d093cddc0a8b0b5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 14 Apr 2009 16:15:29 +0200 Subject: ALSA: hda - Avoid call of snd_jack_report at release Don't call snd_jack_report at release of sigmatel and conexnat codecs which results in Oops at unloading the module. The Oops is triggered by the power-up sequence during the free due to the pincfg restoration. Since the power-up sequence is involved with the unsol handling, the jack reporting may be issued during that. The Oops occurs with this jack reporting because the jack instances have been already released but the codec doesn't do the proper book-keeping. This patch adds the book-keeping of jack instances to avoid the access to bogus pointers. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 21 ++++++++++++++++++--- sound/pci/hda/patch_sigmatel.c | 27 ++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 1f2ad76ca94b..56ce19e68cb5 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -350,12 +350,20 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, } #ifdef CONFIG_SND_JACK +static void conexant_free_jack_priv(struct snd_jack *jack) +{ + struct conexant_jack *jacks = jack->private_data; + jacks->nid = 0; + jacks->jack = NULL; +} + static int conexant_add_jack(struct hda_codec *codec, hda_nid_t nid, int type) { struct conexant_spec *spec; struct conexant_jack *jack; const char *name; + int err; spec = codec->spec; snd_array_init(&spec->jacks, sizeof(*jack), 32); @@ -368,7 +376,12 @@ static int conexant_add_jack(struct hda_codec *codec, jack->nid = nid; jack->type = type; - return snd_jack_new(codec->bus->card, name, type, &jack->jack); + err = snd_jack_new(codec->bus->card, name, type, &jack->jack); + if (err < 0) + return err; + jack->jack->private_data = jack; + jack->jack->private_free = conexant_free_jack_priv; + return 0; } static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) @@ -455,8 +468,10 @@ static void conexant_free(struct hda_codec *codec) if (spec->jacks.list) { struct conexant_jack *jacks = spec->jacks.list; int i; - for (i = 0; i < spec->jacks.used; i++) - snd_device_free(codec->bus->card, &jacks[i].jack); + for (i = 0; i < spec->jacks.used; i++, jacks++) { + if (jacks->jack) + snd_device_free(codec->bus->card, jacks->jack); + } snd_array_free(&spec->jacks); } #endif diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 61996a2f45df..ce30b459aee6 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3851,6 +3851,15 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ } +#ifdef CONFIG_SND_JACK +static void stac92xx_free_jack_priv(struct snd_jack *jack) +{ + struct sigmatel_jack *jacks = jack->private_data; + jacks->nid = 0; + jacks->jack = NULL; +} +#endif + static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type) { @@ -3860,6 +3869,7 @@ static int stac92xx_add_jack(struct hda_codec *codec, int def_conf = snd_hda_codec_get_pincfg(codec, nid); int connectivity = get_defcfg_connect(def_conf); char name[32]; + int err; if (connectivity && connectivity != AC_JACK_PORT_FIXED) return 0; @@ -3876,10 +3886,15 @@ static int stac92xx_add_jack(struct hda_codec *codec, snd_hda_get_jack_connectivity(def_conf), snd_hda_get_jack_location(def_conf)); - return snd_jack_new(codec->bus->card, name, type, &jack->jack); -#else - return 0; + err = snd_jack_new(codec->bus->card, name, type, &jack->jack); + if (err < 0) { + jack->nid = 0; + return err; + } + jack->jack->private_data = jack; + jack->jack->private_free = stac92xx_free_jack_priv; #endif + return 0; } static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, @@ -4138,8 +4153,10 @@ static void stac92xx_free_jacks(struct hda_codec *codec) if (!codec->bus->shutdown && spec->jacks.list) { struct sigmatel_jack *jacks = spec->jacks.list; int i; - for (i = 0; i < spec->jacks.used; i++) - snd_device_free(codec->bus->card, &jacks[i].jack); + for (i = 0; i < spec->jacks.used; i++, jacks++) { + if (jacks->jack) + snd_device_free(codec->bus->card, jacks->jack); + } } snd_array_free(&spec->jacks); #endif -- cgit v1.2.3 From 29dab4fd3176e25dfab6cd763beb02d87973c288 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 14 Apr 2009 22:40:04 +0200 Subject: [ALSA] intel8x0: fix wrong conditions in ac97_clock measure routine Also add a little code cleanup. Signed-off-by: Jaroslav Kysela --- sound/pci/intel8x0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 6962f94d1bea..10f8609e9c6e 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2689,7 +2689,7 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) } ichdev = &chip->ichd[ICHD_PCMOUT]; ichdev->physbuf = subs->dma_buffer.addr; - ichdev->size = chip->ichd[ICHD_PCMOUT].fragsize = INTEL8X0_TESTBUF_SIZE; + ichdev->size = ichdev->fragsize = INTEL8X0_TESTBUF_SIZE; ichdev->substream = NULL; /* don't process interrupts */ /* set rate */ @@ -2766,10 +2766,10 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) if (pos < 40000 || pos >= 60000) /* abnormal value. hw problem? */ printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos); - else if (pos > 40500 || pos < 41500) + else if (pos > 40500 && pos < 41500) /* first exception - 41000Hz reference clock */ chip->ac97_bus->clock = 41000; - else if (pos > 43600 || pos < 44600) + else if (pos > 43600 && pos < 44600) /* second exception - 44100HZ reference clock */ chip->ac97_bus->clock = 44100; else if (pos < 47500 || pos > 48500) -- cgit v1.2.3 From 5e901b37e4a8a305542ad3a776bce997efd7e5e9 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 9 Apr 2009 14:07:27 +0800 Subject: [ARM] pxa/magician: remove un-necessary #include of pxa-regs.h and hardware.h Signed-off-by: Eric Miao Cc: Philipp Zabel Cc: Mark Brown --- sound/soc/pxa/magician.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c index f7c4544f7859..0625c342a1c9 100644 --- a/sound/soc/pxa/magician.c +++ b/sound/soc/pxa/magician.c @@ -27,8 +27,6 @@ #include #include -#include -#include #include #include #include "../codecs/uda1380.h" -- cgit v1.2.3 From eae17754ab1ffc88190ebcbd33b6bec79e6e559a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 13 Apr 2009 11:48:03 +0100 Subject: [ARM] pxa: merge AC97 platform data structures Currently there are two possible platform datas for the PXA AC97 driver: one supported by the generic AC97 driver only which provides callbacks to allow board-specific configuration at stream startup and teardown, and another for pxa2xx-ac97-lib which allows configuration of the reset GPIO for PXA2xx CPUs. Obviously this won't actually work when using the generic AC97 driver since the drivers will attempt to parse the platform data in both formats. Fix this by merging the two structures. Signed-off-by: Mark Brown Acked-by: Robert Jarzmik Cc: Marek Vasut Signed-off-by: Eric Miao --- arch/arm/mach-pxa/include/mach/audio.h | 10 ++++++++++ include/sound/pxa2xx-lib.h | 15 --------------- sound/arm/pxa2xx-ac97-lib.c | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h index f82f96dd1053..16eb02552d5d 100644 --- a/arch/arm/mach-pxa/include/mach/audio.h +++ b/arch/arm/mach-pxa/include/mach/audio.h @@ -4,12 +4,22 @@ #include #include +/* + * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) + * a -1 value means no gpio will be used for reset + + * reset_gpio should only be specified for pxa27x CPUs where a silicon + * bug prevents correct operation of the reset line. If not specified, + * the default behaviour on these CPUs is to consider gpio 113 as the + * AC97 reset line, which is the default on most boards. + */ typedef struct { int (*startup)(struct snd_pcm_substream *, void *); void (*shutdown)(struct snd_pcm_substream *, void *); void (*suspend)(void *); void (*resume)(void *); void *priv; + int reset_gpio; } pxa2xx_audio_ops_t; extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops); diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index 2c894b600e5b..2fd3d251d9a5 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -42,19 +42,4 @@ extern int pxa2xx_ac97_hw_resume(void); extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); -/* AC97 platform_data */ -/** - * struct pxa2xx_ac97_platform_data - pxa ac97 platform data - * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) - * a -1 value means no gpio will be used for reset - * - * Platform data should only be specified for pxa27x CPUs where a silicon bug - * prevents correct operation of the reset line. If not specified, the default - * behaviour is to consider gpio 113 as the AC97 reset line, which is the - * default on most boards. - */ -struct pxa2xx_ac97_platform_data { - int reset_gpio; -}; - #endif diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 0afd1a8226fb..a2c12d105c9a 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c @@ -364,7 +364,7 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume); int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) { int ret; - struct pxa2xx_ac97_platform_data *pdata = dev->dev.platform_data; + pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; if (pdata) { switch (pdata->reset_gpio) { -- cgit v1.2.3 From 2ec775e7053c82bc90858ede011b35aeb416995b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 15 Apr 2009 10:16:24 +0200 Subject: [ALSA] intel8x0: add one retry to the ac97_clock measurement routine It seems that on some hardware platforms, the first measurement is wrong. This patch adds second measurement to this case. Signed-off-by: Jaroslav Kysela --- sound/pci/intel8x0.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 10f8609e9c6e..5dced5b79387 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2676,12 +2676,13 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) struct ichdev *ichdev; unsigned long port; unsigned long pos, pos1, t; - int civ, timeout = 1000; + int civ, timeout = 1000, attempt = 1; struct timespec start_time, stop_time; if (chip->ac97_bus->clock != 48000) return; /* specified in module option */ + __again: subs = chip->pcm[0]->streams[0].substream; if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { snd_printk(KERN_WARNING "no playback buffer allocated - aborting measure ac97 clock\n"); @@ -2749,6 +2750,11 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) if (pos == 0) { snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); + __retry: + if (attempt < 2) { + attempt++; + goto __again; + } return; } @@ -2759,14 +2765,15 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) printk(KERN_INFO "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); if (t == 0) { snd_printk(KERN_ERR "intel8x0: ?? calculation error..\n"); - return; + goto __retry; } pos *= 1000; pos = (pos / t) * 1000 + ((pos % t) * 1000) / t; - if (pos < 40000 || pos >= 60000) + if (pos < 40000 || pos >= 60000) { /* abnormal value. hw problem? */ printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos); - else if (pos > 40500 && pos < 41500) + goto __retry; + } else if (pos > 40500 && pos < 41500) /* first exception - 41000Hz reference clock */ chip->ac97_bus->clock = 41000; else if (pos > 43600 && pos < 44600) -- cgit v1.2.3 From bfb53037c61ddf7c16a40297ad16f2bcbde534dc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 14 Apr 2009 14:51:04 +0200 Subject: ALSA: hda - Add quirk mask for Fujitsu Amilo laptops with ALC883 Added the models for quirk bitmask 1734:110x and 1734:113x of Fujitsu laptops. This will fix the model detection for Amilo Xa3540. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index f35e58a2d921..6ed787eedd06 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8742,10 +8742,9 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), - SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", + SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", ALC883_FUJITSU_PI2515), - SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), - SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", + SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", ALC888_FUJITSU_XA3530), SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), -- cgit v1.2.3 From fcad94a4c71c36a05f4d5c6dcb174534b4e0b136 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 15 Apr 2009 17:48:35 +0200 Subject: ALSA: hda - Fix the cmd cache keys for amp verbs Fix the key value generation for get/set amp verbs. The upper bits of the parameter have to be combined with the verb value to be unique for each direction/index of amp access. This fixes the resume problem on some hardwares like Macbook after the channel mode is changed. Tested-by: Johannes Berg Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index a4e5e5952115..fd6e6f337d10 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2250,7 +2250,11 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, err = bus->ops.command(bus, res); if (!err) { struct hda_cache_head *c; - u32 key = build_cmd_cache_key(nid, verb); + u32 key; + /* parm may contain the verb stuff for get/set amp */ + verb = verb | (parm >> 8); + parm &= 0xff; + key = build_cmd_cache_key(nid, verb); c = get_alloc_hash(&codec->cmd_cache, key); if (c) c->val = parm; -- cgit v1.2.3 From d523b0c808a5c5cbde9ac89427d98ee6288f5f2f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 15 Apr 2009 11:39:01 -0700 Subject: ALSA: hda_intel.c - Consolidate bitfields Commit fa00e046b41663cbda9b1affc0594669e5f14219 added a new bitfield not adjacent to other bitfields in the same struct. Moved the new one. Signed-off-by: Joe Perches Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index bc882f8f163c..21e99cfa8c49 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -312,7 +312,6 @@ struct azx_dev { unsigned int period_bytes; /* size of the period in bytes */ unsigned int frags; /* number for period in the play buffer */ unsigned int fifo_size; /* FIFO size */ - unsigned int start_flag: 1; /* stream full start flag */ unsigned long start_jiffies; /* start + minimum jiffies */ unsigned long min_jiffies; /* minimum jiffies before position is valid */ @@ -333,6 +332,7 @@ struct azx_dev { unsigned int opened :1; unsigned int running :1; unsigned int irq_pending :1; + unsigned int start_flag: 1; /* stream full start flag */ /* * For VIA: * A flag to ensure DMA position is 0 -- cgit v1.2.3 From 4611b043ce9c45cd8ac760b8379b02ceffe26b0d Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Wed, 15 Apr 2009 19:43:35 -0400 Subject: ALSA: Intel8x0: Remove conflicting quirk for SSID 0x103c0934 While cleaning up quirks, I noticed that there is a duplicated quirk for the SSID 0x103c0934. Looking back through the bug reports, I've concluded that there is only one necessary quirk (hp_mute_led), so this patch removes the conflicting one. Reference: Ubuntu #44066 (https://launchpad.net/bugs/44066) Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5dced5b79387..b3180d063d3a 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1894,12 +1894,6 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "HP nc6000", .type = AC97_TUNE_MUTE_LED }, - { - .subvendor = 0x103c, - .subdevice = 0x0934, - .name = "HP nx8220", - .type = AC97_TUNE_MUTE_LED - }, { .subvendor = 0x103c, .subdevice = 0x129d, -- cgit v1.2.3 From c82834251ceb81b7575927c767500bd8c4a7f928 Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Wed, 15 Apr 2009 19:48:08 -0400 Subject: ALSA: Intel8x0: Add hp_only quirk for SSID 0x1028016a (Dell Inspiron 8600) Subject says it all. Briefly, use hp_only for another Dell Inspiron 8600. Reference: Ubuntu #41015 (https://launchpad.net/bugs/41015) Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index b3180d063d3a..8042d5398892 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1852,6 +1852,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "Dell Unknown", /* STAC9750/51 */ .type = AC97_TUNE_HP_ONLY }, + { + .subvendor = 0x1028, + .subdevice = 0x016a, + .name = "Dell Inspiron 8600", /* STAC9750/51 */ + .type = AC97_TUNE_HP_ONLY + }, { .subvendor = 0x1028, .subdevice = 0x0186, -- cgit v1.2.3 From ffd0e56c606836581da5df742a43ce8015ca7475 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 16 Apr 2009 12:20:24 +0200 Subject: ALSA: hda - Fix headphone-detection on some machines with STAC/IDT codecs When the headphone can have no unique DAC, the current code doesn't check the HP-detection although it should. Put the hp-detection check before the DAC check to fix this bug. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ce30b459aee6..917bc5d3ac2c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3076,6 +3076,11 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, unsigned int wid_caps; for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { + if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { + wid_caps = get_wcaps(codec, pins[i]); + if (wid_caps & AC_WCAP_UNSOL_CAP) + spec->hp_detect = 1; + } nid = dac_nids[i]; if (!nid) continue; @@ -3119,11 +3124,6 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, err = create_controls_idx(codec, name, idx, nid, 3); if (err < 0) return err; - if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { - wid_caps = get_wcaps(codec, pins[i]); - if (wid_caps & AC_WCAP_UNSOL_CAP) - spec->hp_detect = 1; - } } } return 0; -- cgit v1.2.3 From 4dc1f87f079d5c6b01284d08b28eff2c4fbd15c4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 16 Apr 2009 14:19:19 +0200 Subject: ALSA: hda - Add upper-limit of mixer amp for AD1884A-laptop model, too Add the upper-limit of mixer amp for AD1884A-laptop model just like the mobile model for some HP laptops. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 38ad3f7b040f..9bcd8ab5a27f 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3977,6 +3977,14 @@ static int patch_ad1884a(struct hda_codec *codec) spec->input_mux = &ad1884a_laptop_capture_source; codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; codec->patch_ops.init = ad1884a_hp_init; + /* set the upper-limit for mixer amp to 0dB for avoiding the + * possible damage by overloading + */ + snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, + (0x17 << AC_AMPCAP_OFFSET_SHIFT) | + (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | + (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | + (1 << AC_AMPCAP_MUTE_SHIFT)); break; case AD1884A_MOBILE: spec->mixers[0] = ad1884a_mobile_mixers; -- cgit v1.2.3 From 5a47fa3d30b5d1977b4e7d1daf5ba5b577258ce1 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Thu, 16 Apr 2009 23:54:04 +0200 Subject: ALSA: emu10k1 - off by 1 in snd_emu10k1_wait() With `while (count++ < 16384)' count reaches 16385. Signed-off-by: Roel Kluin Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index 4bfc31d1b281..c1a5aa15af8f 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -490,7 +490,7 @@ void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait) if (newtime != curtime) break; } - if (count >= 16384) + if (count > 16384) break; curtime = newtime; } -- cgit v1.2.3 From f600f6c4824d7e40be370f7e26ab0fbc3f6f911c Mon Sep 17 00:00:00 2001 From: Karsten Wiese Date: Thu, 16 Apr 2009 19:35:01 +0200 Subject: ALSA: us122l: Fix signedness in comparisions Within 2.6.30's mergewindow, struct urb's transfer_buffer_length has become unsigned. This changed an "int > int" comparision to an "unsigned > int" one in snd_usb_122l. Fix this by using a local int variable instead of urb->transfer_buffer_length in comparisions. Shorten playback_prep_freqn() a bit and tweak error-paths in usb_stream_prepare_playback(). Signed-off-by: Karsten Wiese Signed-off-by: Takashi Iwai --- sound/usb/usx2y/usb_stream.c | 67 ++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 37 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 24393dafcb6e..12ae0340adc0 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -33,32 +33,26 @@ static unsigned usb_stream_next_packet_size(struct usb_stream_kernel *sk) static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb) { struct usb_stream *s = sk->s; - unsigned l = 0; - int pack; - - urb->iso_frame_desc[0].offset = 0; - urb->iso_frame_desc[0].length = usb_stream_next_packet_size(sk); - sk->out_phase = sk->out_phase_peeked; - urb->transfer_buffer_length = urb->iso_frame_desc[0].length; - - for (pack = 1; pack < sk->n_o_ps; pack++) { - l = usb_stream_next_packet_size(sk); - if (s->idle_outsize + urb->transfer_buffer_length + l > - s->period_size) + int pack, lb = 0; + + for (pack = 0; pack < sk->n_o_ps; pack++) { + int l = usb_stream_next_packet_size(sk); + if (s->idle_outsize + lb + l > s->period_size) goto check; sk->out_phase = sk->out_phase_peeked; - urb->iso_frame_desc[pack].offset = urb->transfer_buffer_length; + urb->iso_frame_desc[pack].offset = lb; urb->iso_frame_desc[pack].length = l; - urb->transfer_buffer_length += l; + lb += l; } - snd_printdd(KERN_DEBUG "%i\n", urb->transfer_buffer_length); + snd_printdd(KERN_DEBUG "%i\n", lb); check: urb->number_of_packets = pack; - s->idle_outsize += urb->transfer_buffer_length - s->period_size; + urb->transfer_buffer_length = lb; + s->idle_outsize += lb - s->period_size; snd_printdd(KERN_DEBUG "idle=%i ul=%i ps=%i\n", s->idle_outsize, - urb->transfer_buffer_length, s->period_size); + lb, s->period_size); } static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, @@ -282,21 +276,20 @@ static int usb_stream_prepare_playback(struct usb_stream_kernel *sk, struct usb_stream *s = sk->s; struct urb *io; struct usb_iso_packet_descriptor *id, *od; - int p, l = 0; + int p = 0, lb = 0, l = 0; io = sk->idle_outurb; od = io->iso_frame_desc; - io->transfer_buffer_length = 0; - for (p = 0; s->sync_packet < 0; ++p, ++s->sync_packet) { + for (; s->sync_packet < 0; ++p, ++s->sync_packet) { struct urb *ii = sk->completed_inurb; id = ii->iso_frame_desc + ii->number_of_packets + s->sync_packet; l = id->actual_length; od[p].length = l; - od[p].offset = io->transfer_buffer_length; - io->transfer_buffer_length += l; + od[p].offset = lb; + lb += l; } for (; @@ -304,38 +297,38 @@ static int usb_stream_prepare_playback(struct usb_stream_kernel *sk, ++p, ++s->sync_packet) { l = inurb->iso_frame_desc[s->sync_packet].actual_length; - if (s->idle_outsize + io->transfer_buffer_length + l > - s->period_size) + if (s->idle_outsize + lb + l > s->period_size) goto check_ok; od[p].length = l; - od[p].offset = io->transfer_buffer_length; - io->transfer_buffer_length += l; + od[p].offset = lb; + lb += l; } check_ok: s->sync_packet -= inurb->number_of_packets; - if (s->sync_packet < -2 || s->sync_packet > 0) { + if (unlikely(s->sync_packet < -2 || s->sync_packet > 0)) { snd_printk(KERN_WARNING "invalid sync_packet = %i;" " p=%i nop=%i %i %x %x %x > %x\n", s->sync_packet, p, inurb->number_of_packets, - s->idle_outsize + io->transfer_buffer_length + l, - s->idle_outsize, io->transfer_buffer_length, l, + s->idle_outsize + lb + l, + s->idle_outsize, lb, l, s->period_size); return -1; } - if (io->transfer_buffer_length % s->cfg.frame_size) { + if (unlikely(lb % s->cfg.frame_size)) { snd_printk(KERN_WARNING"invalid outsize = %i\n", - io->transfer_buffer_length); + lb); return -1; } - s->idle_outsize += io->transfer_buffer_length - s->period_size; + s->idle_outsize += lb - s->period_size; io->number_of_packets = p; - if (s->idle_outsize > 0) { - snd_printk(KERN_WARNING "idle=%i\n", s->idle_outsize); - return -1; - } - return 0; + io->transfer_buffer_length = lb; + if (s->idle_outsize <= 0) + return 0; + + snd_printk(KERN_WARNING "idle=%i\n", s->idle_outsize); + return -1; } static void prepare_inurb(int number_of_packets, struct urb *iu) -- cgit v1.2.3 From 93e82ae781e1ca4797cf2a226d3c303975bd99c7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 17 Apr 2009 18:04:41 +0200 Subject: ALSA: hda - Set function_id only on FG nodes (Re)set function_id only from the value on FG nodes. The current code overrides the value with the last widget. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index fd6e6f337d10..8820faf6c9d8 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -642,19 +642,21 @@ static int get_codec_name(struct hda_codec *codec) */ static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) { - int i, total_nodes; + int i, total_nodes, function_id; hda_nid_t nid; total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); for (i = 0; i < total_nodes; i++, nid++) { - codec->function_id = snd_hda_param_read(codec, nid, + function_id = snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE) & 0xff; - switch (codec->function_id) { + switch (function_id) { case AC_GRP_AUDIO_FUNCTION: codec->afg = nid; + codec->function_id = function_id; break; case AC_GRP_MODEM_FUNCTION: codec->mfg = nid; + codec->function_id = function_id; break; default: break; -- cgit v1.2.3 From e91fb9137dd235ab959d7675d0e4104974dad5eb Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 17 Apr 2009 11:37:35 +0200 Subject: [ARM] pxa/palm27x: General fix for Palm27x aSoC driver Firstly, this patch makes the palm27x asoc driver a little more sane. Also, since all affected devices use GPIO95 as AC97_nRESET, this patch sets that properly. Affected are PalmT5, TX and LifeDrive. Signed-off-by: Marek Vasut Signed-off-by: Eric Miao --- arch/arm/mach-pxa/include/mach/palmasoc.h | 7 +------ arch/arm/mach-pxa/palmld.c | 18 +++++++++++++++--- arch/arm/mach-pxa/palmt5.c | 18 +++++++++++++++--- arch/arm/mach-pxa/palmtx.c | 23 ++++++++++++++++++++++- sound/soc/pxa/palm27x.c | 27 +++++++++++++++++++++++---- 5 files changed, 76 insertions(+), 17 deletions(-) (limited to 'sound') diff --git a/arch/arm/mach-pxa/include/mach/palmasoc.h b/arch/arm/mach-pxa/include/mach/palmasoc.h index 6c4b1f7de20a..58afb30d5298 100644 --- a/arch/arm/mach-pxa/include/mach/palmasoc.h +++ b/arch/arm/mach-pxa/include/mach/palmasoc.h @@ -1,13 +1,8 @@ #ifndef _INCLUDE_PALMASOC_H_ #define _INCLUDE_PALMASOC_H_ + struct palm27x_asoc_info { int jack_gpio; }; -#ifdef CONFIG_SND_PXA2XX_SOC_PALM27X -void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data); -#else -static inline void palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) {} -#endif - #endif diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index ecf5910e39d7..1cec1806f002 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c @@ -477,10 +477,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { /****************************************************************************** * aSoC audio ******************************************************************************/ -static struct palm27x_asoc_info palm27x_asoc_pdata = { +static struct palm27x_asoc_info palmld_asoc_pdata = { .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT, }; +static pxa2xx_audio_ops_t palmld_ac97_pdata = { + .reset_gpio = 95, +}; + +static struct platform_device palmld_asoc = { + .name = "palm27x-asoc", + .id = -1, + .dev = { + .platform_data = &palmld_asoc_pdata, + }, +}; + /****************************************************************************** * Framebuffer ******************************************************************************/ @@ -544,6 +556,7 @@ static struct platform_device *devices[] __initdata = { &palmld_backlight, &palmld_leds, &power_supply, + &palmld_asoc, }; static struct map_desc palmld_io_desc[] __initdata = { @@ -573,11 +586,10 @@ static void __init palmld_init(void) set_pxa_fb_info(&palmld_lcd_screen); pxa_set_mci_info(&palmld_mci_platform_data); - pxa_set_ac97_info(NULL); + pxa_set_ac97_info(&palmld_ac97_pdata); pxa_set_ficp_info(&palmld_ficp_platform_data); pxa_set_keypad_info(&palmld_keypad_platform_data); wm97xx_bat_set_pdata(&wm97xx_batt_pdata); - palm27x_asoc_set_pdata(&palm27x_asoc_pdata); platform_add_devices(devices, ARRAY_SIZE(devices)); } diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index d7f81068c613..30662363907b 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c @@ -420,10 +420,22 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { /****************************************************************************** * aSoC audio ******************************************************************************/ -static struct palm27x_asoc_info palm27x_asoc_pdata = { +static struct palm27x_asoc_info palmt5_asoc_pdata = { .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, }; +static pxa2xx_audio_ops_t palmt5_ac97_pdata = { + .reset_gpio = 95, +}; + +static struct platform_device palmt5_asoc = { + .name = "palm27x-asoc", + .id = -1, + .dev = { + .platform_data = &palmt5_asoc_pdata, + }, +}; + /****************************************************************************** * Framebuffer ******************************************************************************/ @@ -486,6 +498,7 @@ static struct platform_device *devices[] __initdata = { #endif &palmt5_backlight, &power_supply, + &palmt5_asoc, }; /* setup udc GPIOs initial state */ @@ -504,12 +517,11 @@ static void __init palmt5_init(void) set_pxa_fb_info(&palmt5_lcd_screen); pxa_set_mci_info(&palmt5_mci_platform_data); palmt5_udc_init(); + pxa_set_ac97_info(&palmt5_ac97_pdata); pxa_set_udc_info(&palmt5_udc_info); - pxa_set_ac97_info(NULL); pxa_set_ficp_info(&palmt5_ficp_platform_data); pxa_set_keypad_info(&palmt5_keypad_platform_data); wm97xx_bat_set_pdata(&wm97xx_batt_pdata); - palm27x_asoc_set_pdata(&palm27x_asoc_pdata); platform_add_devices(devices, ARRAY_SIZE(devices)); } diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index 14393d0ad8b8..e2d44b1a8a9b 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "generic.h" #include "devices.h" @@ -433,6 +434,25 @@ static struct wm97xx_batt_info wm97xx_batt_pdata = { .batt_name = "main-batt", }; +/****************************************************************************** + * aSoC audio + ******************************************************************************/ +static struct palm27x_asoc_info palmtx_asoc_pdata = { + .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT, +}; + +static pxa2xx_audio_ops_t palmtx_ac97_pdata = { + .reset_gpio = 95, +}; + +static struct platform_device palmtx_asoc = { + .name = "palm27x-asoc", + .id = -1, + .dev = { + .platform_data = &palmtx_asoc_pdata, + }, +}; + /****************************************************************************** * Framebuffer ******************************************************************************/ @@ -495,6 +515,7 @@ static struct platform_device *devices[] __initdata = { #endif &palmtx_backlight, &power_supply, + &palmtx_asoc, }; static struct map_desc palmtx_io_desc[] __initdata = { @@ -529,8 +550,8 @@ static void __init palmtx_init(void) set_pxa_fb_info(&palmtx_lcd_screen); pxa_set_mci_info(&palmtx_mci_platform_data); palmtx_udc_init(); + pxa_set_ac97_info(&palmtx_ac97_pdata); pxa_set_udc_info(&palmtx_udc_info); - pxa_set_ac97_info(NULL); pxa_set_ficp_info(&palmtx_ficp_platform_data); pxa_set_keypad_info(&palmtx_keypad_platform_data); wm97xx_bat_set_pdata(&wm97xx_batt_pdata); diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 48a73f64500b..44fcc4e01e08 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c @@ -200,7 +200,7 @@ static struct snd_soc_device palm27x_snd_devdata = { static struct platform_device *palm27x_snd_device; -static int __init palm27x_asoc_init(void) +static int palm27x_asoc_probe(struct platform_device *pdev) { int ret; @@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void) machine_is_palmld())) return -ENODEV; + if (pdev->dev.platform_data) + palm27x_ep_gpio = ((struct palm27x_asoc_info *) + (pdev->dev.platform_data))->jack_gpio; + ret = gpio_request(palm27x_ep_gpio, "Headphone Jack"); if (ret) return ret; @@ -245,16 +249,31 @@ err_alloc: return ret; } -static void __exit palm27x_asoc_exit(void) +static int __devexit palm27x_asoc_remove(struct platform_device *pdev) { free_irq(gpio_to_irq(palm27x_ep_gpio), NULL); gpio_free(palm27x_ep_gpio); platform_device_unregister(palm27x_snd_device); + return 0; } -void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) +static struct platform_driver palm27x_wm9712_driver = { + .probe = palm27x_asoc_probe, + .remove = __devexit_p(palm27x_asoc_remove), + .driver = { + .name = "palm27x-asoc", + .owner = THIS_MODULE, + }, +}; + +static int __init palm27x_asoc_init(void) +{ + return platform_driver_register(&palm27x_wm9712_driver); +} + +static void __exit palm27x_asoc_exit(void) { - palm27x_ep_gpio = data->jack_gpio; + platform_driver_unregister(&palm27x_wm9712_driver); } module_init(palm27x_asoc_init); -- cgit v1.2.3 From 5d4af1be06affa2b42cdf59cd376752be1f934b3 Mon Sep 17 00:00:00 2001 From: Karsten Wiese Date: Mon, 20 Apr 2009 13:01:21 +0200 Subject: ALSA: us122l: add snd_us122l_free() Use it to clean up snd_us122l_card_used[]. Without patch unplugging of an US122L soundcard didn't reset the corresponding element of snd_us122l_card_used[] to 0. The (SNDRV_CARDS + 1)th plugging in did not result in creating the soundcard device anymore. Index values supplied with the modprobe command line were not used correctly anymore after the first unplugging of an US122L. Signed-off-by: Karsten Wiese Cc: stable@kernel.org Signed-off-by: Takashi Iwai --- sound/usb/usx2y/us122l.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 98276aafefe6..463f3ffe3fb9 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -478,6 +478,14 @@ static bool us122l_create_card(struct snd_card *card) return true; } +static void snd_us122l_free(struct snd_card *card) +{ + struct us122l *us122l = US122L(card); + int index = us122l->chip.index; + if (index >= 0 && index < SNDRV_CARDS) + snd_us122l_card_used[index] = 0; +} + static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) { int dev; @@ -494,7 +502,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) if (err < 0) return err; snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; - + card->private_free = snd_us122l_free; US122L(card)->chip.dev = device; US122L(card)->chip.card = card; mutex_init(&US122L(card)->mutex); @@ -588,7 +596,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf) } usb_put_intf(intf); - usb_put_dev(US122L(card)->chip.dev); + usb_put_dev(us122l->chip.dev); while (atomic_read(&us122l->mmap_count)) msleep(500); -- cgit v1.2.3 From e3ba906ad17330e44fad5af42a423417249c6e09 Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Mon, 20 Apr 2009 07:09:11 -0400 Subject: ALSA: Atiixp: Add SSID for mute_led quirk (unknown HP model) Reference: Ubuntu #84973 (https://launchpad.net/bugs/84973) Reference: Linux #8001 (http://bugzilla.kernel.org/show_bug.cgi?id=8001) Make the mute LED function properly on this unknown HP model. Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/atiixp.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 9ce8548c03e4..71515ddb4593 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1393,6 +1393,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "HP nx6125", .type = AC97_TUNE_MUTE_LED }, + { + .subvendor = 0x103c, + .subdevice = 0x3091, + .name = "unknown HP", + .type = AC97_TUNE_MUTE_LED + }, { } /* terminator */ }; -- cgit v1.2.3 From cfbf1eecd70db9a7a49c42a0613c00f7a2a86dfb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 20 Apr 2009 22:54:25 +0200 Subject: ALSA: AOA: Convert onyx and tas codecs to new-style i2c drivers The legacy i2c binding model is going away soon, so convert the AOA codec drivers to the new model or they'll break. Signed-off-by: Jean Delvare Tested-by: Johannes Berg Tested-by: Andreas Schwab Cc: Benjamin Herrenschmidt Signed-off-by: Takashi Iwai --- sound/aoa/codecs/onyx.c | 76 ++++++++++++++++++++++++++++++++++--------------- sound/aoa/codecs/tas.c | 66 ++++++++++++++++++++++++++---------------- 2 files changed, 95 insertions(+), 47 deletions(-) (limited to 'sound') diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index 15500b9d2da0..84bb07d39a7f 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c @@ -47,7 +47,7 @@ MODULE_DESCRIPTION("pcm3052 (onyx) codec driver for snd-aoa"); struct onyx { /* cache registers 65 to 80, they are write-only! */ u8 cache[16]; - struct i2c_client i2c; + struct i2c_client *i2c; struct aoa_codec codec; u32 initialised:1, spdif_locked:1, @@ -72,7 +72,7 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value) *value = onyx->cache[reg-FIRSTREGISTER]; return 0; } - v = i2c_smbus_read_byte_data(&onyx->i2c, reg); + v = i2c_smbus_read_byte_data(onyx->i2c, reg); if (v < 0) return -1; *value = (u8)v; @@ -84,7 +84,7 @@ static int onyx_write_register(struct onyx *onyx, u8 reg, u8 value) { int result; - result = i2c_smbus_write_byte_data(&onyx->i2c, reg, value); + result = i2c_smbus_write_byte_data(onyx->i2c, reg, value); if (!result) onyx->cache[reg-FIRSTREGISTER] = value; return result; @@ -996,12 +996,45 @@ static void onyx_exit_codec(struct aoa_codec *codec) onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx); } -static struct i2c_driver onyx_driver; - static int onyx_create(struct i2c_adapter *adapter, struct device_node *node, int addr) { + struct i2c_board_info info; + struct i2c_client *client; + + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "aoa_codec_onyx", I2C_NAME_SIZE); + info.addr = addr; + info.platform_data = node; + client = i2c_new_device(adapter, &info); + if (!client) + return -ENODEV; + + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, which suggests + * the device doesn't really exist and should be deleted. + * Ideally this would be replaced by better checks _before_ + * instantiating the device. + */ + if (!client->driver) { + i2c_unregister_device(client); + return -ENODEV; + } + + /* + * Let i2c-core delete that device on driver removal. + * This is safe because i2c-core holds the core_lock mutex for us. + */ + list_add_tail(&client->detected, &client->driver->clients); + return 0; +} + +static int onyx_i2c_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device_node *node = client->dev.platform_data; struct onyx *onyx; u8 dummy; @@ -1011,20 +1044,12 @@ static int onyx_create(struct i2c_adapter *adapter, return -ENOMEM; mutex_init(&onyx->mutex); - onyx->i2c.driver = &onyx_driver; - onyx->i2c.adapter = adapter; - onyx->i2c.addr = addr & 0x7f; - strlcpy(onyx->i2c.name, "onyx audio codec", I2C_NAME_SIZE); - - if (i2c_attach_client(&onyx->i2c)) { - printk(KERN_ERR PFX "failed to attach to i2c\n"); - goto fail; - } + onyx->i2c = client; + i2c_set_clientdata(client, onyx); /* we try to read from register ONYX_REG_CONTROL * to check if the codec is present */ if (onyx_read_register(onyx, ONYX_REG_CONTROL, &dummy) != 0) { - i2c_detach_client(&onyx->i2c); printk(KERN_ERR PFX "failed to read control register\n"); goto fail; } @@ -1036,14 +1061,14 @@ static int onyx_create(struct i2c_adapter *adapter, onyx->codec.node = of_node_get(node); if (aoa_codec_register(&onyx->codec)) { - i2c_detach_client(&onyx->i2c); goto fail; } printk(KERN_DEBUG PFX "created and attached onyx instance\n"); return 0; fail: + i2c_set_clientdata(client, NULL); kfree(onyx); - return -EINVAL; + return -ENODEV; } static int onyx_i2c_attach(struct i2c_adapter *adapter) @@ -1080,28 +1105,33 @@ static int onyx_i2c_attach(struct i2c_adapter *adapter) return onyx_create(adapter, NULL, 0x47); } -static int onyx_i2c_detach(struct i2c_client *client) +static int onyx_i2c_remove(struct i2c_client *client) { - struct onyx *onyx = container_of(client, struct onyx, i2c); - int err; + struct onyx *onyx = i2c_get_clientdata(client); - if ((err = i2c_detach_client(client))) - return err; aoa_codec_unregister(&onyx->codec); of_node_put(onyx->codec.node); if (onyx->codec_info) kfree(onyx->codec_info); + i2c_set_clientdata(client, onyx); kfree(onyx); return 0; } +static const struct i2c_device_id onyx_i2c_id[] = { + { "aoa_codec_onyx", 0 }, + { } +}; + static struct i2c_driver onyx_driver = { .driver = { .name = "aoa_codec_onyx", .owner = THIS_MODULE, }, .attach_adapter = onyx_i2c_attach, - .detach_client = onyx_i2c_detach, + .probe = onyx_i2c_probe, + .remove = onyx_i2c_remove, + .id_table = onyx_i2c_id, }; static int __init onyx_init(void) diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index 008e0f85097d..f0ebc971c686 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c @@ -82,7 +82,7 @@ MODULE_DESCRIPTION("tas codec driver for snd-aoa"); struct tas { struct aoa_codec codec; - struct i2c_client i2c; + struct i2c_client *i2c; u32 mute_l:1, mute_r:1 , controls_created:1 , drc_enabled:1, @@ -108,9 +108,9 @@ static struct tas *codec_to_tas(struct aoa_codec *codec) static inline int tas_write_reg(struct tas *tas, u8 reg, u8 len, u8 *data) { if (len == 1) - return i2c_smbus_write_byte_data(&tas->i2c, reg, *data); + return i2c_smbus_write_byte_data(tas->i2c, reg, *data); else - return i2c_smbus_write_i2c_block_data(&tas->i2c, reg, len, data); + return i2c_smbus_write_i2c_block_data(tas->i2c, reg, len, data); } static void tas3004_set_drc(struct tas *tas) @@ -882,12 +882,34 @@ static void tas_exit_codec(struct aoa_codec *codec) } -static struct i2c_driver tas_driver; - static int tas_create(struct i2c_adapter *adapter, struct device_node *node, int addr) { + struct i2c_board_info info; + struct i2c_client *client; + + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "aoa_codec_tas", I2C_NAME_SIZE); + info.addr = addr; + info.platform_data = node; + + client = i2c_new_device(adapter, &info); + if (!client) + return -ENODEV; + + /* + * Let i2c-core delete that device on driver removal. + * This is safe because i2c-core holds the core_lock mutex for us. + */ + list_add_tail(&client->detected, &client->driver->clients); + return 0; +} + +static int tas_i2c_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device_node *node = client->dev.platform_data; struct tas *tas; tas = kzalloc(sizeof(struct tas), GFP_KERNEL); @@ -896,17 +918,11 @@ static int tas_create(struct i2c_adapter *adapter, return -ENOMEM; mutex_init(&tas->mtx); - tas->i2c.driver = &tas_driver; - tas->i2c.adapter = adapter; - tas->i2c.addr = addr; + tas->i2c = client; + i2c_set_clientdata(client, tas); + /* seems that half is a saner default */ tas->drc_range = TAS3004_DRC_MAX / 2; - strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE); - - if (i2c_attach_client(&tas->i2c)) { - printk(KERN_ERR PFX "failed to attach to i2c\n"); - goto fail; - } strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN); tas->codec.owner = THIS_MODULE; @@ -915,14 +931,12 @@ static int tas_create(struct i2c_adapter *adapter, tas->codec.node = of_node_get(node); if (aoa_codec_register(&tas->codec)) { - goto detach; + goto fail; } printk(KERN_DEBUG "snd-aoa-codec-tas: tas found, addr 0x%02x on %s\n", - addr, node->full_name); + (unsigned int)client->addr, node->full_name); return 0; - detach: - i2c_detach_client(&tas->i2c); fail: mutex_destroy(&tas->mtx); kfree(tas); @@ -970,14 +984,11 @@ static int tas_i2c_attach(struct i2c_adapter *adapter) return -ENODEV; } -static int tas_i2c_detach(struct i2c_client *client) +static int tas_i2c_remove(struct i2c_client *client) { - struct tas *tas = container_of(client, struct tas, i2c); - int err; + struct tas *tas = i2c_get_clientdata(client); u8 tmp = TAS_ACR_ANALOG_PDOWN; - if ((err = i2c_detach_client(client))) - return err; aoa_codec_unregister(&tas->codec); of_node_put(tas->codec.node); @@ -989,13 +1000,20 @@ static int tas_i2c_detach(struct i2c_client *client) return 0; } +static const struct i2c_device_id tas_i2c_id[] = { + { "aoa_codec_tas", 0 }, + { } +}; + static struct i2c_driver tas_driver = { .driver = { .name = "aoa_codec_tas", .owner = THIS_MODULE, }, .attach_adapter = tas_i2c_attach, - .detach_client = tas_i2c_detach, + .probe = tas_i2c_probe, + .remove = tas_i2c_remove, + .id_table = tas_i2c_id, }; static int __init tas_init(void) -- cgit v1.2.3 From 5de4155bb3760fc13a172c5cef2368ce218ebe1c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 20 Apr 2009 22:56:59 +0200 Subject: ALSA: keywest: Convert to new-style i2c driver The legacy i2c binding model is going away soon, so convert the ppc keywest sound driver to the new model or it will break. Signed-off-by: Jean Delvare Cc: Benjamin Herrenschmidt Signed-off-by: Takashi Iwai --- sound/ppc/keywest.c | 82 ++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'sound') diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 6ff99ed77516..a5afb2682e7f 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -33,26 +33,25 @@ static struct pmac_keywest *keywest_ctx; -static int keywest_attach_adapter(struct i2c_adapter *adapter); -static int keywest_detach_client(struct i2c_client *client); - -struct i2c_driver keywest_driver = { - .driver = { - .name = "PMac Keywest Audio", - }, - .attach_adapter = &keywest_attach_adapter, - .detach_client = &keywest_detach_client, -}; - - #ifndef i2c_device_name #define i2c_device_name(x) ((x)->name) #endif +static int keywest_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + i2c_set_clientdata(client, keywest_ctx); + return 0; +} + +/* + * This is kind of a hack, best would be to turn powermac to fixed i2c + * bus numbers and declare the sound device as part of platform + * initialization + */ static int keywest_attach_adapter(struct i2c_adapter *adapter) { - int err; - struct i2c_client *new_client; + struct i2c_board_info info; if (! keywest_ctx) return -EINVAL; @@ -60,46 +59,47 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) if (strncmp(i2c_device_name(adapter), "mac-io", 6)) return 0; /* ignored */ - new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (! new_client) - return -ENOMEM; - - new_client->addr = keywest_ctx->addr; - i2c_set_clientdata(new_client, keywest_ctx); - new_client->adapter = adapter; - new_client->driver = &keywest_driver; - new_client->flags = 0; - - strcpy(i2c_device_name(new_client), keywest_ctx->name); - keywest_ctx->client = new_client; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "keywest", I2C_NAME_SIZE); + info.addr = keywest_ctx->addr; + keywest_ctx->client = i2c_new_device(adapter, &info); - /* Tell the i2c layer a new client has arrived */ - if (i2c_attach_client(new_client)) { - snd_printk(KERN_ERR "tumbler: cannot attach i2c client\n"); - err = -ENODEV; - goto __err; - } - + /* + * Let i2c-core delete that device on driver removal. + * This is safe because i2c-core holds the core_lock mutex for us. + */ + list_add_tail(&keywest_ctx->client->detected, + &keywest_ctx->client->driver->clients); return 0; - - __err: - kfree(new_client); - keywest_ctx->client = NULL; - return err; } -static int keywest_detach_client(struct i2c_client *client) +static int keywest_remove(struct i2c_client *client) { + i2c_set_clientdata(client, NULL); if (! keywest_ctx) return 0; if (client == keywest_ctx->client) keywest_ctx->client = NULL; - i2c_detach_client(client); - kfree(client); return 0; } + +static const struct i2c_device_id keywest_i2c_id[] = { + { "keywest", 0 }, + { } +}; + +struct i2c_driver keywest_driver = { + .driver = { + .name = "PMac Keywest Audio", + }, + .attach_adapter = keywest_attach_adapter, + .probe = keywest_probe, + .remove = keywest_remove, + .id_table = keywest_i2c_id, +}; + /* exported */ void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c) { -- cgit v1.2.3 From bb023080fe72f1f80648e9b60771d9a94ce75aca Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Tue, 21 Apr 2009 07:35:25 +0200 Subject: ALSA: hda - Fix alc662_init_verbs Don't unmute unneeded amps for input mixers of ALC662 & co. It caused possible recording noises. Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6ed787eedd06..78bea2c6ab6d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -15641,14 +15641,7 @@ static struct hda_verb alc662_init_verbs[] = { /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ /* Input mixer */ {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, /* always trun on EAPD */ {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, -- cgit v1.2.3 From 622e84cdff719b9dcd3f495ddb0afb54995799cc Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Tue, 21 Apr 2009 07:39:04 +0200 Subject: ALSA: hda - Add quirks for Realtek codecs - Support ASUS F81Se F5Q P80 U20A U80 U50 UX50 for ALC269 - Support ASUS F70SL UX20 X58LE F50Z N80Vc N81Te N505Tp Vx3V N5051A for ALC663 - Support DELL ZM1 for ALC272 Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 78bea2c6ab6d..c9300a3427ea 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -188,6 +188,8 @@ enum { ALC663_ASUS_MODE4, ALC663_ASUS_MODE5, ALC663_ASUS_MODE6, + ALC272_DELL, + ALC272_DELL_ZM1, ALC662_AUTO, ALC662_MODEL_LAST, }; @@ -12976,10 +12978,17 @@ static struct snd_pci_quirk alc269_cfg_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", ALC269_ASUS_EEEPC_P703), + SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), + SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), + SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), + SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), + SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), + SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", ALC269_ASUS_EEEPC_P901), SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", ALC269_ASUS_EEEPC_P901), + SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), {} @@ -15210,12 +15219,23 @@ static hda_nid_t alc662_dac_nids[4] = { 0x02, 0x03, 0x04 }; +static hda_nid_t alc272_dac_nids[2] = { + 0x02, 0x03 +}; + static hda_nid_t alc662_adc_nids[1] = { /* ADC1-2 */ 0x09, }; +static hda_nid_t alc272_adc_nids[1] = { + /* ADC1-2 */ + 0x08, +}; + static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; +static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; + /* input MUX */ /* FIXME: should be a matrix-type input source selection */ @@ -15836,12 +15856,48 @@ static struct hda_verb alc662_ecs_init_verbs[] = { {} }; +static struct hda_verb alc272_dell_zm1_init_verbs[] = { + {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ + {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, + {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, + {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, + {} +}; + +static struct hda_verb alc272_dell_init_verbs[] = { + {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ + {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, + {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, + {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, + {} +}; + static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), { } /* end */ }; +static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { + HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), + { } /* end */ +}; + static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) { unsigned int present; @@ -16353,6 +16409,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { static struct snd_pci_quirk alc662_cfg_tbl[] = { SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), + SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), + SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), @@ -16365,26 +16423,36 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), + SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), + SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), + SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), + SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), + SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), + SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), @@ -16633,6 +16701,36 @@ static struct alc_config_preset alc662_presets[] = { .unsol_event = alc663_mode6_unsol_event, .init_hook = alc663_mode6_inithook, }, + [ALC272_DELL] = { + .mixers = { alc663_m51va_mixer }, + .cap_mixer = alc272_auto_capture_mixer, + .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, + .num_dacs = ARRAY_SIZE(alc272_dac_nids), + .dac_nids = alc662_dac_nids, + .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), + .adc_nids = alc272_adc_nids, + .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), + .capsrc_nids = alc272_capsrc_nids, + .channel_mode = alc662_3ST_2ch_modes, + .input_mux = &alc663_m51va_capture_source, + .unsol_event = alc663_m51va_unsol_event, + .init_hook = alc663_m51va_inithook, + }, + [ALC272_DELL_ZM1] = { + .mixers = { alc663_m51va_mixer }, + .cap_mixer = alc662_auto_capture_mixer, + .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, + .num_dacs = ARRAY_SIZE(alc272_dac_nids), + .dac_nids = alc662_dac_nids, + .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), + .adc_nids = alc662_adc_nids, + .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), + .capsrc_nids = alc662_capsrc_nids, + .channel_mode = alc662_3ST_2ch_modes, + .input_mux = &alc663_m51va_capture_source, + .unsol_event = alc663_m51va_unsol_event, + .init_hook = alc663_m51va_inithook, + }, }; -- cgit v1.2.3 From e10f9d87c9ac9fdfadb6305dbbc9052e49a02fdd Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 21 Apr 2009 15:17:54 +0200 Subject: [ALSA] ac97_codec: increase timeout for analog subsections On some hardware platforms, the AC97 codec requires more time to wake up. Signed-off-by: Jaroslav Kysela --- sound/pci/ac97/ac97_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 97ee127ac33d..78288dbfc17a 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -2122,7 +2122,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, } /* nothing should be in powerdown mode */ snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); - end_time = jiffies + msecs_to_jiffies(100); + end_time = jiffies + msecs_to_jiffies(120); do { if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) goto __ready_ok; -- cgit v1.2.3 From 30fd9940eee910d847f48bd8740b2d0eaa8d2cfc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 21 Apr 2009 15:30:31 +0200 Subject: [ALSA] intel8x0: another attempt to fix ac97_clock measure routine Appearently, a big delay ~300ms is required before hw is settled and ready to transfer samples on some hardware variants. Also, return back "clocking to 48000Hz" message when something fails. Signed-off-by: Jaroslav Kysela --- sound/pci/intel8x0.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5dced5b79387..c4ba486785c6 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2751,11 +2751,12 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) if (pos == 0) { snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); __retry: - if (attempt < 2) { + if (attempt < 3) { + msleep(300); attempt++; goto __again; } - return; + goto __end; } pos /= 4; @@ -2782,6 +2783,7 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) else if (pos < 47500 || pos > 48500) /* not 48000Hz, tuning the clock.. */ chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; + __end: printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); } -- cgit v1.2.3 From 5bd3729f6818721f76a2a2f7d2ecad899bace340 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 21 Apr 2009 18:36:30 +0200 Subject: ALSA: hda - Add quirk for Packard Bell RS65 Added a quirk (model=m51va) for Packard Bell RS65 with ALC663. Reference: Novell bnc#496787 https://bugzilla.novell.com/show_bug.cgi?id=496787 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c9300a3427ea..b8a0d3e79272 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -16464,6 +16464,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", ALC662_3ST_6ch_DIG), SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), + SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", ALC662_3ST_6ch_DIG), -- cgit v1.2.3 From 7315613f87f4aa0a52f60814f4ee3802e0bb1ec5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 23 Apr 2009 08:24:48 +0200 Subject: ALSA: hda - Fix init verbs of AD1884A mobile model The current ad1884a-mobile model has a problem that the speaker output doesn't work sometimes after boot or power-saving on some HP laptops. It seems that the verbs accessing to the non-functional widgets cause this problem. This patch simplifies the init verbs for mobile model not to touch unnecessary setups so that it avoids the speaker-mute problem. Reference: Novell bnc#495668 https://bugzilla.novell.com/show_bug.cgi?id=495668 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 45 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 9bcd8ab5a27f..84cc49ca9148 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3817,6 +3817,49 @@ static struct hda_verb ad1884a_laptop_verbs[] = { { } /* end */ }; +static struct hda_verb ad1884a_mobile_verbs[] = { + /* DACs; unmute as default */ + {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ + {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ + /* Port-A (HP) mixer - route only from analog mixer */ + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + /* Port-A pin */ + {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + /* Port-A (HP) pin - always unmuted */ + {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + /* Port-B (mic jack) pin */ + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ + /* Port-C (int mic) pin */ + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ + /* Port-F (int speaker) mixer - route only from analog mixer */ + {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + /* Port-F pin */ + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + /* Analog mixer; mute as default */ + {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, + {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, + {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, + {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, + /* Analog Mix output amp */ + {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + /* capture sources */ + /* {0x0c, AC_VERB_SET_CONNECT_SEL, 0x0}, */ /* set via unsol */ + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x0d, AC_VERB_SET_CONNECT_SEL, 0x0}, + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + /* unsolicited event for pin-sense */ + {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, + { } /* end */ +}; + /* * Thinkpad X300 * 0x11 - HP @@ -3988,7 +4031,7 @@ static int patch_ad1884a(struct hda_codec *codec) break; case AD1884A_MOBILE: spec->mixers[0] = ad1884a_mobile_mixers; - spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; + spec->init_verbs[0] = ad1884a_mobile_verbs; spec->multiout.dig_out_nid = 0; codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; codec->patch_ops.init = ad1884a_hp_init; -- cgit v1.2.3 From a9b487fa1e00b42f9667abfeca4a5295a71333db Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Mon, 27 Apr 2009 12:18:05 +0200 Subject: ALSA: snd-usb-caiaq: fix reported elapsed periods Reset the internal period position counter upon stream startup. This fixes initial aplay underruns and problems related to latency picky applications such as pulseaudio. Bumped the version number to 1.3.14. Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/audio.c | 12 +++++++----- sound/usb/caiaq/device.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 3f45c0fe61ab..b13ce767ac72 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c @@ -195,11 +195,14 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) debug("%s(%p)\n", __func__, substream); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + dev->period_out_count[index] = BYTES_PER_SAMPLE + 1; dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1; - else + } else { + dev->period_in_count[index] = BYTES_PER_SAMPLE; dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE; - + } + if (dev->streaming) return 0; @@ -300,8 +303,7 @@ static void check_for_elapsed_periods(struct snd_usb_caiaqdev *dev, if (!sub) continue; - pb = frames_to_bytes(sub->runtime, - sub->runtime->period_size); + pb = snd_pcm_lib_period_bytes(sub); cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? &dev->period_out_count[stream] : &dev->period_in_count[stream]; diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 6d517705da0e..515de1cd2a3e 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -35,7 +35,7 @@ #include "input.h" MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.14"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," -- cgit v1.2.3 From 395a434e39cb6dc6e1ff53bb43722b534a3c68d6 Mon Sep 17 00:00:00 2001 From: Subrata Modak Date: Mon, 27 Apr 2009 16:42:37 +0530 Subject: ALSA: Fix Trivial Warnining in sound/pci/cmipci.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed the compile warning below by initializatin iomidi variable properly. sound/pci/cmipci.c: In function ‘snd_cmipci_probe’: sound/pci/cmipci.c:3017: warning: ‘iomidi’ may be used uninitialized in this function Signed-off-by: Subrata Modak Cc: linux-pci Cc: Balbir Singh Cc: Sachin P Sant Signed-off-by: Takashi Iwai --- sound/pci/cmipci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index c7899c32aba1..449fe02f666e 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3014,7 +3014,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc .dev_free = snd_cmipci_dev_free, }; unsigned int val; - long iomidi; + long iomidi = 0; int integrated_midi = 0; char modelstr[16]; int pcm_index, pcm_spdif_index; -- cgit v1.2.3 From 2008f137e92220b98120c4803499cdddb2b0fb06 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 28 Apr 2009 12:25:59 +0200 Subject: ALSA: Add missing SNDRV_PCM_INFO_BATCH flag to some drivers Added SNDRV_PCM_INFO_BATCH flag to PCM info field of some drivers that really don't give the precise pointer value. Signed-off-by: Takashi Iwai --- sound/isa/msnd/msnd.c | 6 ++++-- sound/pci/bt87x.c | 6 ++++-- sound/pci/korg1212/korg1212.c | 6 ++++-- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 3 ++- sound/soc/au1x/dbdma2.c | 2 +- sound/soc/fsl/mpc5200_psc_i2s.c | 3 ++- sound/soc/sh/dma-sh7760.c | 3 ++- sound/sparc/dbri.c | 3 ++- sound/usb/usx2y/usbusx2yaudio.c | 3 ++- 9 files changed, 23 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/isa/msnd/msnd.c b/sound/isa/msnd/msnd.c index 906454413ed2..3a1526ae1729 100644 --- a/sound/isa/msnd/msnd.c +++ b/sound/isa/msnd/msnd.c @@ -438,7 +438,8 @@ static void snd_msnd_capture_reset_queue(struct snd_msnd *chip, static struct snd_pcm_hardware snd_msnd_playback = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP_VALID, + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH, .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, .rates = SNDRV_PCM_RATE_8000_48000, .rate_min = 8000, @@ -456,7 +457,8 @@ static struct snd_pcm_hardware snd_msnd_playback = { static struct snd_pcm_hardware snd_msnd_capture = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP_VALID, + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH, .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, .rates = SNDRV_PCM_RATE_8000_48000, .rate_min = 8000, diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index a299340519df..ce3f2e90f4d7 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -349,7 +349,8 @@ static struct snd_pcm_hardware snd_bt87x_digital_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID, + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH, .formats = SNDRV_PCM_FMTBIT_S16_LE, .rates = 0, /* set at runtime */ .channels_min = 2, @@ -365,7 +366,8 @@ static struct snd_pcm_hardware snd_bt87x_analog_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID, + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH, .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8, .rates = SNDRV_PCM_RATE_KNOT, .rate_min = ANALOG_CLOCK / CLOCK_DIV_MAX, diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 8b79969034be..7cc38a11e997 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -1238,7 +1238,8 @@ static struct snd_pcm_hardware snd_korg1212_playback_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED), + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BATCH), .formats = SNDRV_PCM_FMTBIT_S16_LE, .rates = (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000), @@ -1258,7 +1259,8 @@ static struct snd_pcm_hardware snd_korg1212_capture_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED), + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BATCH), .formats = SNDRV_PCM_FMTBIT_S16_LE, .rates = (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000), diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index 01066c95580e..d057e6489643 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c @@ -240,7 +240,8 @@ static int pdacf_pcm_prepare(struct snd_pcm_substream *subs) static struct snd_pcm_hardware pdacf_pcm_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME | - SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH), .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE | SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE, diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 30490a259148..594c6c5b7838 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -82,7 +82,7 @@ static struct au1xpsc_audio_dmadata *au1xpsc_audio_pcmdma[2]; /* PCM hardware DMA capabilities - platform specific */ static const struct snd_pcm_hardware au1xpsc_pcm_hardware = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED, + SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BATCH, .formats = AU1XPSC_PCM_FMTS, .period_bytes_min = AU1XPSC_PERIOD_MIN_BYTES, .period_bytes_max = 4096 * 1024 - 1, diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 3aa729df27b5..1111c710118a 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c @@ -504,7 +504,8 @@ static struct snd_soc_dai psc_i2s_dai_template = { static const struct snd_pcm_hardware psc_i2s_pcm_hardware = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER, + SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_BATCH, .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE, .rate_min = 8000, diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index 0dad3a0bb920..baddb1242c71 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c @@ -103,7 +103,8 @@ static struct snd_pcm_hardware camelot_pcm_hardware = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH), .formats = DMABRG_FMTS, .rates = DMABRG_RATES, .rate_min = 8000, diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index af95ff1e126c..1d2e51b3f918 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -1975,7 +1975,8 @@ static struct snd_pcm_hardware snd_dbri_pcm_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID, + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH, .formats = SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_U8 | diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 9a608fa85155..dd1ab6177840 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -870,7 +870,8 @@ static struct snd_pcm_hardware snd_usX2Y_2c = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BATCH), .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, .rate_min = 44100, -- cgit v1.2.3 From 3e5b50165fd0be080044586f43fcdd460ed27610 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 28 Apr 2009 12:07:08 +0200 Subject: ALSA: pcm core - Avoid jiffies check for devices with BATCH flag The hardware devices with SNDRV_PCM_INFO_BATCH flag can't give the precise current position. And such hardwares have often big FIFO in addition to the ring buffer, and it screws up the jiffies check in pcm_lib.c. This patch adds a simple check of info flag so that the driver skips the jiffies check in snd_pcm_period_elapsed() when BATCH flag is set. Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 63d088f2265f..a2a792c18c40 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -249,6 +249,12 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) new_hw_ptr = hw_base + pos; } } + /* Skip the jiffies check for hardwares with BATCH flag. + * Such hardware usually just increases the position at each IRQ, + * thus it can't give any strange position. + */ + if (runtime->hw.info & SNDRV_PCM_INFO_BATCH) + goto no_jiffies_check; hdelta = new_hw_ptr - old_hw_ptr; jdelta = jiffies - runtime->hw_ptr_jiffies; if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { @@ -272,6 +278,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) hw_base -= hw_base % runtime->buffer_size; delta = 0; } + no_jiffies_check: if (delta > runtime->period_size + runtime->period_size / 2) { hw_ptr_error(substream, "Lost interrupts? " -- cgit v1.2.3