summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/ascodec-target.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/ascodec-target.h b/firmware/target/arm/as3525/ascodec-target.h
index 2bc99ab7e7..37947541c2 100644
--- a/firmware/target/arm/as3525/ascodec-target.h
+++ b/firmware/target/arm/as3525/ascodec-target.h
@@ -30,6 +30,7 @@
#include "as3514.h"
#include "kernel.h" /* for struct wakeup */
#include "clock-target.h" /* for AS3525_I2C_PRESCALER */
+#include "system-arm.h"
/* Charge Pump and Power management Settings */
#define AS314_CP_DCDC3_SETTING \
@@ -77,8 +78,12 @@ int ascodec_write(unsigned int index, unsigned int value);
static inline void ascodec_write_pmu(unsigned int index, unsigned int subreg,
unsigned int value)
{
+ /* we disable interrupts to make sure no operation happen on the i2c bus
+ * between selecting the sub register and writing to it */
+ int oldstatus = disable_irq_save();
ascodec_write(AS3543_PMU_ENABLE, 8|subreg);
ascodec_write(index, value);
+ restore_irq(oldstatus);
}
#endif