Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4059693pxj; Tue, 8 Jun 2021 05:39:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMrOv/CTgAAvhN1QJ1hioq5gmYfZPcdyudOaD1cz8Ea5nJBR0QAhMtpuLSF5f3ZyW5cTED X-Received: by 2002:aa7:d305:: with SMTP id p5mr19330046edq.167.1623155962110; Tue, 08 Jun 2021 05:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623155962; cv=none; d=google.com; s=arc-20160816; b=i+HZKFTg4iwWAK+/0ZwTY7VwM+jSeiO2Tf2BQDqwx8UqjuenHp+e8PISYqhJ3wSrGo ku0iQx++TaD6wSuTOwyG27lVpKdrtUMMr5gplKDopfmvpdvdmAeOB0+ZjVQoxYm/lNpj wl3AUQUVq4oc3e0Ms96cn9yVwEXK9pJj8Ex+Kv8nwYErCyjwolYIHsM5NwnNubhKo9eh TDUYqGamYLObObmWDzpAuWuDCF1LFsAyEGvII3pF5JnxV38Nse9LMgF+XGHnOWk7ngox CiCHGThgJnf/lGVeGr2K0J6nZBSM6rR/3Kbnx1GtSy6PaHQrgHTBVKfcyFOf56gkK0qW AXcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=UBlZJh5rI7/1dUw1Yk4HhHruAdp5yem1UjzvehIHwFY=; b=lNcun2h/ACsyZfzvGqqfCis+FkDM/CJwP90SXGhtgVx+Rlt9xIS6bYHhZtsDsh+7GH eGoSVPdiea8c6Eb4tfsM6UsLbLy98k1grDiDhC8yBWsoNwgGaZ6kNrlyjCbrOQRvRey3 JHCTqus0iXpIdsE+Mt9ZAYkXLBwIflhXpY/Sck6MK0wLO5+/hdpQNOufZB6DEOHwRaNQ pI+wCc/eHo9WK/dG+mQWyoa9dk9mDP+6+pOcRIyDWUjzWtaEYSfU8i1WuOWOhOEMt0fl V47VlDc5UPm3Ii3Hb2Ehjz37UAA7VWHdqiCp2vHlOJKLn6CJ1JNeg96iqA6+Fj3RDQwh MRGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=GifkWsA7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si15742667ede.450.2021.06.08.05.38.57; Tue, 08 Jun 2021 05:39:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=GifkWsA7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232602AbhFHMj2 (ORCPT + 99 others); Tue, 8 Jun 2021 08:39:28 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:57079 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232299AbhFHMj1 (ORCPT ); Tue, 8 Jun 2021 08:39:27 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623155855; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=UBlZJh5rI7/1dUw1Yk4HhHruAdp5yem1UjzvehIHwFY=; b=GifkWsA7LfPiXQIUW2m8+x/7yE9GnJokMJAdKi2Jfitrf8Adovh+kUlzTrRTeYOS9arhgMA0 MQ58o25NjxlfgQqS2wNNAB1GFU/NnRXHcev3bMIaL/8wGWHhkW1pTwPx9rrZ0QR7YH4Tj3xa nWITlfZK7R07nbMy2dZ7GanDSbk= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 60bf647b8491191eb35d96a1 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 08 Jun 2021 12:37:15 GMT Sender: srivasam=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 9E53DC433D3; Tue, 8 Jun 2021 12:37:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from hyd-lnxbld210.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srivasam) by smtp.codeaurora.org (Postfix) with ESMTPSA id D6AEFC433F1; Tue, 8 Jun 2021 12:37:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D6AEFC433F1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=srivasam@codeaurora.org From: Srinivasa Rao Mandadapu To: agross@kernel.org, bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, srinivas.kandagatla@linaro.org, rohitkr@codeaurora.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, swboyd@chromium.org, judyhsiao@chromium.org Cc: Srinivasa Rao Mandadapu Subject: [PATCH v3] ASoC: qcom: Add four speaker support on MI2S secondary Date: Tue, 8 Jun 2021 18:06:44 +0530 Message-Id: <20210608123644.31398-1-srivasam@codeaurora.org> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add four speaker support on MI2S secondary block by using I2S SD1 line on gpio52 pin, and add channel map control support in the lpass-cpu audio driver. Signed-off-by: Srinivasa Rao Mandadapu --- sound/soc/qcom/lpass-cpu.c | 40 ++++++++++++++++++++++++++++++++++- sound/soc/qcom/lpass-sc7180.c | 1 + sound/soc/qcom/lpass.h | 8 ++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index c62d2612e8f5..d03cc359983a 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -324,10 +324,43 @@ const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = { }; EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops); +int lpass_cpu_pcm_new(struct snd_soc_pcm_runtime *rtd, + struct snd_soc_dai *dai) +{ + int ret; + struct snd_soc_dai_driver *drv = dai->driver; + struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); + + ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK, + snd_pcm_alt_chmaps, drv->playback.channels_max, 0, + &drvdata->chmap_info); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL_GPL(lpass_cpu_pcm_new); + int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai) { struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); - int ret; + struct snd_soc_dai_driver *drv = dai->driver; + int ret, i; + + drvdata->rx_chmap.channels = drv->playback.channels_max; + drvdata->tx_chmap.channels = drv->playback.channels_max; + + if (drv->playback.channels_max == 2) + drvdata->chmap_idx = 1; + else if (drv->playback.channels_max == 4) + drvdata->chmap_idx = 2; + + for (i = 0; i < drv->playback.channels_max; i++) { + drvdata->tx_chmap.map[i] = + snd_pcm_alt_chmaps[drvdata->chmap_idx].map[i]; + drvdata->rx_chmap.map[i] = + snd_pcm_alt_chmaps[drvdata->chmap_idx].map[i]; + } /* ensure audio hardware is disabled */ ret = regmap_write(drvdata->lpaif_map, @@ -856,6 +889,11 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) PTR_ERR(drvdata->mi2s_bit_clk[dai_id])); return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]); } + if (drvdata->mi2s_playback_sd_mode[dai_id] == + LPAIF_I2SCTL_MODE_QUAD01) { + variant->dai_driver[dai_id].playback.channels_min = 4; + variant->dai_driver[dai_id].playback.channels_max = 4; + } } /* Allocation for i2sctl regmap fields */ diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c index 8c168d3c589e..77a556b27cf0 100644 --- a/sound/soc/qcom/lpass-sc7180.c +++ b/sound/soc/qcom/lpass-sc7180.c @@ -58,6 +58,7 @@ static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = { }, .probe = &asoc_qcom_lpass_cpu_dai_probe, .ops = &asoc_qcom_lpass_cpu_dai_ops, + .pcm_new = lpass_cpu_pcm_new, }, { .id = LPASS_DP_RX, .name = "Hdmi", diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h index 83b2e08ade06..db239ea52946 100644 --- a/sound/soc/qcom/lpass.h +++ b/sound/soc/qcom/lpass.h @@ -110,6 +110,11 @@ struct lpass_data { struct lpass_hdmitx_dmactl *hdmi_tx_dmactl[LPASS_MAX_HDMI_DMA_CHANNELS]; struct lpass_dp_metadata_ctl *meta_ctl; struct lpass_sstream_ctl *sstream_ctl; + /* Channel map information */ + struct snd_pcm_chmap *chmap_info; + struct snd_pcm_chmap_elem rx_chmap; + struct snd_pcm_chmap_elem tx_chmap; + int chmap_idx; }; /* Vairant data per each SOC */ @@ -259,5 +264,6 @@ void asoc_qcom_lpass_cpu_platform_shutdown(struct platform_device *pdev); int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev); int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai); extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops; - +int lpass_cpu_pcm_new(struct snd_soc_pcm_runtime *rtd, + struct snd_soc_dai *dai); #endif /* __LPASS_H__ */ -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.