mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
erosqnative hw1/hw2: Check for DAC in bootloader
Check for the ES9018K2M dac in the bootloader for hw1/hw2 devices. Assume that all devices newer than hw2 have ES9018K2M DAC unconditionally. All devices will now report the correct hw revision in the debug menu under Device Data. Add devicedata.version field, current version 0. Rename device_data.lcd_version to device_data.hw_rev. hw2 devices with older bootloaders which ID as hw1 are special- cased to keep using hwvol on them. They should still upgrade though. Change-Id: If0fd5ce3bc6e85e511047721ec18e42fb89312e7
This commit is contained in:
parent
f895167345
commit
adbd0125fd
13 changed files with 110 additions and 38 deletions
|
|
@ -24,15 +24,22 @@
|
|||
#include "config.h"
|
||||
#include "audio.h"
|
||||
#include "audiohw.h"
|
||||
#ifndef BOOTLOADER
|
||||
#include "settings.h"
|
||||
#endif
|
||||
#include "pcm_sw_volume.h"
|
||||
|
||||
#include "gpio-x1000.h"
|
||||
// #define LOGF_ENABLE
|
||||
#include "logf.h"
|
||||
|
||||
#include "gpio-x1000.h"
|
||||
#include "i2c-x1000.h"
|
||||
|
||||
static long int vol_l_hw = PCM5102A_VOLUME_MIN;
|
||||
static long int vol_r_hw = PCM5102A_VOLUME_MIN;
|
||||
int es9018k2m_present_flag = 0;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
static long int vol_l_hw = PCM5102A_VOLUME_MIN;
|
||||
static long int vol_r_hw = PCM5102A_VOLUME_MIN;
|
||||
void eros_qn_set_outputs(void)
|
||||
{
|
||||
audiohw_set_volume(vol_l_hw, vol_r_hw);
|
||||
|
|
@ -63,4 +70,33 @@ void eros_qn_switch_output(int select)
|
|||
{
|
||||
gpio_set_level(GPIO_STEREOSW_SEL, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !defined(BOOTLOADER) */
|
||||
|
||||
bool eros_qn_discover_dac(bool pwr_after_discovery)
|
||||
{
|
||||
i2c_x1000_set_freq(ES9018K2M_BUS, I2C_FREQ_400K);
|
||||
gpio_set_level(GPIO_DAC_PWR, 1);
|
||||
gpio_set_level(GPIO_DAC_ANALOG_PWR, 1);
|
||||
mdelay(10);
|
||||
int ret = es9018k2m_read_reg(ES9018K2M_REG0_SYSTEM_SETTINGS);
|
||||
if (ret == 0)
|
||||
{
|
||||
es9018k2m_present_flag = 1;
|
||||
logf("ES9018K2M found! ret=%d", ret);
|
||||
}
|
||||
/* other options will go here if need be */
|
||||
else
|
||||
{
|
||||
es9018k2m_present_flag = 0;
|
||||
logf("Default to SWVOL: ret=%d", ret);
|
||||
}
|
||||
|
||||
if (!pwr_after_discovery)
|
||||
{
|
||||
gpio_set_level(GPIO_DAC_PWR, 0);
|
||||
gpio_set_level(GPIO_DAC_ANALOG_PWR, 0);
|
||||
}
|
||||
|
||||
return es9018k2m_present_flag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@
|
|||
#include "system.h"
|
||||
#include "es9018k2m.h"
|
||||
#include "i2c-async.h"
|
||||
#include "action.h"
|
||||
#ifndef BOOTLOADER
|
||||
# include "action.h"
|
||||
#endif
|
||||
|
||||
//======================================================================================
|
||||
// ES9018K2M support stuff
|
||||
|
|
@ -36,6 +38,7 @@
|
|||
# error "No definition for ES9018K2M I2C address!"
|
||||
#endif
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
static int vol_tenthdb2hw(const int tdb)
|
||||
{
|
||||
if (tdb < ES9018K2M_VOLUME_MIN) {
|
||||
|
|
@ -147,6 +150,7 @@ void es9018k2m_set_filter_roll_off(int value)
|
|||
es9018k2m_write_reg(ES9018K2M_REG7_GENERAL_SETTINGS, reg7_general_settings);
|
||||
es9018k2m_write_reg(ES9018K2M_REG21_GPIO_INPUT_SELECT, reg21_gpio_input_selection);
|
||||
}
|
||||
#endif /* !defined(BOOTLOADER) */
|
||||
|
||||
/* returns I2C_STATUS_OK upon success, I2C_STATUS_* errors upon error */
|
||||
int es9018k2m_write_reg(uint8_t reg, uint8_t val)
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ bool axp_debug_menu(void)
|
|||
# if defined(BOOTLOADER)
|
||||
devicever = EROSQN_VER;
|
||||
# else
|
||||
devicever = device_data.lcd_version;
|
||||
devicever = device_data.hw_rev;
|
||||
# endif
|
||||
if (devicever >= 4) {
|
||||
return axp2101_debug_menu();
|
||||
|
|
@ -556,7 +556,7 @@ unsigned int power_input_status(void)
|
|||
# if defined(BOOTLOADER)
|
||||
devicever = EROSQN_VER;
|
||||
# else
|
||||
devicever = device_data.lcd_version;
|
||||
devicever = device_data.hw_rev;
|
||||
# endif
|
||||
if (devicever >= 4) {
|
||||
return axp2101_power_input_status();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue