Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b64b51d authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by Len Brown
Browse files

ACPI: thinkpad-acpi: cleanup hotkey_notify and HKEY log messages



Use a generic message on hotkey_notify to log unknown and unhandled events,
and cleanup hotkey_notify a little.

Also, document event 0x5010 (brightness changed notification) and do not
log it as an unknown event (even if we do not use it for anything right
now).

Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 083f1760
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -475,6 +475,10 @@ Non hot-key ACPI HKEY event map:
The above events are not propagated by the driver, except for legacy
The above events are not propagated by the driver, except for legacy
compatibility purposes when hotkey_report_mode is set to 1.
compatibility purposes when hotkey_report_mode is set to 1.


0x5010		Brightness level changed (newer Lenovo BIOSes)

The above events are propagated by the driver.

Compatibility notes:
Compatibility notes:


ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never
ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never
+20 −15
Original line number Original line Diff line number Diff line
@@ -2007,6 +2007,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
	unsigned int scancode;
	unsigned int scancode;
	int send_acpi_ev;
	int send_acpi_ev;
	int ignore_acpi_ev;
	int ignore_acpi_ev;
	int unk_ev;


	if (event != 0x80) {
	if (event != 0x80) {
		printk(TPACPI_ERR
		printk(TPACPI_ERR
@@ -2030,8 +2031,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
			return;
			return;
		}
		}


		send_acpi_ev = 0;
		send_acpi_ev = 1;
		ignore_acpi_ev = 0;
		ignore_acpi_ev = 0;
		unk_ev = 0;


		switch (hkey >> 12) {
		switch (hkey >> 12) {
		case 1:
		case 1:
@@ -2041,33 +2043,34 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
				scancode--;
				scancode--;
				if (!(hotkey_source_mask & (1 << scancode))) {
				if (!(hotkey_source_mask & (1 << scancode))) {
					tpacpi_input_send_key(scancode);
					tpacpi_input_send_key(scancode);
					send_acpi_ev = 0;
				} else {
				} else {
					ignore_acpi_ev = 1;
					ignore_acpi_ev = 1;
				}
				}
			} else {
			} else {
				printk(TPACPI_ERR
				unk_ev = 1;
				       "hotkey 0x%04x out of range "
				       "for keyboard map\n", hkey);
				send_acpi_ev = 1;
			}
			}
			break;
			break;
		case 5:
		case 5:
			/* 0x5000-0x5FFF: LID */
			/* 0x5000-0x5FFF: On screen display helpers */
			/* we don't handle it through this path, just
			switch (hkey) {
			 * eat up known LID events */
			case 0x5010:
			if (hkey != 0x5001 && hkey != 0x5002) {
				/* Lenovo Vista BIOS: brightness changed */
				printk(TPACPI_ERR
				break;
				       "unknown LID-related HKEY event: "
			case 0x5001:
				       "0x%04x\n", hkey);
			case 0x5002:
				send_acpi_ev = 1;
				/* LID switch events.  Do not propagate */
			} else {
				ignore_acpi_ev = 1;
				ignore_acpi_ev = 1;
				break;
			default:
				unk_ev = 1;
			}
			}
			break;
			break;
		case 7:
		case 7:
			/* 0x7000-0x7FFF: misc */
			/* 0x7000-0x7FFF: misc */
			if (tp_features.hotkey_wlsw && hkey == 0x7000) {
			if (tp_features.hotkey_wlsw && hkey == 0x7000) {
				tpacpi_input_send_radiosw();
				tpacpi_input_send_radiosw();
				send_acpi_ev = 0;
				break;
				break;
			}
			}
			/* fallthrough to default */
			/* fallthrough to default */
@@ -2078,9 +2081,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
			/* case 3: ultra-bay related. maybe bay in dock? */
			/* case 3: ultra-bay related. maybe bay in dock? */
			/*	0x3003 - T43 after wake up by bay lever
			/*	0x3003 - T43 after wake up by bay lever
			 *	         eject (0x2305) */
			 *	         eject (0x2305) */
			unk_ev = 1;
		}
		if (unk_ev) {
			printk(TPACPI_NOTICE
			printk(TPACPI_NOTICE
			       "unhandled HKEY event 0x%04x\n", hkey);
			       "unhandled HKEY event 0x%04x\n", hkey);
			send_acpi_ev = 1;
		}
		}


		/* Legacy events */
		/* Legacy events */