diff options
author | Szymon Dziok <b0hoon@o2.pl> | 2014-06-17 23:13:15 +0000 |
---|---|---|
committer | Szymon Dziok <b0hoon@o2.pl> | 2014-06-18 18:06:17 +0000 |
commit | eacd76cb80db12adcce74980e69d116911a8cde7 (patch) | |
tree | 239344e3f9053a75eeab4253f39f6b1dae749aa6 /firmware/target/arm | |
parent | 0c3dca1f33596cb10345601de32d681ed6ece972 (diff) | |
download | rockbox-eacd76cb80db12adcce74980e69d116911a8cde7.tar.gz rockbox-eacd76cb80db12adcce74980e69d116911a8cde7.zip |
Radio and radio recording for Samsung YH-920.
There is no simple method to detect radio through the 3-wire interface, so it's
not implemented for the YH-925 for now. YH-920 always has a radio.
Change-Id: Iea484d752915fcd40dbbbd7dbbf13e81aaf548db
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/pp/audio-pp.c | 21 | ||||
-rw-r--r-- | firmware/target/arm/samsung/fmradio-yh92x.c | 120 | ||||
-rw-r--r-- | firmware/target/arm/samsung/power-yh82x_yh92x.c | 19 |
3 files changed, 159 insertions, 1 deletions
diff --git a/firmware/target/arm/pp/audio-pp.c b/firmware/target/arm/pp/audio-pp.c index 6b5b082cc7..76740f2e42 100644 --- a/firmware/target/arm/pp/audio-pp.c +++ b/firmware/target/arm/pp/audio-pp.c | |||
@@ -30,6 +30,25 @@ void audio_set_output_source(int source) | |||
30 | source = AUDIO_SRC_PLAYBACK; | 30 | source = AUDIO_SRC_PLAYBACK; |
31 | } /* audio_set_output_source */ | 31 | } /* audio_set_output_source */ |
32 | 32 | ||
33 | #ifdef HAVE_AK4537 | ||
34 | void audio_input_mux(int source, unsigned flags) | ||
35 | { | ||
36 | (void)flags; | ||
37 | /* Prevent pops from unneeded switching */ | ||
38 | static int last_source = AUDIO_SRC_PLAYBACK; | ||
39 | |||
40 | #ifdef HAVE_FMRADIO_REC | ||
41 | bool recording = flags & SRCF_RECORDING; | ||
42 | |||
43 | if ((source == AUDIO_SRC_FMRADIO) && (!recording)) | ||
44 | audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN); /* Set line-in vol to 0dB*/ | ||
45 | #endif | ||
46 | if (source != last_source) | ||
47 | audiohw_set_recsrc(source); | ||
48 | |||
49 | last_source = source; | ||
50 | } | ||
51 | #else | ||
33 | void audio_input_mux(int source, unsigned flags) | 52 | void audio_input_mux(int source, unsigned flags) |
34 | { | 53 | { |
35 | (void)flags; | 54 | (void)flags; |
@@ -132,4 +151,6 @@ void audio_input_mux(int source, unsigned flags) | |||
132 | 151 | ||
133 | last_source = source; | 152 | last_source = source; |
134 | } /* audio_input_mux */ | 153 | } /* audio_input_mux */ |
154 | #endif | ||
155 | |||
135 | #endif /* INPUT_SRC_CAPS != 0 */ | 156 | #endif /* INPUT_SRC_CAPS != 0 */ |
diff --git a/firmware/target/arm/samsung/fmradio-yh92x.c b/firmware/target/arm/samsung/fmradio-yh92x.c new file mode 100644 index 0000000000..4637aca287 --- /dev/null +++ b/firmware/target/arm/samsung/fmradio-yh92x.c | |||
@@ -0,0 +1,120 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * Physical interface of the Philips TEA5767 in Samsung YH-92x | ||
10 | * | ||
11 | * Copyright (C) 2014 by Szymon Dziok | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "cpu.h" | ||
25 | #include "fmradio_3wire.h" | ||
26 | |||
27 | #define CLOCK_EN GPIO_SET_BITWISE(GPIOL_ENABLE, 0x10) | ||
28 | #define CLOCK_OUT GPIO_SET_BITWISE(GPIOL_OUTPUT_EN, 0x10) | ||
29 | #define CLOCK_LO GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x10) | ||
30 | #define CLOCK_HI GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x10) | ||
31 | |||
32 | #define DATA (GPIOL_INPUT_VAL & 0x08) | ||
33 | #define DATA_EN GPIO_SET_BITWISE(GPIOL_ENABLE, 0x08) | ||
34 | #define DATA_IN GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_EN, 0x08) | ||
35 | #define DATA_OUT GPIO_SET_BITWISE(GPIOL_OUTPUT_EN, 0x08) | ||
36 | #define DATA_LO GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x08) | ||
37 | #define DATA_HI GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x08) | ||
38 | |||
39 | #define READWRITE_EN GPIO_SET_BITWISE(GPIOL_ENABLE, 0x01) | ||
40 | #define READWRITE_OUT GPIO_SET_BITWISE(GPIOL_OUTPUT_EN, 0x01) | ||
41 | #define READWRITE_LO GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x01) | ||
42 | #define READWRITE_HI GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x01) | ||
43 | |||
44 | #define DELAY1 udelay(1) | ||
45 | #define DELAY2 udelay(2) | ||
46 | |||
47 | void fmradio_3wire_init(void) | ||
48 | { | ||
49 | READWRITE_EN; | ||
50 | READWRITE_OUT; | ||
51 | |||
52 | DATA_EN; | ||
53 | DATA_IN; | ||
54 | |||
55 | CLOCK_EN; | ||
56 | CLOCK_HI; | ||
57 | CLOCK_OUT; | ||
58 | |||
59 | DELAY2; | ||
60 | } | ||
61 | |||
62 | int fmradio_3wire_write(const unsigned char* buf) | ||
63 | { | ||
64 | int i, j; | ||
65 | |||
66 | CLOCK_LO; | ||
67 | READWRITE_LO; | ||
68 | DELAY2; | ||
69 | READWRITE_HI; | ||
70 | DELAY1; | ||
71 | DATA_OUT; | ||
72 | |||
73 | /* 5 bytes to the tuner */ | ||
74 | for (j = 0; j < 5; j++) | ||
75 | { | ||
76 | for (i = 7; i >= 0; i--) | ||
77 | { | ||
78 | if ((buf[j] >> i) & 0x1) DATA_HI; | ||
79 | else DATA_LO; | ||
80 | DELAY1; | ||
81 | CLOCK_HI; | ||
82 | DELAY2; | ||
83 | CLOCK_LO; | ||
84 | DELAY1; | ||
85 | } | ||
86 | } | ||
87 | READWRITE_LO; | ||
88 | |||
89 | return j; | ||
90 | } | ||
91 | |||
92 | int fmradio_3wire_read(unsigned char* buf) | ||
93 | { | ||
94 | int i, j; | ||
95 | |||
96 | CLOCK_LO; | ||
97 | READWRITE_HI; | ||
98 | DELAY2; | ||
99 | READWRITE_LO; | ||
100 | DELAY2; | ||
101 | DATA_IN; | ||
102 | |||
103 | /* 5 bytes from the tuner */ | ||
104 | for (j = 0; j < 5; j++) | ||
105 | { | ||
106 | buf[j] = 0; | ||
107 | for (i = 7; i >= 0; i--) | ||
108 | { | ||
109 | buf[j] |= ((DATA >> 3) << i); | ||
110 | |||
111 | CLOCK_HI; | ||
112 | DELAY2; | ||
113 | CLOCK_LO; | ||
114 | DELAY2; | ||
115 | } | ||
116 | } | ||
117 | READWRITE_HI; | ||
118 | |||
119 | return j; | ||
120 | } | ||
diff --git a/firmware/target/arm/samsung/power-yh82x_yh92x.c b/firmware/target/arm/samsung/power-yh82x_yh92x.c index 021ddade4d..b6c18c5fd0 100644 --- a/firmware/target/arm/samsung/power-yh82x_yh92x.c +++ b/firmware/target/arm/samsung/power-yh82x_yh92x.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | /* Created from power.c using some iPod code, and some custom stuff based on | 22 | /* Created from power.c using some iPod code, and some custom stuff based on |
23 | GPIO analysis | 23 | GPIO analysis |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "config.h" | 26 | #include "config.h" |
@@ -32,9 +32,26 @@ | |||
32 | #include "power.h" | 32 | #include "power.h" |
33 | #include "logf.h" | 33 | #include "logf.h" |
34 | #include "usb.h" | 34 | #include "usb.h" |
35 | #include "fmradio_3wire.h" | ||
36 | |||
37 | #if CONFIG_TUNER | ||
38 | bool tuner_power(bool status) | ||
39 | { | ||
40 | GPIO_SET_BITWISE(GPIOL_ENABLE, 0x04); | ||
41 | GPIO_SET_BITWISE(GPIOL_OUTPUT_EN, 0x04); | ||
42 | if (status) | ||
43 | GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x04); | ||
44 | else | ||
45 | GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x04); | ||
46 | return status; | ||
47 | } | ||
48 | #endif | ||
35 | 49 | ||
36 | void power_init(void) | 50 | void power_init(void) |
37 | { | 51 | { |
52 | #if CONFIG_TUNER | ||
53 | fmradio_3wire_init(); | ||
54 | #endif | ||
38 | } | 55 | } |
39 | 56 | ||
40 | unsigned int power_input_status(void) | 57 | unsigned int power_input_status(void) |