The following reply was made to PR amd64/181357; it has been noted by GNATS.

From: Matthias Petermann <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: amd64/181357: LCD Brightness Control not working on Lenovo X121e
 (ACPI issue?)
Date: Sun, 18 Aug 2013 22:16:41 +0200

 This message is in MIME format.
 
 --=_u7jrKzkqA8e5X0RGN1287A1
 Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes
 Content-Disposition: inline
 Content-Transfer-Encoding: 8bit
 
 Hello, to narrow down the issue I added some temporar logging to  
 acpi_ibm.c. The attached patch is not intended to be committed, just  
 for demonstration where I put the statements. With this applied and  
 the following sequence:
 
 # kldload acpi_ibm
 # sysctl dev.acpi_ibm.0.events=1
 # sysctl dev.acpi_ibm.0.handlerevents='0x03 0x04 0x10 0x11'
 # tail -f /var/log/messages
 
 I see the following output, when I press Fn+F9/F8 multiple times:
 
 [Fn+F9]
 Aug 18 22:02:55 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:02:55 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:02:55 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 1
 [Fn+F9]
 Aug 18 22:02:57 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:02:57 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:02:57 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 2
 [Fn+F9]
 Aug 18 22:02:58 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:02:58 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:02:58 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 3
 [Fn+F9]
 Aug 18 22:02:59 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:02:59 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:02:59 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 4
 [Fn+F9]
 Aug 18 22:02:59 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:02:59 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:02:59 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 5
 [Fn+F9]
 Aug 18 22:03:00 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:03:00 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:03:00 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 6
 [Fn+F9]
 Aug 18 22:03:00 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:03:00 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:03:00 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 7
 [Fn+F8]
 Aug 18 22:03:01 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:03:01 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:03:01 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 6
 [Fn+F8]
 Aug 18 22:03:02 thinkpad kernel: acpi_ibm0: #### Tune brightness ####
 Aug 18 22:03:02 thinkpad kernel: acpi_ibm0: #### in cmos handle ####
 Aug 18 22:03:02 thinkpad kernel: acpi_ibm0: #### before acpi_ec_write ####: 5
 ...
 
 Looks like acpi_ec_write gets proper values. From this point, the keys  
 for brightness control seem to work, but acpi_ec_write doesn't have  
 any effect. So next stop would be ACPI_EC_WRITE(...). Are there any  
 known assumptions for potential causes where I should focus on?
 
 Thanks in advance & regards,
 Matthias
 
 -- 
 Matthias Petermann <[email protected]>
 Ihr Partner für anspruchsvolle IT-Lösungen
 www.petermann-it.de - lösungsorientiert, innovativ und erfolgreich
 
 --=_u7jrKzkqA8e5X0RGN1287A1
 Content-Type: text/x-diff; name=2013-08-18-patch_acpi_ibm.c_debug.txt;
  charset=us-ascii
 Content-Disposition: attachment; size=2013;
  filename=2013-08-18-patch_acpi_ibm.c_debug.txt
 
 --- acpi_ibm.c.orig    2013-08-18 02:01:11.000000000 +0200
 +++ acpi_ibm.c 2013-08-18 21:57:14.000000000 +0200
 @@ -367,7 +367,7 @@
        devclass_t              ec_devclass;
  
        ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
 -
 +      
        sc = device_get_softc(dev);
        sc->dev = dev;
        sc->handle = acpi_get_handle(dev);
 @@ -983,6 +983,7 @@
  static int
  acpi_ibm_brightness_set(struct acpi_ibm_softc *sc, int arg)
  {
 +      
        int                     val, step;
        UINT64                  val_ec;
        ACPI_OBJECT             Arg;
 @@ -992,15 +993,20 @@
        ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
        ACPI_SERIAL_ASSERT(ibm);
  
 -      if (arg < 0 || arg > 7)
 +      if (arg < 0 || arg > 7) {
 +              device_printf(sc->dev, "#### arg out of range ####\n");
                return (EINVAL);
 -
 +      }
 +      
        /* Read the current brightness */
        status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS, &val_ec, 1);
 -      if (ACPI_FAILURE(status))
 +      if (ACPI_FAILURE(status)) {
 +              device_printf(sc->dev, "#### failure read current brightness 2 
####\n");
                return (status);
 -
 +      }
 +      
        if (sc->cmos_handle) {
 +              device_printf(sc->dev, "#### in cmos handle ####\n");
                val = val_ec & IBM_EC_MASK_BRI;
  
                Args.Count = 1;
 @@ -1024,7 +1030,10 @@
                }
        }
  
 -      return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_BRIGHTNESS, arg, 1);
 +      /* This is the original code from FreeBSD 10 current. I just added
 +       * a log statement to see if it tries to set the proper values */ 
 +      device_printf(sc->dev, "#### before acpi_ec_write ####: %d\n",arg);
 +      return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_BRIGHTNESS, arg, 1);  
  }
  
  static int
 @@ -1175,11 +1184,14 @@
  
        case IBM_EVENT_BRIGHTNESS_UP:
        case IBM_EVENT_BRIGHTNESS_DOWN:
 +              device_printf(sc->dev, "#### Tune brightness ####\n");
                /* Read the current brightness */
                status = ACPI_EC_READ(sc->ec_dev, IBM_EC_BRIGHTNESS,
                                      &val_ec, 1);
 -              if (ACPI_FAILURE(status))
 +              if (ACPI_FAILURE(status)) {
 +                      device_printf(sc->dev, "#### Failure read current 
brightness 1 ####\n");
                        return;
 +              }
  
                val = val_ec & IBM_EC_MASK_BRI;
                val = (arg == IBM_EVENT_BRIGHTNESS_UP) ? val + 1 : val - 1;
 
 --=_u7jrKzkqA8e5X0RGN1287A1--
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-amd64
To unsubscribe, send any mail to "[email protected]"

Reply via email to