mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Power management is to be kept in target tree due to being target specific.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31136 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
de712eebbd
commit
2ee9facc11
4 changed files with 26 additions and 94 deletions
|
@ -1118,7 +1118,6 @@ target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
|
|||
|
||||
#ifdef SANSA_CONNECT
|
||||
#ifndef SIMULATOR
|
||||
drivers/tps65021.c
|
||||
target/arm/mmu-arm.S
|
||||
target/arm/lcd-as-memframe.S
|
||||
target/arm/tms320dm320/sdmmc-dm320.c
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: $
|
||||
*
|
||||
* Driver for TPS 65021 Power Management IC
|
||||
*
|
||||
* Copyright (c) 2011 Tomasz Moń
|
||||
*
|
||||
* 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 "system.h"
|
||||
#include "config.h"
|
||||
#if CONFIG_I2C == I2C_DM320
|
||||
#include "i2c-dm320.h"
|
||||
#endif
|
||||
#include "logf.h"
|
||||
#include "tps65021.h"
|
||||
|
||||
/* (7-bit) address is 0x48, the LSB is read/write flag */
|
||||
#define TPS65021_ADDR (0x48 << 1)
|
||||
|
||||
static void tps65021_write_reg(unsigned reg, unsigned value)
|
||||
{
|
||||
unsigned char data[2];
|
||||
|
||||
data[0] = reg;
|
||||
data[1] = value;
|
||||
|
||||
#if CONFIG_I2C == I2C_DM320
|
||||
if (i2c_write(TPS65021_ADDR, data, 2) != 0)
|
||||
#else
|
||||
#warning Implement tps65021_write_reg()
|
||||
#endif
|
||||
{
|
||||
logf("TPS65021 error reg=0x%x", reg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void tps65021_init(void)
|
||||
{
|
||||
#ifdef SANSA_CONNECT
|
||||
/* PWM mode */
|
||||
tps65021_write_reg(0x04, 0xB2);
|
||||
|
||||
/* Set core voltage to 1.5V */
|
||||
tps65021_write_reg(0x06, 0x1C);
|
||||
|
||||
/* Set LCM (LDO1) to 2.85V, Set CODEC and USB (LDO2) to 1.8V */
|
||||
tps65021_write_reg(0x08, 0x36);
|
||||
#endif
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: $
|
||||
*
|
||||
* Copyright (C) 2011 by Tomasz Moń
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef TPS65021_H
|
||||
#define TPS65021_H
|
||||
|
||||
void tps65021_init(void);
|
||||
|
||||
#endif
|
|
@ -28,11 +28,35 @@
|
|||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
#include "avr-sansaconnect.h"
|
||||
#include "tps65021.h"
|
||||
#include "i2c-dm320.h"
|
||||
#include "logf.h"
|
||||
|
||||
/* (7-bit) address is 0x48, the LSB is read/write flag */
|
||||
#define TPS65021_ADDR (0x48 << 1)
|
||||
|
||||
static void tps65021_write_reg(unsigned reg, unsigned value)
|
||||
{
|
||||
unsigned char data[2];
|
||||
|
||||
data[0] = reg;
|
||||
data[1] = value;
|
||||
|
||||
if (i2c_write(TPS65021_ADDR, data, 2) != 0)
|
||||
{
|
||||
logf("TPS65021 error reg=0x%x", reg);
|
||||
}
|
||||
}
|
||||
|
||||
void power_init(void)
|
||||
{
|
||||
tps65021_init();
|
||||
/* PWM mode */
|
||||
tps65021_write_reg(0x04, 0xB2);
|
||||
|
||||
/* Set core voltage to 1.5V */
|
||||
tps65021_write_reg(0x06, 0x1C);
|
||||
|
||||
/* Set LCM (LDO1) to 2.85V, Set CODEC and USB (LDO2) to 1.8V */
|
||||
tps65021_write_reg(0x08, 0x36);
|
||||
}
|
||||
|
||||
void power_off(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue