diff options
Diffstat (limited to 'firmware/target/hosted/ibasso/dx90')
-rw-r--r-- | firmware/target/hosted/ibasso/dx90/audiohw-dx90.c | 63 | ||||
-rw-r--r-- | firmware/target/hosted/ibasso/dx90/button-dx90.c | 104 | ||||
-rw-r--r-- | firmware/target/hosted/ibasso/dx90/codec-dx90.h | 35 |
3 files changed, 202 insertions, 0 deletions
diff --git a/firmware/target/hosted/ibasso/dx90/audiohw-dx90.c b/firmware/target/hosted/ibasso/dx90/audiohw-dx90.c new file mode 100644 index 0000000000..ef18aae4bd --- /dev/null +++ b/firmware/target/hosted/ibasso/dx90/audiohw-dx90.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___ | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 | ||
10 | * Copyright (C) 2014 by Mario Basister: iBasso DX90 port | ||
11 | * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features | ||
12 | * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | |||
25 | #include "config.h" | ||
26 | #include "debug.h" | ||
27 | |||
28 | #include "debug-ibasso.h" | ||
29 | #include "sysfs-ibasso.h" | ||
30 | |||
31 | |||
32 | extern void set_software_volume(void); | ||
33 | |||
34 | |||
35 | void audiohw_set_volume(int volume) | ||
36 | { | ||
37 | set_software_volume(); | ||
38 | |||
39 | /* See codec-dx90.h. -2550 to 0 -> 0 to 255 */ | ||
40 | int volume_adjusted = ((volume + 2550) / 10); | ||
41 | |||
42 | DEBUGF("DEBUG %s: volume: %d, volume_adjusted: %d.", __func__, volume, volume_adjusted); | ||
43 | |||
44 | if(volume_adjusted > 255) | ||
45 | { | ||
46 | DEBUGF("DEBUG %s: Adjusting volume from %d to 255.", __func__, volume); | ||
47 | volume_adjusted = 255; | ||
48 | } | ||
49 | if(volume_adjusted < 0) | ||
50 | { | ||
51 | DEBUGF("DEBUG %s: Adjusting volume from %d to 0.", __func__, volume); | ||
52 | volume_adjusted = 0; | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | /sys/class/codec/es9018_volume | ||
57 | 0 ... 255 | ||
58 | */ | ||
59 | if(! sysfs_set_int(SYSFS_DX90_ES9018_VOLUME, volume_adjusted)) | ||
60 | { | ||
61 | DEBUGF("ERROR %s: Can not set volume.", __func__); | ||
62 | } | ||
63 | } | ||
diff --git a/firmware/target/hosted/ibasso/dx90/button-dx90.c b/firmware/target/hosted/ibasso/dx90/button-dx90.c new file mode 100644 index 0000000000..27e4be0c1e --- /dev/null +++ b/firmware/target/hosted/ibasso/dx90/button-dx90.c | |||
@@ -0,0 +1,104 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___ | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 | ||
10 | * Copyright (C) 2014 by Mario Basister: iBasso DX90 port | ||
11 | * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features | ||
12 | * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | |||
25 | #include "config.h" | ||
26 | #include "button.h" | ||
27 | |||
28 | #include "button-ibasso.h" | ||
29 | |||
30 | |||
31 | int handle_button_event(__u16 code, __s32 value, int last_btns) | ||
32 | { | ||
33 | int button = BUTTON_NONE; | ||
34 | |||
35 | switch(code) | ||
36 | { | ||
37 | case EVENT_CODE_BUTTON_PWR: | ||
38 | { | ||
39 | button = BUTTON_POWER; | ||
40 | break; | ||
41 | } | ||
42 | |||
43 | case EVENT_CODE_BUTTON_PWR_LONG: | ||
44 | { | ||
45 | button = BUTTON_POWER_LONG; | ||
46 | break; | ||
47 | } | ||
48 | |||
49 | case EVENT_CODE_BUTTON_VOLPLUS: | ||
50 | { | ||
51 | button = BUTTON_VOL_UP; | ||
52 | break; | ||
53 | } | ||
54 | |||
55 | case EVENT_CODE_BUTTON_VOLMINUS: | ||
56 | { | ||
57 | button = BUTTON_VOL_DOWN; | ||
58 | break; | ||
59 | } | ||
60 | |||
61 | case EVENT_CODE_BUTTON_REV: | ||
62 | { | ||
63 | button = BUTTON_LEFT; | ||
64 | break; | ||
65 | } | ||
66 | |||
67 | case EVENT_CODE_BUTTON_PLAY: | ||
68 | { | ||
69 | button = BUTTON_PLAY; | ||
70 | break; | ||
71 | } | ||
72 | |||
73 | case EVENT_CODE_BUTTON_NEXT: | ||
74 | { | ||
75 | button = BUTTON_RIGHT; | ||
76 | break; | ||
77 | } | ||
78 | |||
79 | default: | ||
80 | { | ||
81 | return BUTTON_NONE; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | if( (button == BUTTON_RIGHT) | ||
86 | && ((last_btns & BUTTON_LEFT) == BUTTON_LEFT) | ||
87 | && (value == EVENT_VALUE_BUTTON_RELEASE)) | ||
88 | { | ||
89 | /* Workaround for a wrong feedback, only present with DX90. */ | ||
90 | button = BUTTON_LEFT; | ||
91 | } | ||
92 | |||
93 | int buttons = last_btns; | ||
94 | if(value == EVENT_VALUE_BUTTON_PRESS) | ||
95 | { | ||
96 | buttons = (last_btns | button); | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | buttons = (last_btns & (~button)); | ||
101 | } | ||
102 | |||
103 | return buttons; | ||
104 | } | ||
diff --git a/firmware/target/hosted/ibasso/dx90/codec-dx90.h b/firmware/target/hosted/ibasso/dx90/codec-dx90.h new file mode 100644 index 0000000000..b96377dfec --- /dev/null +++ b/firmware/target/hosted/ibasso/dx90/codec-dx90.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___ | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 | ||
10 | * Copyright (C) 2014 by Mario Basister: iBasso DX90 port | ||
11 | * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features | ||
12 | * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | |||
25 | #ifndef _CODEC_DX90_H_ | ||
26 | #define _CODEC_DX90_H_ | ||
27 | |||
28 | |||
29 | #define AUDIOHW_CAPS MONO_VOL_CAP | ||
30 | |||
31 | |||
32 | AUDIOHW_SETTING(VOLUME, "", 0, 1, -255, 0, -128) | ||
33 | |||
34 | |||
35 | #endif | ||