Skip to content

Commit

Permalink
ASoC: remove bespoke trigger support
Browse files Browse the repository at this point in the history
Bespoke trigger support was added when Linux v3.5 by this patch.

	commit 07bf84a
	("ASoC: dpcm: Add bespoke trigger()")

test-component driver is using it, but this is because it indicates used
function for debug/trace purpose. Except test-component driver, bespoke
trigger has never been used over 10 years in upstream.

We can re-support it if needed in the future, but let's remove it for now,
because it just noise in upstream.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87v80ewmdi.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Aug 6, 2024
1 parent cf410c1 commit 7d2fb38
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 77 deletions.
5 changes: 1 addition & 4 deletions include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd);
int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream);
int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd,
int rollback);
int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
int cmd);
void snd_soc_pcm_dai_delay(struct snd_pcm_substream *substream,
snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);

Expand Down Expand Up @@ -345,8 +343,7 @@ struct snd_soc_dai_ops {
*/
int (*trigger)(struct snd_pcm_substream *, int,
struct snd_soc_dai *);
int (*bespoke_trigger)(struct snd_pcm_substream *, int,
struct snd_soc_dai *);

/*
* For hardware based FIFO caused delay reporting.
* Optional.
Expand Down
1 change: 0 additions & 1 deletion include/sound/soc-dpcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ enum snd_soc_dpcm_state {
enum snd_soc_dpcm_trigger {
SND_SOC_DPCM_TRIGGER_PRE = 0,
SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_BESPOKE,
};

/*
Expand Down
9 changes: 0 additions & 9 deletions sound/soc/generic/test-component.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,6 @@ static int test_dai_trigger(struct snd_pcm_substream *substream, int cmd, struct
return 0;
}

static int test_dai_bespoke_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{
mile_stone(dai);

return 0;
}

static const u64 test_dai_formats =
/*
* Select below from Sound Card, not auto
Expand Down Expand Up @@ -228,7 +220,6 @@ static const struct snd_soc_dai_ops test_verbose_ops = {
.hw_params = test_dai_hw_params,
.hw_free = test_dai_hw_free,
.trigger = test_dai_trigger,
.bespoke_trigger = test_dai_bespoke_trigger,
.auto_selectable_formats = &test_dai_formats,
.num_auto_selectable_formats = 1,
};
Expand Down
20 changes: 0 additions & 20 deletions sound/soc/soc-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,26 +685,6 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
return ret;
}

int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
int cmd)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *dai;
int i, ret;

for_each_rtd_dais(rtd, i, dai) {
if (dai->driver->ops &&
dai->driver->ops->bespoke_trigger) {
ret = dai->driver->ops->bespoke_trigger(substream,
cmd, dai);
if (ret < 0)
return soc_dai_ret(dai, ret);
}
}

return 0;
}

void snd_soc_pcm_dai_delay(struct snd_pcm_substream *substream,
snd_pcm_sframes_t *cpu_delay,
snd_pcm_sframes_t *codec_delay)
Expand Down
47 changes: 4 additions & 43 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,14 +2388,6 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
break;
}
break;
case SND_SOC_DPCM_TRIGGER_BESPOKE:
/* bespoke trigger() - handles both FE and BEs */

dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n",
fe->dai_link->name, cmd);

ret = snd_soc_pcm_dai_bespoke_trigger(substream, cmd);
break;
default:
dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd,
fe->dai_link->name);
Expand Down Expand Up @@ -2525,26 +2517,12 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)

static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
{
struct snd_pcm_substream *substream =
snd_soc_dpcm_get_substream(fe, stream);
enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream];
int err;

dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n",
snd_pcm_direction_name(stream), fe->dai_link->name);

if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) {
/* call bespoke trigger - FE takes care of all BE triggers */
dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n",
fe->dai_link->name);

err = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
} else {
dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n",
fe->dai_link->name);

err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP);
}
err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP);

dpcm_be_dai_hw_free(fe, stream);

Expand All @@ -2558,10 +2536,7 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)

static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
{
struct snd_pcm_substream *substream =
snd_soc_dpcm_get_substream(fe, stream);
struct snd_soc_dpcm *dpcm;
enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream];
int ret = 0;

dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n",
Expand Down Expand Up @@ -2605,23 +2580,9 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP)
return 0;

if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) {
/* call trigger on the frontend - FE takes care of all BE triggers */
dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n",
fe->dai_link->name);

ret = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START);
if (ret < 0)
goto hw_free;
} else {
dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n",
fe->dai_link->name);

ret = dpcm_be_dai_trigger(fe, stream,
SNDRV_PCM_TRIGGER_START);
if (ret < 0)
goto hw_free;
}
ret = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_START);
if (ret < 0)
goto hw_free;

return 0;

Expand Down

0 comments on commit 7d2fb38

Please sign in to comment.