zenxfi3&stfm1000: implement fmradio i2c and debug screen
Change-Id: I83dbdee13185d9adcf590dc213da5a8c97adb2ba
This commit is contained in:
parent
4f5efac9e5
commit
e401683482
6 changed files with 88 additions and 1 deletions
|
@ -1867,6 +1867,15 @@ static int radio_callback(int btn, struct gui_synclist *lists)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* RDA55802 */
|
#endif /* RDA55802 */
|
||||||
|
#if (CONFIG_TUNER & STFM1000)
|
||||||
|
IF_TUNER_TYPE(STFM1000)
|
||||||
|
{
|
||||||
|
struct stfm1000_dbg_info nfo;
|
||||||
|
stfm1000_dbg_info(&nfo);
|
||||||
|
simplelist_addline(SIMPLELIST_ADD_LINE, "STFM1000 regs:");
|
||||||
|
simplelist_addline(SIMPLELIST_ADD_LINE,"chipid: 0x%x", nfo.chipid);
|
||||||
|
}
|
||||||
|
#endif /* STFM1000 */
|
||||||
|
|
||||||
#ifdef HAVE_RDS_CAP
|
#ifdef HAVE_RDS_CAP
|
||||||
simplelist_addline(SIMPLELIST_ADD_LINE, "PI:%04X PS:'%8s'",
|
simplelist_addline(SIMPLELIST_ADD_LINE, "PI:%04X PS:'%8s'",
|
||||||
|
|
|
@ -1146,6 +1146,7 @@ target/arm/imx233/creative-zenxfi2/audio-zenxfi2.c
|
||||||
|
|
||||||
#ifdef CREATIVE_ZENXFI3
|
#ifdef CREATIVE_ZENXFI3
|
||||||
drivers/mpr121.c
|
drivers/mpr121.c
|
||||||
|
target/arm/imx233/creative-zenxfi3/fmradio-i2c-zenxfi3.c
|
||||||
target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c
|
target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c
|
||||||
target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
|
target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
|
||||||
target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
|
target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
|
||||||
|
|
|
@ -31,6 +31,36 @@
|
||||||
#include "fmradio_i2c.h" /* physical interface driver */
|
#include "fmradio_i2c.h" /* physical interface driver */
|
||||||
#include "stfm1000.h"
|
#include "stfm1000.h"
|
||||||
|
|
||||||
|
#define STFM100_I2C_ADDR 0xc0
|
||||||
|
|
||||||
|
#define CHIPID 0x80
|
||||||
|
|
||||||
|
static int stfm1000_read_reg(uint8_t reg, uint32_t *val)
|
||||||
|
{
|
||||||
|
uint8_t buf[4];
|
||||||
|
buf[0] = reg;
|
||||||
|
int ret = fmradio_i2c_write(STFM100_I2C_ADDR, buf, 1);
|
||||||
|
if(ret < 0) return ret;
|
||||||
|
ret = fmradio_i2c_read(STFM100_I2C_ADDR, buf, 4);
|
||||||
|
*val = buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stfm1000_write_reg(uint8_t reg, uint32_t val)
|
||||||
|
{
|
||||||
|
uint8_t buf[5];
|
||||||
|
buf[0] = reg;
|
||||||
|
buf[1] = val & 0xff; buf[2] = (val >> 8) & 0xff;
|
||||||
|
buf[3] = (val >> 16) & 0xff; buf[4] = (val >> 24) & 0xff;
|
||||||
|
return fmradio_i2c_write(STFM100_I2C_ADDR, buf, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void stfm1000_dbg_info(struct stfm1000_dbg_info *nfo)
|
||||||
|
{
|
||||||
|
memset(nfo, 0, sizeof(struct stfm1000_dbg_info));
|
||||||
|
stfm1000_read_reg(CHIPID, &nfo->chipid);
|
||||||
|
}
|
||||||
|
|
||||||
void stfm1000_init(void)
|
void stfm1000_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,16 @@
|
||||||
#define HAVE_RADIO_REGION
|
#define HAVE_RADIO_REGION
|
||||||
#define HAVE_RADIO_RSSI
|
#define HAVE_RADIO_RSSI
|
||||||
|
|
||||||
|
struct stfm1000_dbg_info
|
||||||
|
{
|
||||||
|
uint32_t chipid;
|
||||||
|
};
|
||||||
|
|
||||||
bool stfm1000_detect(void);
|
bool stfm1000_detect(void);
|
||||||
void stfm1000_init(void);
|
void stfm1000_init(void);
|
||||||
int stfm1000_set(int setting, int value);
|
int stfm1000_set(int setting, int value);
|
||||||
int stfm1000_get(int setting);
|
int stfm1000_get(int setting);
|
||||||
|
void stfm1000_dbg_info(struct stfm1000_dbg_info *nfo);
|
||||||
|
|
||||||
#ifndef CONFIG_TUNER_MULTI
|
#ifndef CONFIG_TUNER_MULTI
|
||||||
#define tuner_set stfm1000_set
|
#define tuner_set stfm1000_set
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 by Amaury Pouly
|
||||||
|
*
|
||||||
|
* 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 "config.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "fmradio_i2c.h"
|
||||||
|
#include "pinctrl-imx233.h"
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
void fmradio_i2c_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
|
||||||
|
{
|
||||||
|
return i2c_write(address, buf, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
|
||||||
|
{
|
||||||
|
return i2c_read(address, buf, count);
|
||||||
|
}
|
|
@ -110,7 +110,8 @@ void system_init(void)
|
||||||
imx233_pwm_init();
|
imx233_pwm_init();
|
||||||
imx233_lradc_init();
|
imx233_lradc_init();
|
||||||
imx233_i2c_init();
|
imx233_i2c_init();
|
||||||
#if defined(SANSA_FUZEPLUS) && !defined(BOOTLOADER)
|
#if !defined(BOOTLOADER) && \
|
||||||
|
(defined(SANSA_FUZEPLUS) || defined(CREATIVE_ZENXFI3))
|
||||||
fmradio_i2c_init();
|
fmradio_i2c_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue