Skip to content

Commit 7b22166

Browse files
committed
lib: adp536x: remove obsolete ad-hoc regulator API
The Zephyr regulator framework offers now a standard interface for regulators, so drop the custom ad-hoc implementation and update documentation. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
1 parent 35c3fac commit 7b22166

File tree

3 files changed

+3
-94
lines changed

3 files changed

+3
-94
lines changed

doc/nrf/libraries/others/adp536x.rst

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ The library accesses the features of the ADP5360 PMIC by conducting Inter-Integr
1616
Generic read, write, and masked write functions are private to the library.
1717
The feature-specific functions are available to the user.
1818

19+
.. note::
20+
Regulator functionality (BUCK/BUCKBOOST) is exposed using the :ref:`Zephyr regulator API <regulator_api>`.
21+
1922
Supported features
2023
==================
2124

include/adp536x.h

-36
Original file line numberDiff line numberDiff line change
@@ -154,32 +154,6 @@ int adp536x_oc_chg_hiccup_set(bool enable);
154154
*/
155155
int adp536x_oc_dis_hiccup_set(bool enable);
156156

157-
/**
158-
* @brief Enable the buck/boost regulator.
159-
*
160-
* @param[in] enable The requested regulator operation state.
161-
*
162-
* @retval 0 If the operation was successful.
163-
* Otherwise, a (negative) error code is returned.
164-
*/
165-
int adp536x_buckbst_enable(bool enable);
166-
167-
/**
168-
* @brief Set the buck regulator to 1.8 V.
169-
*
170-
* @retval 0 If the operation was successful.
171-
* Otherwise, a (negative) error code is returned.
172-
*/
173-
int adp536x_buck_1v8_set(void);
174-
175-
/**
176-
* @brief Set the buck/boost regulator to 3.3 V.
177-
*
178-
* @retval 0 If the operation was successful.
179-
* Otherwise, a (negative) error code is returned.
180-
*/
181-
int adp536x_buckbst_3v3_set(void);
182-
183157
/**
184158
* @brief Reset the device to its default values.
185159
*
@@ -198,16 +172,6 @@ int adp536x_factory_reset(void);
198172
*/
199173
int adp536x_oc_chg_current_set(uint8_t value);
200174

201-
/**
202-
* @brief Set the buck discharge resistor status.
203-
*
204-
* @param[in] enable Boolean value to enable or disable the discharge resistor.
205-
*
206-
* @retval 0 If the operation was successful.
207-
* Otherwise, a (negative) error code is returned.
208-
*/
209-
int adp536x_buck_discharge_set(bool enable);
210-
211175
/**
212176
* @brief Set Fuel Gauge operating mode
213177
*

lib/adp536x/adp536x.c

-58
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#define ADP536X_VBAT_READ_H 0x25
3131
#define ADP536X_VBAT_READ_L 0x26
3232
#define ADP536X_FUEL_GAUGE_MODE 0x27
33-
#define ADP536X_BUCK_CFG 0x29
34-
#define ADP536X_BUCK_OUTPUT 0x2A
35-
#define ADP536X_BUCKBST_CFG 0x2B
36-
#define ADP536X_BUCKBST_OUTPUT 0x2C
3733
#define ADP536X_DEFAULT_SET_REG 0x37
3834

3935
/* Manufacturer and model ID register. */
@@ -119,26 +115,6 @@
119115
#define ADP536X_BAT_OC_CHG_DGT_OC_CHG_MSK GENMASK(4, 3)
120116
#define ADP536X_BAT_OC_CHG_DGT_OC_CHG(x) (((x) & 0x03) << 3)
121117

122-
/* Buck configure register. */
123-
#define ADP536X_BUCK_CFG_DISCHG_BUCK_MSK BIT(1)
124-
#define ADP536X_BUCK_CFG_DISCHG_BUCK(x) (((x) & 0x01) << 1)
125-
126-
/* Buck output voltage setting register. */
127-
#define ADP536X_BUCK_OUTPUT_VOUT_BUCK_MSK GENMASK(5, 0)
128-
#define ADP536X_BUCK_OUTPUT_VOUT_BUCK(x) (((x) & 0x3F) << 0)
129-
#define ADP536X_BUCK_OUTPUT_BUCK_DLY_MSK GENMASK(7, 6)
130-
#define ADP536X_BUCK_OUTPUT_BUCK_DLY(x) (((x) & 0x03) << 6)
131-
132-
/* Buck/boost output voltage setting register. */
133-
#define ADP536X_BUCKBST_OUTPUT_VOUT_BUCKBST_MSK GENMASK(5, 0)
134-
#define ADP536X_BUCKBST_OUTPUT_VOUT_BUCKBST(x) (((x) & 0x3F) << 0)
135-
#define ADP536X_BUCKBST_OUT_BUCK_DLY_MSK GENMASK(7, 6)
136-
#define ADP536X_BUCKBST_OUT_BUCK_DLY(x) (((x) & 0x03) << 6)
137-
138-
/* Buck/boost configure register. */
139-
#define ADP536X_BUCKBST_CFG_EN_BUCKBST_MSK BIT(0)
140-
#define ADP536X_BUCKBST_CFG_EN_BUCKBST(x) (((x) & 0x01) << 0)
141-
142118
/* DEFAULT_SET register. */
143119
#define ADP536X_DEFAULT_SET_MSK GENMASK(7, 0)
144120
#define ADP536X_DEFAULT_SET(x) (((x) & 0xFF) << 0)
@@ -245,40 +221,6 @@ int adp536x_oc_chg_current_set(uint8_t value)
245221
ADP536X_BAT_OC_CHG_OC_CHG(value));
246222
}
247223

248-
int adp536x_buck_1v8_set(void)
249-
{
250-
/* 1.8V equals to 0b11000 = 0x18 according to ADP536X datasheet. */
251-
uint8_t value = 0x18;
252-
253-
return adp536x_reg_write_mask(ADP536X_BUCK_OUTPUT,
254-
ADP536X_BUCK_OUTPUT_VOUT_BUCK_MSK,
255-
ADP536X_BUCK_OUTPUT_VOUT_BUCK(value));
256-
}
257-
258-
int adp536x_buck_discharge_set(bool enable)
259-
{
260-
return adp536x_reg_write_mask(ADP536X_BUCK_CFG,
261-
ADP536X_BUCK_CFG_DISCHG_BUCK_MSK,
262-
ADP536X_BUCK_CFG_DISCHG_BUCK(enable));
263-
}
264-
265-
int adp536x_buckbst_3v3_set(void)
266-
{
267-
/* 3.3V equals to 0b10011 = 0x13, according to ADP536X datasheet. */
268-
uint8_t value = 0x13;
269-
270-
return adp536x_reg_write_mask(ADP536X_BUCKBST_OUTPUT,
271-
ADP536X_BUCKBST_OUTPUT_VOUT_BUCKBST_MSK,
272-
ADP536X_BUCKBST_OUTPUT_VOUT_BUCKBST(value));
273-
}
274-
275-
int adp536x_buckbst_enable(bool enable)
276-
{
277-
return adp536x_reg_write_mask(ADP536X_BUCKBST_CFG,
278-
ADP536X_BUCKBST_CFG_EN_BUCKBST_MSK,
279-
ADP536X_BUCKBST_CFG_EN_BUCKBST(enable));
280-
}
281-
282224
static int adp536x_default_set(void)
283225
{
284226
/* The value 0x7F has to be written to this register to accomplish

0 commit comments

Comments
 (0)