mirror of https://github.com/thesofproject/sof.git
ipc4: alh: add alh support for ipc4
Stream id is included in ipc4 config and fw constructs hw_params for alh based on this information. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com>
This commit is contained in:
parent
457465fa15
commit
c52e8dbba2
|
@ -16,6 +16,7 @@
|
|||
#include <ipc/topology.h>
|
||||
#include <user/trace.h>
|
||||
#include <stdint.h>
|
||||
#include <ipc4/alh.h>
|
||||
|
||||
/* a8e4218c-e863-4c93-84e7-5c27d2504501 */
|
||||
DECLARE_SOF_UUID("alh-dai", alh_uuid, 0xa8e4218c, 0xe863, 0x4c93,
|
||||
|
@ -30,18 +31,19 @@ static int alh_trigger(struct dai *dai, int cmd, int direction)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int alh_set_config(struct dai *dai, struct ipc_config_dai *common_config,
|
||||
void *spec_config)
|
||||
static int alh_set_config_tplg(struct dai *dai, struct ipc_config_dai *common_config,
|
||||
void *spec_config)
|
||||
{
|
||||
struct alh_pdata *alh = dai_get_drvdata(dai);
|
||||
struct sof_ipc_dai_config *config = spec_config;
|
||||
|
||||
dai_info(dai, "alh_set_config() config->format = 0x%4x",
|
||||
config->format);
|
||||
dai_info(dai, "alh_set_config_tplg() config->format = 0x%4x", config->format);
|
||||
|
||||
if (config->alh.channels || config->alh.rate) {
|
||||
alh->params.channels = config->alh.channels;
|
||||
alh->params.rate = config->alh.rate;
|
||||
dai_info(dai, "alh_set_config() channels %d rate %d",
|
||||
config->alh.channels, config->alh.rate);
|
||||
}
|
||||
|
||||
alh->params.stream_id = config->alh.stream_id;
|
||||
|
@ -49,6 +51,31 @@ static int alh_set_config(struct dai *dai, struct ipc_config_dai *common_config,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int alh_set_config_blob(struct dai *dai, struct ipc_config_dai *common_config,
|
||||
void *spec_config)
|
||||
{
|
||||
struct alh_pdata *alh = dai_get_drvdata(dai);
|
||||
struct sof_alh_configuration_blob *blob = spec_config;
|
||||
struct ipc4_alh_multi_gtw_cfg *alh_cfg = &blob->alh_cfg;
|
||||
|
||||
dai_info(dai, "alh_set_config_blob()");
|
||||
|
||||
alh->params.channels = 2;
|
||||
alh->params.rate = 48000;
|
||||
alh->params.stream_id = alh_cfg->mapping[0].alh_id & 0xf;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int alh_set_config(struct dai *dai, struct ipc_config_dai *common_config,
|
||||
void *spec_config)
|
||||
{
|
||||
if (!common_config->is_config_blob)
|
||||
return alh_set_config_tplg(dai, common_config, spec_config);
|
||||
else
|
||||
return alh_set_config_blob(dai, common_config, spec_config);
|
||||
}
|
||||
|
||||
/* get ALH hw params */
|
||||
static int alh_get_hw_params(struct dai *dai,
|
||||
struct sof_ipc_stream_params *params, int dir)
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright(c) 2021 Intel Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains structures that are exact copies of an existing ABI used
|
||||
* by IOT middleware. They are Intel specific and will be used by one middleware.
|
||||
*
|
||||
* Some of the structures may contain programming implementations that makes them
|
||||
* unsuitable for generic use and general usage.
|
||||
*
|
||||
* This code is mostly copied "as-is" from existing C++ interface files hence the use of
|
||||
* different style in places. The intention is to keep the interface as close as possible to
|
||||
* original so it's easier to track changes with IPC host code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file include/ipc4/alh.h
|
||||
* \brief IPC4 global definitions.
|
||||
* NOTE: This ABI uses bit fields and is non portable.
|
||||
*/
|
||||
|
||||
#ifndef __SOF_IPC4_ALH_H__
|
||||
#define __SOF_IPC4_ALH_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ipc4/gateway.h>
|
||||
|
||||
#define IPC4_ALH_MAX_NUMBER_OF_GTW 16
|
||||
#define IPC4_ALH_DAI_INDEX_OFFSET 7
|
||||
|
||||
struct ipc4_alh_multi_gtw_cfg {
|
||||
/* Number of single channels (valid items in mapping array). */
|
||||
uint32_t count;
|
||||
/* Single to multi aggregation mapping item. */
|
||||
struct {
|
||||
/* Vindex of a single ALH channel aggregated. */
|
||||
uint32_t alh_id;
|
||||
/* Channel mask */
|
||||
uint32_t channel_mask;
|
||||
} mapping[IPC4_ALH_MAX_NUMBER_OF_GTW]; /* < Mapping items */
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
struct sof_alh_configuration_blob {
|
||||
union ipc4_gateway_attributes gtw_attributes;
|
||||
struct ipc4_alh_multi_gtw_cfg alh_cfg;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue