mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
erosqhosted: Support HW volume control on rev2+ hardware
This also adds hwrev info to the debug output. Change-Id: Ia75218cacb8f756a23a77334ea6ab69ac3b20d10
This commit is contained in:
parent
1c28cb439b
commit
51ba8b3eee
4 changed files with 95 additions and 20 deletions
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
static int line = 0;
|
||||
|
||||
extern int hwver;
|
||||
|
||||
bool dbg_hw_info(void)
|
||||
{
|
||||
int btn = 0;
|
||||
|
|
@ -61,6 +63,10 @@ bool dbg_hw_info(void)
|
|||
lcd_putsf(0, line++, "Boot ver: %s", verstr);
|
||||
}
|
||||
|
||||
#ifdef EROS_Q
|
||||
lcd_putsf(0, line++, "hwver: %d", hwver);
|
||||
#endif
|
||||
|
||||
lcd_putsf(0, line++, "pcm srate: %d", pcm_alsa_get_rate());
|
||||
lcd_putsf(0, line++, "pcm xruns: %d", pcm_alsa_get_xruns());
|
||||
#ifdef HAVE_HEADPHONE_DETECTION
|
||||
|
|
|
|||
|
|
@ -45,16 +45,16 @@ const char * const sysfs_bat_status[2] = {
|
|||
"/sys/class/power_supply/axp_battery/status",
|
||||
};
|
||||
|
||||
static int hwver = 0;
|
||||
int hwver = 1; /* Exported */
|
||||
|
||||
unsigned int erosq_power_get_battery_voltage(void)
|
||||
{
|
||||
int battery_voltage;
|
||||
int x = sysfs_get_int(sysfs_bat_voltage[hwver], &battery_voltage);
|
||||
int x = sysfs_get_int(sysfs_bat_voltage[hwver == 4], &battery_voltage);
|
||||
|
||||
if (!x) {
|
||||
hwver ^= 1;
|
||||
sysfs_get_int(sysfs_bat_voltage[hwver], &battery_voltage);
|
||||
if (!x && hwver != 4) {
|
||||
hwver = 4;
|
||||
sysfs_get_int(sysfs_bat_voltage[hwver == 4], &battery_voltage);
|
||||
}
|
||||
|
||||
return battery_voltage/1000;
|
||||
|
|
@ -63,11 +63,11 @@ unsigned int erosq_power_get_battery_voltage(void)
|
|||
unsigned int erosq_power_get_battery_capacity(void)
|
||||
{
|
||||
int battery_capacity;
|
||||
int x = sysfs_get_int(sysfs_bat_capacity[hwver], &battery_capacity);
|
||||
int x = sysfs_get_int(sysfs_bat_capacity[hwver == 4], &battery_capacity);
|
||||
|
||||
if (!x) {
|
||||
hwver ^= 1;
|
||||
sysfs_get_int(sysfs_bat_capacity[hwver], &battery_capacity);
|
||||
if (!x && hwver != 4) {
|
||||
hwver = 4;
|
||||
sysfs_get_int(sysfs_bat_capacity[hwver == 4], &battery_capacity);
|
||||
}
|
||||
|
||||
return battery_capacity;
|
||||
|
|
@ -81,11 +81,11 @@ bool charging_state(void)
|
|||
{
|
||||
if ((current_tick - last_tick) > HZ/2 ) {
|
||||
char buf[12] = {0};
|
||||
int x = sysfs_get_string(sysfs_bat_status[hwver], buf, sizeof(buf));
|
||||
int x = sysfs_get_string(sysfs_bat_status[hwver == 4], buf, sizeof(buf));
|
||||
|
||||
if (!x) {
|
||||
hwver ^= 1;
|
||||
sysfs_get_string(sysfs_bat_status[hwver], buf, sizeof(buf));
|
||||
if (!x && hwver != 4) {
|
||||
hwver = 4;
|
||||
sysfs_get_string(sysfs_bat_status[hwver == 4], buf, sizeof(buf));
|
||||
}
|
||||
|
||||
last_tick = current_tick;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ void alsa_controls_close(void);
|
|||
|
||||
/* check wether a control exists */
|
||||
bool alsa_has_control(const char *name);
|
||||
/* find a control element ID by name, return -1 of not found or index into array */
|
||||
int alsa_controls_find(const char *name);
|
||||
/* find a control element enum index by name, return -1 if not found */
|
||||
int alsa_controls_find_enum(const char *name, const char *enum_name);
|
||||
/* set a control, potentially supports several values */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue