mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
imx233/fuze+: set a few recommended power bits by Freescale, remove some uneeded headers, implement audio path selection for playback and radio
Change-Id: If926ead9b776504a58eb102fcc0e9acadf4f7379
This commit is contained in:
parent
c18a4e6316
commit
289440605a
7 changed files with 63 additions and 5 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include "string.h"
|
||||
#include "usb.h"
|
||||
#include "system-target.h"
|
||||
#include "power-imx233.h"
|
||||
|
||||
struct current_step_bit_t
|
||||
{
|
||||
|
|
@ -99,6 +100,10 @@ void power_init(void)
|
|||
__FIELD_SET(HW_POWER_VDDDCTRL, LINREG_OFFSET, 2);
|
||||
__FIELD_SET(HW_POWER_VDDACTRL, LINREG_OFFSET, 2);
|
||||
__FIELD_SET(HW_POWER_VDDIOCTRL, LINREG_OFFSET, 2);
|
||||
/* enable a few bits controlling the DC-DC as recommended by Freescale */
|
||||
__REG_SET(HW_POWER_LOOPCTRL) = HW_POWER_LOOPCTRL__TOGGLE_DIF |
|
||||
HW_POWER_LOOPCTRL__EN_CM_HYST;
|
||||
__FIELD_SET(HW_POWER_LOOPCTRL, EN_RCSCALE, HW_POWER_LOOPCTRL__EN_RCSCALE__2X);
|
||||
}
|
||||
|
||||
void power_off(void)
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@
|
|||
#define HW_POWER_5VCTRL__PWD_CHARGE_4P2 (1 << 20)
|
||||
|
||||
#define HW_POWER_MINPWR (*(volatile uint32_t *)(HW_POWER_BASE + 0x20))
|
||||
#define HW_POWER_MINPWR__HALF_FETS (1 << 5)
|
||||
#define HW_POWER_MINPWR__DOUBLE_FETS (1 << 6)
|
||||
|
||||
#define HW_POWER_CHARGE (*(volatile uint32_t *)(HW_POWER_BASE + 0x30))
|
||||
#define HW_POWER_CHARGE__BATTCHRG_I_BP 0
|
||||
|
|
@ -129,6 +131,27 @@
|
|||
#define HW_POWER_MISC__FREQSEL__21p6MHz 6
|
||||
#define HW_POWER_MISC__FREQSEL__17p28MHz 7
|
||||
|
||||
#define HW_POWER_LOOPCTRL (*(volatile uint32_t *)(HW_POWER_BASE + 0xb0))
|
||||
#define HW_POWER_LOOPCTRL__DC_C_BP 0
|
||||
#define HW_POWER_LOOPCTRL__DC_C_BM 0x3
|
||||
#define HW_POWER_LOOPCTRL__DC_R_BP 4
|
||||
#define HW_POWER_LOOPCTRL__DC_R_BM 0xf0
|
||||
#define HW_POWER_LOOPCTRL__DC_FF_BP 8
|
||||
#define HW_POWER_LOOPCTRL__DC_FF_BM (0x7 << 8)
|
||||
#define HW_POWER_LOOPCTRL__EN_RCSCALE_BP 12
|
||||
#define HW_POWER_LOOPCTRL__EN_RCSCALE_BM (0x3 << 12)
|
||||
#define HW_POWER_LOOPCTRL__EN_RCSCALE__DISABLED 0
|
||||
#define HW_POWER_LOOPCTRL__EN_RCSCALE__2X 1
|
||||
#define HW_POWER_LOOPCTRL__EN_RCSCALE__4X 2
|
||||
#define HW_POWER_LOOPCTRL__EN_RCSCALE__8X 3
|
||||
#define HW_POWER_LOOPCTRL__RCSCALE_THRESH (1 << 14)
|
||||
#define HW_POWER_LOOPCTRL__DF_HYST_THRESH (1 << 15)
|
||||
#define HW_POWER_LOOPCTRL__CM_HYST_THRESH (1 << 16)
|
||||
#define HW_POWER_LOOPCTRL__EN_DF_HYST (1 << 17)
|
||||
#define HW_POWER_LOOPCTRL__EN_CM_HYST (1 << 18)
|
||||
#define HW_POWER_LOOPCTRL__HYST_SIGN (1 << 19)
|
||||
#define HW_POWER_LOOPCTRL__TOGGLE_DIF (1 << 20)
|
||||
|
||||
#define HW_POWER_STS (*(volatile uint32_t *)(HW_POWER_BASE + 0xc0))
|
||||
#define HW_POWER_STS__VBUSVALID (1 << 1)
|
||||
#define HW_POWER_STS__CHRGSTS (1 << 11)
|
||||
|
|
@ -148,6 +171,17 @@ void imx233_power_set_charge_current(unsigned current); /* in mA */
|
|||
void imx233_power_set_stop_current(unsigned current); /* in mA */
|
||||
void imx233_power_enable_batadj(bool enable);
|
||||
|
||||
static inline void imx233_power_set_dcdc_freq(bool pll, unsigned freq)
|
||||
{
|
||||
HW_POWER_MISC &= ~(HW_POWER_MISC__SEL_PLLCLK | HW_POWER_MISC__FREQSEL_BM);
|
||||
/* WARNING: HW_POWER_MISC does have a SET/CLR variant ! */
|
||||
if(pll)
|
||||
{
|
||||
HW_POWER_MISC |= freq << HW_POWER_MISC__FREQSEL_BP;
|
||||
HW_POWER_MISC |= HW_POWER_MISC__SEL_PLLCLK;
|
||||
}
|
||||
}
|
||||
|
||||
struct imx233_power_info_t
|
||||
{
|
||||
int vddd; /* in mV */
|
||||
|
|
|
|||
|
|
@ -25,13 +25,31 @@
|
|||
#include "audioout-imx233.h"
|
||||
#include "audioin-imx233.h"
|
||||
|
||||
static int input_source = AUDIO_SRC_PLAYBACK;
|
||||
static unsigned input_flags = 0;
|
||||
static int output_source = AUDIO_SRC_PLAYBACK;
|
||||
|
||||
static void select_audio_path(void)
|
||||
{
|
||||
if(input_source == AUDIO_SRC_PLAYBACK)
|
||||
imx233_audiout_select_hp_input(false);
|
||||
else
|
||||
imx233_audiout_select_hp_input(true);
|
||||
}
|
||||
|
||||
void audio_input_mux(int source, unsigned flags)
|
||||
{
|
||||
(void) source;
|
||||
(void) flags;
|
||||
input_source = source;
|
||||
input_flags = flags;
|
||||
select_audio_path();
|
||||
}
|
||||
|
||||
|
||||
void audio_set_output_source(int source)
|
||||
{
|
||||
(void) source;
|
||||
output_source = source;
|
||||
select_audio_path();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "lcd.h"
|
||||
#include "string.h"
|
||||
#include "usb.h"
|
||||
#include "power-imx233.h"
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "tuner.h"
|
||||
#include "fmradio_i2c.h"
|
||||
#include "pinctrl-imx233.h"
|
||||
#include "power-imx233.h"
|
||||
|
||||
static bool tuner_enable = false;
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ bool tuner_power(bool enable)
|
|||
imx233_enable_gpio_output(0, 29, enable);
|
||||
imx233_set_gpio_output(0, 29, enable);
|
||||
tuner_enable = enable;
|
||||
//imx233_power_set_dcdc_freq(enable, HW_POWER_MISC__FREQSEL__24MHz);
|
||||
}
|
||||
return tuner_enable;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,8 @@
|
|||
#include "system-arm.h"
|
||||
#include "mmu-arm.h"
|
||||
#include "panic.h"
|
||||
|
||||
#include "clock-target.h" /* CPUFREQ_* are defined here */
|
||||
#include "clkctrl-imx233.h"
|
||||
#include "power-imx233.h"
|
||||
#include "clock-target.h" /* CPUFREQ_* are defined here */
|
||||
|
||||
/* Digital control */
|
||||
#define HW_DIGCTL_BASE 0x8001C000
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "system.h"
|
||||
#include "system-target.h"
|
||||
#include "clkctrl-imx233.h"
|
||||
|
||||
#include "power-imx233.h"
|
||||
|
||||
void usb_insert_int(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue