2019-07-22 01:32:12 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// soc-dai.c
|
|
|
|
//
|
|
|
|
// Copyright (C) 2019 Renesas Electronics Corp.
|
|
|
|
// Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <sound/soc.h>
|
|
|
|
#include <sound/soc-dai.h>
|
2020-05-25 00:57:36 +00:00
|
|
|
#include <sound/soc-link.h>
|
2019-07-22 01:32:12 +00:00
|
|
|
|
2020-04-23 23:14:38 +00:00
|
|
|
#define soc_dai_ret(dai, ret) _soc_dai_ret(dai, __func__, ret)
|
|
|
|
static inline int _soc_dai_ret(struct snd_soc_dai *dai,
|
|
|
|
const char *func, int ret)
|
|
|
|
{
|
2020-05-29 12:36:13 +00:00
|
|
|
/* Positive, Zero values are not errors */
|
|
|
|
if (ret >= 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Negative values might be errors */
|
2020-04-23 23:14:38 +00:00
|
|
|
switch (ret) {
|
|
|
|
case -EPROBE_DEFER:
|
|
|
|
case -ENOTSUPP:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dev_err(dai->dev,
|
|
|
|
"ASoC: error at %s on %s: %d\n",
|
|
|
|
func, dai->name, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().
static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;
^ config_err:
| ...
| rtd_startup_err:
(A) ...
| component_err:
| ...
v return ret;
}
The difference is
soc_pcm_close() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.
Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()
This patch is for 1) snd_soc_dai_startup/shutdown().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 00:00:40 +00:00
|
|
|
/*
|
|
|
|
* We might want to check substream by using list.
|
|
|
|
* In such case, we can update these macros.
|
|
|
|
*/
|
|
|
|
#define soc_dai_mark_push(dai, substream, tgt) ((dai)->mark_##tgt = substream)
|
|
|
|
#define soc_dai_mark_pop(dai, substream, tgt) ((dai)->mark_##tgt = NULL)
|
|
|
|
#define soc_dai_mark_match(dai, substream, tgt) ((dai)->mark_##tgt == substream)
|
|
|
|
|
2019-07-22 01:32:12 +00:00
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_sysclk - configure DAI system or master clock.
|
|
|
|
* @dai: DAI
|
|
|
|
* @clk_id: DAI specific clock ID
|
|
|
|
* @freq: new clock frequency in Hz
|
|
|
|
* @dir: new clock direction - input/output.
|
|
|
|
*
|
|
|
|
* Configures the DAI master (MCLK) or system (SYSCLK) clocking.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
|
|
|
|
unsigned int freq, int dir)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_sysclk)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_sysclk(dai, clk_id, freq, dir);
|
|
|
|
else
|
|
|
|
ret = snd_soc_component_set_sysclk(dai->component, clk_id, 0,
|
|
|
|
freq, dir);
|
2019-07-22 01:32:12 +00:00
|
|
|
|
2020-04-23 23:14:38 +00:00
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_clkdiv - configure DAI clock dividers.
|
|
|
|
* @dai: DAI
|
|
|
|
* @div_id: DAI specific clock divider ID
|
|
|
|
* @div: new clock divisor.
|
|
|
|
*
|
|
|
|
* Configures the clock dividers. This is used to derive the best DAI bit and
|
|
|
|
* frame clocks from the system or master clock. It's best to set the DAI bit
|
|
|
|
* and frame clocks as low as possible to save system power.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
|
|
|
|
int div_id, int div)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -EINVAL;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_clkdiv)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_clkdiv(dai, div_id, div);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_clkdiv);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_pll - configure DAI PLL.
|
|
|
|
* @dai: DAI
|
|
|
|
* @pll_id: DAI specific PLL ID
|
|
|
|
* @source: DAI specific source for the PLL
|
|
|
|
* @freq_in: PLL input clock frequency in Hz
|
|
|
|
* @freq_out: requested PLL output clock frequency in Hz
|
|
|
|
*
|
|
|
|
* Configures and enables PLL to generate output clock based on input clock.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source,
|
|
|
|
unsigned int freq_in, unsigned int freq_out)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_pll)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_pll(dai, pll_id, source,
|
|
|
|
freq_in, freq_out);
|
|
|
|
else
|
|
|
|
ret = snd_soc_component_set_pll(dai->component, pll_id, source,
|
|
|
|
freq_in, freq_out);
|
2019-07-22 01:32:12 +00:00
|
|
|
|
2020-04-23 23:14:38 +00:00
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio.
|
|
|
|
* @dai: DAI
|
|
|
|
* @ratio: Ratio of BCLK to Sample rate.
|
|
|
|
*
|
|
|
|
* Configures the DAI for a preset BCLK to sample rate ratio.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
|
|
|
|
{
|
2022-08-18 16:53:36 +00:00
|
|
|
int ret = -ENOTSUPP;
|
2020-04-23 23:14:38 +00:00
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_bclk_ratio)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_bclk_ratio(dai, ratio);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio);
|
|
|
|
|
ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()
ASoC is using dai_link which specify DAI format (= dai_link->dai_fmt),
and it is selected by "Sound Card" driver in corrent implementation.
In other words, Sound Card *needs* to setup it.
But, it should be possible to automatically selected from CPU and
Codec driver settings.
This patch adds new .auto_selectable_formats support
at snd_soc_dai_ops.
By this patch, dai_fmt can be automatically selected from each
driver if both CPU / Codec driver had it.
Automatically selectable *field* is depends on each drivers.
For example, some driver want to select format "automatically",
but want to select other fields "manually", because of complex limitation.
Or other example, in case of both CPU and Codec are possible to be
clock provider, but the quality was different.
In these case, user need/want to *manually* select each fields
from Sound Card driver.
This .auto_selectable_formats can set priority.
For example, no limitaion format can be HI priority,
supported but has picky limitation format can be next priority, etc.
It uses Sound Card specified fields preferentially, and try to select
non-specific fields from CPU and Codec driver automatically
if all drivers have .auto_selectable_formats.
In other words, we can select all dai_fmt via Sound Card driver
same as before.
Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ionc8s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-27 02:26:12 +00:00
|
|
|
int snd_soc_dai_get_fmt_max_priority(struct snd_soc_pcm_runtime *rtd)
|
|
|
|
{
|
|
|
|
struct snd_soc_dai *dai;
|
|
|
|
int i, max = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* return max num if *ALL* DAIs have .auto_selectable_formats
|
|
|
|
*/
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->num_auto_selectable_formats)
|
|
|
|
max = max(max, dai->driver->ops->num_auto_selectable_formats);
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return max;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_get_fmt - get supported audio format.
|
|
|
|
* @dai: DAI
|
|
|
|
* @priority: priority level of supported audio format.
|
|
|
|
*
|
|
|
|
* This should return only formats implemented with high
|
|
|
|
* quality by the DAI so that the core can configure a
|
|
|
|
* format which will work well with other devices.
|
|
|
|
* For example devices which don't support both edges of the
|
|
|
|
* LRCLK signal in I2S style formats should only list DSP
|
|
|
|
* modes. This will mean that sometimes fewer formats
|
|
|
|
* are reported here than are supported by set_fmt().
|
|
|
|
*/
|
|
|
|
u64 snd_soc_dai_get_fmt(struct snd_soc_dai *dai, int priority)
|
|
|
|
{
|
|
|
|
const struct snd_soc_dai_ops *ops = dai->driver->ops;
|
|
|
|
u64 fmt = 0;
|
|
|
|
int i, max = 0, until = priority;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Collect auto_selectable_formats until priority
|
|
|
|
*
|
|
|
|
* ex)
|
|
|
|
* auto_selectable_formats[] = { A, B, C };
|
|
|
|
* (A, B, C = SND_SOC_POSSIBLE_DAIFMT_xxx)
|
|
|
|
*
|
|
|
|
* priority = 1 : A
|
|
|
|
* priority = 2 : A | B
|
|
|
|
* priority = 3 : A | B | C
|
|
|
|
* priority = 4 : A | B | C
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
if (ops)
|
|
|
|
max = ops->num_auto_selectable_formats;
|
|
|
|
|
|
|
|
if (max < until)
|
|
|
|
until = max;
|
|
|
|
|
|
|
|
for (i = 0; i < until; i++)
|
|
|
|
fmt |= ops->auto_selectable_formats[i];
|
|
|
|
|
|
|
|
return fmt;
|
|
|
|
}
|
|
|
|
|
2019-07-22 01:32:12 +00:00
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_fmt - configure DAI hardware audio format.
|
|
|
|
* @dai: DAI
|
|
|
|
* @fmt: SND_SOC_DAIFMT_* format value.
|
|
|
|
*
|
|
|
|
* Configures the DAI hardware format and clocking.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2022-05-19 15:43:17 +00:00
|
|
|
if (dai->driver->ops && dai->driver->ops->set_fmt)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_fmt(dai, fmt);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt);
|
|
|
|
|
|
|
|
/**
|
2021-03-01 17:46:59 +00:00
|
|
|
* snd_soc_xlate_tdm_slot_mask - generate tx/rx slot mask.
|
2019-07-22 01:32:12 +00:00
|
|
|
* @slots: Number of slots in use.
|
|
|
|
* @tx_mask: bitmask representing active TX slots.
|
|
|
|
* @rx_mask: bitmask representing active RX slots.
|
|
|
|
*
|
|
|
|
* Generates the TDM tx and rx slot default masks for DAI.
|
|
|
|
*/
|
|
|
|
static int snd_soc_xlate_tdm_slot_mask(unsigned int slots,
|
|
|
|
unsigned int *tx_mask,
|
|
|
|
unsigned int *rx_mask)
|
|
|
|
{
|
|
|
|
if (*tx_mask || *rx_mask)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!slots)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
*tx_mask = (1 << slots) - 1;
|
|
|
|
*rx_mask = (1 << slots) - 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_tdm_slot() - Configures a DAI for TDM operation
|
|
|
|
* @dai: The DAI to configure
|
|
|
|
* @tx_mask: bitmask representing active TX slots.
|
|
|
|
* @rx_mask: bitmask representing active RX slots.
|
|
|
|
* @slots: Number of slots in use.
|
|
|
|
* @slot_width: Width in bits for each slot.
|
|
|
|
*
|
|
|
|
* This function configures the specified DAI for TDM operation. @slot contains
|
|
|
|
* the total number of slots of the TDM stream and @slot_with the width of each
|
|
|
|
* slot in bit clock cycles. @tx_mask and @rx_mask are bitmasks specifying the
|
|
|
|
* active slots of the TDM stream for the specified DAI, i.e. which slots the
|
|
|
|
* DAI should write to or read from. If a bit is set the corresponding slot is
|
|
|
|
* active, if a bit is cleared the corresponding slot is inactive. Bit 0 maps to
|
|
|
|
* the first slot, bit 1 to the second slot and so on. The first active slot
|
|
|
|
* maps to the first channel of the DAI, the second active slot to the second
|
|
|
|
* channel and so on.
|
|
|
|
*
|
|
|
|
* TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask,
|
|
|
|
* @rx_mask and @slot_width will be ignored.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, a negative error code otherwise.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
|
|
|
|
unsigned int tx_mask, unsigned int rx_mask,
|
|
|
|
int slots, int slot_width)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -ENOTSUPP;
|
2023-01-31 02:01:49 +00:00
|
|
|
int stream;
|
|
|
|
unsigned int *tdm_mask[] = {
|
|
|
|
&tx_mask,
|
|
|
|
&rx_mask,
|
|
|
|
};
|
2020-04-23 23:14:38 +00:00
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->xlate_tdm_slot_mask)
|
2019-07-22 01:32:12 +00:00
|
|
|
dai->driver->ops->xlate_tdm_slot_mask(slots,
|
|
|
|
&tx_mask, &rx_mask);
|
|
|
|
else
|
|
|
|
snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
|
|
|
|
|
2023-01-31 02:01:49 +00:00
|
|
|
for_each_pcm_streams(stream)
|
|
|
|
snd_soc_dai_tdm_mask_set(dai, stream, *tdm_mask[stream]);
|
2019-07-22 01:32:12 +00:00
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_tdm_slot)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
|
2019-07-22 01:32:12 +00:00
|
|
|
slots, slot_width);
|
2020-04-23 23:14:38 +00:00
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_channel_map - configure DAI audio channel map
|
|
|
|
* @dai: DAI
|
|
|
|
* @tx_num: how many TX channels
|
|
|
|
* @tx_slot: pointer to an array which imply the TX slot number channel
|
|
|
|
* 0~num-1 uses
|
|
|
|
* @rx_num: how many RX channels
|
|
|
|
* @rx_slot: pointer to an array which imply the RX slot number channel
|
|
|
|
* 0~num-1 uses
|
|
|
|
*
|
|
|
|
* configure the relationship between channel number and TDM slot number.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
|
|
|
|
unsigned int tx_num, unsigned int *tx_slot,
|
|
|
|
unsigned int rx_num, unsigned int *rx_slot)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_channel_map)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_channel_map(dai, tx_num, tx_slot,
|
|
|
|
rx_num, rx_slot);
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_get_channel_map - Get DAI audio channel map
|
|
|
|
* @dai: DAI
|
|
|
|
* @tx_num: how many TX channels
|
|
|
|
* @tx_slot: pointer to an array which imply the TX slot number channel
|
|
|
|
* 0~num-1 uses
|
|
|
|
* @rx_num: how many RX channels
|
|
|
|
* @rx_slot: pointer to an array which imply the RX slot number channel
|
|
|
|
* 0~num-1 uses
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai,
|
|
|
|
unsigned int *tx_num, unsigned int *tx_slot,
|
|
|
|
unsigned int *rx_num, unsigned int *rx_slot)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->get_channel_map)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->get_channel_map(dai, tx_num, tx_slot,
|
|
|
|
rx_num, rx_slot);
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_set_tristate - configure DAI system or master clock.
|
|
|
|
* @dai: DAI
|
|
|
|
* @tristate: tristate enable
|
|
|
|
*
|
|
|
|
* Tristates the DAI so that others can use it.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -EINVAL;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->set_tristate)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->set_tristate(dai, tristate);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_dai_digital_mute - configure DAI system or master clock.
|
|
|
|
* @dai: DAI
|
|
|
|
* @mute: mute enable
|
|
|
|
* @direction: stream to mute
|
|
|
|
*
|
|
|
|
* Mutes the DAI DAC.
|
|
|
|
*/
|
|
|
|
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
|
|
|
|
int direction)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2020-07-09 01:55:41 +00:00
|
|
|
/*
|
|
|
|
* ignore if direction was CAPTURE
|
|
|
|
* and it had .no_capture_mute flag
|
|
|
|
*/
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
2020-07-09 01:55:41 +00:00
|
|
|
dai->driver->ops->mute_stream &&
|
|
|
|
(direction == SNDRV_PCM_STREAM_PLAYBACK ||
|
|
|
|
!dai->driver->ops->no_capture_mute))
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->ops->mute_stream(dai, mute, direction);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:32:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute);
|
2019-07-22 01:33:04 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
|
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *params)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = 0;
|
2019-07-22 01:33:04 +00:00
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
2022-11-04 16:02:52 +00:00
|
|
|
dai->driver->ops->hw_params)
|
2019-07-22 01:33:04 +00:00
|
|
|
ret = dai->driver->ops->hw_params(substream, params, dai);
|
ASoC: soc-dai: add mark for snd_soc_dai_hw_params/free()
soc_pcm_hw_params() does rollback when failed (A),
but, it is almost same as soc_pcm_hw_free().
static int soc_pcm_hw_params(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return ret;
^ component_err:
| ...
| interface_err:
(A) ...
| codec_err:
| ...
v return ret;
}
The difference is
soc_pcm_hw_free() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_hw_free() and rollback.
Now, soc_pcm_hw_params/free() are handling
1) snd_soc_link_hw_params/free()
2) snd_soc_pcm_component_hw_params/free()
=> 3) snd_soc_dai_hw_params/free()
This patch is for 3) snd_soc_dai_hw_params/free().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when hw_params() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *previous* hw_params() only now,
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbxgqai.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 04:31:53 +00:00
|
|
|
|
|
|
|
/* mark substream if succeeded */
|
|
|
|
if (ret == 0)
|
|
|
|
soc_dai_mark_push(dai, substream, hw_params);
|
2022-11-04 16:02:52 +00:00
|
|
|
|
2020-04-23 23:14:38 +00:00
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:33:04 +00:00
|
|
|
}
|
2019-07-22 01:33:19 +00:00
|
|
|
|
|
|
|
void snd_soc_dai_hw_free(struct snd_soc_dai *dai,
|
ASoC: soc-dai: add mark for snd_soc_dai_hw_params/free()
soc_pcm_hw_params() does rollback when failed (A),
but, it is almost same as soc_pcm_hw_free().
static int soc_pcm_hw_params(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return ret;
^ component_err:
| ...
| interface_err:
(A) ...
| codec_err:
| ...
v return ret;
}
The difference is
soc_pcm_hw_free() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_hw_free() and rollback.
Now, soc_pcm_hw_params/free() are handling
1) snd_soc_link_hw_params/free()
2) snd_soc_pcm_component_hw_params/free()
=> 3) snd_soc_dai_hw_params/free()
This patch is for 3) snd_soc_dai_hw_params/free().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when hw_params() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *previous* hw_params() only now,
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbxgqai.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 04:31:53 +00:00
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
int rollback)
|
2019-07-22 01:33:19 +00:00
|
|
|
{
|
ASoC: soc-dai: add mark for snd_soc_dai_hw_params/free()
soc_pcm_hw_params() does rollback when failed (A),
but, it is almost same as soc_pcm_hw_free().
static int soc_pcm_hw_params(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return ret;
^ component_err:
| ...
| interface_err:
(A) ...
| codec_err:
| ...
v return ret;
}
The difference is
soc_pcm_hw_free() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_hw_free() and rollback.
Now, soc_pcm_hw_params/free() are handling
1) snd_soc_link_hw_params/free()
2) snd_soc_pcm_component_hw_params/free()
=> 3) snd_soc_dai_hw_params/free()
This patch is for 3) snd_soc_dai_hw_params/free().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when hw_params() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *previous* hw_params() only now,
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbxgqai.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 04:31:53 +00:00
|
|
|
if (rollback && !soc_dai_mark_match(dai, substream, hw_params))
|
|
|
|
return;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->hw_free)
|
2019-07-22 01:33:19 +00:00
|
|
|
dai->driver->ops->hw_free(substream, dai);
|
ASoC: soc-dai: add mark for snd_soc_dai_hw_params/free()
soc_pcm_hw_params() does rollback when failed (A),
but, it is almost same as soc_pcm_hw_free().
static int soc_pcm_hw_params(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return ret;
^ component_err:
| ...
| interface_err:
(A) ...
| codec_err:
| ...
v return ret;
}
The difference is
soc_pcm_hw_free() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_hw_free() and rollback.
Now, soc_pcm_hw_params/free() are handling
1) snd_soc_link_hw_params/free()
2) snd_soc_pcm_component_hw_params/free()
=> 3) snd_soc_dai_hw_params/free()
This patch is for 3) snd_soc_dai_hw_params/free().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when hw_params() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *previous* hw_params() only now,
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbxgqai.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 04:31:53 +00:00
|
|
|
|
|
|
|
/* remove marked substream */
|
|
|
|
soc_dai_mark_pop(dai, substream, hw_params);
|
2019-07-22 01:33:19 +00:00
|
|
|
}
|
2019-07-22 01:33:32 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_startup(struct snd_soc_dai *dai,
|
|
|
|
struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->startup)
|
2019-07-22 01:33:32 +00:00
|
|
|
ret = dai->driver->ops->startup(substream, dai);
|
|
|
|
|
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().
static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;
^ config_err:
| ...
| rtd_startup_err:
(A) ...
| component_err:
| ...
v return ret;
}
The difference is
soc_pcm_close() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.
Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()
This patch is for 1) snd_soc_dai_startup/shutdown().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 00:00:40 +00:00
|
|
|
/* mark substream if succeeded */
|
|
|
|
if (ret == 0)
|
|
|
|
soc_dai_mark_push(dai, substream, startup);
|
|
|
|
|
2020-04-23 23:14:38 +00:00
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:33:32 +00:00
|
|
|
}
|
2019-07-22 01:33:39 +00:00
|
|
|
|
|
|
|
void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
|
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().
static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;
^ config_err:
| ...
| rtd_startup_err:
(A) ...
| component_err:
| ...
v return ret;
}
The difference is
soc_pcm_close() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.
Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()
This patch is for 1) snd_soc_dai_startup/shutdown().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 00:00:40 +00:00
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
int rollback)
|
2019-07-22 01:33:39 +00:00
|
|
|
{
|
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().
static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;
^ config_err:
| ...
| rtd_startup_err:
(A) ...
| component_err:
| ...
v return ret;
}
The difference is
soc_pcm_close() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.
Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()
This patch is for 1) snd_soc_dai_startup/shutdown().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 00:00:40 +00:00
|
|
|
if (rollback && !soc_dai_mark_match(dai, substream, startup))
|
|
|
|
return;
|
|
|
|
|
2020-04-23 23:14:43 +00:00
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->shutdown)
|
2019-07-22 01:33:39 +00:00
|
|
|
dai->driver->ops->shutdown(substream, dai);
|
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().
static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;
^ config_err:
| ...
| rtd_startup_err:
(A) ...
| component_err:
| ...
v return ret;
}
The difference is
soc_pcm_close() is for all dai/component/substream,
rollback is for succeeded part only.
This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.
Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()
This patch is for 1) snd_soc_dai_startup/shutdown().
The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.
To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.
One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 00:00:40 +00:00
|
|
|
|
|
|
|
/* remove marked substream */
|
|
|
|
soc_dai_mark_pop(dai, substream, startup);
|
2019-07-22 01:33:39 +00:00
|
|
|
}
|
2019-07-22 01:33:45 +00:00
|
|
|
|
2019-07-22 01:35:29 +00:00
|
|
|
int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
|
|
|
|
struct snd_soc_pcm_runtime *rtd, int num)
|
|
|
|
{
|
2020-04-23 23:14:38 +00:00
|
|
|
int ret = -ENOTSUPP;
|
2019-07-22 01:35:29 +00:00
|
|
|
if (dai->driver->compress_new)
|
2020-04-23 23:14:38 +00:00
|
|
|
ret = dai->driver->compress_new(rtd, num);
|
|
|
|
return soc_dai_ret(dai, ret);
|
2019-07-22 01:35:29 +00:00
|
|
|
}
|
2019-07-22 01:36:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* snd_soc_dai_stream_valid() - check if a DAI supports the given stream
|
|
|
|
*
|
|
|
|
* Returns true if the DAI supports the indicated stream type.
|
|
|
|
*/
|
|
|
|
bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir)
|
|
|
|
{
|
2020-02-19 06:56:30 +00:00
|
|
|
struct snd_soc_pcm_stream *stream = snd_soc_dai_get_pcm_stream(dai, dir);
|
2019-07-22 01:36:16 +00:00
|
|
|
|
|
|
|
/* If the codec specifies any channels at all, it supports the stream */
|
|
|
|
return stream->channels_min;
|
|
|
|
}
|
2020-04-23 23:14:48 +00:00
|
|
|
|
2020-07-07 21:04:37 +00:00
|
|
|
/*
|
|
|
|
* snd_soc_dai_link_set_capabilities() - set dai_link properties based on its DAIs
|
|
|
|
*/
|
|
|
|
void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)
|
|
|
|
{
|
|
|
|
bool supported[SNDRV_PCM_STREAM_LAST + 1];
|
|
|
|
int direction;
|
|
|
|
|
|
|
|
for_each_pcm_streams(direction) {
|
2021-08-16 04:56:01 +00:00
|
|
|
struct snd_soc_dai_link_component *cpu;
|
|
|
|
struct snd_soc_dai_link_component *codec;
|
|
|
|
struct snd_soc_dai *dai;
|
|
|
|
bool supported_cpu = false;
|
|
|
|
bool supported_codec = false;
|
|
|
|
int i;
|
2020-07-07 21:04:37 +00:00
|
|
|
|
|
|
|
for_each_link_cpus(dai_link, i, cpu) {
|
2020-08-26 23:55:39 +00:00
|
|
|
dai = snd_soc_find_dai_with_mutex(cpu);
|
2020-07-23 18:05:33 +00:00
|
|
|
if (dai && snd_soc_dai_stream_valid(dai, direction)) {
|
|
|
|
supported_cpu = true;
|
2020-07-07 21:04:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for_each_link_codecs(dai_link, i, codec) {
|
2020-08-26 23:55:39 +00:00
|
|
|
dai = snd_soc_find_dai_with_mutex(codec);
|
2020-07-23 18:05:33 +00:00
|
|
|
if (dai && snd_soc_dai_stream_valid(dai, direction)) {
|
|
|
|
supported_codec = true;
|
2020-07-07 21:04:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-07-23 18:05:33 +00:00
|
|
|
supported[direction] = supported_cpu && supported_codec;
|
2020-07-07 21:04:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];
|
|
|
|
dai_link->dpcm_capture = supported[SNDRV_PCM_STREAM_CAPTURE];
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities);
|
|
|
|
|
2020-05-15 00:46:27 +00:00
|
|
|
void snd_soc_dai_action(struct snd_soc_dai *dai,
|
|
|
|
int stream, int action)
|
|
|
|
{
|
2020-05-15 00:46:47 +00:00
|
|
|
/* see snd_soc_dai_stream_active() */
|
2023-01-31 02:02:04 +00:00
|
|
|
dai->stream[stream].active += action;
|
2020-05-15 00:48:02 +00:00
|
|
|
|
2020-05-15 00:46:42 +00:00
|
|
|
/* see snd_soc_component_active() */
|
2020-05-15 00:46:27 +00:00
|
|
|
dai->component->active += action;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_action);
|
|
|
|
|
2020-05-15 00:46:37 +00:00
|
|
|
int snd_soc_dai_active(struct snd_soc_dai *dai)
|
|
|
|
{
|
|
|
|
int stream, active;
|
|
|
|
|
|
|
|
active = 0;
|
|
|
|
for_each_pcm_streams(stream)
|
2023-01-31 02:02:04 +00:00
|
|
|
active += dai->stream[stream].active;
|
2020-05-15 00:46:37 +00:00
|
|
|
|
|
|
|
return active;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_active);
|
|
|
|
|
2020-04-23 23:15:15 +00:00
|
|
|
int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order)
|
|
|
|
{
|
|
|
|
struct snd_soc_dai *dai;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
if (dai->driver->probe_order != order)
|
|
|
|
continue;
|
|
|
|
|
2023-03-06 01:43:30 +00:00
|
|
|
if (dai->probed)
|
|
|
|
continue;
|
|
|
|
|
2020-04-23 23:15:15 +00:00
|
|
|
if (dai->driver->probe) {
|
|
|
|
int ret = dai->driver->probe(dai);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
dai->probed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-04-23 23:15:20 +00:00
|
|
|
int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order)
|
|
|
|
{
|
|
|
|
struct snd_soc_dai *dai;
|
|
|
|
int i, r, ret = 0;
|
|
|
|
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
if (dai->driver->remove_order != order)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (dai->probed &&
|
|
|
|
dai->driver->remove) {
|
|
|
|
r = dai->driver->remove(dai);
|
|
|
|
if (r < 0)
|
|
|
|
ret = r; /* use last error */
|
|
|
|
}
|
|
|
|
|
|
|
|
dai->probed = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-04-23 23:14:48 +00:00
|
|
|
int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd)
|
|
|
|
{
|
|
|
|
struct snd_soc_dai *dai;
|
2021-08-16 04:56:06 +00:00
|
|
|
int i;
|
2020-04-23 23:14:48 +00:00
|
|
|
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
if (dai->driver->pcm_new) {
|
2021-08-16 04:56:06 +00:00
|
|
|
int ret = dai->driver->pcm_new(rtd, dai);
|
2020-04-23 23:14:48 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-04-23 23:14:53 +00:00
|
|
|
|
|
|
|
int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream)
|
|
|
|
{
|
2020-07-20 01:17:39 +00:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-04-23 23:14:53 +00:00
|
|
|
struct snd_soc_dai *dai;
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->prepare) {
|
|
|
|
ret = dai->driver->ops->prepare(substream, dai);
|
|
|
|
if (ret < 0)
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-04-23 23:15:04 +00:00
|
|
|
|
ASoC: soc-pcm: care trigger rollback
soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.
static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}
For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.
This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.
Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 23:51:33 +00:00
|
|
|
static int soc_dai_trigger(struct snd_soc_dai *dai,
|
|
|
|
struct snd_pcm_substream *substream, int cmd)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->trigger)
|
|
|
|
ret = dai->driver->ops->trigger(substream, cmd, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
|
2020-04-23 23:15:04 +00:00
|
|
|
int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
|
ASoC: soc-pcm: care trigger rollback
soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.
static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}
For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.
This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.
Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 23:51:33 +00:00
|
|
|
int cmd, int rollback)
|
2020-04-23 23:15:04 +00:00
|
|
|
{
|
2020-07-20 01:17:39 +00:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-04-23 23:15:04 +00:00
|
|
|
struct snd_soc_dai *dai;
|
ASoC: soc-pcm: care trigger rollback
soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.
static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}
For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.
This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.
Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 23:51:33 +00:00
|
|
|
int i, r, ret = 0;
|
2020-04-23 23:15:04 +00:00
|
|
|
|
ASoC: soc-pcm: care trigger rollback
soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.
static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}
For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.
This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.
Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 23:51:33 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case SNDRV_PCM_TRIGGER_START:
|
|
|
|
case SNDRV_PCM_TRIGGER_RESUME:
|
|
|
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
ret = soc_dai_trigger(dai, substream, cmd);
|
2020-04-23 23:15:04 +00:00
|
|
|
if (ret < 0)
|
ASoC: soc-pcm: care trigger rollback
soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.
static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}
For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.
This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.
Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 23:51:33 +00:00
|
|
|
break;
|
|
|
|
soc_dai_mark_push(dai, substream, trigger);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SNDRV_PCM_TRIGGER_STOP:
|
|
|
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
|
|
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
|
|
|
for_each_rtd_dais(rtd, i, dai) {
|
|
|
|
if (rollback && !soc_dai_mark_match(dai, substream, trigger))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
r = soc_dai_trigger(dai, substream, cmd);
|
|
|
|
if (r < 0)
|
|
|
|
ret = r; /* use last ret */
|
|
|
|
soc_dai_mark_pop(dai, substream, trigger);
|
2020-04-23 23:15:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ASoC: soc-pcm: care trigger rollback
soc_pcm_trigger() calls DAI/Component/Link trigger,
but some of them might be failed.
static int soc_pcm_trigger(...)
{
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
(*) ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break;
}
...
}
For example, if soc_pcm_trigger() failed at (*) point,
we need to rollback previous succeeded trigger.
This patch adds trigger mark for DAI/Component/Link,
and do STOP if START/RESUME/PAUSE_RELEASE were failed.
Because it need to use new rollback parameter,
we need to modify DAI/Component/Link trigger functions in the same time.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 23:51:33 +00:00
|
|
|
return ret;
|
2020-04-23 23:15:04 +00:00
|
|
|
}
|
2020-04-23 23:15:09 +00:00
|
|
|
|
|
|
|
int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
|
|
|
|
int cmd)
|
|
|
|
{
|
2020-07-20 01:17:39 +00:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-04-23 23:15:09 +00:00
|
|
|
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;
|
|
|
|
}
|
2020-04-23 23:15:24 +00:00
|
|
|
|
2021-11-16 07:45:12 +00:00
|
|
|
void snd_soc_pcm_dai_delay(struct snd_pcm_substream *substream,
|
|
|
|
snd_pcm_sframes_t *cpu_delay,
|
|
|
|
snd_pcm_sframes_t *codec_delay)
|
|
|
|
{
|
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
|
|
|
struct snd_soc_dai *dai;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We're looking for the delay through the full audio path so it needs to
|
|
|
|
* be the maximum of the DAIs doing transmit and the maximum of the DAIs
|
|
|
|
* doing receive (ie, all CPUs and all CODECs) rather than just the maximum
|
|
|
|
* of all DAIs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* for CPU */
|
|
|
|
for_each_rtd_cpu_dais(rtd, i, dai)
|
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->delay)
|
|
|
|
*cpu_delay = max(*cpu_delay, dai->driver->ops->delay(substream, dai));
|
|
|
|
|
|
|
|
/* for Codec */
|
|
|
|
for_each_rtd_codec_dais(rtd, i, dai)
|
|
|
|
if (dai->driver->ops &&
|
|
|
|
dai->driver->ops->delay)
|
|
|
|
*codec_delay = max(*codec_delay, dai->driver->ops->delay(substream, dai));
|
|
|
|
}
|
|
|
|
|
2020-04-23 23:15:24 +00:00
|
|
|
int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->startup)
|
|
|
|
ret = dai->driver->cops->startup(cstream, dai);
|
|
|
|
|
2020-11-18 23:50:04 +00:00
|
|
|
/* mark cstream if succeeded */
|
|
|
|
if (ret == 0)
|
|
|
|
soc_dai_mark_push(dai, cstream, compr_startup);
|
|
|
|
|
2020-04-23 23:15:24 +00:00
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_startup);
|
2020-04-23 23:15:28 +00:00
|
|
|
|
|
|
|
void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
|
2020-11-18 23:50:04 +00:00
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
int rollback)
|
2020-04-23 23:15:28 +00:00
|
|
|
{
|
2020-11-18 23:50:04 +00:00
|
|
|
if (rollback && !soc_dai_mark_match(dai, cstream, compr_startup))
|
|
|
|
return;
|
|
|
|
|
2020-04-23 23:15:28 +00:00
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->shutdown)
|
|
|
|
dai->driver->cops->shutdown(cstream, dai);
|
2020-11-18 23:50:04 +00:00
|
|
|
|
|
|
|
/* remove marked cstream */
|
|
|
|
soc_dai_mark_pop(dai, cstream, compr_startup);
|
2020-04-23 23:15:28 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_shutdown);
|
2020-04-23 23:15:32 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream, int cmd)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->trigger)
|
|
|
|
ret = dai->driver->cops->trigger(cstream, cmd, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_trigger);
|
2020-04-23 23:15:36 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
struct snd_compr_params *params)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->set_params)
|
|
|
|
ret = dai->driver->cops->set_params(cstream, params, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_set_params);
|
2020-04-23 23:15:40 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
struct snd_codec *params)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->get_params)
|
|
|
|
ret = dai->driver->cops->get_params(cstream, params, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_get_params);
|
2020-04-23 23:15:45 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_ack(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
size_t bytes)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->ack)
|
|
|
|
ret = dai->driver->cops->ack(cstream, bytes, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_ack);
|
2020-04-23 23:15:49 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
struct snd_compr_tstamp *tstamp)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->pointer)
|
|
|
|
ret = dai->driver->cops->pointer(cstream, tstamp, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_pointer);
|
2020-04-23 23:15:54 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
struct snd_compr_metadata *metadata)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->set_metadata)
|
|
|
|
ret = dai->driver->cops->set_metadata(cstream, metadata, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_set_metadata);
|
2020-04-23 23:15:59 +00:00
|
|
|
|
|
|
|
int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai,
|
|
|
|
struct snd_compr_stream *cstream,
|
|
|
|
struct snd_compr_metadata *metadata)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dai->driver->cops &&
|
|
|
|
dai->driver->cops->get_metadata)
|
|
|
|
ret = dai->driver->cops->get_metadata(cstream, metadata, dai);
|
|
|
|
|
|
|
|
return soc_dai_ret(dai, ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_get_metadata);
|