Skip to content

Commit 07b116b

Browse files
harinworkstiwai
authored andcommitted
ALSA: ctxfi: Use correct DAIO type for da_desc
Skip the unused DAIO type per model (SPDIFIO on CTSB073X, SPDIFI_BAY on all others) and use the correct DAIO type directly as da_desc type. This removes the mismatch and misleading between the actual DAIO resource and the da_desc type like SPDIFI_BAY (formerly SPDIFI1). Update related functions accordingly, and drop the unreachable SPDIFI_BAY case from the hw20k2 daio_device_index(). Signed-off-by: Harin Lee <me@harin.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260401090159.2404387-3-me@harin.net
1 parent c6cd83c commit 07b116b

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

sound/pci/ctxfi/ctatc.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,11 @@ static int atc_select_mic_in(struct ct_atc *atc)
983983
return 0;
984984
}
985985

986+
static inline enum DAIOTYP atc_spdif_in_type(struct ct_atc *atc)
987+
{
988+
return (atc->model == CTSB073X) ? SPDIFI_BAY : SPDIFIO;
989+
}
990+
986991
static struct capabilities atc_capabilities(struct ct_atc *atc)
987992
{
988993
struct hw *hw = atc->hw;
@@ -1121,7 +1126,7 @@ static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state)
11211126

11221127
static int atc_spdif_in_unmute(struct ct_atc *atc, unsigned char state)
11231128
{
1124-
return atc_daio_unmute(atc, state, SPDIFIO);
1129+
return atc_daio_unmute(atc, state, atc_spdif_in_type(atc));
11251130
}
11261131

11271132
static int atc_spdif_out_get_status(struct ct_atc *atc, unsigned int *status)
@@ -1427,14 +1432,12 @@ static int atc_get_resources(struct ct_atc *atc)
14271432
daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
14281433
da_desc.msr = atc->msr;
14291434
for (i = 0; i < NUM_DAIOTYP; i++) {
1430-
if (((i == MIC) && !cap.dedicated_mic) ||
1431-
((i == RCA) && !cap.dedicated_rca) ||
1432-
i == SPDIFI_BAY)
1435+
if (((i == SPDIFIO) && (atc->model == CTSB073X)) ||
1436+
((i == SPDIFI_BAY) && (atc->model != CTSB073X)) ||
1437+
((i == MIC) && !cap.dedicated_mic) ||
1438+
((i == RCA) && !cap.dedicated_rca))
14331439
continue;
1434-
if (atc->model == CTSB073X && i == SPDIFIO)
1435-
da_desc.type = SPDIFI_BAY;
1436-
else
1437-
da_desc.type = i;
1440+
da_desc.type = i;
14381441
da_desc.output = (i < LINEIM) || (i == RCA);
14391442
err = daio_mgr->get_daio(daio_mgr, &da_desc,
14401443
(struct daio **)&atc->daios[i]);
@@ -1569,7 +1572,7 @@ static void atc_connect_resources(struct ct_atc *atc)
15691572
mixer->set_input_right(mixer, MIX_MIC_IN, &src->rsc);
15701573
}
15711574

1572-
dai = container_of(atc->daios[SPDIFIO], struct dai, daio);
1575+
dai = container_of(atc->daios[atc_spdif_in_type(atc)], struct dai, daio);
15731576
atc_connect_dai(atc->rsc_mgrs[SRC], dai,
15741577
(struct src **)&atc->srcs[0],
15751578
(struct srcimp **)&atc->srcimps[0]);

sound/pci/ctxfi/ctdaio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ static int daio_device_index(enum DAIOTYP type, struct hw *hw)
120120
switch (type) {
121121
case SPDIFOO: return 0;
122122
case SPDIFIO: return 0;
123-
case SPDIFI_BAY: return 1;
124123
case LINEO1: return 4;
125124
case LINEO2: return 7;
126125
case LINEO3: return 5;

0 commit comments

Comments
 (0)