From 7e39524ecb34deaf0caa042aeca497a9c38536cd Mon Sep 17 00:00:00 2001 From: Andrew Ryabinin Date: Sun, 2 Jun 2013 23:03:26 +0400 Subject: 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 --- bootloader/SOURCES | 2 +- firmware/SOURCES | 4 +- firmware/drivers/audio/pcm1792.c | 133 ++++++++++++++++++++++ firmware/export/audiohw.h | 2 + firmware/export/config.h | 4 + firmware/export/config/hifietma8.h | 153 ++++++++++++++++++++++++++ firmware/export/config/hifietma8c.h | 153 ++++++++++++++++++++++++++ firmware/export/pcm1792.h | 142 ++++++++++++++++++++++++ firmware/target/arm/rk27xx/backlight-rk27xx.c | 2 +- firmware/target/arm/rk27xx/ma/audio-ma.c | 5 +- firmware/target/arm/rk27xx/sd-rk27xx.c | 2 +- tools/configure | 50 ++++++++- 12 files changed, 645 insertions(+), 7 deletions(-) create mode 100644 firmware/drivers/audio/pcm1792.c create mode 100644 firmware/export/config/hifietma8.h create mode 100644 firmware/export/config/hifietma8c.h create mode 100644 firmware/export/pcm1792.h diff --git a/bootloader/SOURCES b/bootloader/SOURCES index 9db5965786..ffd1b402dc 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES @@ -68,7 +68,7 @@ show_logo.c #elif defined(MPIO_HD200) || defined(MPIO_HD300) mpio_hd200_hd300.c #elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \ - || defined(MA9) || defined(MA9C) + || defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) rk27xx.c show_logo.c #elif defined(SANSA_CONNECT) 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 drivers/audio/dummy_codec.c #elif defined (HAVE_DF1704_CODEC) drivers/audio/df1704.c +#elif defined (HAVE_PCM1792_CODEC) +drivers/audio/pcm1792.c #endif /* defined(HAVE_*) */ #else /* PLATFORM_HOSTED */ #if defined(SAMSUNG_YPR0) && defined(HAVE_AS3514) @@ -1745,7 +1747,7 @@ target/arm/rk27xx/hm801/powermgmt-hm801.c target/arm/rk27xx/hm801/power-hm801.c #endif -#if defined(MA9) || defined(MA9C) +#if defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) target/arm/rk27xx/ma/button-ma.c target/arm/rk27xx/ma/powermgmt-ma.c target/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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2013 Andrew Ryabinin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "system.h" +#include "pcm1792.h" +#include "config.h" +#include "audio.h" +#include "audiohw.h" + +/* pcm1792 registers initial values */ +#define REG18_INIT_VALUE (PCM1792_ATLD_OFF|PCM1792_FMT_16_I2S| \ + PCM1792_DMF_DISABLE|PCM1792_DME_OFF) + +#define REG19_INIT_VALUE (PCM1792_REV_ON|PCM1792_ATS_DIV1| \ + PCM1792_OPE_ON|PCM1792_DFMS_MONO| \ + PCM1792_FLT_SHARP|PCM1792_INZD_OFF) + +#define REG20_INIT_VALUE (PCM1792_SRST_NORMAL|PCM1792_DSD_OFF|\ + PCM1792_DFTH_ENABLE|PCM1792_STEREO|\ + PCM1792_OS_64) + +#define REG21_INIT_VALUE (PCM1792_DZ_DISABLE|PCM1792_PCMZ_ON) + + +static void pcm1792_write_reg(const int reg, const unsigned int value) +{ + int i; + + pcm1792_set_ml_dir(0); + pcm1792_set_md(1); + pcm1792_set_mc(0); + pcm1792_set_ml(0); + + for (i = (1<<15); i; i >>= 1) { + udelay(40); + pcm1792_set_mc(0); + + if ((reg|value) & i) { + pcm1792_set_md(1); + } else { + pcm1792_set_md(0); + } + + udelay(40); + pcm1792_set_mc(1); + } + + udelay(40); + pcm1792_set_ml(1); + pcm1792_set_mc(0); + udelay(130); + pcm1792_set_md(1); +} + +static int vol_tenthdb2hw(const int tdb) +{ + if (tdb < PCM1792_VOLUME_MIN) { + return 0; + } else if (tdb > PCM1792_VOLUME_MAX) { + return 0xff; + } else { + return (tdb/5+0xff); + } +} + + +void audiohw_init(void) +{ + pcm1792_write_reg(PCM1792_REG(18), REG18_INIT_VALUE); + pcm1792_write_reg(PCM1792_REG(19), REG19_INIT_VALUE); + pcm1792_write_reg(PCM1792_REG(20), REG20_INIT_VALUE); + pcm1792_write_reg(PCM1792_REG(21), REG21_INIT_VALUE); + + /* Left & Right volumes */ + pcm1792_write_reg(PCM1792_REG(16), 0xff); + pcm1792_write_reg(PCM1792_REG(17), 0xff); +} + +void audiohw_mute(void) +{ + pcm1792_write_reg(PCM1792_REG(18), REG18_INIT_VALUE|PCM1792_MUTE_ON); +} + +void audiohw_unmute(void) +{ + pcm1792_write_reg(PCM1792_REG(18), REG18_INIT_VALUE); +} + +void audiohw_preinit(void) +{ +} + +void audiohw_set_frequency(int fsel) +{ + (void)fsel; +} + +void audiohw_set_volume(int vol_l, int vol_r) +{ + pcm1792_write_reg(PCM1792_REG(16), vol_tenthdb2hw(vol_l)); + pcm1792_write_reg(PCM1792_REG(17), vol_tenthdb2hw(vol_r)); +} + +void audiohw_set_filter_roll_off(int value) +{ + if (value == 0) { + pcm1792_write_reg(PCM1792_REG(19), + REG19_INIT_VALUE + |PCM1792_FLT_SHARP); + } else { + pcm1792_write_reg(PCM1792_REG(19), + REG19_INIT_VALUE + |PCM1792_FLT_SLOW); + } +} 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 #include "dummy_codec.h" #elif defined(HAVE_DF1704_CODEC) #include "df1704.h" +#elif defined(HAVE_PCM1792_CODEC) +#include "pcm1792.h" #elif (CONFIG_PLATFORM & (PLATFORM_ANDROID | PLATFORM_MAEMO\ | PLATFORM_PANDORA | PLATFORM_SDL)) #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 */ #include "config/hifietma9.h" #elif defined(MA9C) #include "config/hifietma9c.h" +#elif defined(MA8) +#include "config/hifietma8.h" +#elif defined(MA8C) +#include "config/hifietma8c.h" #elif defined(SONY_NWZE370) #include "config/sonynwze370.h" #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 @@ +/* + * This config file is for HiFi E.T. MA8 reference design + */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 85 + +#define MODEL_NAME "HiFi E.T. MA8" + +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_48 | SAMPR_CAP_44 | \ + SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \ + SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) + +#define HAVE_PCM1792_CODEC + +#define CODEC_SLAVE +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you can flip your LCD */ +/* #define HAVE_LCD_FLIP */ + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you can invert the colours on your LCD */ +/* #define HAVE_LCD_INVERT */ + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +/* define this if you have a flash memory storage */ +#define HAVE_FLASH_STORAGE + +#define CONFIG_STORAGE (STORAGE_SD | STORAGE_NAND) + +#define CONFIG_NAND NAND_RK27XX +#define HAVE_SW_TONE_CONTROLS + +/* commented for now */ +/* #define HAVE_HOTSWAP */ + +#define NUM_DRIVES 2 +#define SECTOR_SIZE 512 + +/* for small(ish) SD cards */ +#define HAVE_FAT16SUPPORT + +/* LCD dimensions */ +#define LCD_WIDTH 320 +#define LCD_HEIGHT 240 +#define LCD_DEPTH 16 /* pseudo 262.144 colors */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ + +/* Define this if your LCD can be enabled/disabled */ +#define HAVE_LCD_ENABLE + +#define CONFIG_KEYPAD MA_PAD + +/* Define this to enable morse code input */ +#define HAVE_MORSE_INPUT + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +#define CONFIG_LCD LCD_ILI9342 + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS +#define MIN_BRIGHTNESS_SETTING 0 +#define MAX_BRIGHTNESS_SETTING 31 +#define DEFAULT_BRIGHTNESS_SETTING 31 +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x100000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +/* TODO: Figure out real values */ +#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 10 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE + +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR + +/* USB On-the-go */ +#define CONFIG_USBOTG USBOTG_RK27XX + +/* enable these for the experimental usb stack */ +#define HAVE_USBSTACK + +#define USE_ROCKBOX_USB +#define USB_VENDOR_ID 0x071b +#define USB_PRODUCT_ID 0x3202 +#define HAVE_BOOTLOADER_USB_MODE + +/* Define this if your LCD can set contrast */ +/* #define HAVE_LCD_CONTRAST */ + +/* The exact type of CPU */ +#define CONFIG_CPU RK27XX + +/* I2C interface */ +#define CONFIG_I2C I2C_RK27XX + +/* Define this to the CPU frequency */ +#define CPU_FREQ 200000000 + +/* define this if the hardware can be powered off while charging */ +/* #define HAVE_POWEROFF_WHILE_CHARGING */ + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 0 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 8 + +#define STORAGE_NEEDS_ALIGN + +/* Define this if you have adjustable CPU frequency */ +#define HAVE_ADJUSTABLE_CPU_FREQ + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +#define RKW_FORMAT +#define BOOTFILE_EXT "rkw" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#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 @@ +/* + * This config file is for HiFi E.T. MA8 reference design + */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 91 + +#define MODEL_NAME "HiFi E.T. MA8C" + +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_48 | SAMPR_CAP_44 | \ + SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \ + SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) + +#define HAVE_PCM1792_CODEC + +#define CODEC_SLAVE +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you can flip your LCD */ +/* #define HAVE_LCD_FLIP */ + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you can invert the colours on your LCD */ +/* #define HAVE_LCD_INVERT */ + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +/* define this if you have a flash memory storage */ +#define HAVE_FLASH_STORAGE + +#define CONFIG_STORAGE (STORAGE_SD | STORAGE_NAND) + +#define CONFIG_NAND NAND_RK27XX +#define HAVE_SW_TONE_CONTROLS + +/* commented for now */ +/* #define HAVE_HOTSWAP */ + +#define NUM_DRIVES 2 +#define SECTOR_SIZE 512 + +/* for small(ish) SD cards */ +#define HAVE_FAT16SUPPORT + +/* LCD dimensions */ +#define LCD_WIDTH 320 +#define LCD_HEIGHT 240 +#define LCD_DEPTH 16 /* pseudo 262.144 colors */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ + +/* Define this if your LCD can be enabled/disabled */ +#define HAVE_LCD_ENABLE + +#define CONFIG_KEYPAD MA_PAD + +/* Define this to enable morse code input */ +#define HAVE_MORSE_INPUT + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +#define CONFIG_LCD LCD_ILI9342C + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS +#define MIN_BRIGHTNESS_SETTING 0 +#define MAX_BRIGHTNESS_SETTING 31 +#define DEFAULT_BRIGHTNESS_SETTING 31 +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x100000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +/* TODO: Figure out real values */ +#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 10 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE + +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR + +/* USB On-the-go */ +#define CONFIG_USBOTG USBOTG_RK27XX + +/* enable these for the experimental usb stack */ +#define HAVE_USBSTACK + +#define USE_ROCKBOX_USB +#define USB_VENDOR_ID 0x071b +#define USB_PRODUCT_ID 0x3202 +#define HAVE_BOOTLOADER_USB_MODE + +/* Define this if your LCD can set contrast */ +/* #define HAVE_LCD_CONTRAST */ + +/* The exact type of CPU */ +#define CONFIG_CPU RK27XX + +/* I2C interface */ +#define CONFIG_I2C I2C_RK27XX + +/* Define this to the CPU frequency */ +#define CPU_FREQ 200000000 + +/* define this if the hardware can be powered off while charging */ +/* #define HAVE_POWEROFF_WHILE_CHARGING */ + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 0 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 8 + +#define STORAGE_NEEDS_ALIGN + +/* Define this if you have adjustable CPU frequency */ +#define HAVE_ADJUSTABLE_CPU_FREQ + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +#define RKW_FORMAT +#define BOOTFILE_EXT "rkw" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * + * Copyright (c) 2013 Andrew Ryabinin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _PCM1792_H +#define _PCM1792_H + +#define PCM1792_VOLUME_MIN -1270 +#define PCM1792_VOLUME_MAX 0 + +#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP) +AUDIOHW_SETTING(VOLUME, "dB", 0, 1, PCM1792_VOLUME_MIN/10, PCM1792_VOLUME_MAX/10, 0) +AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 1, 0) + +#define PCM1792_REG(x) (((x)&0x1f)<<8) + +/** + * Register #18 + */ +/* Attenuation Load Control */ +#define PCM1792_ATLD_OFF (0<<7) +#define PCM1792_ATLD_ON (1<<7) + +/* Audio Interface Data Format */ +#define PCM1792_FMT_16_RJ (0<<4) /* 16-bit standard format, right-justified data */ +#define PCM1792_FMT_20_RJ (1<<4) /* 20-bit standard format, right-justified data */ +#define PCM1792_FMT_24_RJ (2<<4) /* 24-bit standard format, right-justified data */ +#define PCM1792_FMT_24_MSB_I2S (3<<4) /* 24-bit MSB-first, left-justified format data */ +#define PCM1792_FMT_16_I2S (4<<4) /* 16-bit I2S format data */ +#define PCM1792_FMT_24_I2S (5<<4) /* 24-bit I2S format data */ + +/* Sampling Frequency Selection for the De-Emphasis Function */ +#define PCM1792_DMF_DISABLE (0<<2) +#define PCM1792_DMF_48 (1<<2) +#define PCM1792_DMF_44 (2<<2) +#define PCM1792_DMF_32 (2<<2) + +/* Digital De-Emphasis Control */ +#define PCM1792_DME_OFF (0<<1) +#define PCM1792_DME_ON (1<<1) + +/* Soft Mute Control */ +#define PCM1792_MUTE_OFF (0<<0) +#define PCM1792_MUTE_ON (1<<0) + + +/** + * Register #19 + */ +/* Output Phase Reversal */ +#define PCM1792_REV_OFF (0<<7) +#define PCM1792_REV_ON (1<<7) + +/* Attenuation Rate Select */ +#define PCM1792_ATS_DIV1 (0<<5) +#define PCM1792_ATS_DIV2 (1<<5) +#define PCM1792_ATS_DIV4 (2<<5) +#define PCM1792_ATS_DIV8 (4<<5) + +/* DAC Operation Control */ +#define PCM1792_OPE_ON (0<<4) +#define PCM1792_OPE_OFF (1<<4) + +/* Stereo DF Bypass Mode Select */ +#define PCM1792_DFMS_MONO (0<<2) +#define PCM1792_DFMS_STERO (1<<2) + +/* Digital Filter Rolloff Control */ +#define PCM1792_FLT_SHARP (0<<1) +#define PCM1792_FLT_SLOW (1<<1) + +/* Infinite Zero Detect Mute Control */ +#define PCM1792_INZD_OFF (0<<0) +#define PCM1792_INZD_ON (1<<0) + + +/** + * Register #20 + */ +/* System Reset Control */ +#define PCM1792_SRST_NORMAL (0<<6) +#define PCM1792_SRST_RESET (1<<6) + +/* DSD Interface Mode Control */ +#define PCM1792_DSD_OFF (0<<5) +#define PCM1792_DSD_ON (1<<5) + +/* Digital Filter Bypass (or Through Mode) Control */ +#define PCM1792_DFTH_ENABLE (0<<4) /* Digital filter enabled */ +#define PCM1792_DFTH_BYPASS (1<<4) /* Digital filter bypassed + for external digital filter */ + +/* Monaural Mode Selection */ +#define PCM1792_STEREO (0<<3) +#define PCM1792_MONO (1<<3) + +/* Channel Selection for Monaural Mode */ +#define PCM1792_CHSL_L (0<<2) +#define PCM1792_CHSL_R (1<<2) + +/* Delta-Sigma Oversampling Rate Selection */ +#define PCM1792_OS_64 (0<<0) +#define PCM1792_OS_32 (1<<0) +#define PCM1792_OS_128 (2<<0) + +/** + * Register #21 + */ +/* DSD Zero Output Enable */ +#define PCM1792_DZ_DISABLE (0<<1) +#define PCM1792_DZ_EVEN (1<<1) /* Even pattern detect */ +#define PCM1792_DZ_96H (2<<1) /* 96h pattern detect */ + +/* PCM Zero Output Enable */ +#define PCM1792_PCMZ_OFF (0<<0) +#define PCM1792_PCMZ_ON (1<<0) + +void audiohw_mute(void); +void pcm1792_set_ml(const int); +void pcm1792_set_mc(const int); +void pcm1792_set_md(const int); +void pcm1792_set_ml_dir(const int); + +#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[] = { 562, 579, 596, 616, 637, 660, 684, 711, 739, 770, 802, 837, 874, 914, 955, 1000 }; -#elif defined(MA9) || defined(MA9C) +#elif defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) static const unsigned short lin_brightness[] = { 2, 4, 7, 10, 15, 21, 28, 36, 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) { pca9555_write_config(dir<<8, (1<<8)); } +void pcm1792_set_ml_dir (const int) __attribute__((alias("df1704_set_ml_dir"))); void df1704_set_ml(const int val) { pca9555_write_output(val<<8, 1<<8); } +void pcm1792_set_ml (const int) __attribute__((alias("df1704_set_ml"))); void df1704_set_mc(const int val) { pca9555_write_output(val<<1, 1<<1); } +void pcm1792_set_mc (const int) __attribute__((alias("df1704_set_mc"))); void df1704_set_md(const int val) { pca9555_write_output(val<<0, 1<<0); } +void pcm1792_set_md (const int) __attribute__((alias("df1704_set_md"))); static void pop_ctrl(const int val) { @@ -60,7 +64,6 @@ static void dac_enable(const int val) pca9555_write_output(val<<4, 1<<4); } - void audiohw_postinit(void) { 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) return !(GPIO_PCDR & 0x80); #elif defined(HM60X) || defined(HM801) return !(GPIO_PFDR & (1<<2)); -#elif defined(MA9) || defined(MA9C) +#elif defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) return (GPIO_PCDR & 0x80); #else #error "Unknown target" diff --git a/tools/configure b/tools/configure index 368a18611d..328c54845e 100755 --- a/tools/configure +++ b/tools/configure @@ -1331,8 +1331,8 @@ cat <