diff options
Diffstat (limited to 'firmware/target/arm/rk27xx/ihifi2/audio-ihifi770.c')
-rw-r--r-- | firmware/target/arm/rk27xx/ihifi2/audio-ihifi770.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/firmware/target/arm/rk27xx/ihifi2/audio-ihifi770.c b/firmware/target/arm/rk27xx/ihifi2/audio-ihifi770.c new file mode 100644 index 0000000000..a21ea9cfef --- /dev/null +++ b/firmware/target/arm/rk27xx/ihifi2/audio-ihifi770.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2016 by Roman Stolyarov | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "system.h" | ||
23 | #include "kernel.h" | ||
24 | #include "audiohw.h" | ||
25 | |||
26 | void wm8740_hw_init(void) | ||
27 | { | ||
28 | GPIO_PADR &= ~(1<<0); /* MD */ | ||
29 | GPIO_PACON |= (1<<0); | ||
30 | |||
31 | GPIO_PADR &= ~(1<<1); /* MC */ | ||
32 | GPIO_PACON |= (1<<1); | ||
33 | |||
34 | SCU_IOMUXB_CON &= ~(1<<2); | ||
35 | GPIO_PCDR |= (1<<4); /* ML */ | ||
36 | GPIO_PCCON |= (1<<4); | ||
37 | } | ||
38 | |||
39 | void wm8740_set_md(const int val) | ||
40 | { | ||
41 | if (val) | ||
42 | GPIO_PADR |= (1<<0); | ||
43 | else | ||
44 | GPIO_PADR &= ~(1<<0); | ||
45 | } | ||
46 | |||
47 | void wm8740_set_mc(const int val) | ||
48 | { | ||
49 | if (val) | ||
50 | GPIO_PADR |= (1<<1); | ||
51 | else | ||
52 | GPIO_PADR &= ~(1<<1); | ||
53 | } | ||
54 | |||
55 | void wm8740_set_ml(const int val) | ||
56 | { | ||
57 | if (val) | ||
58 | GPIO_PCDR |= (1<<4); | ||
59 | else | ||
60 | GPIO_PCDR &= ~(1<<4); | ||
61 | } | ||
62 | |||
63 | static void pop_ctrl(const int val) | ||
64 | { | ||
65 | if (val) | ||
66 | GPIO_PADR |= (1<<7); | ||
67 | else | ||
68 | GPIO_PADR &= ~(1<<7); | ||
69 | } | ||
70 | |||
71 | void audiohw_postinit(void) | ||
72 | { | ||
73 | pop_ctrl(0); | ||
74 | sleep(HZ/4); | ||
75 | wm8740_hw_init(); | ||
76 | audiohw_init(); | ||
77 | sleep(HZ/2); | ||
78 | pop_ctrl(1); | ||
79 | sleep(HZ/4); | ||
80 | audiohw_unmute(); | ||
81 | } | ||
82 | |||
83 | void audiohw_close(void) | ||
84 | { | ||
85 | audiohw_mute(); | ||
86 | pop_ctrl(0); | ||
87 | sleep(HZ/4); | ||
88 | } | ||