summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/audio/as3514.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/as3514.c')
-rw-r--r--firmware/drivers/audio/as3514.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 64531cfc2b..0fe3070c19 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -78,6 +78,7 @@ const struct sound_settings_info audiohw_settings[] = {
#endif
};
+#ifndef SAMSUNG_YPR0
/* Shadow registers */
static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */
@@ -110,7 +111,29 @@ static void as3514_write_masked(unsigned int reg, unsigned int bits,
{
as3514_write(reg, (as3514_regs[reg] & ~mask) | (bits & mask));
}
+#else
+static void as3514_write(unsigned int reg, unsigned int value)
+{
+ ascodec_write(reg, value);
+}
+
+/* Helpers to set/clear bits */
+static void as3514_set(unsigned int reg, unsigned int bits)
+{
+ ascodec_write(reg, ascodec_read(reg) | bits);
+}
+
+static void as3514_clear(unsigned int reg, unsigned int bits)
+{
+ ascodec_write(reg, ascodec_read(reg) & ~bits);
+}
+static void as3514_write_masked(unsigned int reg, unsigned int bits,
+ unsigned int mask)
+{
+ ascodec_write(reg, (ascodec_read(reg) & ~mask) | (bits & mask));
+}
+#endif
/* convert tenth of dB volume to master volume register value */
int tenthdb2master(int db)
{
@@ -145,8 +168,11 @@ int sound_val2phys(int setting, int value)
*/
void audiohw_preinit(void)
{
+
+#ifndef SAMSUNG_YPR0
/* read all reg values */
ascodec_readbytes(0x0, AS3514_NUM_AUDIO_REGS, as3514_regs);
+#endif
#ifdef HAVE_AS3543
@@ -284,9 +310,14 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
#if CONFIG_CPU == AS3525v2
#define MIXER_MAX_VOLUME 0x1b
#else /* lets leave the AS3514 alone until its better tested*/
+#ifdef SAMSUNG_YPR0
+#define MIXER_MAX_VOLUME 0x1a
+#else
#define MIXER_MAX_VOLUME 0x16
#endif
+#endif
+#ifndef SAMSUNG_YPR0
if (vol_r <= MIXER_MAX_VOLUME) {
mix_r = vol_r;
hph_r = 0;
@@ -302,7 +333,16 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
mix_l = MIXER_MAX_VOLUME;
hph_l = vol_l - MIXER_MAX_VOLUME;
}
-
+#else
+/* Okay. This is shit coded indeed. It is just a test.
+ Some considerations: Samsung keeps DAC constantly to 0x1a volume. It modifies only the headphone amp volume
+*/
+
+ mix_r = 0x1a;
+ mix_l = 0x1a;
+ hph_l = vol_l;
+ hph_r = vol_r;
+#endif
as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK);
as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK);