mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Abstract the PortalPlayer AS3514 handling with an "ascodec" API - inspired by the wmcodec API used with the Wolfson codecs. The intention is to implement this API for the AS3525 and then share code with the Sansa V2 ports.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18940 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
324816f019
commit
42f77d4eb0
15 changed files with 196 additions and 61 deletions
|
@ -103,7 +103,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
|
#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1228,7 +1228,9 @@ bool dbg_ports(void)
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
|
snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, AS3514_CHARGER), i2c_readbyte(AS3514_I2C_ADDR, AS3514_IRQ_ENRD0));
|
snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X",
|
||||||
|
ascodec_read(AS3514_CHARGER),
|
||||||
|
ascodec_read(AS3514_IRQ_ENRD0));
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -460,6 +460,7 @@ target/arm/lcd-as-memframe.S
|
||||||
target/arm/ata-sd-pp.c
|
target/arm/ata-sd-pp.c
|
||||||
target/arm/sandisk/sansa-e200/lcd-e200.c
|
target/arm/sandisk/sansa-e200/lcd-e200.c
|
||||||
target/arm/adc-as3514.c
|
target/arm/adc-as3514.c
|
||||||
|
target/arm/ascodec-pp.c
|
||||||
target/arm/sandisk/backlight-c200_e200.c
|
target/arm/sandisk/backlight-c200_e200.c
|
||||||
target/arm/usb-fw-pp502x.c
|
target/arm/usb-fw-pp502x.c
|
||||||
target/arm/sandisk/sansa-e200/button-e200.c
|
target/arm/sandisk/sansa-e200/button-e200.c
|
||||||
|
@ -478,6 +479,7 @@ target/arm/ata-sd-pp.c
|
||||||
target/arm/sandisk/sansa-c200/lcd-c200.c
|
target/arm/sandisk/sansa-c200/lcd-c200.c
|
||||||
target/arm/sandisk/sansa-c200/lcd-as-c200.S
|
target/arm/sandisk/sansa-c200/lcd-as-c200.S
|
||||||
target/arm/adc-as3514.c
|
target/arm/adc-as3514.c
|
||||||
|
target/arm/ascodec-pp.c
|
||||||
target/arm/sandisk/backlight-c200_e200.c
|
target/arm/sandisk/backlight-c200_e200.c
|
||||||
target/arm/usb-fw-pp502x.c
|
target/arm/usb-fw-pp502x.c
|
||||||
target/arm/sandisk/sansa-c200/button-c200.c
|
target/arm/sandisk/sansa-c200/button-c200.c
|
||||||
|
@ -495,6 +497,7 @@ target/arm/sandisk/audio-c200_e200.c
|
||||||
target/arm/ata-sd-pp.c
|
target/arm/ata-sd-pp.c
|
||||||
target/arm/philips/sa9200/lcd-sa9200.c
|
target/arm/philips/sa9200/lcd-sa9200.c
|
||||||
target/arm/adc-as3514.c
|
target/arm/adc-as3514.c
|
||||||
|
target/arm/ascodec-pp.c
|
||||||
target/arm/philips/sa9200/backlight-sa9200.c
|
target/arm/philips/sa9200/backlight-sa9200.c
|
||||||
target/arm/usb-fw-pp502x.c
|
target/arm/usb-fw-pp502x.c
|
||||||
target/arm/philips/sa9200/button-sa9200.c
|
target/arm/philips/sa9200/button-sa9200.c
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include "audiohw.h"
|
#include "audiohw.h"
|
||||||
#include "i2s.h"
|
#include "i2s.h"
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
|
|
||||||
const struct sound_settings_info audiohw_settings[] = {
|
const struct sound_settings_info audiohw_settings[] = {
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
|
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
|
||||||
|
@ -71,7 +71,7 @@ static unsigned int source = SOURCE_DAC;
|
||||||
*/
|
*/
|
||||||
static void as3514_write(unsigned int reg, unsigned int value)
|
static void as3514_write(unsigned int reg, unsigned int value)
|
||||||
{
|
{
|
||||||
if (pp_i2c_send(AS3514_I2C_ADDR, reg, value) != 2)
|
if (ascodec_write(reg, value) != 2)
|
||||||
{
|
{
|
||||||
DEBUGF("as3514 error reg=0x%02x", reg);
|
DEBUGF("as3514 error reg=0x%02x", reg);
|
||||||
}
|
}
|
||||||
|
@ -135,36 +135,10 @@ int sound_val2phys(int setting, int value)
|
||||||
/*
|
/*
|
||||||
* Initialise the PP I2C and I2S.
|
* Initialise the PP I2C and I2S.
|
||||||
*/
|
*/
|
||||||
void audiohw_init(void)
|
void audiohw_preinit(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* normal outputs for CDI and I2S pin groups */
|
|
||||||
DEV_INIT2 &= ~0x300;
|
|
||||||
|
|
||||||
/*mini2?*/
|
|
||||||
DEV_INIT1 &=~0x3000000;
|
|
||||||
/*mini2?*/
|
|
||||||
|
|
||||||
/* device reset */
|
|
||||||
DEV_RS |= DEV_I2S;
|
|
||||||
DEV_RS &=~DEV_I2S;
|
|
||||||
|
|
||||||
/* I2S device reset */
|
|
||||||
DEV_RS |= DEV_I2S;
|
|
||||||
DEV_RS &=~DEV_I2S;
|
|
||||||
|
|
||||||
/* I2S device enable */
|
|
||||||
DEV_EN |= DEV_I2S;
|
|
||||||
|
|
||||||
/* enable external dev clock clocks */
|
|
||||||
DEV_EN |= DEV_EXTCLOCKS;
|
|
||||||
|
|
||||||
/* external dev clock to 24MHz */
|
|
||||||
outl(inl(0x70000018) & ~0xc, 0x70000018);
|
|
||||||
|
|
||||||
i2s_reset();
|
|
||||||
|
|
||||||
/* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
|
/* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
|
||||||
|
|
||||||
/* Turn on SUM, DAC */
|
/* Turn on SUM, DAC */
|
||||||
|
@ -199,14 +173,10 @@ void audiohw_init(void)
|
||||||
/* read all reg values */
|
/* read all reg values */
|
||||||
for (i = 0; i < ARRAYLEN(as3514.regs); i++)
|
for (i = 0; i < ARRAYLEN(as3514.regs); i++)
|
||||||
{
|
{
|
||||||
as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i);
|
as3514.regs[i] = ascodec_read(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_postinit(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Silently enable / disable audio output */
|
/* Silently enable / disable audio output */
|
||||||
void audiohw_enable_output(bool enable)
|
void audiohw_enable_output(bool enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "i2c-pp.h"
|
#include "i2c-pp.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
#include "ascodec.h"
|
||||||
|
|
||||||
#define MINUTE_SECONDS 60
|
#define MINUTE_SECONDS 60
|
||||||
#define HOUR_SECONDS 3600
|
#define HOUR_SECONDS 3600
|
||||||
|
@ -57,7 +58,7 @@ int rtc_read_datetime(unsigned char* buf)
|
||||||
|
|
||||||
/* RTC_AS3514's slave address is 0x46*/
|
/* RTC_AS3514's slave address is 0x46*/
|
||||||
for (i=0;i<4;i++){
|
for (i=0;i<4;i++){
|
||||||
tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i);
|
tmp[i] = ascodec_read(AS3514_RTC_0 + i);
|
||||||
}
|
}
|
||||||
seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24);
|
seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24);
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ int rtc_write_datetime(unsigned char* buf)
|
||||||
|
|
||||||
/* Send data to RTC */
|
/* Send data to RTC */
|
||||||
for (i=0;i<4;i++){
|
for (i=0;i<4;i++){
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff));
|
ascodec_write(AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff));
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,4 @@ extern void audiohw_set_sample_rate(int sampling_control);
|
||||||
#define VOLUME_MIN -735
|
#define VOLUME_MIN -735
|
||||||
#define VOLUME_MAX 60
|
#define VOLUME_MAX 60
|
||||||
|
|
||||||
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
|
|
||||||
#define AS3514_I2C_ADDR 0x46
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _AS3514_H */
|
#endif /* _AS3514_H */
|
||||||
|
|
27
firmware/export/ascodec.h
Normal file
27
firmware/export/ascodec.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 by Dave Chapman
|
||||||
|
*
|
||||||
|
* 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 _ASCODEC_H
|
||||||
|
#define _ASCODEC_H
|
||||||
|
|
||||||
|
#include "ascodec-target.h"
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,7 +20,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
|
||||||
/* Read 10-bit channel data */
|
/* Read 10-bit channel data */
|
||||||
|
@ -30,21 +30,21 @@ unsigned short adc_read(int channel)
|
||||||
|
|
||||||
if ((unsigned)channel < NUM_ADC_CHANNELS)
|
if ((unsigned)channel < NUM_ADC_CHANNELS)
|
||||||
{
|
{
|
||||||
i2c_lock();
|
ascodec_lock();
|
||||||
|
|
||||||
/* Select channel */
|
/* Select channel */
|
||||||
if (pp_i2c_send( AS3514_I2C_ADDR, AS3514_ADC_0, (channel << 4)) >= 0)
|
if (ascodec_write(AS3514_ADC_0, (channel << 4)) >= 0)
|
||||||
{
|
{
|
||||||
unsigned char buf[2];
|
unsigned char buf[2];
|
||||||
|
|
||||||
/* Read data */
|
/* Read data */
|
||||||
if (i2c_readbytes( AS3514_I2C_ADDR, AS3514_ADC_0, 2, buf) >= 0)
|
if (ascodec_readbytes(AS3514_ADC_0, 2, buf) >= 0)
|
||||||
{
|
{
|
||||||
data = (((buf[0] & 0x3) << 8) | buf[1]);
|
data = (((buf[0] & 0x3) << 8) | buf[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i2c_unlock();
|
ascodec_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
66
firmware/target/arm/ascodec-pp.c
Normal file
66
firmware/target/arm/ascodec-pp.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Driver for AS3514 audio codec
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007 Daniel Ankers
|
||||||
|
* Copyright (c) 2007 Christian Gmeiner
|
||||||
|
*
|
||||||
|
* 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 "cpu.h"
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
#include "i2s.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise the PP I2C and I2S.
|
||||||
|
*/
|
||||||
|
void audiohw_init(void)
|
||||||
|
{
|
||||||
|
/* normal outputs for CDI and I2S pin groups */
|
||||||
|
DEV_INIT2 &= ~0x300;
|
||||||
|
|
||||||
|
/*mini2?*/
|
||||||
|
DEV_INIT1 &=~0x3000000;
|
||||||
|
/*mini2?*/
|
||||||
|
|
||||||
|
/* device reset */
|
||||||
|
DEV_RS |= DEV_I2S;
|
||||||
|
DEV_RS &=~DEV_I2S;
|
||||||
|
|
||||||
|
/* I2S device reset */
|
||||||
|
DEV_RS |= DEV_I2S;
|
||||||
|
DEV_RS &=~DEV_I2S;
|
||||||
|
|
||||||
|
/* I2S device enable */
|
||||||
|
DEV_EN |= DEV_I2S;
|
||||||
|
|
||||||
|
/* enable external dev clock clocks */
|
||||||
|
DEV_EN |= DEV_EXTCLOCKS;
|
||||||
|
|
||||||
|
/* external dev clock to 24MHz */
|
||||||
|
outl(inl(0x70000018) & ~0xc, 0x70000018);
|
||||||
|
|
||||||
|
i2s_reset();
|
||||||
|
|
||||||
|
audiohw_preinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_postinit(void)
|
||||||
|
{
|
||||||
|
}
|
69
firmware/target/arm/ascodec-target.h
Normal file
69
firmware/target/arm/ascodec-target.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Driver for AS3514 audio codec
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007 Daniel Ankers
|
||||||
|
* Copyright (c) 2007 Christian Gmeiner
|
||||||
|
*
|
||||||
|
* 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 _ASCODEC_TARGET_H
|
||||||
|
#define _ASCODEC_TARGET_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef CPU_PP
|
||||||
|
/* TODO: This header is actually portalplayer specific, and should be
|
||||||
|
* moved into an appropriate subdir */
|
||||||
|
|
||||||
|
#include "i2c-pp.h"
|
||||||
|
|
||||||
|
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
|
||||||
|
#define AS3514_I2C_ADDR 0x46
|
||||||
|
#else
|
||||||
|
#error Unknown target!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int ascodec_write(unsigned int reg, unsigned int value)
|
||||||
|
{
|
||||||
|
return pp_i2c_send(AS3514_I2C_ADDR, reg, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ascodec_read(unsigned int reg)
|
||||||
|
{
|
||||||
|
return i2c_readbyte(AS3514_I2C_ADDR, reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ascodec_readbytes(int addr, int len, unsigned char *data)
|
||||||
|
{
|
||||||
|
return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void ascodec_lock(void)
|
||||||
|
{
|
||||||
|
i2c_lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void ascodec_unlock(void)
|
||||||
|
{
|
||||||
|
i2c_unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CPU_PP */
|
||||||
|
|
||||||
|
#endif /* !_ASCODEC_TARGET_H */
|
|
@ -32,6 +32,7 @@
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "i2c-pp.h"
|
#include "i2c-pp.h"
|
||||||
|
#include "ascodec.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
|
||||||
/* Local functions definitions */
|
/* Local functions definitions */
|
||||||
|
@ -230,7 +231,7 @@ void i2c_init(void)
|
||||||
outl(0, 0x600060a4);
|
outl(0, 0x600060a4);
|
||||||
outl(0x1e, 0x600060a4);
|
outl(0x1e, 0x600060a4);
|
||||||
|
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_SUPERVISOR, 5);
|
ascodec_write(AS3514_SUPERVISOR, 5);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
|
||||||
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
||||||
|
@ -46,12 +46,12 @@ void _backlight_on(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness);
|
ascodec_write(AS3514_DCDC15, backlight_brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _backlight_off(void)
|
void _backlight_off(void)
|
||||||
{
|
{
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0);
|
ascodec_write(AS3514_DCDC15, 0x0);
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,9 +36,9 @@ void power_off(void)
|
||||||
char byte;
|
char byte;
|
||||||
|
|
||||||
/* Send shutdown command to PMU */
|
/* Send shutdown command to PMU */
|
||||||
byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM);
|
byte = ascodec_read(AS3514_SYSTEM);
|
||||||
byte &= ~0x1;
|
byte &= ~0x1;
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte);
|
ascodec_write(AS3514_SYSTEM, byte);
|
||||||
|
|
||||||
/* Stop interrupts on both cores */
|
/* Stop interrupts on both cores */
|
||||||
disable_interrupt(IRQ_FIQ_STATUS);
|
disable_interrupt(IRQ_FIQ_STATUS);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
|
||||||
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
||||||
|
@ -46,12 +46,12 @@ void _backlight_on(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness);
|
ascodec_write(AS3514_DCDC15, backlight_brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _backlight_off(void)
|
void _backlight_off(void)
|
||||||
{
|
{
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0);
|
ascodec_write(AS3514_DCDC15, 0x0);
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
#include "tuner.h"
|
#include "tuner.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
@ -36,9 +36,9 @@ void power_off(void)
|
||||||
char byte;
|
char byte;
|
||||||
|
|
||||||
/* Send shutdown command to PMU */
|
/* Send shutdown command to PMU */
|
||||||
byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM);
|
byte = ascodec_read(AS3514_SYSTEM);
|
||||||
byte &= ~0x1;
|
byte &= ~0x1;
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte);
|
ascodec_write(AS3514_SYSTEM, byte);
|
||||||
|
|
||||||
/* Stop interrupts on both cores */
|
/* Stop interrupts on both cores */
|
||||||
disable_interrupt(IRQ_FIQ_STATUS);
|
disable_interrupt(IRQ_FIQ_STATUS);
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
/* TODO: Move target-specific stuff somewhere else (serial number reading) */
|
/* TODO: Move target-specific stuff somewhere else (serial number reading) */
|
||||||
|
|
||||||
#ifdef HAVE_AS3514
|
#ifdef HAVE_AS3514
|
||||||
#include "i2c-pp.h"
|
#include "ascodec.h"
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ static void set_serial_descriptor(void)
|
||||||
short* p = &usb_string_iSerial.wString[1];
|
short* p = &usb_string_iSerial.wString[1];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i2c_readbytes(AS3514_I2C_ADDR, AS3514_UID_0, 0x10, serial);
|
ascodec_readbytes(AS3514_UID_0, 0x10, serial);
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
*p++ = hex[(serial[i] >> 4) & 0xF];
|
*p++ = hex[(serial[i] >> 4) & 0xF];
|
||||||
*p++ = hex[(serial[i] >> 0) & 0xF];
|
*p++ = hex[(serial[i] >> 0) & 0xF];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue