Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/apps/plugins/test_boost.c b/apps/plugins/test_boost.c
- index ec91206..97ffc02 100644
- diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
- index d8572df..f902377 100644
- --- a/firmware/drivers/audio/as3514.c
- +++ b/firmware/drivers/audio/as3514.c
- @@ -131,8 +131,8 @@ void audiohw_preinit(void)
- #ifdef HAVE_AS3543
- - as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on | AUDIOSET1_DAC_GAIN_on);
- - as3514_write(AS3514_AUDIOSET2, AUDIOSET2_AGC_off | AUDIOSET2_HPH_QUALITY_LOW_POWER);
- + as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on);
- + as3514_write(AS3514_AUDIOSET2, AUDIOSET2_SUM_off | AUDIOSET2_AGC_off | AUDIOSET2_HPH_QUALITY_LOW_POWER);
- /* common ground on, delay playback unmuting when inserting headphones */
- as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_on | AUDIOSET3_HP_LONGSTART);
- @@ -144,8 +144,8 @@ void audiohw_preinit(void)
- /* Select Line 2 for FM radio */
- as3514_set(AS3514_LINE_IN1_R, LINE_IN_R_LINE_SELECT);
- #endif
- - /* Output SUM of microphone/line/DAC */
- - as3514_write(AS3514_HPH_OUT_R, HPH_OUT_R_HEADPHONES | HPH_OUT_R_HP_OUT_SUM);
- + /* Set LINEOUT to minimize pop-click noise in headphone on init stage */
- + as3514_write(AS3514_HPH_OUT_R, HPH_OUT_R_LINEOUT | HPH_OUT_R_HP_OUT_DAC);
- #else
- /* as3514/as3515 */
- @@ -216,6 +216,11 @@ void audiohw_preinit(void)
- /* DAC_Mute_off */
- as3514_set(AS3514_DAC_L, DAC_L_DAC_MUTE_off);
- +
- +#ifdef HAVE_AS3543
- + /* DAC direct - gain, mixer and limitter bypassed */
- + as3514_write(AS3514_HPH_OUT_R, HPH_OUT_R_HEADPHONES | HPH_OUT_R_HP_OUT_DAC);
- +#endif
- }
- static void audiohw_mute(bool mute)
- @@ -291,7 +296,21 @@ void audiohw_set_volume(int vol_l, int vol_r)
- } else {
- mix_l = MIXER_MAX_VOLUME;
- hph_l = vol_l - MIXER_MAX_VOLUME;
- - }
- + }
- +
- +#ifdef HAVE_AS3543
- + if (!(as3514_regs[AS3514_HPH_OUT_R] & 0x40)) {// if not radio or recording
- + if (!hph_l || !hph_r) {
- + as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on | AUDIOSET1_DAC_GAIN_on);
- + as3514_write(AS3514_AUDIOSET2, AUDIOSET2_AGC_off | AUDIOSET2_HPH_QUALITY_LOW_POWER);
- + as3514_write_masked(AS3514_HPH_OUT_R, HPH_OUT_R_HP_OUT_SUM, HPH_OUT_R_HP_OUT_MASK);
- + } else {
- + as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on);
- + as3514_write(AS3514_AUDIOSET2, AUDIOSET2_SUM_off | AUDIOSET2_AGC_off | AUDIOSET2_HPH_QUALITY_LOW_POWER);
- + as3514_write_masked(AS3514_HPH_OUT_R, HPH_OUT_R_HP_OUT_DAC, HPH_OUT_R_HP_OUT_MASK);
- + }
- + }
- +#endif
- as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK);
- as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK);
- @@ -464,6 +483,9 @@ void audiohw_set_recvol(int left, int right, int type)
- void audiohw_set_monitor(bool enable)
- {
- if (enable) {
- +#ifdef HAVE_AS3543
- + as3514_write_masked(AS3514_HPH_OUT_R, HPH_OUT_R_HP_OUT_LINE, HPH_OUT_R_HP_OUT_MASK);
- +#endif
- /* select either LIN1 or LIN2 */
- as3514_write_masked(AS3514_AUDIOSET1, AUDIOSET1_LIN_on,
- AUDIOSET1_LIN1_on | AUDIOSET1_LIN2_on);
- @@ -471,6 +493,9 @@ void audiohw_set_monitor(bool enable)
- as3514_set(AS3514_LINE_IN_L, LINE_IN1_L_LI1L_MUTE_off);
- }
- else {
- +#ifdef HAVE_AS3543
- + as3514_write_masked(AS3514_HPH_OUT_R, HPH_OUT_R_HP_OUT_DAC, HPH_OUT_R_HP_OUT_MASK);
- +#endif
- /* turn off both LIN1 and LIN2 (if present) */
- as3514_clear(AS3514_LINE_IN1_R, LINE_IN1_R_LI1R_MUTE_off);
- as3514_clear(AS3514_LINE_IN1_L, LINE_IN1_L_LI1L_MUTE_off);
- diff --git a/firmware/export/config/sansaclipplus.h b/firmware/export/config/sansaclipplus.h
- index 0bdf82d..0b4aa91 100644
- --- a/firmware/export/config/sansaclipplus.h
- +++ b/firmware/export/config/sansaclipplus.h
- @@ -176,7 +176,7 @@
- #define CURRENT_MAX_CHG 150
- /* Define this to the CPU frequency */
- -#define CPU_FREQ 240000000
- +#define CPU_FREQ 38400000
- /* Type of LCD */
- #define CONFIG_LCD LCD_SSD1303
- @@ -195,7 +195,7 @@
- #define CONFIG_LED LED_VIRTUAL
- /* Define this if you have adjustable CPU frequency */
- -//#define HAVE_ADJUSTABLE_CPU_FREQ
- +#define HAVE_ADJUSTABLE_CPU_FREQ
- #define BOOTFILE_EXT "sansa"
- #define BOOTFILE "rockbox." BOOTFILE_EXT
- diff --git a/firmware/export/config/sansaclipzip.h b/firmware/export/config/sansaclipzip.h
- index eaf51d9..d3aff83 100644
- --- a/firmware/export/config/sansaclipzip.h
- +++ b/firmware/export/config/sansaclipzip.h
- @@ -175,7 +175,7 @@
- #define CURRENT_MAX_CHG 150
- /* Define this to the CPU frequency */
- -#define CPU_FREQ 240000000
- +#define CPU_FREQ 38400000
- /* Type of LCD */
- #define CONFIG_LCD LCD_CLIPZIP
- @@ -194,7 +194,7 @@
- #define CONFIG_LED LED_VIRTUAL
- /* Define this if you have adjustable CPU frequency */
- -//#define HAVE_ADJUSTABLE_CPU_FREQ
- +#define HAVE_ADJUSTABLE_CPU_FREQ
- #define BOOTFILE_EXT "sansa"
- #define BOOTFILE "rockbox." BOOTFILE_EXT
- diff --git a/firmware/rolo.c b/firmware/rolo.c
- index 923199f..8976a3e 100644
- --- a/firmware/rolo.c
- +++ b/firmware/rolo.c
- @@ -267,6 +267,10 @@ int rolo_load(const char* filename)
- lcd_remote_update();
- #endif
- adc_close();
- +#if CONFIG_CPU == AS3525v2
- + /* Set CVDD1 power supply to default*/
- + ascodec_write_pmu(0x17, 1, 0);
- +#endif
- #if CONFIG_CPU != IMX31L /* We're not finished yet */
- #ifdef CPU_ARM
- diff --git a/firmware/target/arm/as3525/clock-target.h b/firmware/target/arm/as3525/clock-target.h
- index 97d6edb..7087313 100644
- --- a/firmware/target/arm/as3525/clock-target.h
- +++ b/firmware/target/arm/as3525/clock-target.h
- @@ -70,11 +70,8 @@
- * - bit 12 = unknown (always set to 1)
- * Fpll = Fin * F / (R * OD), where Fin = 12 MHz
- */
- -#define AS3525_PLLA_FREQ 240000000
- -#define AS3525_PLLA_SETTING 0x113B
- -
- -#define AS3525_PLLB_FREQ 192000000 /* allows 44.1kHz with 0.04% error*/
- -#define AS3525_PLLB_SETTING 0x155F
- +#define AS3525_PLLA_FREQ 192000000 /* allows 44.1kHz with 0.04% error*/
- +#define AS3525_PLLA_SETTING 0x155F
- #define AS3525_FCLK_PREDIV 0
- #define AS3525_FCLK_FREQ AS3525_PLLA_FREQ
- @@ -91,7 +88,7 @@
- * 34285715 HZ works ok but 40MHz works even better*/
- #define AS3525_DRAM_FREQ 40000000 /* Initial DRAM frequency */
- #else
- -#define AS3525_DRAM_FREQ 24000000 /* Initial DRAM frequency */
- +#define AS3525_DRAM_FREQ 96000000 /* Initial DRAM frequency */
- #endif /* SANSA_FUZEV2 */
- #else
- @@ -131,8 +128,8 @@
- /* Tell the software what frequencies we're running */
- #define CPUFREQ_MAX AS3525_FCLK_FREQ
- -#define CPUFREQ_DEFAULT AS3525_PCLK_FREQ
- -#define CPUFREQ_NORMAL AS3525_PCLK_FREQ
- +#define CPUFREQ_DEFAULT 38400000
- +#define CPUFREQ_NORMAL CPUFREQ_DEFAULT
- /* FCLK */
- #define AS3525_FCLK_SEL AS3525_CLK_PLLA
- @@ -145,21 +142,8 @@
- #endif /* CONFIG_CPU == AS3525v2 */
- /* MCLK */
- -#if CONFIG_CPU == AS3525v2
- -/* on AMSv2 we can enable PLLB for MCLK to increase PCM sample rate accuracy
- - with no significant impact on battery life */
- -#define AS3525_MCLK_SEL AS3525_CLK_PLLB
- -#else
- #define AS3525_MCLK_SEL AS3525_CLK_PLLA
- -#endif /* CONFIG_CPU == AS3525v2 */
- -
- -#if (AS3525_MCLK_SEL==AS3525_CLK_PLLA)
- #define AS3525_MCLK_FREQ AS3525_PLLA_FREQ
- -#elif (AS3525_MCLK_SEL==AS3525_CLK_PLLB)
- -#define AS3525_MCLK_FREQ AS3525_PLLB_FREQ
- -#else
- -#error Choose either PLLA or PLLB for MCLK!
- -#endif
- /* PCLK */
- diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
- index f128ef6..04692be 100644
- --- a/firmware/target/arm/as3525/system-as3525.c
- +++ b/firmware/target/arm/as3525/system-as3525.c
- @@ -306,8 +306,6 @@ void system_init(void)
- CGU_PERI |= CGU_ROM_ENABLE; /* needed for rebooting */
- - set_cpu_frequency(CPUFREQ_DEFAULT);
- -
- #if 0 /* the GPIO clock is already enabled by the dualboot function */
- CGU_PERI |= CGU_GPIO_CLOCK_ENABLE;
- #endif
- @@ -336,8 +334,8 @@ void system_init(void)
- /* AVDD17: set AVDD17 power supply to 2.5V */
- ascodec_write_pmu(0x18, 7, 0x31);
- #ifdef SANSA_CLIPZIP
- - /* CVDD2: set CVDD2 power supply to 2.8V */
- - ascodec_write_pmu(0x17, 2, 0xF4);
- + /* CVDD2: set CVDD2 power supply to 2.575V */
- + ascodec_write_pmu(0x17, 2, 0x80 | 111);
- #endif
- #else /* HAVE_AS3543 */
- ascodec_write(AS3514_CVDD_DCDC3, AS314_CP_DCDC3_SETTING);
- @@ -460,23 +458,25 @@ void set_cpu_frequency(long frequency)
- }
- }
- #else /* as3525v2 */
- -/* FIXME : disabled for now, seems to cause buggy memory accesses
- - * Disabling MMU or putting the function in uncached memory seems to help? */
- +static bool frequency_lock = false;
- +
- void set_cpu_frequency(long frequency)
- {
- - int oldstatus = disable_irq_save();
- + if(frequency_lock)
- + return;
- - /* We only have 2 settings */
- - cpu_frequency = (frequency == CPUFREQ_MAX) ? frequency : CPUFREQ_NORMAL;
- + frequency_lock = true;
- if(frequency == CPUFREQ_MAX)
- {
- - /* Change PCLK while FCLK is low, so it doesn't go too high */
- - CGU_PERI = (CGU_PERI & ~(0xF << 2)) | (AS3525_PCLK_DIV0 << 2);
- + /* Set CVDD1 power supply */
- + ascodec_write_pmu(0x17, 1, 0x80 | 47);
- CGU_PROC = ((AS3525_FCLK_POSTDIV << 4) |
- (AS3525_FCLK_PREDIV << 2) |
- AS3525_FCLK_SEL);
- +
- + cpu_frequency = CPUFREQ_MAX;
- }
- else
- {
- @@ -484,11 +484,14 @@ void set_cpu_frequency(long frequency)
- (AS3525_FCLK_PREDIV << 2) |
- AS3525_FCLK_SEL);
- - /* Change PCLK after FCLK is low, so it doesn't go too high */
- - CGU_PERI = (CGU_PERI & ~(0xF << 2)) | (AS3525_PCLK_DIV0_UNBOOSTED << 2);
- + cpu_frequency = CPUFREQ_NORMAL;
- +
- + /* Set CVDD1 power supply */
- + ascodec_write_pmu(0x17, 1, 0x80 | 19);
- +
- }
- - restore_irq(oldstatus);
- + frequency_lock = false;
- }
- #endif
- diff --git a/firmware/target/arm/as3525/usb-as3525.c b/firmware/target/arm/as3525/usb-as3525.c
- index 99ae66d..094a2a9 100644
- --- a/firmware/target/arm/as3525/usb-as3525.c
- +++ b/firmware/target/arm/as3525/usb-as3525.c
- @@ -33,10 +33,21 @@ static int usb_status = USB_EXTRACTED;
- void usb_enable(bool on)
- {
- #if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB)
- - if (on)
- + if (on) {
- +
- + cpu_boost(1);
- +// set_cpu_frequency(CPUFREQ_MAX);
- +// cpu_frequency_lock(true);
- +//#endif
- usb_core_init();
- - else
- + } else {
- usb_core_exit();
- +//#if CONFIG_CPU == AS3525v2
- + sleep(HZ);
- + cpu_boost(0);
- + // cpu_frequency_lock(false);
- +//#endif
- + }
- #else
- (void)on;
- #endif
- diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
- index 01fae5f..2b3d690 100644
- --- a/firmware/target/arm/as3525/usb-drv-as3525.c
- +++ b/firmware/target/arm/as3525/usb-drv-as3525.c
- @@ -238,11 +238,11 @@ void usb_drv_init(void)
- initialized = true;
- }
- - usb_enable_pll();
- -
- /* we have external power, so boost cpu */
- cpu_boost(1);
- + usb_enable_pll();
- +
- /* length regulator: normal operation */
- ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement