diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/audio/as3514.c | 42 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_as3514.c | 4 |
2 files changed, 43 insertions, 3 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[] = { | |||
78 | #endif | 78 | #endif |
79 | }; | 79 | }; |
80 | 80 | ||
81 | #ifndef SAMSUNG_YPR0 | ||
81 | /* Shadow registers */ | 82 | /* Shadow registers */ |
82 | static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */ | 83 | static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */ |
83 | 84 | ||
@@ -110,7 +111,29 @@ static void as3514_write_masked(unsigned int reg, unsigned int bits, | |||
110 | { | 111 | { |
111 | as3514_write(reg, (as3514_regs[reg] & ~mask) | (bits & mask)); | 112 | as3514_write(reg, (as3514_regs[reg] & ~mask) | (bits & mask)); |
112 | } | 113 | } |
114 | #else | ||
115 | static void as3514_write(unsigned int reg, unsigned int value) | ||
116 | { | ||
117 | ascodec_write(reg, value); | ||
118 | } | ||
119 | |||
120 | /* Helpers to set/clear bits */ | ||
121 | static void as3514_set(unsigned int reg, unsigned int bits) | ||
122 | { | ||
123 | ascodec_write(reg, ascodec_read(reg) | bits); | ||
124 | } | ||
125 | |||
126 | static void as3514_clear(unsigned int reg, unsigned int bits) | ||
127 | { | ||
128 | ascodec_write(reg, ascodec_read(reg) & ~bits); | ||
129 | } | ||
113 | 130 | ||
131 | static void as3514_write_masked(unsigned int reg, unsigned int bits, | ||
132 | unsigned int mask) | ||
133 | { | ||
134 | ascodec_write(reg, (ascodec_read(reg) & ~mask) | (bits & mask)); | ||
135 | } | ||
136 | #endif | ||
114 | /* convert tenth of dB volume to master volume register value */ | 137 | /* convert tenth of dB volume to master volume register value */ |
115 | int tenthdb2master(int db) | 138 | int tenthdb2master(int db) |
116 | { | 139 | { |
@@ -145,8 +168,11 @@ int sound_val2phys(int setting, int value) | |||
145 | */ | 168 | */ |
146 | void audiohw_preinit(void) | 169 | void audiohw_preinit(void) |
147 | { | 170 | { |
171 | |||
172 | #ifndef SAMSUNG_YPR0 | ||
148 | /* read all reg values */ | 173 | /* read all reg values */ |
149 | ascodec_readbytes(0x0, AS3514_NUM_AUDIO_REGS, as3514_regs); | 174 | ascodec_readbytes(0x0, AS3514_NUM_AUDIO_REGS, as3514_regs); |
175 | #endif | ||
150 | 176 | ||
151 | #ifdef HAVE_AS3543 | 177 | #ifdef HAVE_AS3543 |
152 | 178 | ||
@@ -284,9 +310,14 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
284 | #if CONFIG_CPU == AS3525v2 | 310 | #if CONFIG_CPU == AS3525v2 |
285 | #define MIXER_MAX_VOLUME 0x1b | 311 | #define MIXER_MAX_VOLUME 0x1b |
286 | #else /* lets leave the AS3514 alone until its better tested*/ | 312 | #else /* lets leave the AS3514 alone until its better tested*/ |
313 | #ifdef SAMSUNG_YPR0 | ||
314 | #define MIXER_MAX_VOLUME 0x1a | ||
315 | #else | ||
287 | #define MIXER_MAX_VOLUME 0x16 | 316 | #define MIXER_MAX_VOLUME 0x16 |
288 | #endif | 317 | #endif |
318 | #endif | ||
289 | 319 | ||
320 | #ifndef SAMSUNG_YPR0 | ||
290 | if (vol_r <= MIXER_MAX_VOLUME) { | 321 | if (vol_r <= MIXER_MAX_VOLUME) { |
291 | mix_r = vol_r; | 322 | mix_r = vol_r; |
292 | hph_r = 0; | 323 | hph_r = 0; |
@@ -302,7 +333,16 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
302 | mix_l = MIXER_MAX_VOLUME; | 333 | mix_l = MIXER_MAX_VOLUME; |
303 | hph_l = vol_l - MIXER_MAX_VOLUME; | 334 | hph_l = vol_l - MIXER_MAX_VOLUME; |
304 | } | 335 | } |
305 | 336 | #else | |
337 | /* Okay. This is shit coded indeed. It is just a test. | ||
338 | Some considerations: Samsung keeps DAC constantly to 0x1a volume. It modifies only the headphone amp volume | ||
339 | */ | ||
340 | |||
341 | mix_r = 0x1a; | ||
342 | mix_l = 0x1a; | ||
343 | hph_l = vol_l; | ||
344 | hph_r = vol_r; | ||
345 | #endif | ||
306 | 346 | ||
307 | as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK); | 347 | as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK); |
308 | as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK); | 348 | as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK); |
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c index 44ef3cc4a1..868fa9753b 100644 --- a/firmware/drivers/rtc/rtc_as3514.c +++ b/firmware/drivers/rtc/rtc_as3514.c | |||
@@ -141,11 +141,11 @@ void rtc_alarm_poweroff(void) | |||
141 | seconds = 24*3600; | 141 | seconds = 24*3600; |
142 | 142 | ||
143 | seconds -= tm.tm_sec; | 143 | seconds -= tm.tm_sec; |
144 | 144 | #ifndef SAMSUNG_YPR0 | |
145 | /* disable MCLK, it is a wakeup source and prevents proper shutdown */ | 145 | /* disable MCLK, it is a wakeup source and prevents proper shutdown */ |
146 | CGU_AUDIO = (2 << 0) | (1 << 11); | 146 | CGU_AUDIO = (2 << 0) | (1 << 11); |
147 | CGU_PLLBSUP = (1 << 2) | (1 << 3); | 147 | CGU_PLLBSUP = (1 << 2) | (1 << 3); |
148 | 148 | #endif | |
149 | /* write wakeup register */ | 149 | /* write wakeup register */ |
150 | alarm.seconds = seconds; | 150 | alarm.seconds = seconds; |
151 | alarm.enabled = true; | 151 | alarm.enabled = true; |