From patchwork Mon Jul 22 09:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 813790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2FD1C3DA5D for ; Mon, 22 Jul 2024 13:04:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C9E9614E9; Mon, 22 Jul 2024 15:03:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C9E9614E9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1721653440; bh=ElxwyvAYRep8iP0erjBmNwM65GYITd2Altmm3t3OTiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bzbiCi9d0nzNm/bKVxnt4JTNffEq2iInWYLpbMATn0OGePCL51e/n3F5dkip1SLb9 VfyE1BOkAxnotnXnO8jjMV2evsvz/JPHPd3XLwbFu0LLIVCe6XRa47n22UOqV29K03 TrEm1/GGg0lCkvPndYwel7q8pQG1FSpOwc0Xb/AA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4C3A5F80793; Mon, 22 Jul 2024 15:01:04 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1B2DBF80797; Mon, 22 Jul 2024 15:01:04 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D885FF8019B; Mon, 22 Jul 2024 11:52:25 +0200 (CEST) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 93920F8019B for ; Mon, 22 Jul 2024 11:52:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 93920F8019B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Wlsnz2v/ Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52efe4c7c16so1752239e87.0 for ; Mon, 22 Jul 2024 02:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721641936; x=1722246736; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c4l/632voSz6mCh2TqLV6xqS8GDhLDgECY3Nfdz+lQQ=; b=Wlsnz2v/zdywbJIDBzRMsVGr5sEN+fxUQnh5xHuDgXSzF+tI3opE+Gsv45v2MREPaW DOYCn6KKTOUimbnrmfPbJhotp9L0z4Gqrs5qqwYJbMjckrC0IYiFiJSrjGts7D3LmNCp BK2PgLUPGWDN2guu2Mkw1HgxFCUIIi8V/DYbxvOEAyrhN707a9pbPyEaOJQPRwhZXt/e vYg34tmDFJzRNfpYbg+13yxU/vnXp4VEkSV4EmevGJcXcz1m7tM0Xvv2QGjKRpEGmpaZ ztZTl7WVkFJTlGUYx1yk0x6JAFezNBuKZbZrmzFQjQwGrRzyPgSPd06pA40YKOJxLusl F43Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721641936; x=1722246736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c4l/632voSz6mCh2TqLV6xqS8GDhLDgECY3Nfdz+lQQ=; b=ROwMthqL4HIQSxHBSvf96Q7IWk474KeBg3g8r6noD21bSZGclq4B9L7XvwWRaHL+ll eNO8A9ReU9tH+lbapRYsVcoXymzEX3yVSAUoGbqHnmHxSnCJkiBVZ2AP/D+IMkdg17dV FLd772dMTMHLl7r4ryYxe8+0je8DhuqkludkmwE6Z+u0I5P55Z4bmXGn/Jf+79KpZsKj tYaO2eQpkzdNBelFHZv9idO2l9U04KSfQhq//0FtM0/DQP94XaAiLE2zYel9kNcdB/0V x/p+7jhV9PyyfByLkKkMlX1RjjhxNSpflkcr1hLqLAuZp7baNW/TsNGslHTHMsdfCmhn umSA== X-Forwarded-Encrypted: i=1; AJvYcCUR7Dc+nmvQrxGKgWXW3n1TNsZZr9HIJc3hXZNjTRu22OMQl5IWvhc3dYqosiRlaFug4kKFXaX29WSN8jT/aPwPxKsfIOlPUz/iIQ0= X-Gm-Message-State: AOJu0Yzu7rK5xCz7tADfFwxLAcebFNCHhof9c09dXiYbHAIroLu2T5EW NVr//TDTR8tZ9enyZ383hHC4cvw+SfR4GQb9pvQpTxauQ0lER62R X-Google-Smtp-Source: AGHT+IEkUCQN4xvNexHQBngyKo1Jr+lRR08xYuntYXjmUoolBteeZ3Gzo1t7dPmmD02D9Nfl7fIeHw== X-Received: by 2002:a05:6512:1289:b0:52c:80f6:d384 with SMTP id 2adb3069b0e04-52ef8d85836mr4304130e87.3.1721641935595; Mon, 22 Jul 2024 02:52:15 -0700 (PDT) Received: from localhost.localdomain (byy214.neoplus.adsl.tpnet.pl. [83.30.44.214]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52fc226cdccsm91552e87.164.2024.07.22.02.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 02:52:15 -0700 (PDT) From: Adam Skladowski To: Cc: phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Adam Skladowski , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Lypak Subject: [PATCH 1/4] ASoC: qcom: apq8016_sbc.c: Add Quinary support Date: Mon, 22 Jul 2024 11:51:05 +0200 Message-ID: <20240722095147.3372-2-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240722095147.3372-1-a39.skl@gmail.com> References: <20240722095147.3372-1-a39.skl@gmail.com> MIME-Version: 1.0 X-MailFrom: a39.skl@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: MBD3PFZMHYSLYIE3TI7QTLTHC6ZEU7UL X-Message-ID-Hash: MBD3PFZMHYSLYIE3TI7QTLTHC6ZEU7UL X-Mailman-Approved-At: Mon, 22 Jul 2024 13:00:56 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Vladimir Lypak Add support for configuring Quinary Mi2S interface it will be used on MSM8953 and MSM8976 platform. Signed-off-by: Vladimir Lypak [Adam: Split from MSM8953 support patch,add msg] Signed-off-by: Adam Skladowski --- sound/soc/qcom/apq8016_sbc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 3023cf180a75..8971f4f5d339 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -20,12 +20,13 @@ #include "common.h" #include "qdsp6/q6afe.h" -#define MI2S_COUNT (MI2S_QUATERNARY + 1) +#define MI2S_COUNT (MI2S_QUINARY + 1) struct apq8016_sbc_data { struct snd_soc_card card; void __iomem *mic_iomux; void __iomem *spkr_iomux; + void __iomem *quin_iomux; struct snd_soc_jack jack; bool jack_setup; int mi2s_clk_count[MI2S_COUNT]; @@ -86,6 +87,12 @@ static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s) SPKR_CTL_TLMM_DATA1_EN | SPKR_CTL_TLMM_WS_OUT_SEL_SEC | SPKR_CTL_TLMM_WS_EN_SEL_SEC, pdata->spkr_iomux); break; + case MI2S_QUINARY: + /* Configure Quinary MI2S */ + if (!pdata->quin_iomux) + return -ENOENT; + writel(readl(pdata->quin_iomux) | 0x01, pdata->quin_iomux); + break; case MI2S_TERTIARY: writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL | MIC_CTRL_TLMM_SCLK_EN, @@ -177,6 +184,9 @@ static int qdsp6_dai_get_lpass_id(struct snd_soc_dai *cpu_dai) case QUATERNARY_MI2S_RX: case QUATERNARY_MI2S_TX: return MI2S_QUATERNARY; + case QUINARY_MI2S_RX: + case QUINARY_MI2S_TX: + return MI2S_QUINARY; default: return -EINVAL; } @@ -320,6 +330,10 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev) if (IS_ERR(data->spkr_iomux)) return PTR_ERR(data->spkr_iomux); + data->quin_iomux = devm_platform_ioremap_resource_byname(pdev, "quin-iomux"); + if (IS_ERR(data->quin_iomux)) + return PTR_ERR(data->quin_iomux); + snd_soc_card_set_drvdata(card, data); add_ops(card); From patchwork Mon Jul 22 09:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 814189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61508C3DA59 for ; Mon, 22 Jul 2024 13:04:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5BAAD14FD; Mon, 22 Jul 2024 15:04:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5BAAD14FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1721653460; bh=EFy7tExuqG9na7Q+Y80CJaISj3tjIZbe4+zf3f1TTaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=D/ZERZwQZyHmMuB4eziv9ttVa+MN1H04Ax+JpS/I+5wEVKFnWGjydCTCPA7uMqrNd pNnALRWRCWDV6cDQafLHrcVJXrIs8bEyipqPMSTF/AELGoWjlUIKU/PxdVxiR0E3cN 4J/+5gK7Fw8Vrmcy445/VHxJUc7rDpyApXSYVNzA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3F015F80806; Mon, 22 Jul 2024 15:01:08 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C1071F80674; Mon, 22 Jul 2024 15:01:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9B5A2F8058C; Mon, 22 Jul 2024 11:52:31 +0200 (CEST) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 75B9EF8007E for ; Mon, 22 Jul 2024 11:52:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 75B9EF8007E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=hTkpwgWe Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52efd855adbso1983374e87.2 for ; Mon, 22 Jul 2024 02:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721641938; x=1722246738; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GF6xFxPj/ytlezNbhhUqMrRGdstZMHpzQeT2XWw6wjY=; b=hTkpwgWeDCag1p5fFusFZHqpJ5+YNF3/+MVlhwwAT3vflkEcatuqJtWpFMjUWFP2RM y391mtSqVUo17i5v4JrI3ASkQvFPoErzVurH+LVe/Pb/FBwTod5+CWJ2e0K+CC9eSYSK dmZlibfirE1UIH+VqiJI8OwVGvkIdGaWetvGpkSDSkf0b/11kwxxXNwjD9FuYhwRTDg8 BJM35Nln3u0Ul4E64McHUW4QTPaX37QtgM0YsISVxMLOY3DJRcJdjKx1VbTgZPy4G5Ke Rdlx8NOKwOT2npb2XX1Ha9w/oIeds2LKEzfsyKAI7tV7+B1HO+QVJgObVS+DVwyrZQau OESw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721641938; x=1722246738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GF6xFxPj/ytlezNbhhUqMrRGdstZMHpzQeT2XWw6wjY=; b=Lx2l1xSxqSFw4C89U1B3Q5q1i1r0k5LtpTn3vzXAYDz1w+la2GbE3UbRBLbkG8nJHz +CLzDnAxti1p6C/j2LmLWNyCqycI9tLkG7f3HK7cYLHhYT1+gCL1jHcmQio2hpdND+s6 iymA5uiN+RPMqSfG9VY/kxyXPY22qYC6H0DEvu4pG19xF+JmM0V6rKDdX63+AkVA65/p WYFt1BaiYE8ATZqb1mT2EOkWAaAywOilC7gWppUDRoP2TPqFOwzpKtVSHD91EzI7BhDf Irtr6kVPHgM+gr4Ic+AM/DXEbkXL/R0lGBKxAwzVgifX4UW8gX3yf1NY9FyV4trFInPg dx4A== X-Forwarded-Encrypted: i=1; AJvYcCUCbOY/I04BGkHQ2WFte4dQvaYndz8oYljEZbhECa1zKmD6ssPOhmn11dwadTJhthTC5K2ERmORosq+jBMydHkqVAFlZTLjn2HdgiA= X-Gm-Message-State: AOJu0YzRhA8wap4CT/4V8DSc7bG7/2IZmtmZ2FGOEmy4sm1KjClIdWwb /DwWm2y4KQbZ9ecZB77Y2GR3MwOaTOc4MioCMv9n0nVImOTlXL0/ X-Google-Smtp-Source: AGHT+IGMjXFxraEsXHIkxYNkndbJxB9/sBbeVo4mr3BgdM9QyhZYaPDjmM+IUr8WAtpuoBhZAJ6eTg== X-Received: by 2002:a05:6512:1327:b0:52b:bf8e:ffea with SMTP id 2adb3069b0e04-52efb7bf318mr4451648e87.40.1721641938089; Mon, 22 Jul 2024 02:52:18 -0700 (PDT) Received: from localhost.localdomain (byy214.neoplus.adsl.tpnet.pl. [83.30.44.214]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52fc226cdccsm91552e87.164.2024.07.22.02.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 02:52:17 -0700 (PDT) From: Adam Skladowski To: Cc: phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Adam Skladowski , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Lypak Subject: [PATCH 2/4] ASoC: msm8916-wcd-analog: add cajon and cajon v2 support Date: Mon, 22 Jul 2024 11:51:06 +0200 Message-ID: <20240722095147.3372-3-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240722095147.3372-1-a39.skl@gmail.com> References: <20240722095147.3372-1-a39.skl@gmail.com> MIME-Version: 1.0 X-MailFrom: a39.skl@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: QPEZSAYH7RUA4TJDCCQG655TBZR2RHTU X-Message-ID-Hash: QPEZSAYH7RUA4TJDCCQG655TBZR2RHTU X-Mailman-Approved-At: Mon, 22 Jul 2024 13:00:57 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Vladimir Lypak Add regs overrides for Cajon(PM8952) and Cajon v2(PM8953) codecs. Signed-off-by: Vladimir Lypak [Adam: Add Cajon support,add msg] Co-developed-by: Adam Skladowski Signed-off-by: Adam Skladowski --- sound/soc/codecs/msm8916-wcd-analog.c | 63 +++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 9ca381812975..daf65f5d4e99 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -250,6 +250,7 @@ SPKR_DRV_CAL_EN | SPKR_DRV_SETTLE_EN | \ SPKR_DRV_FW_EN | SPKR_DRV_BOOST_SET | \ SPKR_DRV_CMFB_SET | SPKR_DRV_GAIN_SET) +#define CDC_A_SPKR_ANA_BIAS_SET (0xf1B3) #define CDC_A_SPKR_OCP_CTL (0xf1B4) #define CDC_A_SPKR_PWRSTG_CTL (0xf1B5) #define SPKR_PWRSTG_CTL_DAC_EN_MASK BIT(0) @@ -264,12 +265,15 @@ #define CDC_A_SPKR_DRV_DBG (0xf1B7) #define CDC_A_CURRENT_LIMIT (0xf1C0) +#define CDC_A_BYPASS_MODE (0xf1C2) #define CDC_A_BOOST_EN_CTL (0xf1C3) #define CDC_A_SLOPE_COMP_IP_ZERO (0xf1C4) #define CDC_A_SEC_ACCESS (0xf1D0) #define CDC_A_PERPH_RESET_CTL3 (0xf1DA) #define CDC_A_PERPH_RESET_CTL4 (0xf1DB) +#define CDC_A_RX_EAR_STATUS (0xf1A1) + #define MSM8916_WCD_ANALOG_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000) #define MSM8916_WCD_ANALOG_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ @@ -715,6 +719,50 @@ static const struct reg_default wcd_reg_defaults_2_0[] = { {CDC_A_MASTER_BIAS_CTL, 0x30}, }; +static const struct reg_default wcd_reg_defaults_cajon[] = { + {CDC_A_RX_COM_OCP_CTL, 0xD1}, + {CDC_A_RX_COM_OCP_COUNT, 0xFF}, + {CDC_D_SEC_ACCESS, 0xA5}, + {CDC_D_PERPH_RESET_CTL3, 0x0F}, + {CDC_A_TX_1_2_OPAMP_BIAS, 0x4C}, + {CDC_A_NCP_FBCTRL, 0xA8}, + {CDC_A_NCP_VCTRL, 0xA4}, + {CDC_A_SPKR_DRV_CTL, 0x69}, + {CDC_A_SPKR_DRV_DBG, 0x01}, + {CDC_A_SEC_ACCESS, 0xA5}, + {CDC_A_PERPH_RESET_CTL3, 0x0F}, + {CDC_A_CURRENT_LIMIT, 0x82}, + {CDC_A_SPKR_ANA_BIAS_SET, 0x41}, + {CDC_A_SPKR_DAC_CTL, 0x03}, + {CDC_A_SPKR_OCP_CTL, 0xE1}, + {CDC_A_RX_HPH_BIAS_PA, 0xFA}, + {CDC_A_MASTER_BIAS_CTL, 0x30}, + {CDC_A_MICB_1_INT_RBIAS, 0x00}, +}; + +static const struct reg_default wcd_reg_defaults_cajon_2_0[] = { + {CDC_A_RX_COM_OCP_CTL, 0xD1}, + {CDC_A_RX_COM_OCP_COUNT, 0xFF}, + {CDC_D_SEC_ACCESS, 0xA5}, + {CDC_D_PERPH_RESET_CTL3, 0x0F}, + {CDC_A_TX_1_2_OPAMP_BIAS, 0x4C}, + {CDC_A_NCP_FBCTRL, 0xA8}, + {CDC_A_NCP_VCTRL, 0xA4}, + {CDC_A_SPKR_DRV_CTL, 0x69}, + {CDC_A_SPKR_DRV_DBG, 0x01}, + {CDC_A_SEC_ACCESS, 0xA5}, + {CDC_A_PERPH_RESET_CTL3, 0x0F}, + {CDC_A_CURRENT_LIMIT, 0xA2}, + {CDC_A_BYPASS_MODE, 0x18}, + {CDC_A_SPKR_ANA_BIAS_SET, 0x41}, + {CDC_A_SPKR_DAC_CTL, 0x03}, + {CDC_A_SPKR_OCP_CTL, 0xE1}, + {CDC_A_RX_HPH_BIAS_PA, 0xFA}, + {CDC_A_RX_EAR_STATUS, 0x10}, + {CDC_A_MASTER_BIAS_CTL, 0x30}, + {CDC_A_MICB_1_INT_RBIAS, 0x00}, +}; + static int pm8916_wcd_analog_probe(struct snd_soc_component *component) { struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(component->dev); @@ -738,9 +786,18 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component) snd_soc_component_write(component, CDC_D_PERPH_RESET_CTL4, 0x01); snd_soc_component_write(component, CDC_A_PERPH_RESET_CTL4, 0x01); - for (reg = 0; reg < ARRAY_SIZE(wcd_reg_defaults_2_0); reg++) - snd_soc_component_write(component, wcd_reg_defaults_2_0[reg].reg, - wcd_reg_defaults_2_0[reg].def); + if (priv->codec_version == 4) + for (reg = 0; reg < ARRAY_SIZE(wcd_reg_defaults_cajon_2_0); reg++) + snd_soc_component_write(component, wcd_reg_defaults_cajon_2_0[reg].reg, + wcd_reg_defaults_cajon_2_0[reg].def); + else if (priv->codec_version == 3) + for (reg = 0; reg < ARRAY_SIZE(wcd_reg_defaults_cajon); reg++) + snd_soc_component_write(component, wcd_reg_defaults_cajon[reg].reg, + wcd_reg_defaults_cajon[reg].def); + else + for (reg = 0; reg < ARRAY_SIZE(wcd_reg_defaults_2_0); reg++) + snd_soc_component_write(component, wcd_reg_defaults_2_0[reg].reg, + wcd_reg_defaults_2_0[reg].def); priv->component = component; From patchwork Mon Jul 22 09:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 814188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEEFDC3DA5D for ; Mon, 22 Jul 2024 13:04:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1007720C4; Mon, 22 Jul 2024 15:04:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1007720C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1721653485; bh=KRsPJdZcwmK3gbwOR0QFyaoTgSYfTVGDmjEFVejhQg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=R9hKhfmA77bvAb05OTL2lPu5+pGhX4JoO3vglAQ478MXlXYFphQzDJ8SMvhKV+2lT dLgBYuUej7iaw6iOCafL9v6ebHtL0klmXUP1/fNg5T3vzyArnLT24EZBeNFcBpheOa 5KD4aRHsYYjErRAcymiaS86SWCg28sp39OpcHwh4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C4EEEF80BF3; Mon, 22 Jul 2024 15:01:10 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 4369FF808F9; Mon, 22 Jul 2024 15:01:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2A081F8019B; Mon, 22 Jul 2024 11:54:24 +0200 (CEST) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 451ADF801F5 for ; Mon, 22 Jul 2024 11:52:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 451ADF801F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=IU6fsPB7 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52efaae7edfso1166475e87.2 for ; Mon, 22 Jul 2024 02:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721641942; x=1722246742; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LueQvPp7jIsOu7JwwYrAGJM7gILiYRCDnqZjPBjPXPA=; b=IU6fsPB76kyV5ddtjKnPizGdfKBs1NY5UsbEZanwdV+40WevE/Zi4vKNiDfnR6SdbY 101YTyrvova99wOZiha9XEpqCfbo+UUlBvvTdeS9J8XiCGCp2dyxsCvu/l8Q48OfjO4v vRIiWIc+vGWnGKfNaVlClf3QVrbTO8kC2Cd3PQ3QAXRaRF/rSZ/m17pZrp2FwwQi57/+ eQZm6UqI9xjUTp1KRoqRkcm3ZgAMRXERJtp8ITJ7twowxKbMV117CMkheN5+lFLwA4LB cyHHQml8nULYgoDEDaLen5HmFbzvy8C8JIu5RAC95McJZ+aJwLgxeYy8UvAXquano7oK Wepg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721641942; x=1722246742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LueQvPp7jIsOu7JwwYrAGJM7gILiYRCDnqZjPBjPXPA=; b=WGY18j5XrLSlBdyqXSLjbhKc+iG9kLZ+JveG2LuiTkwnm6N+oGdrfKP8GY/pDrY5QT lZXsp7czvtk/Pba15K7RyElQHWJ077+a6oEzy4y9rcCaMmmiJ//fEOUt0pCmgl/9i5Dl EHejC4JEr/zfEiXkaecQA9HXmDMQVsXJbpr2RDEO+QKbgKmjT8gjm7LmT99u/cA81Puo rgokOPwcKioY57G2iaFFCoj/8be8q8ckNa+Q1YH+fHBE93Rp7kc/saJ0Xdt3YfgHBoiB AyqZD08l+qLUIZAZWPAMncObaAdAId5KkcxTb7+BrMKDK49/7lxKg4QrYrcImA5FP9Yb F/ig== X-Forwarded-Encrypted: i=1; AJvYcCVW5UsSe9LHj4H/o2LvD0twPDe7VkIrlRq04/BYCwSpUQyltQ6rNaWxIA45dJzXOq/G6nvHCgJ7ClHGp1yJekdb/D99CkJherN6fD8= X-Gm-Message-State: AOJu0YzR8De0MOm0VdcrvlFnpl5pUbUXzbm2TwSt/EL/f76DwMuNu+Pd iOYoSfgEOVFZjJZDKskkTIpeyIsv4UDbuEpgH8E8qwyMZLBad+2d X-Google-Smtp-Source: AGHT+IFEAj1t++gm3u7tMYWGE3y1vx+XHwQtuisG9uc4Yr+MK+jmP04CRcVD6fbhOpk4+urwoo37lA== X-Received: by 2002:a05:6512:2826:b0:52e:764b:b20d with SMTP id 2adb3069b0e04-52efb7e1281mr4257344e87.28.1721641941605; Mon, 22 Jul 2024 02:52:21 -0700 (PDT) Received: from localhost.localdomain (byy214.neoplus.adsl.tpnet.pl. [83.30.44.214]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52fc226cdccsm91552e87.164.2024.07.22.02.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 02:52:21 -0700 (PDT) From: Adam Skladowski To: Cc: phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Adam Skladowski , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ASoC: dt-bindings: qcom,sm8250: Add msm8953/msm8976-qdsp6-sndcard Date: Mon, 22 Jul 2024 11:51:07 +0200 Message-ID: <20240722095147.3372-4-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240722095147.3372-1-a39.skl@gmail.com> References: <20240722095147.3372-1-a39.skl@gmail.com> MIME-Version: 1.0 X-MailFrom: a39.skl@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 4XLZZND7VB4OW2DL4ZLWPIWAOI6MOKVZ X-Message-ID-Hash: 4XLZZND7VB4OW2DL4ZLWPIWAOI6MOKVZ X-Mailman-Approved-At: Mon, 22 Jul 2024 13:00:57 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Document MSM8953/MSM8976 QDSP6 cards. Signed-off-by: Adam Skladowski --- .../bindings/sound/qcom,sm8250.yaml | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml index b2e15ebbd1bc..3b5f8adba725 100644 --- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml @@ -29,6 +29,8 @@ properties: - enum: - qcom,apq8016-sbc-sndcard - qcom,msm8916-qdsp6-sndcard + - qcom,msm8953-qdsp6-sndcard + - qcom,msm8976-qdsp6-sndcard - qcom,qcm6490-idp-sndcard - qcom,qcs6490-rb3gen2-sndcard - qcom,qrb5165-rb5-sndcard @@ -144,10 +146,30 @@ allOf: - model - reg - reg-names - else: + - if: + properties: + compatible: + contains: + enum: + - qcom,msm8953-qdsp6-sndcard + - qcom,msm8976-qdsp6-sndcard + then: properties: - reg: false - reg-names: false + reg: + items: + - description: Microphone I/O mux register address + - description: Speaker I/O mux register address + - description: Quinary Mi2S I/O mux register address + reg-names: + items: + - const: mic-iomux + - const: spkr-iomux + - const: quin-iomux + required: + - compatible + - model + - reg + - reg-names additionalProperties: false From patchwork Mon Jul 22 09:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 813789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85675C3DA5D for ; Mon, 22 Jul 2024 13:04:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CFAAC1939; Mon, 22 Jul 2024 15:04:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CFAAC1939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1721653472; bh=L/ApIpFJ9BfLOmjZ356/A8+sGcAzB4WiLcEPhi10XKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ASIlCWNIA784wFkZBWqAvt+VroPRGJE6ErYg4hs3oV9aS6UaOsPlrCIHlgCAHRuyY 2JwexRbXJhZ+D+z2w46T3aU/KH8O6KsiFxHEKsp2l6yaKtmMYk2UlHXJ81LR1gRis9 reUYCFSw1p7Gq5oJt8gxRYWhf1jTpM+d3wGqo4VM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 68554F80803; Mon, 22 Jul 2024 15:01:09 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8DED9F8085D; Mon, 22 Jul 2024 15:01:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6AC4CF8057A; Mon, 22 Jul 2024 11:52:36 +0200 (CEST) Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6740DF800C9 for ; Mon, 22 Jul 2024 11:52:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6740DF800C9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=OrlUY+Zu Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-52f04c1e58eso704130e87.3 for ; Mon, 22 Jul 2024 02:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721641945; x=1722246745; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dl6ci1X9H1bocspAYVTPwqDYk40+i0zlUVaPzwxman8=; b=OrlUY+ZuJeSz3tVC7FO0oBmS5j0C72UC2Ysw2DRUh4va5TY97qK+TwIetZ6NxR7wwB hoRJjW3dLQ8MGBd5mQ/y9AsmAyMANEC0vgYM2q+4K7StlF1xRgwsQxp66WN19i0jk3VE /yVoMnRJDGbRPTtaRxgO2wB9dxiK/XObYKUdjmyM7+tgM0ktcib6128wf8LyXoEDPB8y 9rK9dGTN2jA7bBT2NWKUOexyFNQlRz/UZucgRzVIyuxoveGbLzDxeuZsOWOTXa9HCRzO q4VD90n6GzVJQrmsERdzKCR4YAxc83O+xORHUq/V5S3ojeeY1mnR1L9++09hbirg7GiS K6cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721641945; x=1722246745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dl6ci1X9H1bocspAYVTPwqDYk40+i0zlUVaPzwxman8=; b=OXQmcvo1CtLInXd+890TeK2NsnU3+08aH08yAmnqeE1oKMw++s9Z2kAoowGT5ekjXL RPPD4fLT5Q+aXv83Xx1HDb66PFwL5TlBX8uF+UeMvHtBskbF0WSFbeFUX8ug37hq1hJI TsWhlbzYS6Tb0HtNc5ys1V+MU0t4abz51OvJa175goRxlxuIYtHF+PR9XFqsuInKYsc4 qPFqr7/zSAAnH7nyWeRAkVAGgmN9tp/W8uFRIBTi3T9PZ5M7+hwQsyrqielcuHOMv1j8 so+G8UetJOVfKWXLF+SJssk+b0HzgPrKCPmKNxpB2/bE0aZQodSOPxiENJOqexwQUu+g geIw== X-Forwarded-Encrypted: i=1; AJvYcCXokeBc3q9gEWW4UBc30efnVXAEmcdYDLOwke9B7N31wYVOc/KFacobaeFeD74/aOi/fAsKDfN3wDhnQgUpXln6URqLSLoP4vEY02Y= X-Gm-Message-State: AOJu0YyMvF0qX3yjKj4arpa9BOPc/VutZG4WD4qFCzUFa3Ky0zP4Utrm wqkBIhVaUrDx5ba2lzW5zSHql8R7yUTFdoGR/s+MsF603qKAxD3/ X-Google-Smtp-Source: AGHT+IHiwNvnwn1Ldydw+/A3gbnMJ79+Ia18db3RGXJpSUtCeRrxw/7o90BQd8QswtyBBxDk+Uh7pg== X-Received: by 2002:a05:6512:1250:b0:52c:db76:2a7a with SMTP id 2adb3069b0e04-52efb74c166mr4664718e87.34.1721641944859; Mon, 22 Jul 2024 02:52:24 -0700 (PDT) Received: from localhost.localdomain (byy214.neoplus.adsl.tpnet.pl. [83.30.44.214]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52fc226cdccsm91552e87.164.2024.07.22.02.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 02:52:24 -0700 (PDT) From: Adam Skladowski To: Cc: phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Adam Skladowski , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Lypak Subject: [PATCH 4/4] ASoC: qcom: apq8016_sbc: Add support for msm8953/msm8976 SoC Date: Mon, 22 Jul 2024 11:51:08 +0200 Message-ID: <20240722095147.3372-5-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240722095147.3372-1-a39.skl@gmail.com> References: <20240722095147.3372-1-a39.skl@gmail.com> MIME-Version: 1.0 X-MailFrom: a39.skl@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: K3MHKQBVNXZR72CVXDHVMHULQO5IFB56 X-Message-ID-Hash: K3MHKQBVNXZR72CVXDHVMHULQO5IFB56 X-Mailman-Approved-At: Mon, 22 Jul 2024 13:00:57 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Vladimir Lypak Introduce support for audio card on MSM8953/MSM8976 platform. Main difference between those two is Q6AFE CLK API supported by firmware which influence way we enable digital codec clock. Either inside machine driver or outside via q6afe-clocks driver. Signed-off-by: Vladimir Lypak [Adam: Add MSM8976, rename functions, add mclk setting,add msg] Co-developed-by: Adam Skladowski Signed-off-by: Adam Skladowski --- sound/soc/qcom/apq8016_sbc.c | 66 ++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 8971f4f5d339..51efefefe0a1 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -22,6 +22,11 @@ #define MI2S_COUNT (MI2S_QUINARY + 1) +enum afe_clk_api { + Q6AFE_CLK_V1, + Q6AFE_CLK_V2 +}; + struct apq8016_sbc_data { struct snd_soc_card card; void __iomem *mic_iomux; @@ -29,6 +34,8 @@ struct apq8016_sbc_data { void __iomem *quin_iomux; struct snd_soc_jack jack; bool jack_setup; + enum afe_clk_api q6afe_clk_ver; + bool dig_cdc_mclk_en; int mi2s_clk_count[MI2S_COUNT]; }; @@ -192,6 +199,28 @@ static int qdsp6_dai_get_lpass_id(struct snd_soc_dai *cpu_dai) } } +static int qdsp6_get_clk_id(struct apq8016_sbc_data *data, int mi2s_id) +{ + if (data->q6afe_clk_ver == Q6AFE_CLK_V2) { + switch (mi2s_id) { + case MI2S_PRIMARY: + return Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT; + case MI2S_SECONDARY: + return Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT; + case MI2S_TERTIARY: + return Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT; + case MI2S_QUATERNARY: + return Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT; + case MI2S_QUINARY: + return Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT; + default: + break; + } + } + /* If AFE CLK isn't V2 return V1 */ + return LPAIF_BIT_CLK; +} + static int msm8916_qdsp6_dai_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); @@ -214,8 +243,16 @@ static int msm8916_qdsp6_startup(struct snd_pcm_substream *substream) if (++data->mi2s_clk_count[mi2s] > 1) return 0; + /* + * On newer legacy SoC (MSM8976) lpass codec clocks are not available in gcc region + * so we have to request clock from machine driver using V1 API) + */ + if (data->q6afe_clk_ver == Q6AFE_CLK_V1 && data->dig_cdc_mclk_en == true) + ret = snd_soc_dai_set_sysclk(cpu_dai, LPAIF_DIG_CLK, DEFAULT_MCLK_RATE, 0); + if (ret) + dev_err(card->dev, "Failed to enable LPAIF dig clk: %d\n", ret); - ret = snd_soc_dai_set_sysclk(cpu_dai, LPAIF_BIT_CLK, MI2S_BCLK_RATE, 0); + ret = snd_soc_dai_set_sysclk(cpu_dai, qdsp6_get_clk_id(data, mi2s), MI2S_BCLK_RATE, 0); if (ret) dev_err(card->dev, "Failed to enable LPAIF bit clk: %d\n", ret); return ret; @@ -236,9 +273,15 @@ static void msm8916_qdsp6_shutdown(struct snd_pcm_substream *substream) if (--data->mi2s_clk_count[mi2s] > 0) return; - ret = snd_soc_dai_set_sysclk(cpu_dai, LPAIF_BIT_CLK, 0, 0); + ret = snd_soc_dai_set_sysclk(cpu_dai, qdsp6_get_clk_id(data, mi2s), 0, 0); if (ret) dev_err(card->dev, "Failed to disable LPAIF bit clk: %d\n", ret); + + if (data->q6afe_clk_ver == Q6AFE_CLK_V1 && data->dig_cdc_mclk_en == true) + ret = snd_soc_dai_set_sysclk(cpu_dai, LPAIF_DIG_CLK, 0, 0); + if (ret) + dev_err(card->dev, "Failed to disable LPAIF dig clk: %d\n", ret); + } static const struct snd_soc_ops msm8916_qdsp6_be_ops = { @@ -279,6 +322,23 @@ static void msm8916_qdsp6_add_ops(struct snd_soc_card *card) } } +static void msm8953_qdsp6_add_ops(struct snd_soc_card *card) +{ + struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); + + pdata->q6afe_clk_ver = Q6AFE_CLK_V2; + msm8916_qdsp6_add_ops(card); +} + +static void msm8976_qdsp6_add_ops(struct snd_soc_card *card) +{ + struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); + + pdata->q6afe_clk_ver = Q6AFE_CLK_V1; + pdata->dig_cdc_mclk_en = true; + msm8916_qdsp6_add_ops(card); +} + static const struct snd_kcontrol_new apq8016_sbc_snd_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Mic Jack"), @@ -343,6 +403,8 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev) static const struct of_device_id apq8016_sbc_device_id[] __maybe_unused = { { .compatible = "qcom,apq8016-sbc-sndcard", .data = apq8016_sbc_add_ops }, { .compatible = "qcom,msm8916-qdsp6-sndcard", .data = msm8916_qdsp6_add_ops }, + { .compatible = "qcom,msm8953-qdsp6-sndcard", .data = msm8953_qdsp6_add_ops }, + { .compatible = "qcom,msm8976-qdsp6-sndcard", .data = msm8976_qdsp6_add_ops }, {}, }; MODULE_DEVICE_TABLE(of, apq8016_sbc_device_id);