summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/ypr0/powermgmt-ypr0.c
diff options
context:
space:
mode:
authorLorenzo Miori <memorys60@gmail.com>2012-04-07 10:30:23 +0200
committerThomas Martitz <kugel@rockbox.org>2012-05-28 19:39:14 +0200
commit3cad5573b68917442564dc4f210fac056447c5cd (patch)
tree16e7f637a7bf9a22b00fde445a97f267b5467cc2 /firmware/target/hosted/ypr0/powermgmt-ypr0.c
parent9c33f93c1c9bfd37f33f638eccceefa4c0d5b5e6 (diff)
downloadrockbox-3cad5573b68917442564dc4f210fac056447c5cd.tar.gz
rockbox-3cad5573b68917442564dc4f210fac056447c5cd.zip
ypr0: This patch adds radio support to Samsung YP-R0
Basically it uses the default SI4700 radio chip driver, the only thing that's different is the I2C access, written specifically to interact with my kernel module. Next things to add are: - RDS support! Change-Id: I0ed125641e00f93124d7a34f90dd508e7f1db5a4 Signed-off-by: Lorenzo Miori <memorys60@gmail.com>
Diffstat (limited to 'firmware/target/hosted/ypr0/powermgmt-ypr0.c')
-rw-r--r--firmware/target/hosted/ypr0/powermgmt-ypr0.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/firmware/target/hosted/ypr0/powermgmt-ypr0.c b/firmware/target/hosted/ypr0/powermgmt-ypr0.c
index 45ff2ae737..347e5fa146 100644
--- a/firmware/target/hosted/ypr0/powermgmt-ypr0.c
+++ b/firmware/target/hosted/ypr0/powermgmt-ypr0.c
@@ -24,6 +24,7 @@
24#include "file.h" 24#include "file.h"
25#include "adc.h" 25#include "adc.h"
26#include "sc900776.h" 26#include "sc900776.h"
27#include "radio-ypr0.h"
27 28
28const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 29const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
29{ 30{
@@ -37,7 +38,6 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
37}; 38};
38 39
39/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 40/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
40/* FIXME: This is guessed. Make proper curve using battery_bench */
41const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 41const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
42{ 42{
43 { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 } 43 { 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 }
@@ -45,7 +45,6 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
45 45
46#if CONFIG_CHARGING 46#if CONFIG_CHARGING
47/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 47/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
48/* FIXME: This is guessed. Make proper curve using battery_bench */
49const unsigned short const percent_to_volt_charge[11] = 48const unsigned short const percent_to_volt_charge[11] =
50{ 49{
51 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 50 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
@@ -81,3 +80,29 @@ bool charging_state(void)
81 /* dont indicate for > ~95% */ 80 /* dont indicate for > ~95% */
82 return ret && (_battery_voltage() <= charged_thres); 81 return ret && (_battery_voltage() <= charged_thres);
83} 82}
83
84#if CONFIG_TUNER
85static bool tuner_on = false;
86
87bool tuner_power(bool status)
88{
89 if (status != tuner_on)
90 {
91 tuner_on = status;
92 status = !status;
93 if (tuner_on) {
94 radiodev_open();
95 }
96 else {
97 radiodev_close();
98 }
99 }
100
101 return status;
102}
103
104bool tuner_powered(void)
105{
106 return tuner_on;
107}
108#endif /* #if CONFIG_TUNER */ \ No newline at end of file