mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-13 07:02:31 -05:00
Adding new setting to System Settings <Accessory Power Supply -- off by default). This setting can be used to enable/disable the power supply for accessories. With this commit implemented for iPods with PCF50605 power controller.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17193 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cea07eb2a4
commit
850a11250a
16 changed files with 100 additions and 16 deletions
|
|
@ -11533,3 +11533,17 @@
|
||||||
swcodec: "Tastentöne Wiederholung"
|
swcodec: "Tastentöne Wiederholung"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_ACCESSORY_SUPPLY
|
||||||
|
desc: in keyclick settings menu
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Zubehör Spannungsversorgung"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Zubehör Spannungsversorgung"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Zubehör Spannungsversorgung"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
|
|
||||||
|
|
@ -11576,3 +11576,17 @@
|
||||||
swcodec: "Keyclick Repeats"
|
swcodec: "Keyclick Repeats"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_ACCESSORY_SUPPLY
|
||||||
|
desc: in keyclick settings menu
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Accessory Power Supply"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Accessory Power Supply"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Accessory Power Supply"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
|
|
||||||
|
|
@ -583,6 +583,9 @@ static void init(void)
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
car_adapter_mode_init();
|
car_adapter_mode_init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
accessory_supply_set(global_settings.accessory_supply);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CPU_PP
|
#ifdef CPU_PP
|
||||||
|
|
|
||||||
|
|
@ -348,6 +348,9 @@ MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback);
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
|
MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL);
|
||||||
|
#endif
|
||||||
MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
|
MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
|
||||||
|
|
||||||
#ifdef HAVE_BUTTON_LIGHT
|
#ifdef HAVE_BUTTON_LIGHT
|
||||||
|
|
@ -385,6 +388,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
&car_adapter_mode,
|
&car_adapter_mode,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
&accessory_supply,
|
||||||
|
#endif
|
||||||
#ifdef HAVE_BUTTON_LIGHT
|
#ifdef HAVE_BUTTON_LIGHT
|
||||||
&buttonlight_timeout,
|
&buttonlight_timeout,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -453,6 +453,9 @@ struct user_settings
|
||||||
bool peak_meter_clipcounter; /* clipping count indicator */
|
bool peak_meter_clipcounter; /* clipping count indicator */
|
||||||
#endif
|
#endif
|
||||||
bool car_adapter_mode; /* 0=off 1=on */
|
bool car_adapter_mode; /* 0=off 1=on */
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* show status bar */
|
/* show status bar */
|
||||||
bool statusbar; /* 0=hide, 1=show */
|
bool statusbar; /* 0=hide, 1=show */
|
||||||
|
|
|
||||||
|
|
@ -511,6 +511,10 @@ const struct settings_list settings[] = {
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
OFFON_SETTING(NVRAM(1), car_adapter_mode,
|
OFFON_SETTING(NVRAM(1), car_adapter_mode,
|
||||||
LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
|
LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
OFFON_SETTING(0, accessory_supply, LANG_ACCESSORY_SUPPLY,
|
||||||
|
false, "accessory power supply", accessory_supply_set),
|
||||||
#endif
|
#endif
|
||||||
/* tuner */
|
/* tuner */
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
|
|
|
||||||
|
|
@ -79,27 +79,25 @@ void pcf50605_init(void)
|
||||||
#if defined (IPOD_VIDEO)
|
#if defined (IPOD_VIDEO)
|
||||||
/* I/O and GPO voltage supply (default: 0xf8 = 3.3V ON) */
|
/* I/O and GPO voltage supply (default: 0xf8 = 3.3V ON) */
|
||||||
/* ECO not allowed regarding data sheet */
|
/* ECO not allowed regarding data sheet */
|
||||||
pcf50605_write(PCF5060X_IOREGC, 0xf8); /* 3.3V ON */
|
pcf50605_write(PCF5060X_IOREGC, 0xf8); /* 3.3V ON */
|
||||||
|
|
||||||
/* core voltage supply (default DCDC1/DCDC2: 0xec = 1.2V ON) */
|
/* core voltage supply (default DCDC1/DCDC2: 0xec = 1.2V ON) */
|
||||||
/* ECO not stable, assumed due to less precision of voltage in ECO mode */
|
/* ECO not stable, assumed due to less precision of voltage in ECO mode */
|
||||||
pcf50605_write(PCF5060X_DCDC1, 0xec); /* 1.2V ON */
|
pcf50605_write(PCF5060X_DCDC1, 0xec); /* 1.2V ON */
|
||||||
pcf50605_write(PCF5060X_DCDC2, 0x0c); /* OFF */
|
pcf50605_write(PCF5060X_DCDC2, 0x0c); /* OFF */
|
||||||
|
|
||||||
/* unknown (default: 0xe3 = 1.8V ON) */
|
/* unknown (default: 0xe3 = 1.8V ON) */
|
||||||
pcf50605_write(PCF5060X_DCUDC1, 0xe3); /* 1.8V ON */
|
pcf50605_write(PCF5060X_DCUDC1, 0xe3); /* 1.8V ON */
|
||||||
|
|
||||||
/* WM8758 voltage supply (default: 0xf5 = 3.0V ON) */
|
/* WM8758 voltage supply (default: 0xf5 = 3.0V ON) */
|
||||||
/* ECO not allowed as max. current of 5mA is not sufficient */
|
/* ECO not allowed as max. current of 5mA is not sufficient */
|
||||||
pcf50605_write(PCF5060X_D1REGC1, 0xf0); /* 2.5V ON */
|
pcf50605_write(PCF5060X_D1REGC1, 0xf0); /* 2.5V ON */
|
||||||
|
|
||||||
/* LCD voltage supply (default: 0xf5 = 3.0V ON) */
|
/* LCD voltage supply (default: 0xf5 = 3.0V ON) */
|
||||||
pcf50605_write(PCF5060X_D3REGC1, 0xf1); /* 2.6V ON */
|
pcf50605_write(PCF5060X_D3REGC1, 0xf1); /* 2.6V ON */
|
||||||
#else
|
#else
|
||||||
/* keep initialization from svn for other iPods */
|
/* keep initialization from svn for other iPods */
|
||||||
pcf50605_write(PCF5060X_D1REGC1, 0xf5); /* 3.0V ON */
|
pcf50605_write(PCF5060X_D1REGC1, 0xf5); /* 3.0V ON */
|
||||||
pcf50605_write(PCF5060X_D3REGC1, 0xf5); /* 3.0V ON */
|
pcf50605_write(PCF5060X_D3REGC1, 0xf5); /* 3.0V ON */
|
||||||
#endif
|
#endif
|
||||||
/* Dock Connector pin 17 (default: OFF) */
|
|
||||||
pcf50605_write(PCF5060X_D2REGC1, 0xf8); /* 3.3V ON */
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@
|
||||||
/* Define if the device can wake from an RTC alarm */
|
/* Define if the device can wake from an RTC alarm */
|
||||||
#define HAVE_RTC_ALARM
|
#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
|
/* Define this if you can switch on/off the accessory power supply */
|
||||||
|
#define HAVE_ACCESSORY_SUPPLY
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,5 +182,7 @@ void reset_poweroff_timer(void);
|
||||||
void cancel_shutdown(void);
|
void cancel_shutdown(void);
|
||||||
void shutdown_hw(void);
|
void shutdown_hw(void);
|
||||||
void sys_poweroff(void);
|
void sys_poweroff(void);
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
void accessory_supply_set(bool);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
|
#include "pcf5060x.h"
|
||||||
|
#include "pcf50605.h"
|
||||||
|
|
||||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||||
{
|
{
|
||||||
|
|
@ -88,3 +90,20 @@ unsigned int battery_adc_voltage(void)
|
||||||
{
|
{
|
||||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ACCESSORY_SUPPLY
|
||||||
|
void accessory_supply_set(bool enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
/* Accessory voltage supply */
|
||||||
|
pcf50605_write(PCF5060X_D2REGC1, 0xf8); /* 3.3V ON */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Accessory voltage supply */
|
||||||
|
pcf50605_write(PCF5060X_D2REGC1, 0x18); /* OFF */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue