提交 8896bc3e 编写于 作者: L Lars-Peter Clausen 提交者: Mark Brown

ASoC: max98090: 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>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 80170468
...@@ -360,22 +360,20 @@ static int max98090_reset(struct max98090_priv *max98090) ...@@ -360,22 +360,20 @@ static int max98090_reset(struct max98090_priv *max98090)
return ret; return ret;
} }
static const unsigned int max98090_micboost_tlv[] = { static const DECLARE_TLV_DB_RANGE(max98090_micboost_tlv,
TLV_DB_RANGE_HEAD(2),
0, 1, TLV_DB_SCALE_ITEM(0, 2000, 0), 0, 1, TLV_DB_SCALE_ITEM(0, 2000, 0),
2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0)
}; );
static const DECLARE_TLV_DB_SCALE(max98090_mic_tlv, 0, 100, 0); static const DECLARE_TLV_DB_SCALE(max98090_mic_tlv, 0, 100, 0);
static const DECLARE_TLV_DB_SCALE(max98090_line_single_ended_tlv, static const DECLARE_TLV_DB_SCALE(max98090_line_single_ended_tlv,
-600, 600, 0); -600, 600, 0);
static const unsigned int max98090_line_tlv[] = { static const DECLARE_TLV_DB_RANGE(max98090_line_tlv,
TLV_DB_RANGE_HEAD(2),
0, 3, TLV_DB_SCALE_ITEM(-600, 300, 0), 0, 3, TLV_DB_SCALE_ITEM(-600, 300, 0),
4, 5, TLV_DB_SCALE_ITEM(1400, 600, 0), 4, 5, TLV_DB_SCALE_ITEM(1400, 600, 0)
}; );
static const DECLARE_TLV_DB_SCALE(max98090_avg_tlv, 0, 600, 0); static const DECLARE_TLV_DB_SCALE(max98090_avg_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(max98090_av_tlv, -1200, 100, 0); static const DECLARE_TLV_DB_SCALE(max98090_av_tlv, -1200, 100, 0);
...@@ -391,38 +389,34 @@ static const DECLARE_TLV_DB_SCALE(max98090_alccomp_tlv, -3100, 100, 0); ...@@ -391,38 +389,34 @@ static const DECLARE_TLV_DB_SCALE(max98090_alccomp_tlv, -3100, 100, 0);
static const DECLARE_TLV_DB_SCALE(max98090_drcexp_tlv, -6600, 100, 0); static const DECLARE_TLV_DB_SCALE(max98090_drcexp_tlv, -6600, 100, 0);
static const DECLARE_TLV_DB_SCALE(max98090_sdg_tlv, 50, 200, 0); static const DECLARE_TLV_DB_SCALE(max98090_sdg_tlv, 50, 200, 0);
static const unsigned int max98090_mixout_tlv[] = { static const DECLARE_TLV_DB_RANGE(max98090_mixout_tlv,
TLV_DB_RANGE_HEAD(2),
0, 1, TLV_DB_SCALE_ITEM(-1200, 250, 0), 0, 1, TLV_DB_SCALE_ITEM(-1200, 250, 0),
2, 3, TLV_DB_SCALE_ITEM(-600, 600, 0), 2, 3, TLV_DB_SCALE_ITEM(-600, 600, 0)
}; );
static const unsigned int max98090_hp_tlv[] = { static const DECLARE_TLV_DB_RANGE(max98090_hp_tlv,
TLV_DB_RANGE_HEAD(5),
0, 6, TLV_DB_SCALE_ITEM(-6700, 400, 0), 0, 6, TLV_DB_SCALE_ITEM(-6700, 400, 0),
7, 14, TLV_DB_SCALE_ITEM(-4000, 300, 0), 7, 14, TLV_DB_SCALE_ITEM(-4000, 300, 0),
15, 21, TLV_DB_SCALE_ITEM(-1700, 200, 0), 15, 21, TLV_DB_SCALE_ITEM(-1700, 200, 0),
22, 27, TLV_DB_SCALE_ITEM(-400, 100, 0), 22, 27, TLV_DB_SCALE_ITEM(-400, 100, 0),
28, 31, TLV_DB_SCALE_ITEM(150, 50, 0), 28, 31, TLV_DB_SCALE_ITEM(150, 50, 0)
}; );
static const unsigned int max98090_spk_tlv[] = { static const DECLARE_TLV_DB_RANGE(max98090_spk_tlv,
TLV_DB_RANGE_HEAD(5),
0, 4, TLV_DB_SCALE_ITEM(-4800, 400, 0), 0, 4, TLV_DB_SCALE_ITEM(-4800, 400, 0),
5, 10, TLV_DB_SCALE_ITEM(-2900, 300, 0), 5, 10, TLV_DB_SCALE_ITEM(-2900, 300, 0),
11, 14, TLV_DB_SCALE_ITEM(-1200, 200, 0), 11, 14, TLV_DB_SCALE_ITEM(-1200, 200, 0),
15, 29, TLV_DB_SCALE_ITEM(-500, 100, 0), 15, 29, TLV_DB_SCALE_ITEM(-500, 100, 0),
30, 39, TLV_DB_SCALE_ITEM(950, 50, 0), 30, 39, TLV_DB_SCALE_ITEM(950, 50, 0)
}; );
static const unsigned int max98090_rcv_lout_tlv[] = { static const DECLARE_TLV_DB_RANGE(max98090_rcv_lout_tlv,
TLV_DB_RANGE_HEAD(5),
0, 6, TLV_DB_SCALE_ITEM(-6200, 400, 0), 0, 6, TLV_DB_SCALE_ITEM(-6200, 400, 0),
7, 14, TLV_DB_SCALE_ITEM(-3500, 300, 0), 7, 14, TLV_DB_SCALE_ITEM(-3500, 300, 0),
15, 21, TLV_DB_SCALE_ITEM(-1200, 200, 0), 15, 21, TLV_DB_SCALE_ITEM(-1200, 200, 0),
22, 27, TLV_DB_SCALE_ITEM(100, 100, 0), 22, 27, TLV_DB_SCALE_ITEM(100, 100, 0),
28, 31, TLV_DB_SCALE_ITEM(650, 50, 0), 28, 31, TLV_DB_SCALE_ITEM(650, 50, 0)
}; );
static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol, static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册