Lines Matching refs:da9150
177 void da9150_read_qif(struct da9150 *da9150, u8 addr, int count, u8 *buf) in da9150_read_qif() argument
181 ret = da9150_i2c_read_device(da9150->core_qif, addr, count, buf); in da9150_read_qif()
183 dev_err(da9150->dev, "Failed to read from QIF 0x%x: %d\n", in da9150_read_qif()
188 void da9150_write_qif(struct da9150 *da9150, u8 addr, int count, const u8 *buf) in da9150_write_qif() argument
192 ret = da9150_i2c_write_device(da9150->core_qif, addr, count, buf); in da9150_write_qif()
194 dev_err(da9150->dev, "Failed to write to QIF 0x%x: %d\n", in da9150_write_qif()
199 u8 da9150_reg_read(struct da9150 *da9150, u16 reg) in da9150_reg_read() argument
203 ret = regmap_read(da9150->regmap, reg, &val); in da9150_reg_read()
205 dev_err(da9150->dev, "Failed to read from reg 0x%x: %d\n", in da9150_reg_read()
212 void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val) in da9150_reg_write() argument
216 ret = regmap_write(da9150->regmap, reg, val); in da9150_reg_write()
218 dev_err(da9150->dev, "Failed to write to reg 0x%x: %d\n", in da9150_reg_write()
223 void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val) in da9150_set_bits() argument
227 ret = regmap_update_bits(da9150->regmap, reg, mask, val); in da9150_set_bits()
229 dev_err(da9150->dev, "Failed to set bits in reg 0x%x: %d\n", in da9150_set_bits()
234 void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf) in da9150_bulk_read() argument
238 ret = regmap_bulk_read(da9150->regmap, reg, buf, count); in da9150_bulk_read()
240 dev_err(da9150->dev, "Failed to bulk read from reg 0x%x: %d\n", in da9150_bulk_read()
245 void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8 *buf) in da9150_bulk_write() argument
249 ret = regmap_raw_write(da9150->regmap, reg, buf, count); in da9150_bulk_write()
251 dev_err(da9150->dev, "Failed to bulk write to reg 0x%x %d\n", in da9150_bulk_write()
398 struct da9150 *da9150; in da9150_probe() local
403 da9150 = devm_kzalloc(&client->dev, sizeof(*da9150), GFP_KERNEL); in da9150_probe()
404 if (!da9150) in da9150_probe()
407 da9150->dev = &client->dev; in da9150_probe()
408 da9150->irq = client->irq; in da9150_probe()
409 i2c_set_clientdata(client, da9150); in da9150_probe()
411 da9150->regmap = devm_regmap_init_i2c(client, &da9150_regmap_config); in da9150_probe()
412 if (IS_ERR(da9150->regmap)) { in da9150_probe()
413 ret = PTR_ERR(da9150->regmap); in da9150_probe()
414 dev_err(da9150->dev, "Failed to allocate register map: %d\n", in da9150_probe()
420 qif_addr = da9150_reg_read(da9150, DA9150_CORE2WIRE_CTRL_A); in da9150_probe()
423 da9150->core_qif = i2c_new_dummy_device(client->adapter, qif_addr); in da9150_probe()
424 if (IS_ERR(da9150->core_qif)) { in da9150_probe()
425 dev_err(da9150->dev, "Failed to attach QIF client\n"); in da9150_probe()
426 return PTR_ERR(da9150->core_qif); in da9150_probe()
429 i2c_set_clientdata(da9150->core_qif, da9150); in da9150_probe()
432 da9150->irq_base = pdata->irq_base; in da9150_probe()
438 da9150->irq_base = -1; in da9150_probe()
441 ret = regmap_add_irq_chip(da9150->regmap, da9150->irq, in da9150_probe()
443 da9150->irq_base, &da9150_regmap_irq_chip, in da9150_probe()
444 &da9150->regmap_irq_data); in da9150_probe()
446 dev_err(da9150->dev, "Failed to add regmap irq chip: %d\n", in da9150_probe()
452 da9150->irq_base = regmap_irq_chip_get_base(da9150->regmap_irq_data); in da9150_probe()
454 enable_irq_wake(da9150->irq); in da9150_probe()
456 ret = mfd_add_devices(da9150->dev, -1, da9150_devs, in da9150_probe()
458 da9150->irq_base, NULL); in da9150_probe()
460 dev_err(da9150->dev, "Failed to add child devices: %d\n", ret); in da9150_probe()
467 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); in da9150_probe()
469 i2c_unregister_device(da9150->core_qif); in da9150_probe()
476 struct da9150 *da9150 = i2c_get_clientdata(client); in da9150_remove() local
478 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); in da9150_remove()
479 mfd_remove_devices(da9150->dev); in da9150_remove()
480 i2c_unregister_device(da9150->core_qif); in da9150_remove()
487 struct da9150 *da9150 = i2c_get_clientdata(client); in da9150_shutdown() local
490 da9150_set_bits(da9150, DA9150_CONFIG_D, in da9150_shutdown()
495 da9150_set_bits(da9150, DA9150_CONTROL_C, in da9150_shutdown()