summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorAndrew Ryabinin <ryabinin.a.a@gmail.com>2013-06-02 23:03:26 +0400
committerAndrew Ryabinin <ryabinin.a.a@gmail.com>2013-11-05 09:59:45 +0400
commit3a97e12fc58bd413c81d827c7b32a8cfd08b4d2b (patch)
tree4a827d570ab32161783d9327a748d87f601605c5 /firmware
parenta170c99170589488531f7f576ad5e248b1c7c589 (diff)
downloadrockbox-3a97e12fc58bd413c81d827c7b32a8cfd08b4d2b.tar.gz
rockbox-3a97e12fc58bd413c81d827c7b32a8cfd08b4d2b.zip
Introduce HiFi E.T. MA8/MA8C ports.
HiFi E.T. MA8 is almost the same as MA9 except another DAC(pcm1792 in ma8, df1704 in ma9). MA8 has ILI9342 lcd, MA8C has ILI9342C lcd. Change-Id: If2ac04f5a3382590b2a392c46286559f54b2ed6a
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES4
-rw-r--r--firmware/drivers/audio/pcm1792.c133
-rw-r--r--firmware/export/audiohw.h2
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/config/hifietma8.h153
-rw-r--r--firmware/export/config/hifietma8c.h153
-rw-r--r--firmware/export/pcm1792.h142
-rw-r--r--firmware/target/arm/rk27xx/backlight-rk27xx.c2
-rw-r--r--firmware/target/arm/rk27xx/ma/audio-ma.c5
-rw-r--r--firmware/target/arm/rk27xx/sd-rk27xx.c2
10 files changed, 596 insertions, 4 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index d8b2795f59..fb78e8924c 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -411,6 +411,8 @@ drivers/audio/aic3x.c
411drivers/audio/dummy_codec.c 411drivers/audio/dummy_codec.c
412#elif defined (HAVE_DF1704_CODEC) 412#elif defined (HAVE_DF1704_CODEC)
413drivers/audio/df1704.c 413drivers/audio/df1704.c
414#elif defined (HAVE_PCM1792_CODEC)
415drivers/audio/pcm1792.c
414#endif /* defined(HAVE_*) */ 416#endif /* defined(HAVE_*) */
415#else /* PLATFORM_HOSTED */ 417#else /* PLATFORM_HOSTED */
416#if defined(SAMSUNG_YPR0) && defined(HAVE_AS3514) 418#if defined(SAMSUNG_YPR0) && defined(HAVE_AS3514)
@@ -1745,7 +1747,7 @@ target/arm/rk27xx/hm801/powermgmt-hm801.c
1745target/arm/rk27xx/hm801/power-hm801.c 1747target/arm/rk27xx/hm801/power-hm801.c
1746#endif 1748#endif
1747 1749
1748#if defined(MA9) || defined(MA9C) 1750#if defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C)
1749target/arm/rk27xx/ma/button-ma.c 1751target/arm/rk27xx/ma/button-ma.c
1750target/arm/rk27xx/ma/powermgmt-ma.c 1752target/arm/rk27xx/ma/powermgmt-ma.c
1751target/arm/rk27xx/ma/power-ma.c 1753target/arm/rk27xx/ma/power-ma.c
diff --git a/firmware/drivers/audio/pcm1792.c b/firmware/drivers/audio/pcm1792.c
new file mode 100644
index 0000000000..67237a920a
--- /dev/null
+++ b/firmware/drivers/audio/pcm1792.c
@@ -0,0 +1,133 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 Andrew Ryabinin
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 "pcm1792.h"
24#include "config.h"
25#include "audio.h"
26#include "audiohw.h"
27
28/* pcm1792 registers initial values */
29#define REG18_INIT_VALUE (PCM1792_ATLD_OFF|PCM1792_FMT_16_I2S| \
30 PCM1792_DMF_DISABLE|PCM1792_DME_OFF)
31
32#define REG19_INIT_VALUE (PCM1792_REV_ON|PCM1792_ATS_DIV1| \
33 PCM1792_OPE_ON|PCM1792_DFMS_MONO| \
34 PCM1792_FLT_SHARP|PCM1792_INZD_OFF)
35
36#define REG20_INIT_VALUE (PCM1792_SRST_NORMAL|PCM1792_DSD_OFF|\
37 PCM1792_DFTH_ENABLE|PCM1792_STEREO|\
38 PCM1792_OS_64)
39
40#define REG21_INIT_VALUE (PCM1792_DZ_DISABLE|PCM1792_PCMZ_ON)
41
42
43static void pcm1792_write_reg(const int reg, const unsigned int value)
44{
45 int i;
46
47 pcm1792_set_ml_dir(0);
48 pcm1792_set_md(1);
49 pcm1792_set_mc(0);
50 pcm1792_set_ml(0);
51
52 for (i = (1<<15); i; i >>= 1) {
53 udelay(40);
54 pcm1792_set_mc(0);
55
56 if ((reg|value) & i) {
57 pcm1792_set_md(1);
58 } else {
59 pcm1792_set_md(0);
60 }
61
62 udelay(40);
63 pcm1792_set_mc(1);
64 }
65
66 udelay(40);
67 pcm1792_set_ml(1);
68 pcm1792_set_mc(0);
69 udelay(130);
70 pcm1792_set_md(1);
71}
72
73static int vol_tenthdb2hw(const int tdb)
74{
75 if (tdb < PCM1792_VOLUME_MIN) {
76 return 0;
77 } else if (tdb > PCM1792_VOLUME_MAX) {
78 return 0xff;
79 } else {
80 return (tdb/5+0xff);
81 }
82}
83
84
85void audiohw_init(void)
86{
87 pcm1792_write_reg(PCM1792_REG(18), REG18_INIT_VALUE);
88 pcm1792_write_reg(PCM1792_REG(19), REG19_INIT_VALUE);
89 pcm1792_write_reg(PCM1792_REG(20), REG20_INIT_VALUE);
90 pcm1792_write_reg(PCM1792_REG(21), REG21_INIT_VALUE);
91
92 /* Left & Right volumes */
93 pcm1792_write_reg(PCM1792_REG(16), 0xff);
94 pcm1792_write_reg(PCM1792_REG(17), 0xff);
95}
96
97void audiohw_mute(void)
98{
99 pcm1792_write_reg(PCM1792_REG(18), REG18_INIT_VALUE|PCM1792_MUTE_ON);
100}
101
102void audiohw_unmute(void)
103{
104 pcm1792_write_reg(PCM1792_REG(18), REG18_INIT_VALUE);
105}
106
107void audiohw_preinit(void)
108{
109}
110
111void audiohw_set_frequency(int fsel)
112{
113 (void)fsel;
114}
115
116void audiohw_set_volume(int vol_l, int vol_r)
117{
118 pcm1792_write_reg(PCM1792_REG(16), vol_tenthdb2hw(vol_l));
119 pcm1792_write_reg(PCM1792_REG(17), vol_tenthdb2hw(vol_r));
120}
121
122void audiohw_set_filter_roll_off(int value)
123{
124 if (value == 0) {
125 pcm1792_write_reg(PCM1792_REG(19),
126 REG19_INIT_VALUE
127 |PCM1792_FLT_SHARP);
128 } else {
129 pcm1792_write_reg(PCM1792_REG(19),
130 REG19_INIT_VALUE
131 |PCM1792_FLT_SLOW);
132 }
133}
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index 1cabf6f782..7c5424a29d 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -109,6 +109,8 @@ struct sound_settings_info
109#include "dummy_codec.h" 109#include "dummy_codec.h"
110#elif defined(HAVE_DF1704_CODEC) 110#elif defined(HAVE_DF1704_CODEC)
111#include "df1704.h" 111#include "df1704.h"
112#elif defined(HAVE_PCM1792_CODEC)
113#include "pcm1792.h"
112#elif (CONFIG_PLATFORM & (PLATFORM_ANDROID | PLATFORM_MAEMO\ 114#elif (CONFIG_PLATFORM & (PLATFORM_ANDROID | PLATFORM_MAEMO\
113 | PLATFORM_PANDORA | PLATFORM_SDL)) 115 | PLATFORM_PANDORA | PLATFORM_SDL))
114#include "hosted_codec.h" 116#include "hosted_codec.h"
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 9c6f1f73c5..ffe34fb81b 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -535,6 +535,10 @@ Lyre prototype 1 */
535#include "config/hifietma9.h" 535#include "config/hifietma9.h"
536#elif defined(MA9C) 536#elif defined(MA9C)
537#include "config/hifietma9c.h" 537#include "config/hifietma9c.h"
538#elif defined(MA8)
539#include "config/hifietma8.h"
540#elif defined(MA8C)
541#include "config/hifietma8c.h"
538#elif defined(SONY_NWZE370) 542#elif defined(SONY_NWZE370)
539#include "config/sonynwze370.h" 543#include "config/sonynwze370.h"
540#elif defined(SONY_NWZE360) 544#elif defined(SONY_NWZE360)
diff --git a/firmware/export/config/hifietma8.h b/firmware/export/config/hifietma8.h
new file mode 100644
index 0000000000..7d36882832
--- /dev/null
+++ b/firmware/export/config/hifietma8.h
@@ -0,0 +1,153 @@
1/*
2 * This config file is for HiFi E.T. MA8 reference design
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 85
7
8#define MODEL_NAME "HiFi E.T. MA8"
9
10/* define the bitmask of hardware sample rates */
11#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_48 | SAMPR_CAP_44 | \
12 SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \
13 SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
14
15#define HAVE_PCM1792_CODEC
16
17#define CODEC_SLAVE
18/* define this if you have a bitmap LCD display */
19#define HAVE_LCD_BITMAP
20
21/* define this if you can flip your LCD */
22/* #define HAVE_LCD_FLIP */
23
24/* define this if you have a colour LCD */
25#define HAVE_LCD_COLOR
26
27/* define this if you want album art for this target */
28#define HAVE_ALBUMART
29
30/* define this to enable bitmap scaling */
31#define HAVE_BMP_SCALING
32
33/* define this to enable JPEG decoding */
34#define HAVE_JPEG
35
36/* define this if you can invert the colours on your LCD */
37/* #define HAVE_LCD_INVERT */
38
39/* define this if you have access to the quickscreen */
40#define HAVE_QUICKSCREEN
41
42/* define this if you would like tagcache to build on this target */
43#define HAVE_TAGCACHE
44
45/* define this if you have a flash memory storage */
46#define HAVE_FLASH_STORAGE
47
48#define CONFIG_STORAGE (STORAGE_SD | STORAGE_NAND)
49
50#define CONFIG_NAND NAND_RK27XX
51#define HAVE_SW_TONE_CONTROLS
52
53/* commented for now */
54/* #define HAVE_HOTSWAP */
55
56#define NUM_DRIVES 2
57#define SECTOR_SIZE 512
58
59/* for small(ish) SD cards */
60#define HAVE_FAT16SUPPORT
61
62/* LCD dimensions */
63#define LCD_WIDTH 320
64#define LCD_HEIGHT 240
65#define LCD_DEPTH 16 /* pseudo 262.144 colors */
66#define LCD_PIXELFORMAT RGB565 /* rgb565 */
67
68/* Define this if your LCD can be enabled/disabled */
69#define HAVE_LCD_ENABLE
70
71#define CONFIG_KEYPAD MA_PAD
72
73/* Define this to enable morse code input */
74#define HAVE_MORSE_INPUT
75
76/* Define this if you do software codec */
77#define CONFIG_CODEC SWCODEC
78
79#define CONFIG_LCD LCD_ILI9342
80
81/* Define this for LCD backlight available */
82#define HAVE_BACKLIGHT
83#define HAVE_BACKLIGHT_BRIGHTNESS
84#define MIN_BRIGHTNESS_SETTING 0
85#define MAX_BRIGHTNESS_SETTING 31
86#define DEFAULT_BRIGHTNESS_SETTING 31
87#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
88
89/* Define this if you have a software controlled poweroff */
90#define HAVE_SW_POWEROFF
91
92/* The number of bytes reserved for loadable codecs */
93#define CODEC_SIZE 0x100000
94
95/* The number of bytes reserved for loadable plugins */
96#define PLUGIN_BUFFER_SIZE 0x80000
97
98/* TODO: Figure out real values */
99#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */
100#define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */
101#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */
102#define BATTERY_CAPACITY_INC 10 /* capacity increment */
103#define BATTERY_TYPES_COUNT 1 /* only one type */
104
105#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
106
107/* Hardware controlled charging with monitoring */
108#define CONFIG_CHARGING CHARGING_MONITOR
109
110/* USB On-the-go */
111#define CONFIG_USBOTG USBOTG_RK27XX
112
113/* enable these for the experimental usb stack */
114#define HAVE_USBSTACK
115
116#define USE_ROCKBOX_USB
117#define USB_VENDOR_ID 0x071b
118#define USB_PRODUCT_ID 0x3202
119#define HAVE_BOOTLOADER_USB_MODE
120
121/* Define this if your LCD can set contrast */
122/* #define HAVE_LCD_CONTRAST */
123
124/* The exact type of CPU */
125#define CONFIG_CPU RK27XX
126
127/* I2C interface */
128#define CONFIG_I2C I2C_RK27XX
129
130/* Define this to the CPU frequency */
131#define CPU_FREQ 200000000
132
133/* define this if the hardware can be powered off while charging */
134/* #define HAVE_POWEROFF_WHILE_CHARGING */
135
136/* Offset ( in the firmware file's header ) to the file CRC */
137#define FIRMWARE_OFFSET_FILE_CRC 0
138
139/* Offset ( in the firmware file's header ) to the real data */
140#define FIRMWARE_OFFSET_FILE_DATA 8
141
142#define STORAGE_NEEDS_ALIGN
143
144/* Define this if you have adjustable CPU frequency */
145#define HAVE_ADJUSTABLE_CPU_FREQ
146
147/* Virtual LED (icon) */
148#define CONFIG_LED LED_VIRTUAL
149
150#define RKW_FORMAT
151#define BOOTFILE_EXT "rkw"
152#define BOOTFILE "rockbox." BOOTFILE_EXT
153#define BOOTDIR "/.rockbox"
diff --git a/firmware/export/config/hifietma8c.h b/firmware/export/config/hifietma8c.h
new file mode 100644
index 0000000000..4e2d605523
--- /dev/null
+++ b/firmware/export/config/hifietma8c.h
@@ -0,0 +1,153 @@
1/*
2 * This config file is for HiFi E.T. MA8 reference design
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 91
7
8#define MODEL_NAME "HiFi E.T. MA8C"
9
10/* define the bitmask of hardware sample rates */
11#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_48 | SAMPR_CAP_44 | \
12 SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \
13 SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
14
15#define HAVE_PCM1792_CODEC
16
17#define CODEC_SLAVE
18/* define this if you have a bitmap LCD display */
19#define HAVE_LCD_BITMAP
20
21/* define this if you can flip your LCD */
22/* #define HAVE_LCD_FLIP */
23
24/* define this if you have a colour LCD */
25#define HAVE_LCD_COLOR
26
27/* define this if you want album art for this target */
28#define HAVE_ALBUMART
29
30/* define this to enable bitmap scaling */
31#define HAVE_BMP_SCALING
32
33/* define this to enable JPEG decoding */
34#define HAVE_JPEG
35
36/* define this if you can invert the colours on your LCD */
37/* #define HAVE_LCD_INVERT */
38
39/* define this if you have access to the quickscreen */
40#define HAVE_QUICKSCREEN
41
42/* define this if you would like tagcache to build on this target */
43#define HAVE_TAGCACHE
44
45/* define this if you have a flash memory storage */
46#define HAVE_FLASH_STORAGE
47
48#define CONFIG_STORAGE (STORAGE_SD | STORAGE_NAND)
49
50#define CONFIG_NAND NAND_RK27XX
51#define HAVE_SW_TONE_CONTROLS
52
53/* commented for now */
54/* #define HAVE_HOTSWAP */
55
56#define NUM_DRIVES 2
57#define SECTOR_SIZE 512
58
59/* for small(ish) SD cards */
60#define HAVE_FAT16SUPPORT
61
62/* LCD dimensions */
63#define LCD_WIDTH 320
64#define LCD_HEIGHT 240
65#define LCD_DEPTH 16 /* pseudo 262.144 colors */
66#define LCD_PIXELFORMAT RGB565 /* rgb565 */
67
68/* Define this if your LCD can be enabled/disabled */
69#define HAVE_LCD_ENABLE
70
71#define CONFIG_KEYPAD MA_PAD
72
73/* Define this to enable morse code input */
74#define HAVE_MORSE_INPUT
75
76/* Define this if you do software codec */
77#define CONFIG_CODEC SWCODEC
78
79#define CONFIG_LCD LCD_ILI9342C
80
81/* Define this for LCD backlight available */
82#define HAVE_BACKLIGHT
83#define HAVE_BACKLIGHT_BRIGHTNESS
84#define MIN_BRIGHTNESS_SETTING 0
85#define MAX_BRIGHTNESS_SETTING 31
86#define DEFAULT_BRIGHTNESS_SETTING 31
87#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
88
89/* Define this if you have a software controlled poweroff */
90#define HAVE_SW_POWEROFF
91
92/* The number of bytes reserved for loadable codecs */
93#define CODEC_SIZE 0x100000
94
95/* The number of bytes reserved for loadable plugins */
96#define PLUGIN_BUFFER_SIZE 0x80000
97
98/* TODO: Figure out real values */
99#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */
100#define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */
101#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */
102#define BATTERY_CAPACITY_INC 10 /* capacity increment */
103#define BATTERY_TYPES_COUNT 1 /* only one type */
104
105#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
106
107/* Hardware controlled charging with monitoring */
108#define CONFIG_CHARGING CHARGING_MONITOR
109
110/* USB On-the-go */
111#define CONFIG_USBOTG USBOTG_RK27XX
112
113/* enable these for the experimental usb stack */
114#define HAVE_USBSTACK
115
116#define USE_ROCKBOX_USB
117#define USB_VENDOR_ID 0x071b
118#define USB_PRODUCT_ID 0x3202
119#define HAVE_BOOTLOADER_USB_MODE
120
121/* Define this if your LCD can set contrast */
122/* #define HAVE_LCD_CONTRAST */
123
124/* The exact type of CPU */
125#define CONFIG_CPU RK27XX
126
127/* I2C interface */
128#define CONFIG_I2C I2C_RK27XX
129
130/* Define this to the CPU frequency */
131#define CPU_FREQ 200000000
132
133/* define this if the hardware can be powered off while charging */
134/* #define HAVE_POWEROFF_WHILE_CHARGING */
135
136/* Offset ( in the firmware file's header ) to the file CRC */
137#define FIRMWARE_OFFSET_FILE_CRC 0
138
139/* Offset ( in the firmware file's header ) to the real data */
140#define FIRMWARE_OFFSET_FILE_DATA 8
141
142#define STORAGE_NEEDS_ALIGN
143
144/* Define this if you have adjustable CPU frequency */
145#define HAVE_ADJUSTABLE_CPU_FREQ
146
147/* Virtual LED (icon) */
148#define CONFIG_LED LED_VIRTUAL
149
150#define RKW_FORMAT
151#define BOOTFILE_EXT "rkw"
152#define BOOTFILE "rockbox." BOOTFILE_EXT
153#define BOOTDIR "/.rockbox"
diff --git a/firmware/export/pcm1792.h b/firmware/export/pcm1792.h
new file mode 100644
index 0000000000..917599edbf
--- /dev/null
+++ b/firmware/export/pcm1792.h
@@ -0,0 +1,142 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 *
11 * Copyright (c) 2013 Andrew Ryabinin
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
23#ifndef _PCM1792_H
24#define _PCM1792_H
25
26#define PCM1792_VOLUME_MIN -1270
27#define PCM1792_VOLUME_MAX 0
28
29#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP)
30AUDIOHW_SETTING(VOLUME, "dB", 0, 1, PCM1792_VOLUME_MIN/10, PCM1792_VOLUME_MAX/10, 0)
31AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 1, 0)
32
33#define PCM1792_REG(x) (((x)&0x1f)<<8)
34
35/**
36 * Register #18
37 */
38/* Attenuation Load Control */
39#define PCM1792_ATLD_OFF (0<<7)
40#define PCM1792_ATLD_ON (1<<7)
41
42/* Audio Interface Data Format */
43#define PCM1792_FMT_16_RJ (0<<4) /* 16-bit standard format, right-justified data */
44#define PCM1792_FMT_20_RJ (1<<4) /* 20-bit standard format, right-justified data */
45#define PCM1792_FMT_24_RJ (2<<4) /* 24-bit standard format, right-justified data */
46#define PCM1792_FMT_24_MSB_I2S (3<<4) /* 24-bit MSB-first, left-justified format data */
47#define PCM1792_FMT_16_I2S (4<<4) /* 16-bit I2S format data */
48#define PCM1792_FMT_24_I2S (5<<4) /* 24-bit I2S format data */
49
50/* Sampling Frequency Selection for the De-Emphasis Function */
51#define PCM1792_DMF_DISABLE (0<<2)
52#define PCM1792_DMF_48 (1<<2)
53#define PCM1792_DMF_44 (2<<2)
54#define PCM1792_DMF_32 (2<<2)
55
56/* Digital De-Emphasis Control */
57#define PCM1792_DME_OFF (0<<1)
58#define PCM1792_DME_ON (1<<1)
59
60/* Soft Mute Control */
61#define PCM1792_MUTE_OFF (0<<0)
62#define PCM1792_MUTE_ON (1<<0)
63
64
65/**
66 * Register #19
67 */
68/* Output Phase Reversal */
69#define PCM1792_REV_OFF (0<<7)
70#define PCM1792_REV_ON (1<<7)
71
72/* Attenuation Rate Select */
73#define PCM1792_ATS_DIV1 (0<<5)
74#define PCM1792_ATS_DIV2 (1<<5)
75#define PCM1792_ATS_DIV4 (2<<5)
76#define PCM1792_ATS_DIV8 (4<<5)
77
78/* DAC Operation Control */
79#define PCM1792_OPE_ON (0<<4)
80#define PCM1792_OPE_OFF (1<<4)
81
82/* Stereo DF Bypass Mode Select */
83#define PCM1792_DFMS_MONO (0<<2)
84#define PCM1792_DFMS_STERO (1<<2)
85
86/* Digital Filter Rolloff Control */
87#define PCM1792_FLT_SHARP (0<<1)
88#define PCM1792_FLT_SLOW (1<<1)
89
90/* Infinite Zero Detect Mute Control */
91#define PCM1792_INZD_OFF (0<<0)
92#define PCM1792_INZD_ON (1<<0)
93
94
95/**
96 * Register #20
97 */
98/* System Reset Control */
99#define PCM1792_SRST_NORMAL (0<<6)
100#define PCM1792_SRST_RESET (1<<6)
101
102/* DSD Interface Mode Control */
103#define PCM1792_DSD_OFF (0<<5)
104#define PCM1792_DSD_ON (1<<5)
105
106/* Digital Filter Bypass (or Through Mode) Control */
107#define PCM1792_DFTH_ENABLE (0<<4) /* Digital filter enabled */
108#define PCM1792_DFTH_BYPASS (1<<4) /* Digital filter bypassed
109 for external digital filter */
110
111/* Monaural Mode Selection */
112#define PCM1792_STEREO (0<<3)
113#define PCM1792_MONO (1<<3)
114
115/* Channel Selection for Monaural Mode */
116#define PCM1792_CHSL_L (0<<2)
117#define PCM1792_CHSL_R (1<<2)
118
119/* Delta-Sigma Oversampling Rate Selection */
120#define PCM1792_OS_64 (0<<0)
121#define PCM1792_OS_32 (1<<0)
122#define PCM1792_OS_128 (2<<0)
123
124/**
125 * Register #21
126 */
127/* DSD Zero Output Enable */
128#define PCM1792_DZ_DISABLE (0<<1)
129#define PCM1792_DZ_EVEN (1<<1) /* Even pattern detect */
130#define PCM1792_DZ_96H (2<<1) /* 96h pattern detect */
131
132/* PCM Zero Output Enable */
133#define PCM1792_PCMZ_OFF (0<<0)
134#define PCM1792_PCMZ_ON (1<<0)
135
136void audiohw_mute(void);
137void pcm1792_set_ml(const int);
138void pcm1792_set_mc(const int);
139void pcm1792_set_md(const int);
140void pcm1792_set_ml_dir(const int);
141
142#endif
diff --git a/firmware/target/arm/rk27xx/backlight-rk27xx.c b/firmware/target/arm/rk27xx/backlight-rk27xx.c
index 8c10d7af2a..5d92cd827b 100644
--- a/firmware/target/arm/rk27xx/backlight-rk27xx.c
+++ b/firmware/target/arm/rk27xx/backlight-rk27xx.c
@@ -61,7 +61,7 @@ static const unsigned short lin_brightness[] = {
61 562, 579, 596, 616, 637, 660, 684, 711, 61 562, 579, 596, 616, 637, 660, 684, 711,
62 739, 770, 802, 837, 874, 914, 955, 1000 62 739, 770, 802, 837, 874, 914, 955, 1000
63}; 63};
64#elif defined(MA9) || defined(MA9C) 64#elif defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C)
65static const unsigned short lin_brightness[] = { 65static const unsigned short lin_brightness[] = {
66 2, 4, 7, 10, 15, 21, 28, 36, 66 2, 4, 7, 10, 15, 21, 28, 36,
67 46, 58, 72, 87, 104, 124, 146, 171, 67 46, 58, 72, 87, 104, 124, 146, 171,
diff --git a/firmware/target/arm/rk27xx/ma/audio-ma.c b/firmware/target/arm/rk27xx/ma/audio-ma.c
index 92cea307b2..f842824c26 100644
--- a/firmware/target/arm/rk27xx/ma/audio-ma.c
+++ b/firmware/target/arm/rk27xx/ma/audio-ma.c
@@ -29,21 +29,25 @@ void df1704_set_ml_dir(const int dir)
29{ 29{
30 pca9555_write_config(dir<<8, (1<<8)); 30 pca9555_write_config(dir<<8, (1<<8));
31} 31}
32void pcm1792_set_ml_dir (const int) __attribute__((alias("df1704_set_ml_dir")));
32 33
33void df1704_set_ml(const int val) 34void df1704_set_ml(const int val)
34{ 35{
35 pca9555_write_output(val<<8, 1<<8); 36 pca9555_write_output(val<<8, 1<<8);
36} 37}
38void pcm1792_set_ml (const int) __attribute__((alias("df1704_set_ml")));
37 39
38void df1704_set_mc(const int val) 40void df1704_set_mc(const int val)
39{ 41{
40 pca9555_write_output(val<<1, 1<<1); 42 pca9555_write_output(val<<1, 1<<1);
41} 43}
44void pcm1792_set_mc (const int) __attribute__((alias("df1704_set_mc")));
42 45
43void df1704_set_md(const int val) 46void df1704_set_md(const int val)
44{ 47{
45 pca9555_write_output(val<<0, 1<<0); 48 pca9555_write_output(val<<0, 1<<0);
46} 49}
50void pcm1792_set_md (const int) __attribute__((alias("df1704_set_md")));
47 51
48static void pop_ctrl(const int val) 52static void pop_ctrl(const int val)
49{ 53{
@@ -60,7 +64,6 @@ static void dac_enable(const int val)
60 pca9555_write_output(val<<4, 1<<4); 64 pca9555_write_output(val<<4, 1<<4);
61} 65}
62 66
63
64void audiohw_postinit(void) 67void audiohw_postinit(void)
65{ 68{
66 pop_ctrl(0); 69 pop_ctrl(0);
diff --git a/firmware/target/arm/rk27xx/sd-rk27xx.c b/firmware/target/arm/rk27xx/sd-rk27xx.c
index 39a4330d2a..9f6ba467b7 100644
--- a/firmware/target/arm/rk27xx/sd-rk27xx.c
+++ b/firmware/target/arm/rk27xx/sd-rk27xx.c
@@ -132,7 +132,7 @@ static inline bool card_detect_target(void)
132 return !(GPIO_PCDR & 0x80); 132 return !(GPIO_PCDR & 0x80);
133#elif defined(HM60X) || defined(HM801) 133#elif defined(HM60X) || defined(HM801)
134 return !(GPIO_PFDR & (1<<2)); 134 return !(GPIO_PFDR & (1<<2));
135#elif defined(MA9) || defined(MA9C) 135#elif defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C)
136 return (GPIO_PCDR & 0x80); 136 return (GPIO_PCDR & 0x80);
137#else 137#else
138#error "Unknown target" 138#error "Unknown target"