Lines Matching refs: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
147 struct max8997_dev *max8997;
151 max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev),
153 if (max8997 == NULL)
156 i2c_set_clientdata(i2c, max8997);
157 max8997->dev = &i2c->dev;
158 max8997->i2c = i2c;
159 max8997->type = (uintptr_t)i2c_get_match_data(i2c);
160 max8997->irq = i2c->irq;
162 if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) {
163 pdata = max8997_i2c_parse_dt_pdata(max8997->dev);
171 max8997->pdata = pdata;
172 max8997->ono = pdata->ono;
174 mutex_init(&max8997->iolock);
176 max8997->rtc = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_RTC);
177 if (IS_ERR(max8997->rtc)) {
178 dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n");
179 return PTR_ERR(max8997->rtc);
181 i2c_set_clientdata(max8997->rtc, max8997);
183 max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC);
184 if (IS_ERR(max8997->haptic)) {
185 dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n");
186 ret = PTR_ERR(max8997->haptic);
189 i2c_set_clientdata(max8997->haptic, max8997);
191 max8997->muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC);
192 if (IS_ERR(max8997->muic)) {
193 dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n");
194 ret = PTR_ERR(max8997->muic);
197 i2c_set_clientdata(max8997->muic, max8997);
199 pm_runtime_set_active(max8997->dev);
201 max8997_irq_init(max8997);
203 ret = mfd_add_devices(max8997->dev, -1, max8997_devs,
207 dev_err(max8997->dev, "failed to add MFD devices %d\n", ret);
217 device_init_wakeup(max8997->dev, true);
222 mfd_remove_devices(max8997->dev);
223 i2c_unregister_device(max8997->muic);
225 i2c_unregister_device(max8997->haptic);
227 i2c_unregister_device(max8997->rtc);
232 { "max8997", TYPE_MAX8997 },
393 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
398 &max8997->reg_dump[i]);
402 &max8997->reg_dump[i + MAX8997_REG_PMIC_END]);
406 &max8997->reg_dump[i + MAX8997_REG_PMIC_END +
415 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
420 max8997->reg_dump[i]);
424 max8997->reg_dump[i + MAX8997_REG_PMIC_END]);
428 max8997->reg_dump[i + MAX8997_REG_PMIC_END +
437 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
439 disable_irq(max8997->irq);
441 irq_set_irq_wake(max8997->irq, 1);
448 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
451 irq_set_irq_wake(max8997->irq, 0);
452 enable_irq(max8997->irq);
453 return max8997_irq_resume(max8997);
465 .name = "max8997",