~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mfd/wm8350/supply.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * supply.h  --  Power Supply Driver for Wolfson WM8350 PMIC
  4  *
  5  * Copyright 2007 Wolfson Microelectronics PLC
  6  */
  7 
  8 #ifndef __LINUX_MFD_WM8350_SUPPLY_H_
  9 #define __LINUX_MFD_WM8350_SUPPLY_H_
 10 
 11 #include <linux/mutex.h>
 12 #include <linux/power_supply.h>
 13 
 14 /*
 15  * Charger registers
 16  */
 17 #define WM8350_BATTERY_CHARGER_CONTROL_1        0xA8
 18 #define WM8350_BATTERY_CHARGER_CONTROL_2        0xA9
 19 #define WM8350_BATTERY_CHARGER_CONTROL_3        0xAA
 20 
 21 /*
 22  * R168 (0xA8) - Battery Charger Control 1
 23  */
 24 #define WM8350_CHG_ENA_R168                     0x8000
 25 #define WM8350_CHG_THR                          0x2000
 26 #define WM8350_CHG_EOC_SEL_MASK                 0x1C00
 27 #define WM8350_CHG_TRICKLE_TEMP_CHOKE           0x0200
 28 #define WM8350_CHG_TRICKLE_USB_CHOKE            0x0100
 29 #define WM8350_CHG_RECOVER_T                    0x0080
 30 #define WM8350_CHG_END_ACT                      0x0040
 31 #define WM8350_CHG_FAST                         0x0020
 32 #define WM8350_CHG_FAST_USB_THROTTLE            0x0010
 33 #define WM8350_CHG_NTC_MON                      0x0008
 34 #define WM8350_CHG_BATT_HOT_MON                 0x0004
 35 #define WM8350_CHG_BATT_COLD_MON                0x0002
 36 #define WM8350_CHG_CHIP_TEMP_MON                0x0001
 37 
 38 /*
 39  * R169 (0xA9) - Battery Charger Control 2
 40  */
 41 #define WM8350_CHG_ACTIVE                       0x8000
 42 #define WM8350_CHG_PAUSE                        0x4000
 43 #define WM8350_CHG_STS_MASK                     0x3000
 44 #define WM8350_CHG_TIME_MASK                    0x0F00
 45 #define WM8350_CHG_MASK_WALL_FB                 0x0080
 46 #define WM8350_CHG_TRICKLE_SEL                  0x0040
 47 #define WM8350_CHG_VSEL_MASK                    0x0030
 48 #define WM8350_CHG_ISEL_MASK                    0x000F
 49 #define WM8350_CHG_STS_OFF                      0x0000
 50 #define WM8350_CHG_STS_TRICKLE                  0x1000
 51 #define WM8350_CHG_STS_FAST                     0x2000
 52 
 53 /*
 54  * R170 (0xAA) - Battery Charger Control 3
 55  */
 56 #define WM8350_CHG_THROTTLE_T_MASK              0x0060
 57 #define WM8350_CHG_SMART                        0x0010
 58 #define WM8350_CHG_TIMER_ADJT_MASK              0x000F
 59 
 60 /*
 61  * Charger Interrupts
 62  */
 63 #define WM8350_IRQ_CHG_BAT_HOT                  0
 64 #define WM8350_IRQ_CHG_BAT_COLD                 1
 65 #define WM8350_IRQ_CHG_BAT_FAIL                 2
 66 #define WM8350_IRQ_CHG_TO                       3
 67 #define WM8350_IRQ_CHG_END                      4
 68 #define WM8350_IRQ_CHG_START                    5
 69 #define WM8350_IRQ_CHG_FAST_RDY                 6
 70 #define WM8350_IRQ_CHG_VBATT_LT_3P9             10
 71 #define WM8350_IRQ_CHG_VBATT_LT_3P1             11
 72 #define WM8350_IRQ_CHG_VBATT_LT_2P85            12
 73 
 74 /*
 75  * Charger Policy
 76  */
 77 #define WM8350_CHG_TRICKLE_50mA                 (0 << 6)
 78 #define WM8350_CHG_TRICKLE_100mA                (1 << 6)
 79 #define WM8350_CHG_4_05V                        (0 << 4)
 80 #define WM8350_CHG_4_10V                        (1 << 4)
 81 #define WM8350_CHG_4_15V                        (2 << 4)
 82 #define WM8350_CHG_4_20V                        (3 << 4)
 83 #define WM8350_CHG_FAST_LIMIT_mA(x)             ((x / 50) & 0xf)
 84 #define WM8350_CHG_EOC_mA(x)                    (((x - 10) & 0x7) << 10)
 85 #define WM8350_CHG_TRICKLE_3_1V                 (0 << 13)
 86 #define WM8350_CHG_TRICKLE_3_9V                 (1 << 13)
 87 
 88 /*
 89  * Supply Registers.
 90  */
 91 #define WM8350_USB_VOLTAGE_READBACK             0x9C
 92 #define WM8350_LINE_VOLTAGE_READBACK            0x9D
 93 #define WM8350_BATT_VOLTAGE_READBACK            0x9E
 94 
 95 /*
 96  * Supply Interrupts.
 97  */
 98 #define WM8350_IRQ_USB_LIMIT                    15
 99 #define WM8350_IRQ_EXT_USB_FB                   36
100 #define WM8350_IRQ_EXT_WALL_FB                  37
101 #define WM8350_IRQ_EXT_BAT_FB                   38
102 
103 /*
104  * Policy to control charger state machine.
105  */
106 struct wm8350_charger_policy {
107 
108         /* charger state machine policy  - set in machine driver */
109         int eoc_mA;             /* end of charge current (mA)  */
110         int charge_mV;          /* charge voltage */
111         int fast_limit_mA;      /* fast charge current limit */
112         int fast_limit_USB_mA;  /* USB fast charge current limit */
113         int charge_timeout;     /* charge timeout (mins) */
114         int trickle_start_mV;   /* trickle charge starts at mV */
115         int trickle_charge_mA;  /* trickle charge current */
116         int trickle_charge_USB_mA;      /* USB trickle charge current */
117 };
118 
119 struct wm8350_power {
120         struct platform_device *pdev;
121         struct power_supply *battery;
122         struct power_supply *usb;
123         struct power_supply *ac;
124         struct wm8350_charger_policy *policy;
125 
126         int rev_g_coeff;
127 };
128 
129 #endif
130 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php