From patchwork Sat Jul 27 18:20:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 13743768 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70A4E288BD; Sat, 27 Jul 2024 18:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104451; cv=none; b=rMcRqxwdafdXm2oi9keCT+IikjncTwfOCjvRztyFmlXooa9fEmmpd8YLNxGblcilWrrXTgMHQQEyfzTSFcz372ghWR6i4qOi0AvLT8CtEcMW7xHGS6nvCAI+pIb9AMstb1LvZTQ9USrnbYcY547e1X9ByBu5LxSpF6ntBMaVO58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104451; c=relaxed/simple; bh=PMtw6Te5sj/TrlbW9514sz7eS62gjeUYCJGHpfh1FaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BEMY8uodMnOmscpYrXocf6t1GED3BPcqmJzjC2ynqeWEUDXrUyIBjytj69FfezGV0pPir2Aa68HP9EWRE0qrxNu2fUW5md0gFUhAg0xhFsjjwwLqsUPNJ47v6KABEMP6bqcbXlxSR8/ByC3ScUFaYKFjlcdoQY+xgossaPotNVU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VnSY1F6V; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VnSY1F6V" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2eeb1ba0481so34920671fa.2; Sat, 27 Jul 2024 11:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722104447; x=1722709247; darn=vger.kernel.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=4zam71Ol4yolcRCdgG2yrrm07LDlzniNh9XTYbPohag=; b=VnSY1F6VofxM6ZohUa/dsQke6SYq0BzwiegRnU03kP0GuFGn24V3KMcaWZRiDFtRhw 6hbwKDCfFVw0aPIcA4l/BkFrUCOqWifLXG6CDR7pcDqw98D1bzWyMg0ZEwByhS6/D+Wn XczSpHTnVSm+PxY+WOA27rOhx0Yk/xsU1nV2+uJwJeOIDUuO1/Q1SI5AoVKeYk5zTJqL ygBaAG2DpD/CQtzi0TxYGInnJpFMe3B68m8Ip11Mmrkhih9NcRXVvJGYaPBjVNPrEVO2 Gl3u8tdd/UebS+a87OU99JXaR+5F9tNJF5Arwc67yKOYHIm15MimKpVw3zFrwx5YlHFn 5RBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722104447; x=1722709247; 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=4zam71Ol4yolcRCdgG2yrrm07LDlzniNh9XTYbPohag=; b=K7XLCaSnHVxhsCIUv0EtOxbY9fgLopzRTdIxjS8MVjd7rWu0itEnYOIt4hkZDC11gi HkwbyilxMWuLzFKZ+WghQX6PorcYQgeSmALbCXvYYSzTAn4cvmw2lBqhIwKMUlpBfoeV jvV0+vWA8dNh0yVjGzW2794HeJ92mt/1VxmYoW9fa0tGLqw2+BorPjnmgLEubQFMJAOA +A3uqPl5qc+HWxaFlT/b2/5AzLaelM2c8iXOMQXjnPXpW/xcf0+TmAuxoztpXBBoCFEa ETBSYS0I6swtIhMZmVzW+fRL4b49c+U9kUbFq7+6kiXHUfc/A/Yd2IASjHJcUYZyG46t h1Xw== X-Forwarded-Encrypted: i=1; AJvYcCUd1GhaxYDSevnuJVaaxpy8rJ6EKiKrkWf6r58jI59w7q5mOkuECTLB7JgReuZz+kni1F6NqrWSNELIVak+HKHy7hB0+9vDH2fvewEJjMEEjdGfbpXOa//e8gtfCwtqfrSpsNGM/vz/doJ7yMvzcrnskm7ialR1vM9c5L28BvrchyXs0speH5+Ntfu4abaobi8CJl0UJghKtJzZY8kiq56irdEPRQ== X-Gm-Message-State: AOJu0Yw7Nw1QReuHlFn3m7pwrzPawm/wW/+3fClMeekDHayDcmFn9SBK 6LzgzGOLfoamWEXxZKK/U/F4bz/NIyR4OTMimBfNMhPzVCiVWx7RC+iK7Q== X-Google-Smtp-Source: AGHT+IGvyLQim7JK45a/ba9q00AzQhJejT77FSBr2xSMgFq12bEECWsvmkm1dvXC4saab8Kw2Ycm7g== X-Received: by 2002:a2e:be8f:0:b0:2ef:228a:1b86 with SMTP id 38308e7fff4ca-2f12edd5328mr20892951fa.21.1722104446584; Sat, 27 Jul 2024 11:20:46 -0700 (PDT) Received: from localhost.localdomain (byw127.neoplus.adsl.tpnet.pl. [83.30.42.127]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f03d077226sm7504891fa.126.2024.07.27.11.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jul 2024 11:20:46 -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 , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Stephan Gerhold , alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Vladimir Lypak Subject: [PATCH v2 1/4] ASoC: qcom: apq8016_sbc.c: Add Quinary support Date: Sat, 27 Jul 2024 20:20:24 +0200 Message-ID: <20240727182031.35069-2-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240727182031.35069-1-a39.skl@gmail.com> References: <20240727182031.35069-1-a39.skl@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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..303dd88206b1 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; } @@ -290,6 +300,7 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct snd_soc_card *card; struct apq8016_sbc_data *data; + struct resource *res; int ret; add_ops = device_get_match_data(&pdev->dev); @@ -320,6 +331,9 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev) if (IS_ERR(data->spkr_iomux)) return PTR_ERR(data->spkr_iomux); + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "quin-iomux"); + data->quin_iomux = devm_ioremap_resource(&pdev->dev, res); + snd_soc_card_set_drvdata(card, data); add_ops(card); From patchwork Sat Jul 27 18:20:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 13743769 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59D5E18757F; Sat, 27 Jul 2024 18:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104456; cv=none; b=WLLLzCtuxVkp5YQCe6srzo5ozRBfgKnTy6Ju7ZOwym/+Hu/C4v3iOJCpQs1FSFEpa0QDSG4IV6Nb8tWvj2dbsRPxz7UV8UyKmvHV0rEWuXzN5Vq8j98QVd7pbg/SrAMSMOz+1tHyWE71UhoL7as6U9P1OfKYDMGl+tmW3TlwQVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104456; c=relaxed/simple; bh=EFy7tExuqG9na7Q+Y80CJaISj3tjIZbe4+zf3f1TTaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iK5RveG9bj/lZ7i5zuuaRwbKCZlqD4UBttf1NpldDGaTNqlV/z3cjx882+syE06x2dyBmFkPJNfaUhcG6eg3ZvXnKpsDMojFeNoe8SV2E6lvjwkmJJCqZkR6vwKW94SJoejGYylvD2uGvAsL9EGcX1Poa/0uwT/mB/GBN0ife+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C7IrBQmI; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C7IrBQmI" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2f035ae0fd1so26359641fa.2; Sat, 27 Jul 2024 11:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722104452; x=1722709252; darn=vger.kernel.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=C7IrBQmITHfmf6QelZlWJjAofQc/smf/U1TB4DqOPQjVzkNBhQbJOqUOqKorQSd+yv +KN2pRg86hHQw0Jv0sEv53IHLf+D9F+N6KxyDKSZQvcwu9i1lyPQA0MOf9648lnFUff4 RCQGujd3W7do+A9cQ/xm1c0lXvfgL4kwNoD4uv7JunY1tZSiqizapy8efCuq8L00m8lX cwyTYiuApF2JzDAIpidDSPjwdR5FUPQYiegbtxVuYi+bidCa5nLK2uCYiUe+QMyy6Znw AvxySaNF9NOPgamn7V+aR2NGzvjvE+JKmDrznJq5PRLDWppHSaahEc3n4W2YHdXWUCPs bKcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722104452; x=1722709252; 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=faOMihb0/V9nt8TPFf8hqu2RZzxYLYCge/Jbt+4T3MZ1v9x+38NH6w8iRF0wZhMKWu 67yk7GT01CNQ+3tSJarq24a42/eWbPTfdBGLu9b9heGIgYIoxvsGE4JiMjVjB0uGB/eD iO0JWPzw8CYUVPmqw6Sjy5pcbunpnqjGZCKIxdtKY8UIvr3JOc733jLNTJ2LV74K4jXl RhRpHxPGNV4btBCN8KXDDRDZEtCJH8abdR5c80CrS+MHWRp7M61wEX7Rwegp+LhWw+mQ j0qX0cAVrWb2kTtq5id45eafHc2xR5jRS6oV4eWk5h7GvcAA8el71F19dXrPEW+t/fsO mArQ== X-Forwarded-Encrypted: i=1; AJvYcCXRH9gqLeOzrz3BEPOvszptw4qFTYVeij7PFKT0E/7jQTwdzkJC54hqOdh4CKcMShh2DN6xZPWwxq6jkKJPPMVASAGWXcdQ1/lZt6I2xfbPj3P+OaFO4/OXqq7XPr6X9pWf2W7lEfF3MiKV99RPy/20Ml5oL8tm/Cd4jEvPNqt9Vyo7cOfSngrJ30gXSevtIiOZV/T7lCX0gjmSnT6kTyv2lud6PA== X-Gm-Message-State: AOJu0Yw2h0zwxkeuZvhA0KMqpbQdipiqMl+XLZkx01yBmeWH+KtjtA/I H1YR43C6ltxwsRRrmEJsB2YcMn5b5FoCSuvEFlnf3k5x1vMM/2hDe1yxRA== X-Google-Smtp-Source: AGHT+IEm/COoGFbHv82FK7uvxWXcLwKhJWA1hhbjMFP9GYJUO820ubZBT+LuGLrHoMr/gFZyfg3itg== X-Received: by 2002:a2e:3a19:0:b0:2ee:4c2e:3d3b with SMTP id 38308e7fff4ca-2f12ee02fa2mr19973671fa.4.1722104451431; Sat, 27 Jul 2024 11:20:51 -0700 (PDT) Received: from localhost.localdomain (byw127.neoplus.adsl.tpnet.pl. [83.30.42.127]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f03d077226sm7504891fa.126.2024.07.27.11.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jul 2024 11:20:50 -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 , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Stephan Gerhold , alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Vladimir Lypak Subject: [PATCH v2 2/4] ASoC: msm8916-wcd-analog: add cajon and cajon v2 support Date: Sat, 27 Jul 2024 20:20:25 +0200 Message-ID: <20240727182031.35069-3-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240727182031.35069-1-a39.skl@gmail.com> References: <20240727182031.35069-1-a39.skl@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Sat Jul 27 18:20:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 13743770 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 170A218784A; Sat, 27 Jul 2024 18:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104458; cv=none; b=n6fjf9HbCfOOYnv7DxhLzy4OPh14tCErQcOUoADFO/d4QdRo7w6VtLO/YlDHsrPe17YEU8vqjkR3xN49LyBW1e1sYe60pJfXWn3XRDZZh9PcYzrdtKUdQVoR/LilALr0yOy6Qt4ry2tcJePgD19rEo9SL9PozQCEQ70HqHfVkJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104458; c=relaxed/simple; bh=cjVHMpBbBNVIROJODEIAMPhNoAE9dItU05+iUVuD1ps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sMypSTqHy0SLCRg6yrIXidMvsdtEDVuGuwYe9TdWtm+W+JPuvIG99OoQ8n3juE5ZrlHl9p391xQYS5LqehBBeQrH8vj+0r97wxHjFuNJlxSIh2QWW/XySMBOF6zWiZ5dP9VRBjxANDBWDYjL6eeBAODJUtKW03MAdfDBd7PZy48= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PW36FuRw; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PW36FuRw" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2f0dfdc9e16so21873491fa.2; Sat, 27 Jul 2024 11:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722104455; x=1722709255; darn=vger.kernel.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=/b1UF2QE7ux02MF1mK2AOvPunWfuVvcN7o6J69AheMU=; b=PW36FuRwvLOjLf13t2tVQOgYPOV5T71cNsTLP51bFMI465qAqQnxZ/aV9hP9ldboDR 0N7jn0BxC5t+oqiWkcYFJJ32XFjfvpE2V6hHPQe8gXykJO8IL79dbV0efbg/n7/sgrPv PWC+V/GGJBQUdKsjlknGD2jPAxH3cTHQgglhRT7QnNzdPEG7XQ8I4l2Bcr5BWvlfTdXQ /4wg6ofCE5/cNZ6nXEQKrG5t8i1/nQj5tMvJFJTFl4ueE/Nttb+F+HWoFCJ5N+6QexFr jTiIaNBK/7zPtddx/EvzcBA9QrBQIdYF0mbWivaqU7kzTeegE4121NI/Q1Cv2V3aBRcP LBVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722104455; x=1722709255; 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=/b1UF2QE7ux02MF1mK2AOvPunWfuVvcN7o6J69AheMU=; b=SMs/ujiFh2VArI6WNwIMvNqub1ghQsZyDKs5K29cYbm+CH3Ez2Bqn6Rxir4GG1E+3O Uu5gfH6HttnDZbLngJ/Pm2LML6jOfmxvxCWDxmM2Ylhxr3UjThinyut3aXDybeJkLFWE uSpIAyHNIVPXVsnUt54oPh31xID6p0+QwI6Mf25RnqVdt3twjtCGyo5utyegXewm/MI+ ASHRWwPBM2Rg7MdMKwEG21mO620R868beUARdmfPf4/Vkt42EDOQ1KxnYBAgF/KLzGu6 fDW7YKL2mRd6sFZE0mjykCGObzrRBGIZfvnRsv48ENs1z6MnG5hZnIw/CX0AfeANAC6/ VN9w== X-Forwarded-Encrypted: i=1; AJvYcCVmeABVhycDt9c7iF8y0TJwYgKxs0BxqcSwY20ZEEiQOmEG/NwlO1zcTmWXVKAO0bKp6/J33OZ48qrJ6XdviFNbhGmNWCYLthr6w0OCnLhnum8k4z8IXAhauAN7BD5Dp/Rl0pmkh65eLcVbinlw20ZCX37hEnsQchqKboNpe0XIcWkJ0NLy6CRr8knCud7SrW0WzjnXrBb2RH5AaC2RNitxzRFOYg== X-Gm-Message-State: AOJu0YwTETUtH7lupInORD9RkM9afQI7VP4RGGQSRG86aRGuMdsCTPR8 ZSA23kUVLMSDGrO8xVfAbf9CjT6/1DkkqX9uyV56ODKyrGi9QF6LUY28fw== X-Google-Smtp-Source: AGHT+IFsHsOE9GFIml5SbGqV2PLpprs29PPSV7oR7rhgGyymm9vSuDoD90hrVIW/JyK4/9e8l+NdPg== X-Received: by 2002:a2e:9609:0:b0:2ef:2a60:c1c1 with SMTP id 38308e7fff4ca-2f12ee1663bmr19475811fa.21.1722104454336; Sat, 27 Jul 2024 11:20:54 -0700 (PDT) Received: from localhost.localdomain (byw127.neoplus.adsl.tpnet.pl. [83.30.42.127]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f03d077226sm7504891fa.126.2024.07.27.11.20.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jul 2024 11:20:53 -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 , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Stephan Gerhold , alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2 3/4] ASoC: dt-bindings: apq8016-sbc: Add msm8953/msm8976-qdsp6-sndcard Date: Sat, 27 Jul 2024 20:20:26 +0200 Message-ID: <20240727182031.35069-4-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240727182031.35069-1-a39.skl@gmail.com> References: <20240727182031.35069-1-a39.skl@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document MSM8953/MSM8976 QDSP6 cards. Signed-off-by: Adam Skladowski --- .../sound/qcom,apq8016-sbc-sndcard.yaml | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml b/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml index 6ad451549036..1706ce334d2f 100644 --- a/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml @@ -15,16 +15,16 @@ properties: enum: - qcom,apq8016-sbc-sndcard - qcom,msm8916-qdsp6-sndcard + - qcom,msm8953-qdsp6-sndcard + - qcom,msm8976-qdsp6-sndcard reg: - items: - - description: Microphone I/O mux register address - - description: Speaker I/O mux register address + minItems: 2 + maxItems: 3 reg-names: - items: - - const: mic-iomux - - const: spkr-iomux + minItems: 2 + maxItems: 3 audio-routing: $ref: /schemas/types.yaml#/definitions/non-unique-string-array @@ -106,6 +106,45 @@ required: - reg-names - model +allOf: + - if: + properties: + compatible: + contains: + enum: + - qcom,apq8016-sbc-sndcard + - qcom,msm8916-qdsp6-sndcard + then: + properties: + reg: + items: + - description: Microphone I/O mux register address + - description: Speaker I/O mux register address + reg-names: + items: + - const: mic-iomux + - const: spkr-iomux + + - if: + properties: + compatible: + contains: + enum: + - qcom,msm8953-qdsp6-sndcard + - qcom,msm8976-qdsp6-sndcard + then: + properties: + 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 + additionalProperties: false examples: From patchwork Sat Jul 27 18:20:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 13743771 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BC61188CA1; Sat, 27 Jul 2024 18:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104462; cv=none; b=CvgwCFLluMM4VxJP0NBq9Oco6tLjXtWtEfp5WSFmDFPWbzFqj9u//yqckK+lEZshSu+j1c8RYob+UKMfCSC7n4P0Hes9T3eioexg/FygshOWmuCQYCRvvxNeSSf35KDqANgHkmtp+vaWEKKs1CO+oJ4u2hdz8mSWDw2bf71jbN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722104462; c=relaxed/simple; bh=5zVSTCeiMxOBFFg5PrNZbHTDjaRaeLpoeIwBE9Am3N4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g3OMOrno75lA0tWq+JzAAx/iVLRI2S2Z73NW8qqSt3FHuhWo5QiSrtE4ytZtvz0IvcyJXbsryMFL/CyR4iB/yJ48CTaQfeyNmK76eXJyHQoQYZBxadKHCpznIbVf4ENg61/FEIumzV6TD16eG/HZHsSa4f24sf6K3nxS8HFKEYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MtUQ1ylC; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MtUQ1ylC" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2ef2c109eabso28603001fa.0; Sat, 27 Jul 2024 11:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722104458; x=1722709258; darn=vger.kernel.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=EqaxMQ0ue5RjoXRCR/HykfXlaIjq8MZY6Aig5hFF/Rw=; b=MtUQ1ylCPtLRTrOAiX8i5WrJ4AcAnh0wZML1jlgHTUae7RlEZ35bIWMXr4JXQmJSme s0n08HW1hcc9FN0FkqiNF79rP8rnsIXCRk42aEQPrAe8N1meWWASu7DP9Gm/o882Tp/3 YnHsu6oiGCnHUouNabr0DJjvCeHZ+Zk1Pbm4aWDOO3hAhRebO8DR+pc3TWXvPoVV9+/c JxP6GO6CnX2ZtEMMAFpDEe3LAZTmk2i7Y5sAwPa24PYXUyzmZpNGoQN9NGHDH7RyFfo7 OCF9ttNibtwm6H+3cm4ecP38WkntUbh2Tkj1PqI02RvMpS0UZZJQOPGDsIxvb4Zxt2TS pT0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722104458; x=1722709258; 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=EqaxMQ0ue5RjoXRCR/HykfXlaIjq8MZY6Aig5hFF/Rw=; b=YucXuQgwpIRZ1z5p5LlkxHYbd+m+GVRpUJtJxYU/V3OMfoLjmmldNxajOPAYwoTJIx tVn5q+Zw1a5lZOhG4Fi86/SxTZi/L+XbZPwE7T2rJ8yw0UL/7ce0OVnwbPF6G+Y0AoZ2 zJ2+9ZFN46cz0ipsA8LSG6NJ9IHkE2lhc/wdsLXe07TQDwgpgrVBaOhdnRLoc8IpEFTJ 8uAD1R8fTC6r43V/W1wZgv9Vz7XtNLawE/o4UY40lO/TlKFJm4iH+915gPZArm3JekHU ysbIiSNgRKm2nlGeIKPIez1mJjq0J0Xn60rEeAxIsMeI/tJZOqT2NtoQdN6oNYYe8YkF OdXQ== X-Forwarded-Encrypted: i=1; AJvYcCVodgq4oZOHsEGVSYmGlP/7hXEuNhEQWoXS7ZymyV7Pf5R2vWbFk1HVmbEviHYGCbXZtXIH3n1XPyjYD0rUjg7M69sErIKt/oP+CUGX0SvkVeQ39ADmfqb7n040KF4e1wYpzr2lTWsjjmp5JN/bWYEviN0C1IwbG39/SS8P17c7t9lAy3EmNu1ehRJSzITMAq8e1lqhzBWOyilcIH8p0I9Oyp1Gcw== X-Gm-Message-State: AOJu0Yw67EKsSByZsLfRWQTRgiNsjUqAydcqj7JFBJxO5n1kVAhE7BdY 7t0LckxFKSLQdWqZo5JBMnZHwyjTxw4COP0ZEcm4OLna8dRPJCJ6+uOnzA== X-Google-Smtp-Source: AGHT+IGbBdJtk3eIEo/RH3d6bKcSiI0SsWpJ+V+kkSG9Ok71l+0sMc9Cw5SGvtCbjRPh+gvKYM/Y9Q== X-Received: by 2002:a2e:990e:0:b0:2ef:24e0:633b with SMTP id 38308e7fff4ca-2f12ecd42d4mr19809041fa.19.1722104458102; Sat, 27 Jul 2024 11:20:58 -0700 (PDT) Received: from localhost.localdomain (byw127.neoplus.adsl.tpnet.pl. [83.30.42.127]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f03d077226sm7504891fa.126.2024.07.27.11.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jul 2024 11:20:57 -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 , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Stephan Gerhold , alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Vladimir Lypak Subject: [PATCH v2 4/4] ASoC: qcom: apq8016_sbc: Add support for msm8953/msm8976 SoC Date: Sat, 27 Jul 2024 20:20:27 +0200 Message-ID: <20240727182031.35069-5-a39.skl@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240727182031.35069-1-a39.skl@gmail.com> References: <20240727182031.35069-1-a39.skl@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 68 ++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 303dd88206b1..453ca4795603 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,17 @@ 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 +274,16 @@ 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 +324,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 +405,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);