diff options
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index f6e922cf3fd3..26f10fdbfcd6 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -2303,6 +2303,21 @@ static void snd_hdspm_set_infotext(struct snd_ctl_elem_info *uinfo, | |||
2303 | snd_hdspm_set_infotext(info, texts, ARRAY_SIZE(texts)) | 2303 | snd_hdspm_set_infotext(info, texts, ARRAY_SIZE(texts)) |
2304 | 2304 | ||
2305 | 2305 | ||
2306 | /* Helper function to query the external sample rate and return the | ||
2307 | * corresponding enum to be returned to userspace. | ||
2308 | */ | ||
2309 | static int hdspm_external_rate_to_enum(struct hdspm *hdspm) | ||
2310 | { | ||
2311 | int rate = hdspm_external_sample_rate(hdspm); | ||
2312 | int i, selected_rate = 0; | ||
2313 | for (i = 1; i < 10; i++) | ||
2314 | if (HDSPM_bit2freq(i) == rate) { | ||
2315 | selected_rate = i; | ||
2316 | break; | ||
2317 | } | ||
2318 | return selected_rate; | ||
2319 | } | ||
2320 | |||
2306 | 2321 | ||
2307 | #define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ | 2322 | #define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ |
2308 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2323 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
@@ -2396,18 +2411,9 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, | |||
2396 | 2411 | ||
2397 | case MADI: | 2412 | case MADI: |
2398 | case MADIface: | 2413 | case MADIface: |
2399 | { | 2414 | ucontrol->value.enumerated.item[0] = |
2400 | int rate = hdspm_external_sample_rate(hdspm); | 2415 | hdspm_external_rate_to_enum(hdspm); |
2401 | int i, selected_rate = 0; | ||
2402 | for (i = 1; i < 10; i++) | ||
2403 | if (HDSPM_bit2freq(i) == rate) { | ||
2404 | selected_rate = i; | ||
2405 | break; | ||
2406 | } | ||
2407 | ucontrol->value.enumerated.item[0] = selected_rate; | ||
2408 | } | ||
2409 | break; | 2416 | break; |
2410 | |||
2411 | default: | 2417 | default: |
2412 | break; | 2418 | break; |
2413 | } | 2419 | } |