Lines Matching refs:rsmu
57 static int rsmu_read_device(struct rsmu_ddata *rsmu, u8 reg, u8 *buf, u16 bytes) in rsmu_read_device() argument
59 struct i2c_client *client = to_i2c_client(rsmu->dev); in rsmu_read_device()
76 dev_err(rsmu->dev, "i2c_transfer failed at addr: %04x!", reg); in rsmu_read_device()
79 dev_err(rsmu->dev, in rsmu_read_device()
87 static int rsmu_write_device(struct rsmu_ddata *rsmu, u8 reg, u8 *buf, u16 bytes) in rsmu_write_device() argument
89 struct i2c_client *client = to_i2c_client(rsmu->dev); in rsmu_write_device()
110 static int rsmu_write_page_register(struct rsmu_ddata *rsmu, u32 reg) in rsmu_write_page_register() argument
121 if (rsmu->page == page) in rsmu_write_page_register()
129 err = rsmu_write_device(rsmu, RSMU_CM_PAGE_ADDR, buf, sizeof(buf)); in rsmu_write_page_register()
131 dev_err(rsmu->dev, "Failed to set page offset 0x%x\n", page); in rsmu_write_page_register()
134 rsmu->page = page; in rsmu_write_page_register()
141 struct rsmu_ddata *rsmu = i2c_get_clientdata((struct i2c_client *)context); in rsmu_reg_read() local
145 err = rsmu_write_page_register(rsmu, reg); in rsmu_reg_read()
149 err = rsmu_read_device(rsmu, addr, (u8 *)val, 1); in rsmu_reg_read()
151 dev_err(rsmu->dev, "Failed to read offset address 0x%x\n", addr); in rsmu_reg_read()
158 struct rsmu_ddata *rsmu = i2c_get_clientdata((struct i2c_client *)context); in rsmu_reg_write() local
163 err = rsmu_write_page_register(rsmu, reg); in rsmu_reg_write()
167 err = rsmu_write_device(rsmu, addr, &data, 1); in rsmu_reg_write()
169 dev_err(rsmu->dev, in rsmu_reg_write()
208 struct rsmu_ddata *rsmu; in rsmu_i2c_probe() local
211 rsmu = devm_kzalloc(&client->dev, sizeof(*rsmu), GFP_KERNEL); in rsmu_i2c_probe()
212 if (!rsmu) in rsmu_i2c_probe()
215 i2c_set_clientdata(client, rsmu); in rsmu_i2c_probe()
217 rsmu->dev = &client->dev; in rsmu_i2c_probe()
218 rsmu->type = (enum rsmu_type)id->driver_data; in rsmu_i2c_probe()
220 switch (rsmu->type) { in rsmu_i2c_probe()
231 dev_err(rsmu->dev, "Unsupported RSMU device type: %d\n", rsmu->type); in rsmu_i2c_probe()
235 if (rsmu->type == RSMU_CM) in rsmu_i2c_probe()
236 rsmu->regmap = devm_regmap_init(&client->dev, NULL, client, cfg); in rsmu_i2c_probe()
238 rsmu->regmap = devm_regmap_init_i2c(client, cfg); in rsmu_i2c_probe()
239 if (IS_ERR(rsmu->regmap)) { in rsmu_i2c_probe()
240 ret = PTR_ERR(rsmu->regmap); in rsmu_i2c_probe()
241 dev_err(rsmu->dev, "Failed to allocate register map: %d\n", ret); in rsmu_i2c_probe()
245 return rsmu_core_init(rsmu); in rsmu_i2c_probe()
250 struct rsmu_ddata *rsmu = i2c_get_clientdata(client); in rsmu_i2c_remove() local
252 rsmu_core_exit(rsmu); in rsmu_i2c_remove()