aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma/acpi/brightness_levels.asl
blob: d0e70a941879c30d3d8baa9a1e3827ff0f5ae485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	Name (BRIG, Package (0x12)
	{
		100, /* default AC */
		100, /* default Battery */
		  2,
		  4,
		  5,
		  7,
		  9,
		 11,
		 13,
		 18,
		 20,
		 24,
		 29,
		 33,
		 40,
		 50,
		 67,
		100,
	})

	Method (XBCM, 1, NotSerialized)
	{
		Store (Divide (Multiply (Arg0, BCLM), 100), BCLV)
	}

	Method (XBQC, 0, NotSerialized)
	{
		/* Find value close to BCLV in BRIG (which must be ordered) */
		Store (BCLV, Local0)			// Current value
		Store (BCLM, Local1)			// For calculations
		Store (2, Local2)			// Loop index
		While (LLess (Local2, Subtract (SizeOf (BRIG), 1))) {
			Store (DeRefOf (Index (BRIG, Local2)), Local3)
			/* Use same calculation as XBCM, to get exact matches */
			Store (Divide (Multiply (Local3, Local1), 100), Local3)

			If (LLessEqual (Local0, Local3)) {
				Return (DeRefOf (Index (BRIG, Local2)))
			}
			Add (Local2, 1, Local2)
		}
		/* Didn't find greater/equal value: use the last */
		Return (DeRefOf (Index (BRIG, Local2)))
	}