提交 32e933be 编写于 作者: L Lars-Peter Clausen 提交者: Mark Brown

ASoC: da7213: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE

DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD()
that it automatically calculates the number of items in the TLV and is
hence less prone to manual error.

Generate using the following coccinelle script

// <smpl>
@@
declarer name DECLARE_TLV_DB_RANGE;
identifier tlv;
constant x;
@@
-unsigned int tlv[] = {
-	TLV_DB_RANGE_HEAD(x),
+DECLARE_TLV_DB_RANGE(tlv,
	...
-};
+);
// </smpl>
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Acked-by: NAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 6c1e1bfe
...@@ -28,27 +28,24 @@ ...@@ -28,27 +28,24 @@
/* Gain and Volume */ /* Gain and Volume */
static const unsigned int aux_vol_tlv[] = { static const DECLARE_TLV_DB_RANGE(aux_vol_tlv,
TLV_DB_RANGE_HEAD(2),
/* -54dB */ /* -54dB */
0x0, 0x11, TLV_DB_SCALE_ITEM(-5400, 0, 0), 0x0, 0x11, TLV_DB_SCALE_ITEM(-5400, 0, 0),
/* -52.5dB to 15dB */ /* -52.5dB to 15dB */
0x12, 0x3f, TLV_DB_SCALE_ITEM(-5250, 150, 0) 0x12, 0x3f, TLV_DB_SCALE_ITEM(-5250, 150, 0)
}; );
static const unsigned int digital_gain_tlv[] = { static const DECLARE_TLV_DB_RANGE(digital_gain_tlv,
TLV_DB_RANGE_HEAD(2),
0x0, 0x07, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1), 0x0, 0x07, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
/* -78dB to 12dB */ /* -78dB to 12dB */
0x08, 0x7f, TLV_DB_SCALE_ITEM(-7800, 75, 0) 0x08, 0x7f, TLV_DB_SCALE_ITEM(-7800, 75, 0)
}; );
static const unsigned int alc_analog_gain_tlv[] = { static const DECLARE_TLV_DB_RANGE(alc_analog_gain_tlv,
TLV_DB_RANGE_HEAD(2),
0x0, 0x0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1), 0x0, 0x0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
/* 0dB to 36dB */ /* 0dB to 36dB */
0x01, 0x07, TLV_DB_SCALE_ITEM(0, 600, 0) 0x01, 0x07, TLV_DB_SCALE_ITEM(0, 600, 0)
}; );
static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0); static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_SCALE(mixin_gain_tlv, -450, 150, 0); static const DECLARE_TLV_DB_SCALE(mixin_gain_tlv, -450, 150, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册