Skip to content

Commit

Permalink
ASoC: rt5645: Add the control of ClassD modulator Speaker Gain Ratio
Browse files Browse the repository at this point in the history
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Oder Chiou authored and Mark Brown committed Oct 1, 2015
1 parent de3f8fd commit e29fd55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sound/soc/codecs/rt5645.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,25 @@ static const DECLARE_TLV_DB_RANGE(bst_tlv,
8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0)
);

/* {-6, -4.5, -3, -1.5, 0, 0.82, 1.58, 2.28} dB */
static const DECLARE_TLV_DB_RANGE(spk_clsd_tlv,
0, 4, TLV_DB_SCALE_ITEM(-600, 150, 0),
5, 5, TLV_DB_SCALE_ITEM(82, 0, 0),
6, 6, TLV_DB_SCALE_ITEM(158, 0, 0),
7, 7, TLV_DB_SCALE_ITEM(228, 0, 0)
);

static const struct snd_kcontrol_new rt5645_snd_controls[] = {
/* Speaker Output Volume */
SOC_DOUBLE("Speaker Channel Switch", RT5645_SPK_VOL,
RT5645_VOL_L_SFT, RT5645_VOL_R_SFT, 1, 1),
SOC_DOUBLE_TLV("Speaker Playback Volume", RT5645_SPK_VOL,
RT5645_L_VOL_SFT, RT5645_R_VOL_SFT, 39, 1, out_vol_tlv),

/* ClassD modulator Speaker Gain Ratio */
SOC_SINGLE_TLV("Speaker ClassD Playback Volume", RT5645_SPO_CLSD_RATIO,
RT5645_SPK_G_CLSD_SFT, 7, 0, spk_clsd_tlv),

/* Headphone Output Volume */
SOC_DOUBLE("Headphone Channel Switch", RT5645_HP_VOL,
RT5645_VOL_L_SFT, RT5645_VOL_R_SFT, 1, 1),
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/codecs/rt5645.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@
#define RT5645_M_SV_R_SPM_R (0x1 << 0)
#define RT5645_M_SV_R_SPM_R_SFT 0

/* SPOMIX Ratio Control (0x4a) */
#define RT5645_SPK_G_CLSD_MASK (0x7 << 0)
#define RT5645_SPK_G_CLSD_SFT 0

/* Mono Output Mixer Control (0x4c) */
#define RT5645_M_OV_L_MM (0x1 << 9)
#define RT5645_M_OV_L_MM_SFT 9
Expand Down

0 comments on commit e29fd55

Please sign in to comment.