Commit 108ccb3f authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai

ALSA: asihpi - Change compander API and tidy

Compander API changed to one function per parameter.
Factor out some common code for stereo log value reading.
Make some more entity functions static.
Signed-off-by: default avatarEliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 38439146
...@@ -142,12 +142,15 @@ enum HPI_BUSES { ...@@ -142,12 +142,15 @@ enum HPI_BUSES {
/******************************************* CONTROL ATTRIBUTES ****/ /******************************************* CONTROL ATTRIBUTES ****/
/* (in order of control type ID */ /* (in order of control type ID */
/* This allows for 255 control types, 256 unique attributes each */ /* This allows for 255 control types, 256 unique attributes each */
#define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai) #define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai)
/* Get the sub-index of the attribute for a control type */ /* Get the sub-index of the attribute for a control type */
#define HPI_CTL_ATTR_INDEX(i) (i&0xff) #define HPI_CTL_ATTR_INDEX(i) (i&0xff)
/* Extract the control from the control attribute */
#define HPI_CTL_ATTR_CONTROL(i) (i>>8)
/* Generic control attributes. */ /* Generic control attributes. */
/** Enable a control. /** Enable a control.
...@@ -311,8 +314,7 @@ Used for HPI_ChannelModeSet/Get() ...@@ -311,8 +314,7 @@ Used for HPI_ChannelModeSet/Get()
/* Microphone control attributes */ /* Microphone control attributes */
#define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1) #define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1)
/** Equalizer control attributes /** Equalizer control attributes */
*/
/** Used to get number of filters in an EQ. (Can't set) */ /** Used to get number of filters in an EQ. (Can't set) */
#define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1) #define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1)
/** Set/get the filter by type, freq, Q, gain */ /** Set/get the filter by type, freq, Q, gain */
...@@ -320,13 +322,15 @@ Used for HPI_ChannelModeSet/Get() ...@@ -320,13 +322,15 @@ Used for HPI_ChannelModeSet/Get()
/** Get the biquad coefficients */ /** Get the biquad coefficients */
#define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3) #define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3)
/* Note compander also uses HPI_GENERIC_ENABLE */
#define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1) #define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1)
#define HPI_COMPANDER_MAKEUPGAIN HPI_CTL_ATTR(COMPANDER, 2)
#define HPI_COMPANDER_THRESHOLD HPI_CTL_ATTR(COMPANDER, 3)
#define HPI_COMPANDER_RATIO HPI_CTL_ATTR(COMPANDER, 4)
#define HPI_COMPANDER_ATTACK HPI_CTL_ATTR(COMPANDER, 5)
#define HPI_COMPANDER_DECAY HPI_CTL_ATTR(COMPANDER, 6)
/* Cobranet control attributes. /* Cobranet control attributes. */
MUST be distinct from all other control attributes.
This is so that host side processing can easily identify a Cobranet control
and apply additional host side operations (like copying data) as required.
*/
#define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1) #define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1)
#define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2) #define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2)
#define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3) #define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3)
...@@ -1512,11 +1516,11 @@ struct hpi_control_cache_single { ...@@ -1512,11 +1516,11 @@ struct hpi_control_cache_single {
struct hpi_control_cache_info i; struct hpi_control_cache_info i;
union { union {
struct { /* volume */ struct { /* volume */
u16 an_log[2]; short an_log[2];
} v; } v;
struct { /* peak meter */ struct { /* peak meter */
u16 an_log_peak[2]; short an_log_peak[2];
u16 an_logRMS[2]; short an_logRMS[2];
} p; } p;
struct { /* channel mode */ struct { /* channel mode */
u16 mode; u16 mode;
...@@ -1526,7 +1530,7 @@ struct hpi_control_cache_single { ...@@ -1526,7 +1530,7 @@ struct hpi_control_cache_single {
u16 source_node_index; u16 source_node_index;
} x; } x;
struct { /* level/trim */ struct { /* level/trim */
u16 an_log[2]; short an_log[2];
} l; } l;
struct { /* tuner - partial caching. struct { /* tuner - partial caching.
some attributes go to the DSP. */ some attributes go to the DSP. */
......
This diff is collapsed.
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