.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Intel SOC Punit device state debug driver |
---|
3 | 4 | * Punit controls power management for North Complex devices (Graphics |
---|
4 | 5 | * blocks, Image Signal Processing, video processing, display, DSP etc.) |
---|
5 | 6 | * |
---|
6 | 7 | * Copyright (c) 2015, Intel Corporation. |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify it |
---|
9 | | - * under the terms and conditions of the GNU General Public License, |
---|
10 | | - * version 2, as published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
13 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
14 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
15 | | - * more details. |
---|
16 | | - * |
---|
17 | 8 | */ |
---|
18 | 9 | |
---|
19 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
113 | 104 | |
---|
114 | 105 | static struct dentry *punit_dbg_file; |
---|
115 | 106 | |
---|
116 | | -static int punit_dbgfs_register(struct punit_device *punit_device) |
---|
| 107 | +static void punit_dbgfs_register(struct punit_device *punit_device) |
---|
117 | 108 | { |
---|
118 | | - static struct dentry *dev_state; |
---|
119 | | - |
---|
120 | 109 | punit_dbg_file = debugfs_create_dir("punit_atom", NULL); |
---|
121 | | - if (!punit_dbg_file) |
---|
122 | | - return -ENXIO; |
---|
123 | 110 | |
---|
124 | | - dev_state = debugfs_create_file("dev_power_state", 0444, |
---|
125 | | - punit_dbg_file, punit_device, |
---|
126 | | - &punit_dev_state_fops); |
---|
127 | | - if (!dev_state) { |
---|
128 | | - pr_err("punit_dev_state register failed\n"); |
---|
129 | | - debugfs_remove(punit_dbg_file); |
---|
130 | | - return -ENXIO; |
---|
131 | | - } |
---|
132 | | - |
---|
133 | | - return 0; |
---|
| 111 | + debugfs_create_file("dev_power_state", 0444, punit_dbg_file, |
---|
| 112 | + punit_device, &punit_dev_state_fops); |
---|
134 | 113 | } |
---|
135 | 114 | |
---|
136 | 115 | static void punit_dbgfs_unregister(void) |
---|
.. | .. |
---|
138 | 117 | debugfs_remove_recursive(punit_dbg_file); |
---|
139 | 118 | } |
---|
140 | 119 | |
---|
141 | | -#define ICPU(model, drv_data) \ |
---|
142 | | - { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT,\ |
---|
143 | | - (kernel_ulong_t)&drv_data } |
---|
| 120 | +#define X86_MATCH(model, data) \ |
---|
| 121 | + X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, INTEL_FAM6_##model, \ |
---|
| 122 | + X86_FEATURE_MWAIT, data) |
---|
144 | 123 | |
---|
145 | 124 | static const struct x86_cpu_id intel_punit_cpu_ids[] = { |
---|
146 | | - ICPU(INTEL_FAM6_ATOM_SILVERMONT, punit_device_byt), |
---|
147 | | - ICPU(INTEL_FAM6_ATOM_SILVERMONT_MID, punit_device_tng), |
---|
148 | | - ICPU(INTEL_FAM6_ATOM_AIRMONT, punit_device_cht), |
---|
| 125 | + X86_MATCH(ATOM_SILVERMONT, &punit_device_byt), |
---|
| 126 | + X86_MATCH(ATOM_SILVERMONT_MID, &punit_device_tng), |
---|
| 127 | + X86_MATCH(ATOM_AIRMONT, &punit_device_cht), |
---|
149 | 128 | {} |
---|
150 | 129 | }; |
---|
151 | | - |
---|
152 | 130 | MODULE_DEVICE_TABLE(x86cpu, intel_punit_cpu_ids); |
---|
153 | 131 | |
---|
154 | 132 | static int __init punit_atom_debug_init(void) |
---|
155 | 133 | { |
---|
156 | 134 | const struct x86_cpu_id *id; |
---|
157 | | - int ret; |
---|
158 | 135 | |
---|
159 | 136 | id = x86_match_cpu(intel_punit_cpu_ids); |
---|
160 | 137 | if (!id) |
---|
161 | 138 | return -ENODEV; |
---|
162 | 139 | |
---|
163 | | - ret = punit_dbgfs_register((struct punit_device *)id->driver_data); |
---|
164 | | - if (ret < 0) |
---|
165 | | - return ret; |
---|
| 140 | + punit_dbgfs_register((struct punit_device *)id->driver_data); |
---|
166 | 141 | |
---|
167 | 142 | return 0; |
---|
168 | 143 | } |
---|