summaryrefslogtreecommitdiff
path: root/firmware/tuner_philips.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/tuner_philips.c')
-rw-r--r--firmware/tuner_philips.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/firmware/tuner_philips.c b/firmware/tuner_philips.c
index 0a6f5c4c7f..8520fdbae9 100644
--- a/firmware/tuner_philips.c
+++ b/firmware/tuner_philips.c
@@ -29,7 +29,7 @@
29static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 }; 29static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 };
30 30
31/* tuner abstraction layer: set something to the tuner */ 31/* tuner abstraction layer: set something to the tuner */
32void philips_set(int setting, int value) 32int philips_set(int setting, int value)
33{ 33{
34 switch(setting) 34 switch(setting)
35 { 35 {
@@ -60,6 +60,11 @@ void philips_set(int setting, int value)
60 } 60 }
61 break; 61 break;
62 62
63 case RADIO_SCAN_FREQUENCY:
64 philips_set(RADIO_FREQUENCY, value);
65 sleep(HZ/30);
66 return philips_get(RADIO_TUNED);
67
63 case RADIO_MUTE: 68 case RADIO_MUTE:
64 write_bytes[0] = (write_bytes[0] & 0x7F) | (value ? 0x80 : 0); 69 write_bytes[0] = (write_bytes[0] & 0x7F) | (value ? 0x80 : 0);
65 break; 70 break;
@@ -75,9 +80,10 @@ void philips_set(int setting, int value)
75 case RADIO_SET_BAND: 80 case RADIO_SET_BAND:
76 write_bytes[3] = (write_bytes[3] & ~(1<<5)) | (value ? (1<<5) : 0); 81 write_bytes[3] = (write_bytes[3] & ~(1<<5)) | (value ? (1<<5) : 0);
77 default: 82 default:
78 return; 83 return -1;
79 } 84 }
80 fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes)); 85 fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes));
86 return 1;
81} 87}
82 88
83/* tuner abstraction layer: read something from the tuner */ 89/* tuner abstraction layer: read something from the tuner */
@@ -106,13 +112,12 @@ int philips_get(int setting)
106 case RADIO_STEREO: 112 case RADIO_STEREO:
107 val = read_bytes[2] >> 7; 113 val = read_bytes[2] >> 7;
108 break; 114 break;
109
110 case RADIO_ALL: /* debug query */
111 val = read_bytes[0] << 24
112 | read_bytes[1] << 16
113 | read_bytes[2] << 8
114 | read_bytes[3];
115 break;
116 } 115 }
117 return val; 116 return val;
118} 117}
118
119void philips_dbg_info(struct philips_dbg_info *info)
120{
121 fmradio_i2c_read(I2C_ADR, info->read_regs, 5);
122 memcpy(info->write_regs, write_bytes, 5);
123}