Skip to content

Instantly share code, notes, and snippets.

@philmb3487
Created April 17, 2021 15:00
Show Gist options
  • Select an option

  • Save philmb3487/448d57653c83a4d24d1fb82f5e18f07b to your computer and use it in GitHub Desktop.

Select an option

Save philmb3487/448d57653c83a4d24d1fb82f5e18f07b to your computer and use it in GitHub Desktop.

Revisions

  1. philmb3487 created this gist Apr 17, 2021.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    // coffee lake chips use the BXT methods.
    current = INREG(0xC8258);
    max = INREG(0xC8254);

    printf ("current backlight value: %d%%\n", current * 100 / max);

    if (argc > 1) {
    uint32_t v = atoi (argv[1]) * max / 100;
    if (v > max)
    v = max;
    OUTREG(0xC8258, v);
    (void) INREG(0xC8258);
    printf ("set backlight to %d%%\n", v * 100 / max);
    }