| .. | .. |
|---|
| 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 |
|---|
| 23 | 9 | |
|---|
| 24 | 10 | #include <linux/err.h> |
|---|
| 25 | 11 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 199 | 185 | |
|---|
| 200 | 186 | mutex_init(&max8997->iolock); |
|---|
| 201 | 187 | |
|---|
| 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)) { |
|---|
| 204 | 190 | dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n"); |
|---|
| 205 | | - return -ENODEV; |
|---|
| 191 | + return PTR_ERR(max8997->rtc); |
|---|
| 206 | 192 | } |
|---|
| 207 | 193 | i2c_set_clientdata(max8997->rtc, max8997); |
|---|
| 208 | 194 | |
|---|
| 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)) { |
|---|
| 211 | 197 | dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n"); |
|---|
| 212 | | - ret = -ENODEV; |
|---|
| 198 | + ret = PTR_ERR(max8997->haptic); |
|---|
| 213 | 199 | goto err_i2c_haptic; |
|---|
| 214 | 200 | } |
|---|
| 215 | 201 | i2c_set_clientdata(max8997->haptic, max8997); |
|---|
| 216 | 202 | |
|---|
| 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)) { |
|---|
| 219 | 205 | dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n"); |
|---|
| 220 | | - ret = -ENODEV; |
|---|
| 206 | + ret = PTR_ERR(max8997->muic); |
|---|
| 221 | 207 | goto err_i2c_muic; |
|---|
| 222 | 208 | } |
|---|
| 223 | 209 | i2c_set_clientdata(max8997->muic, max8997); |
|---|
| .. | .. |
|---|
| 462 | 448 | struct i2c_client *i2c = to_i2c_client(dev); |
|---|
| 463 | 449 | struct max8997_dev *max8997 = i2c_get_clientdata(i2c); |
|---|
| 464 | 450 | |
|---|
| 451 | + disable_irq(max8997->irq); |
|---|
| 465 | 452 | if (device_may_wakeup(dev)) |
|---|
| 466 | 453 | irq_set_irq_wake(max8997->irq, 1); |
|---|
| 467 | 454 | return 0; |
|---|
| .. | .. |
|---|
| 474 | 461 | |
|---|
| 475 | 462 | if (device_may_wakeup(dev)) |
|---|
| 476 | 463 | irq_set_irq_wake(max8997->irq, 0); |
|---|
| 464 | + enable_irq(max8997->irq); |
|---|
| 477 | 465 | return max8997_irq_resume(max8997); |
|---|
| 478 | 466 | } |
|---|
| 479 | 467 | |
|---|