18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Power supply driver for the Active-semi ACT8945A PMIC 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2015 Atmel Corporation 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Author: Wenyou Yang <wenyou.yang@atmel.com> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 108c2ecf20Sopenharmony_ci#include <linux/module.h> 118c2ecf20Sopenharmony_ci#include <linux/of.h> 128c2ecf20Sopenharmony_ci#include <linux/of_irq.h> 138c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 148c2ecf20Sopenharmony_ci#include <linux/power_supply.h> 158c2ecf20Sopenharmony_ci#include <linux/regmap.h> 168c2ecf20Sopenharmony_ci#include <linux/gpio/consumer.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistatic const char *act8945a_charger_model = "ACT8945A"; 198c2ecf20Sopenharmony_cistatic const char *act8945a_charger_manufacturer = "Active-semi"; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/** 228c2ecf20Sopenharmony_ci * ACT8945A Charger Register Map 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* 0x70: Reserved */ 268c2ecf20Sopenharmony_ci#define ACT8945A_APCH_CFG 0x71 278c2ecf20Sopenharmony_ci#define ACT8945A_APCH_STATUS 0x78 288c2ecf20Sopenharmony_ci#define ACT8945A_APCH_CTRL 0x79 298c2ecf20Sopenharmony_ci#define ACT8945A_APCH_STATE 0x7A 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/* ACT8945A_APCH_CFG */ 328c2ecf20Sopenharmony_ci#define APCH_CFG_OVPSET (0x3 << 0) 338c2ecf20Sopenharmony_ci#define APCH_CFG_OVPSET_6V6 (0x0 << 0) 348c2ecf20Sopenharmony_ci#define APCH_CFG_OVPSET_7V (0x1 << 0) 358c2ecf20Sopenharmony_ci#define APCH_CFG_OVPSET_7V5 (0x2 << 0) 368c2ecf20Sopenharmony_ci#define APCH_CFG_OVPSET_8V (0x3 << 0) 378c2ecf20Sopenharmony_ci#define APCH_CFG_PRETIMO (0x3 << 2) 388c2ecf20Sopenharmony_ci#define APCH_CFG_PRETIMO_40_MIN (0x0 << 2) 398c2ecf20Sopenharmony_ci#define APCH_CFG_PRETIMO_60_MIN (0x1 << 2) 408c2ecf20Sopenharmony_ci#define APCH_CFG_PRETIMO_80_MIN (0x2 << 2) 418c2ecf20Sopenharmony_ci#define APCH_CFG_PRETIMO_DISABLED (0x3 << 2) 428c2ecf20Sopenharmony_ci#define APCH_CFG_TOTTIMO (0x3 << 4) 438c2ecf20Sopenharmony_ci#define APCH_CFG_TOTTIMO_3_HOUR (0x0 << 4) 448c2ecf20Sopenharmony_ci#define APCH_CFG_TOTTIMO_4_HOUR (0x1 << 4) 458c2ecf20Sopenharmony_ci#define APCH_CFG_TOTTIMO_5_HOUR (0x2 << 4) 468c2ecf20Sopenharmony_ci#define APCH_CFG_TOTTIMO_DISABLED (0x3 << 4) 478c2ecf20Sopenharmony_ci#define APCH_CFG_SUSCHG (0x1 << 7) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define APCH_STATUS_CHGDAT BIT(0) 508c2ecf20Sopenharmony_ci#define APCH_STATUS_INDAT BIT(1) 518c2ecf20Sopenharmony_ci#define APCH_STATUS_TEMPDAT BIT(2) 528c2ecf20Sopenharmony_ci#define APCH_STATUS_TIMRDAT BIT(3) 538c2ecf20Sopenharmony_ci#define APCH_STATUS_CHGSTAT BIT(4) 548c2ecf20Sopenharmony_ci#define APCH_STATUS_INSTAT BIT(5) 558c2ecf20Sopenharmony_ci#define APCH_STATUS_TEMPSTAT BIT(6) 568c2ecf20Sopenharmony_ci#define APCH_STATUS_TIMRSTAT BIT(7) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define APCH_CTRL_CHGEOCOUT BIT(0) 598c2ecf20Sopenharmony_ci#define APCH_CTRL_INDIS BIT(1) 608c2ecf20Sopenharmony_ci#define APCH_CTRL_TEMPOUT BIT(2) 618c2ecf20Sopenharmony_ci#define APCH_CTRL_TIMRPRE BIT(3) 628c2ecf20Sopenharmony_ci#define APCH_CTRL_CHGEOCIN BIT(4) 638c2ecf20Sopenharmony_ci#define APCH_CTRL_INCON BIT(5) 648c2ecf20Sopenharmony_ci#define APCH_CTRL_TEMPIN BIT(6) 658c2ecf20Sopenharmony_ci#define APCH_CTRL_TIMRTOT BIT(7) 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define APCH_STATE_ACINSTAT (0x1 << 1) 688c2ecf20Sopenharmony_ci#define APCH_STATE_CSTATE (0x3 << 4) 698c2ecf20Sopenharmony_ci#define APCH_STATE_CSTATE_SHIFT 4 708c2ecf20Sopenharmony_ci#define APCH_STATE_CSTATE_DISABLED 0x00 718c2ecf20Sopenharmony_ci#define APCH_STATE_CSTATE_EOC 0x01 728c2ecf20Sopenharmony_ci#define APCH_STATE_CSTATE_FAST 0x02 738c2ecf20Sopenharmony_ci#define APCH_STATE_CSTATE_PRE 0x03 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct act8945a_charger { 768c2ecf20Sopenharmony_ci struct power_supply *psy; 778c2ecf20Sopenharmony_ci struct power_supply_desc desc; 788c2ecf20Sopenharmony_ci struct regmap *regmap; 798c2ecf20Sopenharmony_ci struct work_struct work; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci bool init_done; 828c2ecf20Sopenharmony_ci struct gpio_desc *lbo_gpio; 838c2ecf20Sopenharmony_ci struct gpio_desc *chglev_gpio; 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistatic int act8945a_get_charger_state(struct regmap *regmap, int *val) 878c2ecf20Sopenharmony_ci{ 888c2ecf20Sopenharmony_ci int ret; 898c2ecf20Sopenharmony_ci unsigned int status, state; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATUS, &status); 928c2ecf20Sopenharmony_ci if (ret < 0) 938c2ecf20Sopenharmony_ci return ret; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATE, &state); 968c2ecf20Sopenharmony_ci if (ret < 0) 978c2ecf20Sopenharmony_ci return ret; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci state &= APCH_STATE_CSTATE; 1008c2ecf20Sopenharmony_ci state >>= APCH_STATE_CSTATE_SHIFT; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci switch (state) { 1038c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_PRE: 1048c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_FAST: 1058c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_STATUS_CHARGING; 1068c2ecf20Sopenharmony_ci break; 1078c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_EOC: 1088c2ecf20Sopenharmony_ci if (status & APCH_STATUS_CHGDAT) 1098c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_STATUS_FULL; 1108c2ecf20Sopenharmony_ci else 1118c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_STATUS_CHARGING; 1128c2ecf20Sopenharmony_ci break; 1138c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_DISABLED: 1148c2ecf20Sopenharmony_ci default: 1158c2ecf20Sopenharmony_ci if (!(status & APCH_STATUS_INDAT)) 1168c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_STATUS_DISCHARGING; 1178c2ecf20Sopenharmony_ci else 1188c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_STATUS_NOT_CHARGING; 1198c2ecf20Sopenharmony_ci break; 1208c2ecf20Sopenharmony_ci } 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci return 0; 1238c2ecf20Sopenharmony_ci} 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_cistatic int act8945a_get_charge_type(struct regmap *regmap, int *val) 1268c2ecf20Sopenharmony_ci{ 1278c2ecf20Sopenharmony_ci int ret; 1288c2ecf20Sopenharmony_ci unsigned int status, state; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATUS, &status); 1318c2ecf20Sopenharmony_ci if (ret < 0) 1328c2ecf20Sopenharmony_ci return ret; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATE, &state); 1358c2ecf20Sopenharmony_ci if (ret < 0) 1368c2ecf20Sopenharmony_ci return ret; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci state &= APCH_STATE_CSTATE; 1398c2ecf20Sopenharmony_ci state >>= APCH_STATE_CSTATE_SHIFT; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci switch (state) { 1428c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_PRE: 1438c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CHARGE_TYPE_TRICKLE; 1448c2ecf20Sopenharmony_ci break; 1458c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_FAST: 1468c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CHARGE_TYPE_FAST; 1478c2ecf20Sopenharmony_ci break; 1488c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_EOC: 1498c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CHARGE_TYPE_NONE; 1508c2ecf20Sopenharmony_ci break; 1518c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_DISABLED: 1528c2ecf20Sopenharmony_ci default: 1538c2ecf20Sopenharmony_ci if (!(status & APCH_STATUS_INDAT)) 1548c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CHARGE_TYPE_NONE; 1558c2ecf20Sopenharmony_ci else 1568c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN; 1578c2ecf20Sopenharmony_ci break; 1588c2ecf20Sopenharmony_ci } 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci return 0; 1618c2ecf20Sopenharmony_ci} 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_cistatic int act8945a_get_battery_health(struct regmap *regmap, int *val) 1648c2ecf20Sopenharmony_ci{ 1658c2ecf20Sopenharmony_ci int ret; 1668c2ecf20Sopenharmony_ci unsigned int status, state, config; 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATUS, &status); 1698c2ecf20Sopenharmony_ci if (ret < 0) 1708c2ecf20Sopenharmony_ci return ret; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_CFG, &config); 1738c2ecf20Sopenharmony_ci if (ret < 0) 1748c2ecf20Sopenharmony_ci return ret; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATE, &state); 1778c2ecf20Sopenharmony_ci if (ret < 0) 1788c2ecf20Sopenharmony_ci return ret; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci state &= APCH_STATE_CSTATE; 1818c2ecf20Sopenharmony_ci state >>= APCH_STATE_CSTATE_SHIFT; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci switch (state) { 1848c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_DISABLED: 1858c2ecf20Sopenharmony_ci if (config & APCH_CFG_SUSCHG) { 1868c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_HEALTH_UNKNOWN; 1878c2ecf20Sopenharmony_ci } else if (status & APCH_STATUS_INDAT) { 1888c2ecf20Sopenharmony_ci if (!(status & APCH_STATUS_TEMPDAT)) 1898c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_HEALTH_OVERHEAT; 1908c2ecf20Sopenharmony_ci else if (status & APCH_STATUS_TIMRDAT) 1918c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE; 1928c2ecf20Sopenharmony_ci else 1938c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_HEALTH_OVERVOLTAGE; 1948c2ecf20Sopenharmony_ci } else { 1958c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_HEALTH_GOOD; 1968c2ecf20Sopenharmony_ci } 1978c2ecf20Sopenharmony_ci break; 1988c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_PRE: 1998c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_FAST: 2008c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_EOC: 2018c2ecf20Sopenharmony_ci default: 2028c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_HEALTH_GOOD; 2038c2ecf20Sopenharmony_ci break; 2048c2ecf20Sopenharmony_ci } 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci return 0; 2078c2ecf20Sopenharmony_ci} 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_cistatic int act8945a_get_capacity_level(struct act8945a_charger *charger, 2108c2ecf20Sopenharmony_ci struct regmap *regmap, int *val) 2118c2ecf20Sopenharmony_ci{ 2128c2ecf20Sopenharmony_ci int ret; 2138c2ecf20Sopenharmony_ci unsigned int status, state, config; 2148c2ecf20Sopenharmony_ci int lbo_level = gpiod_get_value(charger->lbo_gpio); 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATUS, &status); 2178c2ecf20Sopenharmony_ci if (ret < 0) 2188c2ecf20Sopenharmony_ci return ret; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_CFG, &config); 2218c2ecf20Sopenharmony_ci if (ret < 0) 2228c2ecf20Sopenharmony_ci return ret; 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATE, &state); 2258c2ecf20Sopenharmony_ci if (ret < 0) 2268c2ecf20Sopenharmony_ci return ret; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci state &= APCH_STATE_CSTATE; 2298c2ecf20Sopenharmony_ci state >>= APCH_STATE_CSTATE_SHIFT; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci switch (state) { 2328c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_PRE: 2338c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_LOW; 2348c2ecf20Sopenharmony_ci break; 2358c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_FAST: 2368c2ecf20Sopenharmony_ci if (lbo_level) 2378c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_HIGH; 2388c2ecf20Sopenharmony_ci else 2398c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_LOW; 2408c2ecf20Sopenharmony_ci break; 2418c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_EOC: 2428c2ecf20Sopenharmony_ci if (status & APCH_STATUS_CHGDAT) 2438c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_FULL; 2448c2ecf20Sopenharmony_ci else 2458c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; 2468c2ecf20Sopenharmony_ci break; 2478c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_DISABLED: 2488c2ecf20Sopenharmony_ci default: 2498c2ecf20Sopenharmony_ci if (config & APCH_CFG_SUSCHG) { 2508c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; 2518c2ecf20Sopenharmony_ci } else { 2528c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; 2538c2ecf20Sopenharmony_ci if (!(status & APCH_STATUS_INDAT)) { 2548c2ecf20Sopenharmony_ci if (!lbo_level) 2558c2ecf20Sopenharmony_ci *val = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL; 2568c2ecf20Sopenharmony_ci } 2578c2ecf20Sopenharmony_ci } 2588c2ecf20Sopenharmony_ci break; 2598c2ecf20Sopenharmony_ci } 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci return 0; 2628c2ecf20Sopenharmony_ci} 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci#define MAX_CURRENT_USB_HIGH 450000 2658c2ecf20Sopenharmony_ci#define MAX_CURRENT_USB_LOW 90000 2668c2ecf20Sopenharmony_ci#define MAX_CURRENT_USB_PRE 45000 2678c2ecf20Sopenharmony_ci/* 2688c2ecf20Sopenharmony_ci * Riset(K) = 2336 * (1V/Ichg(mA)) - 0.205 2698c2ecf20Sopenharmony_ci * Riset = 2.43K 2708c2ecf20Sopenharmony_ci */ 2718c2ecf20Sopenharmony_ci#define MAX_CURRENT_AC_HIGH 886527 2728c2ecf20Sopenharmony_ci#define MAX_CURRENT_AC_LOW 117305 2738c2ecf20Sopenharmony_ci#define MAX_CURRENT_AC_HIGH_PRE 88653 2748c2ecf20Sopenharmony_ci#define MAX_CURRENT_AC_LOW_PRE 11731 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_cistatic int act8945a_get_current_max(struct act8945a_charger *charger, 2778c2ecf20Sopenharmony_ci struct regmap *regmap, int *val) 2788c2ecf20Sopenharmony_ci{ 2798c2ecf20Sopenharmony_ci int ret; 2808c2ecf20Sopenharmony_ci unsigned int status, state; 2818c2ecf20Sopenharmony_ci unsigned int acin_state; 2828c2ecf20Sopenharmony_ci int chgin_level = gpiod_get_value(charger->chglev_gpio); 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATUS, &status); 2858c2ecf20Sopenharmony_ci if (ret < 0) 2868c2ecf20Sopenharmony_ci return ret; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_STATE, &state); 2898c2ecf20Sopenharmony_ci if (ret < 0) 2908c2ecf20Sopenharmony_ci return ret; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci acin_state = (state & APCH_STATE_ACINSTAT) >> 1; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci state &= APCH_STATE_CSTATE; 2958c2ecf20Sopenharmony_ci state >>= APCH_STATE_CSTATE_SHIFT; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci switch (state) { 2988c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_PRE: 2998c2ecf20Sopenharmony_ci if (acin_state) { 3008c2ecf20Sopenharmony_ci if (chgin_level) 3018c2ecf20Sopenharmony_ci *val = MAX_CURRENT_AC_HIGH_PRE; 3028c2ecf20Sopenharmony_ci else 3038c2ecf20Sopenharmony_ci *val = MAX_CURRENT_AC_LOW_PRE; 3048c2ecf20Sopenharmony_ci } else { 3058c2ecf20Sopenharmony_ci *val = MAX_CURRENT_USB_PRE; 3068c2ecf20Sopenharmony_ci } 3078c2ecf20Sopenharmony_ci break; 3088c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_FAST: 3098c2ecf20Sopenharmony_ci if (acin_state) { 3108c2ecf20Sopenharmony_ci if (chgin_level) 3118c2ecf20Sopenharmony_ci *val = MAX_CURRENT_AC_HIGH; 3128c2ecf20Sopenharmony_ci else 3138c2ecf20Sopenharmony_ci *val = MAX_CURRENT_AC_LOW; 3148c2ecf20Sopenharmony_ci } else { 3158c2ecf20Sopenharmony_ci if (chgin_level) 3168c2ecf20Sopenharmony_ci *val = MAX_CURRENT_USB_HIGH; 3178c2ecf20Sopenharmony_ci else 3188c2ecf20Sopenharmony_ci *val = MAX_CURRENT_USB_LOW; 3198c2ecf20Sopenharmony_ci } 3208c2ecf20Sopenharmony_ci break; 3218c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_EOC: 3228c2ecf20Sopenharmony_ci case APCH_STATE_CSTATE_DISABLED: 3238c2ecf20Sopenharmony_ci default: 3248c2ecf20Sopenharmony_ci *val = 0; 3258c2ecf20Sopenharmony_ci break; 3268c2ecf20Sopenharmony_ci } 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci return 0; 3298c2ecf20Sopenharmony_ci} 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic enum power_supply_property act8945a_charger_props[] = { 3328c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_STATUS, 3338c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_CHARGE_TYPE, 3348c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_TECHNOLOGY, 3358c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_HEALTH, 3368c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_CAPACITY_LEVEL, 3378c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_CURRENT_MAX, 3388c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_MODEL_NAME, 3398c2ecf20Sopenharmony_ci POWER_SUPPLY_PROP_MANUFACTURER 3408c2ecf20Sopenharmony_ci}; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_cistatic int act8945a_charger_get_property(struct power_supply *psy, 3438c2ecf20Sopenharmony_ci enum power_supply_property prop, 3448c2ecf20Sopenharmony_ci union power_supply_propval *val) 3458c2ecf20Sopenharmony_ci{ 3468c2ecf20Sopenharmony_ci struct act8945a_charger *charger = power_supply_get_drvdata(psy); 3478c2ecf20Sopenharmony_ci struct regmap *regmap = charger->regmap; 3488c2ecf20Sopenharmony_ci int ret = 0; 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci switch (prop) { 3518c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_STATUS: 3528c2ecf20Sopenharmony_ci ret = act8945a_get_charger_state(regmap, &val->intval); 3538c2ecf20Sopenharmony_ci break; 3548c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_CHARGE_TYPE: 3558c2ecf20Sopenharmony_ci ret = act8945a_get_charge_type(regmap, &val->intval); 3568c2ecf20Sopenharmony_ci break; 3578c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_TECHNOLOGY: 3588c2ecf20Sopenharmony_ci val->intval = POWER_SUPPLY_TECHNOLOGY_LION; 3598c2ecf20Sopenharmony_ci break; 3608c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_HEALTH: 3618c2ecf20Sopenharmony_ci ret = act8945a_get_battery_health(regmap, &val->intval); 3628c2ecf20Sopenharmony_ci break; 3638c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_CAPACITY_LEVEL: 3648c2ecf20Sopenharmony_ci ret = act8945a_get_capacity_level(charger, 3658c2ecf20Sopenharmony_ci regmap, &val->intval); 3668c2ecf20Sopenharmony_ci break; 3678c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_CURRENT_MAX: 3688c2ecf20Sopenharmony_ci ret = act8945a_get_current_max(charger, 3698c2ecf20Sopenharmony_ci regmap, &val->intval); 3708c2ecf20Sopenharmony_ci break; 3718c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_MODEL_NAME: 3728c2ecf20Sopenharmony_ci val->strval = act8945a_charger_model; 3738c2ecf20Sopenharmony_ci break; 3748c2ecf20Sopenharmony_ci case POWER_SUPPLY_PROP_MANUFACTURER: 3758c2ecf20Sopenharmony_ci val->strval = act8945a_charger_manufacturer; 3768c2ecf20Sopenharmony_ci break; 3778c2ecf20Sopenharmony_ci default: 3788c2ecf20Sopenharmony_ci return -EINVAL; 3798c2ecf20Sopenharmony_ci } 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci return ret; 3828c2ecf20Sopenharmony_ci} 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_cistatic int act8945a_enable_interrupt(struct act8945a_charger *charger) 3858c2ecf20Sopenharmony_ci{ 3868c2ecf20Sopenharmony_ci struct regmap *regmap = charger->regmap; 3878c2ecf20Sopenharmony_ci unsigned char ctrl; 3888c2ecf20Sopenharmony_ci int ret; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci ctrl = APCH_CTRL_CHGEOCOUT | APCH_CTRL_CHGEOCIN | 3918c2ecf20Sopenharmony_ci APCH_CTRL_INDIS | APCH_CTRL_INCON | 3928c2ecf20Sopenharmony_ci APCH_CTRL_TEMPOUT | APCH_CTRL_TEMPIN | 3938c2ecf20Sopenharmony_ci APCH_CTRL_TIMRPRE | APCH_CTRL_TIMRTOT; 3948c2ecf20Sopenharmony_ci ret = regmap_write(regmap, ACT8945A_APCH_CTRL, ctrl); 3958c2ecf20Sopenharmony_ci if (ret) 3968c2ecf20Sopenharmony_ci return ret; 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci ctrl = APCH_STATUS_CHGSTAT | APCH_STATUS_INSTAT | 3998c2ecf20Sopenharmony_ci APCH_STATUS_TEMPSTAT | APCH_STATUS_TIMRSTAT; 4008c2ecf20Sopenharmony_ci ret = regmap_write(regmap, ACT8945A_APCH_STATUS, ctrl); 4018c2ecf20Sopenharmony_ci if (ret) 4028c2ecf20Sopenharmony_ci return ret; 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci return 0; 4058c2ecf20Sopenharmony_ci} 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_cistatic unsigned int act8945a_set_supply_type(struct act8945a_charger *charger, 4088c2ecf20Sopenharmony_ci unsigned int *type) 4098c2ecf20Sopenharmony_ci{ 4108c2ecf20Sopenharmony_ci unsigned int status, state; 4118c2ecf20Sopenharmony_ci int ret; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci ret = regmap_read(charger->regmap, ACT8945A_APCH_STATUS, &status); 4148c2ecf20Sopenharmony_ci if (ret < 0) 4158c2ecf20Sopenharmony_ci return ret; 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_ci ret = regmap_read(charger->regmap, ACT8945A_APCH_STATE, &state); 4188c2ecf20Sopenharmony_ci if (ret < 0) 4198c2ecf20Sopenharmony_ci return ret; 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci if (status & APCH_STATUS_INDAT) { 4228c2ecf20Sopenharmony_ci if (state & APCH_STATE_ACINSTAT) 4238c2ecf20Sopenharmony_ci *type = POWER_SUPPLY_TYPE_MAINS; 4248c2ecf20Sopenharmony_ci else 4258c2ecf20Sopenharmony_ci *type = POWER_SUPPLY_TYPE_USB; 4268c2ecf20Sopenharmony_ci } else { 4278c2ecf20Sopenharmony_ci *type = POWER_SUPPLY_TYPE_BATTERY; 4288c2ecf20Sopenharmony_ci } 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci return 0; 4318c2ecf20Sopenharmony_ci} 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cistatic void act8945a_work(struct work_struct *work) 4348c2ecf20Sopenharmony_ci{ 4358c2ecf20Sopenharmony_ci struct act8945a_charger *charger = 4368c2ecf20Sopenharmony_ci container_of(work, struct act8945a_charger, work); 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci act8945a_set_supply_type(charger, &charger->desc.type); 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci power_supply_changed(charger->psy); 4418c2ecf20Sopenharmony_ci} 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_cistatic irqreturn_t act8945a_status_changed(int irq, void *dev_id) 4448c2ecf20Sopenharmony_ci{ 4458c2ecf20Sopenharmony_ci struct act8945a_charger *charger = dev_id; 4468c2ecf20Sopenharmony_ci 4478c2ecf20Sopenharmony_ci if (charger->init_done) 4488c2ecf20Sopenharmony_ci schedule_work(&charger->work); 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci return IRQ_HANDLED; 4518c2ecf20Sopenharmony_ci} 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci#define DEFAULT_TOTAL_TIME_OUT 3 4548c2ecf20Sopenharmony_ci#define DEFAULT_PRE_TIME_OUT 40 4558c2ecf20Sopenharmony_ci#define DEFAULT_INPUT_OVP_THRESHOLD 6600 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_cistatic int act8945a_charger_config(struct device *dev, 4588c2ecf20Sopenharmony_ci struct act8945a_charger *charger) 4598c2ecf20Sopenharmony_ci{ 4608c2ecf20Sopenharmony_ci struct device_node *np = dev->of_node; 4618c2ecf20Sopenharmony_ci struct regmap *regmap = charger->regmap; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci u32 total_time_out; 4648c2ecf20Sopenharmony_ci u32 pre_time_out; 4658c2ecf20Sopenharmony_ci u32 input_voltage_threshold; 4668c2ecf20Sopenharmony_ci int err, ret; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci unsigned int tmp; 4698c2ecf20Sopenharmony_ci unsigned int value = 0; 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci if (!np) { 4728c2ecf20Sopenharmony_ci dev_err(dev, "no charger of node\n"); 4738c2ecf20Sopenharmony_ci return -EINVAL; 4748c2ecf20Sopenharmony_ci } 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci ret = regmap_read(regmap, ACT8945A_APCH_CFG, &tmp); 4778c2ecf20Sopenharmony_ci if (ret) 4788c2ecf20Sopenharmony_ci return ret; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci if (tmp & APCH_CFG_SUSCHG) { 4818c2ecf20Sopenharmony_ci value |= APCH_CFG_SUSCHG; 4828c2ecf20Sopenharmony_ci dev_info(dev, "have been suspended\n"); 4838c2ecf20Sopenharmony_ci } 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci charger->lbo_gpio = devm_gpiod_get_optional(dev, "active-semi,lbo", 4868c2ecf20Sopenharmony_ci GPIOD_IN); 4878c2ecf20Sopenharmony_ci if (IS_ERR(charger->lbo_gpio)) { 4888c2ecf20Sopenharmony_ci err = PTR_ERR(charger->lbo_gpio); 4898c2ecf20Sopenharmony_ci dev_err(dev, "unable to claim gpio \"lbo\": %d\n", err); 4908c2ecf20Sopenharmony_ci return err; 4918c2ecf20Sopenharmony_ci } 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ci ret = devm_request_irq(dev, gpiod_to_irq(charger->lbo_gpio), 4948c2ecf20Sopenharmony_ci act8945a_status_changed, 4958c2ecf20Sopenharmony_ci (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING), 4968c2ecf20Sopenharmony_ci "act8945a_lbo_detect", charger); 4978c2ecf20Sopenharmony_ci if (ret) 4988c2ecf20Sopenharmony_ci dev_info(dev, "failed to request gpio \"lbo\" IRQ\n"); 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_ci charger->chglev_gpio = devm_gpiod_get_optional(dev, 5018c2ecf20Sopenharmony_ci "active-semi,chglev", 5028c2ecf20Sopenharmony_ci GPIOD_IN); 5038c2ecf20Sopenharmony_ci if (IS_ERR(charger->chglev_gpio)) { 5048c2ecf20Sopenharmony_ci err = PTR_ERR(charger->chglev_gpio); 5058c2ecf20Sopenharmony_ci dev_err(dev, "unable to claim gpio \"chglev\": %d\n", err); 5068c2ecf20Sopenharmony_ci return err; 5078c2ecf20Sopenharmony_ci } 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_ci if (of_property_read_u32(np, 5108c2ecf20Sopenharmony_ci "active-semi,input-voltage-threshold-microvolt", 5118c2ecf20Sopenharmony_ci &input_voltage_threshold)) 5128c2ecf20Sopenharmony_ci input_voltage_threshold = DEFAULT_INPUT_OVP_THRESHOLD; 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci if (of_property_read_u32(np, 5158c2ecf20Sopenharmony_ci "active-semi,precondition-timeout", 5168c2ecf20Sopenharmony_ci &pre_time_out)) 5178c2ecf20Sopenharmony_ci pre_time_out = DEFAULT_PRE_TIME_OUT; 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci if (of_property_read_u32(np, "active-semi,total-timeout", 5208c2ecf20Sopenharmony_ci &total_time_out)) 5218c2ecf20Sopenharmony_ci total_time_out = DEFAULT_TOTAL_TIME_OUT; 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci switch (input_voltage_threshold) { 5248c2ecf20Sopenharmony_ci case 8000: 5258c2ecf20Sopenharmony_ci value |= APCH_CFG_OVPSET_8V; 5268c2ecf20Sopenharmony_ci break; 5278c2ecf20Sopenharmony_ci case 7500: 5288c2ecf20Sopenharmony_ci value |= APCH_CFG_OVPSET_7V5; 5298c2ecf20Sopenharmony_ci break; 5308c2ecf20Sopenharmony_ci case 7000: 5318c2ecf20Sopenharmony_ci value |= APCH_CFG_OVPSET_7V; 5328c2ecf20Sopenharmony_ci break; 5338c2ecf20Sopenharmony_ci case 6600: 5348c2ecf20Sopenharmony_ci default: 5358c2ecf20Sopenharmony_ci value |= APCH_CFG_OVPSET_6V6; 5368c2ecf20Sopenharmony_ci break; 5378c2ecf20Sopenharmony_ci } 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci switch (pre_time_out) { 5408c2ecf20Sopenharmony_ci case 60: 5418c2ecf20Sopenharmony_ci value |= APCH_CFG_PRETIMO_60_MIN; 5428c2ecf20Sopenharmony_ci break; 5438c2ecf20Sopenharmony_ci case 80: 5448c2ecf20Sopenharmony_ci value |= APCH_CFG_PRETIMO_80_MIN; 5458c2ecf20Sopenharmony_ci break; 5468c2ecf20Sopenharmony_ci case 0: 5478c2ecf20Sopenharmony_ci value |= APCH_CFG_PRETIMO_DISABLED; 5488c2ecf20Sopenharmony_ci break; 5498c2ecf20Sopenharmony_ci case 40: 5508c2ecf20Sopenharmony_ci default: 5518c2ecf20Sopenharmony_ci value |= APCH_CFG_PRETIMO_40_MIN; 5528c2ecf20Sopenharmony_ci break; 5538c2ecf20Sopenharmony_ci } 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci switch (total_time_out) { 5568c2ecf20Sopenharmony_ci case 4: 5578c2ecf20Sopenharmony_ci value |= APCH_CFG_TOTTIMO_4_HOUR; 5588c2ecf20Sopenharmony_ci break; 5598c2ecf20Sopenharmony_ci case 5: 5608c2ecf20Sopenharmony_ci value |= APCH_CFG_TOTTIMO_5_HOUR; 5618c2ecf20Sopenharmony_ci break; 5628c2ecf20Sopenharmony_ci case 0: 5638c2ecf20Sopenharmony_ci value |= APCH_CFG_TOTTIMO_DISABLED; 5648c2ecf20Sopenharmony_ci break; 5658c2ecf20Sopenharmony_ci case 3: 5668c2ecf20Sopenharmony_ci default: 5678c2ecf20Sopenharmony_ci value |= APCH_CFG_TOTTIMO_3_HOUR; 5688c2ecf20Sopenharmony_ci break; 5698c2ecf20Sopenharmony_ci } 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci return regmap_write(regmap, ACT8945A_APCH_CFG, value); 5728c2ecf20Sopenharmony_ci} 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_cistatic int act8945a_charger_probe(struct platform_device *pdev) 5758c2ecf20Sopenharmony_ci{ 5768c2ecf20Sopenharmony_ci struct act8945a_charger *charger; 5778c2ecf20Sopenharmony_ci struct power_supply_config psy_cfg = {}; 5788c2ecf20Sopenharmony_ci int irq, ret; 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); 5818c2ecf20Sopenharmony_ci if (!charger) 5828c2ecf20Sopenharmony_ci return -ENOMEM; 5838c2ecf20Sopenharmony_ci 5848c2ecf20Sopenharmony_ci charger->regmap = dev_get_regmap(pdev->dev.parent, NULL); 5858c2ecf20Sopenharmony_ci if (!charger->regmap) { 5868c2ecf20Sopenharmony_ci dev_err(&pdev->dev, "Parent did not provide regmap\n"); 5878c2ecf20Sopenharmony_ci return -EINVAL; 5888c2ecf20Sopenharmony_ci } 5898c2ecf20Sopenharmony_ci 5908c2ecf20Sopenharmony_ci ret = act8945a_charger_config(&pdev->dev, charger); 5918c2ecf20Sopenharmony_ci if (ret) 5928c2ecf20Sopenharmony_ci return ret; 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci irq = of_irq_get(pdev->dev.of_node, 0); 5958c2ecf20Sopenharmony_ci if (irq <= 0) { 5968c2ecf20Sopenharmony_ci dev_err(&pdev->dev, "failed to find IRQ number\n"); 5978c2ecf20Sopenharmony_ci return irq ?: -ENXIO; 5988c2ecf20Sopenharmony_ci } 5998c2ecf20Sopenharmony_ci 6008c2ecf20Sopenharmony_ci ret = devm_request_irq(&pdev->dev, irq, act8945a_status_changed, 6018c2ecf20Sopenharmony_ci IRQF_TRIGGER_FALLING, "act8945a_interrupt", 6028c2ecf20Sopenharmony_ci charger); 6038c2ecf20Sopenharmony_ci if (ret) { 6048c2ecf20Sopenharmony_ci dev_err(&pdev->dev, "failed to request nIRQ pin IRQ\n"); 6058c2ecf20Sopenharmony_ci return ret; 6068c2ecf20Sopenharmony_ci } 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_ci charger->desc.name = "act8945a-charger"; 6098c2ecf20Sopenharmony_ci charger->desc.get_property = act8945a_charger_get_property; 6108c2ecf20Sopenharmony_ci charger->desc.properties = act8945a_charger_props; 6118c2ecf20Sopenharmony_ci charger->desc.num_properties = ARRAY_SIZE(act8945a_charger_props); 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci ret = act8945a_set_supply_type(charger, &charger->desc.type); 6148c2ecf20Sopenharmony_ci if (ret) 6158c2ecf20Sopenharmony_ci return -EINVAL; 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_ci psy_cfg.of_node = pdev->dev.of_node; 6188c2ecf20Sopenharmony_ci psy_cfg.drv_data = charger; 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci charger->psy = devm_power_supply_register(&pdev->dev, 6218c2ecf20Sopenharmony_ci &charger->desc, 6228c2ecf20Sopenharmony_ci &psy_cfg); 6238c2ecf20Sopenharmony_ci if (IS_ERR(charger->psy)) { 6248c2ecf20Sopenharmony_ci dev_err(&pdev->dev, "failed to register power supply\n"); 6258c2ecf20Sopenharmony_ci return PTR_ERR(charger->psy); 6268c2ecf20Sopenharmony_ci } 6278c2ecf20Sopenharmony_ci 6288c2ecf20Sopenharmony_ci platform_set_drvdata(pdev, charger); 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci INIT_WORK(&charger->work, act8945a_work); 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ci ret = act8945a_enable_interrupt(charger); 6338c2ecf20Sopenharmony_ci if (ret) 6348c2ecf20Sopenharmony_ci return -EIO; 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_ci charger->init_done = true; 6378c2ecf20Sopenharmony_ci 6388c2ecf20Sopenharmony_ci return 0; 6398c2ecf20Sopenharmony_ci} 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_cistatic int act8945a_charger_remove(struct platform_device *pdev) 6428c2ecf20Sopenharmony_ci{ 6438c2ecf20Sopenharmony_ci struct act8945a_charger *charger = platform_get_drvdata(pdev); 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci charger->init_done = false; 6468c2ecf20Sopenharmony_ci cancel_work_sync(&charger->work); 6478c2ecf20Sopenharmony_ci 6488c2ecf20Sopenharmony_ci return 0; 6498c2ecf20Sopenharmony_ci} 6508c2ecf20Sopenharmony_ci 6518c2ecf20Sopenharmony_cistatic struct platform_driver act8945a_charger_driver = { 6528c2ecf20Sopenharmony_ci .driver = { 6538c2ecf20Sopenharmony_ci .name = "act8945a-charger", 6548c2ecf20Sopenharmony_ci }, 6558c2ecf20Sopenharmony_ci .probe = act8945a_charger_probe, 6568c2ecf20Sopenharmony_ci .remove = act8945a_charger_remove, 6578c2ecf20Sopenharmony_ci}; 6588c2ecf20Sopenharmony_cimodule_platform_driver(act8945a_charger_driver); 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Active-semi ACT8945A ActivePath charger driver"); 6618c2ecf20Sopenharmony_ciMODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>"); 6628c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 663