hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/mfd/max8997.c
....@@ -1,25 +1,11 @@
1
-/*
2
- * max8997.c - mfd core driver for the Maxim 8966 and 8997
3
- *
4
- * Copyright (C) 2011 Samsung Electronics
5
- * MyungJoo Ham <myungjoo.ham@samsung.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
- *
21
- * This driver is based on max8998.c
22
- */
1
+// SPDX-License-Identifier: GPL-2.0+
2
+//
3
+// max8997.c - mfd core driver for the Maxim 8966 and 8997
4
+//
5
+// Copyright (C) 2011 Samsung Electronics
6
+// MyungJoo Ham <myungjoo.ham@samsung.com>
7
+//
8
+// This driver is based on max8998.c
239
2410 #include <linux/err.h>
2511 #include <linux/slab.h>
....@@ -199,25 +185,25 @@
199185
200186 mutex_init(&max8997->iolock);
201187
202
- max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC);
203
- if (!max8997->rtc) {
188
+ max8997->rtc = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_RTC);
189
+ if (IS_ERR(max8997->rtc)) {
204190 dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n");
205
- return -ENODEV;
191
+ return PTR_ERR(max8997->rtc);
206192 }
207193 i2c_set_clientdata(max8997->rtc, max8997);
208194
209
- max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
210
- if (!max8997->haptic) {
195
+ max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC);
196
+ if (IS_ERR(max8997->haptic)) {
211197 dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n");
212
- ret = -ENODEV;
198
+ ret = PTR_ERR(max8997->haptic);
213199 goto err_i2c_haptic;
214200 }
215201 i2c_set_clientdata(max8997->haptic, max8997);
216202
217
- max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
218
- if (!max8997->muic) {
203
+ max8997->muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC);
204
+ if (IS_ERR(max8997->muic)) {
219205 dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n");
220
- ret = -ENODEV;
206
+ ret = PTR_ERR(max8997->muic);
221207 goto err_i2c_muic;
222208 }
223209 i2c_set_clientdata(max8997->muic, max8997);
....@@ -462,6 +448,7 @@
462448 struct i2c_client *i2c = to_i2c_client(dev);
463449 struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
464450
451
+ disable_irq(max8997->irq);
465452 if (device_may_wakeup(dev))
466453 irq_set_irq_wake(max8997->irq, 1);
467454 return 0;
....@@ -474,6 +461,7 @@
474461
475462 if (device_may_wakeup(dev))
476463 irq_set_irq_wake(max8997->irq, 0);
464
+ enable_irq(max8997->irq);
477465 return max8997_irq_resume(max8997);
478466 }
479467