summaryrefslogtreecommitdiff
path: root/firmware/drivers/tuner/tea5767.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/tuner/tea5767.c')
-rw-r--r--firmware/drivers/tuner/tea5767.c23
1 files changed, 22 insertions, 1 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
37static bool tuner_present = true;
37static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 }; 38static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 };
38 39
39static void tea5767_set_clear(int byte, unsigned char bits, int set) 40static 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
140void 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
139void tea5767_dbg_info(struct tea5767_dbg_info *info) 160void 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);