Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353068
b: refs/heads/master
c: f873e53
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Jan 12, 2013
1 parent 2a79869 commit 064ff7c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7594aa33963eb4a795ca346ec6d7c0dfaa2485a2
refs/heads/master: f873e536b6354214f80776382c3779b75e9e145f
32 changes: 27 additions & 5 deletions trunk/sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/sort.h>
#include <linux/ctype.h>
#include <linux/string.h>
#include <sound/core.h>
#include <sound/jack.h>
#include "hda_codec.h"
Expand Down Expand Up @@ -3230,6 +3232,25 @@ static const struct hda_pcm_stream dyn_adc_pcm_analog_capture = {
},
};

static void fill_pcm_stream_name(char *str, size_t len, const char *sfx,
const char *chip_name)
{
char *p;

if (*str)
return;
strlcpy(str, chip_name, len);

/* drop non-alnum chars after a space */
for (p = strchr(str, ' '); p; p = strchr(p + 1, ' ')) {
if (!isalnum(p[1])) {
*p = 0;
break;
}
}
strlcat(str, sfx, len);
}

/* build PCM streams based on the parsed results */
int snd_hda_gen_build_pcms(struct hda_codec *codec)
{
Expand All @@ -3245,8 +3266,9 @@ int snd_hda_gen_build_pcms(struct hda_codec *codec)
if (spec->no_analog)
goto skip_analog;

snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
"%s Analog", codec->chip_name);
fill_pcm_stream_name(spec->stream_name_analog,
sizeof(spec->stream_name_analog),
" Analog", codec->chip_name);
info->name = spec->stream_name_analog;

if (spec->multiout.num_dacs > 0) {
Expand Down Expand Up @@ -3286,9 +3308,9 @@ int snd_hda_gen_build_pcms(struct hda_codec *codec)
skip_analog:
/* SPDIF for stream index #1 */
if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
snprintf(spec->stream_name_digital,
sizeof(spec->stream_name_digital),
"%s Digital", codec->chip_name);
fill_pcm_stream_name(spec->stream_name_digital,
sizeof(spec->stream_name_digital),
" Digital", codec->chip_name);
codec->num_pcms = 2;
codec->slave_dig_outs = spec->multiout.slave_dig_outs;
info = spec->pcm_rec + 1;
Expand Down

0 comments on commit 064ff7c

Please sign in to comment.