diff options
author | Michal Oleszczyk <oleszczyk.m@gmail.com> | 2018-02-19 04:03:46 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-19 06:36:40 -0500 |
commit | 92a2742f9813ef65da19145a77e8067d6abbc822 (patch) | |
tree | 3bd2a42c8b0e0feccb5001f8d9aca2e33a920326 | |
parent | 7f7d5239f56cfd25ba8470354d9705815c079157 (diff) |
ASoC: sgtl5000: add 5 band graphic equalizer
Enable 5-band graphic equalizer which allows manipulation of
gain in range -11.75dB to 12dB for 5 specific sound bands:
115Hz, 330Hz, 990Hz, 3000Hz, 9900Hz.
Signed-off-by: Michal Oleszczyk <oleszczyk.m@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 24 | ||||
-rw-r--r-- | sound/soc/codecs/sgtl5000.h | 7 |
2 files changed, 28 insertions, 3 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 1724c4622052..7c1d65830c05 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -520,6 +520,9 @@ static const DECLARE_TLV_DB_RANGE(mic_gain_tlv, | |||
520 | /* tlv for DAP channels, 0% - 100% - 200% */ | 520 | /* tlv for DAP channels, 0% - 100% - 200% */ |
521 | static const DECLARE_TLV_DB_SCALE(dap_volume, 0, 1, 0); | 521 | static const DECLARE_TLV_DB_SCALE(dap_volume, 0, 1, 0); |
522 | 522 | ||
523 | /* tlv for bass bands, -11.75db to 12.0db, step .25db */ | ||
524 | static const DECLARE_TLV_DB_SCALE(bass_band, -1175, 25, 0); | ||
525 | |||
523 | /* tlv for hp volume, -51.5db to 12.0db, step .5db */ | 526 | /* tlv for hp volume, -51.5db to 12.0db, step .5db */ |
524 | static const DECLARE_TLV_DB_SCALE(headphone_volume, -5150, 50, 0); | 527 | static const DECLARE_TLV_DB_SCALE(headphone_volume, -5150, 50, 0); |
525 | 528 | ||
@@ -585,6 +588,21 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = { | |||
585 | SOC_SINGLE_EXT_TLV("AVC Threshold Volume", SGTL5000_DAP_AVC_THRESHOLD, | 588 | SOC_SINGLE_EXT_TLV("AVC Threshold Volume", SGTL5000_DAP_AVC_THRESHOLD, |
586 | 0, 96, 0, avc_get_threshold, avc_put_threshold, | 589 | 0, 96, 0, avc_get_threshold, avc_put_threshold, |
587 | avc_threshold), | 590 | avc_threshold), |
591 | |||
592 | SOC_SINGLE_TLV("BASS 0", SGTL5000_DAP_EQ_BASS_BAND0, | ||
593 | 0, 0x5F, 0, bass_band), | ||
594 | |||
595 | SOC_SINGLE_TLV("BASS 1", SGTL5000_DAP_EQ_BASS_BAND1, | ||
596 | 0, 0x5F, 0, bass_band), | ||
597 | |||
598 | SOC_SINGLE_TLV("BASS 2", SGTL5000_DAP_EQ_BASS_BAND2, | ||
599 | 0, 0x5F, 0, bass_band), | ||
600 | |||
601 | SOC_SINGLE_TLV("BASS 3", SGTL5000_DAP_EQ_BASS_BAND3, | ||
602 | 0, 0x5F, 0, bass_band), | ||
603 | |||
604 | SOC_SINGLE_TLV("BASS 4", SGTL5000_DAP_EQ_BASS_BAND4, | ||
605 | 0, 0x5F, 0, bass_band), | ||
588 | }; | 606 | }; |
589 | 607 | ||
590 | /* mute the codec used by alsa core */ | 608 | /* mute the codec used by alsa core */ |
@@ -1303,11 +1321,11 @@ static int sgtl5000_probe(struct snd_soc_component *component) | |||
1303 | SGTL5000_BIAS_VOLT_MASK, | 1321 | SGTL5000_BIAS_VOLT_MASK, |
1304 | sgtl5000->micbias_voltage << SGTL5000_BIAS_VOLT_SHIFT); | 1322 | sgtl5000->micbias_voltage << SGTL5000_BIAS_VOLT_SHIFT); |
1305 | /* | 1323 | /* |
1306 | * disable DAP | 1324 | * enable DAP Graphic EQ |
1307 | * TODO: | 1325 | * TODO: |
1308 | * Enable DAP in kcontrol and dapm. | 1326 | * Add control for changing between PEQ/Tone Control/GEQ |
1309 | */ | 1327 | */ |
1310 | snd_soc_component_write(component, SGTL5000_DAP_CTRL, 0); | 1328 | snd_soc_component_write(component, SGTL5000_DAP_AUDIO_EQ, SGTL5000_DAP_SEL_GEQ); |
1311 | 1329 | ||
1312 | /* Unmute DAC after start */ | 1330 | /* Unmute DAC after start */ |
1313 | snd_soc_component_update_bits(component, SGTL5000_CHIP_ADCDAC_CTRL, | 1331 | snd_soc_component_update_bits(component, SGTL5000_CHIP_ADCDAC_CTRL, |
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 22f3442af982..28cf637155bb 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h | |||
@@ -399,4 +399,11 @@ | |||
399 | #define SGTL5000_SYSCLK 0x00 | 399 | #define SGTL5000_SYSCLK 0x00 |
400 | #define SGTL5000_LRCLK 0x01 | 400 | #define SGTL5000_LRCLK 0x01 |
401 | 401 | ||
402 | /* | ||
403 | * SGTL5000_DAP_AUDIO_EQ | ||
404 | */ | ||
405 | #define SGTL5000_DAP_SEL_PEQ 1 | ||
406 | #define SGTL5000_DAP_SEL_TONE_CTRL 2 | ||
407 | #define SGTL5000_DAP_SEL_GEQ 3 | ||
408 | |||
402 | #endif | 409 | #endif |