diff options
author | Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com> | 2018-05-08 12:16:39 +0900 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-05-09 18:40:39 +0900 |
commit | 5a748de0644d16ceb4192ebf785742619b88109b (patch) | |
tree | df7f3c3cbe31af36092def4d5016c252f3b265fd /sound/soc/uniphier/aio.h | |
parent | 0e7b25c673ec916dee8d927fc8de5806d900cba8 (diff) | |
download | lwn-5a748de0644d16ceb4192ebf785742619b88109b.tar.gz lwn-5a748de0644d16ceb4192ebf785742619b88109b.zip |
ASoC: uniphier: add digital output volume for UniPhier sound system
This patch adds controllers for digital volume of PCM output. Volume
effects simply linear, not dB scale as follows:
Gained PCM = Original * 0x4000 / Volume
The value range of volume is from 0x0001 to 0xffff. 0x0000 works as
mute. Initial value is 0x4000 (+0dB).
Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/uniphier/aio.h')
-rw-r--r-- | sound/soc/uniphier/aio.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/uniphier/aio.h b/sound/soc/uniphier/aio.h index 52670126084f..aa89c2f6fa24 100644 --- a/sound/soc/uniphier/aio.h +++ b/sound/soc/uniphier/aio.h @@ -130,6 +130,10 @@ enum IEC61937_PC { #define AUD_PLLDIV_1_1 2 #define AUD_PLLDIV_2_3 3 +#define AUD_VOL_INIT 0x4000 /* +0dB */ +#define AUD_VOL_MAX 0xffff /* +6dB */ +#define AUD_VOL_FADE_TIME 20 /* 20ms */ + #define AUD_RING_SIZE (128 * 1024) #define AUD_MIN_FRAGMENT 4 @@ -231,6 +235,7 @@ struct uniphier_aio_sub { /* For PCM audio */ struct snd_pcm_substream *substream; struct snd_pcm_hw_params params; + int vol; /* For compress audio */ struct snd_compr_stream *cstream; @@ -323,6 +328,8 @@ int aio_port_set_clk(struct uniphier_aio_sub *sub); int aio_port_set_param(struct uniphier_aio_sub *sub, int pass_through, const struct snd_pcm_hw_params *params); void aio_port_set_enable(struct uniphier_aio_sub *sub, int enable); +int aio_port_get_volume(struct uniphier_aio_sub *sub); +void aio_port_set_volume(struct uniphier_aio_sub *sub, int vol); int aio_if_set_param(struct uniphier_aio_sub *sub, int pass_through); int aio_oport_set_stream_type(struct uniphier_aio_sub *sub, enum IEC61937_PC pc); |