Lines Matching refs:rsmu

25 static int rsmu_read_device(struct rsmu_ddata *rsmu, u8 reg, u8 *buf, u16 bytes)  in rsmu_read_device()  argument
27 struct spi_device *client = to_spi_device(rsmu->dev); in rsmu_read_device()
66 static int rsmu_write_device(struct rsmu_ddata *rsmu, u8 reg, u8 *buf, u16 bytes) in rsmu_write_device() argument
68 struct spi_device *client = to_spi_device(rsmu->dev); in rsmu_write_device()
94 static int rsmu_write_page_register(struct rsmu_ddata *rsmu, u32 reg) in rsmu_write_page_register() argument
102 switch (rsmu->type) { in rsmu_write_page_register()
126 dev_err(rsmu->dev, "Unsupported RSMU device type: %d\n", rsmu->type); in rsmu_write_page_register()
131 if (rsmu->page == page) in rsmu_write_page_register()
134 err = rsmu_write_device(rsmu, page_reg, buf, bytes); in rsmu_write_page_register()
136 dev_err(rsmu->dev, "Failed to set page offset 0x%x\n", page); in rsmu_write_page_register()
139 rsmu->page = page; in rsmu_write_page_register()
146 struct rsmu_ddata *rsmu = spi_get_drvdata((struct spi_device *)context); in rsmu_reg_read() local
150 err = rsmu_write_page_register(rsmu, reg); in rsmu_reg_read()
154 err = rsmu_read_device(rsmu, addr, (u8 *)val, 1); in rsmu_reg_read()
156 dev_err(rsmu->dev, "Failed to read offset address 0x%x\n", addr); in rsmu_reg_read()
163 struct rsmu_ddata *rsmu = spi_get_drvdata((struct spi_device *)context); in rsmu_reg_write() local
168 err = rsmu_write_page_register(rsmu, reg); in rsmu_reg_write()
172 err = rsmu_write_device(rsmu, addr, &data, 1); in rsmu_reg_write()
174 dev_err(rsmu->dev, in rsmu_reg_write()
202 struct rsmu_ddata *rsmu; in rsmu_spi_probe() local
205 rsmu = devm_kzalloc(&client->dev, sizeof(*rsmu), GFP_KERNEL); in rsmu_spi_probe()
206 if (!rsmu) in rsmu_spi_probe()
209 spi_set_drvdata(client, rsmu); in rsmu_spi_probe()
211 rsmu->dev = &client->dev; in rsmu_spi_probe()
212 rsmu->type = (enum rsmu_type)id->driver_data; in rsmu_spi_probe()
215 switch (rsmu->type) { in rsmu_spi_probe()
223 dev_err(rsmu->dev, "Unsupported RSMU device type: %d\n", rsmu->type); in rsmu_spi_probe()
227 rsmu->regmap = devm_regmap_init(&client->dev, NULL, client, cfg); in rsmu_spi_probe()
228 if (IS_ERR(rsmu->regmap)) { in rsmu_spi_probe()
229 ret = PTR_ERR(rsmu->regmap); in rsmu_spi_probe()
230 dev_err(rsmu->dev, "Failed to allocate register map: %d\n", ret); in rsmu_spi_probe()
234 return rsmu_core_init(rsmu); in rsmu_spi_probe()
239 struct rsmu_ddata *rsmu = spi_get_drvdata(client); in rsmu_spi_remove() local
241 rsmu_core_exit(rsmu); in rsmu_spi_remove()