lkml.org 
[lkml]   [2021]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 14/16] ASoC: qcom: audioreach: add volume ctrl module support
    Date
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    ---
    sound/soc/qcom/audioreach/audioreach.c | 34 ++++++++++++++++++++++++++
    sound/soc/qcom/audioreach/audioreach.h | 8 ++++++
    2 files changed, 42 insertions(+)

    diff --git a/sound/soc/qcom/audioreach/audioreach.c b/sound/soc/qcom/audioreach/audioreach.c
    index 1839d872fd5f..5a50eede4496 100644
    --- a/sound/soc/qcom/audioreach/audioreach.c
    +++ b/sound/soc/qcom/audioreach/audioreach.c
    @@ -928,6 +928,40 @@ static int audioreach_shmem_set_media_format(struct q6apm_graph *graph,
    return rc;
    }

    +int audioreach_gain_set_vol_ctrl(struct q6apm *apm, struct audioreach_module
    + *module, int vol)
    +{
    + struct apm_module_param_data *param_data;
    + struct param_id_vol_ctrl_master_gain *cfg;
    + int rc, payload_size;
    + struct gpr_pkt *pkt;
    + void *p;
    +
    + payload_size = sizeof(*cfg) + APM_MODULE_PARAM_DATA_SIZE;
    + p = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0);
    + if (IS_ERR(p))
    + return -ENOMEM;
    +
    + pkt = p;
    + p = p + GPR_HDR_SIZE + APM_CMD_HDR_SIZE;
    +
    + param_data = p;
    + param_data->module_instance_id = module->instance_id;
    + param_data->error_code = 0;
    + param_data->param_id = PARAM_ID_VOL_CTRL_MASTER_GAIN;
    + param_data->param_size = payload_size - APM_MODULE_PARAM_DATA_SIZE;
    +
    + p = p + APM_MODULE_PARAM_DATA_SIZE;
    + cfg = p;
    + cfg->master_gain = vol;
    + rc = q6apm_send_cmd_sync(apm, pkt, 0);
    +
    + kfree(pkt);
    +
    + return rc;
    +}
    +EXPORT_SYMBOL_GPL(audioreach_gain_set_vol_ctrl);
    +
    static int audioreach_gain_set(struct q6apm_graph *graph,
    struct audioreach_module *module)
    {
    diff --git a/sound/soc/qcom/audioreach/audioreach.h b/sound/soc/qcom/audioreach/audioreach.h
    index 6279ddc3c5ce..2c6d5f4e66b4 100644
    --- a/sound/soc/qcom/audioreach/audioreach.h
    +++ b/sound/soc/qcom/audioreach/audioreach.h
    @@ -536,6 +536,14 @@ struct param_id_hw_ep_dma_data_align {
    uint32_t dma_data_align;
    } __packed;

    +#define PARAM_ID_VOL_CTRL_MASTER_GAIN 0x08001035
    +#define VOL_CTRL_DEFAULT_GAIN 0x2000
    +struct param_id_vol_ctrl_master_gain {
    + uint16_t master_gain;
    + uint16_t reserved;
    +} __packed;
    +
    +
    /* Graph */
    struct audioreach_connection {
    /* Connections */
    --
    2.21.0
    \
     
     \ /
      Last update: 2021-07-14 17:39    [W:4.670 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site