From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
patches@opensource.cirrus.com,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v8 3/9] mfd: madera: Add common support for Cirrus Logic Madera codecs
Date: Mon, 26 Feb 2018 17:06:40 +0000 [thread overview]
Message-ID: <c59653aa-c55a-52ea-98f6-292f70f97b25@opensource.cirrus.com> (raw)
In-Reply-To: <CAHp75VdQtLKfSR5fhxxGJfa0j8h-vKT3YLDRTt0Khxe1UKzknw@mail.gmail.com>
On 26/02/18 14:11, Andy Shevchenko wrote:
> On Mon, Feb 26, 2018 at 3:05 PM, Richard Fitzgerald
> <rf@opensource.cirrus.com> wrote:
>> This adds the generic core support for Cirrus Logic "Madera" class codecs.
>> These are complex audio codec SoCs with a variety of digital and analogue
>> I/O, onboard audio processing and DSPs, and other features.
>>
>> These codecs are all based off a common set of hardware IP so can be
>> supported by a core of common code (with a few minor device-to-device
>> variations).
>
>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by the
>> + * Free Software Foundation; version 2.
>
> This is redundant.
>
Ditto my other reply. Our legal team want these lines.
>> +static void madera_enable_hard_reset(struct madera *madera)
>> +{
>> + if (madera->reset_gpio)
>
> if (!...)
> return
>
Could do but why bother? For such a trivial function, in my opinion
static void madera_enable_hard_reset(struct madera *madera)
{
if (madera->reset_gpio)
gpiod_set_value_cansleep(madera->reset_gpio, 0);
}
is simpler and more readable than
static void madera_enable_hard_reset(struct madera *madera)
{
if (!madera->reset_gpio)
return;
gpiod_set_value_cansleep(madera->reset_gpio, 0);
}
>> + gpiod_set_value_cansleep(madera->reset_gpio, 0);
>> +}
>> +
>> +static void madera_disable_hard_reset(struct madera *madera)
>> +{
>> + if (madera->reset_gpio) {
>
> Ditto.
>
As above, yes it would work the other way but I think for such a simple
implementation the way I have written it is more readable.
>> + gpiod_set_value_cansleep(madera->reset_gpio, 1);
>> + usleep_range(1000, 2000);
>> + }
>> +}
>> +
>
>> +#ifdef CONFIG_PM
>
> __maybe_unused
>
>
>> +const struct dev_pm_ops madera_pm_ops = {
>> + SET_RUNTIME_PM_OPS(madera_runtime_suspend,
>> + madera_runtime_resume,
>> + NULL)
>> +};
>
> There is a macro helper for this I believe.
Not for a dev_pm_ops that only has runtime pm.
If you're thinking of UNIVERSAL_DEV_PM_OPS that would set the same
functions as handlers for system suspend, which we don't want to do
for the reasons given in the comment describing UNIVERSAL_DEV_PM_OPS.
>
>> +const struct of_device_id madera_of_match[] = {
>> + { .compatible = "cirrus,cs47l35", .data = (void *)CS47L35 },
>> + { .compatible = "cirrus,cs47l85", .data = (void *)CS47L85 },
>> + { .compatible = "cirrus,cs47l90", .data = (void *)CS47L90 },
>> + { .compatible = "cirrus,cs47l91", .data = (void *)CS47L91 },
>> + { .compatible = "cirrus,wm1840", .data = (void *)WM1840 },
>
>> + {},
>
> No comma.
>
Seems to be personal preference. Both ways are used in the kernel and
we've always used this style so I'll leave it to Lee to decide.
>> +};
>
>
>> + ret = devm_gpio_request_one(madera->dev,
>> + madera->pdata.reset,
>> + GPIOF_DIR_OUT | GPIOF_INIT_LOW,
>> + "madera reset");
>> + if (!ret)
>> + madera->reset_gpio = gpio_to_desc(madera->pdata.reset);
>
> Why? What's wrong with descriptors?
>
This is what I mean by code going stale when it's acked but then never
gets merged. Some time ago there was a reason (which I forget).
>> + dev_set_drvdata(madera->dev, madera);
> ...
>> + if (dev_get_platdata(madera->dev))
>
> What this dance for?
>
Are you perhaps thinking the second line is dev_get_drvdata()?
dev_get_platdata() gets a pointer to any pdata, so not related
to dev_set_drvdata().
>> + ret = mfd_add_devices(madera->dev, PLATFORM_DEVID_NONE,
>> + mfd_devs, n_devs,
>> + NULL, 0, NULL);
>
> devm_?
>
I can try it and see. It's scary because we can depend on our
children but maybe devm_mfd_add_devices() is safe.
>> + if (i2c->dev.of_node) {
>> + of_id = of_match_device(madera_of_match, &i2c->dev);
>> + if (of_id)
>> + type = (unsigned long)of_id->data;
>> + } else {
>> + type = id->driver_data;
>> + }
>
>> + if (spi->dev.of_node) {
>> + of_id = of_match_device(madera_of_match, &spi->dev);
>> + if (of_id)
>> + type = (unsigned long)of_id->data;
>
> There is a helper to get match data.
>
>> + } else {
>> + type = id->driver_data;
>> + }
>
>> +struct madera_irqchip_pdata;
>> +struct madera_codec_pdata;
>
>
> Why do you need platform data in new code?
>
Answered in a comment in another patch. We care about allowing people
to use our chips with systems that don't use devicetree/acpi. There
are also many out-of-tree systems.
>> + * @reset: GPIO controlling /RESET (0 = none)
>
> Shouldn't be descriptor?
>
next prev parent reply other threads:[~2018-02-26 17:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 13:05 [PATCH v8 0/9] Add support for Cirrus Logic CS47L35/L85/L90/L91 codecs Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 1/9] mfd: madera: Add register definitions for Cirrus Logic Madera codecs Richard Fitzgerald
2018-02-26 13:46 ` Andy Shevchenko
2018-02-26 17:41 ` Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 2/9] mfd: madera: Add DT bindings " Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 3/9] mfd: madera: Add common support " Richard Fitzgerald
2018-02-26 13:58 ` Fabio Estevam
2018-02-26 15:36 ` Richard Fitzgerald
2018-02-26 14:11 ` Andy Shevchenko
2018-02-26 17:06 ` Richard Fitzgerald [this message]
2018-02-26 17:19 ` Andy Shevchenko
2018-02-26 17:37 ` Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 4/9] mfd: madera: Register map tables for Cirrus Logic CS47L35 Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 5/9] mfd: madera: Register map tables for Cirrus Logic CS47L85 Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 6/9] mfd: madera: Register map tables for Cirrus Logic CS47L90/91 Richard Fitzgerald
2018-02-26 13:05 ` [PATCH v8 7/9] pinctrl: madera: Add DT bindings for Cirrus Logic Madera codecs Richard Fitzgerald
2018-03-21 8:04 ` Linus Walleij
2018-02-26 13:05 ` [PATCH v8 8/9] pinctrl: madera: Add driver " Richard Fitzgerald
2018-03-21 8:07 ` Linus Walleij
2018-02-26 13:05 ` [PATCH v8 9/9] gpio: madera: Support Cirrus Logic Madera class codecs Richard Fitzgerald
2018-02-26 14:16 ` Andy Shevchenko
2018-02-26 17:19 ` Richard Fitzgerald
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=c59653aa-c55a-52ea-98f6-292f70f97b25@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
/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).