From patchwork Wed Jul 31 15:25: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: 815717 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 7BD7E1AED3B; Wed, 31 Jul 2024 15:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439567; cv=none; b=rwsFTrOHf4vIGDixvbZLcq/b5wGs1A7M7mmFUIQWciEzlR4U4FIuMKnzIQs0TeUvGFui2kAzkBpCx0NWwtFlZIivLK5Cgk9MkSAVx4Zr5/wxJgAB39XDaEB3DDMJcY67rMwBaN7N5YqZet+Wv2Kc4M0Acz3RCLCQbyeJpgBmqiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439567; c=relaxed/simple; bh=lyyOSz5mnVlYsXDZyPPBuvrk6tGYt4/xz9ZU1RO5S4A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cai2m8vlyJTHNPdiFAI/fNHn5tIW7Oxul2RXgSEfAvZ0oOn63XbkT97uOmfMM+pxhFkEZlgVfn3XMIHefk4UtgQ46TEoo7w971wd1vS7xisF6S7REZMfRgNr45EbAjeTDIyll1roH04v7+sCYavdxlg54WEjP86LtxGJEWTb8cQ= 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=mRfGq9og; arc=none smtp.client-ip=209.85.128.48 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="mRfGq9og" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4281d812d3eso37148815e9.3; Wed, 31 Jul 2024 08:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722439564; x=1723044364; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FC0xYn/ikx2v85GL/8Br0D4pnaNCpqHqIy3/h9Umxsk=; b=mRfGq9og9ioSmRoHSN8vjdo6q7Nzs2GydUh9MEdD7JJcm69xIjzFCrVV3z6VWrp5BQ K6jL5LtXDlwjJAQSKE3vV3JNH91OFx9KA0Q4uUK4zouXFEQ2Z3KB3IIXEXC09dM2YNOv 4Gv4lbHWgl1xO9Kr4TNxIhVFgBU0gBSxsGEN9DfksI0DcMuMfugyBqMnmvLxINi3tjju gOhgxylCbYQxMHoZXN1reqjA6PU+sB7f3tnn55vw1ZwF6TDPQjgeFcxvWqeVtzzzwFLf yuyYdRtwQwT+wyRTKHvvfwbdRWRuL+Ea8gPPCdRH1cSRAnV/UxiZwPROHPZrRG5sBS04 T6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439564; x=1723044364; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FC0xYn/ikx2v85GL/8Br0D4pnaNCpqHqIy3/h9Umxsk=; b=NvEPbib/hUM0Mx2G7wjkqQq1HdR5+XRXYERu9C7fGCHKj7dT2UdTncsV7keaCZU7oK jvqIInkf09DlchnOHc3KQFZy7CZdAG30K0uXA3h5TwMD8dGa5EYwmdmGdxA+AbwHdWy3 fhAIo2sTotAlSxu1LA541LWvCSOvKAZ8yZYsz8XIyPQfPHCM3R1ly/j7ZVjIjknSsR4r Sp/kTZQ1wRwKnOIs1SyVVZbX3nA0LMp88Kjbb68FSCJ4qCz0FCt5YNR4+rq04Ykg4dLr P8gjNtcCpaiBBPwl3YMl5yCxJMXGIcNhw7UKm6HfJ4PPIao2NaCt3M00MxXfMGgYhw/G Y/Aw== X-Forwarded-Encrypted: i=1; AJvYcCVj2Fx2O1BHhhWBXZW5mX1t4sQeki8Ig4WOc5FF7JaKI3e7MUwxRvF+ForQ7DB0JInH8iCc+bgB3czOq981w7MJUmh4drSQDEMXNQwCeHDJxp3t45MEFdjIbufYI6gzWgySN4rhdaiuk5zinFCXvOjhn79xVfQ1Rd8+INvqZ/6Vnhje9YKy/sduq14CwM+R05RqUVaKJlhOEr2N6ynVUvVvANOXtA== X-Gm-Message-State: AOJu0YxPFhOeG/S9IVYnPuzLA9nDhIAEBC8F5X8a3Y3zfFmeYYrAkD04 bsxRevixlMQushqbocVOA3F0dbQbRM3xCAyW/y3k9xpiRX3tLxDCnl2pPQ== X-Google-Smtp-Source: AGHT+IGV5Tyg8OIw9jbYm8EISXLPoSoS24RYZm1S5mUY09Ep05QHPxO5cMSJU7Ibzbu5TFy9NWYQ+w== X-Received: by 2002:a05:600c:3590:b0:426:5c81:2538 with SMTP id 5b1f17b1804b1-42828544a87mr33856585e9.14.1722439563745; Wed, 31 Jul 2024 08:26:03 -0700 (PDT) Received: from [127.0.1.1] (byv161.neoplus.adsl.tpnet.pl. [83.30.41.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb64755sm25430985e9.36.2024.07.31.08.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:26:03 -0700 (PDT) From: Adam Skladowski Date: Wed, 31 Jul 2024 17:25:25 +0200 Subject: [PATCH v3 1/8] ASoC: qcom: apq8016_sbc.c: Add Quinary support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-msm8953-msm8976-asoc-v3-1-163f23c3a28d@gmail.com> References: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> In-Reply-To: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , Stephan Gerhold Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Adam Skladowski , Vladimir Lypak X-Mailer: b4 0.14.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 Acked-by: Konrad Dybcio --- sound/soc/qcom/apq8016_sbc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 3023cf180a75..5a29adbd3f82 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,10 @@ 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"); + if (res != NULL) + data->quin_iomux = devm_ioremap_resource(&pdev->dev, res); + snd_soc_card_set_drvdata(card, data); add_ops(card); From patchwork Wed Jul 31 15:25: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: 815716 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 A071C1BD013; Wed, 31 Jul 2024 15:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439572; cv=none; b=H6eLnknHVB4YDj1Mkur7SG+d4mzYnkdNYItID4Q6+11YBTtILsfcc023Gg8ryZCYn3sG2o7EuKEkUSzYLJ3e93lqDww8tYTQe4sDMKoez8SiQQlip2LRCqL1fz15/apnVfWrLbwgxXo8zNJf/ROF9/43crYqBFGPEI7PP3ApqMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439572; c=relaxed/simple; bh=b/S9uy+bIF3wHOM/WZrlrCVkMM4isQGv528aMZ3QO/A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CUHRXXPfmu//E0RyJ1TYrp40yKr5ckJoTFTer5LdCF8IM5EtTUH9pxeJDndRD9zKDN0UivbWU3KCP2C47faZkBKYfGYgVDoUHrSVTq1/YkNyR2QHqUtWP9R1C1NuQKySBIcQh190c3WoENKNvIVJc2fN+Mg4e/ORtOxKlXYTV+o= 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=lY5jT9tV; arc=none smtp.client-ip=209.85.128.50 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="lY5jT9tV" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4281faefea9so26444215e9.2; Wed, 31 Jul 2024 08:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722439568; x=1723044368; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sURZDxH5XdiCOHMBbcEMdZ8vmUSUFBsPH3V2odo9HSw=; b=lY5jT9tV0FSOZ4D0uiWCfx2y9ZWq1MtTP0CBcxoti2LkuGqXrJ2tY6at8etqbYuLX+ B1DfMuvtoa7aFvF2wBLnJZoHc/7pPx4hzUKGRi7rcaB9pCWT5EgNsUs+BtBvJQhL5AqC /IGEPhqo6HsDSOYwt4k8/Qwp7JjE93TSa92PP18502Ce3/Q/WW5IJi5qmp6ThknqQcUT XyYYpw+/xoKj6XltCN1EVnsr5flHQZzOx1j19eMmZ/RdePKHem5cDUr4OSrZPAO9URol LaHl+wramsLRTdjg39oEzzOWyJ60wtiHWN7oAA3ydthUa+s77mJW2KjICuwgHKyHPicQ R3Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439568; x=1723044368; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sURZDxH5XdiCOHMBbcEMdZ8vmUSUFBsPH3V2odo9HSw=; b=f/3b4O5M0xt0htbBHeBz7bERPiZFwaeRddxZiF3Cz8FsX5kRZHvsTcPRt3vHaYsTpG CHbHebxOKZVpqTb0OzacPcTH38gxU79xqAQxEVR4g0SPEjL2pfRpuFD7B6d4Y+u7rGsN adq4Yazdn1DZoshzFIxxeSXkGcZtVdb7LhWiUGhpHZti98ChRbsOX0BzJ8VuOIoP8mAK mNYMHyEZGBXSsDs05LLnd5pF1uY7O2qAh23EPNNrBouAiUsXilfKRPi2zbfZ2zLHhCUE NEqbupHdU7S+9SPt6p4GkoLvqhZLHAjkCwqPdV9adiIWNRwmq3KLd5zBj4JLW/Geat6k f9Pw== X-Forwarded-Encrypted: i=1; AJvYcCXpzlBeCHS5MsG7oJWbvmJ9NJuDiiM+9ZZmvy6FOnWKIirQXyvnohDwQ7viaRtHXlE8YhUjFg0QMM+mVdSS62Frhxxxc8imXBc+BSPTMXnZsL1qc9ubImA36ulgro+NIFdE43fWiPkYT1jLg+h8AqVqFDmIQYTC/H29sGMr0kFtI8CyfcvcPCy05j51Sh+0P2KfJWa7xj/WPXBhrKfdnwMW13I/7w== X-Gm-Message-State: AOJu0Yye7ZhyzuP60ZtSO6OOe1THvJu89ZqpbhryB2cAFuObU6dW57uQ A2AJ8UDUM5J5ZJTzh9ReMUDS7uflYlDU0cmtNvwZ38D+BvoBmh71 X-Google-Smtp-Source: AGHT+IG1H5Bp8jT30iBFVbiEisWLixnQb+cAxq4bxDj2j3vvk6Vqxm5kMpTGRf+D6NJonYzOXpNGuw== X-Received: by 2002:a05:600c:190b:b0:428:1846:4f0 with SMTP id 5b1f17b1804b1-428184606e9mr83560415e9.16.1722439567835; Wed, 31 Jul 2024 08:26:07 -0700 (PDT) Received: from [127.0.1.1] (byv161.neoplus.adsl.tpnet.pl. [83.30.41.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb64755sm25430985e9.36.2024.07.31.08.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:26:07 -0700 (PDT) From: Adam Skladowski Date: Wed, 31 Jul 2024 17:25:27 +0200 Subject: [PATCH v3 3/8] ASoC: msm8916-wcd-analog: add pm8950 codec Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-msm8953-msm8976-asoc-v3-3-163f23c3a28d@gmail.com> References: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> In-Reply-To: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , Stephan Gerhold Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Adam Skladowski X-Mailer: b4 0.14.0 Add regs overrides for PM8950 codec and implement matching reg overrides via compatible. Signed-off-by: Adam Skladowski --- sound/soc/codecs/msm8916-wcd-analog.c | 52 ++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 9ca381812975..13df60409857 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -232,6 +232,8 @@ #define RX_EAR_CTL_PA_SEL_MASK BIT(7) #define RX_EAR_CTL_PA_SEL BIT(7) +#define CDC_A_RX_EAR_STATUS (0xf1A1) + #define CDC_A_SPKR_DAC_CTL (0xf1B0) #define SPKR_DAC_CTL_DAC_RESET_MASK BIT(4) #define SPKR_DAC_CTL_DAC_RESET_NORMAL 0 @@ -250,6 +252,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,6 +267,7 @@ #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) @@ -286,6 +290,11 @@ static const char * const supply_names[] = { #define MBHC_MAX_BUTTONS (5) +struct wcd_reg_seq { + const struct reg_default *seq; + int seq_size; +}; + struct pm8916_wcd_analog_priv { u16 pmic_rev; u16 codec_version; @@ -715,9 +724,41 @@ static const struct reg_default wcd_reg_defaults_2_0[] = { {CDC_A_MASTER_BIAS_CTL, 0x30}, }; +static const struct wcd_reg_seq pm8916_data = { + .seq = wcd_reg_defaults_2_0, + .seq_size = ARRAY_SIZE(wcd_reg_defaults_2_0), +}; + +static const struct reg_default wcd_reg_defaults_pm8950[] = { + {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 wcd_reg_seq pm8950_data = { + .seq = wcd_reg_defaults_pm8950, + .seq_size = ARRAY_SIZE(wcd_reg_defaults_pm8950), +}; + static int pm8916_wcd_analog_probe(struct snd_soc_component *component) { struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(component->dev); + const struct wcd_reg_seq *wcd_reg_init_data; int err, reg; err = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); @@ -738,9 +779,11 @@ 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); + wcd_reg_init_data = of_device_get_match_data(component->dev); + + for (reg = 0; reg < wcd_reg_init_data->seq_size; reg++) + snd_soc_component_write(component, wcd_reg_init_data->seq[reg].reg, + wcd_reg_init_data->seq[reg].def); priv->component = component; @@ -1259,7 +1302,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) } static const struct of_device_id pm8916_wcd_analog_spmi_match_table[] = { - { .compatible = "qcom,pm8916-wcd-analog-codec", }, + { .compatible = "qcom,pm8916-wcd-analog-codec", .data = &pm8916_data }, + { .compatible = "qcom,pm8950-wcd-analog-codec", .data = &pm8950_data }, { } }; From patchwork Wed Jul 31 15:25:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 815715 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 D249B1BD034; Wed, 31 Jul 2024 15:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439575; cv=none; b=K9HvJtASY88LjzhP7finGy/1v/VkZt+TJ9rI0GyY7bDt0huhM8dCpOMw+DXxfG0XRvlleOZ+4zdzzbGtBPWtQdOWyOfAHr6wWp1A1F93rc9e+0TJaiccHytHbt7Io0vHYULCcBaB1MMPvNQFrIxrifIrwSnveNW2FK0Yg4n64Tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439575; c=relaxed/simple; bh=ub3FOT3N4vnIxLUsFS2HSpg9K4GlOZ+9OZbF4CeT7Fo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uh5bjDt1Vgkq82bG8HtpCPoeCJp7PpgMmSFZDYQxdteruSF9Wv97Wy09E7P28NRx+56TglY2r3pJp3hwTw58kGhOu3ggi0fFLii/zIh7QEj7vrm8Ecfi+srXLMfPGvjItfVtB97QPFKuzYR9aiUEXYOvMf2tcHfFl9I/vTU32Do= 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=jfYV8nqR; arc=none smtp.client-ip=209.85.128.52 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="jfYV8nqR" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4281e3b2f72so28813775e9.1; Wed, 31 Jul 2024 08:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722439572; x=1723044372; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+1Cyu5R+oW5fffURVcJfSnNMpwp4wHNtRUsf1XeMFf4=; b=jfYV8nqR6U92Sde3OCgCuqRcRI7zowIv8ByB2apWqo7/FdyAuZrIX37gjjNSlDOK5l cfSwtiu17JwUxpv7625AWpvlnCxJnVm2Ur7s/jpu/SeH3ZLR68MaflhjPdFr8kSjWPjO iy6bDJRsVjyO1zv6Mbt5hr2n9ZwGcQtaPcly0R3b0WmKwVDjbVdF9xLOyX5r2yPz5nuv ZPnTEwCCA/0A43bSifdKLBNg3si252C14AFIn4cKWmXnjFxOZ5o9ohEuJodjM6pE01js SR2kvTJLSwnledjQhXUA9irtKSSokW7hYY49jJAg2+8Ir0mji+yeCQeum19USl6vLncD zYrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439572; x=1723044372; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+1Cyu5R+oW5fffURVcJfSnNMpwp4wHNtRUsf1XeMFf4=; b=dPE6Wxf889N6PqFQG6FpwF54iGHGzfT/1Qgo1ouEJCUxxtH7AZeXMqUJIshTeBihfW g43tIONPwm5dB3qAbaU/p+7TeYKDtRor0rsYpF3NBEZRVIYVJIivo5KVAp3rbAOXl89D 5gC19gQkw0w8QNUEqUz+ezYbT6asE87liBpbPwNjCI33IECBabpUiYP6wegb2bg+/FrL UATxZ58x2w5zxFNFN5zd1xTfGRL+ZfzQRyMG/TO8ubCpn4zTJ55yIApsOVOSj+pZcCnn 0b5iZaKRC03JbV7mBegFEoXFf9yhwJtgWfAihWso/7ExsbP9AC5Y0hNbty1QLcGkKoMw xkeA== X-Forwarded-Encrypted: i=1; AJvYcCVCOy2Dfr8XjD+bqB4wLCQsfnrxc2Likr7uyQxt+GZeiSRlr/TbrZNpxT6O9L5zH3H3jSzKHpaNCNonqPNpudlXL4cRKnY5sUqplvJV+gp43BsVMcIV23zEoJatw4RG3cAwXUYS3GPr/MO0DmH+84S3EN3zOuQBMOzK2hA0XZhJosCPaNtISBO54815uthiIywLSSEVO8skS8nq9PrJmSh9FgfqDQ== X-Gm-Message-State: AOJu0YzXCjP5yHeTHoXigq1ddp5eXSEMJAAOSURn7grNhczaH3Hsrf/X TrEFJVTIMI+4qoY+H5gQc+/klInePCKyLB0gjtIw8u+YxfOBBujBvs1UuQ== X-Google-Smtp-Source: AGHT+IE4tWC1HMsu8ewKdcCzKf9d3rockdZHaoPstllb0YXHMBWMItwOq1au+xKA5f8sl27YWu529w== X-Received: by 2002:a05:600c:3547:b0:426:5f8f:51a4 with SMTP id 5b1f17b1804b1-42811d89f99mr87663815e9.12.1722439572060; Wed, 31 Jul 2024 08:26:12 -0700 (PDT) Received: from [127.0.1.1] (byv161.neoplus.adsl.tpnet.pl. [83.30.41.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb64755sm25430985e9.36.2024.07.31.08.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:26:11 -0700 (PDT) From: Adam Skladowski Date: Wed, 31 Jul 2024 17:25:29 +0200 Subject: [PATCH v3 5/8] ASoC: dt-bindings: apq8016-sbc: Add msm8953/msm8976-qdsp6-sndcard Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-msm8953-msm8976-asoc-v3-5-163f23c3a28d@gmail.com> References: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> In-Reply-To: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , Stephan Gerhold Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Adam Skladowski X-Mailer: b4 0.14.0 Document MSM8953/MSM8976 QDSP6 cards. Signed-off-by: Adam Skladowski Reviewed-by: Krzysztof Kozlowski --- .../bindings/sound/qcom,apq8016-sbc-sndcard.yaml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml b/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml index 6ad451549036..43db5ad65d75 100644 --- a/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc-sndcard.yaml @@ -15,16 +15,22 @@ properties: enum: - qcom,apq8016-sbc-sndcard - qcom,msm8916-qdsp6-sndcard + - qcom,msm8953-qdsp6-sndcard + - qcom,msm8976-qdsp6-sndcard reg: + minItems: 2 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: + minItems: 2 items: - const: mic-iomux - const: spkr-iomux + - const: quin-iomux audio-routing: $ref: /schemas/types.yaml#/definitions/non-unique-string-array @@ -106,6 +112,27 @@ required: - reg-names - model +allOf: + - if: + properties: + compatible: + contains: + enum: + - qcom,apq8016-sbc-sndcard + - qcom,msm8916-qdsp6-sndcard + then: + properties: + reg: + maxItems: 2 + reg-names: + maxItems: 2 + else: + properties: + reg: + minItems: 3 + reg-names: + minItems: 3 + additionalProperties: false examples: From patchwork Wed Jul 31 15:25:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Skladowski X-Patchwork-Id: 815714 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 80D531BE245; Wed, 31 Jul 2024 15:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439580; cv=none; b=AlWIa7YkfOqbHKlbcHKt2sWu2zmQ2NvAcBqQEct1AHNoA3p7hMQBa1x/G6R7xsIMFSU18IeWiw7RcabsQkUIG//eK2BUWNgbehjOQNDoN6+bdcdnuxaw1REAvys5fm0W5BaHSOgh3nfhjAQov9VorvZR9XU+xBmnF+b3DIPPa3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722439580; c=relaxed/simple; bh=7ih/twfj7Vu9/nowcpH2q0+GyQypwWFRSVqFIt9jL5M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VZxiP/jMW7SGHhqB6DA3wK76X7tMMcMDHwi2NNO4lU/LdFaaWfGAAAF3jqe9lZjlfJ3qgsaE/Pdfmiejfwckgpl43JSo97wLWDN4I2ZgRk9CQ+MDtYfBF/iz6hlLjo7hP6Cy/9QnEzJg4dUrWy/hVJxLzN6X5ZdRKyPqVTbHxxk= 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=naUzGYF6; arc=none smtp.client-ip=209.85.208.177 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="naUzGYF6" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ef23d04541so71019181fa.2; Wed, 31 Jul 2024 08:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722439577; x=1723044377; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QiPIHigZUWEy/gTiB3EmC11NKGqz88RzfHr+wLDLdBQ=; b=naUzGYF6rIo9kAgKJebJ9oT0iyk6ka+rxFIRUMXobPf3brJ7xyWapQTfD68VHwdfLa 4PsOW0hBMz1emgJm5lhAOL9t+aC2xJx2azY+S/GdNgbngydXhLMxw9sJCwfKZqntNMs8 eqGNPPgNgebb318v69dzKkQ9mm1iOdQea2gTr4s2h3FwA99XEACuhG/k5QmRSc6E+teq CthJgYZBwUEdQQgp+eCUMP8p6EinQdZSXs1p82WIUX0Wp+fi6+hN08f4WTYP/SszYsZp 2AoHe7DFsv/56T7k73bc3r6BIzOxMLefdULfxObk+X1ee4f9BKUuD7ZNeIRAADYciNif aDFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722439577; x=1723044377; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QiPIHigZUWEy/gTiB3EmC11NKGqz88RzfHr+wLDLdBQ=; b=l36eX8Is1pJEUWC8/t16EhKHXFSsKnVnlKM1bK+wwsenbqpXHg6jw2NaHjiiHt1js8 xgcv4Q9avg61/V+cHHB+b2nLRF7TQmNte5/CUan6ouHRkV3p2vDRWMeuDC7JeJCpsi5E 6HOnpvicxttMpWG/nbreQTG8Y9fduebUzzNLmRSgpVC02+0FXWi5MVC8873n+a30xQfY lCNeAmwpkUcQjSuOgyE4HQ3tZuCuX0hPqmZy0n4cduBTRAdnYQUGW5iFej4/vjvMrUEJ m0x1qSpursVPJWX/TtYfXFsnE0rHtjdrTCWj7F44Z1x9HkZc7yR9jPRRy57otn8FLNSu OnnA== X-Forwarded-Encrypted: i=1; AJvYcCXt9VLTnFl+Ryu9YpgwFsfOu961oVd++B1K1XVW5mYoeVgi/5T/cAuJknMPgxMyF64UutVdbcjWrAs7UESqdUB/GBMB/1EdURSWogZ3F5zH7cV4nAyRsLagNecEV+wRPA+3Df9kiUmF0g40hJEBMV/eAJp5PdfYROmw8j0AEAbAFsIOfT3BPkF0qF5s8BOXdyU0z3zd1T0nVs1Gnq0x9UA4lCQ4Eg== X-Gm-Message-State: AOJu0YzKwI2UFicgrKH7NYpQzpd2iTxT6Zv29IekP574w2NEV7VPMc07 yVLF4pp9FwQThYVfR1p8Y7D8ZALowW9rza2SNitADVRicBZDJ38g X-Google-Smtp-Source: AGHT+IGfiiY8nEDh5Jy5pRnrx5JgptFO0aaTdFxWxnCuI2DfwVrpN841vJxt9dac7N5AxkUuFMo2zw== X-Received: by 2002:a2e:7d13:0:b0:2ef:2b38:879c with SMTP id 38308e7fff4ca-2f12edf02b2mr97756941fa.3.1722439576327; Wed, 31 Jul 2024 08:26:16 -0700 (PDT) Received: from [127.0.1.1] (byv161.neoplus.adsl.tpnet.pl. [83.30.41.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb64755sm25430985e9.36.2024.07.31.08.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 08:26:15 -0700 (PDT) From: Adam Skladowski Date: Wed, 31 Jul 2024 17:25:31 +0200 Subject: [PATCH v3 7/8] ASoC: qcom: apq8016_sbc: Add support for msm8976 SoC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-msm8953-msm8976-asoc-v3-7-163f23c3a28d@gmail.com> References: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> In-Reply-To: <20240731-msm8953-msm8976-asoc-v3-0-163f23c3a28d@gmail.com> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , Stephan Gerhold Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Adam Skladowski X-Mailer: b4 0.14.0 Introduce support for audio card on MSM8976 platform. While MSM8976 falls into v1 category with MSM8916, digitial codec clock is not available in GCC so we have to set it in machine driver. For that reason for V1 clocks new boolean is added to check if we need to enable codec clock. Signed-off-by: Adam Skladowski --- sound/soc/qcom/apq8016_sbc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 3ed35beb671a..8219d4d55625 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -35,6 +35,7 @@ struct apq8016_sbc_data { 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]; }; @@ -242,6 +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) { + 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, qdsp6_get_clk_id(data, mi2s), MI2S_BCLK_RATE, 0); if (ret) @@ -267,6 +278,13 @@ static void msm8916_qdsp6_shutdown(struct snd_pcm_substream *substream) 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) { + 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 = { @@ -317,6 +335,15 @@ static void msm8953_qdsp6_add_ops(struct snd_soc_card *card) pdata->q6afe_clk_ver = Q6AFE_CLK_V2; } +static void msm8976_qdsp6_add_ops(struct snd_soc_card *card) +{ + struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); + + msm8916_qdsp6_add_ops(card); + pdata->q6afe_clk_ver = Q6AFE_CLK_V1; + pdata->dig_cdc_mclk_en = true; +} + static const struct snd_kcontrol_new apq8016_sbc_snd_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Mic Jack"), @@ -383,6 +410,7 @@ 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);