From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: broonie@kernel.org, perex@perex.cz, lgirdwood@gmail.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, krzk+dt@kernel.org,
neil.armstrong@linaro.org, krzysztof.kozlowski@linaro.org
Subject: Re: [PATCH v2 2/2] ASoC: codec: lpass-rx-macro: add suppor for 2.5 codec version
Date: Wed, 12 Jun 2024 15:37:56 +0100 [thread overview]
Message-ID: <5bf5ee5e-d24f-476f-9500-9d1b7adcfc72@linaro.org> (raw)
In-Reply-To: <qjyuvejxvjfanhqi3xpgobqjuugh52okxiutdprprx43emee7t@gzh7go6yc77z>
On 07/06/2024 12:03, Dmitry Baryshkov wrote:
> On Thu, Jun 06, 2024 at 01:25:59PM +0100, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> LPASS Codec v2.5 has significant changes in the rx register offsets.
>> Due to this headset playback on SM8550, SM8650, x1e80100 and all SoCs
>> after SM8450 have only Left working.
>>
>> This patch adjusts the registers to accomdate 2.5 changes. With this
>> fixed now L and R are functional on Headset playback.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>> sound/soc/codecs/lpass-rx-macro.c | 565 ++++++++++++++++++++++--------
>> 1 file changed, 410 insertions(+), 155 deletions(-)
>>
>> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
>> index f35187d69cac..bb8ede0e7076 100644
>> --- a/sound/soc/codecs/lpass-rx-macro.c
>> +++ b/sound/soc/codecs/lpass-rx-macro.c
>>
>> static int rx_macro_probe(struct platform_device *pdev)
>> {
>> + struct reg_default *reg_defaults;
>> struct device *dev = &pdev->dev;
>> kernel_ulong_t flags;
>> struct rx_macro *rx;
>> void __iomem *base;
>> - int ret;
>> + int ret, def_count;
>>
>> flags = (kernel_ulong_t)device_get_match_data(dev);
>>
>> @@ -3567,6 +3793,33 @@ static int rx_macro_probe(struct platform_device *pdev)
>> goto err;
>> }
>>
>> + rx->codec_version = lpass_macro_get_codec_version();
>
> What guarantees that VA macro has been probed already? If I'm not
> mistaken, we might easily get a default '0' here instead of a correct
> version.
fsgen(Frame sync gen) clk is derived from VA macro, so if we are here
that means the va macro is probed.
>
>> + switch (rx->codec_version) {
>> + case LPASS_CODEC_VERSION_2_5 ... LPASS_CODEC_VERSION_2_8:
>> + rx->rxn_reg_offset = 0xc0;
>> + def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults);
>> + reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL);
>> + if (!reg_defaults)
>> + return -ENOMEM;
>> + memcpy(®_defaults[0], rx_defaults, sizeof(rx_defaults));
>> + memcpy(®_defaults[ARRAY_SIZE(rx_defaults)],
>> + rx_2_5_defaults, sizeof(rx_2_5_defaults));
>> + break;
>> + default:
>> + rx->rxn_reg_offset = 0x80;
>> + def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_pre_2_5_defaults);
>> + reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL);
>> + if (!reg_defaults)
>> + return -ENOMEM;
>> + memcpy(®_defaults[0], rx_defaults, sizeof(rx_defaults));
>> + memcpy(®_defaults[ARRAY_SIZE(rx_defaults)],
>> + rx_pre_2_5_defaults, sizeof(rx_pre_2_5_defaults));
>> + break;
>> + }
>> +
>> + rx_regmap_config.reg_defaults = reg_defaults,
>> + rx_regmap_config.num_reg_defaults = def_count;
>> +
>> rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config);
>> if (IS_ERR(rx->regmap)) {
>> ret = PTR_ERR(rx->regmap);
>> @@ -3629,6 +3882,7 @@ static int rx_macro_probe(struct platform_device *pdev)
>> if (ret)
>> goto err_clkout;
>>
>> + kfree(reg_defaults);
>> return 0;
>>
>> err_clkout:
>> @@ -3642,6 +3896,7 @@ static int rx_macro_probe(struct platform_device *pdev)
>> err_dcodec:
>> clk_disable_unprepare(rx->macro);
>> err:
>> + kfree(reg_defaults);
>> lpass_macro_pds_exit(rx->pds);
>>
>> return ret;
>> --
>> 2.21.0
>>
>
next prev parent reply other threads:[~2024-06-12 14:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 12:25 [PATCH v2 0/2] ASoC: codecs: lpass: add support for v2.5 rx macro srinivas.kandagatla
2024-06-06 12:25 ` [PATCH v2 1/2] ASoC: codecs: lpass-macro: add helpers to get codec version srinivas.kandagatla
2024-06-07 10:58 ` Dmitry Baryshkov
2024-06-06 12:25 ` [PATCH v2 2/2] ASoC: codec: lpass-rx-macro: add suppor for 2.5 " srinivas.kandagatla
2024-06-07 11:03 ` Dmitry Baryshkov
2024-06-12 14:37 ` Srinivas Kandagatla [this message]
2024-06-12 16:52 ` Dmitry Baryshkov
2024-06-12 17:09 ` Srinivas Kandagatla
2024-06-12 18:13 ` Dmitry Baryshkov
2024-06-13 10:18 ` [PATCH v2 0/2] ASoC: codecs: lpass: add support for v2.5 rx macro neil.armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bf5ee5e-d24f-476f-9500-9d1b7adcfc72@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=perex@perex.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®