[PATCH 09/10] ASoC: cs42l83: Extend CS42L42 support to new part
Krzysztof Kozlowski
krzysztof.kozlowski at linaro.org
Fri Sep 9 16:47:50 CEST 2022
On 09/09/2022 15:53, Martin Povišer wrote:
> The CS42L83 part is a headphone jack codec found in recent Apple
> machines. It is a publicly undocumented part but as far as can be told
> it is identical to CS42L42 except for two points:
>
(...)
> + regmap = devm_regmap_init_i2c(i2c_client, &cs42l83_regmap);
> + if (IS_ERR(regmap)) {
> + ret = PTR_ERR(regmap);
> + dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
> + return ret;
Use dev_err_probe()
> + }
> +
> + cs42l83->devid = CS42L83_CHIP_ID;
> + cs42l83->dev = dev;
> + cs42l83->regmap = regmap;
> + cs42l83->irq = i2c_client->irq;
> +
> + ret = cs42l42_common_probe(cs42l83, &cs42l42_soc_component, &cs42l42_dai);
> + if (ret)
> + return ret;
> +
> + ret = cs42l42_init(cs42l83);
> + if (ret)
> + cs42l42_common_remove(cs42l83);
> +
> + return ret;
> +}
> +
> +static int cs42l83_i2c_remove(struct i2c_client *i2c_client)
> +{
> + struct cs42l42_private *cs42l83 = dev_get_drvdata(&i2c_client->dev);
> +
> + cs42l42_common_remove(cs42l83);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused cs42l83_i2c_resume(struct device *dev)
> +{
> + int ret;
> +
> + ret = cs42l42_resume(dev);
> + if (ret)
> + return ret;
> +
> + cs42l42_resume_restore(dev);
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops cs42l83_i2c_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l83_i2c_resume)
> +};
> +
> +static const struct of_device_id __maybe_unused cs42l83_of_match[] = {
> + { .compatible = "cirrus,cs42l83", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, cs42l83_of_match);
> +
> +static struct i2c_driver cs42l83_i2c_driver = {
> + .driver = {
> + .name = "cs42l83",
> + .pm = &cs42l83_i2c_pm_ops,
> + .of_match_table = of_match_ptr(cs42l83_of_match),
This should complain with compile testing. Usually it comes with
__maybe_unused/
Best regards,
Krzysztof
More information about the Alsa-devel
mailing list