Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: ctxfi: Use explicit output flag for DAIO resources

Replace the index-based type check with an explicit output flag in
struct daio and struct daio_desc.

This allows handling DAIO resource types correctly regardless of their
index. This is necessary for hardware variants where resource types do
not follow a sequential order.

Signed-off-by: Harin Lee <me@harin.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20251124180501.2760421-4-me@harin.net

authored by

Harin Lee and committed by
Takashi Iwai
9bb003a1 4b490e0d

+11 -8
+2 -1
sound/pci/ctxfi/ctatc.c
··· 1163 1163 daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; 1164 1164 for (i = 0; i < atc->n_daio; i++) { 1165 1165 daio = atc->daios[i]; 1166 - if (daio->type < LINEIM) { 1166 + if (daio->output) { 1167 1167 dao = container_of(daio, struct dao, daio); 1168 1168 dao->ops->clear_left_input(dao); 1169 1169 dao->ops->clear_right_input(dao); ··· 1393 1393 for (i = 0, atc->n_daio = 0; i < num_daios; i++) { 1394 1394 da_desc.type = (atc->model != CTSB073X) ? i : 1395 1395 ((i == SPDIFIO) ? SPDIFI1 : i); 1396 + da_desc.output = i < LINEIM; 1396 1397 err = daio_mgr->get_daio(daio_mgr, &da_desc, 1397 1398 (struct daio **)&atc->daios[i]); 1398 1399 if (err) {
+7 -7
sound/pci/ctxfi/ctdaio.c
··· 18 18 #include <linux/slab.h> 19 19 #include <linux/kernel.h> 20 20 21 - #define DAIO_OUT_MAX SPDIFOO 22 - 23 21 struct daio_usage { 24 22 unsigned short data; 25 23 }; ··· 327 329 goto error1; 328 330 329 331 /* Set daio->rscl/r->ops to daio specific ones */ 330 - if (desc->type <= DAIO_OUT_MAX) { 332 + if (desc->output) { 331 333 daio->rscl.ops = daio->rscr.ops = &daio_out_rsc_ops; 332 334 } else { 333 335 switch (hw->chip_type) { ··· 342 344 } 343 345 } 344 346 daio->type = desc->type; 347 + daio->output = desc->output; 345 348 346 349 return 0; 347 350 ··· 432 433 dsc.type = dao->daio.type; 433 434 dsc.msr = desc->msr; 434 435 dsc.passthru = desc->passthru; 436 + dsc.output = dao->daio.output; 435 437 dao_rsc_uninit(dao); 436 438 return dao_rsc_init(dao, &dsc, mgr); 437 439 } ··· 518 518 519 519 err = -ENOMEM; 520 520 /* Allocate mem for daio resource */ 521 - if (desc->type <= DAIO_OUT_MAX) { 521 + if (desc->output) { 522 522 struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL); 523 523 if (!dao) 524 524 goto error; ··· 565 565 daio_mgr_put_rsc(&mgr->mgr, daio->type); 566 566 } 567 567 568 - if (daio->type <= DAIO_OUT_MAX) { 568 + if (daio->output) { 569 569 dao_rsc_uninit(container_of(daio, struct dao, daio)); 570 570 kfree(container_of(daio, struct dao, daio)); 571 571 } else { ··· 580 580 { 581 581 struct hw *hw = mgr->mgr.hw; 582 582 583 - if (DAIO_OUT_MAX >= daio->type) { 583 + if (daio->output) { 584 584 hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk, 585 585 daio_device_index(daio->type, hw)); 586 586 } else { ··· 594 594 { 595 595 struct hw *hw = mgr->mgr.hw; 596 596 597 - if (DAIO_OUT_MAX >= daio->type) { 597 + if (daio->output) { 598 598 hw->daio_mgr_dsb_dao(mgr->mgr.ctrl_blk, 599 599 daio_device_index(daio->type, hw)); 600 600 } else {
+2
sound/pci/ctxfi/ctdaio.h
··· 43 43 struct rsc rscl; /* Basic resource info for left TX/RX */ 44 44 struct rsc rscr; /* Basic resource info for right TX/RX */ 45 45 enum DAIOTYP type; 46 + unsigned char output; 46 47 }; 47 48 48 49 struct dao { ··· 92 91 unsigned int type:4; 93 92 unsigned int msr:4; 94 93 unsigned int passthru:1; 94 + unsigned int output:1; 95 95 }; 96 96 97 97 struct daio_mgr {