diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/tuner/tea5767.c | 23 | ||||
-rw-r--r-- | firmware/export/tea5767.h | 1 | ||||
-rw-r--r-- | firmware/tuner.c | 3 |
3 files changed, 25 insertions, 2 deletions
diff --git a/firmware/drivers/tuner/tea5767.c b/firmware/drivers/tuner/tea5767.c index b16bb4b7c5..7660fa783d 100644 --- a/firmware/drivers/tuner/tea5767.c +++ b/firmware/drivers/tuner/tea5767.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #define I2C_ADR 0xC0 | 34 | #define I2C_ADR 0xC0 |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | static bool tuner_present = true; | ||
37 | static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 }; | 38 | static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 }; |
38 | 39 | ||
39 | static void tea5767_set_clear(int byte, unsigned char bits, int set) | 40 | static void tea5767_set_clear(int byte, unsigned char bits, int set) |
@@ -116,7 +117,7 @@ int tea5767_get(int setting) | |||
116 | switch(setting) | 117 | switch(setting) |
117 | { | 118 | { |
118 | case RADIO_PRESENT: | 119 | case RADIO_PRESENT: |
119 | val = 1; /* true */ | 120 | val = tuner_present; |
120 | break; | 121 | break; |
121 | 122 | ||
122 | case RADIO_TUNED: | 123 | case RADIO_TUNED: |
@@ -136,6 +137,26 @@ int tea5767_get(int setting) | |||
136 | return val; | 137 | return val; |
137 | } | 138 | } |
138 | 139 | ||
140 | void tea5767_init(void) | ||
141 | { | ||
142 | /* save binsize by only detecting presence for targets where it may be absent */ | ||
143 | #if defined(PHILIPS_HDD1630) | ||
144 | unsigned char buf[5]; | ||
145 | unsigned char chipid; | ||
146 | |||
147 | /* init chipid register with 0xFF in case fmradio_i2c_read fails silently */ | ||
148 | buf[3] = 0xFF; | ||
149 | if (fmradio_i2c_read(I2C_ADR, buf, sizeof(buf)) < 0) { | ||
150 | /* no i2c device detected */ | ||
151 | tuner_present = false; | ||
152 | } else { | ||
153 | /* check chip id */ | ||
154 | chipid = buf[3] & 0x0F; | ||
155 | tuner_present = (chipid == 0); | ||
156 | } | ||
157 | #endif | ||
158 | } | ||
159 | |||
139 | void tea5767_dbg_info(struct tea5767_dbg_info *info) | 160 | void tea5767_dbg_info(struct tea5767_dbg_info *info) |
140 | { | 161 | { |
141 | fmradio_i2c_read(I2C_ADR, info->read_regs, 5); | 162 | fmradio_i2c_read(I2C_ADR, info->read_regs, 5); |
diff --git a/firmware/export/tea5767.h b/firmware/export/tea5767.h index eee469d1ea..64dd266311 100644 --- a/firmware/export/tea5767.h +++ b/firmware/export/tea5767.h | |||
@@ -32,6 +32,7 @@ struct tea5767_dbg_info | |||
32 | unsigned char write_regs[5]; | 32 | unsigned char write_regs[5]; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | void tea5767_init(void); | ||
35 | int tea5767_set(int setting, int value); | 36 | int tea5767_set(int setting, int value); |
36 | int tea5767_get(int setting); | 37 | int tea5767_get(int setting); |
37 | void tea5767_dbg_info(struct tea5767_dbg_info *info); | 38 | void tea5767_dbg_info(struct tea5767_dbg_info *info); |
diff --git a/firmware/tuner.c b/firmware/tuner.c index e08cef46ff..278584264b 100644 --- a/firmware/tuner.c +++ b/firmware/tuner.c | |||
@@ -74,7 +74,8 @@ void tuner_init(void) | |||
74 | #if (CONFIG_TUNER & TEA5767) | 74 | #if (CONFIG_TUNER & TEA5767) |
75 | TUNER_TYPE_CASE(TEA5767, | 75 | TUNER_TYPE_CASE(TEA5767, |
76 | tea5767_set, | 76 | tea5767_set, |
77 | tea5767_get) | 77 | tea5767_get, |
78 | tea5767_init()) | ||
78 | #endif | 79 | #endif |
79 | #if (CONFIG_TUNER & S1A0903X01) | 80 | #if (CONFIG_TUNER & S1A0903X01) |
80 | TUNER_TYPE_CASE(S1A0903X01, | 81 | TUNER_TYPE_CASE(S1A0903X01, |