rk27xx codec: Fix volume setting

Change-Id: If57e0225fed4a9f87dff9661b21b2e06fa3d341e
This commit is contained in:
Marcin Bukat 2012-07-10 20:09:21 +02:00
parent 9f13f881b3
commit 676f72a0f4
2 changed files with 14 additions and 9 deletions

View file

@ -28,7 +28,7 @@
#include "i2c-rk27xx.h"
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 */
[SOUND_BASS] = {"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)
return 31;
return 32;
else if (tdb < -115)
return -(((tdb + 115)/20) - 20); /* 2.0 dB steps */
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)
{
uint8_t val;
val = (uint8_t)(vol_r & 0x1f);
codec_write(CGR9, val);
if (vol_l > 31 || vol_r > 31)
{
audiohw_mute(true);
}
else
{
audiohw_mute(false);
val = (uint8_t)(vol_l & 0x1f);
codec_write(CGR8, val);
codec_write(CGR9, vol_r);
codec_write(CGR8, vol_l);
}
}

View file

@ -24,8 +24,8 @@
#ifndef _RK27XX_CODEC_H_
#define _RK27XX_CODEC_H_
#define VOLUME_MIN -335
#define VOLUME_MAX 45
#define VOLUME_MIN -330
#define VOLUME_MAX 40
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
extern int tenthdb2master(int db);