diff options
Diffstat (limited to 'sound/pci/ac97/ac97_codec.c')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index bf578ba2677e..14ad54b7928c 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -214,6 +214,12 @@ static void update_power_regs(struct snd_ac97 *ac97); | |||
214 | #define ac97_is_power_save_mode(ac97) 0 | 214 | #define ac97_is_power_save_mode(ac97) 0 |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | #define ac97_err(ac97, fmt, args...) \ | ||
218 | dev_err((ac97)->bus->card->dev, fmt, ##args) | ||
219 | #define ac97_warn(ac97, fmt, args...) \ | ||
220 | dev_warn((ac97)->bus->card->dev, fmt, ##args) | ||
221 | #define ac97_dbg(ac97, fmt, args...) \ | ||
222 | dev_dbg((ac97)->bus->card->dev, fmt, ##args) | ||
217 | 223 | ||
218 | /* | 224 | /* |
219 | * I/O routines | 225 | * I/O routines |
@@ -1673,7 +1679,7 @@ static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97) | |||
1673 | int err, idx; | 1679 | int err, idx; |
1674 | 1680 | ||
1675 | /* | 1681 | /* |
1676 | printk(KERN_DEBUG "AC97_GPIO_CFG = %x\n", | 1682 | ac97_dbg(ac97, "AC97_GPIO_CFG = %x\n", |
1677 | snd_ac97_read(ac97,AC97_GPIO_CFG)); | 1683 | snd_ac97_read(ac97,AC97_GPIO_CFG)); |
1678 | */ | 1684 | */ |
1679 | snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); | 1685 | snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); |
@@ -1963,7 +1969,7 @@ static int snd_ac97_dev_register(struct snd_device *device) | |||
1963 | ac97->bus->card->number, ac97->num, | 1969 | ac97->bus->card->number, ac97->num, |
1964 | snd_ac97_get_short_name(ac97)); | 1970 | snd_ac97_get_short_name(ac97)); |
1965 | if ((err = device_register(&ac97->dev)) < 0) { | 1971 | if ((err = device_register(&ac97->dev)) < 0) { |
1966 | snd_printk(KERN_ERR "Can't register ac97 bus\n"); | 1972 | ac97_err(ac97, "Can't register ac97 bus\n"); |
1967 | ac97->dev.bus = NULL; | 1973 | ac97->dev.bus = NULL; |
1968 | return err; | 1974 | return err; |
1969 | } | 1975 | } |
@@ -2089,7 +2095,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2089 | msecs_to_jiffies(500), 1); | 2095 | msecs_to_jiffies(500), 1); |
2090 | } | 2096 | } |
2091 | if (err < 0) { | 2097 | if (err < 0) { |
2092 | snd_printk(KERN_WARNING "AC'97 %d does not respond - RESET\n", ac97->num); | 2098 | ac97_warn(ac97, "AC'97 %d does not respond - RESET\n", |
2099 | ac97->num); | ||
2093 | /* proceed anyway - it's often non-critical */ | 2100 | /* proceed anyway - it's often non-critical */ |
2094 | } | 2101 | } |
2095 | } | 2102 | } |
@@ -2098,7 +2105,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2098 | ac97->id |= snd_ac97_read(ac97, AC97_VENDOR_ID2); | 2105 | ac97->id |= snd_ac97_read(ac97, AC97_VENDOR_ID2); |
2099 | if (! (ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) && | 2106 | if (! (ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) && |
2100 | (ac97->id == 0x00000000 || ac97->id == 0xffffffff)) { | 2107 | (ac97->id == 0x00000000 || ac97->id == 0xffffffff)) { |
2101 | snd_printk(KERN_ERR "AC'97 %d access is not valid [0x%x], removing mixer.\n", ac97->num, ac97->id); | 2108 | ac97_err(ac97, |
2109 | "AC'97 %d access is not valid [0x%x], removing mixer.\n", | ||
2110 | ac97->num, ac97->id); | ||
2102 | snd_ac97_free(ac97); | 2111 | snd_ac97_free(ac97); |
2103 | return -EIO; | 2112 | return -EIO; |
2104 | } | 2113 | } |
@@ -2131,7 +2140,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2131 | 2140 | ||
2132 | if (!ac97_is_audio(ac97) && !ac97_is_modem(ac97)) { | 2141 | if (!ac97_is_audio(ac97) && !ac97_is_modem(ac97)) { |
2133 | if (!(ac97->scaps & (AC97_SCAP_SKIP_AUDIO|AC97_SCAP_SKIP_MODEM))) | 2142 | if (!(ac97->scaps & (AC97_SCAP_SKIP_AUDIO|AC97_SCAP_SKIP_MODEM))) |
2134 | snd_printk(KERN_ERR "AC'97 %d access error (not audio or modem codec)\n", ac97->num); | 2143 | ac97_err(ac97, |
2144 | "AC'97 %d access error (not audio or modem codec)\n", | ||
2145 | ac97->num); | ||
2135 | snd_ac97_free(ac97); | 2146 | snd_ac97_free(ac97); |
2136 | return -EACCES; | 2147 | return -EACCES; |
2137 | } | 2148 | } |
@@ -2156,7 +2167,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2156 | goto __ready_ok; | 2167 | goto __ready_ok; |
2157 | schedule_timeout_uninterruptible(1); | 2168 | schedule_timeout_uninterruptible(1); |
2158 | } while (time_after_eq(end_time, jiffies)); | 2169 | } while (time_after_eq(end_time, jiffies)); |
2159 | snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num); | 2170 | ac97_warn(ac97, |
2171 | "AC'97 %d analog subsections not ready\n", ac97->num); | ||
2160 | } | 2172 | } |
2161 | 2173 | ||
2162 | /* FIXME: add powerdown control */ | 2174 | /* FIXME: add powerdown control */ |
@@ -2188,7 +2200,10 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2188 | goto __ready_ok; | 2200 | goto __ready_ok; |
2189 | schedule_timeout_uninterruptible(1); | 2201 | schedule_timeout_uninterruptible(1); |
2190 | } while (time_after_eq(end_time, jiffies)); | 2202 | } while (time_after_eq(end_time, jiffies)); |
2191 | snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); | 2203 | ac97_warn(ac97, |
2204 | "MC'97 %d converters and GPIO not ready (0x%x)\n", | ||
2205 | ac97->num, | ||
2206 | snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); | ||
2192 | } | 2207 | } |
2193 | 2208 | ||
2194 | __ready_ok: | 2209 | __ready_ok: |
@@ -2723,7 +2738,7 @@ static int tune_ad_sharing(struct snd_ac97 *ac97) | |||
2723 | { | 2738 | { |
2724 | unsigned short scfg; | 2739 | unsigned short scfg; |
2725 | if ((ac97->id & 0xffffff00) != 0x41445300) { | 2740 | if ((ac97->id & 0xffffff00) != 0x41445300) { |
2726 | snd_printk(KERN_ERR "ac97_quirk AD_SHARING is only for AD codecs\n"); | 2741 | ac97_err(ac97, "ac97_quirk AD_SHARING is only for AD codecs\n"); |
2727 | return -EINVAL; | 2742 | return -EINVAL; |
2728 | } | 2743 | } |
2729 | /* Turn on OMS bit to route microphone to back panel */ | 2744 | /* Turn on OMS bit to route microphone to back panel */ |
@@ -2739,7 +2754,8 @@ AC97_SINGLE("Jack Detect", AC97_ALC650_CLOCK, 5, 1, 0); | |||
2739 | static int tune_alc_jack(struct snd_ac97 *ac97) | 2754 | static int tune_alc_jack(struct snd_ac97 *ac97) |
2740 | { | 2755 | { |
2741 | if ((ac97->id & 0xffffff00) != 0x414c4700) { | 2756 | if ((ac97->id & 0xffffff00) != 0x414c4700) { |
2742 | snd_printk(KERN_ERR "ac97_quirk ALC_JACK is only for Realtek codecs\n"); | 2757 | ac97_err(ac97, |
2758 | "ac97_quirk ALC_JACK is only for Realtek codecs\n"); | ||
2743 | return -EINVAL; | 2759 | return -EINVAL; |
2744 | } | 2760 | } |
2745 | snd_ac97_update_bits(ac97, 0x7a, 0x20, 0x20); /* select jack detect function */ | 2761 | snd_ac97_update_bits(ac97, 0x7a, 0x20, 0x20); /* select jack detect function */ |
@@ -2899,7 +2915,8 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons | |||
2899 | if (override && strcmp(override, "-1") && strcmp(override, "default")) { | 2915 | if (override && strcmp(override, "-1") && strcmp(override, "default")) { |
2900 | result = apply_quirk_str(ac97, override); | 2916 | result = apply_quirk_str(ac97, override); |
2901 | if (result < 0) | 2917 | if (result < 0) |
2902 | snd_printk(KERN_ERR "applying quirk type %s failed (%d)\n", override, result); | 2918 | ac97_err(ac97, "applying quirk type %s failed (%d)\n", |
2919 | override, result); | ||
2903 | return result; | 2920 | return result; |
2904 | } | 2921 | } |
2905 | 2922 | ||
@@ -2913,10 +2930,14 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons | |||
2913 | quirk->subdevice == (quirk->mask & ac97->subsystem_device)) { | 2930 | quirk->subdevice == (quirk->mask & ac97->subsystem_device)) { |
2914 | if (quirk->codec_id && quirk->codec_id != ac97->id) | 2931 | if (quirk->codec_id && quirk->codec_id != ac97->id) |
2915 | continue; | 2932 | continue; |
2916 | snd_printdd("ac97 quirk for %s (%04x:%04x)\n", quirk->name, ac97->subsystem_vendor, ac97->subsystem_device); | 2933 | ac97_dbg(ac97, "ac97 quirk for %s (%04x:%04x)\n", |
2934 | quirk->name, ac97->subsystem_vendor, | ||
2935 | ac97->subsystem_device); | ||
2917 | result = apply_quirk(ac97, quirk->type); | 2936 | result = apply_quirk(ac97, quirk->type); |
2918 | if (result < 0) | 2937 | if (result < 0) |
2919 | snd_printk(KERN_ERR "applying quirk type %d for %s failed (%d)\n", quirk->type, quirk->name, result); | 2938 | ac97_err(ac97, |
2939 | "applying quirk type %d for %s failed (%d)\n", | ||
2940 | quirk->type, quirk->name, result); | ||
2920 | return result; | 2941 | return result; |
2921 | } | 2942 | } |
2922 | } | 2943 | } |