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.

ASoC: SoundWire codecs: simplify/fix set_stream

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Simplify set_stream in SoundWire codecs.

+83 -328
-3
sound/soc/codecs/cs42l42-sdw.c
··· 152 152 static int cs42l42_sdw_dai_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 153 153 int direction) 154 154 { 155 - if (!sdw_stream) 156 - return 0; 157 - 158 155 snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 159 156 160 157 return 0;
+7 -27
sound/soc/codecs/max98373-sdw.c
··· 20 20 #include "max98373.h" 21 21 #include "max98373-sdw.h" 22 22 23 - struct sdw_stream_data { 24 - struct sdw_stream_runtime *sdw_stream; 25 - }; 26 - 27 23 static const u32 max98373_sdw_cache_reg[] = { 28 24 MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK, 29 25 MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK, ··· 532 536 snd_soc_component_get_drvdata(component); 533 537 struct sdw_stream_config stream_config = {0}; 534 538 struct sdw_port_config port_config = {0}; 535 - struct sdw_stream_data *stream; 539 + struct sdw_stream_runtime *sdw_stream; 536 540 int ret, chan_sz, sampling_rate; 537 541 538 - stream = snd_soc_dai_get_dma_data(dai, substream); 542 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 539 543 540 - if (!stream) 544 + if (!sdw_stream) 541 545 return -EINVAL; 542 546 543 547 if (!max98373->slave) ··· 561 565 } 562 566 563 567 ret = sdw_stream_add_slave(max98373->slave, &stream_config, 564 - &port_config, 1, stream->sdw_stream); 568 + &port_config, 1, sdw_stream); 565 569 if (ret) { 566 570 dev_err(dai->dev, "Unable to configure port\n"); 567 571 return ret; ··· 660 664 struct snd_soc_component *component = dai->component; 661 665 struct max98373_priv *max98373 = 662 666 snd_soc_component_get_drvdata(component); 663 - struct sdw_stream_data *stream = 667 + struct sdw_stream_runtime *sdw_stream = 664 668 snd_soc_dai_get_dma_data(dai, substream); 665 669 666 670 if (!max98373->slave) 667 671 return -EINVAL; 668 672 669 - sdw_stream_remove_slave(max98373->slave, stream->sdw_stream); 673 + sdw_stream_remove_slave(max98373->slave, sdw_stream); 670 674 return 0; 671 675 } 672 676 673 677 static int max98373_set_sdw_stream(struct snd_soc_dai *dai, 674 678 void *sdw_stream, int direction) 675 679 { 676 - struct sdw_stream_data *stream; 677 - 678 - if (!sdw_stream) 679 - return 0; 680 - 681 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 682 - if (!stream) 683 - return -ENOMEM; 684 - 685 - stream->sdw_stream = sdw_stream; 686 - 687 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 688 - snd_soc_dai_dma_data_set(dai, direction, stream); 680 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 689 681 690 682 return 0; 691 683 } ··· 681 697 static void max98373_shutdown(struct snd_pcm_substream *substream, 682 698 struct snd_soc_dai *dai) 683 699 { 684 - struct sdw_stream_data *stream; 685 - 686 - stream = snd_soc_dai_get_dma_data(dai, substream); 687 700 snd_soc_dai_set_dma_data(dai, substream, NULL); 688 - kfree(stream); 689 701 } 690 702 691 703 static int max98373_sdw_set_tdm_slot(struct snd_soc_dai *dai,
+7 -23
sound/soc/codecs/rt1308-sdw.c
··· 496 496 static int rt1308_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 497 497 int direction) 498 498 { 499 - struct sdw_stream_data *stream; 500 - 501 - if (!sdw_stream) 502 - return 0; 503 - 504 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 505 - if (!stream) 506 - return -ENOMEM; 507 - 508 - stream->sdw_stream = sdw_stream; 509 - 510 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 511 - snd_soc_dai_dma_data_set(dai, direction, stream); 499 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 512 500 513 501 return 0; 514 502 } ··· 504 516 static void rt1308_sdw_shutdown(struct snd_pcm_substream *substream, 505 517 struct snd_soc_dai *dai) 506 518 { 507 - struct sdw_stream_data *stream; 508 - 509 - stream = snd_soc_dai_get_dma_data(dai, substream); 510 519 snd_soc_dai_set_dma_data(dai, substream, NULL); 511 - kfree(stream); 512 520 } 513 521 514 522 static int rt1308_sdw_set_tdm_slot(struct snd_soc_dai *dai, ··· 537 553 snd_soc_component_get_drvdata(component); 538 554 struct sdw_stream_config stream_config = {0}; 539 555 struct sdw_port_config port_config = {0}; 540 - struct sdw_stream_data *stream; 556 + struct sdw_stream_runtime *sdw_stream; 541 557 int retval; 542 558 543 559 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 544 - stream = snd_soc_dai_get_dma_data(dai, substream); 560 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 545 561 546 - if (!stream) 562 + if (!sdw_stream) 547 563 return -EINVAL; 548 564 549 565 if (!rt1308->sdw_slave) ··· 564 580 } 565 581 566 582 retval = sdw_stream_add_slave(rt1308->sdw_slave, &stream_config, 567 - &port_config, 1, stream->sdw_stream); 583 + &port_config, 1, sdw_stream); 568 584 if (retval) { 569 585 dev_err(dai->dev, "Unable to configure port\n"); 570 586 return retval; ··· 579 595 struct snd_soc_component *component = dai->component; 580 596 struct rt1308_sdw_priv *rt1308 = 581 597 snd_soc_component_get_drvdata(component); 582 - struct sdw_stream_data *stream = 598 + struct sdw_stream_runtime *sdw_stream = 583 599 snd_soc_dai_get_dma_data(dai, substream); 584 600 585 601 if (!rt1308->sdw_slave) 586 602 return -EINVAL; 587 603 588 - sdw_stream_remove_slave(rt1308->sdw_slave, stream->sdw_stream); 604 + sdw_stream_remove_slave(rt1308->sdw_slave, sdw_stream); 589 605 return 0; 590 606 } 591 607
-4
sound/soc/codecs/rt1308-sdw.h
··· 170 170 unsigned int bq_params_cnt; 171 171 }; 172 172 173 - struct sdw_stream_data { 174 - struct sdw_stream_runtime *sdw_stream; 175 - }; 176 - 177 173 #endif /* __RT1308_SDW_H__ */
+7 -23
sound/soc/codecs/rt1316-sdw.c
··· 494 494 static int rt1316_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 495 495 int direction) 496 496 { 497 - struct sdw_stream_data *stream; 498 - 499 - if (!sdw_stream) 500 - return 0; 501 - 502 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 503 - if (!stream) 504 - return -ENOMEM; 505 - 506 - stream->sdw_stream = sdw_stream; 507 - 508 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 509 - snd_soc_dai_dma_data_set(dai, direction, stream); 497 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 510 498 511 499 return 0; 512 500 } ··· 502 514 static void rt1316_sdw_shutdown(struct snd_pcm_substream *substream, 503 515 struct snd_soc_dai *dai) 504 516 { 505 - struct sdw_stream_data *stream; 506 - 507 - stream = snd_soc_dai_get_dma_data(dai, substream); 508 517 snd_soc_dai_set_dma_data(dai, substream, NULL); 509 - kfree(stream); 510 518 } 511 519 512 520 static int rt1316_sdw_hw_params(struct snd_pcm_substream *substream, ··· 513 529 snd_soc_component_get_drvdata(component); 514 530 struct sdw_stream_config stream_config = {0}; 515 531 struct sdw_port_config port_config = {0}; 516 - struct sdw_stream_data *stream; 532 + struct sdw_stream_runtime *sdw_stream; 517 533 int retval; 518 534 519 535 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 520 - stream = snd_soc_dai_get_dma_data(dai, substream); 536 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 521 537 522 - if (!stream) 538 + if (!sdw_stream) 523 539 return -EINVAL; 524 540 525 541 if (!rt1316->sdw_slave) ··· 535 551 port_config.num = 2; 536 552 537 553 retval = sdw_stream_add_slave(rt1316->sdw_slave, &stream_config, 538 - &port_config, 1, stream->sdw_stream); 554 + &port_config, 1, sdw_stream); 539 555 if (retval) { 540 556 dev_err(dai->dev, "Unable to configure port\n"); 541 557 return retval; ··· 550 566 struct snd_soc_component *component = dai->component; 551 567 struct rt1316_sdw_priv *rt1316 = 552 568 snd_soc_component_get_drvdata(component); 553 - struct sdw_stream_data *stream = 569 + struct sdw_stream_runtime *sdw_stream = 554 570 snd_soc_dai_get_dma_data(dai, substream); 555 571 556 572 if (!rt1316->sdw_slave) 557 573 return -EINVAL; 558 574 559 - sdw_stream_remove_slave(rt1316->sdw_slave, stream->sdw_stream); 575 + sdw_stream_remove_slave(rt1316->sdw_slave, sdw_stream); 560 576 return 0; 561 577 } 562 578
-4
sound/soc/codecs/rt1316-sdw.h
··· 50 50 unsigned int bq_params_cnt; 51 51 }; 52 52 53 - struct sdw_stream_data { 54 - struct sdw_stream_runtime *sdw_stream; 55 - }; 56 - 57 53 #endif /* __RT1316_SDW_H__ */
+7 -23
sound/soc/codecs/rt1318-sdw.c
··· 562 562 static int rt1318_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 563 563 int direction) 564 564 { 565 - struct sdw_stream_data *stream; 566 - 567 - if (!sdw_stream) 568 - return 0; 569 - 570 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 571 - if (!stream) 572 - return -ENOMEM; 573 - 574 - stream->sdw_stream = sdw_stream; 575 - 576 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 577 - snd_soc_dai_dma_data_set(dai, direction, stream); 565 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 578 566 579 567 return 0; 580 568 } ··· 570 582 static void rt1318_sdw_shutdown(struct snd_pcm_substream *substream, 571 583 struct snd_soc_dai *dai) 572 584 { 573 - struct sdw_stream_data *stream; 574 - 575 - stream = snd_soc_dai_get_dma_data(dai, substream); 576 585 snd_soc_dai_set_dma_data(dai, substream, NULL); 577 - kfree(stream); 578 586 } 579 587 580 588 static int rt1318_sdw_hw_params(struct snd_pcm_substream *substream, ··· 582 598 struct sdw_stream_config stream_config; 583 599 struct sdw_port_config port_config; 584 600 enum sdw_data_direction direction; 585 - struct sdw_stream_data *stream; 601 + struct sdw_stream_runtime *sdw_stream; 586 602 int retval, port, num_channels, ch_mask; 587 603 unsigned int sampling_rate; 588 604 589 605 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 590 - stream = snd_soc_dai_get_dma_data(dai, substream); 606 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 591 607 592 - if (!stream) 608 + if (!sdw_stream) 593 609 return -EINVAL; 594 610 595 611 if (!rt1318->sdw_slave) ··· 617 633 port_config.num = port; 618 634 619 635 retval = sdw_stream_add_slave(rt1318->sdw_slave, &stream_config, 620 - &port_config, 1, stream->sdw_stream); 636 + &port_config, 1, sdw_stream); 621 637 if (retval) { 622 638 dev_err(dai->dev, "Unable to configure port\n"); 623 639 return retval; ··· 663 679 struct snd_soc_component *component = dai->component; 664 680 struct rt1318_sdw_priv *rt1318 = 665 681 snd_soc_component_get_drvdata(component); 666 - struct sdw_stream_data *stream = 682 + struct sdw_stream_runtime *sdw_stream = 667 683 snd_soc_dai_get_dma_data(dai, substream); 668 684 669 685 if (!rt1318->sdw_slave) 670 686 return -EINVAL; 671 687 672 - sdw_stream_remove_slave(rt1318->sdw_slave, stream->sdw_stream); 688 + sdw_stream_remove_slave(rt1318->sdw_slave, sdw_stream); 673 689 return 0; 674 690 } 675 691
-4
sound/soc/codecs/rt1318-sdw.h
··· 94 94 bool first_hw_init; 95 95 }; 96 96 97 - struct sdw_stream_data { 98 - struct sdw_stream_runtime *sdw_stream; 99 - }; 100 - 101 97 #endif /* __RT1318_SDW_H__ */
+7 -27
sound/soc/codecs/rt5682-sdw.c
··· 88 88 .reg_write = rt5682_sdw_write, 89 89 }; 90 90 91 - struct sdw_stream_data { 92 - struct sdw_stream_runtime *sdw_stream; 93 - }; 94 - 95 91 static int rt5682_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 96 92 int direction) 97 93 { 98 - struct sdw_stream_data *stream; 99 - 100 - if (!sdw_stream) 101 - return 0; 102 - 103 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 104 - if (!stream) 105 - return -ENOMEM; 106 - 107 - stream->sdw_stream = sdw_stream; 108 - 109 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 110 - snd_soc_dai_dma_data_set(dai, direction, stream); 94 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 111 95 112 96 return 0; 113 97 } ··· 99 115 static void rt5682_sdw_shutdown(struct snd_pcm_substream *substream, 100 116 struct snd_soc_dai *dai) 101 117 { 102 - struct sdw_stream_data *stream; 103 - 104 - stream = snd_soc_dai_get_dma_data(dai, substream); 105 118 snd_soc_dai_set_dma_data(dai, substream, NULL); 106 - kfree(stream); 107 119 } 108 120 109 121 static int rt5682_sdw_hw_params(struct snd_pcm_substream *substream, ··· 110 130 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); 111 131 struct sdw_stream_config stream_config = {0}; 112 132 struct sdw_port_config port_config = {0}; 113 - struct sdw_stream_data *stream; 133 + struct sdw_stream_runtime *sdw_stream; 114 134 int retval; 115 135 unsigned int val_p = 0, val_c = 0, osr_p = 0, osr_c = 0; 116 136 117 137 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 118 138 119 - stream = snd_soc_dai_get_dma_data(dai, substream); 120 - if (!stream) 139 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 140 + if (!sdw_stream) 121 141 return -ENOMEM; 122 142 123 143 if (!rt5682->slave) ··· 132 152 port_config.num = 2; 133 153 134 154 retval = sdw_stream_add_slave(rt5682->slave, &stream_config, 135 - &port_config, 1, stream->sdw_stream); 155 + &port_config, 1, sdw_stream); 136 156 if (retval) { 137 157 dev_err(dai->dev, "Unable to configure port\n"); 138 158 return retval; ··· 226 246 { 227 247 struct snd_soc_component *component = dai->component; 228 248 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); 229 - struct sdw_stream_data *stream = 249 + struct sdw_stream_runtime *sdw_stream = 230 250 snd_soc_dai_get_dma_data(dai, substream); 231 251 232 252 if (!rt5682->slave) 233 253 return -EINVAL; 234 254 235 - sdw_stream_remove_slave(rt5682->slave, stream->sdw_stream); 255 + sdw_stream_remove_slave(rt5682->slave, sdw_stream); 236 256 return 0; 237 257 } 238 258
+7 -23
sound/soc/codecs/rt700.c
··· 875 875 static int rt700_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 876 876 int direction) 877 877 { 878 - struct sdw_stream_data *stream; 879 - 880 - if (!sdw_stream) 881 - return 0; 882 - 883 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 884 - if (!stream) 885 - return -ENOMEM; 886 - 887 - stream->sdw_stream = sdw_stream; 888 - 889 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 890 - snd_soc_dai_dma_data_set(dai, direction, stream); 878 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 891 879 892 880 return 0; 893 881 } ··· 883 895 static void rt700_shutdown(struct snd_pcm_substream *substream, 884 896 struct snd_soc_dai *dai) 885 897 { 886 - struct sdw_stream_data *stream; 887 - 888 - stream = snd_soc_dai_get_dma_data(dai, substream); 889 898 snd_soc_dai_set_dma_data(dai, substream, NULL); 890 - kfree(stream); 891 899 } 892 900 893 901 static int rt700_pcm_hw_params(struct snd_pcm_substream *substream, ··· 894 910 struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); 895 911 struct sdw_stream_config stream_config = {0}; 896 912 struct sdw_port_config port_config = {0}; 897 - struct sdw_stream_data *stream; 913 + struct sdw_stream_runtime *sdw_stream; 898 914 int retval; 899 915 unsigned int val = 0; 900 916 901 917 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 902 - stream = snd_soc_dai_get_dma_data(dai, substream); 918 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 903 919 904 - if (!stream) 920 + if (!sdw_stream) 905 921 return -EINVAL; 906 922 907 923 if (!rt700->slave) ··· 928 944 } 929 945 930 946 retval = sdw_stream_add_slave(rt700->slave, &stream_config, 931 - &port_config, 1, stream->sdw_stream); 947 + &port_config, 1, sdw_stream); 932 948 if (retval) { 933 949 dev_err(dai->dev, "Unable to configure port\n"); 934 950 return retval; ··· 975 991 { 976 992 struct snd_soc_component *component = dai->component; 977 993 struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); 978 - struct sdw_stream_data *stream = 994 + struct sdw_stream_runtime *sdw_stream = 979 995 snd_soc_dai_get_dma_data(dai, substream); 980 996 981 997 if (!rt700->slave) 982 998 return -EINVAL; 983 999 984 - sdw_stream_remove_slave(rt700->slave, stream->sdw_stream); 1000 + sdw_stream_remove_slave(rt700->slave, sdw_stream); 985 1001 return 0; 986 1002 } 987 1003
-4
sound/soc/codecs/rt700.h
··· 27 27 bool disable_irq; 28 28 }; 29 29 30 - struct sdw_stream_data { 31 - struct sdw_stream_runtime *sdw_stream; 32 - }; 33 - 34 30 /* NID */ 35 31 #define RT700_AUDIO_FUNCTION_GROUP 0x01 36 32 #define RT700_DAC_OUT1 0x02
+7 -23
sound/soc/codecs/rt711-sdca.c
··· 1237 1237 static int rt711_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 1238 1238 int direction) 1239 1239 { 1240 - struct sdw_stream_data *stream; 1241 - 1242 - if (!sdw_stream) 1243 - return 0; 1244 - 1245 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 1246 - if (!stream) 1247 - return -ENOMEM; 1248 - 1249 - stream->sdw_stream = sdw_stream; 1250 - 1251 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 1252 - snd_soc_dai_dma_data_set(dai, direction, stream); 1240 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 1253 1241 1254 1242 return 0; 1255 1243 } ··· 1245 1257 static void rt711_sdca_shutdown(struct snd_pcm_substream *substream, 1246 1258 struct snd_soc_dai *dai) 1247 1259 { 1248 - struct sdw_stream_data *stream; 1249 - 1250 - stream = snd_soc_dai_get_dma_data(dai, substream); 1251 1260 snd_soc_dai_set_dma_data(dai, substream, NULL); 1252 - kfree(stream); 1253 1261 } 1254 1262 1255 1263 static int rt711_sdca_pcm_hw_params(struct snd_pcm_substream *substream, ··· 1256 1272 struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); 1257 1273 struct sdw_stream_config stream_config = {0}; 1258 1274 struct sdw_port_config port_config = {0}; 1259 - struct sdw_stream_data *stream; 1275 + struct sdw_stream_runtime *sdw_stream; 1260 1276 int retval; 1261 1277 unsigned int sampling_rate; 1262 1278 1263 1279 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 1264 - stream = snd_soc_dai_get_dma_data(dai, substream); 1280 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 1265 1281 1266 - if (!stream) 1282 + if (!sdw_stream) 1267 1283 return -EINVAL; 1268 1284 1269 1285 if (!rt711->slave) ··· 1284 1300 } 1285 1301 1286 1302 retval = sdw_stream_add_slave(rt711->slave, &stream_config, 1287 - &port_config, 1, stream->sdw_stream); 1303 + &port_config, 1, sdw_stream); 1288 1304 if (retval) { 1289 1305 dev_err(dai->dev, "Unable to configure port\n"); 1290 1306 return retval; ··· 1335 1351 { 1336 1352 struct snd_soc_component *component = dai->component; 1337 1353 struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); 1338 - struct sdw_stream_data *stream = 1354 + struct sdw_stream_runtime *sdw_stream = 1339 1355 snd_soc_dai_get_dma_data(dai, substream); 1340 1356 1341 1357 if (!rt711->slave) 1342 1358 return -EINVAL; 1343 1359 1344 - sdw_stream_remove_slave(rt711->slave, stream->sdw_stream); 1360 + sdw_stream_remove_slave(rt711->slave, sdw_stream); 1345 1361 return 0; 1346 1362 } 1347 1363
-4
sound/soc/codecs/rt711-sdca.h
··· 36 36 bool fu1e_dapm_mute, fu1e_mixer_l_mute, fu1e_mixer_r_mute; 37 37 }; 38 38 39 - struct sdw_stream_data { 40 - struct sdw_stream_runtime *sdw_stream; 41 - }; 42 - 43 39 /* NID */ 44 40 #define RT711_AUDIO_FUNCTION_GROUP 0x01 45 41 #define RT711_DAC_OUT2 0x03
+7 -23
sound/soc/codecs/rt711.c
··· 964 964 static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 965 965 int direction) 966 966 { 967 - struct sdw_stream_data *stream; 968 - 969 - if (!sdw_stream) 970 - return 0; 971 - 972 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 973 - if (!stream) 974 - return -ENOMEM; 975 - 976 - stream->sdw_stream = sdw_stream; 977 - 978 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 979 - snd_soc_dai_dma_data_set(dai, direction, stream); 967 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 980 968 981 969 return 0; 982 970 } ··· 972 984 static void rt711_shutdown(struct snd_pcm_substream *substream, 973 985 struct snd_soc_dai *dai) 974 986 { 975 - struct sdw_stream_data *stream; 976 - 977 - stream = snd_soc_dai_get_dma_data(dai, substream); 978 987 snd_soc_dai_set_dma_data(dai, substream, NULL); 979 - kfree(stream); 980 988 } 981 989 982 990 static int rt711_pcm_hw_params(struct snd_pcm_substream *substream, ··· 983 999 struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); 984 1000 struct sdw_stream_config stream_config = {0}; 985 1001 struct sdw_port_config port_config = {0}; 986 - struct sdw_stream_data *stream; 1002 + struct sdw_stream_runtime *sdw_stream; 987 1003 int retval; 988 1004 unsigned int val = 0; 989 1005 990 1006 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 991 - stream = snd_soc_dai_get_dma_data(dai, substream); 1007 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 992 1008 993 - if (!stream) 1009 + if (!sdw_stream) 994 1010 return -EINVAL; 995 1011 996 1012 if (!rt711->slave) ··· 1011 1027 } 1012 1028 1013 1029 retval = sdw_stream_add_slave(rt711->slave, &stream_config, 1014 - &port_config, 1, stream->sdw_stream); 1030 + &port_config, 1, sdw_stream); 1015 1031 if (retval) { 1016 1032 dev_err(dai->dev, "Unable to configure port\n"); 1017 1033 return retval; ··· 1059 1075 { 1060 1076 struct snd_soc_component *component = dai->component; 1061 1077 struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); 1062 - struct sdw_stream_data *stream = 1078 + struct sdw_stream_runtime *sdw_stream = 1063 1079 snd_soc_dai_get_dma_data(dai, substream); 1064 1080 1065 1081 if (!rt711->slave) 1066 1082 return -EINVAL; 1067 1083 1068 - sdw_stream_remove_slave(rt711->slave, stream->sdw_stream); 1084 + sdw_stream_remove_slave(rt711->slave, sdw_stream); 1069 1085 return 0; 1070 1086 } 1071 1087
-4
sound/soc/codecs/rt711.h
··· 29 29 bool disable_irq; 30 30 }; 31 31 32 - struct sdw_stream_data { 33 - struct sdw_stream_runtime *sdw_stream; 34 - }; 35 - 36 32 /* NID */ 37 33 #define RT711_AUDIO_FUNCTION_GROUP 0x01 38 34 #define RT711_DAC_OUT2 0x03
+7 -23
sound/soc/codecs/rt712-sdca.c
··· 992 992 static int rt712_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 993 993 int direction) 994 994 { 995 - struct sdw_stream_data *stream; 996 - 997 - if (!sdw_stream) 998 - return 0; 999 - 1000 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 1001 - if (!stream) 1002 - return -ENOMEM; 1003 - 1004 - stream->sdw_stream = sdw_stream; 1005 - 1006 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 1007 - snd_soc_dai_dma_data_set(dai, direction, stream); 995 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 1008 996 1009 997 return 0; 1010 998 } ··· 1000 1012 static void rt712_sdca_shutdown(struct snd_pcm_substream *substream, 1001 1013 struct snd_soc_dai *dai) 1002 1014 { 1003 - struct sdw_stream_data *stream; 1004 - 1005 - stream = snd_soc_dai_get_dma_data(dai, substream); 1006 1015 snd_soc_dai_set_dma_data(dai, substream, NULL); 1007 - kfree(stream); 1008 1016 } 1009 1017 1010 1018 static int rt712_sdca_pcm_hw_params(struct snd_pcm_substream *substream, ··· 1012 1028 struct sdw_stream_config stream_config; 1013 1029 struct sdw_port_config port_config; 1014 1030 enum sdw_data_direction direction; 1015 - struct sdw_stream_data *stream; 1031 + struct sdw_stream_runtime *sdw_stream; 1016 1032 int retval, port, num_channels; 1017 1033 unsigned int sampling_rate; 1018 1034 1019 1035 dev_dbg(dai->dev, "%s %s", __func__, dai->name); 1020 - stream = snd_soc_dai_get_dma_data(dai, substream); 1036 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 1021 1037 1022 - if (!stream) 1038 + if (!sdw_stream) 1023 1039 return -EINVAL; 1024 1040 1025 1041 if (!rt712->slave) ··· 1052 1068 port_config.num = port; 1053 1069 1054 1070 retval = sdw_stream_add_slave(rt712->slave, &stream_config, 1055 - &port_config, 1, stream->sdw_stream); 1071 + &port_config, 1, sdw_stream); 1056 1072 if (retval) { 1057 1073 dev_err(dai->dev, "Unable to configure port\n"); 1058 1074 return retval; ··· 1112 1128 { 1113 1129 struct snd_soc_component *component = dai->component; 1114 1130 struct rt712_sdca_priv *rt712 = snd_soc_component_get_drvdata(component); 1115 - struct sdw_stream_data *stream = 1131 + struct sdw_stream_runtime *sdw_stream = 1116 1132 snd_soc_dai_get_dma_data(dai, substream); 1117 1133 1118 1134 if (!rt712->slave) 1119 1135 return -EINVAL; 1120 1136 1121 - sdw_stream_remove_slave(rt712->slave, stream->sdw_stream); 1137 + sdw_stream_remove_slave(rt712->slave, sdw_stream); 1122 1138 return 0; 1123 1139 } 1124 1140
-4
sound/soc/codecs/rt712-sdca.h
··· 40 40 bool fu0f_mixer_r_mute; 41 41 }; 42 42 43 - struct sdw_stream_data { 44 - struct sdw_stream_runtime *sdw_stream; 45 - }; 46 - 47 43 /* NID */ 48 44 #define RT712_VENDOR_REG 0x20 49 45 #define RT712_VENDOR_CALI 0x58
+7 -23
sound/soc/codecs/rt715-sdca.c
··· 784 784 static int rt715_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 785 785 int direction) 786 786 { 787 - struct rt715_sdw_stream_data *stream; 788 - 789 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 790 - if (!stream) 791 - return -ENOMEM; 792 - 793 - stream->sdw_stream = sdw_stream; 794 - 795 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 796 - snd_soc_dai_dma_data_set(dai, direction, stream); 787 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 797 788 798 789 return 0; 799 790 } ··· 793 802 struct snd_soc_dai *dai) 794 803 795 804 { 796 - struct rt715_sdw_stream_data *stream; 797 - 798 - stream = snd_soc_dai_get_dma_data(dai, substream); 799 - if (!stream) 800 - return; 801 - 802 805 snd_soc_dai_set_dma_data(dai, substream, NULL); 803 - kfree(stream); 804 806 } 805 807 806 808 static int rt715_sdca_pcm_hw_params(struct snd_pcm_substream *substream, ··· 804 820 struct rt715_sdca_priv *rt715 = snd_soc_component_get_drvdata(component); 805 821 struct sdw_stream_config stream_config = {0}; 806 822 struct sdw_port_config port_config = {0}; 807 - struct rt715_sdw_stream_data *stream; 823 + struct sdw_stream_runtime *sdw_stream; 808 824 int retval; 809 825 unsigned int val; 810 826 811 - stream = snd_soc_dai_get_dma_data(dai, substream); 827 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 812 828 813 - if (!stream) 829 + if (!sdw_stream) 814 830 return -EINVAL; 815 831 816 832 if (!rt715->slave) ··· 835 851 } 836 852 837 853 retval = sdw_stream_add_slave(rt715->slave, &stream_config, 838 - &port_config, 1, stream->sdw_stream); 854 + &port_config, 1, sdw_stream); 839 855 if (retval) { 840 856 dev_err(component->dev, "Unable to configure port, retval:%d\n", 841 857 retval); ··· 906 922 { 907 923 struct snd_soc_component *component = dai->component; 908 924 struct rt715_sdca_priv *rt715 = snd_soc_component_get_drvdata(component); 909 - struct rt715_sdw_stream_data *stream = 925 + struct sdw_stream_runtime *sdw_stream = 910 926 snd_soc_dai_get_dma_data(dai, substream); 911 927 912 928 if (!rt715->slave) 913 929 return -EINVAL; 914 930 915 - sdw_stream_remove_slave(rt715->slave, stream->sdw_stream); 931 + sdw_stream_remove_slave(rt715->slave, sdw_stream); 916 932 return 0; 917 933 } 918 934
-4
sound/soc/codecs/rt715-sdca.h
··· 37 37 int kctl_8ch_orig[8]; 38 38 }; 39 39 40 - struct rt715_sdw_stream_data { 41 - struct sdw_stream_runtime *sdw_stream; 42 - }; 43 - 44 40 struct rt715_sdca_kcontrol_private { 45 41 unsigned int reg_base; 46 42 unsigned int count;
+7 -23
sound/soc/codecs/rt715.c
··· 765 765 int direction) 766 766 { 767 767 768 - struct sdw_stream_data *stream; 769 - 770 - if (!sdw_stream) 771 - return 0; 772 - 773 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 774 - if (!stream) 775 - return -ENOMEM; 776 - 777 - stream->sdw_stream = sdw_stream; 778 - 779 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 780 - snd_soc_dai_dma_data_set(dai, direction, stream); 768 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 781 769 782 770 return 0; 783 771 } ··· 774 786 struct snd_soc_dai *dai) 775 787 776 788 { 777 - struct sdw_stream_data *stream; 778 - 779 - stream = snd_soc_dai_get_dma_data(dai, substream); 780 789 snd_soc_dai_set_dma_data(dai, substream, NULL); 781 - kfree(stream); 782 790 } 783 791 784 792 static int rt715_pcm_hw_params(struct snd_pcm_substream *substream, ··· 785 801 struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component); 786 802 struct sdw_stream_config stream_config = {0}; 787 803 struct sdw_port_config port_config = {0}; 788 - struct sdw_stream_data *stream; 804 + struct sdw_stream_runtime *sdw_stream; 789 805 int retval; 790 806 unsigned int val = 0; 791 807 792 - stream = snd_soc_dai_get_dma_data(dai, substream); 808 + sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 793 809 794 - if (!stream) 810 + if (!sdw_stream) 795 811 return -EINVAL; 796 812 797 813 if (!rt715->slave) ··· 814 830 } 815 831 816 832 retval = sdw_stream_add_slave(rt715->slave, &stream_config, 817 - &port_config, 1, stream->sdw_stream); 833 + &port_config, 1, sdw_stream); 818 834 if (retval) { 819 835 dev_err(dai->dev, "Unable to configure port\n"); 820 836 return retval; ··· 877 893 { 878 894 struct snd_soc_component *component = dai->component; 879 895 struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component); 880 - struct sdw_stream_data *stream = 896 + struct sdw_stream_runtime *sdw_stream = 881 897 snd_soc_dai_get_dma_data(dai, substream); 882 898 883 899 if (!rt715->slave) 884 900 return -EINVAL; 885 901 886 - sdw_stream_remove_slave(rt715->slave, stream->sdw_stream); 902 + sdw_stream_remove_slave(rt715->slave, sdw_stream); 887 903 return 0; 888 904 } 889 905
-4
sound/soc/codecs/rt715.h
··· 27 27 unsigned int kctl_8ch_vol_ori[8]; 28 28 }; 29 29 30 - struct sdw_stream_data { 31 - struct sdw_stream_runtime *sdw_stream; 32 - }; 33 - 34 30 /* NID */ 35 31 #define RT715_AUDIO_FUNCTION_GROUP 0x01 36 32 #define RT715_MIC_ADC 0x07
+6 -28
sound/soc/codecs/sdw-mockup.c
··· 23 23 struct sdw_slave *slave; 24 24 }; 25 25 26 - struct sdw_stream_data { 27 - struct sdw_stream_runtime *sdw_stream; 28 - }; 29 - 30 26 static int sdw_mockup_component_probe(struct snd_soc_component *component) 31 27 { 32 28 return 0; ··· 41 45 static int sdw_mockup_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, 42 46 int direction) 43 47 { 44 - struct sdw_stream_data *stream; 45 - 46 - if (!sdw_stream) 47 - return 0; 48 - 49 - stream = kzalloc(sizeof(*stream), GFP_KERNEL); 50 - if (!stream) 51 - return -ENOMEM; 52 - 53 - stream->sdw_stream = sdw_stream; 54 - 55 - /* Use tx_mask or rx_mask to configure stream tag and set dma_data */ 56 - snd_soc_dai_dma_data_set(dai, direction, stream); 48 + snd_soc_dai_dma_data_set(dai, direction, sdw_stream); 57 49 58 50 return 0; 59 51 } ··· 49 65 static void sdw_mockup_shutdown(struct snd_pcm_substream *substream, 50 66 struct snd_soc_dai *dai) 51 67 { 52 - struct sdw_stream_data *stream; 53 - 54 - stream = snd_soc_dai_get_dma_data(dai, substream); 55 68 snd_soc_dai_set_dma_data(dai, substream, NULL); 56 - kfree(stream); 57 69 } 58 70 59 71 static int sdw_mockup_pcm_hw_params(struct snd_pcm_substream *substream, ··· 60 80 struct sdw_mockup_priv *sdw_mockup = snd_soc_component_get_drvdata(component); 61 81 struct sdw_stream_config stream_config = {0}; 62 82 struct sdw_port_config port_config = {0}; 63 - struct sdw_stream_data *stream; 83 + struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 64 84 int ret; 65 85 66 - stream = snd_soc_dai_get_dma_data(dai, substream); 67 - if (!stream) 86 + if (!sdw_stream) 68 87 return -EINVAL; 69 88 70 89 if (!sdw_mockup->slave) ··· 78 99 port_config.num = 8; 79 100 80 101 ret = sdw_stream_add_slave(sdw_mockup->slave, &stream_config, 81 - &port_config, 1, stream->sdw_stream); 102 + &port_config, 1, sdw_stream); 82 103 if (ret) 83 104 dev_err(dai->dev, "Unable to configure port\n"); 84 105 ··· 90 111 { 91 112 struct snd_soc_component *component = dai->component; 92 113 struct sdw_mockup_priv *sdw_mockup = snd_soc_component_get_drvdata(component); 93 - struct sdw_stream_data *stream = 94 - snd_soc_dai_get_dma_data(dai, substream); 114 + struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream); 95 115 96 116 if (!sdw_mockup->slave) 97 117 return -EINVAL; 98 118 99 - sdw_stream_remove_slave(sdw_mockup->slave, stream->sdw_stream); 119 + sdw_stream_remove_slave(sdw_mockup->slave, sdw_stream); 100 120 return 0; 101 121 } 102 122