Re: [PATCH v3 3/3] ARM: dts: sun7i: Add support for the Ainol AW1 tablet

From: Maxime Ripard
Date: Tue May 08 2018 - 09:29:07 EST


On Mon, May 07, 2018 at 10:15:46PM +0200, Paul Kocialkowski wrote:
> > > + backlight: backlight {
> > > + compatible = "pwm-backlight";
> > > + pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
> > > + brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
> >
> > The increase in perceived brightness should be linear. Usually, for
> > PWMs backed backlight, an exponential list is a much better
> > approximation.
>
> Thanks for the hint, it never occurred to me that pwm duty cycle was not
> linear with brightness, but that makes sense. I'll give that a try (on
> 255 values instead of 10 to keep some level of precision in low
> brightness). The way to go here is probably use a base-255 logarithm
> such as: duty cycle = range * log(i+1)/log(255) with i the linear
> brightness value (0 to 255) and range the amplitude of our values (that
> gets divided by the maximum brightness, so it's really up to hardware
> precision at this point). I'll go with a range of 255 as well.

Without going into something so complicated, usually a list with power
of two ending at 255 is a good approximation :)

> > > +&mmc0 {
> > > + pinctrl-names = "default";
> > > + pinctrl-0 = <&mmc0_pins_a>;
> > > + vmmc-supply = <&reg_vcc3v3>;
> >
> > You have the regulators described in your DT, you'd better use them
> > instead of the one coming from sunxi-common-regulators.dtsi.
>
> Well, according to the reference A20 design, the mmc pins and the card
> are powered by the 3.3V power rail, that comes from a regular step-down
> regulator sourcing from IPSOUT, so I don't see what regulator I should
> better use. Do you have a suggestion?

That works for me then.

> > > +&pio {
> > > + panel_power_pin: panel_power_pin@0 {
> > > + pins = "PH8";
> > > + function = "gpio_out";
> > > + };
> > > +};
> >
> > You don't need that pinctrl node.
>
> I'll get rid of it then. You mentioned that regulator-simple uses the
> old GPIO API, so I assumed it meant that a pinctrl node is still needed.
> For reference, it uses of_get_named_gpio (not the devm-managed fashion).

This is only relevant for the polarity of the pins, not the pinctrl part.

Maxime

--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com