diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-19 09:19:11 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-19 09:19:11 -0500 |
commit | d4d9cd0338892e7f0d65f8a110473d175535cd5d (patch) | |
tree | 6bfc5b0f497f7a9e4ff7391e056a1656b05add68 | |
parent | 03c6901ea22bbb532586334d5b79941ccf56d5b0 (diff) |
ALSA: hda - Add probe_only option
Added probe_only module option to hd-audio driver.
This option specifies whether the driver creates and initializes the
codec-parser after probing. When this option is set, the driver skips
the codec parsing and initialization but gives you proc and other
accesses. It's useful to see the initial codec state for debugging.
The default of this value is off, so the default behavior is as same
as before.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | Documentation/sound/alsa/ALSA-Configuration.txt | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 12 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 11 |
4 files changed, 18 insertions, 9 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index a4f3a22caba3..ee45454c50be 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -757,6 +757,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
757 | model - force the model name | 757 | model - force the model name |
758 | position_fix - Fix DMA pointer (0 = auto, 1 = use LPIB, 2 = POSBUF) | 758 | position_fix - Fix DMA pointer (0 = auto, 1 = use LPIB, 2 = POSBUF) |
759 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) | 759 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) |
760 | probe_only - Only probing and no codec initialization (default=off); | ||
761 | Useful to check the initial codec status for debugging | ||
760 | bdl_pos_adj - Specifies the DMA IRQ timing delay in samples. | 762 | bdl_pos_adj - Specifies the DMA IRQ timing delay in samples. |
761 | Passing -1 will make the driver to choose the appropriate | 763 | Passing -1 will make the driver to choose the appropriate |
762 | value based on the controller chip. | 764 | value based on the controller chip. |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 625fe5984dd6..e16cf63821ae 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -709,7 +709,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
709 | * Returns 0 if successful, or a negative error code. | 709 | * Returns 0 if successful, or a negative error code. |
710 | */ | 710 | */ |
711 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 711 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, |
712 | struct hda_codec **codecp) | 712 | int do_init, struct hda_codec **codecp) |
713 | { | 713 | { |
714 | struct hda_codec *codec; | 714 | struct hda_codec *codec; |
715 | char component[31]; | 715 | char component[31]; |
@@ -793,10 +793,12 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
793 | if (bus->modelname) | 793 | if (bus->modelname) |
794 | codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); | 794 | codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); |
795 | 795 | ||
796 | err = snd_hda_codec_configure(codec); | 796 | if (do_init) { |
797 | if (err < 0) { | 797 | err = snd_hda_codec_configure(codec); |
798 | snd_hda_codec_free(codec); | 798 | if (err < 0) { |
799 | return err; | 799 | snd_hda_codec_free(codec); |
800 | return err; | ||
801 | } | ||
800 | } | 802 | } |
801 | snd_hda_codec_proc_new(codec); | 803 | snd_hda_codec_proc_new(codec); |
802 | 804 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5587d416229f..729fc7642d7f 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -811,7 +811,7 @@ enum { | |||
811 | int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp, | 811 | int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp, |
812 | struct hda_bus **busp); | 812 | struct hda_bus **busp); |
813 | int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 813 | int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, |
814 | struct hda_codec **codecp); | 814 | int do_init, struct hda_codec **codecp); |
815 | 815 | ||
816 | /* | 816 | /* |
817 | * low level functions | 817 | * low level functions |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index a26ae8c4cf70..6613b6bef9eb 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -58,6 +58,7 @@ static char *model[SNDRV_CARDS]; | |||
58 | static int position_fix[SNDRV_CARDS]; | 58 | static int position_fix[SNDRV_CARDS]; |
59 | static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; | 59 | static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; |
60 | static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; | 60 | static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; |
61 | static int probe_only[SNDRV_CARDS]; | ||
61 | static int single_cmd; | 62 | static int single_cmd; |
62 | static int enable_msi; | 63 | static int enable_msi; |
63 | 64 | ||
@@ -76,6 +77,8 @@ module_param_array(bdl_pos_adj, int, NULL, 0644); | |||
76 | MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); | 77 | MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); |
77 | module_param_array(probe_mask, int, NULL, 0444); | 78 | module_param_array(probe_mask, int, NULL, 0444); |
78 | MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); | 79 | MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); |
80 | module_param_array(probe_only, bool, NULL, 0444); | ||
81 | MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization."); | ||
79 | module_param(single_cmd, bool, 0444); | 82 | module_param(single_cmd, bool, 0444); |
80 | MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs " | 83 | MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs " |
81 | "(for debugging only)."); | 84 | "(for debugging only)."); |
@@ -1224,7 +1227,8 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | |||
1224 | }; | 1227 | }; |
1225 | 1228 | ||
1226 | static int __devinit azx_codec_create(struct azx *chip, const char *model, | 1229 | static int __devinit azx_codec_create(struct azx *chip, const char *model, |
1227 | unsigned int codec_probe_mask) | 1230 | unsigned int codec_probe_mask, |
1231 | int no_init) | ||
1228 | { | 1232 | { |
1229 | struct hda_bus_template bus_temp; | 1233 | struct hda_bus_template bus_temp; |
1230 | int c, codecs, err; | 1234 | int c, codecs, err; |
@@ -1282,7 +1286,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1282 | for (c = 0; c < max_slots; c++) { | 1286 | for (c = 0; c < max_slots; c++) { |
1283 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1287 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { |
1284 | struct hda_codec *codec; | 1288 | struct hda_codec *codec; |
1285 | err = snd_hda_codec_new(chip->bus, c, &codec); | 1289 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); |
1286 | if (err < 0) | 1290 | if (err < 0) |
1287 | continue; | 1291 | continue; |
1288 | codecs++; | 1292 | codecs++; |
@@ -2340,7 +2344,8 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2340 | card->private_data = chip; | 2344 | card->private_data = chip; |
2341 | 2345 | ||
2342 | /* create codec instances */ | 2346 | /* create codec instances */ |
2343 | err = azx_codec_create(chip, model[dev], probe_mask[dev]); | 2347 | err = azx_codec_create(chip, model[dev], probe_mask[dev], |
2348 | probe_only[dev]); | ||
2344 | if (err < 0) | 2349 | if (err < 0) |
2345 | goto out_free; | 2350 | goto out_free; |
2346 | 2351 | ||