diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_generic.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index f4b5043a3176..d4cb9df6e5b3 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/export.h> | 25 | #include <linux/export.h> |
26 | #include <linux/sort.h> | 26 | #include <linux/sort.h> |
27 | #include <linux/ctype.h> | ||
28 | #include <linux/string.h> | ||
27 | #include <sound/core.h> | 29 | #include <sound/core.h> |
28 | #include <sound/jack.h> | 30 | #include <sound/jack.h> |
29 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
@@ -3230,6 +3232,25 @@ static const struct hda_pcm_stream dyn_adc_pcm_analog_capture = { | |||
3230 | }, | 3232 | }, |
3231 | }; | 3233 | }; |
3232 | 3234 | ||
3235 | static void fill_pcm_stream_name(char *str, size_t len, const char *sfx, | ||
3236 | const char *chip_name) | ||
3237 | { | ||
3238 | char *p; | ||
3239 | |||
3240 | if (*str) | ||
3241 | return; | ||
3242 | strlcpy(str, chip_name, len); | ||
3243 | |||
3244 | /* drop non-alnum chars after a space */ | ||
3245 | for (p = strchr(str, ' '); p; p = strchr(p + 1, ' ')) { | ||
3246 | if (!isalnum(p[1])) { | ||
3247 | *p = 0; | ||
3248 | break; | ||
3249 | } | ||
3250 | } | ||
3251 | strlcat(str, sfx, len); | ||
3252 | } | ||
3253 | |||
3233 | /* build PCM streams based on the parsed results */ | 3254 | /* build PCM streams based on the parsed results */ |
3234 | int snd_hda_gen_build_pcms(struct hda_codec *codec) | 3255 | int snd_hda_gen_build_pcms(struct hda_codec *codec) |
3235 | { | 3256 | { |
@@ -3245,8 +3266,9 @@ int snd_hda_gen_build_pcms(struct hda_codec *codec) | |||
3245 | if (spec->no_analog) | 3266 | if (spec->no_analog) |
3246 | goto skip_analog; | 3267 | goto skip_analog; |
3247 | 3268 | ||
3248 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | 3269 | fill_pcm_stream_name(spec->stream_name_analog, |
3249 | "%s Analog", codec->chip_name); | 3270 | sizeof(spec->stream_name_analog), |
3271 | " Analog", codec->chip_name); | ||
3250 | info->name = spec->stream_name_analog; | 3272 | info->name = spec->stream_name_analog; |
3251 | 3273 | ||
3252 | if (spec->multiout.num_dacs > 0) { | 3274 | if (spec->multiout.num_dacs > 0) { |
@@ -3286,9 +3308,9 @@ int snd_hda_gen_build_pcms(struct hda_codec *codec) | |||
3286 | skip_analog: | 3308 | skip_analog: |
3287 | /* SPDIF for stream index #1 */ | 3309 | /* SPDIF for stream index #1 */ |
3288 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | 3310 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
3289 | snprintf(spec->stream_name_digital, | 3311 | fill_pcm_stream_name(spec->stream_name_digital, |
3290 | sizeof(spec->stream_name_digital), | 3312 | sizeof(spec->stream_name_digital), |
3291 | "%s Digital", codec->chip_name); | 3313 | " Digital", codec->chip_name); |
3292 | codec->num_pcms = 2; | 3314 | codec->num_pcms = 2; |
3293 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; | 3315 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
3294 | info = spec->pcm_rec + 1; | 3316 | info = spec->pcm_rec + 1; |