From patchwork Thu Dec 14 17:34:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10112945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2362360327 for ; Thu, 14 Dec 2017 17:40:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C854290AB for ; Thu, 14 Dec 2017 17:40:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 008152915C; Thu, 14 Dec 2017 17:40:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2767E290AB for ; Thu, 14 Dec 2017 17:40:26 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DF312267B8F; Thu, 14 Dec 2017 18:36:59 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 229F2267B79; Thu, 14 Dec 2017 18:36:58 +0100 (CET) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by alsa0.perex.cz (Postfix) with ESMTP id 4204C267B79 for ; Thu, 14 Dec 2017 18:36:51 +0100 (CET) Received: by mail-wm0-f67.google.com with SMTP id t8so12837156wmc.3 for ; Thu, 14 Dec 2017 09:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5P11H62b4xPELhart8WGy+syC64k2uY5O2WNEbio21c=; b=EHWjGLWxC5uWzk41AmS2WsltXjFy/9CxGKGBCSO0Z4Aa95f7DuyyGK7yBBBR1EXWYD fJSxUPUz7oigNz0oJsydiUM7QEhNtmQLVERG8avpt8LLVOFkR+BgVbq5A2j9KFwbaCTQ gLQhoyex15mIM/+zQ73zdU10Mm4fQu7X6ktpA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5P11H62b4xPELhart8WGy+syC64k2uY5O2WNEbio21c=; b=oz/pk5Fn5YEuKtba/fS0GBec/CpWedMGSSSHUswbO1P+Gv5QwMhEWBdIipVoq10wmp NQvuNiGK4NvI8UT3nttOeprPQIKR2JbBc2hUruC5xR4LeVXj7/aN+RwvdWxHjdKWi5vU qoKAXWHPV2kma2Usgvmlj0e1OhkFaaZED5b/6qpWzRuyDuZytXHoqkyRKjT6dx1YtIAB QhujN8+2/jusU338lHnpsxkIWH2bfYBATzztzf/eklmXULrJ0KYdkHoBNxtL5X1AxUId u1toptEjrjnpC9P2eZ1Q6HXUnGg8YTk6j3J+8Dy6uaN+yMBZ9eqiYPzLEHiagi7ZVO1e X6fg== X-Gm-Message-State: AKGB3mKDLDuj3gvLa5ol/BnR1k2ztPwdCa8yOzWndj/ACDzl1NEx1/Q9 uvT+WPyu/d+DX/VWfpiXnYe/UV+LdcI= X-Google-Smtp-Source: ACJfBosv4LFf5WIbaTCyjB5X5Wm6noRIJlbj36URf6DzLTZw4AfUPqQJyk8lLJHe78fF5JfN6mq5lA== X-Received: by 10.28.19.199 with SMTP id 190mr2661709wmt.87.1513273010774; Thu, 14 Dec 2017 09:36:50 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id r82sm1741757wme.31.2017.12.14.09.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Dec 2017 09:36:50 -0800 (PST) From: srinivas.kandagatla@linaro.org To: Andy Gross , Mark Brown , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org Date: Thu, 14 Dec 2017 17:34:01 +0000 Message-Id: <20171214173402.19074-15-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171214173402.19074-1-srinivas.kandagatla@linaro.org> References: <20171214173402.19074-1-srinivas.kandagatla@linaro.org> Cc: Mark Rutland , devicetree@vger.kernel.org, Banajit Goswami , linux-kernel@vger.kernel.org, Patrick Lai , Takashi Iwai , sboyd@codeaurora.org, Liam Girdwood , David Brown , Rob Herring , Srinivas Kandagatla , linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [RESEND PATCH v2 14/15] ASoC: qcom: apq8096: Add db820c machine driver X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Srinivas Kandagatla uThis patch adds support to DB820c machine driver. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/Kconfig | 9 +++- sound/soc/qcom/apq8096.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 sound/soc/qcom/apq8096.c diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig index ecd1e4ba834d..748ccc3edefa 100644 --- a/sound/soc/qcom/Kconfig +++ b/sound/soc/qcom/Kconfig @@ -72,7 +72,6 @@ config SND_SOC_QDSP6_ASM_DAI tristate default n - config SND_SOC_QDSP6 tristate "SoC ALSA audio driver for QDSP6" select SND_SOC_QDSP6_AFE @@ -87,3 +86,11 @@ config SND_SOC_QDSP6 This will enable sound soc platform specific audio drivers. This includes q6asm, q6adm, q6afe interfaces to DSP using apr. + +config SND_SOC_MSM8996 + tristate "SoC Machine driver for MSM8996 and APQ8096 boards" + select SND_SOC_QDSP6V2 + default n + help + To add support for SoC audio on MSM8996 and APQ8096 boards + diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c new file mode 100644 index 000000000000..5b2036317f71 --- /dev/null +++ b/sound/soc/qcom/apq8096.c @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2017 The Linux Foundation. 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 and + * only version 2 as published by the Free Software Foundation. + * + * 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. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include + +int msm8996_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + struct snd_interval *rate = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *channels = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_CHANNELS); + + rate->min = rate->max = 48000; + channels->min = channels->max = 2; + + return 0; +} +static struct snd_soc_dai_link msm8996_dai_links[] = { + /* FrontEnd DAI Links */ + { + .name = "MultiMedia1 Playback", + .stream_name = "MultiMedia1", + .cpu_dai_name = "MM_DL1", + .platform_name = "q6asm_dai", + .dynamic = 1, + .dpcm_playback = 1, + + .codec_dai_name = "snd-soc-dummy-dai", + .codec_name = "snd-soc-dummy", + }, + /* Backend DAI Links */ + { + .name = "HDMI Playback", + .stream_name = "q6afe_dai", + .cpu_dai_name = "HDMI", + .platform_name = "q6routing", + .no_pcm = 1, + .dpcm_playback = 1, + .be_hw_params_fixup = msm8996_be_hw_params_fixup, + .codec_dai_name = "i2s-hifi", + .codec_name = "hdmi-audio-codec.0.auto", + }, +}; + +static int apq8096_sbc_parse_of(struct snd_soc_card *card) +{ + struct device *dev = card->dev; + int ret; + + ret = snd_soc_of_parse_card_name(card, "qcom,model"); + if (ret) + dev_err(dev, "Error parsing card name: %d\n", ret); + + return ret; +} + +static int msm_snd_apq8096_probe(struct platform_device *pdev) +{ + int ret; + struct snd_soc_card *card; + + card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + if (!card) + return -ENOMEM; + + card->dev = &pdev->dev; + + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + + card->dai_link = msm8996_dai_links; + card->num_links = ARRAY_SIZE(msm8996_dai_links); + + ret = apq8096_sbc_parse_of(card); + if (ret) { + dev_err(&pdev->dev, "Error parsing OF data\n"); + return ret; + } + + ret = devm_snd_soc_register_card(&pdev->dev, card); + if (ret) + dev_err(&pdev->dev, "sound card register failed (%d)!\n", ret); + else + dev_err(&pdev->dev, "sound card register Sucessfull\n"); + + return ret; +} + +static const struct of_device_id msm_snd_apq8096_dt_match[] = { + {.compatible = "qcom,apq8096-sndcard"}, + {} +}; + +static struct platform_driver msm_snd_apq8096_driver = { + .probe = msm_snd_apq8096_probe, + .driver = { + .name = "msm-snd-apq8096", + .owner = THIS_MODULE, + .of_match_table = msm_snd_apq8096_dt_match, + }, +}; +module_platform_driver(msm_snd_apq8096_driver); +MODULE_AUTHOR("Srinivas Kandagatla