lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181217075321.k45vhgnszeqs3tea@pengutronix.de>
Date:   Mon, 17 Dec 2018 08:53:21 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     Paul Cercueil <paul@...pouillou.net>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        "thierry.reding@...il.com" <thierry.reding@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ralf Baechle <ralf@...ux-mips.org>, paul.burton@...s.com,
        James Hogan <jhogan@...nel.org>,
        Jonathan Corbet <corbet@....net>,
        Mathieu Malaterre <malat@...ian.org>, ezequiel@...labora.co.uk,
        prasannatsmkumar@...il.com, linux-pwm@...r.kernel.org,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        LINUXWATCHDOG <linux-watchdog@...r.kernel.org>,
        linux-mips@...r.kernel.org, linux-doc@...r.kernel.org,
        linux-clk <linux-clk@...r.kernel.org>, od@...c.me
Subject: Re: [PATCH v8 15/26] pwm: jz4740: Add support for the JZ4725B

On Sun, Dec 16, 2018 at 03:18:52PM +0100, Paul Cercueil wrote:
> Hi,
> 
> Le ven. 14 déc. 2018 à 15:26, Uwe Kleine-König
> <u.kleine-koenig@...gutronix.de> a écrit :
> > Hello,
> > 
> > On Fri, Dec 14, 2018 at 02:50:20PM +0100, Linus Walleij wrote:
> > > On Thu, Dec 13, 2018 at 9:42 PM Uwe Kleine-König
> > > <u.kleine-koenig@...gutronix.de> wrote:
> > > > [Adding Linus Walleij to Cc:]
> > > > On Thu, Dec 13, 2018 at 03:03:15PM +0100, Paul Cercueil wrote:
> > > > > Le jeu. 13 déc. 2018 à 10:24, Uwe Kleine-König
> > > > > <u.kleine-koenig@...gutronix.de> a écrit :
> > > > > > On Wed, Dec 12, 2018 at 11:09:10PM +0100, Paul Cercueil wrote:
> > > > > > >  The PWM in the JZ4725B works the same as in the JZ4740,
> > > > > > >  except that it only has 6 channels available instead of
> > > > > > >  8.
> > > > > >
> > > > > > this driver is probed only from device tree? If yes, it
> > > > > > might be sensible to specify the number of PWMs there and
> > > > > > get it from there.
> > > > > > There doesn't seem to be a generic binding for that, but there are
> > > > > > several drivers that could benefit from it. (This is a bigger project
> > > > > > though and shouldn't stop your patch. Still more as it already got
> > > > > > Thierry's ack.)
> > > > >
> > > > > I think there needs to be a proper guideline, as there doesn't seem to be
> > > > > a consensus about this. I learned from emails with Rob and  Linus (Walleij)
> > > > > that I should not have in devicetree what I can deduce from the compatible
> > > > > string.
> > > >
> > > > I understood them a bit differently. It is ok to deduce things from the
> > > > compatible string. But if you define a generic property (say) "num-pwms"
> > > > that is used uniformly in most bindings this is ok, too. (And then the
> > > > two different devices could use the same compatible.)
> > > >
> > > > An upside of the generic "num-pwms" property is that the pwm core could
> > > > sanity check pwm phandles before passing them to the hardware drivers.
> > > 
> > >  I don't know if this helps, but in GPIO we have "ngpios" which is
> > >  used to augment an existing block as to the number of lines actually
> > >  used with it.
> > > 
> > >  The typical case is that an ASIC engineer synthesize a block for
> > >  32 GPIOs but only 12 of them are routed to external pads. So
> > >  we augment the behaviour of that driver to only use 12 of the
> > >  32 lines.
> > > 
> > >  I guess using the remaining 20 lines "works" in a sense but they
> > >  have no practical use and will just bias electrons in the silicon
> > >  for no use.
> > 
> > This looks very similar to the case under discussion.
> > 
> > >  So if the PWM case is something similar, then by all means add
> > >  num-pwms.
> > 
> > .. or "npwms" to use the same nomenclature as the gpio binding?
> 
> If we're going to do something like this, should it be the drivers or
> the core (within pwmchip_add) that checks for this "npwms" property?

Of course this should be done in the core. The driver than can rely on
the validity of the index. But as I wrote before, this shouldn't stop
your patch from going in.

But if Thierry agrees that this npmws (or num-pwms) is a good idea, it
would be great to start early to convert drivers.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ