Commit b8a6d6777b83b5aaaf7cbe7f6cdc2a32270490d0
Committed by
Stefano Babic
1 parent
9a84116b31
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
pmic: Add support for setting transmission length in uclass private data
The struct uc_pmic_priv's trans_len field stores the number of types to be transmitted per PMIC transfer. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 19 additions and 0 deletions Side-by-side Diff
drivers/power/pmic/pmic-uclass.c
... | ... | @@ -165,8 +165,18 @@ |
165 | 165 | return pmic_reg_write(dev, reg, byte); |
166 | 166 | } |
167 | 167 | |
168 | +static int pmic_pre_probe(struct udevice *dev) | |
169 | +{ | |
170 | + struct uc_pmic_priv *pmic_priv = dev_get_uclass_priv(dev); | |
171 | + | |
172 | + pmic_priv->trans_len = 1; | |
173 | + return 0; | |
174 | +} | |
175 | + | |
168 | 176 | UCLASS_DRIVER(pmic) = { |
169 | 177 | .id = UCLASS_PMIC, |
170 | 178 | .name = "pmic", |
179 | + .pre_probe = pmic_pre_probe, | |
180 | + .per_device_auto_alloc_size = sizeof(struct uc_pmic_priv), | |
171 | 181 | }; |
include/power/pmic.h
... | ... | @@ -297,6 +297,15 @@ |
297 | 297 | */ |
298 | 298 | int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set); |
299 | 299 | |
300 | +/* | |
301 | + * This structure holds the private data for PMIC uclass | |
302 | + * For now we store information about the number of bytes | |
303 | + * being sent at once to the device. | |
304 | + */ | |
305 | +struct uc_pmic_priv { | |
306 | + uint trans_len; | |
307 | +}; | |
308 | + | |
300 | 309 | #endif /* CONFIG_DM_PMIC */ |
301 | 310 | |
302 | 311 | #ifdef CONFIG_POWER |