/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* supply.h -- Power Supply Driver for Wolfson WM8350 PMIC
*
* Copyright 2007 Wolfson Microelectronics PLC
*/
#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
#define __LINUX_MFD_WM8350_SUPPLY_H_
#include <linux/mutex.h>
#include <linux/power_supply.h>
/*
* Charger registers
*/
#define WM8350_BATTERY_CHARGER_CONTROL_1 0 xA8
#define WM8350_BATTERY_CHARGER_CONTROL_2 0 xA9
#define WM8350_BATTERY_CHARGER_CONTROL_3 0 xAA
/*
* R168 (0xA8) - Battery Charger Control 1
*/
#define WM8350_CHG_ENA_R168 0 x8000
#define WM8350_CHG_THR 0 x2000
#define WM8350_CHG_EOC_SEL_MASK 0 x1C00
#define WM8350_CHG_TRICKLE_TEMP_CHOKE 0 x0200
#define WM8350_CHG_TRICKLE_USB_CHOKE 0 x0100
#define WM8350_CHG_RECOVER_T 0 x0080
#define WM8350_CHG_END_ACT 0 x0040
#define WM8350_CHG_FAST 0 x0020
#define WM8350_CHG_FAST_USB_THROTTLE 0 x0010
#define WM8350_CHG_NTC_MON 0 x0008
#define WM8350_CHG_BATT_HOT_MON 0 x0004
#define WM8350_CHG_BATT_COLD_MON 0 x0002
#define WM8350_CHG_CHIP_TEMP_MON 0 x0001
/*
* R169 (0xA9) - Battery Charger Control 2
*/
#define WM8350_CHG_ACTIVE 0 x8000
#define WM8350_CHG_PAUSE 0 x4000
#define WM8350_CHG_STS_MASK 0 x3000
#define WM8350_CHG_TIME_MASK 0 x0F00
#define WM8350_CHG_MASK_WALL_FB 0 x0080
#define WM8350_CHG_TRICKLE_SEL 0 x0040
#define WM8350_CHG_VSEL_MASK 0 x0030
#define WM8350_CHG_ISEL_MASK 0 x000F
#define WM8350_CHG_STS_OFF 0 x0000
#define WM8350_CHG_STS_TRICKLE 0 x1000
#define WM8350_CHG_STS_FAST 0 x2000
/*
* R170 (0xAA) - Battery Charger Control 3
*/
#define WM8350_CHG_THROTTLE_T_MASK 0 x0060
#define WM8350_CHG_SMART 0 x0010
#define WM8350_CHG_TIMER_ADJT_MASK 0 x000F
/*
* Charger Interrupts
*/
#define WM8350_IRQ_CHG_BAT_HOT 0
#define WM8350_IRQ_CHG_BAT_COLD 1
#define WM8350_IRQ_CHG_BAT_FAIL 2
#define WM8350_IRQ_CHG_TO 3
#define WM8350_IRQ_CHG_END 4
#define WM8350_IRQ_CHG_START 5
#define WM8350_IRQ_CHG_FAST_RDY 6
#define WM8350_IRQ_CHG_VBATT_LT_3P9 10
#define WM8350_IRQ_CHG_VBATT_LT_3P1 11
#define WM8350_IRQ_CHG_VBATT_LT_2P85 12
/*
* Charger Policy
*/
#define WM8350_CHG_TRICKLE_50mA (0 << 6 )
#define WM8350_CHG_TRICKLE_100mA (1 << 6 )
#define WM8350_CHG_4_05V (0 << 4 )
#define WM8350_CHG_4_10V (1 << 4 )
#define WM8350_CHG_4_15V (2 << 4 )
#define WM8350_CHG_4_20V (3 << 4 )
#define WM8350_CHG_FAST_LIMIT_mA(x) ((x / 50 ) & 0 xf)
#define WM8350_CHG_EOC_mA(x) (((x - 10 ) & 0 x7) << 10 )
#define WM8350_CHG_TRICKLE_3_1V (0 << 13 )
#define WM8350_CHG_TRICKLE_3_9V (1 << 13 )
/*
* Supply Registers.
*/
#define WM8350_USB_VOLTAGE_READBACK 0 x9C
#define WM8350_LINE_VOLTAGE_READBACK 0 x9D
#define WM8350_BATT_VOLTAGE_READBACK 0 x9E
/*
* Supply Interrupts.
*/
#define WM8350_IRQ_USB_LIMIT 15
#define WM8350_IRQ_EXT_USB_FB 36
#define WM8350_IRQ_EXT_WALL_FB 37
#define WM8350_IRQ_EXT_BAT_FB 38
/*
* Policy to control charger state machine.
*/
struct wm8350_charger_policy {
/* charger state machine policy - set in machine driver */
int eoc_mA; /* end of charge current (mA) */
int charge_mV; /* charge voltage */
int fast_limit_mA; /* fast charge current limit */
int fast_limit_USB_mA; /* USB fast charge current limit */
int charge_timeout; /* charge timeout (mins) */
int trickle_start_mV; /* trickle charge starts at mV */
int trickle_charge_mA; /* trickle charge current */
int trickle_charge_USB_mA; /* USB trickle charge current */
};
struct wm8350_power {
struct platform_device *pdev;
struct power_supply *battery;
struct power_supply *usb;
struct power_supply *ac;
struct wm8350_charger_policy *policy;
int rev_g_coeff;
};
#endif
Messung V0.5 in Prozent C=90 H=97 G=93
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-07)
¤
*© Formatika GbR, Deutschland