Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2012 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | * Authors: |
| 24 | * Ben Widawsky <ben@bwidawsk.net> |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | #include <linux/device.h> |
| 29 | #include <linux/module.h> |
| 30 | #include <linux/stat.h> |
| 31 | #include <linux/sysfs.h> |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 32 | #include "intel_drv.h" |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 33 | #include "i915_drv.h" |
| 34 | |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 35 | #define dev_to_drm_minor(d) dev_get_drvdata((d)) |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 36 | |
Hunt Xu | 5ab3633 | 2012-07-01 03:45:07 +0000 | [diff] [blame] | 37 | #ifdef CONFIG_PM |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 38 | static u32 calc_residency(struct drm_device *dev, const u32 reg) |
| 39 | { |
| 40 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 41 | u64 raw_time; /* 32b value may overflow during fixed point math */ |
Jesse Barnes | e454a05 | 2013-09-26 17:55:58 -0700 | [diff] [blame] | 42 | u64 units = 128ULL, div = 100000ULL, bias = 100ULL; |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 43 | |
| 44 | if (!intel_enable_rc6(dev)) |
| 45 | return 0; |
| 46 | |
Jesse Barnes | e454a05 | 2013-09-26 17:55:58 -0700 | [diff] [blame] | 47 | /* On VLV, residency time is in CZ units rather than 1.28us */ |
| 48 | if (IS_VALLEYVIEW(dev)) { |
| 49 | u32 clkctl2; |
| 50 | |
| 51 | clkctl2 = I915_READ(VLV_CLK_CTL2) >> |
| 52 | CLK_CTL2_CZCOUNT_30NS_SHIFT; |
| 53 | if (!clkctl2) { |
| 54 | WARN(!clkctl2, "bogus CZ count value"); |
| 55 | return 0; |
| 56 | } |
| 57 | units = DIV_ROUND_UP_ULL(30ULL * bias, (u64)clkctl2); |
| 58 | if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH) |
| 59 | units <<= 8; |
| 60 | |
| 61 | div = 1000000ULL * bias; |
| 62 | } |
| 63 | |
| 64 | raw_time = I915_READ(reg) * units; |
| 65 | return DIV_ROUND_UP_ULL(raw_time, div); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | static ssize_t |
Ben Widawsky | dbdfd8e | 2012-09-07 19:43:38 -0700 | [diff] [blame] | 69 | show_rc6_mask(struct device *kdev, struct device_attribute *attr, char *buf) |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 70 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 71 | struct drm_minor *dminor = dev_to_drm_minor(kdev); |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 72 | return snprintf(buf, PAGE_SIZE, "%x\n", intel_enable_rc6(dminor->dev)); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | static ssize_t |
Ben Widawsky | dbdfd8e | 2012-09-07 19:43:38 -0700 | [diff] [blame] | 76 | show_rc6_ms(struct device *kdev, struct device_attribute *attr, char *buf) |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 77 | { |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 78 | struct drm_minor *dminor = dev_get_drvdata(kdev); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 79 | u32 rc6_residency = calc_residency(dminor->dev, GEN6_GT_GFX_RC6); |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 80 | return snprintf(buf, PAGE_SIZE, "%u\n", rc6_residency); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | static ssize_t |
Ben Widawsky | dbdfd8e | 2012-09-07 19:43:38 -0700 | [diff] [blame] | 84 | show_rc6p_ms(struct device *kdev, struct device_attribute *attr, char *buf) |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 85 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 86 | struct drm_minor *dminor = dev_to_drm_minor(kdev); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 87 | u32 rc6p_residency = calc_residency(dminor->dev, GEN6_GT_GFX_RC6p); |
Jesse Barnes | 5ffd494 | 2013-09-11 13:43:20 -0700 | [diff] [blame] | 88 | if (IS_VALLEYVIEW(dminor->dev)) |
| 89 | rc6p_residency = 0; |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 90 | return snprintf(buf, PAGE_SIZE, "%u\n", rc6p_residency); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | static ssize_t |
Ben Widawsky | dbdfd8e | 2012-09-07 19:43:38 -0700 | [diff] [blame] | 94 | show_rc6pp_ms(struct device *kdev, struct device_attribute *attr, char *buf) |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 95 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 96 | struct drm_minor *dminor = dev_to_drm_minor(kdev); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 97 | u32 rc6pp_residency = calc_residency(dminor->dev, GEN6_GT_GFX_RC6pp); |
Jesse Barnes | 5ffd494 | 2013-09-11 13:43:20 -0700 | [diff] [blame] | 98 | if (IS_VALLEYVIEW(dminor->dev)) |
| 99 | rc6pp_residency = 0; |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 100 | return snprintf(buf, PAGE_SIZE, "%u\n", rc6pp_residency); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | static DEVICE_ATTR(rc6_enable, S_IRUGO, show_rc6_mask, NULL); |
| 104 | static DEVICE_ATTR(rc6_residency_ms, S_IRUGO, show_rc6_ms, NULL); |
| 105 | static DEVICE_ATTR(rc6p_residency_ms, S_IRUGO, show_rc6p_ms, NULL); |
| 106 | static DEVICE_ATTR(rc6pp_residency_ms, S_IRUGO, show_rc6pp_ms, NULL); |
| 107 | |
| 108 | static struct attribute *rc6_attrs[] = { |
| 109 | &dev_attr_rc6_enable.attr, |
| 110 | &dev_attr_rc6_residency_ms.attr, |
| 111 | &dev_attr_rc6p_residency_ms.attr, |
| 112 | &dev_attr_rc6pp_residency_ms.attr, |
| 113 | NULL |
| 114 | }; |
| 115 | |
| 116 | static struct attribute_group rc6_attr_group = { |
| 117 | .name = power_group_name, |
| 118 | .attrs = rc6_attrs |
| 119 | }; |
Ben Widawsky | 8c3f929 | 2012-09-02 00:24:40 -0700 | [diff] [blame] | 120 | #endif |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 121 | |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 122 | static int l3_access_valid(struct drm_device *dev, loff_t offset) |
| 123 | { |
Ben Widawsky | 040d2ba | 2013-09-19 11:01:40 -0700 | [diff] [blame] | 124 | if (!HAS_L3_DPF(dev)) |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 125 | return -EPERM; |
| 126 | |
| 127 | if (offset % 4 != 0) |
| 128 | return -EINVAL; |
| 129 | |
| 130 | if (offset >= GEN7_L3LOG_SIZE) |
| 131 | return -ENXIO; |
| 132 | |
| 133 | return 0; |
| 134 | } |
| 135 | |
| 136 | static ssize_t |
| 137 | i915_l3_read(struct file *filp, struct kobject *kobj, |
| 138 | struct bin_attribute *attr, char *buf, |
| 139 | loff_t offset, size_t count) |
| 140 | { |
| 141 | struct device *dev = container_of(kobj, struct device, kobj); |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 142 | struct drm_minor *dminor = dev_to_drm_minor(dev); |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 143 | struct drm_device *drm_dev = dminor->dev; |
| 144 | struct drm_i915_private *dev_priv = drm_dev->dev_private; |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 145 | int slice = (int)(uintptr_t)attr->private; |
Ben Widawsky | 3ccfd19 | 2013-09-18 19:03:18 -0700 | [diff] [blame] | 146 | int ret; |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 147 | |
Ben Widawsky | 1c3dcd1 | 2013-09-12 22:28:28 -0700 | [diff] [blame] | 148 | count = round_down(count, 4); |
| 149 | |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 150 | ret = l3_access_valid(drm_dev, offset); |
| 151 | if (ret) |
| 152 | return ret; |
| 153 | |
Dan Carpenter | e5ad402 | 2013-09-20 14:20:18 +0300 | [diff] [blame] | 154 | count = min_t(size_t, GEN7_L3LOG_SIZE - offset, count); |
Ben Widawsky | 33618ea | 2013-09-12 22:28:29 -0700 | [diff] [blame] | 155 | |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 156 | ret = i915_mutex_lock_interruptible(drm_dev); |
| 157 | if (ret) |
| 158 | return ret; |
| 159 | |
Ben Widawsky | 3ccfd19 | 2013-09-18 19:03:18 -0700 | [diff] [blame] | 160 | if (dev_priv->l3_parity.remap_info[slice]) |
| 161 | memcpy(buf, |
| 162 | dev_priv->l3_parity.remap_info[slice] + (offset/4), |
| 163 | count); |
| 164 | else |
| 165 | memset(buf, 0, count); |
Ben Widawsky | 1c966dd | 2013-09-17 21:12:42 -0700 | [diff] [blame] | 166 | |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 167 | mutex_unlock(&drm_dev->struct_mutex); |
| 168 | |
Ben Widawsky | 1c966dd | 2013-09-17 21:12:42 -0700 | [diff] [blame] | 169 | return count; |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | static ssize_t |
| 173 | i915_l3_write(struct file *filp, struct kobject *kobj, |
| 174 | struct bin_attribute *attr, char *buf, |
| 175 | loff_t offset, size_t count) |
| 176 | { |
| 177 | struct device *dev = container_of(kobj, struct device, kobj); |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 178 | struct drm_minor *dminor = dev_to_drm_minor(dev); |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 179 | struct drm_device *drm_dev = dminor->dev; |
| 180 | struct drm_i915_private *dev_priv = drm_dev->dev_private; |
Ben Widawsky | 3ccfd19 | 2013-09-18 19:03:18 -0700 | [diff] [blame] | 181 | struct i915_hw_context *ctx; |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 182 | u32 *temp = NULL; /* Just here to make handling failures easy */ |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 183 | int slice = (int)(uintptr_t)attr->private; |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 184 | int ret; |
| 185 | |
| 186 | ret = l3_access_valid(drm_dev, offset); |
| 187 | if (ret) |
| 188 | return ret; |
| 189 | |
Ben Widawsky | 3ccfd19 | 2013-09-18 19:03:18 -0700 | [diff] [blame] | 190 | if (dev_priv->hw_contexts_disabled) |
| 191 | return -ENXIO; |
| 192 | |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 193 | ret = i915_mutex_lock_interruptible(drm_dev); |
| 194 | if (ret) |
| 195 | return ret; |
| 196 | |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 197 | if (!dev_priv->l3_parity.remap_info[slice]) { |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 198 | temp = kzalloc(GEN7_L3LOG_SIZE, GFP_KERNEL); |
| 199 | if (!temp) { |
| 200 | mutex_unlock(&drm_dev->struct_mutex); |
| 201 | return -ENOMEM; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | ret = i915_gpu_idle(drm_dev); |
| 206 | if (ret) { |
| 207 | kfree(temp); |
| 208 | mutex_unlock(&drm_dev->struct_mutex); |
| 209 | return ret; |
| 210 | } |
| 211 | |
| 212 | /* TODO: Ideally we really want a GPU reset here to make sure errors |
| 213 | * aren't propagated. Since I cannot find a stable way to reset the GPU |
| 214 | * at this point it is left as a TODO. |
| 215 | */ |
| 216 | if (temp) |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 217 | dev_priv->l3_parity.remap_info[slice] = temp; |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 218 | |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 219 | memcpy(dev_priv->l3_parity.remap_info[slice] + (offset/4), buf, count); |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 220 | |
Ben Widawsky | 3ccfd19 | 2013-09-18 19:03:18 -0700 | [diff] [blame] | 221 | /* NB: We defer the remapping until we switch to the context */ |
| 222 | list_for_each_entry(ctx, &dev_priv->context_list, link) |
| 223 | ctx->remap_slice |= (1<<slice); |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 224 | |
| 225 | mutex_unlock(&drm_dev->struct_mutex); |
| 226 | |
| 227 | return count; |
| 228 | } |
| 229 | |
| 230 | static struct bin_attribute dpf_attrs = { |
| 231 | .attr = {.name = "l3_parity", .mode = (S_IRUSR | S_IWUSR)}, |
| 232 | .size = GEN7_L3LOG_SIZE, |
| 233 | .read = i915_l3_read, |
| 234 | .write = i915_l3_write, |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 235 | .mmap = NULL, |
| 236 | .private = (void *)0 |
| 237 | }; |
| 238 | |
| 239 | static struct bin_attribute dpf_attrs_1 = { |
| 240 | .attr = {.name = "l3_parity_slice_1", .mode = (S_IRUSR | S_IWUSR)}, |
| 241 | .size = GEN7_L3LOG_SIZE, |
| 242 | .read = i915_l3_read, |
| 243 | .write = i915_l3_write, |
| 244 | .mmap = NULL, |
| 245 | .private = (void *)1 |
Ben Widawsky | 84bc758 | 2012-05-25 16:56:25 -0700 | [diff] [blame] | 246 | }; |
| 247 | |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 248 | static ssize_t gt_cur_freq_mhz_show(struct device *kdev, |
| 249 | struct device_attribute *attr, char *buf) |
| 250 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 251 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 252 | struct drm_device *dev = minor->dev; |
| 253 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 254 | int ret; |
| 255 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 256 | mutex_lock(&dev_priv->rps.hw_lock); |
Jesse Barnes | 177006a | 2013-05-02 10:48:07 -0700 | [diff] [blame] | 257 | if (IS_VALLEYVIEW(dev_priv->dev)) { |
| 258 | u32 freq; |
Jani Nikula | 6493625 | 2013-05-22 15:36:20 +0300 | [diff] [blame] | 259 | freq = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS); |
Jesse Barnes | 177006a | 2013-05-02 10:48:07 -0700 | [diff] [blame] | 260 | ret = vlv_gpu_freq(dev_priv->mem_freq, (freq >> 8) & 0xff); |
| 261 | } else { |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 262 | ret = dev_priv->rps.cur_delay * GT_FREQUENCY_MULTIPLIER; |
Jesse Barnes | 177006a | 2013-05-02 10:48:07 -0700 | [diff] [blame] | 263 | } |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 264 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 265 | |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 266 | return snprintf(buf, PAGE_SIZE, "%d\n", ret); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 269 | static ssize_t vlv_rpe_freq_mhz_show(struct device *kdev, |
| 270 | struct device_attribute *attr, char *buf) |
| 271 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 272 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 273 | struct drm_device *dev = minor->dev; |
| 274 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 275 | |
| 276 | return snprintf(buf, PAGE_SIZE, "%d\n", |
| 277 | vlv_gpu_freq(dev_priv->mem_freq, |
| 278 | dev_priv->rps.rpe_delay)); |
| 279 | } |
| 280 | |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 281 | static ssize_t gt_max_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf) |
| 282 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 283 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 284 | struct drm_device *dev = minor->dev; |
| 285 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 286 | int ret; |
| 287 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 288 | mutex_lock(&dev_priv->rps.hw_lock); |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 289 | if (IS_VALLEYVIEW(dev_priv->dev)) |
| 290 | ret = vlv_gpu_freq(dev_priv->mem_freq, dev_priv->rps.max_delay); |
| 291 | else |
| 292 | ret = dev_priv->rps.max_delay * GT_FREQUENCY_MULTIPLIER; |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 293 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 294 | |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 295 | return snprintf(buf, PAGE_SIZE, "%d\n", ret); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 296 | } |
| 297 | |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 298 | static ssize_t gt_max_freq_mhz_store(struct device *kdev, |
| 299 | struct device_attribute *attr, |
| 300 | const char *buf, size_t count) |
| 301 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 302 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 303 | struct drm_device *dev = minor->dev; |
| 304 | struct drm_i915_private *dev_priv = dev->dev_private; |
Ben Widawsky | 31c7738 | 2013-04-05 14:29:22 -0700 | [diff] [blame] | 305 | u32 val, rp_state_cap, hw_max, hw_min, non_oc_max; |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 306 | ssize_t ret; |
| 307 | |
| 308 | ret = kstrtou32(buf, 0, &val); |
| 309 | if (ret) |
| 310 | return ret; |
| 311 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 312 | mutex_lock(&dev_priv->rps.hw_lock); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 313 | |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 314 | if (IS_VALLEYVIEW(dev_priv->dev)) { |
| 315 | val = vlv_freq_opcode(dev_priv->mem_freq, val); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 316 | |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 317 | hw_max = valleyview_rps_max_freq(dev_priv); |
| 318 | hw_min = valleyview_rps_min_freq(dev_priv); |
| 319 | non_oc_max = hw_max; |
| 320 | } else { |
| 321 | val /= GT_FREQUENCY_MULTIPLIER; |
| 322 | |
| 323 | rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
| 324 | hw_max = dev_priv->rps.hw_max; |
| 325 | non_oc_max = (rp_state_cap & 0xff); |
| 326 | hw_min = ((rp_state_cap & 0xff0000) >> 16); |
| 327 | } |
| 328 | |
| 329 | if (val < hw_min || val > hw_max || |
| 330 | val < dev_priv->rps.min_delay) { |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 331 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 332 | return -EINVAL; |
| 333 | } |
| 334 | |
Ben Widawsky | 31c7738 | 2013-04-05 14:29:22 -0700 | [diff] [blame] | 335 | if (val > non_oc_max) |
| 336 | DRM_DEBUG("User requested overclocking to %d\n", |
| 337 | val * GT_FREQUENCY_MULTIPLIER); |
| 338 | |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 339 | if (dev_priv->rps.cur_delay > val) { |
| 340 | if (IS_VALLEYVIEW(dev_priv->dev)) |
| 341 | valleyview_set_rps(dev_priv->dev, val); |
| 342 | else |
| 343 | gen6_set_rps(dev_priv->dev, val); |
| 344 | } |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 345 | |
| 346 | dev_priv->rps.max_delay = val; |
| 347 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 348 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 349 | |
| 350 | return count; |
| 351 | } |
| 352 | |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 353 | static ssize_t gt_min_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf) |
| 354 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 355 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 356 | struct drm_device *dev = minor->dev; |
| 357 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 358 | int ret; |
| 359 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 360 | mutex_lock(&dev_priv->rps.hw_lock); |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 361 | if (IS_VALLEYVIEW(dev_priv->dev)) |
| 362 | ret = vlv_gpu_freq(dev_priv->mem_freq, dev_priv->rps.min_delay); |
| 363 | else |
| 364 | ret = dev_priv->rps.min_delay * GT_FREQUENCY_MULTIPLIER; |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 365 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 366 | |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 367 | return snprintf(buf, PAGE_SIZE, "%d\n", ret); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 368 | } |
| 369 | |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 370 | static ssize_t gt_min_freq_mhz_store(struct device *kdev, |
| 371 | struct device_attribute *attr, |
| 372 | const char *buf, size_t count) |
| 373 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 374 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 375 | struct drm_device *dev = minor->dev; |
| 376 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 377 | u32 val, rp_state_cap, hw_max, hw_min; |
| 378 | ssize_t ret; |
| 379 | |
| 380 | ret = kstrtou32(buf, 0, &val); |
| 381 | if (ret) |
| 382 | return ret; |
| 383 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 384 | mutex_lock(&dev_priv->rps.hw_lock); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 385 | |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 386 | if (IS_VALLEYVIEW(dev)) { |
| 387 | val = vlv_freq_opcode(dev_priv->mem_freq, val); |
| 388 | |
| 389 | hw_max = valleyview_rps_max_freq(dev_priv); |
| 390 | hw_min = valleyview_rps_min_freq(dev_priv); |
| 391 | } else { |
| 392 | val /= GT_FREQUENCY_MULTIPLIER; |
| 393 | |
| 394 | rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
| 395 | hw_max = dev_priv->rps.hw_max; |
| 396 | hw_min = ((rp_state_cap & 0xff0000) >> 16); |
| 397 | } |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 398 | |
| 399 | if (val < hw_min || val > hw_max || val > dev_priv->rps.max_delay) { |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 400 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 401 | return -EINVAL; |
| 402 | } |
| 403 | |
Jesse Barnes | 0a073b8 | 2013-04-17 15:54:58 -0700 | [diff] [blame] | 404 | if (dev_priv->rps.cur_delay < val) { |
| 405 | if (IS_VALLEYVIEW(dev)) |
| 406 | valleyview_set_rps(dev, val); |
| 407 | else |
| 408 | gen6_set_rps(dev_priv->dev, val); |
| 409 | } |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 410 | |
| 411 | dev_priv->rps.min_delay = val; |
| 412 | |
Jesse Barnes | 4fc688c | 2012-11-02 11:14:01 -0700 | [diff] [blame] | 413 | mutex_unlock(&dev_priv->rps.hw_lock); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 414 | |
| 415 | return count; |
| 416 | |
| 417 | } |
| 418 | |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 419 | static DEVICE_ATTR(gt_cur_freq_mhz, S_IRUGO, gt_cur_freq_mhz_show, NULL); |
Ben Widawsky | 46ddf19 | 2012-09-12 18:12:07 -0700 | [diff] [blame] | 420 | static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, gt_max_freq_mhz_store); |
| 421 | static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, gt_min_freq_mhz_store); |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 422 | |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 423 | static DEVICE_ATTR(vlv_rpe_freq_mhz, S_IRUGO, vlv_rpe_freq_mhz_show, NULL); |
Ben Widawsky | ac6ae34 | 2012-09-07 19:43:44 -0700 | [diff] [blame] | 424 | |
| 425 | static ssize_t gt_rp_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf); |
| 426 | static DEVICE_ATTR(gt_RP0_freq_mhz, S_IRUGO, gt_rp_mhz_show, NULL); |
| 427 | static DEVICE_ATTR(gt_RP1_freq_mhz, S_IRUGO, gt_rp_mhz_show, NULL); |
| 428 | static DEVICE_ATTR(gt_RPn_freq_mhz, S_IRUGO, gt_rp_mhz_show, NULL); |
| 429 | |
| 430 | /* For now we have a static number of RP states */ |
| 431 | static ssize_t gt_rp_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf) |
| 432 | { |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 433 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Ben Widawsky | ac6ae34 | 2012-09-07 19:43:44 -0700 | [diff] [blame] | 434 | struct drm_device *dev = minor->dev; |
| 435 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 436 | u32 val, rp_state_cap; |
| 437 | ssize_t ret; |
| 438 | |
| 439 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 440 | if (ret) |
| 441 | return ret; |
| 442 | rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
| 443 | mutex_unlock(&dev->struct_mutex); |
| 444 | |
| 445 | if (attr == &dev_attr_gt_RP0_freq_mhz) { |
| 446 | val = ((rp_state_cap & 0x0000ff) >> 0) * GT_FREQUENCY_MULTIPLIER; |
| 447 | } else if (attr == &dev_attr_gt_RP1_freq_mhz) { |
| 448 | val = ((rp_state_cap & 0x00ff00) >> 8) * GT_FREQUENCY_MULTIPLIER; |
| 449 | } else if (attr == &dev_attr_gt_RPn_freq_mhz) { |
| 450 | val = ((rp_state_cap & 0xff0000) >> 16) * GT_FREQUENCY_MULTIPLIER; |
| 451 | } else { |
| 452 | BUG(); |
| 453 | } |
Jani Nikula | 3e2a155 | 2013-02-14 10:42:11 +0200 | [diff] [blame] | 454 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
Ben Widawsky | ac6ae34 | 2012-09-07 19:43:44 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 457 | static const struct attribute *gen6_attrs[] = { |
| 458 | &dev_attr_gt_cur_freq_mhz.attr, |
| 459 | &dev_attr_gt_max_freq_mhz.attr, |
| 460 | &dev_attr_gt_min_freq_mhz.attr, |
Ben Widawsky | ac6ae34 | 2012-09-07 19:43:44 -0700 | [diff] [blame] | 461 | &dev_attr_gt_RP0_freq_mhz.attr, |
| 462 | &dev_attr_gt_RP1_freq_mhz.attr, |
| 463 | &dev_attr_gt_RPn_freq_mhz.attr, |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 464 | NULL, |
| 465 | }; |
| 466 | |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 467 | static const struct attribute *vlv_attrs[] = { |
| 468 | &dev_attr_gt_cur_freq_mhz.attr, |
| 469 | &dev_attr_gt_max_freq_mhz.attr, |
| 470 | &dev_attr_gt_min_freq_mhz.attr, |
| 471 | &dev_attr_vlv_rpe_freq_mhz.attr, |
| 472 | NULL, |
| 473 | }; |
| 474 | |
Mika Kuoppala | ef86ddc | 2013-06-06 17:38:54 +0300 | [diff] [blame] | 475 | static ssize_t error_state_read(struct file *filp, struct kobject *kobj, |
| 476 | struct bin_attribute *attr, char *buf, |
| 477 | loff_t off, size_t count) |
| 478 | { |
| 479 | |
| 480 | struct device *kdev = container_of(kobj, struct device, kobj); |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 481 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Mika Kuoppala | ef86ddc | 2013-06-06 17:38:54 +0300 | [diff] [blame] | 482 | struct drm_device *dev = minor->dev; |
| 483 | struct i915_error_state_file_priv error_priv; |
| 484 | struct drm_i915_error_state_buf error_str; |
| 485 | ssize_t ret_count = 0; |
| 486 | int ret; |
| 487 | |
| 488 | memset(&error_priv, 0, sizeof(error_priv)); |
| 489 | |
| 490 | ret = i915_error_state_buf_init(&error_str, count, off); |
| 491 | if (ret) |
| 492 | return ret; |
| 493 | |
| 494 | error_priv.dev = dev; |
| 495 | i915_error_state_get(dev, &error_priv); |
| 496 | |
| 497 | ret = i915_error_state_to_str(&error_str, &error_priv); |
| 498 | if (ret) |
| 499 | goto out; |
| 500 | |
| 501 | ret_count = count < error_str.bytes ? count : error_str.bytes; |
| 502 | |
| 503 | memcpy(buf, error_str.buf, ret_count); |
| 504 | out: |
| 505 | i915_error_state_put(&error_priv); |
| 506 | i915_error_state_buf_release(&error_str); |
| 507 | |
| 508 | return ret ?: ret_count; |
| 509 | } |
| 510 | |
| 511 | static ssize_t error_state_write(struct file *file, struct kobject *kobj, |
| 512 | struct bin_attribute *attr, char *buf, |
| 513 | loff_t off, size_t count) |
| 514 | { |
| 515 | struct device *kdev = container_of(kobj, struct device, kobj); |
Dave Airlie | 14c8d110 | 2013-10-11 14:45:30 +1000 | [diff] [blame] | 516 | struct drm_minor *minor = dev_to_drm_minor(kdev); |
Mika Kuoppala | ef86ddc | 2013-06-06 17:38:54 +0300 | [diff] [blame] | 517 | struct drm_device *dev = minor->dev; |
| 518 | int ret; |
| 519 | |
| 520 | DRM_DEBUG_DRIVER("Resetting error state\n"); |
| 521 | |
| 522 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 523 | if (ret) |
| 524 | return ret; |
| 525 | |
| 526 | i915_destroy_error_state(dev); |
| 527 | mutex_unlock(&dev->struct_mutex); |
| 528 | |
| 529 | return count; |
| 530 | } |
| 531 | |
| 532 | static struct bin_attribute error_state_attr = { |
| 533 | .attr.name = "error", |
| 534 | .attr.mode = S_IRUSR | S_IWUSR, |
| 535 | .size = 0, |
| 536 | .read = error_state_read, |
| 537 | .write = error_state_write, |
| 538 | }; |
| 539 | |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 540 | void i915_setup_sysfs(struct drm_device *dev) |
| 541 | { |
| 542 | int ret; |
| 543 | |
Ben Widawsky | 8c3f929 | 2012-09-02 00:24:40 -0700 | [diff] [blame] | 544 | #ifdef CONFIG_PM |
Daniel Vetter | 112abd2 | 2012-05-31 14:57:43 +0200 | [diff] [blame] | 545 | if (INTEL_INFO(dev)->gen >= 6) { |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 546 | ret = sysfs_merge_group(&dev->primary->kdev->kobj, |
Daniel Vetter | 112abd2 | 2012-05-31 14:57:43 +0200 | [diff] [blame] | 547 | &rc6_attr_group); |
| 548 | if (ret) |
| 549 | DRM_ERROR("RC6 residency sysfs setup failed\n"); |
| 550 | } |
Ben Widawsky | 8c3f929 | 2012-09-02 00:24:40 -0700 | [diff] [blame] | 551 | #endif |
Ben Widawsky | 040d2ba | 2013-09-19 11:01:40 -0700 | [diff] [blame] | 552 | if (HAS_L3_DPF(dev)) { |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 553 | ret = device_create_bin_file(dev->primary->kdev, &dpf_attrs); |
Daniel Vetter | 112abd2 | 2012-05-31 14:57:43 +0200 | [diff] [blame] | 554 | if (ret) |
| 555 | DRM_ERROR("l3 parity sysfs setup failed\n"); |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 556 | |
| 557 | if (NUM_L3_SLICES(dev) > 1) { |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 558 | ret = device_create_bin_file(dev->primary->kdev, |
Ben Widawsky | 35a85ac | 2013-09-19 11:13:41 -0700 | [diff] [blame] | 559 | &dpf_attrs_1); |
| 560 | if (ret) |
| 561 | DRM_ERROR("l3 parity slice 1 setup failed\n"); |
| 562 | } |
Daniel Vetter | 112abd2 | 2012-05-31 14:57:43 +0200 | [diff] [blame] | 563 | } |
Ben Widawsky | df6eedc | 2012-09-07 19:43:40 -0700 | [diff] [blame] | 564 | |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 565 | ret = 0; |
| 566 | if (IS_VALLEYVIEW(dev)) |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 567 | ret = sysfs_create_files(&dev->primary->kdev->kobj, vlv_attrs); |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 568 | else if (INTEL_INFO(dev)->gen >= 6) |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 569 | ret = sysfs_create_files(&dev->primary->kdev->kobj, gen6_attrs); |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 570 | if (ret) |
| 571 | DRM_ERROR("RPS sysfs setup failed\n"); |
Mika Kuoppala | ef86ddc | 2013-06-06 17:38:54 +0300 | [diff] [blame] | 572 | |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 573 | ret = sysfs_create_bin_file(&dev->primary->kdev->kobj, |
Mika Kuoppala | ef86ddc | 2013-06-06 17:38:54 +0300 | [diff] [blame] | 574 | &error_state_attr); |
| 575 | if (ret) |
| 576 | DRM_ERROR("error_state sysfs setup failed\n"); |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | void i915_teardown_sysfs(struct drm_device *dev) |
| 580 | { |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 581 | sysfs_remove_bin_file(&dev->primary->kdev->kobj, &error_state_attr); |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 582 | if (IS_VALLEYVIEW(dev)) |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 583 | sysfs_remove_files(&dev->primary->kdev->kobj, vlv_attrs); |
Chris Wilson | 97e4eed | 2013-08-26 16:18:54 +0100 | [diff] [blame] | 584 | else |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 585 | sysfs_remove_files(&dev->primary->kdev->kobj, gen6_attrs); |
| 586 | device_remove_bin_file(dev->primary->kdev, &dpf_attrs_1); |
| 587 | device_remove_bin_file(dev->primary->kdev, &dpf_attrs); |
Ben Widawsky | 853c70e | 2012-09-19 10:50:19 -0700 | [diff] [blame] | 588 | #ifdef CONFIG_PM |
Dave Airlie | 5bdebb1 | 2013-10-11 14:07:25 +1000 | [diff] [blame^] | 589 | sysfs_unmerge_group(&dev->primary->kdev->kobj, &rc6_attr_group); |
Ben Widawsky | 853c70e | 2012-09-19 10:50:19 -0700 | [diff] [blame] | 590 | #endif |
Ben Widawsky | 0136db5 | 2012-04-10 21:17:01 -0700 | [diff] [blame] | 591 | } |