summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/power-imx233.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-16 20:57:39 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-17 00:29:25 +0200
commit239219ee70aa02a324fb94b6e463781c5c77beea (patch)
tree4429c2056a5ddd90173a8e132718a2c62019f8d9 /firmware/target/arm/imx233/power-imx233.h
parent2d0d752bf8aed6bf91cdabd0d4571f336e7370eb (diff)
downloadrockbox-239219ee70aa02a324fb94b6e463781c5c77beea.tar.gz
rockbox-239219ee70aa02a324fb94b6e463781c5c77beea.tar.bz2
rockbox-239219ee70aa02a324fb94b6e463781c5c77beea.zip
imx233: fix power for stmp3600 and stmp3700
There are many small differences between them. In particular some regulators are not available on stmp3600. Also the vbusvalid detect method is not available as an irq on stmp3600 and seems broken on stmp3700. Finally die temperature is handled by the power block on stmp3600. Change-Id: I2c68b418738f15564e445d3a1496018cef97fff7
Diffstat (limited to 'firmware/target/arm/imx233/power-imx233.h')
-rw-r--r--firmware/target/arm/imx233/power-imx233.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/firmware/target/arm/imx233/power-imx233.h b/firmware/target/arm/imx233/power-imx233.h
index e6bd02525b..d33ca20333 100644
--- a/firmware/target/arm/imx233/power-imx233.h
+++ b/firmware/target/arm/imx233/power-imx233.h
@@ -34,6 +34,7 @@
#define BV_POWER_5VCTRL_CHARGE_4P2_ILIMIT__200mA (1 << 4)
#define BV_POWER_5VCTRL_CHARGE_4P2_ILIMIT__400mA (1 << 5)
+
#define BV_POWER_CHARGE_BATTCHRG_I__10mA (1 << 0)
#define BV_POWER_CHARGE_BATTCHRG_I__20mA (1 << 1)
#define BV_POWER_CHARGE_BATTCHRG_I__50mA (1 << 2)
@@ -46,6 +47,7 @@
#define BV_POWER_CHARGE_STOP_ILIMIT__50mA (1 << 2)
#define BV_POWER_CHARGE_STOP_ILIMIT__100mA (1 << 3)
+#if IMX233_SUBTARGET >= 3700
#define HW_POWER_VDDDCTRL__TRG_STEP 25 /* mV */
#define HW_POWER_VDDDCTRL__TRG_MIN 800 /* mV */
@@ -57,6 +59,13 @@
#define HW_POWER_VDDMEMCTRL__TRG_STEP 50 /* mV */
#define HW_POWER_VDDMEMCTRL__TRG_MIN 1700 /* mV */
+#else
+/* don't use the full available range because of the weird encodings for
+ * extreme values which are useless anyway */
+#define HW_POWER_VDDDCTRL__TRG_STEP 32 /* mV */
+#define HW_POWER_VDDDCTRL__TRG_MIN 1280 /* mV */
+#define HW_POWER_VDDDCTRL__TRG_OFF 8 /* below 8, the register value doesn't encode linearly */
+#endif
#define BV_POWER_MISC_FREQSEL__RES 0
#define BV_POWER_MISC_FREQSEL__20MHz 1
@@ -67,6 +76,7 @@
#define BV_POWER_MISC_FREQSEL__21p6MHz 6
#define BV_POWER_MISC_FREQSEL__17p28MHz 7
+
void imx233_power_init(void);
void imx233_power_set_charge_current(unsigned current); /* in mA */
@@ -75,10 +85,12 @@ void imx233_power_enable_batadj(bool enable);
enum imx233_regulator_t
{
- REGULATOR_VDDD, /* target, brownout, linreg, linreg offset */
+ REGULATOR_VDDD, /* target, brownout, linreg[3700+], linreg offset[3700+] */
+#if IMX233_SUBTARGET >= 3700
REGULATOR_VDDA, /* target, brownout, linreg, linreg offset */
REGULATOR_VDDIO, /* target, brownout, linreg offset */
REGULATOR_VDDMEM, /* target, linreg */
+#endif
REGULATOR_COUNT,
};
@@ -97,12 +109,19 @@ void imx233_power_get_regulator_linreg(enum imx233_regulator_t reg,
void imx233_power_set_regulator_linreg(enum imx233_regulator_t reg,
bool enabled, int linreg_offset);
+#if IMX233_SUBTARGET >= 3700
static inline void imx233_power_set_dcdc_freq(bool pll, unsigned freq)
{
if(pll)
BF_WR(POWER_MISC, FREQSEL, freq);
BF_WR(POWER_MISC, SEL_PLLCLK, pll);
}
+#endif
+
+#if IMX233_SUBTARGET < 3700
+/* return -1 on error */
+int imx233_power_sense_die_temperature(int *min, int *max);
+#endif
struct imx233_power_info_t
{