drivers/platform/x86/x86-android-tablets/asus.c

Source file repositories/reference/linux-study-clean/drivers/platform/x86/x86-android-tablets/asus.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/x86-android-tablets/asus.c
Extension
.c
Size
9132 bytes
Lines
320
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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Board info for Asus X86 tablets which ship with Android as the factory image
 * and which have broken DSDT tables. The factory kernels shipped on these
 * devices typically have a bunch of things hardcoded, rather than specified
 * in their DSDT.
 *
 * Copyright (C) 2021-2023 Hans de Goede <hansg@kernel.org>
 */

#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
#include <linux/input-event-codes.h>
#include <linux/platform_device.h>

#include "shared-psy-info.h"
#include "x86-android-tablets.h"

/* Asus ME176C and TF103C tablets shared data */
static const struct property_entry asus_me176c_tf103c_int3496_props[] __initconst = {
	PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 22, GPIO_ACTIVE_HIGH),
	{ }
};

static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
	{
		/* For micro USB ID pin handling */
		.name = "intel-int3496",
		.id = PLATFORM_DEVID_NONE,
		.properties = asus_me176c_tf103c_int3496_props,
	},
};

static const struct software_node asus_me176c_tf103c_gpio_keys_node = {
	.name = "lid_sw",
};

static const struct property_entry asus_me176c_tf103c_lid_props[] = {
	PROPERTY_ENTRY_U32("linux,input-type", EV_SW),
	PROPERTY_ENTRY_U32("linux,code", SW_LID),
	PROPERTY_ENTRY_STRING("label", "lid_sw"),
	PROPERTY_ENTRY_GPIO("gpios", &baytrail_gpiochip_nodes[2], 12, GPIO_ACTIVE_LOW),
	PROPERTY_ENTRY_U32("debounce-interval", 50),
	PROPERTY_ENTRY_BOOL("wakeup-source"),
	{ }
};

static const struct software_node asus_me176c_tf103c_lid_node = {
	.parent = &asus_me176c_tf103c_gpio_keys_node,
	.properties = asus_me176c_tf103c_lid_props,
};

static const struct software_node *asus_me176c_tf103c_lid_swnodes[] = {
	&asus_me176c_tf103c_gpio_keys_node,
	&asus_me176c_tf103c_lid_node,
	NULL
};

/* Asus ME176C tablets have an Android factory image with everything hardcoded */
static const char * const asus_me176c_accel_mount_matrix[] = {
	"-1", "0", "0",
	"0", "1", "0",
	"0", "0", "1"
};

static const struct property_entry asus_me176c_accel_props[] = {
	PROPERTY_ENTRY_STRING_ARRAY("mount-matrix", asus_me176c_accel_mount_matrix),
	{ }
};

static const struct software_node asus_me176c_accel_node = {
	.properties = asus_me176c_accel_props,
};

static const struct property_entry asus_me176c_bq24190_props[] = {
	PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", tusb1211_chg_det_psy, 1),
	PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_hv_4v35_battery_node),
	PROPERTY_ENTRY_U32("ti,system-minimum-microvolt", 3600000),
	PROPERTY_ENTRY_BOOL("omit-battery-class"),
	PROPERTY_ENTRY_BOOL("disable-reset"),
	{ }
};

static const struct software_node asus_me176c_bq24190_node = {
	.properties = asus_me176c_bq24190_props,
};

static const struct property_entry asus_me176c_ug3105_props[] = {
	PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", bq24190_psy, 1),
	PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_hv_4v35_battery_node),

Annotation

Implementation Notes