[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210217110313.ly5ly5u5vyh2s7dh@gilmour>
Date: Wed, 17 Feb 2021 12:03:13 +0100
From: Maxime Ripard <maxime@...no.tech>
To: Marjan Pascolo <marjan.pascolo@...xom.it>
Cc: wens@...e.org, Jernej Skrabec <jernej.skrabec@...l.net>,
dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pinctrl/sunxi: adding input-debounce-ns property
Hi,
On Wed, Feb 10, 2021 at 05:22:37PM +0100, Marjan Pascolo wrote:
> On Allwinner SoC interrupt debounce can be controlled by two oscillator
> (32KHz and 24MHz) and a prescale divider.
> Oscillator and prescale divider are set through
> device tree property "input-debounce" which have 1uS accuracy.
> For acheive nS precision a new device tree poperty is made
> named "input-debounce-ns".
> "input-debounce-ns" is checked only if "input-debounce"
> property is not defined.
>
> Suggested-by: Maxime Ripard <maxime@...no.tech>
> Signed-off-by: Marjan Pascolo <marjan.pascolo@...xom.it>
> ---
> ---
> .../pinctrl/allwinner,sun4i-a10-pinctrl.yaml | 9 +++++++
> drivers/pinctrl/sunxi/pinctrl-sunxi.c | 25 ++++++++++++++++---
> 2 files changed, 30 insertions(+), 4 deletions(-)
>
> diff --git
> a/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> b/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> index 5240487dfe50..346776de3a44 100644
> ---
> a/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> +++
> b/Documentation/devicetree/bindings/pinctrl/allwinner,sun4i-a10-pinctrl.yaml
> @@ -93,6 +93,15 @@ properties:
> minItems: 1
> maxItems: 5
>
> + input-debounce-ns:
> + description:
> + Debouncing periods in nanoseconds, one period per interrupt
> + bank found in the controller.
> + Only checked if input-debounce is not present
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + minItems: 1
> + maxItems: 5
> +
This should be a separate patch, with the DT maintainers in Cc.
You should enforce that the properties are mutually exclusive through
the schema too
> patternProperties:
> # It's pretty scary, but the basic idea is that:
> # - One node name can start with either s- or r- for PRCM nodes,
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> index dc8d39ae045b..869b6d5743ba 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> @@ -1335,14 +1335,31 @@ static int sunxi_pinctrl_setup_debounce(struct
> sunxi_pinctrl *pctl,
> struct clk *hosc, *losc;
> u8 div, src;
> int i, ret;
> + /* Keeping for loop below clean */
> + const char* debounce_prop_name;
> + unsigned long debounce_dividend;
>
> /* Deal with old DTs that didn't have the oscillators */
> if (of_clk_get_parent_count(node) != 3)
> return 0;
>
> + /*
> + * Distinguish between simple input-debounce
> + * and new input-debounce-ns
> + */
> +
I'm not sure that comment should stay, the code is obvious enough
> /* If we don't have any setup, bail out */
> - if (!of_find_property(node, "input-debounce", NULL))
> - return 0;
> + if (!of_find_property(node, "input-debounce", NULL)) {
> + if(!of_find_property(node, "input-debounce-ns", NULL)) {
> + return 0;
> + } else {
> + debounce_prop_name="input-debounce-ns";
> + debounce_dividend=NSEC_PER_SEC;
> + }
> + } else {
> + debounce_prop_name="input-debounce";
> + debounce_dividend=USEC_PER_SEC;
> + }
This doesn't follow the kernel coding style, make sure to run
scripts/checkpatch.pl on your patches before sending them.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists