Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * gpio-fan.c - Hwmon driver for fans connected to GPIO lines. |
| 3 | * |
| 4 | * Copyright (C) 2010 LaCie |
| 5 | * |
| 6 | * Author: Simon Guinot <[email protected]> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #include <linux/module.h> |
| 24 | #include <linux/init.h> |
| 25 | #include <linux/slab.h> |
| 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/irq.h> |
| 28 | #include <linux/platform_device.h> |
| 29 | #include <linux/err.h> |
| 30 | #include <linux/mutex.h> |
| 31 | #include <linux/hwmon.h> |
| 32 | #include <linux/gpio.h> |
Sachin Kamat | c50588a | 2013-09-27 16:56:00 +0530 | [diff] [blame] | 33 | #include <linux/of.h> |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 34 | #include <linux/of_platform.h> |
| 35 | #include <linux/of_gpio.h> |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 36 | #include <linux/thermal.h> |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 37 | |
Linus Walleij | ef7a612 | 2017-09-26 01:09:05 +0200 | [diff] [blame] | 38 | struct gpio_fan_speed { |
| 39 | int rpm; |
| 40 | int ctrl_val; |
| 41 | }; |
| 42 | |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 43 | struct gpio_fan_data { |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 44 | struct device *dev; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 45 | struct device *hwmon_dev; |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 46 | /* Cooling device if any */ |
| 47 | struct thermal_cooling_device *cdev; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 48 | struct mutex lock; /* lock GPIOs operations. */ |
| 49 | int num_ctrl; |
| 50 | unsigned *ctrl; |
| 51 | int num_speed; |
| 52 | struct gpio_fan_speed *speed; |
| 53 | int speed_index; |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 54 | #ifdef CONFIG_PM_SLEEP |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 55 | int resume_speed; |
| 56 | #endif |
| 57 | bool pwm_enable; |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 58 | unsigned int alarm_gpio; |
| 59 | unsigned int alarm_gpio_active_low; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 60 | struct work_struct alarm_work; |
| 61 | }; |
| 62 | |
| 63 | /* |
| 64 | * Alarm GPIO. |
| 65 | */ |
| 66 | |
| 67 | static void fan_alarm_notify(struct work_struct *ws) |
| 68 | { |
| 69 | struct gpio_fan_data *fan_data = |
| 70 | container_of(ws, struct gpio_fan_data, alarm_work); |
| 71 | |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 72 | sysfs_notify(&fan_data->dev->kobj, NULL, "fan1_alarm"); |
| 73 | kobject_uevent(&fan_data->dev->kobj, KOBJ_CHANGE); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id) |
| 77 | { |
| 78 | struct gpio_fan_data *fan_data = dev_id; |
| 79 | |
| 80 | schedule_work(&fan_data->alarm_work); |
| 81 | |
| 82 | return IRQ_NONE; |
| 83 | } |
| 84 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 85 | static ssize_t fan1_alarm_show(struct device *dev, |
| 86 | struct device_attribute *attr, char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 87 | { |
| 88 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 89 | int value = gpio_get_value_cansleep(fan_data->alarm_gpio); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 90 | |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 91 | if (fan_data->alarm_gpio_active_low) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 92 | value = !value; |
| 93 | |
| 94 | return sprintf(buf, "%d\n", value); |
| 95 | } |
| 96 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 97 | static DEVICE_ATTR_RO(fan1_alarm); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 98 | |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 99 | static int fan_alarm_init(struct gpio_fan_data *fan_data) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 100 | { |
| 101 | int err; |
| 102 | int alarm_irq; |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 103 | struct device *dev = fan_data->dev; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 104 | |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 105 | err = devm_gpio_request(dev, fan_data->alarm_gpio, "GPIO fan alarm"); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 106 | if (err) |
| 107 | return err; |
| 108 | |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 109 | err = gpio_direction_input(fan_data->alarm_gpio); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 110 | if (err) |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 111 | return err; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 112 | |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 113 | /* |
| 114 | * If the alarm GPIO don't support interrupts, just leave |
| 115 | * without initializing the fail notification support. |
| 116 | */ |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 117 | alarm_irq = gpio_to_irq(fan_data->alarm_gpio); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 118 | if (alarm_irq < 0) |
| 119 | return 0; |
| 120 | |
| 121 | INIT_WORK(&fan_data->alarm_work, fan_alarm_notify); |
Thomas Gleixner | dced35a | 2011-03-28 17:49:12 +0200 | [diff] [blame] | 122 | irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH); |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 123 | err = devm_request_irq(dev, alarm_irq, fan_alarm_irq_handler, |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 124 | IRQF_SHARED, "GPIO fan alarm", fan_data); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 125 | return err; |
| 126 | } |
| 127 | |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 128 | /* |
| 129 | * Control GPIOs. |
| 130 | */ |
| 131 | |
| 132 | /* Must be called with fan_data->lock held, except during initialization. */ |
| 133 | static void __set_fan_ctrl(struct gpio_fan_data *fan_data, int ctrl_val) |
| 134 | { |
| 135 | int i; |
| 136 | |
| 137 | for (i = 0; i < fan_data->num_ctrl; i++) |
Nishanth Menon | 52a95c1 | 2014-12-04 10:58:47 -0600 | [diff] [blame] | 138 | gpio_set_value_cansleep(fan_data->ctrl[i], (ctrl_val >> i) & 1); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | static int __get_fan_ctrl(struct gpio_fan_data *fan_data) |
| 142 | { |
| 143 | int i; |
| 144 | int ctrl_val = 0; |
| 145 | |
| 146 | for (i = 0; i < fan_data->num_ctrl; i++) { |
| 147 | int value; |
| 148 | |
Nishanth Menon | 52a95c1 | 2014-12-04 10:58:47 -0600 | [diff] [blame] | 149 | value = gpio_get_value_cansleep(fan_data->ctrl[i]); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 150 | ctrl_val |= (value << i); |
| 151 | } |
| 152 | return ctrl_val; |
| 153 | } |
| 154 | |
| 155 | /* Must be called with fan_data->lock held, except during initialization. */ |
| 156 | static void set_fan_speed(struct gpio_fan_data *fan_data, int speed_index) |
| 157 | { |
| 158 | if (fan_data->speed_index == speed_index) |
| 159 | return; |
| 160 | |
| 161 | __set_fan_ctrl(fan_data, fan_data->speed[speed_index].ctrl_val); |
| 162 | fan_data->speed_index = speed_index; |
| 163 | } |
| 164 | |
| 165 | static int get_fan_speed_index(struct gpio_fan_data *fan_data) |
| 166 | { |
| 167 | int ctrl_val = __get_fan_ctrl(fan_data); |
| 168 | int i; |
| 169 | |
| 170 | for (i = 0; i < fan_data->num_speed; i++) |
| 171 | if (fan_data->speed[i].ctrl_val == ctrl_val) |
| 172 | return i; |
| 173 | |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 174 | dev_warn(fan_data->dev, |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 175 | "missing speed array entry for GPIO value 0x%x\n", ctrl_val); |
| 176 | |
Guenter Roeck | c52ae3d | 2013-09-13 10:42:39 -0700 | [diff] [blame] | 177 | return -ENODEV; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 178 | } |
| 179 | |
Axel Lin | 2565fb0 | 2014-08-02 13:36:38 +0800 | [diff] [blame] | 180 | static int rpm_to_speed_index(struct gpio_fan_data *fan_data, unsigned long rpm) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 181 | { |
| 182 | struct gpio_fan_speed *speed = fan_data->speed; |
| 183 | int i; |
| 184 | |
| 185 | for (i = 0; i < fan_data->num_speed; i++) |
| 186 | if (speed[i].rpm >= rpm) |
| 187 | return i; |
| 188 | |
| 189 | return fan_data->num_speed - 1; |
| 190 | } |
| 191 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 192 | static ssize_t pwm1_show(struct device *dev, struct device_attribute *attr, |
| 193 | char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 194 | { |
| 195 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 196 | u8 pwm = fan_data->speed_index * 255 / (fan_data->num_speed - 1); |
| 197 | |
| 198 | return sprintf(buf, "%d\n", pwm); |
| 199 | } |
| 200 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 201 | static ssize_t pwm1_store(struct device *dev, struct device_attribute *attr, |
| 202 | const char *buf, size_t count) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 203 | { |
| 204 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 205 | unsigned long pwm; |
| 206 | int speed_index; |
| 207 | int ret = count; |
| 208 | |
Frans Meulenbroeks | 179c4fd | 2012-01-04 20:58:52 +0100 | [diff] [blame] | 209 | if (kstrtoul(buf, 10, &pwm) || pwm > 255) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 210 | return -EINVAL; |
| 211 | |
| 212 | mutex_lock(&fan_data->lock); |
| 213 | |
| 214 | if (!fan_data->pwm_enable) { |
| 215 | ret = -EPERM; |
| 216 | goto exit_unlock; |
| 217 | } |
| 218 | |
| 219 | speed_index = DIV_ROUND_UP(pwm * (fan_data->num_speed - 1), 255); |
| 220 | set_fan_speed(fan_data, speed_index); |
| 221 | |
| 222 | exit_unlock: |
| 223 | mutex_unlock(&fan_data->lock); |
| 224 | |
| 225 | return ret; |
| 226 | } |
| 227 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 228 | static ssize_t pwm1_enable_show(struct device *dev, |
| 229 | struct device_attribute *attr, char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 230 | { |
| 231 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 232 | |
| 233 | return sprintf(buf, "%d\n", fan_data->pwm_enable); |
| 234 | } |
| 235 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 236 | static ssize_t pwm1_enable_store(struct device *dev, |
| 237 | struct device_attribute *attr, |
| 238 | const char *buf, size_t count) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 239 | { |
| 240 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 241 | unsigned long val; |
| 242 | |
Frans Meulenbroeks | 179c4fd | 2012-01-04 20:58:52 +0100 | [diff] [blame] | 243 | if (kstrtoul(buf, 10, &val) || val > 1) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 244 | return -EINVAL; |
| 245 | |
| 246 | if (fan_data->pwm_enable == val) |
| 247 | return count; |
| 248 | |
| 249 | mutex_lock(&fan_data->lock); |
| 250 | |
| 251 | fan_data->pwm_enable = val; |
| 252 | |
| 253 | /* Disable manual control mode: set fan at full speed. */ |
| 254 | if (val == 0) |
| 255 | set_fan_speed(fan_data, fan_data->num_speed - 1); |
| 256 | |
| 257 | mutex_unlock(&fan_data->lock); |
| 258 | |
| 259 | return count; |
| 260 | } |
| 261 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 262 | static ssize_t pwm1_mode_show(struct device *dev, |
| 263 | struct device_attribute *attr, char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 264 | { |
| 265 | return sprintf(buf, "0\n"); |
| 266 | } |
| 267 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 268 | static ssize_t fan1_min_show(struct device *dev, |
| 269 | struct device_attribute *attr, char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 270 | { |
| 271 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 272 | |
| 273 | return sprintf(buf, "%d\n", fan_data->speed[0].rpm); |
| 274 | } |
| 275 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 276 | static ssize_t fan1_max_show(struct device *dev, |
| 277 | struct device_attribute *attr, char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 278 | { |
| 279 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 280 | |
| 281 | return sprintf(buf, "%d\n", |
| 282 | fan_data->speed[fan_data->num_speed - 1].rpm); |
| 283 | } |
| 284 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 285 | static ssize_t fan1_input_show(struct device *dev, |
| 286 | struct device_attribute *attr, char *buf) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 287 | { |
| 288 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 289 | |
| 290 | return sprintf(buf, "%d\n", fan_data->speed[fan_data->speed_index].rpm); |
| 291 | } |
| 292 | |
| 293 | static ssize_t set_rpm(struct device *dev, struct device_attribute *attr, |
| 294 | const char *buf, size_t count) |
| 295 | { |
| 296 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
| 297 | unsigned long rpm; |
| 298 | int ret = count; |
| 299 | |
Frans Meulenbroeks | 179c4fd | 2012-01-04 20:58:52 +0100 | [diff] [blame] | 300 | if (kstrtoul(buf, 10, &rpm)) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 301 | return -EINVAL; |
| 302 | |
| 303 | mutex_lock(&fan_data->lock); |
| 304 | |
| 305 | if (!fan_data->pwm_enable) { |
| 306 | ret = -EPERM; |
| 307 | goto exit_unlock; |
| 308 | } |
| 309 | |
| 310 | set_fan_speed(fan_data, rpm_to_speed_index(fan_data, rpm)); |
| 311 | |
| 312 | exit_unlock: |
| 313 | mutex_unlock(&fan_data->lock); |
| 314 | |
| 315 | return ret; |
| 316 | } |
| 317 | |
Julia Lawall | c490c63 | 2016-12-22 13:04:44 +0100 | [diff] [blame] | 318 | static DEVICE_ATTR_RW(pwm1); |
| 319 | static DEVICE_ATTR_RW(pwm1_enable); |
| 320 | static DEVICE_ATTR_RO(pwm1_mode); |
| 321 | static DEVICE_ATTR_RO(fan1_min); |
| 322 | static DEVICE_ATTR_RO(fan1_max); |
| 323 | static DEVICE_ATTR_RO(fan1_input); |
| 324 | static DEVICE_ATTR(fan1_target, S_IRUGO | S_IWUSR, fan1_input_show, set_rpm); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 325 | |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 326 | static umode_t gpio_fan_is_visible(struct kobject *kobj, |
| 327 | struct attribute *attr, int index) |
| 328 | { |
| 329 | struct device *dev = container_of(kobj, struct device, kobj); |
| 330 | struct gpio_fan_data *data = dev_get_drvdata(dev); |
| 331 | |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 332 | if (index == 0 && !data->alarm_gpio) |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 333 | return 0; |
Guenter Roeck | 7258a12 | 2013-07-06 09:46:14 -0700 | [diff] [blame] | 334 | if (index > 0 && !data->ctrl) |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 335 | return 0; |
| 336 | |
| 337 | return attr->mode; |
| 338 | } |
| 339 | |
| 340 | static struct attribute *gpio_fan_attributes[] = { |
Guenter Roeck | 7258a12 | 2013-07-06 09:46:14 -0700 | [diff] [blame] | 341 | &dev_attr_fan1_alarm.attr, /* 0 */ |
| 342 | &dev_attr_pwm1.attr, /* 1 */ |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 343 | &dev_attr_pwm1_enable.attr, |
| 344 | &dev_attr_pwm1_mode.attr, |
| 345 | &dev_attr_fan1_input.attr, |
| 346 | &dev_attr_fan1_target.attr, |
| 347 | &dev_attr_fan1_min.attr, |
| 348 | &dev_attr_fan1_max.attr, |
| 349 | NULL |
| 350 | }; |
| 351 | |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 352 | static const struct attribute_group gpio_fan_group = { |
| 353 | .attrs = gpio_fan_attributes, |
| 354 | .is_visible = gpio_fan_is_visible, |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 355 | }; |
| 356 | |
Guenter Roeck | 7258a12 | 2013-07-06 09:46:14 -0700 | [diff] [blame] | 357 | static const struct attribute_group *gpio_fan_groups[] = { |
| 358 | &gpio_fan_group, |
| 359 | NULL |
| 360 | }; |
| 361 | |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 362 | static int fan_ctrl_init(struct gpio_fan_data *fan_data) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 363 | { |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 364 | struct device *dev = fan_data->dev; |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 365 | int num_ctrl = fan_data->num_ctrl; |
| 366 | unsigned int *ctrl = fan_data->ctrl; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 367 | int i, err; |
| 368 | |
| 369 | for (i = 0; i < num_ctrl; i++) { |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 370 | err = devm_gpio_request(dev, ctrl[i], |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 371 | "GPIO fan control"); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 372 | if (err) |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 373 | return err; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 374 | |
Nishanth Menon | 52a95c1 | 2014-12-04 10:58:47 -0600 | [diff] [blame] | 375 | err = gpio_direction_output(ctrl[i], |
| 376 | gpio_get_value_cansleep(ctrl[i])); |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 377 | if (err) |
| 378 | return err; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 379 | } |
| 380 | |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 381 | fan_data->pwm_enable = true; /* Enable manual fan speed control. */ |
| 382 | fan_data->speed_index = get_fan_speed_index(fan_data); |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 383 | if (fan_data->speed_index < 0) |
Guenter Roeck | c52ae3d | 2013-09-13 10:42:39 -0700 | [diff] [blame] | 384 | return fan_data->speed_index; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 385 | |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 386 | return 0; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 387 | } |
| 388 | |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 389 | static int gpio_fan_get_max_state(struct thermal_cooling_device *cdev, |
| 390 | unsigned long *state) |
| 391 | { |
| 392 | struct gpio_fan_data *fan_data = cdev->devdata; |
| 393 | |
| 394 | if (!fan_data) |
| 395 | return -EINVAL; |
| 396 | |
| 397 | *state = fan_data->num_speed - 1; |
| 398 | return 0; |
| 399 | } |
| 400 | |
| 401 | static int gpio_fan_get_cur_state(struct thermal_cooling_device *cdev, |
| 402 | unsigned long *state) |
| 403 | { |
| 404 | struct gpio_fan_data *fan_data = cdev->devdata; |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 405 | |
| 406 | if (!fan_data) |
| 407 | return -EINVAL; |
| 408 | |
Nishanth Menon | 000e0949 | 2016-02-19 18:09:51 -0600 | [diff] [blame] | 409 | *state = fan_data->speed_index; |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | static int gpio_fan_set_cur_state(struct thermal_cooling_device *cdev, |
| 414 | unsigned long state) |
| 415 | { |
| 416 | struct gpio_fan_data *fan_data = cdev->devdata; |
| 417 | |
| 418 | if (!fan_data) |
| 419 | return -EINVAL; |
| 420 | |
| 421 | set_fan_speed(fan_data, state); |
| 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | static const struct thermal_cooling_device_ops gpio_fan_cool_ops = { |
| 426 | .get_max_state = gpio_fan_get_max_state, |
| 427 | .get_cur_state = gpio_fan_get_cur_state, |
| 428 | .set_cur_state = gpio_fan_set_cur_state, |
| 429 | }; |
| 430 | |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 431 | /* |
| 432 | * Translate OpenFirmware node properties into platform_data |
| 433 | */ |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 434 | static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data) |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 435 | { |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 436 | struct gpio_fan_speed *speed; |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 437 | struct device *dev = fan_data->dev; |
| 438 | struct device_node *np = dev->of_node; |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 439 | unsigned *ctrl; |
| 440 | unsigned i; |
| 441 | u32 u; |
| 442 | struct property *prop; |
| 443 | const __be32 *p; |
| 444 | |
Simon Guinot | 73ef85f | 2015-02-25 18:58:19 +0100 | [diff] [blame] | 445 | /* Alarm GPIO if one exists */ |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 446 | if (of_gpio_named_count(np, "alarm-gpios") > 0) { |
Simon Guinot | 73ef85f | 2015-02-25 18:58:19 +0100 | [diff] [blame] | 447 | int val; |
| 448 | enum of_gpio_flags flags; |
| 449 | |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 450 | val = of_get_named_gpio_flags(np, "alarm-gpios", 0, &flags); |
Simon Guinot | 73ef85f | 2015-02-25 18:58:19 +0100 | [diff] [blame] | 451 | if (val < 0) |
| 452 | return val; |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 453 | fan_data->alarm_gpio = val; |
| 454 | fan_data->alarm_gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; |
Simon Guinot | 73ef85f | 2015-02-25 18:58:19 +0100 | [diff] [blame] | 455 | } |
| 456 | |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 457 | /* Fill GPIO pin array */ |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 458 | fan_data->num_ctrl = of_gpio_count(np); |
| 459 | if (fan_data->num_ctrl <= 0) { |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 460 | if (fan_data->alarm_gpio) |
Simon Guinot | 73ef85f | 2015-02-25 18:58:19 +0100 | [diff] [blame] | 461 | return 0; |
| 462 | dev_err(dev, "DT properties empty / missing"); |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 463 | return -ENODEV; |
| 464 | } |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 465 | ctrl = devm_kzalloc(dev, fan_data->num_ctrl * sizeof(unsigned int), |
| 466 | GFP_KERNEL); |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 467 | if (!ctrl) |
| 468 | return -ENOMEM; |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 469 | for (i = 0; i < fan_data->num_ctrl; i++) { |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 470 | int val; |
| 471 | |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 472 | val = of_get_gpio(np, i); |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 473 | if (val < 0) |
| 474 | return val; |
| 475 | ctrl[i] = val; |
| 476 | } |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 477 | fan_data->ctrl = ctrl; |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 478 | |
| 479 | /* Get number of RPM/ctrl_val pairs in speed map */ |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 480 | prop = of_find_property(np, "gpio-fan,speed-map", &i); |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 481 | if (!prop) { |
| 482 | dev_err(dev, "gpio-fan,speed-map DT property missing"); |
| 483 | return -ENODEV; |
| 484 | } |
| 485 | i = i / sizeof(u32); |
| 486 | if (i == 0 || i & 1) { |
| 487 | dev_err(dev, "gpio-fan,speed-map contains zero/odd number of entries"); |
| 488 | return -ENODEV; |
| 489 | } |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 490 | fan_data->num_speed = i / 2; |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 491 | |
| 492 | /* |
| 493 | * Populate speed map |
| 494 | * Speed map is in the form <RPM ctrl_val RPM ctrl_val ...> |
| 495 | * this needs splitting into pairs to create gpio_fan_speed structs |
| 496 | */ |
| 497 | speed = devm_kzalloc(dev, |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 498 | fan_data->num_speed * sizeof(struct gpio_fan_speed), |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 499 | GFP_KERNEL); |
| 500 | if (!speed) |
| 501 | return -ENOMEM; |
| 502 | p = NULL; |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 503 | for (i = 0; i < fan_data->num_speed; i++) { |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 504 | p = of_prop_next_u32(prop, p, &u); |
| 505 | if (!p) |
| 506 | return -ENODEV; |
| 507 | speed[i].rpm = u; |
| 508 | p = of_prop_next_u32(prop, p, &u); |
| 509 | if (!p) |
| 510 | return -ENODEV; |
| 511 | speed[i].ctrl_val = u; |
| 512 | } |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 513 | fan_data->speed = speed; |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 514 | |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 515 | return 0; |
| 516 | } |
| 517 | |
Jingoo Han | 6de709c | 2014-05-07 17:27:54 +0900 | [diff] [blame] | 518 | static const struct of_device_id of_gpio_fan_match[] = { |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 519 | { .compatible = "gpio-fan", }, |
| 520 | {}, |
| 521 | }; |
Luis de Bethencourt | fe51528 | 2015-09-17 18:09:28 +0200 | [diff] [blame] | 522 | MODULE_DEVICE_TABLE(of, of_gpio_fan_match); |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 523 | |
Bill Pemberton | 6c931ae | 2012-11-19 13:22:35 -0500 | [diff] [blame] | 524 | static int gpio_fan_probe(struct platform_device *pdev) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 525 | { |
| 526 | int err; |
| 527 | struct gpio_fan_data *fan_data; |
Linus Walleij | f9013c1 | 2017-09-26 01:09:04 +0200 | [diff] [blame] | 528 | struct device *dev = &pdev->dev; |
| 529 | struct device_node *np = dev->of_node; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 530 | |
Linus Walleij | f9013c1 | 2017-09-26 01:09:04 +0200 | [diff] [blame] | 531 | fan_data = devm_kzalloc(dev, sizeof(struct gpio_fan_data), |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 532 | GFP_KERNEL); |
| 533 | if (!fan_data) |
| 534 | return -ENOMEM; |
| 535 | |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 536 | err = gpio_fan_get_of_data(fan_data); |
Linus Walleij | a9b4c8a | 2017-09-26 01:09:07 +0200 | [diff] [blame] | 537 | if (err) |
| 538 | return err; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 539 | |
Linus Walleij | 8c0eb9b | 2017-09-26 01:09:06 +0200 | [diff] [blame] | 540 | fan_data->dev = dev; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 541 | platform_set_drvdata(pdev, fan_data); |
| 542 | mutex_init(&fan_data->lock); |
| 543 | |
| 544 | /* Configure alarm GPIO if available. */ |
Linus Walleij | c9933cb | 2017-09-26 01:09:09 +0200 | [diff] [blame^] | 545 | if (fan_data->alarm_gpio) { |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 546 | err = fan_alarm_init(fan_data); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 547 | if (err) |
Guenter Roeck | d00985f | 2012-06-02 09:58:07 -0700 | [diff] [blame] | 548 | return err; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | /* Configure control GPIOs if available. */ |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 552 | if (fan_data->ctrl && fan_data->num_ctrl > 0) { |
| 553 | if (!fan_data->speed || fan_data->num_speed <= 1) |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 554 | return -EINVAL; |
Linus Walleij | b5482f7 | 2017-09-26 01:09:08 +0200 | [diff] [blame] | 555 | err = fan_ctrl_init(fan_data); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 556 | if (err) |
Guenter Roeck | c81cc5a | 2013-03-30 09:09:39 -0700 | [diff] [blame] | 557 | return err; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 558 | } |
| 559 | |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 560 | /* Make this driver part of hwmon class. */ |
Axel Lin | 49153b0 | 2014-06-14 14:50:50 +0800 | [diff] [blame] | 561 | fan_data->hwmon_dev = |
Linus Walleij | f9013c1 | 2017-09-26 01:09:04 +0200 | [diff] [blame] | 562 | devm_hwmon_device_register_with_groups(dev, |
Axel Lin | 49153b0 | 2014-06-14 14:50:50 +0800 | [diff] [blame] | 563 | "gpio_fan", fan_data, |
| 564 | gpio_fan_groups); |
Guenter Roeck | 7258a12 | 2013-07-06 09:46:14 -0700 | [diff] [blame] | 565 | if (IS_ERR(fan_data->hwmon_dev)) |
| 566 | return PTR_ERR(fan_data->hwmon_dev); |
Linus Walleij | a9b4c8a | 2017-09-26 01:09:07 +0200 | [diff] [blame] | 567 | |
Nishanth Menon | e76ea26 | 2015-04-08 18:23:52 -0500 | [diff] [blame] | 568 | /* Optional cooling device register for Device tree platforms */ |
Linus Walleij | f9013c1 | 2017-09-26 01:09:04 +0200 | [diff] [blame] | 569 | fan_data->cdev = thermal_of_cooling_device_register(np, |
Nishanth Menon | e76ea26 | 2015-04-08 18:23:52 -0500 | [diff] [blame] | 570 | "gpio-fan", |
| 571 | fan_data, |
| 572 | &gpio_fan_cool_ops); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 573 | |
Linus Walleij | f9013c1 | 2017-09-26 01:09:04 +0200 | [diff] [blame] | 574 | dev_info(dev, "GPIO fan initialized\n"); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 575 | |
| 576 | return 0; |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 577 | } |
| 578 | |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 579 | static int gpio_fan_remove(struct platform_device *pdev) |
Nishanth Menon | b95579c | 2014-12-04 10:58:56 -0600 | [diff] [blame] | 580 | { |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 581 | struct gpio_fan_data *fan_data = platform_get_drvdata(pdev); |
| 582 | |
| 583 | if (!IS_ERR(fan_data->cdev)) |
| 584 | thermal_cooling_device_unregister(fan_data->cdev); |
Nishanth Menon | b95579c | 2014-12-04 10:58:56 -0600 | [diff] [blame] | 585 | |
| 586 | if (fan_data->ctrl) |
| 587 | set_fan_speed(fan_data, 0); |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 588 | |
| 589 | return 0; |
| 590 | } |
| 591 | |
| 592 | static void gpio_fan_shutdown(struct platform_device *pdev) |
| 593 | { |
| 594 | gpio_fan_remove(pdev); |
Nishanth Menon | b95579c | 2014-12-04 10:58:56 -0600 | [diff] [blame] | 595 | } |
| 596 | |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 597 | #ifdef CONFIG_PM_SLEEP |
| 598 | static int gpio_fan_suspend(struct device *dev) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 599 | { |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 600 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 601 | |
| 602 | if (fan_data->ctrl) { |
| 603 | fan_data->resume_speed = fan_data->speed_index; |
| 604 | set_fan_speed(fan_data, 0); |
| 605 | } |
| 606 | |
| 607 | return 0; |
| 608 | } |
| 609 | |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 610 | static int gpio_fan_resume(struct device *dev) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 611 | { |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 612 | struct gpio_fan_data *fan_data = dev_get_drvdata(dev); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 613 | |
| 614 | if (fan_data->ctrl) |
| 615 | set_fan_speed(fan_data, fan_data->resume_speed); |
| 616 | |
| 617 | return 0; |
| 618 | } |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 619 | |
| 620 | static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume); |
Guenter Roeck | 24f9c53 | 2013-01-10 05:54:40 -0800 | [diff] [blame] | 621 | #define GPIO_FAN_PM (&gpio_fan_pm) |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 622 | #else |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 623 | #define GPIO_FAN_PM NULL |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 624 | #endif |
| 625 | |
| 626 | static struct platform_driver gpio_fan_driver = { |
| 627 | .probe = gpio_fan_probe, |
Nishanth Menon | b5cf88e | 2015-01-08 12:05:03 -0600 | [diff] [blame] | 628 | .remove = gpio_fan_remove, |
Nishanth Menon | b95579c | 2014-12-04 10:58:56 -0600 | [diff] [blame] | 629 | .shutdown = gpio_fan_shutdown, |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 630 | .driver = { |
| 631 | .name = "gpio-fan", |
Rafael J. Wysocki | 6d20a6c0 | 2012-07-08 00:01:03 +0200 | [diff] [blame] | 632 | .pm = GPIO_FAN_PM, |
Jamie Lentin | 55fb8b06 | 2012-09-14 17:07:06 +0100 | [diff] [blame] | 633 | .of_match_table = of_match_ptr(of_gpio_fan_match), |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 634 | }, |
| 635 | }; |
| 636 | |
Axel Lin | 25a236a | 2011-11-25 02:31:00 -0500 | [diff] [blame] | 637 | module_platform_driver(gpio_fan_driver); |
Simon Guinot | d6fe136 | 2010-10-22 00:44:19 +0200 | [diff] [blame] | 638 | |
| 639 | MODULE_AUTHOR("Simon Guinot <[email protected]>"); |
| 640 | MODULE_DESCRIPTION("GPIO FAN driver"); |
| 641 | MODULE_LICENSE("GPL"); |
| 642 | MODULE_ALIAS("platform:gpio-fan"); |