From: "Rivera-Matos, Ricardo" <rriveram@opensource.cirrus.com>
To: James Ogletree <jogletre@opensource.cirrus.com>,
<dmitry.torokhov@gmail.com>, <robh+dt@kernel.org>,
<krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>,
<lee@kernel.org>, <broonie@kernel.org>, <jeff@labundy.com>
Cc: <patches@opensource.cirrus.com>, <linux-sound@vger.kernel.org>,
<linux-input@vger.kernel.org>, <devicetree@vger.kernel.org>,
David Rhodes <drhodes@opensource.cirrus.com>
Subject: Re: [PATCH RESEND v10 5/5] ASoC: cs40l50: Support I2S streaming to CS40L50
Date: Thu, 30 May 2024 12:07:15 -0500 [thread overview]
Message-ID: <abf5d0d6-30f4-44f4-b01b-ad9e4321db58@opensource.cirrus.com> (raw)
In-Reply-To: <20240408153214.42368-6-jogletre@opensource.cirrus.com>
On 4/8/24 10:32 AM, James Ogletree wrote:
> Introduce support for Cirrus Logic Device CS40L50: a
> haptic driver with waveform memory, integrated DSP,
> and closed-loop algorithms.
>
> The ASoC driver enables I2S streaming to the device.
>
> Reviewed-by: David Rhodes <drhodes@opensource.cirrus.com>
> Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
> ---
> MAINTAINERS | 1 +
> sound/soc/codecs/Kconfig | 11 ++
> sound/soc/codecs/Makefile | 2 +
> sound/soc/codecs/cs40l50-codec.c | 308 +++++++++++++++++++++++++++++++
> 4 files changed, 322 insertions(+)
> create mode 100644 sound/soc/codecs/cs40l50-codec.c
>
<cut>
> diff --git a/sound/soc/codecs/cs40l50-codec.c b/sound/soc/codecs/cs40l50-codec.c
> new file mode 100644
> index 000000000000..6d4a0970b219
> --- /dev/null
> +++ b/sound/soc/codecs/cs40l50-codec.c
> @@ -0,0 +1,308 @@
> +// SPDX-License-Identifier: GPL-2.0
> +//
> +// CS40L50 Advanced Haptic Driver with waveform memory,
> +// integrated DSP, and closed-loop algorithms
> +//
> +// Copyright 2024 Cirrus Logic, Inc.
> +//
> +// Author: James Ogletree <james.ogletree@cirrus.com>
> +
> +#include <linux/bitfield.h>
> +#include <linux/mfd/cs40l50.h>
> +#include <linux/pm_runtime.h>
Is pm_runtime.h being used in the context of the codec driver? If not,
you should drop it.
> +#include <sound/pcm_params.h>
> +#include <sound/soc.h>
> +
<cut>
> +
> +static const struct cs40l50_pll_config cs40l50_pll_cfg[] = {
> + { 32768, 0x00 },
> + { 1536000, 0x1B },
> + { 3072000, 0x21 },
> + { 6144000, 0x28 },
> + { 9600000, 0x30 },
> + { 12288000, 0x33 },
> +};
> +
> +static int cs40l50_get_clk_config(unsigned int freq, unsigned int *cfg)
You could constify freq.
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(cs40l50_pll_cfg); i++) {
> + if (cs40l50_pll_cfg[i].freq == freq) {
> + *cfg = cs40l50_pll_cfg[i].cfg;
> + return 0;
> + }
> + }
> +
> + return -EINVAL;
> +}
> +
> +static int cs40l50_swap_ext_clk(struct cs40l50_codec *codec, unsigned int clk_src)
You could constify clk_src.
> +{
> + unsigned int cfg;
> + int ret;
> +
> + switch (clk_src) {
> + case CS40L50_PLL_REFCLK_BCLK:
> + ret = cs40l50_get_clk_config(codec->bclk_ratio * codec->rate, &cfg);
> + if (ret)
> + return ret;
> + break;
> + case CS40L50_PLL_REFCLK_MCLK:
> + cfg = CS40L50_PLL_REEFCLK_MCLK_CFG;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + ret = regmap_update_bits(codec->regmap, CS40L50_REFCLK_INPUT,
> + CS40L50_PLL_REFCLK_LOOP_MASK,
> + CS40L50_PLL_REFCLK_OPEN_LOOP <<
> + CS40L50_PLL_REFCLK_LOOP_SHIFT);
> + if (ret)
> + return ret;
> +
> + ret = regmap_update_bits(codec->regmap, CS40L50_REFCLK_INPUT,
> + CS40L50_PLL_REFCLK_FREQ_MASK |
> + CS40L50_PLL_REFCLK_SEL_MASK,
> + (cfg << CS40L50_PLL_REFCLK_FREQ_SHIFT) | clk_src);
> + if (ret)
> + return ret;
> +
> + return regmap_update_bits(codec->regmap, CS40L50_REFCLK_INPUT,
> + CS40L50_PLL_REFCLK_LOOP_MASK,
> + CS40L50_PLL_REFCLK_CLOSED_LOOP <<
> + CS40L50_PLL_REFCLK_LOOP_SHIFT);
> +}
> +
<cut>
> +
> +MODULE_DESCRIPTION("ASoC CS40L50 driver");
> +MODULE_AUTHOR("James Ogletree <james.ogletree@cirrus.com>");
> +MODULE_LICENSE("GPL");
This gets my Reviewed-by pending these edits.
Ricardo
prev parent reply other threads:[~2024-05-30 17:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 15:32 [PATCH RESEND v10 0/5] Add support for CS40L50 James Ogletree
2024-04-08 15:32 ` [PATCH RESEND v10 1/5] firmware: cs_dsp: Add write sequence interface James Ogletree
2024-04-08 15:32 ` [PATCH RESEND v10 2/5] dt-bindings: input: cirrus,cs40l50: Add initial DT binding James Ogletree
2024-04-08 15:32 ` [PATCH RESEND v10 3/5] mfd: cs40l50: Add support for CS40L50 core driver James Ogletree
2024-04-11 15:35 ` Lee Jones
2024-04-08 15:32 ` [PATCH RESEND v10 4/5] Input: cs40l50 - Add support for the CS40L50 haptic driver James Ogletree
2024-04-16 23:28 ` Dmitry Torokhov
2024-04-19 18:26 ` James Ogletree
2024-05-03 15:25 ` James Ogletree
2024-05-20 15:47 ` James Ogletree
2024-04-08 15:32 ` [PATCH RESEND v10 5/5] ASoC: cs40l50: Support I2S streaming to CS40L50 James Ogletree
2024-05-29 19:24 ` James Ogletree
2024-05-29 19:28 ` Mark Brown
2024-05-29 22:03 ` James Ogletree
2024-05-30 10:05 ` Mark Brown
2024-05-30 17:07 ` Rivera-Matos, Ricardo [this message]
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=abf5d0d6-30f4-44f4-b01b-ad9e4321db58@opensource.cirrus.com \
--to=rriveram@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=drhodes@opensource.cirrus.com \
--cc=jeff@labundy.com \
--cc=jogletre@opensource.cirrus.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).