| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Power button driver for Intel MID platforms. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Hong Liu <hong.liu@intel.com> |
|---|
| 7 | 8 | * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | | -#include <linux/init.h> |
|---|
| 20 | 11 | #include <linux/input.h> |
|---|
| 21 | 12 | #include <linux/interrupt.h> |
|---|
| 22 | 13 | #include <linux/mfd/intel_msic.h> |
|---|
| .. | .. |
|---|
| 55 | 46 | unsigned short mirqlvl1_addr; |
|---|
| 56 | 47 | unsigned short pbstat_addr; |
|---|
| 57 | 48 | u8 pbstat_mask; |
|---|
| 49 | + struct intel_scu_ipc_dev *scu; |
|---|
| 58 | 50 | int (*setup)(struct mid_pb_ddata *ddata); |
|---|
| 59 | 51 | }; |
|---|
| 60 | 52 | |
|---|
| .. | .. |
|---|
| 64 | 56 | int ret; |
|---|
| 65 | 57 | u8 pbstat; |
|---|
| 66 | 58 | |
|---|
| 67 | | - ret = intel_scu_ipc_ioread8(ddata->pbstat_addr, &pbstat); |
|---|
| 59 | + ret = intel_scu_ipc_dev_ioread8(ddata->scu, ddata->pbstat_addr, |
|---|
| 60 | + &pbstat); |
|---|
| 68 | 61 | if (ret) |
|---|
| 69 | 62 | return ret; |
|---|
| 70 | 63 | |
|---|
| .. | .. |
|---|
| 76 | 69 | |
|---|
| 77 | 70 | static int mid_irq_ack(struct mid_pb_ddata *ddata) |
|---|
| 78 | 71 | { |
|---|
| 79 | | - return intel_scu_ipc_update_register(ddata->mirqlvl1_addr, 0, MSIC_PWRBTNM); |
|---|
| 72 | + return intel_scu_ipc_dev_update(ddata->scu, ddata->mirqlvl1_addr, 0, |
|---|
| 73 | + MSIC_PWRBTNM); |
|---|
| 80 | 74 | } |
|---|
| 81 | 75 | |
|---|
| 82 | 76 | static int mrfld_setup(struct mid_pb_ddata *ddata) |
|---|
| 83 | 77 | { |
|---|
| 84 | 78 | /* Unmask the PBIRQ and MPBIRQ on Tangier */ |
|---|
| 85 | | - intel_scu_ipc_update_register(BCOVE_PBIRQ, 0, MSIC_PWRBTNM); |
|---|
| 86 | | - intel_scu_ipc_update_register(BCOVE_PBIRQMASK, 0, MSIC_PWRBTNM); |
|---|
| 79 | + intel_scu_ipc_dev_update(ddata->scu, BCOVE_PBIRQ, 0, MSIC_PWRBTNM); |
|---|
| 80 | + intel_scu_ipc_dev_update(ddata->scu, BCOVE_PBIRQMASK, 0, MSIC_PWRBTNM); |
|---|
| 87 | 81 | |
|---|
| 88 | 82 | return 0; |
|---|
| 89 | 83 | } |
|---|
| .. | .. |
|---|
| 121 | 115 | .setup = mrfld_setup, |
|---|
| 122 | 116 | }; |
|---|
| 123 | 117 | |
|---|
| 124 | | -#define ICPU(model, ddata) \ |
|---|
| 125 | | - { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (kernel_ulong_t)&ddata } |
|---|
| 126 | | - |
|---|
| 127 | 118 | static const struct x86_cpu_id mid_pb_cpu_ids[] = { |
|---|
| 128 | | - ICPU(INTEL_FAM6_ATOM_SALTWELL_MID, mfld_ddata), |
|---|
| 129 | | - ICPU(INTEL_FAM6_ATOM_SILVERMONT_MID, mrfld_ddata), |
|---|
| 119 | + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_MID, &mfld_ddata), |
|---|
| 120 | + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, &mrfld_ddata), |
|---|
| 130 | 121 | {} |
|---|
| 131 | 122 | }; |
|---|
| 132 | 123 | |
|---|
| .. | .. |
|---|
| 173 | 164 | return error; |
|---|
| 174 | 165 | } |
|---|
| 175 | 166 | |
|---|
| 167 | + ddata->scu = devm_intel_scu_ipc_dev_get(&pdev->dev); |
|---|
| 168 | + if (!ddata->scu) |
|---|
| 169 | + return -EPROBE_DEFER; |
|---|
| 170 | + |
|---|
| 176 | 171 | error = devm_request_threaded_irq(&pdev->dev, irq, NULL, mid_pb_isr, |
|---|
| 177 | 172 | IRQF_ONESHOT, DRIVER_NAME, ddata); |
|---|
| 178 | 173 | if (error) { |
|---|