From patchwork Tue Dec 5 22:18:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 120765 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6312093qgn; Tue, 5 Dec 2017 14:21:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMbrcw/I50kE2SAdR0gfEkqjyMwMcGisJZ71Foh83Q2b5zNLmlT4lbF0FCt56KpqmeGDJsJ9 X-Received: by 10.84.224.5 with SMTP id r5mr19929071plj.341.1512512488420; Tue, 05 Dec 2017 14:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512512488; cv=none; d=google.com; s=arc-20160816; b=HQEHB/Kp+/N6GbV3DoJL/km0rkBgBfLZML1j7KbwpEP4RIe4BnfjctxaYl1JJXrj7S GImrqGpC9gn/tMTjR/oKDDX8PhCz/RCudeWdi7ie/x0E6N9o4Ycl4kQcKeMXuIqmGFka vm3FO3njJio3OpWfTHzUB3+SJVz/BIKt20+/KJLeg66BWSO8tIrLbOU2WajV5klpmwFM uy9TeLoQT3kZMiOl63r3BK2aS0Wk8v7hm9+JHRfmrpJsCxiEbJIcmopuZT41FlH3n+Zu GtQtbzwkY2HFvaQaKx9Xdj/OJ/7uncQKo2IN/FEJRqA5vORNspJAI5vUSFlu3Utwl5n2 YIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5P11H62b4xPELhart8WGy+syC64k2uY5O2WNEbio21c=; b=n+ALcF+wo3r0dtJQNMBigPTvD9ilc+EdwViIvZt/+Qfc6ddv2G91gGCfCZnfuDBwZX M0BwAvzKOqq+OMphnceoympd+k5OVKGiNMImO0cImZJhPCL/BZAv0ujsMWmIaBzIDYA/ fyYPcBitNskzG+75/CMnfCQ1K1OzZUkvk7RYBthmQq/i8AjEs1J4UpTm+s0RGA4+SErf NoZJ1p+1GiDIp5Xgqa/sSsk0JTf8RTZZ2ZeiC4mrBq5D2xh13j37x5al3zMP+TYCz/BI Rv6gpzh98rZljLFrQDwU6Ts0dXUVyeZbQl3VWMfP5dm6kSrdvuXpPg7v38YtrsGzVlWN z+4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MIkitO4H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20si791469pft.356.2017.12.05.14.21.28; Tue, 05 Dec 2017 14:21:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MIkitO4H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751AbdLEWV0 (ORCPT + 28 others); Tue, 5 Dec 2017 17:21:26 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36883 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752598AbdLEWUf (ORCPT ); Tue, 5 Dec 2017 17:20:35 -0500 Received: by mail-wm0-f67.google.com with SMTP id f140so3950844wmd.2 for ; Tue, 05 Dec 2017 14:20:35 -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=MIkitO4HhmsKWXEQ7pWYUaSBSOIyZYezWZYnA/n8MIEGFqNpiuuym+R4IE/nHtCwAK WbHjc8NdinkJZ0Efq1gp0A7VuqbdAW8bDEWlZfG762Lr9j0Z8UFra9eOS6Lau7+db0FF 2zHoaoPr+wUO0mfbRm7atV37BiI73/4vKCJGs= 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=DoV5o9swVOk70sz3zu5rlVcqWjb6xGpl1HL8gLYrdhxT3xcS8JAReB6YjG3csQgPrm tcvgiRLgg4dCjdLOnRVAqHlIi/jE1PaLtEFJm2Yt7u3YbhsBoUFDKh3oml/ZlO/w3aH1 2E8RgVARrw7AnXYdXmtSiB35FQpRvLAz2Fskfj4Wcr7SyLmXcbyvifcZWZVK3wNdm7gO hTitSwmd6yrDIEj/JEjGjNyzcqiA0ReALX3jPj83tNEl/wmyugtQrlG2Rxahxhv4iUKD 5n4JlxSqgFCI7rHW+BloSISrdaDY+EH/xQty/YMwrG4kKyys5AcJKEveYaQLaYnGIkHb 3sJw== X-Gm-Message-State: AKGB3mLwTGLsaZmPcz6MMPrjMu84Of9BOCqqBuJmgR7YFdFEipLtfwFM t4buleKg29z7CelKZWmGURGUKQ== X-Received: by 10.28.218.70 with SMTP id r67mr6773422wmg.14.1512512434188; Tue, 05 Dec 2017 14:20:34 -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 t138sm1633154wme.16.2017.12.05.14.20.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Dec 2017 14:20:33 -0800 (PST) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org, bgoswami@codeaurora.org Cc: alsa-devel@alsa-project.org, tiwai@suse.com, plai@codeaurora.org, kwestfie@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lkasam@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH v2 14/15] ASoC: qcom: apq8096: Add db820c machine driver Date: Tue, 5 Dec 2017 22:18:11 +0000 Message-Id: <20171205221812.25641-15-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171205221812.25641-1-srinivas.kandagatla@linaro.org> References: <20171205221812.25641-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.15.0 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