From patchwork Tue Jan 14 02:25:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3483671 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EAB249F169 for ; Tue, 14 Jan 2014 02:25:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF34420176 for ; Tue, 14 Jan 2014 02:25:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03C4120172 for ; Tue, 14 Jan 2014 02:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751987AbaANCZw (ORCPT ); Mon, 13 Jan 2014 21:25:52 -0500 Received: from mail-pb0-f42.google.com ([209.85.160.42]:50642 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbaANCZv (ORCPT ); Mon, 13 Jan 2014 21:25:51 -0500 Received: by mail-pb0-f42.google.com with SMTP id uo5so8168196pbc.1 for ; Mon, 13 Jan 2014 18:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:to:cc:in-reply-to:references:from:subject :user-agent:mime-version:content-type; bh=KHnaoyZLyTPqebyPyvEvetje534b1jtxrfLpyJb/N2Y=; b=eWh1Fnlj2KI8vNlMC0NarK7roJnumy6cL7VRSQTdfkISTJqQCfTMsEVY95RQBE7/Op MnMOw00QoaMmWkkkngzUPUHbM2wwNqr9vLnJ/VLycshg+3GeW4fYc5mJ/Qy2CiFJ+78G yiKjOEII3vudIPzYXK1lKnCOgBwKBHPgz9Knt35FaIIC7ygdM6AsvqMbTQaJLSSCblvD CQgkj04j4R/8UZ1ZivpGEyhS7zNPP57eAxOl60JxPgFGKGouUm8zFxWyXAzII0nE9i3j ysanMjjqUvNVNX2MNa0eluqUaN+ieY+16OMkHeptjESp9fKnJRPcfVRMrjsETyThI065 VK1g== X-Received: by 10.66.129.169 with SMTP id nx9mr33556981pab.130.1389666350872; Mon, 13 Jan 2014 18:25:50 -0800 (PST) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id yd4sm41414410pbc.13.2014.01.13.18.25.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 13 Jan 2014 18:25:50 -0800 (PST) Date: Mon, 13 Jan 2014 18:25:50 -0800 (PST) Message-ID: <877ga3guz8.wl%kuninori.morimoto.gx@gmail.com> To: Simon , Laurent Cc: Morimoto , Magnus , Linux-SH In-Reply-To: <87bnzfgv15.wl%kuninori.morimoto.gx@gmail.com> References: <87bnzfgv15.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 3/4] ARM: shmobile: lager: add sound support User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto This patch adds sound support for Lager board. But, it is using PIO transfer at this point. Signed-off-by: Kuninori Morimoto --- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/board-lager.c | 100 ++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 8011329..110c9ba 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -274,6 +274,7 @@ config MACH_LAGER depends on ARCH_R8A7790 select USE_OF select MICREL_PHY if SH_ETH + select SND_SOC_AK4642 if SND_SIMPLE_CARD config MACH_KOELSCH bool "Koelsch board" diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index 8dde446..8a09490 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,20 @@ #include #include #include +#include +#include + +/* + * SSI-AK4643 + * + * SW1: 1: AK4643 + * 2: CN22 + * 3: ADV7511 + * + * this command is required when playback. + * + * # amixer set "LINEOUT Mixer DACL" on + */ /* DU */ static struct rcar_du_encoder_data lager_du_encoders[] = { @@ -364,6 +379,77 @@ static const struct platform_device_info sata1_info __initconst = { .dma_mask = DMA_BIT_MASK(32), }; +/* I2C */ +static struct i2c_board_info i2c2_devices[] = { + { + I2C_BOARD_INFO("ak4643", 0x12), + } +}; + +/* Sound */ +static struct resource rsnd_resources[] __initdata = { + [RSND_GEN2_SCU] = DEFINE_RES_MEM(0xec500000, 0x1000), + [RSND_GEN2_ADG] = DEFINE_RES_MEM(0xec5a0000, 0x100), + [RSND_GEN2_SSIU] = DEFINE_RES_MEM(0xec540000, 0x1000), + [RSND_GEN2_SSI] = DEFINE_RES_MEM(0xec541000, 0x1280), +}; + +static struct rsnd_ssi_platform_info rsnd_ssi[] = { + RSND_SSI_SET(0, 0, gic_spi(370), RSND_SSI_PLAY), + RSND_SSI_SET(0, 0, gic_spi(371), RSND_SSI_CLK_PIN_SHARE), +}; + +static struct rsnd_scu_platform_info rsnd_scu[2] = { + /* no member at this point */ +}; + +static struct rcar_snd_info rsnd_info = { + .flags = RSND_GEN2, + .ssi_info = rsnd_ssi, + .ssi_info_nr = ARRAY_SIZE(rsnd_ssi), + .scu_info = rsnd_scu, + .scu_info_nr = ARRAY_SIZE(rsnd_scu), +}; + +static struct asoc_simple_card_info rsnd_card_info = { + .name = "AK4643", + .card = "SSI01-AK4643", + .codec = "ak4642-codec.2-0012", + .platform = "rcar_sound", + .daifmt = SND_SOC_DAIFMT_LEFT_J, + .cpu_dai = { + .name = "rcar_sound", + .fmt = SND_SOC_DAIFMT_CBS_CFS, + }, + .codec_dai = { + .name = "ak4642-hifi", + .fmt = SND_SOC_DAIFMT_CBM_CFM, + .sysclk = 11289600, + }, +}; + +static void __init lager_add_rsnd_device(void) +{ + struct platform_device_info cardinfo = { + .parent = &platform_bus, + .name = "asoc-simple-card", + .id = -1, + .data = &rsnd_card_info, + .size_data = sizeof(struct asoc_simple_card_info), + .dma_mask = DMA_BIT_MASK(32), + }; + + i2c_register_board_info(2, i2c2_devices, + ARRAY_SIZE(i2c2_devices)); + + platform_device_register_resndata( + &platform_bus, "rcar_sound", -1, + rsnd_resources, ARRAY_SIZE(rsnd_resources), + &rsnd_info, sizeof(rsnd_info)); + + platform_device_register_full(&cardinfo); +} + static const struct pinctrl_map lager_pinctrl_map[] = { /* DU (CN10: ARGB0, CN13: LVDS) */ PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", @@ -372,12 +458,24 @@ static const struct pinctrl_map lager_pinctrl_map[] = { "du_sync_1", "du"), PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", "du_clk_out_0", "du"), + /* I2C2 */ + PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar.2", "pfc-r8a7790", + "i2c2", "i2c2"), /* SCIF0 (CN19: DEBUG SERIAL0) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", "scif0_data", "scif0"), /* SCIF1 (CN20: DEBUG SERIAL1) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790", "scif1_data", "scif1"), + /* SSI (CN17: sound) */ + PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", + "ssi0129_ctrl", "ssi"), + PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", + "ssi0_data", "ssi"), + PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", + "ssi1_data", "ssi"), + PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", + "audio_clk_a", "audio_clk"), /* MMCIF1 */ PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.1", "pfc-r8a7790", "mmc1_data8", "mmc1"), @@ -461,6 +559,8 @@ static void __init lager_add_standard_devices(void) lager_add_camera1_device(); platform_device_register_full(&sata1_info); + + lager_add_rsnd_device(); } /*