[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180823131816.741c09cc@ipc1.ka-ro>
Date: Thu, 23 Aug 2018 13:18:16 +0200
From: Lothar Waßmann <LW@...O-electronics.de>
To: Michal Vokáč <michal.vokac@...ft.com>
Cc: Thierry Reding <thierry.reding@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
devicetree@...r.kernel.org, linux-pwm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Lukasz Majewski <l.majewski@...ess.pl>,
Fabio Estevam <fabio.estevam@....com>
Subject: Re: [RFC PATCH 1/2] dt-bindings: pwm: imx: Allow switching PWM
output between PWM and GPIO
Michal Vokáč <michal.vokac@...ft.com> wrote:
> On 22.8.2018 16:10, Lothar Waßmann wrote:
> > My use case is attaching different displays to the same baseboard,
> > where some displays have the brightness control pin inverted with
> > respect to the others. It's easy to change the compatible string for
> > the simple-panel driver and the PWM polarity setting for the
> > pwm-backlight driver from U-Boot according to the display model, but
> > it's not so easy, to edit the pinctrl settings from pull-up to
> > pull-down or vice versa.
>
> OK, I got it. Though that is something different than having two clients,
> right?
>
> You do not actually need to change the pinctrl pull-up/down configuration
> in bootloader. You define the two pinctrl groups as I suggested in the
> example. Or more precisely, you add a new pinctrl group where the PWM
> output pad is configured as a GPIO with pull-up. You add this group to
> all your common device trees. This does no harm as the group is not used
> yet.
>
> In bootloader you detect the type of the panel. Normal PWM polarity? OK,
> do nothing and boot. Inverted PWM polarity? Set the pinctrl-names property
> to "default", "pwm". Set the pinctrl-0 property to point to the GPIO group
> and set pinctrl-1 property to point to the old PWM group.
>
> E.g. something like:
>
> => fdt set /soc/aips-bus@...0000/pwm@...0000 pinctrl-names default pwm
> => fdt get value gpio-phandle /soc/aips-bus@...0000/iomuxc@...0000/pwm1grp-gpio phandle
> => fdt get value pwm-phandle /soc/aips-bus@...0000/iomuxc@...0000/pwm1grp-pwm phandle
> => fdt set /soc/aips-bus@...0000/pwm@...0000 pinctrl-0 ${gpio-phandle}
> => fdt set /soc/aips-bus@...0000/pwm@...0000 pinctrl-1 ${pwm-phandle}
>
> Will this work for you?
>
This would probably work, but it's quite ugly.
I'd still prefer to set the pin output state to the desired level
rather than relying on the chip internal pullup/pulldown facility.
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@...o-electronics.de
___________________________________________________________
Powered by blists - more mailing lists