Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20221214185500.3896902-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Amadeusz Sławiński and committed by
Mark Brown
905ea24f 1b929c02

+62
+29
sound/soc/intel/avs/messages.c
··· 702 702 (u8 *)&cpr_fmt, sizeof(cpr_fmt)); 703 703 } 704 704 705 + int avs_ipc_peakvol_set_volume(struct avs_dev *adev, u16 module_id, u8 instance_id, 706 + struct avs_volume_cfg *vol) 707 + { 708 + return avs_ipc_set_large_config(adev, module_id, instance_id, AVS_PEAKVOL_VOLUME, (u8 *)vol, 709 + sizeof(*vol)); 710 + } 711 + 712 + int avs_ipc_peakvol_get_volume(struct avs_dev *adev, u16 module_id, u8 instance_id, 713 + struct avs_volume_cfg **vols, size_t *num_vols) 714 + { 715 + size_t payload_size; 716 + u8 *payload; 717 + int ret; 718 + 719 + ret = avs_ipc_get_large_config(adev, module_id, instance_id, AVS_PEAKVOL_VOLUME, NULL, 0, 720 + &payload, &payload_size); 721 + if (ret) 722 + return ret; 723 + 724 + /* Non-zero payload expected for PEAKVOL_VOLUME. */ 725 + if (!payload_size) 726 + return -EREMOTEIO; 727 + 728 + *vols = (struct avs_volume_cfg *)payload; 729 + *num_vols = payload_size / sizeof(**vols); 730 + 731 + return 0; 732 + } 733 + 705 734 #ifdef CONFIG_DEBUG_FS 706 735 int avs_ipc_set_enable_logs(struct avs_dev *adev, u8 *log_info, size_t size) 707 736 {
+33
sound/soc/intel/avs/messages.h
··· 561 561 #define AVS_COPIER_MOD_UUID \ 562 562 GUID_INIT(0x9BA00C83, 0xCA12, 0x4A83, 0x94, 0x3C, 0x1F, 0xA2, 0xE8, 0x2F, 0x9D, 0xDA) 563 563 564 + #define AVS_PEAKVOL_MOD_UUID \ 565 + GUID_INIT(0x8A171323, 0x94A3, 0x4E1D, 0xAF, 0xE9, 0xFE, 0x5D, 0xBA, 0xa4, 0xC3, 0x93) 566 + 567 + #define AVS_GAIN_MOD_UUID \ 568 + GUID_INIT(0x61BCA9A8, 0x18D0, 0x4A18, 0x8E, 0x7B, 0x26, 0x39, 0x21, 0x98, 0x04, 0xB7) 569 + 564 570 #define AVS_KPBUFF_MOD_UUID \ 565 571 GUID_INIT(0xA8A0CB32, 0x4A77, 0x4DB1, 0x85, 0xC7, 0x53, 0xD7, 0xEE, 0x07, 0xBC, 0xE6) 566 572 ··· 735 729 struct avs_copier_gtw_cfg gtw_cfg; 736 730 } __packed; 737 731 732 + struct avs_volume_cfg { 733 + u32 channel_id; 734 + u32 target_volume; 735 + u32 curve_type; 736 + u32 reserved; /* alignment */ 737 + u64 curve_duration; 738 + } __packed; 739 + 740 + struct avs_peakvol_cfg { 741 + struct avs_modcfg_base base; 742 + struct avs_volume_cfg vols[]; 743 + } __packed; 744 + 738 745 struct avs_micsel_cfg { 739 746 struct avs_modcfg_base base; 740 747 struct avs_audio_format out_fmt; ··· 820 801 u8 instance_id, u32 sink_id, 821 802 const struct avs_audio_format *src_fmt, 822 803 const struct avs_audio_format *sink_fmt); 804 + 805 + enum avs_peakvol_runtime_param { 806 + AVS_PEAKVOL_VOLUME = 0, 807 + }; 808 + 809 + enum avs_audio_curve_type { 810 + AVS_AUDIO_CURVE_NONE = 0, 811 + AVS_AUDIO_CURVE_WINDOWS_FADE = 1, 812 + }; 813 + 814 + int avs_ipc_peakvol_set_volume(struct avs_dev *adev, u16 module_id, u8 instance_id, 815 + struct avs_volume_cfg *vol); 816 + int avs_ipc_peakvol_get_volume(struct avs_dev *adev, u16 module_id, u8 instance_id, 817 + struct avs_volume_cfg **vols, size_t *num_vols); 823 818 824 819 #define AVS_PROBE_INST_ID 0 825 820