linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 RFC 5/5] mfd: cs40l26: Add CODEC driver component
Date: Fri, 26 May 2023 14:43:27 -0500	[thread overview]
Message-ID: <ZHEL30a/YEia7kjr@nixie71> (raw)
In-Reply-To: <1685059471-9598-5-git-send-email-fred.treven@cirrus.com>

Hi Fred,

On Thu, May 25, 2023 at 07:04:31PM -0500, Fred Treven wrote:
> Use MFD interface to load the CODEC driver along
> with the Input FF driver.
> 
> Signed-off-by: Fred Treven <fred.treven@cirrus.com>
> ---

Did you mean to include a thin codec driver as part of this series to
support the audio-to-haptics use-case? I don't see one.

As Lee correctly points out, this isn't an MFD despite the title of the
commit message, and is sort of an abuse of the API.

What you seem to actually want is a true MFD driver responsible for
initializing common resources such as regmap, an IRQ chip, etc. That
driver then adds input and codec drivers as children.

At the moment, you're more or less treating the input driver as the
MFD with one child, but that is not the correct pattern.

>  drivers/input/misc/cs40l26.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/input/misc/cs40l26.c b/drivers/input/misc/cs40l26.c
> index 12c29cbd4ff0..35d15a6c2230 100644
> --- a/drivers/input/misc/cs40l26.c
> +++ b/drivers/input/misc/cs40l26.c
> @@ -13,6 +13,7 @@
>  #include <linux/i2c.h>
>  #include <linux/interrupt.h>
>  #include <linux/kernel.h>
> +#include <linux/mfd/core.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/string.h>
>  #include <linux/firmware/cirrus/wmfw.h>
> @@ -2136,6 +2137,10 @@ static inline int cs40l26_worker_init(struct cs40l26_private *cs40l26)
>  	return 0;
>  }
>  
> +static const struct mfd_cell cs40l26_devs[] = {
> +	{ .name = "cs40l26-codec" },
> +};
> +
>  static struct regulator_bulk_data cs40l26_supplies[] = {
>  	{ .supply = "VP" },
>  	{ .supply = "VA" },
> @@ -2275,6 +2280,12 @@ int cs40l26_probe(struct cs40l26_private *cs40l26)
>  	if (error)
>  		goto err;
>  
> +	error = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, cs40l26_devs, 1, NULL, 0, NULL);
> +	if (error) {
> +		dev_err(dev, "Failed to MFD add device %s: %d\n", cs40l26_devs[0].name, error);
> +		goto err;
> +	}
> +
>  	return 0;
>  err:
>  	cs40l26_remove(cs40l26);
> -- 
> 2.7.4
> 

Kind regards,
Jeff LaBundy

  parent reply	other threads:[~2023-05-26 19:43 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
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 [this message]
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=ZHEL30a/YEia7kjr@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).