From 907bac80691c7df5b5b57cbf27f91e8bb1dcf434 Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Fri, 13 Jul 2012 14:58:18 +0530 Subject: ARM: tegra: integration of slave mode support. Add configurability support for i2s parameters accross all board. ARM: tegra: board: add i2s params Add configurability support for i2s parameters accross all board files. Signed-off-by: Ankit Gupta Change-Id: If58788b5126280b7e1dc8c66e9c96d0e71229b5e Reviewed-on: http://git-master/r/111476 (cherry-picked from commit cac52867b0a0cad3b3c5bf46f08b0b94d0be2e02) ARM: tegra: include: add configurability support for i2s params. Add several variables for i2s configuration in platform data structure. Signed-off-by: Ankit Gupta Change-Id: Iea3930f308954471f170513234c2c02a8559ef98 Reviewed-on: http://git-master/r/111473 (cherry picked from commit 35e749770f6046fc82860f1152db2f5f579b9508) Reviewed-on: http://git-master/r/118071 Reviewed-by: Sumit Bhattacharya Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson --- arch/arm/mach-tegra/board-cardhu.c | 46 ++++++++++++++--- arch/arm/mach-tegra/board-enterprise.c | 57 ++++++++++++++-------- arch/arm/mach-tegra/board-harmony.c | 18 ++++++- arch/arm/mach-tegra/board-kai.c | 19 ++++++-- arch/arm/mach-tegra/board-ventana.c | 18 ++++++- arch/arm/mach-tegra/board-whistler.c | 32 +++++++++--- .../arm/mach-tegra/include/mach/tegra_asoc_pdata.h | 15 +++--- 7 files changed, 159 insertions(+), 46 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c index 80cab77df587..16ad11943533 100644 --- a/arch/arm/mach-tegra/board-cardhu.c +++ b/arch/arm/mach-tegra/board-cardhu.c @@ -2,6 +2,7 @@ * arch/arm/mach-tegra/board-cardhu.c * * Copyright (c) 2011-2012, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2011-2012, NVIDIA Corporation. * * 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 @@ -724,12 +725,25 @@ static struct platform_device tegra_rtc_device = { .num_resources = ARRAY_SIZE(tegra_rtc_resources), }; -static struct tegra_wm8903_platform_data cardhu_audio_wm8903_pdata = { +static struct tegra_asoc_platform_data cardhu_audio_wm8903_pdata = { .gpio_spkr_en = TEGRA_GPIO_SPKR_EN, .gpio_hp_det = TEGRA_GPIO_HP_DET, .gpio_hp_mute = -1, .gpio_int_mic_en = -1, .gpio_ext_mic_en = -1, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = -1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + }, }; static struct tegra_asoc_platform_data cardhu_audio_max98095_pdata = { @@ -738,6 +752,19 @@ static struct tegra_asoc_platform_data cardhu_audio_max98095_pdata = { .gpio_hp_mute = -1, .gpio_int_mic_en = -1, .gpio_ext_mic_en = -1, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = -1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + }, }; static struct platform_device cardhu_audio_wm8903_device = { @@ -763,14 +790,17 @@ static struct tegra_asoc_platform_data cardhu_audio_aic326x_pdata = { .gpio_int_mic_en = -1, .gpio_ext_mic_en = -1, /*defaults for Verbier-Cardhu board with TI AIC326X codec*/ - .audio_port_id = { - [HIFI_CODEC] = 0, - [BASEBAND] = -1, - [BT_SCO] = 3, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + .sample_size = 16, }, - .baseband_param = { - .rate = -1, - .channels = -1, + .i2s_param[BT_SCO] = { + .sample_size = 16, + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, }, }; diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c index f9e5b05e6d3c..f9791a7b0e48 100644 --- a/arch/arm/mach-tegra/board-enterprise.c +++ b/arch/arm/mach-tegra/board-enterprise.c @@ -467,8 +467,6 @@ static void __init enterprise_uart_init(void) ARRAY_SIZE(enterprise_uart_devices)); } - - static struct resource tegra_rtc_resources[] = { [0] = { .start = TEGRA_RTC_BASE, @@ -500,16 +498,27 @@ static struct tegra_asoc_platform_data enterprise_audio_pdata = { .gpio_hp_mute = -1, .gpio_int_mic_en = -1, .gpio_ext_mic_en = -1, - .debounce_time_hp = -1, + .debounce_time_hp = -1, /*defaults for Enterprise board*/ - .audio_port_id = { - [HIFI_CODEC] = 0, - [BASEBAND] = 2, - [BT_SCO] = 3, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + .sample_size = 16, }, - .baseband_param = { - .rate = 8000, - .channels = 1, + .i2s_param[BASEBAND] = { + .audio_port_id = 2, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + .sample_size = 16, + .rate = 8000, + .channels = 1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + .sample_size = 16, }, }; @@ -528,15 +537,25 @@ static struct tegra_asoc_platform_data enterprise_audio_aic326x_pdata = { .gpio_int_mic_en = -1, .gpio_ext_mic_en = -1, /*defaults for Verbier-Enterprise (E1197) board with TI AIC326X codec*/ - .audio_port_id = { - [HIFI_CODEC] = 0, - [BASEBAND] = 2, - [BT_SCO] = 3, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + .sample_size = 16, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = 2, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + .sample_size = 16, + .rate = 8000, + .channels = 1, }, - .baseband_param = { - .rate = 8000, - .channels = 1, - .bit_format = TEGRA_DAIFMT_DSP_A, + .i2s_param[BT_SCO] = { + .sample_size = 16, + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, }, }; @@ -849,7 +868,7 @@ static void enterprise_audio_init(void) tegra_get_board_info(&board_info); if (board_info.board_id == BOARD_E1197) - enterprise_audio_pdata.audio_port_id[HIFI_CODEC] = 1; + enterprise_audio_pdata.i2s_param[HIFI_CODEC].audio_port_id = 1; platform_add_devices(enterprise_audio_devices, ARRAY_SIZE(enterprise_audio_devices)); diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index dd14435cc17c..0e1dfe58b278 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c @@ -3,6 +3,7 @@ * * Copyright (C) 2010 Google, Inc. * Copyright (C) 2011 NVIDIA, Inc. + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -43,7 +44,7 @@ #include #include -#include +#include #include #include #include @@ -230,12 +231,25 @@ static void harmony_keys_init(void) tegra_gpio_enable(harmony_gpio_keys_buttons[i].gpio); } -static struct tegra_wm8903_platform_data harmony_audio_pdata = { +static struct tegra_asoc_platform_data harmony_audio_pdata = { .gpio_spkr_en = TEGRA_GPIO_SPKR_EN, .gpio_hp_det = TEGRA_GPIO_HP_DET, .gpio_hp_mute = -1, .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN, .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = -1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + }, }; static struct platform_device harmony_audio_device = { diff --git a/arch/arm/mach-tegra/board-kai.c b/arch/arm/mach-tegra/board-kai.c index 07fbccfd8138..83874f89d836 100644 --- a/arch/arm/mach-tegra/board-kai.c +++ b/arch/arm/mach-tegra/board-kai.c @@ -1,7 +1,7 @@ /* * arch/arm/mach-tegra/board-kai.c * - * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include #include @@ -575,12 +575,25 @@ static struct platform_device tegra_rtc_device = { .num_resources = ARRAY_SIZE(tegra_rtc_resources), }; -static struct tegra_rt5640_platform_data kai_audio_pdata = { +static struct tegra_asoc_platform_data kai_audio_pdata = { .gpio_spkr_en = TEGRA_GPIO_SPKR_EN, .gpio_hp_det = TEGRA_GPIO_HP_DET, .gpio_hp_mute = -1, .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN, .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = -1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + }, }; static struct platform_device kai_audio_device = { diff --git a/arch/arm/mach-tegra/board-ventana.c b/arch/arm/mach-tegra/board-ventana.c index c8c9ac49745f..4e01850ea40e 100644 --- a/arch/arm/mach-tegra/board-ventana.c +++ b/arch/arm/mach-tegra/board-ventana.c @@ -2,6 +2,7 @@ * arch/arm/mach-tegra/board-ventana.c * * Copyright (c) 2010-2011 NVIDIA Corporation. + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * 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 @@ -49,7 +50,7 @@ #include #include #include -#include +#include #include #include @@ -350,12 +351,25 @@ static struct platform_device tegra_camera = { .id = -1, }; -static struct tegra_wm8903_platform_data ventana_audio_pdata = { +static struct tegra_asoc_platform_data ventana_audio_pdata = { .gpio_spkr_en = TEGRA_GPIO_SPKR_EN, .gpio_hp_det = TEGRA_GPIO_HP_DET, .gpio_hp_mute = -1, .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN, .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = -1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + }, }; static struct platform_device ventana_audio_device = { diff --git a/arch/arm/mach-tegra/board-whistler.c b/arch/arm/mach-tegra/board-whistler.c index 4bd5ed8471d4..92fa6e502abe 100644 --- a/arch/arm/mach-tegra/board-whistler.c +++ b/arch/arm/mach-tegra/board-whistler.c @@ -352,12 +352,32 @@ static struct platform_device tegra_camera = { }; static struct tegra_asoc_platform_data whistler_audio_pdata = { - .gpio_spkr_en = -1, - .gpio_hp_det = TEGRA_GPIO_HP_DET, - .gpio_hp_mute = -1, - .gpio_int_mic_en = -1, - .gpio_ext_mic_en = -1, - .debounce_time_hp = 200, + .gpio_spkr_en = -1, + .gpio_hp_det = TEGRA_GPIO_HP_DET, + .gpio_hp_mute = -1, + .gpio_int_mic_en = -1, + .gpio_ext_mic_en = -1, + .debounce_time_hp = 200, + .i2s_param[HIFI_CODEC] = { + .audio_port_id = 0, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_I2S, + .sample_size = 16, + }, + .i2s_param[BASEBAND] = { + .audio_port_id = 2, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + .sample_size = 16, + .rate = 8000, + .channels = 1, + }, + .i2s_param[BT_SCO] = { + .sample_size = 16, + .audio_port_id = 3, + .is_i2s_master = 1, + .i2s_mode = TEGRA_DAIFMT_DSP_A, + }, }; static struct platform_device whistler_audio_aic326x_device = { diff --git a/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h b/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h index fff2fcc68269..7aada6940b39 100644 --- a/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h +++ b/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h @@ -1,7 +1,7 @@ /* * arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h * - * Copyright 2012 NVIDIA, Inc. + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -25,20 +25,23 @@ #define TEGRA_DAIFMT_RIGHT_J 3 #define TEGRA_DAIFMT_LEFT_J 4 -struct baseband_config { +struct i2s_config { + int audio_port_id; + int is_i2s_master; + int i2s_mode; + int sample_size; int rate; int channels; - int bit_format; - int is_master; }; struct tegra_asoc_platform_data { + const char *codec_name; + const char *codec_dai_name; int gpio_spkr_en; int gpio_hp_det; int gpio_hp_mute; int gpio_int_mic_en; int gpio_ext_mic_en; unsigned int debounce_time_hp; - int audio_port_id[NUM_I2S_DEVICES]; - struct baseband_config baseband_param; + struct i2s_config i2s_param[NUM_I2S_DEVICES]; }; -- cgit v1.2.3