drivers/platform/x86/x86-android-tablets/shared-psy-info.c

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

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/x86-android-tablets/shared-psy-info.c
Extension
.c
Size
5573 bytes
Lines
187
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
/*
 * Shared psy info for 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/platform_device.h>
#include <linux/power/bq24190_charger.h>
#include <linux/property.h>
#include <linux/regulator/machine.h>

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

/* Generic / shared charger / battery settings */
const char * const tusb1211_chg_det_psy[] = { "tusb1211-charger-detect" };
const char * const bq24190_psy[] = { "bq24190-charger" };
const char * const bq25890_psy[] = { "bq25890-charger-0" };

static const struct property_entry fg_bq24190_supply_props[] = {
	PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_psy),
	{ }
};

const struct software_node fg_bq24190_supply_node = {
	.properties = fg_bq24190_supply_props,
};

static const struct property_entry fg_bq25890_supply_props[] = {
	PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq25890_psy),
	{ }
};

const struct software_node fg_bq25890_supply_node = {
	.properties = fg_bq25890_supply_props,
};

static const u32 generic_lipo_battery_ovc_cap_celcius[] = { 25 };

static const u32 generic_lipo_4v2_battery_ovc_cap_table0[] = {
	4200000, 100,
	4150000, 95,
	4110000, 90,
	4075000, 85,
	4020000, 80,
	3982500, 75,
	3945000, 70,
	3907500, 65,
	3870000, 60,
	3853333, 55,
	3836667, 50,
	3820000, 45,
	3803333, 40,
	3786667, 35,
	3770000, 30,
	3750000, 25,
	3730000, 20,
	3710000, 15,
	3690000, 10,
	3610000, 5,
	3350000, 0
};

static const u32 generic_lipo_hv_4v35_battery_ovc_cap_table0[] = {
	4300000, 100,
	4250000, 96,
	4200000, 91,
	4150000, 86,
	4110000, 82,
	4075000, 77,
	4020000, 73,
	3982500, 68,
	3945000, 64,
	3907500, 59,
	3870000, 55,
	3853333, 50,
	3836667, 45,
	3820000, 41,
	3803333, 36,
	3786667, 32,
	3770000, 27,
	3750000, 23,
	3730000, 18,
	3710000, 14,

Annotation

Implementation Notes