linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marjan Pascolo <marjan.pascolo@trexom.it>
To: Maxime Ripard <maxime@cerno.tech>
Cc: linux-arm-kernel@lists.infradead.org, wens@csie.org,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl/sunxi: adding input-debounce-ns property
Date: Fri, 26 Feb 2021 13:53:00 +0100	[thread overview]
Message-ID: <4171ad5c-97f1-5738-9127-078fea74bbf7@trexom.it> (raw)
In-Reply-To: <20210217110313.ly5ly5u5vyh2s7dh@gilmour>

Hi Maxime,

Il 17/02/2021 12:03, Maxime Ripard ha scritto:
> 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@cerno.tech>
>> Signed-off-by: Marjan Pascolo <marjan.pascolo@trexom.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

I'm sorry, I've ignored documentaion about /Documentation.

I see that some additional YAML operator (like oneOf) are used.

oneOf should fit the schema, but I can't understand if oneOf's options 
must be a literal value, or if could also be a node.

Otherwise I'll use if ..then..else.


>
>>   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.
Spaces between operators, right. After /Documentation submission I'll 
resubmit this one
>
> Maxime

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-02-26 12:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 19:27 [PATCH 0/2] drm/sun4i: fix DCLK and improve its handling Giulio Benetti
2021-01-06 19:27 ` [PATCH 1/2] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
2021-01-06 21:00   ` Jernej Škrabec
2021-01-07  2:30     ` [PATCH v2 0/2] drm/sun4i: fix DCLK and improve its handling Giulio Benetti
2021-01-07  2:30       ` [PATCH v2 1/2] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
2021-01-07  2:30       ` [PATCH v2 2/2] drm/sun4i: tcon: improve DCLK polarity handling Giulio Benetti
2021-01-08  9:23         ` Maxime Ripard
2021-01-08 14:34           ` Giulio Benetti
2021-01-11 17:20             ` Maxime Ripard
2021-01-11 17:37               ` Giulio Benetti
2021-01-11 17:46               ` [PATCH v3] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
2021-01-13  9:42                 ` Maxime Ripard
2021-01-13 10:47                   ` [PATCH v4] " Giulio Benetti
2021-01-13 16:05                     ` [PATCH v5] " Giulio Benetti
2021-01-14  1:32                       ` kernel test robot
2021-01-14  7:58                       ` Marjan Pascolo
2021-01-14  8:12                         ` Giulio Benetti
2021-01-14  8:17                         ` [PATCH v6] " Giulio Benetti
2021-01-14 11:40                           ` Marjan Pascolo
2021-01-14 11:42                           ` Maxime Ripard
2021-02-10 16:22                             ` [PATCH] pinctrl/sunxi: adding input-debounce-ns property Marjan Pascolo
2021-02-17 11:03                               ` Maxime Ripard
2021-02-26 12:53                                 ` Marjan Pascolo [this message]
2021-03-04 15:51                                   ` Maxime Ripard
2021-01-13 10:48                   ` [PATCH v3] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
     [not found]           ` <00f21d15-7a88-2d01-dd48-dc49e9295e34@trexom.it>
2021-01-08 14:46             ` [PATCH v2 2/2] drm/sun4i: tcon: improve DCLK polarity handling Giulio Benetti
2021-01-06 19:28 ` [PATCH " Giulio Benetti

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=4171ad5c-97f1-5738-9127-078fea74bbf7@trexom.it \
    --to=marjan.pascolo@trexom.it \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=wens@csie.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).