From a236d1a6e3ff97d86f0d82656139b97f3e717f90 Mon Sep 17 00:00:00 2001 From: Markinus Date: Thu, 30 Dec 2010 18:30:20 +0100 Subject: [PATCH] htcleo: add support for custom DSP like from desire. For normal use don't activate it, you need some other stuff for testing. --- arch/arm/configs/htcleo_defconfig | 9 +- arch/arm/mach-msm/Kconfig | 7 ++ arch/arm/mach-msm/Makefile | 4 + arch/arm/mach-msm/board-htcleo-acoustic.c | 4 + arch/arm/mach-msm/board-htcleo-audio.c | 4 + arch/arm/mach-msm/board-htcleo.h | 4 + .../mach-msm/include/mach/msm_iomap-8x50.h | 5 + .../mach-msm/include/mach/msm_qdsp6_audio.h | 5 +- .../include/mach/msm_qdsp6_audio_1550.h | 114 ++++++++++++++++++ arch/arm/mach-msm/qdsp6/dal_acdb.h | 5 + arch/arm/mach-msm/qdsp6/dal_adie.h | 4 + arch/arm/mach-msm/qdsp6/q6audio.c | 2 + arch/arm/mach-msm/qdsp6_1550/aac_in.c | 2 +- arch/arm/mach-msm/qdsp6_1550/audio_ctl.c | 2 +- arch/arm/mach-msm/qdsp6_1550/dal.h | 6 + arch/arm/mach-msm/qdsp6_1550/dal_audio.h | 2 +- arch/arm/mach-msm/qdsp6_1550/mp3.c | 2 +- arch/arm/mach-msm/qdsp6_1550/pcm_in.c | 2 +- arch/arm/mach-msm/qdsp6_1550/pcm_out.c | 2 +- arch/arm/mach-msm/qdsp6_1550/q6audio.c | 2 +- arch/arm/mach-msm/qdsp6_1550/qcelp_in.c | 2 +- 21 files changed, 173 insertions(+), 16 deletions(-) create mode 100644 arch/arm/mach-msm/include/mach/msm_qdsp6_audio_1550.h diff --git a/arch/arm/configs/htcleo_defconfig b/arch/arm/configs/htcleo_defconfig index 4529543d..2d8a54f8 100644 --- a/arch/arm/configs/htcleo_defconfig +++ b/arch/arm/configs/htcleo_defconfig @@ -231,6 +231,7 @@ CONFIG_MSM_DEBUG_UART_NONE=y # CONFIG_MACH_MAHIMAHI is not set # CONFIG_MACH_BRAVO is not set CONFIG_MACH_HTCLEO=y +# CONFIG_USING_BRAVOS_DSP is not set # CONFIG_HTCLEO_BLINK_AT_BOOT is not set # CONFIG_MACH_PASSIONC is not set # CONFIG_MACH_BRAVOC is not set @@ -1649,7 +1650,7 @@ CONFIG_INOTIFY_USER=y # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set -# CONFIG_FUSE_FS is not set +CONFIG_FUSE_FS=m # # Caches @@ -1722,7 +1723,7 @@ CONFIG_NETWORK_FILESYSTEMS=y # CONFIG_NFS_FS is not set # CONFIG_NFSD is not set # CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set +CONFIG_CIFS=m # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set @@ -1732,7 +1733,7 @@ CONFIG_NETWORK_FILESYSTEMS=y # # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y -CONFIG_NLS=y +CONFIG_NLS=m CONFIG_NLS_DEFAULT="iso8859-1" CONFIG_NLS_CODEPAGE_437=y # CONFIG_NLS_CODEPAGE_737 is not set @@ -1771,7 +1772,7 @@ CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_UTF8 is not set +CONFIG_NLS_UTF8=m # CONFIG_DLM is not set # diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 5f9c3a72..d821e478 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig @@ -282,6 +282,13 @@ config MACH_HTCLEO help Select this to support the HTC Leo device +config USING_BRAVOS_DSP + depends on MACH_HTCLEO + default n + bool "Bravos DSP for Leo" + help + Enable this if you use Bravos DSP on a Leo + config HTCLEO_BLINK_AT_BOOT depends on MACH_HTCLEO default n diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index 5f3a5b58..a8f31f3a 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile @@ -59,7 +59,11 @@ obj-$(CONFIG_MSM_ADSP) += qdsp5/ obj-$(CONFIG_MSM_ADSP_COMP) += qdsp5_comp/ obj-$(CONFIG_MSM7KV2_AUDIO) += qdsp5v2/ ifdef CONFIG_MSM_AMSS_VERSION_1550 +ifdef CONFIG_USING_BRAVOS_DSP +obj-$(CONFIG_QSD_AUDIO) += qdsp6/ +else obj-$(CONFIG_QSD_AUDIO) += qdsp6_1550/ +endif else obj-$(CONFIG_QSD_AUDIO) += qdsp6/ endif diff --git a/arch/arm/mach-msm/board-htcleo-acoustic.c b/arch/arm/mach-msm/board-htcleo-acoustic.c index 2760e847..fd7d3767 100644 --- a/arch/arm/mach-msm/board-htcleo-acoustic.c +++ b/arch/arm/mach-msm/board-htcleo-acoustic.c @@ -28,7 +28,11 @@ #include #include #include +#if defined(CONFIG_USING_BRAVOS_DSP) #include +#else +#include +#endif #include "smd_private.h" #include "dex_comm.h" diff --git a/arch/arm/mach-msm/board-htcleo-audio.c b/arch/arm/mach-msm/board-htcleo-audio.c index 9fac3eb2..bf6d0021 100644 --- a/arch/arm/mach-msm/board-htcleo-audio.c +++ b/arch/arm/mach-msm/board-htcleo-audio.c @@ -15,7 +15,11 @@ #include #include +#if defined(CONFIG_USING_BRAVOS_DSP) #include +#else +#include +#endif #include #include #include diff --git a/arch/arm/mach-msm/board-htcleo.h b/arch/arm/mach-msm/board-htcleo.h index 7e629764..c72a4ce1 100644 --- a/arch/arm/mach-msm/board-htcleo.h +++ b/arch/arm/mach-msm/board-htcleo.h @@ -20,7 +20,11 @@ #define MSM_EBI1_BANK0_BASE 0x11800000 //#define MSM_EBI1_BANK0_SIZE 0x1E800000 /* 488MB */ +#if defined(CONFIG_USING_BRAVOS_DSP) +#define MSM_EBI1_BANK0_SIZE 0x1CFC0000 /* 488MB - DESIRE DSP - 0x00040000 RAM CONSOLE*/ +#else #define MSM_EBI1_BANK0_SIZE 0x1E7C0000 /* 488MB - 0x00040000 RAM CONSOLE*/ +#endif /* Don't change that */ #define MSM_SMI_BASE 0x00000000 diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h index 80d6f416..32289fd1 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h @@ -168,7 +168,12 @@ // but is required to make early_ramconsole work. // These values must match the values used in // the defconfig. + #define MSM_RAM_CONSOLE_BASE IOMEM(0xF9100000) +#if defined(CONFIG_USING_BRAVOS_DSP) +#define MSM_RAM_CONSOLE_PHYS 0x2E7C0000 +#else #define MSM_RAM_CONSOLE_PHYS 0x2FFC0000 +#endif #define MSM_RAM_CONSOLE_SIZE 0x00040000 diff --git a/arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h b/arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h index 4f3c4a5b..ca5e735e 100644 --- a/arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h +++ b/arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h @@ -33,9 +33,7 @@ struct audio_client { int dsp_buf; /* next buffer the DSP will touch */ int running; int session; - - int open_done; - int open_status; + wait_queue_head_t wait; struct dal_client *client; @@ -93,7 +91,6 @@ int q6audio_set_tx_mute(int mute); int q6audio_reinit_acdb(char* filename); int q6audio_update_acdb(uint32_t id_src, uint32_t id_dst); int q6audio_set_rx_volume(int level); -int q6audio_set_rx_mute(int mute); int q6audio_set_stream_volume(struct audio_client *ac, int vol); struct q6audio_analog_ops { diff --git a/arch/arm/mach-msm/include/mach/msm_qdsp6_audio_1550.h b/arch/arm/mach-msm/include/mach/msm_qdsp6_audio_1550.h new file mode 100644 index 00000000..4f3c4a5b --- /dev/null +++ b/arch/arm/mach-msm/include/mach/msm_qdsp6_audio_1550.h @@ -0,0 +1,114 @@ +/* arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h + * + * Copyright (C) 2009 Google, Inc. + * Author: Brian Swetland + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _MACH_MSM_QDSP6_Q6AUDIO_ +#define _MACH_MSM_QDSP6_Q6AUDIO_ + +#define AUDIO_FLAG_READ 0 +#define AUDIO_FLAG_WRITE 1 + +struct audio_buffer { + dma_addr_t phys; + void *data; + uint32_t size; + uint32_t used; /* 1 = CPU is waiting for DSP to consume this buf */ +}; + +struct audio_client { + struct audio_buffer buf[2]; + int cpu_buf; /* next buffer the CPU will touch */ + int dsp_buf; /* next buffer the DSP will touch */ + int running; + int session; + + int open_done; + int open_status; + wait_queue_head_t wait; + struct dal_client *client; + + int cb_status; + uint32_t flags; +}; + +#define Q6_HW_HANDSET 0 +#define Q6_HW_HEADSET 1 +#define Q6_HW_SPEAKER 2 +#define Q6_HW_TTY 3 +#define Q6_HW_BT_SCO 4 +#define Q6_HW_BT_A2DP 5 + +#define Q6_HW_COUNT 6 + +struct q6_hw_info { + int min_gain; + int max_gain; +}; + +/* Obtain a 16bit signed, interleaved audio channel of the specified + * rate (Hz) and channels (1 or 2), with two buffers of bufsz bytes. + */ +struct audio_client *q6audio_open_pcm(uint32_t bufsz, uint32_t rate, + uint32_t channels, uint32_t flags, + uint32_t acdb_id); + +struct audio_client *q6voice_open(uint32_t flags, uint32_t acdb_id); + +struct audio_client *q6audio_open_mp3(uint32_t bufsz, uint32_t rate, + uint32_t channels, uint32_t acdb_id); + +struct audio_client *q6fm_open(void); + +struct audio_client *q6audio_open_aac(uint32_t bufsz, uint32_t rate, + uint32_t flags, void *data, uint32_t acdb_id); + +struct audio_client *q6audio_open_qcelp(uint32_t bufsz, uint32_t rate, + void *data, uint32_t acdb_id); + +int q6audio_close(struct audio_client *ac); +int q6voice_close(struct audio_client *ac); +int q6audio_mp3_close(struct audio_client *ac); +int q6fm_close(struct audio_client *ac); +int q6audio_aac_close(struct audio_client *ac); +int q6audio_qcelp_close(struct audio_client *ac); + +int q6audio_read(struct audio_client *ac, struct audio_buffer *ab); +int q6audio_write(struct audio_client *ac, struct audio_buffer *ab); +int q6audio_async(struct audio_client *ac); + +int q6audio_do_routing(uint32_t route, uint32_t acdb_id); +int q6audio_set_tx_mute(int mute); +int q6audio_reinit_acdb(char* filename); +int q6audio_update_acdb(uint32_t id_src, uint32_t id_dst); +int q6audio_set_rx_volume(int level); +int q6audio_set_rx_mute(int mute); +int q6audio_set_stream_volume(struct audio_client *ac, int vol); + +struct q6audio_analog_ops { + void (*init)(void); + void (*speaker_enable)(int en); + void (*headset_enable)(int en); + void (*receiver_enable)(int en); + void (*bt_sco_enable)(int en); + void (*int_mic_enable)(int en); + void (*ext_mic_enable)(int en); + void (*i2s_enable)(int en); + int (*get_rx_vol)(uint8_t hw, int level); +}; + +void q6audio_register_analog_ops(struct q6audio_analog_ops *ops); +void q6audio_set_acdb_file(char* filename); + +#endif diff --git a/arch/arm/mach-msm/qdsp6/dal_acdb.h b/arch/arm/mach-msm/qdsp6/dal_acdb.h index 0e95b3b8..ac5b0eb9 100644 --- a/arch/arm/mach-msm/qdsp6/dal_acdb.h +++ b/arch/arm/mach-msm/qdsp6/dal_acdb.h @@ -27,7 +27,12 @@ */ #define ACDB_DAL_DEVICE 0x02000069 + +#if defined(CONFIG_MACH_HTCLEO) +#define ACDB_DAL_PORT "SMD_DAL00" +#else #define ACDB_DAL_PORT "SMD_DAL_AM_AUD" +#endif #define ACDB_OP_IOCTL DAL_OP_FIRST_DEVICE_API diff --git a/arch/arm/mach-msm/qdsp6/dal_adie.h b/arch/arm/mach-msm/qdsp6/dal_adie.h index b7f58456..9c337630 100644 --- a/arch/arm/mach-msm/qdsp6/dal_adie.h +++ b/arch/arm/mach-msm/qdsp6/dal_adie.h @@ -32,7 +32,11 @@ #include "dal.h" #define ADIE_DAL_DEVICE 0x02000029 +#if defined(CONFIG_MACH_HTCLEO) +#define ADIE_DAL_PORT "SMD_DAL00" +#else #define ADIE_DAL_PORT "SMD_DAL_AM_AUD" +#endif enum { ADIE_OP_GET_NUM_PATHS = DAL_OP_FIRST_DEVICE_API, diff --git a/arch/arm/mach-msm/qdsp6/q6audio.c b/arch/arm/mach-msm/qdsp6/q6audio.c index 2df5b244..958b02c8 100644 --- a/arch/arm/mach-msm/qdsp6/q6audio.c +++ b/arch/arm/mach-msm/qdsp6/q6audio.c @@ -342,7 +342,9 @@ static int audio_ioctl(struct audio_client *ac, void *ptr, uint32_t len) hdr->src = AUDIO_ADDR(ac->session, 0, AUDIO_DOMAIN_MODEM); hdr->context = ac->session; ac->cb_status = -EBUSY; + pr_info("DAL CALL OPCODE: %d\n", hdr->opcode); r = dal_call(ac->client, AUDIO_OP_CONTROL, 5, ptr, len, &tmp, sizeof(tmp)); + pr_info("DAL CALL RET: %d\n", r); if (r != 4) return -EIO; if (!wait_event_timeout(ac->wait, (ac->cb_status != -EBUSY), 5*HZ)) { diff --git a/arch/arm/mach-msm/qdsp6_1550/aac_in.c b/arch/arm/mach-msm/qdsp6_1550/aac_in.c index 5c7042bc..9b9f1c46 100644 --- a/arch/arm/mach-msm/qdsp6_1550/aac_in.c +++ b/arch/arm/mach-msm/qdsp6_1550/aac_in.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #define BUFSZ (4096) #define DMASZ (BUFSZ * 2) diff --git a/arch/arm/mach-msm/qdsp6_1550/audio_ctl.c b/arch/arm/mach-msm/qdsp6_1550/audio_ctl.c index 8606f183..eaf5a942 100644 --- a/arch/arm/mach-msm/qdsp6_1550/audio_ctl.c +++ b/arch/arm/mach-msm/qdsp6_1550/audio_ctl.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include #define BUFSZ (0) diff --git a/arch/arm/mach-msm/qdsp6_1550/dal.h b/arch/arm/mach-msm/qdsp6_1550/dal.h index f7cd6dd0..e6b84a4b 100644 --- a/arch/arm/mach-msm/qdsp6_1550/dal.h +++ b/arch/arm/mach-msm/qdsp6_1550/dal.h @@ -19,6 +19,12 @@ struct dal_client; +struct dal_info { + uint32_t size; + uint32_t version; + char name[32]; +}; + typedef void (*dal_event_func_t)(void *data, int len, void *cookie); struct dal_client *dal_attach(uint32_t device_id, const char *name, dal_event_func_t func, void *cookie); diff --git a/arch/arm/mach-msm/qdsp6_1550/dal_audio.h b/arch/arm/mach-msm/qdsp6_1550/dal_audio.h index f9ea9c72..cf21a239 100644 --- a/arch/arm/mach-msm/qdsp6_1550/dal_audio.h +++ b/arch/arm/mach-msm/qdsp6_1550/dal_audio.h @@ -31,7 +31,7 @@ #include "dal_audio_format.h" #include "dal.h" -#include +#include #define AUDIO_DAL_DEVICE 0x02000028 #define AUDIO_DAL_PORT "DSP_DAL_AQ_AUD" diff --git a/arch/arm/mach-msm/qdsp6_1550/mp3.c b/arch/arm/mach-msm/qdsp6_1550/mp3.c index 92e8f0f0..c04fc5d1 100644 --- a/arch/arm/mach-msm/qdsp6_1550/mp3.c +++ b/arch/arm/mach-msm/qdsp6_1550/mp3.c @@ -24,7 +24,7 @@ #include -#include +#include #include "dal_audio.h" #define BUFSZ (8192) diff --git a/arch/arm/mach-msm/qdsp6_1550/pcm_in.c b/arch/arm/mach-msm/qdsp6_1550/pcm_in.c index 80ce9ddd..c580527f 100644 --- a/arch/arm/mach-msm/qdsp6_1550/pcm_in.c +++ b/arch/arm/mach-msm/qdsp6_1550/pcm_in.c @@ -24,7 +24,7 @@ #include -#include +#include #define BUFSZ (4096) #define DMASZ (BUFSZ * 2) diff --git a/arch/arm/mach-msm/qdsp6_1550/pcm_out.c b/arch/arm/mach-msm/qdsp6_1550/pcm_out.c index 345943fa..b3fbc8e6 100644 --- a/arch/arm/mach-msm/qdsp6_1550/pcm_out.c +++ b/arch/arm/mach-msm/qdsp6_1550/pcm_out.c @@ -24,7 +24,7 @@ #include -#include +#include #include "dal_audio.h" #if 0 diff --git a/arch/arm/mach-msm/qdsp6_1550/q6audio.c b/arch/arm/mach-msm/qdsp6_1550/q6audio.c index 3710682e..a972b97d 100644 --- a/arch/arm/mach-msm/qdsp6_1550/q6audio.c +++ b/arch/arm/mach-msm/qdsp6_1550/q6audio.c @@ -31,7 +31,7 @@ #include "dal_audio_format.h" #include "dal_acdb.h" #include "dal_adie.h" -#include +#include #include #include #include diff --git a/arch/arm/mach-msm/qdsp6_1550/qcelp_in.c b/arch/arm/mach-msm/qdsp6_1550/qcelp_in.c index e5843181..50c74259 100644 --- a/arch/arm/mach-msm/qdsp6_1550/qcelp_in.c +++ b/arch/arm/mach-msm/qdsp6_1550/qcelp_in.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #define BUFSZ (734)