Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/fdt Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/dbf7d2b18d49
branches:  netbsd-9
changeset: 964217:dbf7d2b18d49
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 12 13:03:46 2020 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #1149):

        sys/dev/fdt/pwm_backlight.c: revision 1.7

save the new current level when set by the user.

stops PBP display from going back to default brightness after
dpms, etc.

ok jmcneill.

diffstat:

 sys/dev/fdt/pwm_backlight.c |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diffs (91 lines):

diff -r 1d588467d020 -r dbf7d2b18d49 sys/dev/fdt/pwm_backlight.c
--- a/sys/dev/fdt/pwm_backlight.c       Sat Dec 12 13:01:18 2020 +0000
+++ b/sys/dev/fdt/pwm_backlight.c       Sat Dec 12 13:03:46 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pwm_backlight.c,v 1.4.10.1 2020/01/21 10:39:58 martin Exp $ */
+/* $NetBSD: pwm_backlight.c,v 1.4.10.2 2020/12/12 13:03:46 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.4.10.1 2020/01/21 10:39:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.4.10.2 2020/12/12 13:03:46 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -60,7 +60,7 @@
 
 static void    pwm_backlight_sysctl_init(struct pwm_backlight_softc *);
 static void    pwm_backlight_pmf_init(struct pwm_backlight_softc *);
-static void    pwm_backlight_set(struct pwm_backlight_softc *, u_int);
+static void    pwm_backlight_set(struct pwm_backlight_softc *, u_int, bool);
 static u_int   pwm_backlight_get(struct pwm_backlight_softc *);
 
 static const char *compatible[] = {
@@ -129,7 +129,7 @@
 
        if (of_getprop_uint32(phandle, "default-brightness-level", &default_level) == 0) {
                /* set the default level now */
-               pwm_backlight_set(sc, default_level);
+               pwm_backlight_set(sc, default_level, true);
        }
 
        sc->sc_curlevel = pwm_backlight_get(sc);
@@ -139,7 +139,7 @@
 }
 
 static void
-pwm_backlight_set(struct pwm_backlight_softc *sc, u_int index)
+pwm_backlight_set(struct pwm_backlight_softc *sc, u_int index, bool set_cur)
 {
        struct pwm_config conf;
 
@@ -153,6 +153,9 @@
        conf.duty_cycle = (conf.period * sc->sc_levels[index]) / sc->sc_levels[sc->sc_nlevels - 1];
        pwm_set_config(sc->sc_pwm, &conf);
        pwm_enable(sc->sc_pwm);
+
+       if (set_cur)
+               sc->sc_curlevel = index;
 }
 
 static u_int
@@ -193,7 +196,7 @@
 
        for (n = 0; n < sc->sc_nlevels; n++) {
                if (sc->sc_levels[n] == level) {
-                       pwm_backlight_set(sc, n);
+                       pwm_backlight_set(sc, n, true);
                        return 0;
                }
        }
@@ -255,7 +258,7 @@
        if (sc->sc_pin)
                fdtbus_gpio_write(sc->sc_pin, enable);
        else
-               pwm_backlight_set(sc, enable ? sc->sc_curlevel : 0);
+               pwm_backlight_set(sc, enable ? sc->sc_curlevel : 0, false);
 }
 
 static void
@@ -303,7 +306,7 @@
 
        n = pwm_backlight_get(sc);
        if (n < sc->sc_nlevels - 1)
-               pwm_backlight_set(sc, n + 1);
+               pwm_backlight_set(sc, n + 1, true);
 }
 
 static void
@@ -314,7 +317,7 @@
 
        n = pwm_backlight_get(sc);
        if (n > 0)
-               pwm_backlight_set(sc, n - 1);
+               pwm_backlight_set(sc, n - 1, true);
 }
 
 static void



Home | Main Index | Thread Index | Old Index