Lines Matching defs:max8997

3 // max8997.c - mfd core driver for the Maxim 8966 and 8997
20 #include <linux/mfd/max8997.h>
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 },
48 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
51 mutex_lock(&max8997->iolock);
53 mutex_unlock(&max8997->iolock);
65 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
68 mutex_lock(&max8997->iolock);
70 mutex_unlock(&max8997->iolock);
80 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
83 mutex_lock(&max8997->iolock);
85 mutex_unlock(&max8997->iolock);
92 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
95 mutex_lock(&max8997->iolock);
97 mutex_unlock(&max8997->iolock);
107 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
110 mutex_lock(&max8997->iolock);
117 mutex_unlock(&max8997->iolock);
123 * Only the common platform data elements for max8997 are parsed here from the
124 * device tree. Other sub-modules of max8997 such as pmic, rtc and others have
127 * The max8997 platform data structure is instantiated here and the drivers for
157 struct max8997_dev *max8997;
161 max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev),
163 if (max8997 == NULL)
166 i2c_set_clientdata(i2c, max8997);
167 max8997->dev = &i2c->dev;
168 max8997->i2c = i2c;
169 max8997->type = max8997_i2c_get_driver_data(i2c, id);
170 max8997->irq = i2c->irq;
172 if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) {
173 pdata = max8997_i2c_parse_dt_pdata(max8997->dev);
181 max8997->pdata = pdata;
182 max8997->ono = pdata->ono;
184 mutex_init(&max8997->iolock);
186 max8997->rtc = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_RTC);
187 if (IS_ERR(max8997->rtc)) {
188 dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n");
189 return PTR_ERR(max8997->rtc);
191 i2c_set_clientdata(max8997->rtc, max8997);
193 max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC);
194 if (IS_ERR(max8997->haptic)) {
195 dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n");
196 ret = PTR_ERR(max8997->haptic);
199 i2c_set_clientdata(max8997->haptic, max8997);
201 max8997->muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC);
202 if (IS_ERR(max8997->muic)) {
203 dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n");
204 ret = PTR_ERR(max8997->muic);
207 i2c_set_clientdata(max8997->muic, max8997);
209 pm_runtime_set_active(max8997->dev);
211 max8997_irq_init(max8997);
213 ret = mfd_add_devices(max8997->dev, -1, max8997_devs,
217 dev_err(max8997->dev, "failed to add MFD devices %d\n", ret);
227 device_init_wakeup(max8997->dev, true);
232 mfd_remove_devices(max8997->dev);
233 i2c_unregister_device(max8997->muic);
235 i2c_unregister_device(max8997->haptic);
237 i2c_unregister_device(max8997->rtc);
242 { "max8997", TYPE_MAX8997 },
403 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
408 &max8997->reg_dump[i]);
412 &max8997->reg_dump[i + MAX8997_REG_PMIC_END]);
416 &max8997->reg_dump[i + MAX8997_REG_PMIC_END +
425 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
430 max8997->reg_dump[i]);
434 max8997->reg_dump[i + MAX8997_REG_PMIC_END]);
438 max8997->reg_dump[i + MAX8997_REG_PMIC_END +
447 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
449 disable_irq(max8997->irq);
451 irq_set_irq_wake(max8997->irq, 1);
458 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
461 irq_set_irq_wake(max8997->irq, 0);
462 enable_irq(max8997->irq);
463 return max8997_irq_resume(max8997);
475 .name = "max8997",