blob: feeda6ed546ca5898efe38031acb0b9857deaf9e [file] [log] [blame]
Qipeng Zha39d047c2015-09-15 00:39:19 +08001/*
2 * MFD core driver for Intel Broxton Whiskey Cove PMIC
3 *
4 * Copyright (C) 2015 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/module.h>
17#include <linux/acpi.h>
18#include <linux/err.h>
19#include <linux/delay.h>
20#include <linux/interrupt.h>
21#include <linux/kernel.h>
22#include <linux/mfd/core.h>
Andy Shevchenkof1e34ad2017-03-17 17:37:14 +020023#include <linux/mfd/intel_soc_pmic.h>
Andy Shevchenko0c227c52017-03-17 17:37:15 +020024#include <linux/mfd/intel_soc_pmic_bxtwc.h>
Qipeng Zha39d047c2015-09-15 00:39:19 +080025#include <asm/intel_pmc_ipc.h>
26
27/* PMIC device registers */
28#define REG_ADDR_MASK 0xFF00
29#define REG_ADDR_SHIFT 8
30#define REG_OFFSET_MASK 0xFF
31
32/* Interrupt Status Registers */
33#define BXTWC_IRQLVL1 0x4E02
34#define BXTWC_PWRBTNIRQ 0x4E03
35
36#define BXTWC_THRM0IRQ 0x4E04
37#define BXTWC_THRM1IRQ 0x4E05
38#define BXTWC_THRM2IRQ 0x4E06
39#define BXTWC_BCUIRQ 0x4E07
40#define BXTWC_ADCIRQ 0x4E08
41#define BXTWC_CHGR0IRQ 0x4E09
42#define BXTWC_CHGR1IRQ 0x4E0A
43#define BXTWC_GPIOIRQ0 0x4E0B
44#define BXTWC_GPIOIRQ1 0x4E0C
45#define BXTWC_CRITIRQ 0x4E0D
Nilesh Bacchewar957ae502016-11-07 12:11:47 -080046#define BXTWC_TMUIRQ 0x4FB6
Qipeng Zha39d047c2015-09-15 00:39:19 +080047
48/* Interrupt MASK Registers */
49#define BXTWC_MIRQLVL1 0x4E0E
50#define BXTWC_MPWRTNIRQ 0x4E0F
51
Bin Gao9c6235c2016-07-20 17:33:56 -070052#define BXTWC_MIRQLVL1_MCHGR BIT(5)
53
Qipeng Zha39d047c2015-09-15 00:39:19 +080054#define BXTWC_MTHRM0IRQ 0x4E12
55#define BXTWC_MTHRM1IRQ 0x4E13
56#define BXTWC_MTHRM2IRQ 0x4E14
57#define BXTWC_MBCUIRQ 0x4E15
58#define BXTWC_MADCIRQ 0x4E16
59#define BXTWC_MCHGR0IRQ 0x4E17
60#define BXTWC_MCHGR1IRQ 0x4E18
61#define BXTWC_MGPIO0IRQ 0x4E19
62#define BXTWC_MGPIO1IRQ 0x4E1A
63#define BXTWC_MCRITIRQ 0x4E1B
Nilesh Bacchewar957ae502016-11-07 12:11:47 -080064#define BXTWC_MTMUIRQ 0x4FB7
Qipeng Zha39d047c2015-09-15 00:39:19 +080065
66/* Whiskey Cove PMIC share same ACPI ID between different platforms */
67#define BROXTON_PMIC_WC_HRV 4
68
69/* Manage in two IRQ chips since mask registers are not consecutive */
70enum bxtwc_irqs {
71 /* Level 1 */
72 BXTWC_PWRBTN_LVL1_IRQ = 0,
73 BXTWC_TMU_LVL1_IRQ,
74 BXTWC_THRM_LVL1_IRQ,
75 BXTWC_BCU_LVL1_IRQ,
76 BXTWC_ADC_LVL1_IRQ,
77 BXTWC_CHGR_LVL1_IRQ,
78 BXTWC_GPIO_LVL1_IRQ,
79 BXTWC_CRIT_LVL1_IRQ,
80
81 /* Level 2 */
82 BXTWC_PWRBTN_IRQ,
83};
84
85enum bxtwc_irqs_level2 {
86 /* Level 2 */
Kuppuswamy Sathyanarayananc4949632017-06-05 12:08:02 -070087 BXTWC_BCU_IRQ = 0,
Qipeng Zha39d047c2015-09-15 00:39:19 +080088 BXTWC_ADC_IRQ,
Heikki Krogerus960070202016-10-17 10:32:13 +030089 BXTWC_USBC_IRQ,
Qipeng Zha39d047c2015-09-15 00:39:19 +080090 BXTWC_CHGR0_IRQ,
91 BXTWC_CHGR1_IRQ,
Qipeng Zha39d047c2015-09-15 00:39:19 +080092 BXTWC_CRIT_IRQ,
Kuppuswamy Sathyanarayanan4533d852017-06-05 12:08:01 -070093};
94
95enum bxtwc_irqs_tmu {
96 BXTWC_TMU_IRQ = 0,
Qipeng Zha39d047c2015-09-15 00:39:19 +080097};
98
99static const struct regmap_irq bxtwc_regmap_irqs[] = {
100 REGMAP_IRQ_REG(BXTWC_PWRBTN_LVL1_IRQ, 0, BIT(0)),
101 REGMAP_IRQ_REG(BXTWC_TMU_LVL1_IRQ, 0, BIT(1)),
102 REGMAP_IRQ_REG(BXTWC_THRM_LVL1_IRQ, 0, BIT(2)),
103 REGMAP_IRQ_REG(BXTWC_BCU_LVL1_IRQ, 0, BIT(3)),
104 REGMAP_IRQ_REG(BXTWC_ADC_LVL1_IRQ, 0, BIT(4)),
105 REGMAP_IRQ_REG(BXTWC_CHGR_LVL1_IRQ, 0, BIT(5)),
106 REGMAP_IRQ_REG(BXTWC_GPIO_LVL1_IRQ, 0, BIT(6)),
107 REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)),
108 REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03),
109};
110
111static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {
Kuppuswamy Sathyanarayananc4949632017-06-05 12:08:02 -0700112 REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 0, 0x1f),
113 REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 1, 0xff),
114 REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 2, BIT(5)),
115 REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 2, 0x1f),
116 REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 3, 0x1f),
Kuppuswamy Sathyanarayananc4949632017-06-05 12:08:02 -0700117 REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 6, 0x03),
Qipeng Zha39d047c2015-09-15 00:39:19 +0800118};
119
Nilesh Bacchewar957ae502016-11-07 12:11:47 -0800120static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {
121 REGMAP_IRQ_REG(BXTWC_TMU_IRQ, 0, 0x06),
122};
123
Qipeng Zha39d047c2015-09-15 00:39:19 +0800124static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
125 .name = "bxtwc_irq_chip",
126 .status_base = BXTWC_IRQLVL1,
127 .mask_base = BXTWC_MIRQLVL1,
128 .irqs = bxtwc_regmap_irqs,
129 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs),
130 .num_regs = 2,
131};
132
133static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = {
134 .name = "bxtwc_irq_chip_level2",
Kuppuswamy Sathyanarayananc4949632017-06-05 12:08:02 -0700135 .status_base = BXTWC_BCUIRQ,
136 .mask_base = BXTWC_MBCUIRQ,
Qipeng Zha39d047c2015-09-15 00:39:19 +0800137 .irqs = bxtwc_regmap_irqs_level2,
138 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_level2),
139 .num_regs = 10,
140};
141
Nilesh Bacchewar957ae502016-11-07 12:11:47 -0800142static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = {
143 .name = "bxtwc_irq_chip_tmu",
144 .status_base = BXTWC_TMUIRQ,
145 .mask_base = BXTWC_MTMUIRQ,
146 .irqs = bxtwc_regmap_irqs_tmu,
147 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_tmu),
148 .num_regs = 1,
149};
150
Qipeng Zha39d047c2015-09-15 00:39:19 +0800151static struct resource gpio_resources[] = {
Kuppuswamy Sathyanarayanana1d28c592017-06-05 12:08:03 -0700152 DEFINE_RES_IRQ_NAMED(BXTWC_GPIO_LVL1_IRQ, "GPIO"),
Qipeng Zha39d047c2015-09-15 00:39:19 +0800153};
154
155static struct resource adc_resources[] = {
156 DEFINE_RES_IRQ_NAMED(BXTWC_ADC_IRQ, "ADC"),
157};
158
Bin Gao9c6235c2016-07-20 17:33:56 -0700159static struct resource usbc_resources[] = {
Heikki Krogerus960070202016-10-17 10:32:13 +0300160 DEFINE_RES_IRQ(BXTWC_USBC_IRQ),
Bin Gao9c6235c2016-07-20 17:33:56 -0700161};
162
Qipeng Zha39d047c2015-09-15 00:39:19 +0800163static struct resource charger_resources[] = {
164 DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "CHARGER"),
165 DEFINE_RES_IRQ_NAMED(BXTWC_CHGR1_IRQ, "CHARGER1"),
166};
167
168static struct resource thermal_resources[] = {
Kuppuswamy Sathyanarayananc4949632017-06-05 12:08:02 -0700169 DEFINE_RES_IRQ(BXTWC_THRM_LVL1_IRQ),
Qipeng Zha39d047c2015-09-15 00:39:19 +0800170};
171
172static struct resource bcu_resources[] = {
173 DEFINE_RES_IRQ_NAMED(BXTWC_BCU_IRQ, "BCU"),
174};
175
Nilesh Bacchewar957ae502016-11-07 12:11:47 -0800176static struct resource tmu_resources[] = {
177 DEFINE_RES_IRQ_NAMED(BXTWC_TMU_IRQ, "TMU"),
178};
179
Qipeng Zha39d047c2015-09-15 00:39:19 +0800180static struct mfd_cell bxt_wc_dev[] = {
181 {
182 .name = "bxt_wcove_gpadc",
183 .num_resources = ARRAY_SIZE(adc_resources),
184 .resources = adc_resources,
185 },
186 {
187 .name = "bxt_wcove_thermal",
188 .num_resources = ARRAY_SIZE(thermal_resources),
189 .resources = thermal_resources,
190 },
191 {
Bin Gao9c6235c2016-07-20 17:33:56 -0700192 .name = "bxt_wcove_usbc",
193 .num_resources = ARRAY_SIZE(usbc_resources),
194 .resources = usbc_resources,
195 },
196 {
Qipeng Zha39d047c2015-09-15 00:39:19 +0800197 .name = "bxt_wcove_ext_charger",
198 .num_resources = ARRAY_SIZE(charger_resources),
199 .resources = charger_resources,
200 },
201 {
202 .name = "bxt_wcove_bcu",
203 .num_resources = ARRAY_SIZE(bcu_resources),
204 .resources = bcu_resources,
205 },
206 {
Nilesh Bacchewar957ae502016-11-07 12:11:47 -0800207 .name = "bxt_wcove_tmu",
208 .num_resources = ARRAY_SIZE(tmu_resources),
209 .resources = tmu_resources,
210 },
211
212 {
Qipeng Zha39d047c2015-09-15 00:39:19 +0800213 .name = "bxt_wcove_gpio",
214 .num_resources = ARRAY_SIZE(gpio_resources),
215 .resources = gpio_resources,
216 },
217 {
218 .name = "bxt_wcove_region",
219 },
220};
221
222static int regmap_ipc_byte_reg_read(void *context, unsigned int reg,
223 unsigned int *val)
224{
225 int ret;
226 int i2c_addr;
227 u8 ipc_in[2];
228 u8 ipc_out[4];
229 struct intel_soc_pmic *pmic = context;
230
Kuppuswamy Sathyanarayananb4ccc4d2017-03-30 16:35:40 -0700231 if (!pmic)
232 return -EINVAL;
233
Qipeng Zha39d047c2015-09-15 00:39:19 +0800234 if (reg & REG_ADDR_MASK)
235 i2c_addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
Kuppuswamy Sathyanarayananb4ccc4d2017-03-30 16:35:40 -0700236 else
Qipeng Zha39d047c2015-09-15 00:39:19 +0800237 i2c_addr = BXTWC_DEVICE1_ADDR;
Kuppuswamy Sathyanarayananb4ccc4d2017-03-30 16:35:40 -0700238
Qipeng Zha39d047c2015-09-15 00:39:19 +0800239 reg &= REG_OFFSET_MASK;
240
241 ipc_in[0] = reg;
242 ipc_in[1] = i2c_addr;
243 ret = intel_pmc_ipc_command(PMC_IPC_PMIC_ACCESS,
244 PMC_IPC_PMIC_ACCESS_READ,
245 ipc_in, sizeof(ipc_in), (u32 *)ipc_out, 1);
246 if (ret) {
247 dev_err(pmic->dev, "Failed to read from PMIC\n");
248 return ret;
249 }
250 *val = ipc_out[0];
251
252 return 0;
253}
254
255static int regmap_ipc_byte_reg_write(void *context, unsigned int reg,
256 unsigned int val)
257{
258 int ret;
259 int i2c_addr;
260 u8 ipc_in[3];
261 struct intel_soc_pmic *pmic = context;
262
Kuppuswamy Sathyanarayananb4ccc4d2017-03-30 16:35:40 -0700263 if (!pmic)
264 return -EINVAL;
265
Qipeng Zha39d047c2015-09-15 00:39:19 +0800266 if (reg & REG_ADDR_MASK)
267 i2c_addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
Kuppuswamy Sathyanarayananb4ccc4d2017-03-30 16:35:40 -0700268 else
Qipeng Zha39d047c2015-09-15 00:39:19 +0800269 i2c_addr = BXTWC_DEVICE1_ADDR;
Kuppuswamy Sathyanarayananb4ccc4d2017-03-30 16:35:40 -0700270
Qipeng Zha39d047c2015-09-15 00:39:19 +0800271 reg &= REG_OFFSET_MASK;
272
273 ipc_in[0] = reg;
274 ipc_in[1] = i2c_addr;
275 ipc_in[2] = val;
276 ret = intel_pmc_ipc_command(PMC_IPC_PMIC_ACCESS,
277 PMC_IPC_PMIC_ACCESS_WRITE,
278 ipc_in, sizeof(ipc_in), NULL, 0);
279 if (ret) {
280 dev_err(pmic->dev, "Failed to write to PMIC\n");
281 return ret;
282 }
283
284 return 0;
285}
286
287/* sysfs interfaces to r/w PMIC registers, required by initial script */
288static unsigned long bxtwc_reg_addr;
289static ssize_t bxtwc_reg_show(struct device *dev,
290 struct device_attribute *attr, char *buf)
291{
292 return sprintf(buf, "0x%lx\n", bxtwc_reg_addr);
293}
294
295static ssize_t bxtwc_reg_store(struct device *dev,
296 struct device_attribute *attr, const char *buf, size_t count)
297{
298 if (kstrtoul(buf, 0, &bxtwc_reg_addr)) {
299 dev_err(dev, "Invalid register address\n");
300 return -EINVAL;
301 }
302 return (ssize_t)count;
303}
304
305static ssize_t bxtwc_val_show(struct device *dev,
306 struct device_attribute *attr, char *buf)
307{
308 int ret;
309 unsigned int val;
310 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
311
312 ret = regmap_read(pmic->regmap, bxtwc_reg_addr, &val);
313 if (ret < 0) {
314 dev_err(dev, "Failed to read 0x%lx\n", bxtwc_reg_addr);
315 return -EIO;
316 }
317
318 return sprintf(buf, "0x%02x\n", val);
319}
320
321static ssize_t bxtwc_val_store(struct device *dev,
322 struct device_attribute *attr, const char *buf, size_t count)
323{
324 int ret;
325 unsigned int val;
326 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
327
Dan Carpenterf3a654c2015-09-28 12:56:36 +0300328 ret = kstrtouint(buf, 0, &val);
329 if (ret)
330 return ret;
Qipeng Zha39d047c2015-09-15 00:39:19 +0800331
332 ret = regmap_write(pmic->regmap, bxtwc_reg_addr, val);
333 if (ret) {
334 dev_err(dev, "Failed to write value 0x%02x to address 0x%lx",
335 val, bxtwc_reg_addr);
336 return -EIO;
337 }
338 return count;
339}
340
341static DEVICE_ATTR(addr, S_IWUSR | S_IRUSR, bxtwc_reg_show, bxtwc_reg_store);
342static DEVICE_ATTR(val, S_IWUSR | S_IRUSR, bxtwc_val_show, bxtwc_val_store);
343static struct attribute *bxtwc_attrs[] = {
344 &dev_attr_addr.attr,
345 &dev_attr_val.attr,
346 NULL
347};
348
349static const struct attribute_group bxtwc_group = {
350 .attrs = bxtwc_attrs,
351};
352
353static const struct regmap_config bxtwc_regmap_config = {
354 .reg_bits = 16,
355 .val_bits = 8,
356 .reg_write = regmap_ipc_byte_reg_write,
357 .reg_read = regmap_ipc_byte_reg_read,
358};
359
360static int bxtwc_probe(struct platform_device *pdev)
361{
362 int ret;
363 acpi_handle handle;
364 acpi_status status;
365 unsigned long long hrv;
366 struct intel_soc_pmic *pmic;
367
368 handle = ACPI_HANDLE(&pdev->dev);
369 status = acpi_evaluate_integer(handle, "_HRV", NULL, &hrv);
370 if (ACPI_FAILURE(status)) {
371 dev_err(&pdev->dev, "Failed to get PMIC hardware revision\n");
372 return -ENODEV;
373 }
374 if (hrv != BROXTON_PMIC_WC_HRV) {
375 dev_err(&pdev->dev, "Invalid PMIC hardware revision: %llu\n",
376 hrv);
377 return -ENODEV;
378 }
379
380 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
381 if (!pmic)
382 return -ENOMEM;
383
384 ret = platform_get_irq(pdev, 0);
385 if (ret < 0) {
386 dev_err(&pdev->dev, "Invalid IRQ\n");
387 return ret;
388 }
389 pmic->irq = ret;
390
391 dev_set_drvdata(&pdev->dev, pmic);
392 pmic->dev = &pdev->dev;
393
394 pmic->regmap = devm_regmap_init(&pdev->dev, NULL, pmic,
395 &bxtwc_regmap_config);
396 if (IS_ERR(pmic->regmap)) {
397 ret = PTR_ERR(pmic->regmap);
398 dev_err(&pdev->dev, "Failed to initialise regmap: %d\n", ret);
399 return ret;
400 }
401
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700402 ret = devm_regmap_add_irq_chip(&pdev->dev, pmic->regmap, pmic->irq,
403 IRQF_ONESHOT | IRQF_SHARED,
404 0, &bxtwc_regmap_irq_chip,
405 &pmic->irq_chip_data);
Qipeng Zha39d047c2015-09-15 00:39:19 +0800406 if (ret) {
407 dev_err(&pdev->dev, "Failed to add IRQ chip\n");
408 return ret;
409 }
410
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700411 ret = devm_regmap_add_irq_chip(&pdev->dev, pmic->regmap, pmic->irq,
412 IRQF_ONESHOT | IRQF_SHARED,
413 0, &bxtwc_regmap_irq_chip_level2,
414 &pmic->irq_chip_data_level2);
Qipeng Zha39d047c2015-09-15 00:39:19 +0800415 if (ret) {
416 dev_err(&pdev->dev, "Failed to add secondary IRQ chip\n");
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700417 return ret;
Qipeng Zha39d047c2015-09-15 00:39:19 +0800418 }
419
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700420 ret = devm_regmap_add_irq_chip(&pdev->dev, pmic->regmap, pmic->irq,
421 IRQF_ONESHOT | IRQF_SHARED,
422 0, &bxtwc_regmap_irq_chip_tmu,
423 &pmic->irq_chip_data_tmu);
Nilesh Bacchewar957ae502016-11-07 12:11:47 -0800424 if (ret) {
425 dev_err(&pdev->dev, "Failed to add TMU IRQ chip\n");
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700426 return ret;
Nilesh Bacchewar957ae502016-11-07 12:11:47 -0800427 }
428
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700429 ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, bxt_wc_dev,
430 ARRAY_SIZE(bxt_wc_dev), NULL, 0, NULL);
Qipeng Zha39d047c2015-09-15 00:39:19 +0800431 if (ret) {
432 dev_err(&pdev->dev, "Failed to add devices\n");
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700433 return ret;
Qipeng Zha39d047c2015-09-15 00:39:19 +0800434 }
435
436 ret = sysfs_create_group(&pdev->dev.kobj, &bxtwc_group);
437 if (ret) {
438 dev_err(&pdev->dev, "Failed to create sysfs group %d\n", ret);
Kuppuswamy Sathyanarayanan5131f072017-06-05 12:08:04 -0700439 return ret;
Qipeng Zha39d047c2015-09-15 00:39:19 +0800440 }
441
Bin Gao9c6235c2016-07-20 17:33:56 -0700442 /*
443 * There is known hw bug. Upon reset BIT 5 of register
444 * BXTWC_CHGR_LVL1_IRQ is 0 which is the expected value. However,
445 * later it's set to 1(masked) automatically by hardware. So we
446 * have the software workaround here to unmaksed it in order to let
447 * charger interrutp work.
448 */
449 regmap_update_bits(pmic->regmap, BXTWC_MIRQLVL1,
450 BXTWC_MIRQLVL1_MCHGR, 0);
451
Qipeng Zha39d047c2015-09-15 00:39:19 +0800452 return 0;
Qipeng Zha39d047c2015-09-15 00:39:19 +0800453}
454
455static int bxtwc_remove(struct platform_device *pdev)
456{
Qipeng Zha39d047c2015-09-15 00:39:19 +0800457 sysfs_remove_group(&pdev->dev.kobj, &bxtwc_group);
Qipeng Zha39d047c2015-09-15 00:39:19 +0800458
459 return 0;
460}
461
462static void bxtwc_shutdown(struct platform_device *pdev)
463{
464 struct intel_soc_pmic *pmic = dev_get_drvdata(&pdev->dev);
465
466 disable_irq(pmic->irq);
467}
468
469#ifdef CONFIG_PM_SLEEP
470static int bxtwc_suspend(struct device *dev)
471{
472 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
473
474 disable_irq(pmic->irq);
475
476 return 0;
477}
478
479static int bxtwc_resume(struct device *dev)
480{
481 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
482
483 enable_irq(pmic->irq);
484 return 0;
485}
486#endif
487static SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume);
488
489static const struct acpi_device_id bxtwc_acpi_ids[] = {
490 { "INT34D3", },
491 { }
492};
Wei Yongjunf57576e2016-11-01 15:59:50 +0000493MODULE_DEVICE_TABLE(acpi, bxtwc_acpi_ids);
Qipeng Zha39d047c2015-09-15 00:39:19 +0800494
495static struct platform_driver bxtwc_driver = {
496 .probe = bxtwc_probe,
497 .remove = bxtwc_remove,
498 .shutdown = bxtwc_shutdown,
499 .driver = {
500 .name = "BXTWC PMIC",
501 .pm = &bxtwc_pm_ops,
502 .acpi_match_table = ACPI_PTR(bxtwc_acpi_ids),
503 },
504};
505
506module_platform_driver(bxtwc_driver);
507
508MODULE_LICENSE("GPL v2");
509MODULE_AUTHOR("Qipeng Zha<qipeng.zha@intel.com>");