Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/audio/dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ static void dai_free(struct comp_dev *dev)
}

static int dai_comp_get_hw_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
struct dai_data *dd = comp_get_drvdata(dev);
int ret = 0;

comp_info(dev, "dai_hw_params()");

/* fetching hw dai stream params */
ret = dai_get_hw_params(dd->dai, params);
ret = dai_get_hw_params(dd->dai, params, dir);
if (ret < 0) {
comp_err(dev, "dai_comp_get_hw_params() error: dai_get_hw_params failed");
return ret;
Expand All @@ -223,7 +223,7 @@ static int dai_verify_params(struct comp_dev *dev,
{
struct sof_ipc_stream_params hw_params;

dai_comp_get_hw_params(dev, &hw_params);
dai_comp_get_hw_params(dev, &hw_params, params->direction);

/* checks whether pcm parameters match hardware DAI parameter set
* during dai_set_config(). If hardware parameter is equal to 0, it
Expand Down
2 changes: 1 addition & 1 deletion src/audio/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static int pipeline_comp_hw_params(struct comp_dev *current,
/* Fetch hardware stream parameters from DAI component */
if (dev_comp_type(current) == SOF_COMP_DAI) {
ret = comp_dai_get_hw_params(current,
&ppl_data->params->params);
&ppl_data->params->params, dir);
if (ret < 0) {
pipe_cl_err("pipeline_find_dai_comp(): comp_dai_get_hw_params() error.");
return ret;
Expand Down
8 changes: 6 additions & 2 deletions src/drivers/intel/baytrail/ssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,18 @@ static int ssp_set_config(struct dai *dai,

/* get SSP hw params */
static int ssp_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
struct ssp_pdata *ssp = dai_get_drvdata(dai);

params->rate = ssp->params.fsync_rate;
params->channels = ssp->params.tdm_slots;
params->buffer_fmt = 0;

if (dir == SOF_IPC_STREAM_PLAYBACK)
params->channels = popcount(ssp->params.tx_slots);
else
params->channels = popcount(ssp->params.rx_slots);

switch (ssp->params.sample_valid_bits) {
case 16:
params->frame_fmt = SOF_IPC_FRAME_S16_LE;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/intel/cavs/alh.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static int alh_set_config(struct dai *dai, struct sof_ipc_dai_config *config)

/* get ALH hw params */
static int alh_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
/* 0 means variable */
params->rate = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/intel/cavs/dmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ static int configure_registers(struct dai *dai,

/* get DMIC hw params */
static int dmic_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
int di = dai->index;

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/intel/cavs/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static int hda_set_config(struct dai *dai,

/* get HDA hw params */
static int hda_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
/* 0 means variable */
params->rate = 0;
Expand Down
8 changes: 6 additions & 2 deletions src/drivers/intel/cavs/ssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,18 @@ static int ssp_set_config(struct dai *dai,

/* get SSP hw params */
static int ssp_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
struct ssp_pdata *ssp = dai_get_drvdata(dai);

params->rate = ssp->params.fsync_rate;
params->channels = ssp->params.tdm_slots;
params->buffer_fmt = 0;

if (dir == SOF_IPC_STREAM_PLAYBACK)
params->channels = popcount(ssp->params.tx_slots);
else
params->channels = popcount(ssp->params.rx_slots);

switch (ssp->params.sample_valid_bits) {
case 16:
params->frame_fmt = SOF_IPC_FRAME_S16_LE;
Expand Down
8 changes: 6 additions & 2 deletions src/drivers/intel/haswell/ssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,18 @@ static int ssp_set_config(struct dai *dai,

/* get SSP hw params */
static int ssp_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params, int dir)
{
struct ssp_pdata *ssp = dai_get_drvdata(dai);

params->rate = ssp->params.fsync_rate;
params->channels = ssp->params.tdm_slots;
params->buffer_fmt = 0;

if (dir == SOF_IPC_STREAM_PLAYBACK)
params->channels = popcount(ssp->params.tx_slots);
else
params->channels = popcount(ssp->params.rx_slots);

switch (ssp->params.sample_valid_bits) {
case 16:
params->frame_fmt = SOF_IPC_FRAME_S16_LE;
Expand Down
7 changes: 4 additions & 3 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct comp_ops {

/** get dai hw parameters */
int (*dai_get_hw_params)(struct comp_dev *dev,
struct sof_ipc_stream_params *params);
struct sof_ipc_stream_params *params, int dir);

/** set component audio stream parameters */
int (*dai_config)(struct comp_dev *dev,
Expand Down Expand Up @@ -512,10 +512,11 @@ static inline int comp_params(struct comp_dev *dev,
* @return 0 if succeeded, error code otherwise.
*/
static inline int comp_dai_get_hw_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params,
int dir)
{
if (dev->drv->ops.dai_get_hw_params)
return dev->drv->ops.dai_get_hw_params(dev, params);
return dev->drv->ops.dai_get_hw_params(dev, params, dir);
return -EINVAL;
}

Expand Down
7 changes: 4 additions & 3 deletions src/include/sof/lib/dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct dai_ops {
int (*pm_context_restore)(struct dai *dai);
int (*pm_context_store)(struct dai *dai);
int (*get_hw_params)(struct dai *dai,
struct sof_ipc_stream_params *params);
struct sof_ipc_stream_params *params, int dir);
int (*get_handshake)(struct dai *dai, int direction, int stream_id);
int (*get_fifo)(struct dai *dai, int direction, int stream_id);
int (*probe)(struct dai *dai);
Expand Down Expand Up @@ -275,9 +275,10 @@ static inline int dai_pm_context_restore(struct dai *dai)
* \brief Get Digital Audio interface stream parameters
*/
static inline int dai_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params)
struct sof_ipc_stream_params *params,
int dir)
{
int ret = dai->drv->ops.get_hw_params(dai, params);
int ret = dai->drv->ops.get_hw_params(dai, params, dir);

platform_shared_commit(dai, sizeof(*dai));

Expand Down