Lines Matching refs:max8997

49 	struct max8997_dev *max8997 = i2c_get_clientdata(i2c);  in max8997_read_reg()  local
52 mutex_lock(&max8997->iolock); in max8997_read_reg()
54 mutex_unlock(&max8997->iolock); in max8997_read_reg()
66 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_bulk_read() local
69 mutex_lock(&max8997->iolock); in max8997_bulk_read()
71 mutex_unlock(&max8997->iolock); in max8997_bulk_read()
81 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_write_reg() local
84 mutex_lock(&max8997->iolock); in max8997_write_reg()
86 mutex_unlock(&max8997->iolock); in max8997_write_reg()
93 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_bulk_write() local
96 mutex_lock(&max8997->iolock); in max8997_bulk_write()
98 mutex_unlock(&max8997->iolock); in max8997_bulk_write()
108 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_update_reg() local
111 mutex_lock(&max8997->iolock); in max8997_update_reg()
118 mutex_unlock(&max8997->iolock); in max8997_update_reg()
158 struct max8997_dev *max8997; in max8997_i2c_probe() local
162 max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev), in max8997_i2c_probe()
164 if (max8997 == NULL) in max8997_i2c_probe()
167 i2c_set_clientdata(i2c, max8997); in max8997_i2c_probe()
168 max8997->dev = &i2c->dev; in max8997_i2c_probe()
169 max8997->i2c = i2c; in max8997_i2c_probe()
170 max8997->type = max8997_i2c_get_driver_data(i2c, id); in max8997_i2c_probe()
171 max8997->irq = i2c->irq; in max8997_i2c_probe()
173 if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) { in max8997_i2c_probe()
174 pdata = max8997_i2c_parse_dt_pdata(max8997->dev); in max8997_i2c_probe()
182 max8997->pdata = pdata; in max8997_i2c_probe()
183 max8997->ono = pdata->ono; in max8997_i2c_probe()
185 mutex_init(&max8997->iolock); in max8997_i2c_probe()
187 max8997->rtc = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_RTC); in max8997_i2c_probe()
188 if (IS_ERR(max8997->rtc)) { in max8997_i2c_probe()
189 dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n"); in max8997_i2c_probe()
190 return PTR_ERR(max8997->rtc); in max8997_i2c_probe()
192 i2c_set_clientdata(max8997->rtc, max8997); in max8997_i2c_probe()
194 max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC); in max8997_i2c_probe()
195 if (IS_ERR(max8997->haptic)) { in max8997_i2c_probe()
196 dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n"); in max8997_i2c_probe()
197 ret = PTR_ERR(max8997->haptic); in max8997_i2c_probe()
200 i2c_set_clientdata(max8997->haptic, max8997); in max8997_i2c_probe()
202 max8997->muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC); in max8997_i2c_probe()
203 if (IS_ERR(max8997->muic)) { in max8997_i2c_probe()
204 dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n"); in max8997_i2c_probe()
205 ret = PTR_ERR(max8997->muic); in max8997_i2c_probe()
208 i2c_set_clientdata(max8997->muic, max8997); in max8997_i2c_probe()
210 pm_runtime_set_active(max8997->dev); in max8997_i2c_probe()
212 max8997_irq_init(max8997); in max8997_i2c_probe()
214 ret = mfd_add_devices(max8997->dev, -1, max8997_devs, in max8997_i2c_probe()
218 dev_err(max8997->dev, "failed to add MFD devices %d\n", ret); in max8997_i2c_probe()
228 device_init_wakeup(max8997->dev, true); in max8997_i2c_probe()
233 mfd_remove_devices(max8997->dev); in max8997_i2c_probe()
234 i2c_unregister_device(max8997->muic); in max8997_i2c_probe()
236 i2c_unregister_device(max8997->haptic); in max8997_i2c_probe()
238 i2c_unregister_device(max8997->rtc); in max8997_i2c_probe()
404 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_freeze() local
409 &max8997->reg_dump[i]); in max8997_freeze()
413 &max8997->reg_dump[i + MAX8997_REG_PMIC_END]); in max8997_freeze()
417 &max8997->reg_dump[i + MAX8997_REG_PMIC_END + in max8997_freeze()
426 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_restore() local
431 max8997->reg_dump[i]); in max8997_restore()
435 max8997->reg_dump[i + MAX8997_REG_PMIC_END]); in max8997_restore()
439 max8997->reg_dump[i + MAX8997_REG_PMIC_END + in max8997_restore()
448 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_suspend() local
450 disable_irq(max8997->irq); in max8997_suspend()
452 irq_set_irq_wake(max8997->irq, 1); in max8997_suspend()
459 struct max8997_dev *max8997 = i2c_get_clientdata(i2c); in max8997_resume() local
462 irq_set_irq_wake(max8997->irq, 0); in max8997_resume()
463 enable_irq(max8997->irq); in max8997_resume()
464 return max8997_irq_resume(max8997); in max8997_resume()