From: Krzysztof Kozlowski <krzk@kernel.org>
To: Niranjan H Y <niranjan.hy@ti.com>,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-sound@vger.kernel.org, devicetree@vger.kernel.org
Cc: lee@kernel.org, linusw@kernel.org, lgirdwood@gmail.com,
broonie@kernel.org, perex@perex.cz, tiwai@suse.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
nb@tipi-net.de, navada@ti.com, v-hampiholi@ti.com,
sandeepk@ti.com, baojun.xu@ti.com, shenghao-ding@ti.com
Subject: Re: [PATCH v1 5/8] mfd: tac5x1x: Add TI TAC5x1x MFD core driver
Date: Sat, 14 Mar 2026 11:20:09 +0100 [thread overview]
Message-ID: <e072b8ba-f14d-45b9-a331-5bd343fff093@kernel.org> (raw)
In-Reply-To: <20260312184833.263-6-niranjan.hy@ti.com>
On 12/03/2026 19:48, Niranjan H Y wrote:
> This patch adds the core Multi-Function Device (MFD) driver for the Texas
This patchset has multiple basic mistakes, including but not limited to:
1. Not following current kernel style. What does the submitting patches
say about such commit msg?
2. Repeating known old issues which we already fixed. Start from scratch
from recent drivers.
> Instruments TAC5x1x family of audio codecs. The MFD core handles device
> initialization, power management, and common resources for child devices.
>
> +
> +static int tac5x1x_setup_regulators(struct device *dev,
> + struct tac5x1x *tac5x1x)
> +{
> + int i, ret;
> +
> + for (i = 0; i < TAC5X1X_NUM_SUPPLIES; i++)
> + tac5x1x->supplies[i].supply = tac5x1x_supply_names[i];
> +
> + ret = devm_regulator_bulk_get(dev, TAC5X1X_NUM_SUPPLIES,
> + tac5x1x->supplies);
> + if (ret) {
> + dev_err(dev, "Failed to get regulators: %d\n", ret);
Look how all drivers are doing this - dev_err_probe
> + return ret;
> + }
> +
> + /* Regulators managed by PM runtime during probe */
> + tac5x1x->regulators_enabled = false;
> +
> + return 0;
> +}
> +
> +static int tac5x1x_probe(struct device *dev, struct tac5x1x *tac5x1x)
> +{
> + struct device_node *np = dev->of_node;
> + int ret;
> +
> + ret = tac5x1x_setup_regulators(dev, tac5x1x);
> + if (ret)
> + return ret;
> +
> + /* Initialize PM runtime before adding child devices */
> + pm_runtime_set_autosuspend_delay(dev, 3000);
> + pm_runtime_use_autosuspend(dev);
> + pm_runtime_set_active(dev);
> + pm_runtime_mark_last_busy(dev);
> + ret = devm_pm_runtime_enable(dev);
> + if (ret)
> + return ret;
> +
> + /* Enable regulators for device initialization */
> + ret = regulator_bulk_enable(TAC5X1X_NUM_SUPPLIES, tac5x1x->supplies);
> + if (ret) {
> + dev_err(dev, "Failed to enable regulators: %d\n", ret);
> + return ret;
> + }
> + tac5x1x->regulators_enabled = true;
> +
> + ret = tac5x1x_reset(tac5x1x);
> + if (ret) {
> + dev_err(dev, "Failed to reset device\n");
> + goto err_disable_regulators;
> + }
> + tac5x1x_init(tac5x1x);
> +
> + ret = tac5x1x_parse_dt(tac5x1x, np);
> + if (ret) {
> + dev_err(dev, "Failed to parse DT node: %d\n", ret);
> + goto err_disable_regulators;
> + }
> +
> + /* update if vcom property is found */
> + if (tac5x1x->out2x_vcom_cfg != -1) {
> + regmap_update_bits(tac5x1x->regmap, TAC5X1X_OUT2CFG0,
> + TAC5X1X_OUT2CFG0_VCOM_MASK,
> + tac5x1x->out2x_vcom_cfg);
> + }
> +
> + dev_dbg(dev, "%s adding mfds\n", __func__);
Drop, useless debug.
> +
> + /* Add child devices now PM runtime is initialized */
> + ret = mfd_add_devices(dev, PLATFORM_DEVID_NONE, tac5x1x_mfd_devs,
> + ARRAY_SIZE(tac5x1x_mfd_devs), NULL, 0, NULL);
> + if (ret) {
> + dev_err(dev, "Failed to add mfd devices\n");
> + goto err_remove_mfd;
> + }
> +
> + return 0;
> +
> +err_remove_mfd:
> + mfd_remove_devices(dev);
> +err_disable_regulators:
> + if (tac5x1x->regulators_enabled) {
> + regulator_bulk_disable(TAC5X1X_NUM_SUPPLIES, tac5x1x->supplies);
> + tac5x1x->regulators_enabled = false;
> + }
> + return ret;
> +}
> +
> +static void tac5x1x_remove(struct tac5x1x *tac5x1x)
> +{
> + mfd_remove_devices(tac5x1x->dev);
> + /* Only disable regulators if they are still enabled */
> + if (tac5x1x->regulators_enabled) {
> + regulator_bulk_disable(TAC5X1X_NUM_SUPPLIES, tac5x1x->supplies);
> + tac5x1x->regulators_enabled = false;
Nope, you are not refcounting in parallel to regulator core. Drop.
> + }
Why aren't you using devm interfaces?
> +}
> +
> +const struct of_device_id tac5x1x_of_match[] = {
> + { .compatible = "ti,taa5212", .data = (void *)TAA5212 },
> + { .compatible = "ti,taa5412", .data = (void *)TAA5412 },
> + { .compatible = "ti,tac5111", .data = (void *)TAC5111 },
> + { .compatible = "ti,tac5112", .data = (void *)TAC5112 },
> + { .compatible = "ti,tac5211", .data = (void *)TAC5211 },
> + { .compatible = "ti,tac5212", .data = (void *)TAC5212 },
> + { .compatible = "ti,tac5301", .data = (void *)TAC5301 },
> + { .compatible = "ti,tac5311", .data = (void *)TAC5311 },
> + { .compatible = "ti,tac5312", .data = (void *)TAC5312 },
> + { .compatible = "ti,tac5411", .data = (void *)TAC5411 },
> + { .compatible = "ti,tac5412", .data = (void *)TAC5412 },
> + { .compatible = "ti,tad5112", .data = (void *)TAD5112 },
> + { .compatible = "ti,tad5212", .data = (void *)TAD5212 },
What is all this? Your bindings said 5x1x?
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, tac5x1x_of_match);
> +
> +static int tac5x1x_i2c_probe(struct i2c_client *i2c)
> +{
> + enum tac5x1x_type type;
> + struct tac5x1x *tac5x1x;
> + struct regmap *regmap;
> + const struct regmap_config *config = &tac5x1x_regmap;
> +
> + tac5x1x = devm_kzalloc(&i2c->dev, sizeof(struct tac5x1x),
> + GFP_KERNEL);
> + if (!tac5x1x)
> + return -ENOMEM;
> +
> + i2c_set_clientdata(i2c, tac5x1x);
> + regmap = devm_regmap_init_i2c(i2c, config);
> + if (IS_ERR(regmap))
> + return PTR_ERR(regmap);
> + type = (uintptr_t)i2c_get_match_data(i2c);
No, don't use uintptr_t
> +
> + tac5x1x->dev = &i2c->dev;
> + tac5x1x->codec_type = type;
> + tac5x1x->regmap = regmap;
> +
> + return tac5x1x_probe(&i2c->dev, tac5x1x);
> +}
> +
> +static void tac5x1x_i2c_remove(struct i2c_client *client)
> +{
> + tac5x1x_remove(i2c_get_clientdata(client));
> +}
> +
> +static const struct i2c_device_id tac5x1x_id[] = {
> + {"taa5212", TAA5212},
> + {"taa5412", TAA5412},
> + {"tac5111", TAC5111},
> + {"tac5112", TAC5112},
> + {"tac5211", TAC5211},
> + {"tac5212", TAC5212},
> + {"tac5301", TAC5301},
> + {"tac5311", TAC5311},
> + {"tac5312", TAC5312},
> + {"tac5411", TAC5411},
> + {"tac5412", TAC5412},
> + {"tad5112", TAD5112},
> + {"tad5212", TAD5212},
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, tac5x1x_id);
> +
> +static DEFINE_RUNTIME_DEV_PM_OPS(tac5x1x_pm_ops, tac5x1x_suspend,
> + tac5x1x_resume, NULL);
> +
> +static struct i2c_driver tac5x1x_i2c_driver = {
> + .driver = {
> + .name = "tac5x1x-core",
> + .pm = pm_ptr(&tac5x1x_pm_ops),
> + .of_match_table = of_match_ptr(tac5x1x_of_match),
You have warnings here, drop of_match_ptr and compile test your code
> + },
> + .probe = tac5x1x_i2c_probe,
> + .remove = tac5x1x_i2c_remove,
> + .id_table = tac5x1x_id,
> +};
> +module_i2c_driver(tac5x1x_i2c_driver);
> +
> +MODULE_DESCRIPTION("Core support for the ASoC tac5x1x codec driver");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Niranjan H Y <niranjan.hy@ti.com>");
> +MODULE_SOFTDEP("pre: tac5x1x_pinctrl");
Drop
Best regards,
Krzysztof
next prev parent reply other threads:[~2026-03-14 10:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 18:48 [PATCH v1 0/8] ASoC: support TI's TAC5x1x audio codec family Niranjan H Y
2026-03-12 18:48 ` [PATCH v1 1/8] dt-bindings: mfd: Add bindings for TI TAC5x1x MFD core Niranjan H Y
2026-03-13 20:43 ` Rob Herring
2026-03-14 10:13 ` Krzysztof Kozlowski
2026-03-12 18:48 ` [PATCH v1 2/8] dt-bindings: pinctrl: Add bindings for TI TAC5x1x pinctrl Niranjan H Y
2026-03-14 10:10 ` Krzysztof Kozlowski
2026-03-14 10:12 ` Krzysztof Kozlowski
2026-03-12 18:48 ` [PATCH v1 3/8] dt-bindings: sound: Add bindings for TI TAC5x1x codec Niranjan H Y
2026-03-14 10:14 ` Krzysztof Kozlowski
2026-03-12 18:48 ` [PATCH v1 4/8] dt-bindings: sound: Update ti,pcm6240.yaml to remove TAC5x1x family Niranjan H Y
2026-03-14 10:15 ` Krzysztof Kozlowski
2026-03-12 18:48 ` [PATCH v1 5/8] mfd: tac5x1x: Add TI TAC5x1x MFD core driver Niranjan H Y
2026-03-14 10:20 ` Krzysztof Kozlowski [this message]
2026-03-12 18:48 ` [PATCH v1 6/8] pinctrl: pinctrl-tac5x1x: Add TI TAC5x1x pinctrl driver Niranjan H Y
2026-03-14 10:11 ` Krzysztof Kozlowski
2026-03-12 18:48 ` [PATCH v1 7/8] ASoC: tac5x1x: Add TI TAC5x1x codec driver Niranjan H Y
2026-03-12 19:56 ` Mark Brown
2026-03-12 18:48 ` [PATCH v1 8/8] ASoC: pcm6240: remove support for taac5x1x family Niranjan H Y
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=e072b8ba-f14d-45b9-a331-5bd343fff093@kernel.org \
--to=krzk@kernel.org \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=navada@ti.com \
--cc=nb@tipi-net.de \
--cc=niranjan.hy@ti.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=sandeepk@ti.com \
--cc=shenghao-ding@ti.com \
--cc=tiwai@suse.com \
--cc=v-hampiholi@ti.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