Skip to content

Commit e0767e3

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: cadence: rename sdw_cdns_dai_dma_data as sdw_cdns_dai_runtime
The existing 'struct sdw_cdns_dma_data' has really nothing to do with DMAs. The information is stored in the dai->dma_data, but this is really private data that should be stored in a different context. Beyond the academic elegance discussion, using dma_data is a problem for new Intel hardware where the dma_data structure is already used for true DMA handling performed by other parts of the code. This patch prepares a transition away from the use of dma_data, for now with a rename-only change. Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent cf43cd3 commit e0767e3

File tree

3 files changed

+65
-65
lines changed

3 files changed

+65
-65
lines changed

drivers/soundwire/cadence_master.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,40 +1707,40 @@ int cdns_set_sdw_stream(struct snd_soc_dai *dai,
17071707
void *stream, int direction)
17081708
{
17091709
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
1710-
struct sdw_cdns_dma_data *dma;
1710+
struct sdw_cdns_dai_runtime *dai_runtime;
17111711

17121712
if (stream) {
17131713
/* first paranoia check */
17141714
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
1715-
dma = dai->playback_dma_data;
1715+
dai_runtime = dai->playback_dma_data;
17161716
else
1717-
dma = dai->capture_dma_data;
1717+
dai_runtime = dai->capture_dma_data;
17181718

1719-
if (dma) {
1719+
if (dai_runtime) {
17201720
dev_err(dai->dev,
1721-
"dma_data already allocated for dai %s\n",
1721+
"dai_runtime already allocated for dai %s\n",
17221722
dai->name);
17231723
return -EINVAL;
17241724
}
17251725

1726-
/* allocate and set dma info */
1727-
dma = kzalloc(sizeof(*dma), GFP_KERNEL);
1728-
if (!dma)
1726+
/* allocate and set dai_runtime info */
1727+
dai_runtime = kzalloc(sizeof(*dai_runtime), GFP_KERNEL);
1728+
if (!dai_runtime)
17291729
return -ENOMEM;
17301730

1731-
dma->stream_type = SDW_STREAM_PCM;
1731+
dai_runtime->stream_type = SDW_STREAM_PCM;
17321732

1733-
dma->bus = &cdns->bus;
1734-
dma->link_id = cdns->instance;
1733+
dai_runtime->bus = &cdns->bus;
1734+
dai_runtime->link_id = cdns->instance;
17351735

1736-
dma->stream = stream;
1736+
dai_runtime->stream = stream;
17371737

17381738
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
1739-
dai->playback_dma_data = dma;
1739+
dai->playback_dma_data = dai_runtime;
17401740
else
1741-
dai->capture_dma_data = dma;
1741+
dai->capture_dma_data = dai_runtime;
17421742
} else {
1743-
/* for NULL stream we release allocated dma_data */
1743+
/* for NULL stream we release allocated dai_runtime */
17441744
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
17451745
kfree(dai->playback_dma_data);
17461746
dai->playback_dma_data = NULL;

drivers/soundwire/cadence_master.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct sdw_cdns_stream_config {
7070
};
7171

7272
/**
73-
* struct sdw_cdns_dma_data: Cadence DMA data
73+
* struct sdw_cdns_dai_runtime: Cadence DAI runtime data
7474
*
7575
* @name: SoundWire stream name
7676
* @stream: stream runtime
@@ -82,7 +82,7 @@ struct sdw_cdns_stream_config {
8282
* @suspended: status set when suspended, to be used in .prepare
8383
* @paused: status set in .trigger, to be used in suspend
8484
*/
85-
struct sdw_cdns_dma_data {
85+
struct sdw_cdns_dai_runtime {
8686
char *name;
8787
struct sdw_stream_runtime *stream;
8888
struct sdw_cdns_pdi *pdi;

drivers/soundwire/intel.c

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -824,15 +824,15 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
824824
{
825825
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
826826
struct sdw_intel *sdw = cdns_to_intel(cdns);
827-
struct sdw_cdns_dma_data *dma;
827+
struct sdw_cdns_dai_runtime *dai_runtime;
828828
struct sdw_cdns_pdi *pdi;
829829
struct sdw_stream_config sconfig;
830830
struct sdw_port_config *pconfig;
831831
int ch, dir;
832832
int ret;
833833

834-
dma = snd_soc_dai_get_dma_data(dai, substream);
835-
if (!dma)
834+
dai_runtime = snd_soc_dai_get_dma_data(dai, substream);
835+
if (!dai_runtime)
836836
return -EIO;
837837

838838
ch = params_channels(params);
@@ -854,10 +854,10 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
854854
sdw_cdns_config_stream(cdns, ch, dir, pdi);
855855

856856
/* store pdi and hw_params, may be needed in prepare step */
857-
dma->paused = false;
858-
dma->suspended = false;
859-
dma->pdi = pdi;
860-
dma->hw_params = params;
857+
dai_runtime->paused = false;
858+
dai_runtime->suspended = false;
859+
dai_runtime->pdi = pdi;
860+
dai_runtime->hw_params = params;
861861

862862
/* Inform DSP about PDI stream number */
863863
ret = intel_params_stream(sdw, substream->stream, dai, params,
@@ -869,7 +869,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
869869
sconfig.direction = dir;
870870
sconfig.ch_count = ch;
871871
sconfig.frame_rate = params_rate(params);
872-
sconfig.type = dma->stream_type;
872+
sconfig.type = dai_runtime->stream_type;
873873

874874
sconfig.bps = snd_pcm_format_width(params_format(params));
875875

@@ -884,7 +884,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
884884
pconfig->ch_mask = (1 << ch) - 1;
885885

886886
ret = sdw_stream_add_master(&cdns->bus, &sconfig,
887-
pconfig, 1, dma->stream);
887+
pconfig, 1, dai_runtime->stream);
888888
if (ret)
889889
dev_err(cdns->dev, "add master to stream failed:%d\n", ret);
890890

@@ -898,19 +898,19 @@ static int intel_prepare(struct snd_pcm_substream *substream,
898898
{
899899
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
900900
struct sdw_intel *sdw = cdns_to_intel(cdns);
901-
struct sdw_cdns_dma_data *dma;
901+
struct sdw_cdns_dai_runtime *dai_runtime;
902902
int ch, dir;
903903
int ret = 0;
904904

905-
dma = snd_soc_dai_get_dma_data(dai, substream);
906-
if (!dma) {
907-
dev_err(dai->dev, "failed to get dma data in %s\n",
905+
dai_runtime = snd_soc_dai_get_dma_data(dai, substream);
906+
if (!dai_runtime) {
907+
dev_err(dai->dev, "failed to get dai runtime in %s\n",
908908
__func__);
909909
return -EIO;
910910
}
911911

912-
if (dma->suspended) {
913-
dma->suspended = false;
912+
if (dai_runtime->suspended) {
913+
dai_runtime->suspended = false;
914914

915915
/*
916916
* .prepare() is called after system resume, where we
@@ -921,21 +921,21 @@ static int intel_prepare(struct snd_pcm_substream *substream,
921921
*/
922922

923923
/* configure stream */
924-
ch = params_channels(dma->hw_params);
924+
ch = params_channels(dai_runtime->hw_params);
925925
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
926926
dir = SDW_DATA_DIR_RX;
927927
else
928928
dir = SDW_DATA_DIR_TX;
929929

930-
intel_pdi_shim_configure(sdw, dma->pdi);
931-
intel_pdi_alh_configure(sdw, dma->pdi);
932-
sdw_cdns_config_stream(cdns, ch, dir, dma->pdi);
930+
intel_pdi_shim_configure(sdw, dai_runtime->pdi);
931+
intel_pdi_alh_configure(sdw, dai_runtime->pdi);
932+
sdw_cdns_config_stream(cdns, ch, dir, dai_runtime->pdi);
933933

934934
/* Inform DSP about PDI stream number */
935935
ret = intel_params_stream(sdw, substream->stream, dai,
936-
dma->hw_params,
936+
dai_runtime->hw_params,
937937
sdw->instance,
938-
dma->pdi->intel_alh_id);
938+
dai_runtime->pdi->intel_alh_id);
939939
}
940940

941941
return ret;
@@ -946,11 +946,11 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
946946
{
947947
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
948948
struct sdw_intel *sdw = cdns_to_intel(cdns);
949-
struct sdw_cdns_dma_data *dma;
949+
struct sdw_cdns_dai_runtime *dai_runtime;
950950
int ret;
951951

952-
dma = snd_soc_dai_get_dma_data(dai, substream);
953-
if (!dma)
952+
dai_runtime = snd_soc_dai_get_dma_data(dai, substream);
953+
if (!dai_runtime)
954954
return -EIO;
955955

956956
/*
@@ -959,10 +959,10 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
959959
* DEPREPARED for the first cpu-dai and to RELEASED for the last
960960
* cpu-dai.
961961
*/
962-
ret = sdw_stream_remove_master(&cdns->bus, dma->stream);
962+
ret = sdw_stream_remove_master(&cdns->bus, dai_runtime->stream);
963963
if (ret < 0) {
964964
dev_err(dai->dev, "remove master from stream %s failed: %d\n",
965-
dma->stream->name, ret);
965+
dai_runtime->stream->name, ret);
966966
return ret;
967967
}
968968

@@ -972,8 +972,8 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
972972
return ret;
973973
}
974974

975-
dma->hw_params = NULL;
976-
dma->pdi = NULL;
975+
dai_runtime->hw_params = NULL;
976+
dai_runtime->pdi = NULL;
977977

978978
return 0;
979979
}
@@ -996,25 +996,25 @@ static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai,
996996
static void *intel_get_sdw_stream(struct snd_soc_dai *dai,
997997
int direction)
998998
{
999-
struct sdw_cdns_dma_data *dma;
999+
struct sdw_cdns_dai_runtime *dai_runtime;
10001000

10011001
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
1002-
dma = dai->playback_dma_data;
1002+
dai_runtime = dai->playback_dma_data;
10031003
else
1004-
dma = dai->capture_dma_data;
1004+
dai_runtime = dai->capture_dma_data;
10051005

1006-
if (!dma)
1006+
if (!dai_runtime)
10071007
return ERR_PTR(-EINVAL);
10081008

1009-
return dma->stream;
1009+
return dai_runtime->stream;
10101010
}
10111011

10121012
static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai)
10131013
{
10141014
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
10151015
struct sdw_intel *sdw = cdns_to_intel(cdns);
10161016
struct sdw_intel_link_res *res = sdw->link_res;
1017-
struct sdw_cdns_dma_data *dma;
1017+
struct sdw_cdns_dai_runtime *dai_runtime;
10181018
int ret = 0;
10191019

10201020
/*
@@ -1025,9 +1025,9 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
10251025
if (res->ops && res->ops->trigger)
10261026
res->ops->trigger(dai, cmd, substream->stream);
10271027

1028-
dma = snd_soc_dai_get_dma_data(dai, substream);
1029-
if (!dma) {
1030-
dev_err(dai->dev, "failed to get dma data in %s\n",
1028+
dai_runtime = snd_soc_dai_get_dma_data(dai, substream);
1029+
if (!dai_runtime) {
1030+
dev_err(dai->dev, "failed to get dai runtime in %s\n",
10311031
__func__);
10321032
return -EIO;
10331033
}
@@ -1042,17 +1042,17 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
10421042
* the .trigger callback is used to track the suspend case only.
10431043
*/
10441044

1045-
dma->suspended = true;
1045+
dai_runtime->suspended = true;
10461046

10471047
ret = intel_free_stream(sdw, substream->stream, dai, sdw->instance);
10481048
break;
10491049

10501050
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1051-
dma->paused = true;
1051+
dai_runtime->paused = true;
10521052
break;
10531053
case SNDRV_PCM_TRIGGER_STOP:
10541054
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1055-
dma->paused = false;
1055+
dai_runtime->paused = false;
10561056
break;
10571057
default:
10581058
break;
@@ -1091,25 +1091,25 @@ static int intel_component_dais_suspend(struct snd_soc_component *component)
10911091
for_each_component_dais(component, dai) {
10921092
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
10931093
struct sdw_intel *sdw = cdns_to_intel(cdns);
1094-
struct sdw_cdns_dma_data *dma;
1094+
struct sdw_cdns_dai_runtime *dai_runtime;
10951095
int stream;
10961096
int ret;
10971097

1098-
dma = dai->playback_dma_data;
1098+
dai_runtime = dai->playback_dma_data;
10991099
stream = SNDRV_PCM_STREAM_PLAYBACK;
1100-
if (!dma) {
1101-
dma = dai->capture_dma_data;
1100+
if (!dai_runtime) {
1101+
dai_runtime = dai->capture_dma_data;
11021102
stream = SNDRV_PCM_STREAM_CAPTURE;
11031103
}
11041104

1105-
if (!dma)
1105+
if (!dai_runtime)
11061106
continue;
11071107

1108-
if (dma->suspended)
1108+
if (dai_runtime->suspended)
11091109
continue;
11101110

1111-
if (dma->paused) {
1112-
dma->suspended = true;
1111+
if (dai_runtime->paused) {
1112+
dai_runtime->suspended = true;
11131113

11141114
ret = intel_free_stream(sdw, stream, dai, sdw->instance);
11151115
if (ret < 0)

0 commit comments

Comments
 (0)