Lines Matching refs:p

20 int check_reg(struct pmic *p, u32 reg)  in check_reg()  argument
22 if (reg >= p->number_of_regs) { in check_reg()
24 reg, p->number_of_regs); in check_reg()
31 int pmic_set_output(struct pmic *p, u32 reg, int out, int on) in pmic_set_output() argument
35 if (pmic_reg_read(p, reg, &val)) in pmic_set_output()
43 if (pmic_reg_write(p, reg, val)) in pmic_set_output()
51 struct pmic *p; in pmic_alloc() local
53 p = calloc(sizeof(*p), 1); in pmic_alloc()
54 if (!p) { in pmic_alloc()
59 list_add_tail(&p->list, &pmic_list); in pmic_alloc()
61 debug("%s: new pmic struct: 0x%p\n", __func__, p); in pmic_alloc()
63 return p; in pmic_alloc()
68 struct pmic *p; in pmic_get() local
70 list_for_each_entry(p, &pmic_list, list) { in pmic_get()
71 if (strcmp(p->name, s) == 0) { in pmic_get()
72 debug("%s: pmic %s -> 0x%p\n", __func__, p->name, p); in pmic_get()
73 return p; in pmic_get()
81 static int pmic_dump(struct pmic *p) in pmic_dump() argument
86 if (!p) { in pmic_dump()
91 printf("PMIC: %s\n", p->name); in pmic_dump()
92 for (i = 0; i < p->number_of_regs; i++) { in pmic_dump()
93 ret = pmic_reg_read(p, i, &val); in pmic_dump()
114 struct pmic *p; in pmic_list_names() local
117 list_for_each_entry(p, &pmic_list, list) { in pmic_list_names()
118 printf("name: %s bus: %s_%d\n", p->name, in pmic_list_names()
119 power_get_interface(p->interface), p->bus); in pmic_list_names()
127 struct pmic *p; in do_pmic() local
145 p = pmic_get(name); in do_pmic()
146 if (!p) in do_pmic()
150 if (pmic_dump(p)) in do_pmic()
160 ret = pmic_reg_read(p, reg, &val); in do_pmic()
176 pmic_reg_write(p, reg, val); in do_pmic()
185 if (!p->pbat) { in do_pmic()
186 printf("%s is not a battery\n", p->name); in do_pmic()
191 p->fg->fg_battery_check(p->pbat->fg, p); in do_pmic()
195 p->name); in do_pmic()
196 if (p->low_power_mode) in do_pmic()
197 p->low_power_mode(); in do_pmic()
198 if (p->pbat->battery_charge) in do_pmic()
199 p->pbat->battery_charge(p); in do_pmic()