Skip to content

Commit

Permalink
ASoC: SOF: update gain ipc msg definition to align with fw
Browse files Browse the repository at this point in the history
Fw uses latest 64 bits curve_duration in gain ipc msg definition so
update kernel driver side. Curve_duration is in number of hundreds
nanoseconds, and only 32 bits int can support up to 400s volume ramp,
which is enough for ramp feature, so we don't need to support 64 bits
read by topology. Now divide 64 bits curve_duration to two parts:
low part set by topology and high part zeroed in driver.

Signed-off-by: Rander Wang <[email protected]>
  • Loading branch information
RanderWang committed Dec 5, 2022
1 parent 41f9d4f commit f7eeed6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion sound/soc/sof/ipc4-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ sof_ipc4_set_volume_data(struct snd_sof_dev *sdev, struct snd_sof_widget *swidge
}

/* set curve type and duration from topology */
data.curve_duration = gain->data.curve_duration;
data.curve_duration_l = gain->data.curve_duration_l;
data.curve_duration_h = gain->data.curve_duration_h;
data.curve_type = gain->data.curve_type;

msg->data_ptr = &data;
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static const struct sof_topology_token gain_tokens[] = {
get_token_u32, offsetof(struct sof_ipc4_gain_data, curve_type)},
{SOF_TKN_GAIN_RAMP_DURATION,
SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc4_gain_data, curve_duration)},
offsetof(struct sof_ipc4_gain_data, curve_duration_l)},
{SOF_TKN_GAIN_VAL, SND_SOC_TPLG_TUPLE_TYPE_WORD,
get_token_u32, offsetof(struct sof_ipc4_gain_data, init_val)},
};
Expand Down Expand Up @@ -715,7 +715,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)

dev_dbg(scomp->dev,
"pga widget %s: ramp type: %d, ramp duration %d, initial gain value: %#x, cpc %d\n",
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration,
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration_l,
gain->data.init_val, gain->base_config.cpc);

ret = sof_ipc4_widget_setup_msg(swidget, &gain->msg);
Expand Down
6 changes: 4 additions & 2 deletions sound/soc/sof/ipc4-topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,16 @@ struct sof_ipc4_control_data {
* @init_val: Initial value
* @curve_type: Curve type
* @reserved: reserved for future use
* @curve_duration: Curve duration
* @curve_duration_l: Curve duration low part
* @curve_duration_h: Curve duration high part
*/
struct sof_ipc4_gain_data {
uint32_t channels;
uint32_t init_val;
uint32_t curve_type;
uint32_t reserved;
uint32_t curve_duration;
uint32_t curve_duration_l;
uint32_t curve_duration_h;
} __aligned(8);

/**
Expand Down

0 comments on commit f7eeed6

Please sign in to comment.