1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Shared psy info for X86 tablets which ship with Android as the factory image
4 * and which have broken DSDT tables. The factory kernels shipped on these
5 * devices typically have a bunch of things hardcoded, rather than specified
8 * Copyright (C) 2021-2023 Hans de Goede <hdegoede@redhat.com>
11 #include <linux/gpio/machine.h>
12 #include <linux/platform_device.h>
13 #include <linux/power/bq24190_charger.h>
14 #include <linux/property.h>
15 #include <linux/regulator/machine.h>
17 #include "shared-psy-info.h"
19 /* Generic / shared charger / battery settings */
20 const char * const tusb1211_chg_det_psy
[] = { "tusb1211-charger-detect" };
21 const char * const bq24190_psy
[] = { "bq24190-charger" };
22 const char * const bq25890_psy
[] = { "bq25890-charger-0" };
24 static const struct property_entry fg_bq24190_supply_props
[] = {
25 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_psy
),
29 const struct software_node fg_bq24190_supply_node
= {
30 .properties
= fg_bq24190_supply_props
,
33 static const struct property_entry fg_bq25890_supply_props
[] = {
34 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq25890_psy
),
38 const struct software_node fg_bq25890_supply_node
= {
39 .properties
= fg_bq25890_supply_props
,
42 /* LiPo HighVoltage (max 4.35V) settings used by most devs with a HV battery */
43 static const struct property_entry generic_lipo_hv_4v35_battery_props
[] = {
44 PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
45 PROPERTY_ENTRY_STRING("device-chemistry", "lithium-ion"),
46 PROPERTY_ENTRY_U32("precharge-current-microamp", 256000),
47 PROPERTY_ENTRY_U32("charge-term-current-microamp", 128000),
48 PROPERTY_ENTRY_U32("constant-charge-current-max-microamp", 1856000),
49 PROPERTY_ENTRY_U32("constant-charge-voltage-max-microvolt", 4352000),
50 PROPERTY_ENTRY_U32("factory-internal-resistance-micro-ohms", 150000),
54 const struct software_node generic_lipo_hv_4v35_battery_node
= {
55 .properties
= generic_lipo_hv_4v35_battery_props
,
58 /* For enabling the bq24190 5V boost based on id-pin */
59 static struct regulator_consumer_supply intel_int3496_consumer
= {
61 .dev_name
= "intel-int3496",
64 static const struct regulator_init_data bq24190_vbus_init_data
= {
66 .name
= "bq24190_vbus",
67 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
69 .consumer_supplies
= &intel_int3496_consumer
,
70 .num_consumer_supplies
= 1,
73 struct bq24190_platform_data bq24190_pdata
= {
74 .regulator_init_data
= &bq24190_vbus_init_data
,
77 const char * const bq24190_modules
[] __initconst
= {
78 "intel_crystal_cove_charger", /* For the bq24190 IRQ */
79 "bq24190_charger", /* For the Vbus regulator for intel-int3496 */
83 /* Generic platform device array and GPIO lookup table for micro USB ID pin handling */
84 const struct platform_device_info int3496_pdevs
[] __initconst
= {
86 /* For micro USB ID pin handling */
87 .name
= "intel-int3496",
88 .id
= PLATFORM_DEVID_NONE
,
92 struct gpiod_lookup_table int3496_reference_gpios
= {
93 .dev_id
= "intel-int3496",
95 GPIO_LOOKUP("INT33FC:01", 15, "vbus", GPIO_ACTIVE_HIGH
),
96 GPIO_LOOKUP("INT33FC:02", 1, "mux", GPIO_ACTIVE_HIGH
),
97 GPIO_LOOKUP("INT33FC:02", 18, "id", GPIO_ACTIVE_HIGH
),