Lines Matching +full:haptic +full:- +full:driver

1 // SPDX-License-Identifier: GPL-2.0+
3 // max8997.c - mfd core driver for the Maxim 8966 and 8997
8 // This driver is based on max8998.c
21 #include <linux/mfd/max8997-private.h>
30 { .name = "max8997-pmic", },
31 { .name = "max8997-rtc", },
32 { .name = "max8997-battery", },
33 { .name = "max8997-haptic", },
34 { .name = "max8997-muic", },
35 { .name = "max8997-led", .id = 1 },
36 { .name = "max8997-led", .id = 2 },
41 { .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 },
51 mutex_lock(&max8997->iolock); in max8997_read_reg()
53 mutex_unlock(&max8997->iolock); in max8997_read_reg()
68 mutex_lock(&max8997->iolock); in max8997_bulk_read()
70 mutex_unlock(&max8997->iolock); in max8997_bulk_read()
83 mutex_lock(&max8997->iolock); in max8997_write_reg()
85 mutex_unlock(&max8997->iolock); in max8997_write_reg()
95 mutex_lock(&max8997->iolock); in max8997_bulk_write()
97 mutex_unlock(&max8997->iolock); in max8997_bulk_write()
110 mutex_lock(&max8997->iolock); in max8997_update_reg()
117 mutex_unlock(&max8997->iolock); in max8997_update_reg()
124 * device tree. Other sub-modules of max8997 such as pmic, rtc and others have
128 * the sub-modules need not instantiate another instance while parsing their
138 return ERR_PTR(-ENOMEM); in max8997_i2c_parse_dt_pdata()
140 pd->ono = irq_of_parse_and_map(dev->of_node, 1); in max8997_i2c_parse_dt_pdata()
148 struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev); in max8997_i2c_probe()
151 max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev), in max8997_i2c_probe()
154 return -ENOMEM; in max8997_i2c_probe()
157 max8997->dev = &i2c->dev; in max8997_i2c_probe()
158 max8997->i2c = i2c; in max8997_i2c_probe()
159 max8997->type = (uintptr_t)i2c_get_match_data(i2c); in max8997_i2c_probe()
160 max8997->irq = i2c->irq; in max8997_i2c_probe()
162 if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) { in max8997_i2c_probe()
163 pdata = max8997_i2c_parse_dt_pdata(max8997->dev); in max8997_i2c_probe()
171 max8997->pdata = pdata; in max8997_i2c_probe()
172 max8997->ono = pdata->ono; in max8997_i2c_probe()
174 mutex_init(&max8997->iolock); in max8997_i2c_probe()
176 max8997->rtc = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_RTC); in max8997_i2c_probe()
177 if (IS_ERR(max8997->rtc)) { in max8997_i2c_probe()
178 dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n"); in max8997_i2c_probe()
179 return PTR_ERR(max8997->rtc); in max8997_i2c_probe()
181 i2c_set_clientdata(max8997->rtc, max8997); in max8997_i2c_probe()
183 max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC); in max8997_i2c_probe()
184 if (IS_ERR(max8997->haptic)) { in max8997_i2c_probe()
185 dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n"); in max8997_i2c_probe()
186 ret = PTR_ERR(max8997->haptic); in max8997_i2c_probe()
189 i2c_set_clientdata(max8997->haptic, max8997); in max8997_i2c_probe()
191 max8997->muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC); in max8997_i2c_probe()
192 if (IS_ERR(max8997->muic)) { in max8997_i2c_probe()
193 dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n"); in max8997_i2c_probe()
194 ret = PTR_ERR(max8997->muic); in max8997_i2c_probe()
197 i2c_set_clientdata(max8997->muic, max8997); in max8997_i2c_probe()
199 pm_runtime_set_active(max8997->dev); in max8997_i2c_probe()
203 ret = mfd_add_devices(max8997->dev, -1, max8997_devs, in max8997_i2c_probe()
207 dev_err(max8997->dev, "failed to add MFD devices %d\n", ret); in max8997_i2c_probe()
217 device_init_wakeup(max8997->dev, true); in max8997_i2c_probe()
222 mfd_remove_devices(max8997->dev); in max8997_i2c_probe()
223 i2c_unregister_device(max8997->muic); in max8997_i2c_probe()
225 i2c_unregister_device(max8997->haptic); in max8997_i2c_probe()
227 i2c_unregister_device(max8997->rtc); in max8997_i2c_probe()
398 &max8997->reg_dump[i]); in max8997_freeze()
402 &max8997->reg_dump[i + MAX8997_REG_PMIC_END]); in max8997_freeze()
406 &max8997->reg_dump[i + MAX8997_REG_PMIC_END + in max8997_freeze()
420 max8997->reg_dump[i]); in max8997_restore()
424 max8997->reg_dump[i + MAX8997_REG_PMIC_END]); in max8997_restore()
428 max8997->reg_dump[i + MAX8997_REG_PMIC_END + in max8997_restore()
439 disable_irq(max8997->irq); in max8997_suspend()
441 irq_set_irq_wake(max8997->irq, 1); in max8997_suspend()
451 irq_set_irq_wake(max8997->irq, 0); in max8997_resume()
452 enable_irq(max8997->irq); in max8997_resume()
464 .driver = {