drivers/platform/x86/samsung-galaxybook.c

Source file repositories/reference/linux-study-clean/drivers/platform/x86/samsung-galaxybook.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/samsung-galaxybook.c
Extension
.c
Size
40686 bytes
Lines
1457
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 samsung_galaxybook {
	struct platform_device *platform;
	struct acpi_device *acpi;

	struct device *fw_attrs_dev;
	struct kset *fw_attrs_kset;
	/* block in case firmware attributes are updated in multiple threads */
	struct mutex fw_attr_lock;

	bool has_kbd_backlight;
	bool has_block_recording;
	bool has_performance_mode;

	struct led_classdev kbd_backlight;
	struct work_struct kbd_backlight_hotkey_work;
	/* block in case brightness updated using hotkey and another thread */
	struct mutex kbd_backlight_lock;

	void *i8042_filter_ptr;

	struct work_struct block_recording_hotkey_work;
	struct input_dev *input;

	struct acpi_battery_hook battery_hook;

	u8 profile_performance_modes[PLATFORM_PROFILE_LAST];
};

enum galaxybook_fw_attr_id {
	GB_ATTR_POWER_ON_LID_OPEN,
	GB_ATTR_USB_CHARGING,
	GB_ATTR_BLOCK_RECORDING,
};

static const char * const galaxybook_fw_attr_name[] = {
	[GB_ATTR_POWER_ON_LID_OPEN] = "power_on_lid_open",
	[GB_ATTR_USB_CHARGING]      = "usb_charging",
	[GB_ATTR_BLOCK_RECORDING]   = "block_recording",
};

static const char * const galaxybook_fw_attr_desc[] = {
	[GB_ATTR_POWER_ON_LID_OPEN] = "Power On Lid Open",
	[GB_ATTR_USB_CHARGING]      = "USB Charging",
	[GB_ATTR_BLOCK_RECORDING]   = "Block Recording",
};

#define GB_ATTR_LANGUAGE_CODE "en_US.UTF-8"

struct galaxybook_fw_attr {
	struct samsung_galaxybook *galaxybook;
	enum galaxybook_fw_attr_id fw_attr_id;
	struct attribute_group attr_group;
	struct kobj_attribute display_name;
	struct kobj_attribute current_value;
	int (*get_value)(struct samsung_galaxybook *galaxybook, bool *value);
	int (*set_value)(struct samsung_galaxybook *galaxybook, const bool value);
};

struct sawb {
	u16 safn;
	u16 sasb;
	u8 rflg;
	union {
		struct {
			u8 gunm;
			u8 guds[250];
		} __packed;
		struct {
			u8 caid[16];
			u8 fncn;
			u8 subn;
			u8 iob0;
			u8 iob1;
			u8 iob2;
			u8 iob3;
			u8 iob4;
			u8 iob5;
			u8 iob6;
			u8 iob7;
			u8 iob8;
			u8 iob9;
		} __packed;
		struct {
			u8 iob_prefix[18];
			u8 iobs[10];
		} __packed;
	} __packed;
} __packed;

#define GB_SAWB_LEN_SETTINGS          0x15

Annotation

Implementation Notes