Hi Paul

On Wed, Apr 02, 2014 at 06:22:35PM +0300, Paul Irofti wrote:
> Hi Remi,
> 
> thank you for the detailed report and for your patience.
> 
> I was wondering if you could test the following diff and let me know
> what happens.

I applied this patch to a freshly checked out source tree on April 2
and tested a few boot sequences:

#1
https://relo.ch/dmesg-samsung900X3F/dmesg-samsung900X3F-201404032101.txt
acpitz0 ok, battery sensors partly
zzz: imediate shutdown after resume: acpitz0 > 144

#2
https://relo.ch/dmesg-samsung900X3F/dmesg-samsung900X3F-201404032104.txt
immediate shutdown, acpitz0 > 144

#3
https://relo.ch/dmesg-samsung900X3F/dmesg-samsung900X3F-201404032136.txt
acpitz0 ok, battery sensors partly
zzz: imediate shutdown after resume: acpitz0 > 144

#4
https://relo.ch/dmesg-samsung900X3F/dmesg-samsung900X3F-201404032138.txt
immediate shutdown, acpitz0 > 144

#5
https://relo.ch/dmesg-samsung900X3F/dmesg-samsung900X3F-201404032140.txt
immediate shutdown, acpitz0 > 144

#6
https://relo.ch/dmesg-samsung900X3F/dmesg-samsung900X3F-201404032147.txt
acpitz0 ok, battery sensors partly, keyboard illumination on
zzz: imediate shutdown after resume: acpitz0 > 144, 
     keyboard illumination stays off during and after resume


Thank you for having a look into this!
Remi

> 
> Thanks,
> Paul
> 
> Index: dev/acpi/acpiec.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.48
> diff -u -p -r1.48 acpiec.c
> --- dev/acpi/acpiec.c 2 Jul 2013 18:37:47 -0000       1.48
> +++ dev/acpi/acpiec.c 2 Apr 2014 15:21:00 -0000
> @@ -34,6 +34,7 @@
>  
>  int          acpiec_match(struct device *, void *, void *);
>  void         acpiec_attach(struct device *, struct device *, void *);
> +int          acpiec_activate(struct device *, int);
>  
>  u_int8_t     acpiec_status(struct acpiec_softc *);
>  u_int8_t     acpiec_read_data(struct acpiec_softc *);
> @@ -54,6 +55,7 @@ int         acpiec_getregister(const u_int8_t *
>  
>  void         acpiec_wait(struct acpiec_softc *, u_int8_t, u_int8_t);
>  void         acpiec_sci_event(struct acpiec_softc *);
> +void         acpiec_clear_events(struct acpiec_softc *);
>  
>  void         acpiec_get_events(struct acpiec_softc *);
>  
> @@ -82,7 +84,8 @@ void                acpiec_unlock(struct acpiec_softc 
>  int  acpiec_reg(struct acpiec_softc *);
>  
>  struct cfattach acpiec_ca = {
> -     sizeof(struct acpiec_softc), acpiec_match, acpiec_attach
> +     sizeof(struct acpiec_softc), acpiec_match, acpiec_attach,
> +     NULL, acpiec_activate
>  };
>  
>  struct cfdriver acpiec_cd = {
> @@ -296,6 +299,8 @@ acpiec_attach(struct device *parent, str
>       acpi_set_gpehandler(sc->sc_acpi, sc->sc_gpe, acpiec_gpehandler,
>           sc, 1);
>  #endif
> +
> +     /* acpiec_clear_events(sc); */
>       
>       if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, &res))
>               sc->sc_glk = 0;
> @@ -307,6 +312,20 @@ acpiec_attach(struct device *parent, str
>       printf("\n");
>  }
>  
> +int
> +acpiec_activate(struct device *self, int act)
> +{
> +     struct acpiec_softc *sc = (struct acpiec_softc *)self;
> +
> +
> +     switch (act) {
> +     case DVACT_RESUME:
> +             acpiec_clear_events(sc);
> +             break;
> +     }
> +     return (0);
> +}
> +
>  void
>  acpiec_get_events(struct acpiec_softc *sc)
>  {
> @@ -552,4 +571,19 @@ acpiec_unlock(struct acpiec_softc *sc)
>       }
>  
>       sc->sc_ecbusy = 0;
> +}
> +
> +void
> +acpiec_clear_events(struct acpiec_softc *sc)
> +{
> +     int i;
> +
> +     for (i = 0; i < 100; i++) {
> +             /*acpiec_write_cmd(sc, EC_CMD_QR);*/
> +             bus_space_write_1(sc->sc_cmd_bt, sc->sc_cmd_bh, 0, EC_CMD_QR);
> +             sc->sc_gotsci = 0;
> +             if ((acpiec_status(sc) & EC_STAT_SCI_EVT) != EC_STAT_SCI_EVT) {
> +                     break;
> +             }
> +     }
>  }

Reply via email to