drivers/platform/x86/panasonic-laptop.c

Source file repositories/reference/linux-study-clean/drivers/platform/x86/panasonic-laptop.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/panasonic-laptop.c
Extension
.c
Size
30296 bytes
Lines
1151
Domain
Driver Families
Bucket
drivers/platform
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pcc_acpi {
	acpi_handle		handle;
	unsigned long		num_sifr;
	int			sticky_key;
	int			eco_mode;
	int			mute;
	int			ac_brightness;
	int			dc_brightness;
	int			current_brightness;
	u32			*sinf;
	struct acpi_device	*device;
	struct input_dev	*input_dev;
	struct backlight_device	*backlight;
	struct platform_device	*platform;
};

/*
 * On some Panasonic models the volume up / down / mute keys send duplicate
 * keypress events over the PS/2 kbd interface, filter these out.
 */
static bool panasonic_i8042_filter(unsigned char data, unsigned char str,
				   struct serio *port, void *context)
{
	static bool extended;

	if (str & I8042_STR_AUXDATA)
		return false;

	if (data == 0xe0) {
		extended = true;
		return true;
	} else if (extended) {
		extended = false;

		switch (data & 0x7f) {
		case 0x20: /* e0 20 / e0 a0, Volume Mute press / release */
		case 0x2e: /* e0 2e / e0 ae, Volume Down press / release */
		case 0x30: /* e0 30 / e0 b0, Volume Up press / release */
			return true;
		default:
			/*
			 * Report the previously filtered e0 before continuing
			 * with the next non-filtered byte.
			 */
			serio_interrupt(port, 0xe0, 0);
			return false;
		}
	}

	return false;
}

/* method access functions */
static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
{
	union acpi_object in_objs[] = {
		{ .integer.type  = ACPI_TYPE_INTEGER,
		  .integer.value = func, },
		{ .integer.type  = ACPI_TYPE_INTEGER,
		  .integer.value = val, },
	};
	struct acpi_object_list params = {
		.count   = ARRAY_SIZE(in_objs),
		.pointer = in_objs,
	};
	acpi_status status = AE_OK;

	status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET,
				      &params, NULL);

	return (status == AE_OK) ? 0 : -EIO;
}

static inline int acpi_pcc_get_sqty(struct acpi_device *device)
{
	unsigned long long s;
	acpi_status status;

	status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY,
				       NULL, &s);
	if (ACPI_SUCCESS(status))
		return s;
	else {
		pr_err("evaluation error HKEY.SQTY\n");
		return -EINVAL;
	}
}

static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc)
{

Annotation

Implementation Notes