1
2
3
4
5
6
7
8#define LOG_CATEGORY UCLASS_SPMI
9
10#include <common.h>
11#include <dm.h>
12#include <errno.h>
13#include <spmi/spmi.h>
14#include <linux/ctype.h>
15
16int spmi_reg_read(struct udevice *dev, int usid, int pid, int reg)
17{
18 const struct dm_spmi_ops *ops = dev_get_driver_ops(dev);
19
20 if (!ops || !ops->read)
21 return -ENOSYS;
22
23 return ops->read(dev, usid, pid, reg);
24}
25
26int spmi_reg_write(struct udevice *dev, int usid, int pid, int reg,
27 uint8_t value)
28{
29 const struct dm_spmi_ops *ops = dev_get_driver_ops(dev);
30
31 if (!ops || !ops->write)
32 return -ENOSYS;
33
34 return ops->write(dev, usid, pid, reg, value);
35}
36
37UCLASS_DRIVER(spmi) = {
38 .id = UCLASS_SPMI,
39 .name = "spmi",
40 .post_bind = dm_scan_fdt_dev,
41};
42