rockbox/firmware/target/arm/as3525/power-as3525.c
Rafaël Carré 88c55d7290 as3514/as3543 fixes
- Enable end of charge monitoring once, it doesn't need to be disabled
- Acknowledge the first (wrong) end of charge interrupt on charger enable
  (this had been broken in r25299)
- Centralize reads to ENRD* registers and cache the results when needed
    - on PP it is not needed because reads are atomic, we only check for
      end of charge when the charging, and for charger presence when
      discharging

as3525v2 (using as3543) specifics
- I got the datasheet today from AMS, thanks to them for being so fast
  and not require me to sign tons of papers!
- USB detection now works on as3525v2 using the as3543. Clip+ won't
  reboot to OF yet, it needs mkamsboot support first (usbstack disabled)
- Charging should work, the CHARGER register is at a different place, it
  is an extended PMU register -> use ascodec_read/write_charger() to
  access it
- real interrupts are not used yet for ENRD, we get thousands of
  interrupts per second, apparently only limited by the i2c clock.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26116 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 20:53:25 +00:00

67 lines
1.7 KiB
C

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright © 2008 Rafaël Carré
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <stdbool.h>
#include "config.h"
#include "ascodec-target.h"
#include "as3514.h"
#include "power.h"
void power_off(void)
{
/* clear bit 0 of system register */
ascodec_write(AS3514_SYSTEM, ascodec_read(AS3514_SYSTEM) & ~1);
/* TODO : turn off peripherals properly ? */
while(1); /* wait for system to shut down */
}
void power_init(void)
{
}
#if CONFIG_CHARGING
unsigned int power_input_status(void)
{
return ascodec_chg_status() ?
POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
/* TODO: Handle USB and other sources properly */
}
#endif /* CONFIG_CHARGING */
void ide_power_enable(bool on)
{
(void)on;
}
#if CONFIG_TUNER
bool tuner_power(bool status)
{
(void) status;
return true;
}
bool tuner_powered(void)
{
return true;
}
#endif