Re: [PATCH 08/10] pinctrl: cs42l43: Add support for the cs42l43

From: Krzysztof Kozlowski
Date: Fri May 12 2023 - 11:31:42 EST


On 12/05/2023 14:28, Charles Keepax wrote:
> The CS42L43 is an audio CODEC with integrated MIPI SoundWire interface
> (Version 1.2.1 compliant), I2C, SPI, and I2S/TDM interfaces designed
> for portable applications. It provides a high dynamic range, stereo
> DAC for headphone output, two integrated Class D amplifiers for
> loudspeakers, and two ADCs for wired headset microphone input or
> stereo line input. PDM inputs are provided for digital microphones.
>
> Add a basic pinctrl driver which supports driver strength for the
> various pins, gpios, and pinmux for the 2 multi-function pins.
>
> Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

...

> +{
> + struct cs42l43 *cs42l43 = dev_get_drvdata(pdev->dev.parent);
> + struct cs42l43_pin *priv;
> + struct pinctrl_dev *pctldev;
> + int ret;
> +
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->dev = &pdev->dev;
> + priv->regmap = cs42l43->regmap;
> +
> + priv->shutters_locked = cs42l43->hw_lock;
> +
> + priv->gpio_chip.request = gpiochip_generic_request;
> + priv->gpio_chip.free = gpiochip_generic_free;
> + priv->gpio_chip.direction_input = cs42l43_gpio_direction_in;
> + priv->gpio_chip.direction_output = cs42l43_gpio_direction_out;
> + priv->gpio_chip.get = cs42l43_gpio_get;
> + priv->gpio_chip.set = cs42l43_gpio_set;
> + priv->gpio_chip.label = dev_name(priv->dev);
> + priv->gpio_chip.parent = priv->dev;
> + priv->gpio_chip.can_sleep = true;
> + priv->gpio_chip.base = -1;
> + priv->gpio_chip.ngpio = CS42L43_NUM_GPIOS;
> + priv->gpio_chip.fwnode = dev_fwnode(cs42l43->dev);
> +
> + if (is_of_node(dev_fwnode(cs42l43->dev))) {
> + device_set_node(priv->dev,
> + fwnode_get_named_child_node(dev_fwnode(cs42l43->dev),
> + "pinctrl"));

That's something unusual. It seems you want to bind to a DT node because
you miss compatible in DT node?

> + } else {
> + device_set_node(priv->dev, dev_fwnode(cs42l43->dev));
> + }
> +
> + pm_runtime_enable(priv->dev);
> + pm_runtime_idle(priv->dev);
> +

....

> +
> +static struct platform_driver cs42l43_pin_driver = {
> + .driver = {
> + .name = "cs42l43-pinctrl",
> + },
> +
> + .probe = cs42l43_pin_probe,
> + .remove = cs42l43_pin_remove,
> +};
> +module_platform_driver(cs42l43_pin_driver);
> +
> +MODULE_DESCRIPTION("CS42L43 Pinctrl Driver");
> +MODULE_AUTHOR("Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:cs42l43-pinctrl");

Same comment, so I guess you have this pattern everywhere.

Best regards,
Krzysztof