forked from len0rd/rockbox
rk27xx codec: Fix volume setting
Change-Id: If57e0225fed4a9f87dff9661b21b2e06fa3d341e
This commit is contained in:
parent
9f13f881b3
commit
676f72a0f4
2 changed files with 14 additions and 9 deletions
|
|
@ -28,7 +28,7 @@
|
||||||
#include "i2c-rk27xx.h"
|
#include "i2c-rk27xx.h"
|
||||||
|
|
||||||
const struct sound_settings_info audiohw_settings[] = {
|
const struct sound_settings_info audiohw_settings[] = {
|
||||||
[SOUND_VOLUME] = {"dB", 1, 5,-335, 45,-255},
|
[SOUND_VOLUME] = {"dB", 0, 1, -34, 4, -25},
|
||||||
/* HAVE_SW_TONE_CONTROLS */
|
/* HAVE_SW_TONE_CONTROLS */
|
||||||
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
|
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
|
||||||
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
|
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
|
||||||
|
|
@ -72,7 +72,7 @@ int tenthdb2master(int tdb)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (tdb < VOLUME_MIN)
|
if (tdb < VOLUME_MIN)
|
||||||
return 31;
|
return 32;
|
||||||
else if (tdb < -115)
|
else if (tdb < -115)
|
||||||
return -(((tdb + 115)/20) - 20); /* 2.0 dB steps */
|
return -(((tdb + 115)/20) - 20); /* 2.0 dB steps */
|
||||||
else if (tdb < 5)
|
else if (tdb < 5)
|
||||||
|
|
@ -150,11 +150,16 @@ void audiohw_set_frequency(int fsel)
|
||||||
|
|
||||||
void audiohw_set_master_vol(int vol_l, int vol_r)
|
void audiohw_set_master_vol(int vol_l, int vol_r)
|
||||||
{
|
{
|
||||||
uint8_t val;
|
|
||||||
|
|
||||||
val = (uint8_t)(vol_r & 0x1f);
|
if (vol_l > 31 || vol_r > 31)
|
||||||
codec_write(CGR9, val);
|
{
|
||||||
|
audiohw_mute(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
audiohw_mute(false);
|
||||||
|
|
||||||
val = (uint8_t)(vol_l & 0x1f);
|
codec_write(CGR9, vol_r);
|
||||||
codec_write(CGR8, val);
|
codec_write(CGR8, vol_l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
#ifndef _RK27XX_CODEC_H_
|
#ifndef _RK27XX_CODEC_H_
|
||||||
#define _RK27XX_CODEC_H_
|
#define _RK27XX_CODEC_H_
|
||||||
|
|
||||||
#define VOLUME_MIN -335
|
#define VOLUME_MIN -330
|
||||||
#define VOLUME_MAX 45
|
#define VOLUME_MAX 40
|
||||||
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
|
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue