Commit 905ea24f authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: Intel: avs: Add peakvol runtime-parameter requests

Peakvol module allows for setting and obtaining DSP volume as well as
modifying shape and duration at which volume actually changes. Add IPC
messages to expose those capabilities.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20221214185500.3896902-2-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1b929c02
...@@ -702,6 +702,35 @@ int avs_ipc_copier_set_sink_format(struct avs_dev *adev, u16 module_id, ...@@ -702,6 +702,35 @@ int avs_ipc_copier_set_sink_format(struct avs_dev *adev, u16 module_id,
(u8 *)&cpr_fmt, sizeof(cpr_fmt)); (u8 *)&cpr_fmt, sizeof(cpr_fmt));
} }
int avs_ipc_peakvol_set_volume(struct avs_dev *adev, u16 module_id, u8 instance_id,
struct avs_volume_cfg *vol)
{
return avs_ipc_set_large_config(adev, module_id, instance_id, AVS_PEAKVOL_VOLUME, (u8 *)vol,
sizeof(*vol));
}
int avs_ipc_peakvol_get_volume(struct avs_dev *adev, u16 module_id, u8 instance_id,
struct avs_volume_cfg **vols, size_t *num_vols)
{
size_t payload_size;
u8 *payload;
int ret;
ret = avs_ipc_get_large_config(adev, module_id, instance_id, AVS_PEAKVOL_VOLUME, NULL, 0,
&payload, &payload_size);
if (ret)
return ret;
/* Non-zero payload expected for PEAKVOL_VOLUME. */
if (!payload_size)
return -EREMOTEIO;
*vols = (struct avs_volume_cfg *)payload;
*num_vols = payload_size / sizeof(**vols);
return 0;
}
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
int avs_ipc_set_enable_logs(struct avs_dev *adev, u8 *log_info, size_t size) int avs_ipc_set_enable_logs(struct avs_dev *adev, u8 *log_info, size_t size)
{ {
......
...@@ -561,6 +561,12 @@ int avs_ipc_set_system_time(struct avs_dev *adev); ...@@ -561,6 +561,12 @@ int avs_ipc_set_system_time(struct avs_dev *adev);
#define AVS_COPIER_MOD_UUID \ #define AVS_COPIER_MOD_UUID \
GUID_INIT(0x9BA00C83, 0xCA12, 0x4A83, 0x94, 0x3C, 0x1F, 0xA2, 0xE8, 0x2F, 0x9D, 0xDA) GUID_INIT(0x9BA00C83, 0xCA12, 0x4A83, 0x94, 0x3C, 0x1F, 0xA2, 0xE8, 0x2F, 0x9D, 0xDA)
#define AVS_PEAKVOL_MOD_UUID \
GUID_INIT(0x8A171323, 0x94A3, 0x4E1D, 0xAF, 0xE9, 0xFE, 0x5D, 0xBA, 0xa4, 0xC3, 0x93)
#define AVS_GAIN_MOD_UUID \
GUID_INIT(0x61BCA9A8, 0x18D0, 0x4A18, 0x8E, 0x7B, 0x26, 0x39, 0x21, 0x98, 0x04, 0xB7)
#define AVS_KPBUFF_MOD_UUID \ #define AVS_KPBUFF_MOD_UUID \
GUID_INIT(0xA8A0CB32, 0x4A77, 0x4DB1, 0x85, 0xC7, 0x53, 0xD7, 0xEE, 0x07, 0xBC, 0xE6) GUID_INIT(0xA8A0CB32, 0x4A77, 0x4DB1, 0x85, 0xC7, 0x53, 0xD7, 0xEE, 0x07, 0xBC, 0xE6)
...@@ -729,6 +735,19 @@ struct avs_copier_cfg { ...@@ -729,6 +735,19 @@ struct avs_copier_cfg {
struct avs_copier_gtw_cfg gtw_cfg; struct avs_copier_gtw_cfg gtw_cfg;
} __packed; } __packed;
struct avs_volume_cfg {
u32 channel_id;
u32 target_volume;
u32 curve_type;
u32 reserved; /* alignment */
u64 curve_duration;
} __packed;
struct avs_peakvol_cfg {
struct avs_modcfg_base base;
struct avs_volume_cfg vols[];
} __packed;
struct avs_micsel_cfg { struct avs_micsel_cfg {
struct avs_modcfg_base base; struct avs_modcfg_base base;
struct avs_audio_format out_fmt; struct avs_audio_format out_fmt;
...@@ -802,6 +821,20 @@ int avs_ipc_copier_set_sink_format(struct avs_dev *adev, u16 module_id, ...@@ -802,6 +821,20 @@ int avs_ipc_copier_set_sink_format(struct avs_dev *adev, u16 module_id,
const struct avs_audio_format *src_fmt, const struct avs_audio_format *src_fmt,
const struct avs_audio_format *sink_fmt); const struct avs_audio_format *sink_fmt);
enum avs_peakvol_runtime_param {
AVS_PEAKVOL_VOLUME = 0,
};
enum avs_audio_curve_type {
AVS_AUDIO_CURVE_NONE = 0,
AVS_AUDIO_CURVE_WINDOWS_FADE = 1,
};
int avs_ipc_peakvol_set_volume(struct avs_dev *adev, u16 module_id, u8 instance_id,
struct avs_volume_cfg *vol);
int avs_ipc_peakvol_get_volume(struct avs_dev *adev, u16 module_id, u8 instance_id,
struct avs_volume_cfg **vols, size_t *num_vols);
#define AVS_PROBE_INST_ID 0 #define AVS_PROBE_INST_ID 0
enum avs_probe_runtime_param { enum avs_probe_runtime_param {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment