From: Jeff LaBundy <jeff@labundy.com>
To: Fred Treven <fred.treven@cirrus.com>
Cc: Ben Bright <ben.bright@cirrus.com>,
James Ogletree <james.ogletree@cirrus.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Simon Trimmer <simont@opensource.cirrus.com>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
patches@opensource.cirrus.com, linux-input@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
lee@kernel.org
Subject: Re: [PATCH 4/5] Input: cs40l26 - Load multiple coefficient files
Date: Fri, 26 May 2023 14:37:30 -0500 [thread overview]
Message-ID: <ZHEKeiDRtKQ1FnfE@nixie71> (raw)
In-Reply-To: <1685059471-9598-4-git-send-email-fred.treven@cirrus.com>
Hi Fred,
On Thu, May 25, 2023 at 07:04:30PM -0500, Fred Treven wrote:
> Enable the driver to load all necessary coefficient tuning
> files: cs40l26.bin (wavetable)
> cs40l26-svc.bin (Sensorless Velocity Control)
> cs40l26-dvl.bin (Dynamic Voltage Limiter)
>
> Signed-off-by: Fred Treven <fred.treven@cirrus.com>
> ---
Thanks for sending; glad to see this series continue to move along. Just a
few notes about best practice for reviews:
1. For the purpose of mainline submission, patches 2 and 4 must be squashed,
and then come after their dependency (patch 3 in this case). Otherwise, we
end up reviewing code that subsequently disappears or changes in a subsequent
patch.
2. All patches in the same thread must have the same version number (e.g. v2).
If a patch was not present in a previous iteration, the change log can simply
say so. Speaking of which...
3. Please include a change log below the '---' so that it is clear what has
changed since the last review.
4. This is a matter of personal taste, but for a new driver that touches a
few different areas such as this, it's nice to have a cover letter to explain
the general layout and motivation. This is also a good place to put a change
log.
> drivers/input/misc/cs40l26.c | 31 +++++++++++++++++++++++--------
> include/linux/input/cs40l26.h | 3 ++-
> 2 files changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/input/misc/cs40l26.c b/drivers/input/misc/cs40l26.c
> index 1959438dfe31..12c29cbd4ff0 100644
> --- a/drivers/input/misc/cs40l26.c
> +++ b/drivers/input/misc/cs40l26.c
> @@ -2006,6 +2006,12 @@ static const struct cs_dsp_client_ops cs40l26_cs_dsp_client_ops = {
> .post_run = cs40l26_cs_dsp_post_run,
> };
>
> +static struct cs_dsp_coeff_desc cs40l26_coeffs[] = {
> + { .coeff_firmware = NULL, .coeff_filename = "cs40l26.bin", .optional = false },
> + { .coeff_firmware = NULL, .coeff_filename = "cs40l26-svc.bin", .optional = true },
> + { .coeff_firmware = NULL, .coeff_filename = "cs40l26-dvl.bin", .optional = true },
> +};
> +
> static int cs40l26_cs_dsp_init(struct cs40l26_private *cs40l26)
> {
> int error;
> @@ -2035,14 +2041,16 @@ static int cs40l26_cs_dsp_init(struct cs40l26_private *cs40l26)
> static void cs40l26_dsp_start(struct cs40l26_private *cs40l26)
> {
> struct device *dev = cs40l26->dev;
> + int i;
>
> if (cs40l26_dsp_pre_config(cs40l26))
> goto err_rls_fw;
>
> mutex_lock(&cs40l26->lock);
>
> - if (cs_dsp_power_up(&cs40l26->dsp, cs40l26->wmfw, "cs40l26.wmfw",
> - cs40l26->bin, "cs40l26.bin", "cs40l26"))
> + if (cs_dsp_power_up_multiple(&cs40l26->dsp, cs40l26->wmfw, "cs40l26.wmfw",
> + cs40l26_coeffs, CS40L26_NUM_COEFF_FILES,
> + "cs40l26"))
> goto err_mutex;
>
> if (cs40l26->dsp.fw_id != CS40L26_FW_ID) {
> @@ -2062,7 +2070,9 @@ static void cs40l26_dsp_start(struct cs40l26_private *cs40l26)
> mutex_unlock(&cs40l26->lock);
>
> err_rls_fw:
> - release_firmware(cs40l26->bin);
> + for (i = 0; i < CS40L26_NUM_COEFF_FILES; i++)
> + release_firmware(cs40l26_coeffs[i].coeff_firmware);
> +
> release_firmware(cs40l26->wmfw);
>
> cs40l26_pm_runtime_setup(cs40l26);
> @@ -2074,17 +2084,20 @@ static void cs40l26_coeff_upload(const struct firmware *bin, void *context)
>
> if (!bin) {
> dev_err(cs40l26->dev, "Failed to request coefficient file\n");
> + cs40l26->ncoeffs++;
> return;
> }
>
> - cs40l26->bin = bin;
> + cs40l26_coeffs[cs40l26->ncoeffs++].coeff_firmware = bin;
>
> - cs40l26_dsp_start(cs40l26);
> + if (cs40l26->ncoeffs == CS40L26_NUM_COEFF_FILES)
> + cs40l26_dsp_start(cs40l26);
> }
>
> static void cs40l26_fw_upload(const struct firmware *wmfw, void *context)
> {
> struct cs40l26_private *cs40l26 = (struct cs40l26_private *)context;
> + int i;
>
> if (!wmfw) {
> dev_err(cs40l26->dev, "Failed to request firmware file\n");
> @@ -2098,9 +2111,11 @@ static void cs40l26_fw_upload(const struct firmware *wmfw, void *context)
>
> cs40l26->wmfw = wmfw;
>
> - request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
> - "cs40l26.bin", cs40l26->dev, GFP_KERNEL,
> - cs40l26, cs40l26_coeff_upload);
> + for (i = 0; i < CS40L26_NUM_COEFF_FILES; i++)
> + request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
> + "cs40l26.bin", cs40l26->dev,
> + GFP_KERNEL, cs40l26,
> + cs40l26_coeff_upload);
> }
>
> static inline int cs40l26_worker_init(struct cs40l26_private *cs40l26)
> diff --git a/include/linux/input/cs40l26.h b/include/linux/input/cs40l26.h
> index bc0acec9cf23..2f74ef61b952 100644
> --- a/include/linux/input/cs40l26.h
> +++ b/include/linux/input/cs40l26.h
> @@ -231,6 +231,7 @@
> /* Firmware Handling */
> #define CS40L26_FW_ID 0x1800D4
> #define CS40L26_FW_ID_VERSION_MIN 0x070237
> +#define CS40L26_NUM_COEFF_FILES 3
>
> /* Algorithms */
> #define CS40L26_BUZZGEN_ALGO_ID 0x0004F202
> @@ -473,8 +474,8 @@ struct cs40l26_private {
> unsigned int vbst_uv;
> bool exploratory_mode_enabled;
> const struct firmware *wmfw;
> - const struct firmware *bin;
> bool dsp_initialized;
> + int ncoeffs;
> };
>
> int cs40l26_probe(struct cs40l26_private *cs40l26);
> --
> 2.7.4
>
Kind regards,
Jeff LaBundy
next prev parent reply other threads:[~2023-05-26 19:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 0:04 [PATCH v2 1/5] dt-bindings: input: cirrus,cs40l26: Support for CS40L26 Fred Treven
2023-05-26 0:04 ` [PATCH v2 2/5] Input: cs40l26 - Support for CS40L26 Haptic Device Fred Treven
2023-05-26 0:04 ` [PATCH 3/5] firmware: cs_dsp: Add ability to loa multiple coefficient files Fred Treven
2023-05-26 0:04 ` [PATCH 4/5] Input: cs40l26 - Load " Fred Treven
2023-05-26 19:37 ` Jeff LaBundy [this message]
2023-05-26 0:04 ` [PATCH RFC 5/5] mfd: cs40l26: Add CODEC driver component Fred Treven
2023-05-26 7:54 ` Lee Jones
2023-05-26 19:43 ` Jeff LaBundy
2023-05-26 21:23 ` Fred Treven
2023-05-26 21:55 ` Jeff LaBundy
2023-05-26 19:27 ` [PATCH v2 1/5] dt-bindings: input: cirrus,cs40l26: Support for CS40L26 Conor Dooley
2023-05-26 21:32 ` Fred Treven
2023-05-26 22:03 ` Conor Dooley
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=ZHEKeiDRtKQ1FnfE@nixie71 \
--to=jeff@labundy.com \
--cc=ben.bright@cirrus.com \
--cc=ckeepax@opensource.cirrus.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=fred.treven@cirrus.com \
--cc=james.ogletree@cirrus.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rf@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
--cc=simont@opensource.cirrus.com \
/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).