Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007-2009 Luca Tettamanti <kronos.it@gmail.com> |
| 3 | * |
| 4 | * This file is released under the GPLv2 |
| 5 | * See COPYING in the top level directory of the kernel tree. |
| 6 | */ |
| 7 | |
| 8 | #include <linux/kernel.h> |
| 9 | #include <linux/hwmon.h> |
| 10 | #include <linux/list.h> |
| 11 | #include <linux/module.h> |
| 12 | |
| 13 | #include <acpi/acpi.h> |
| 14 | #include <acpi/acpixf.h> |
| 15 | #include <acpi/acpi_drivers.h> |
| 16 | #include <acpi/acpi_bus.h> |
| 17 | |
| 18 | |
| 19 | #define ATK_HID "ATK0110" |
| 20 | |
| 21 | /* Minimum time between readings, enforced in order to avoid |
| 22 | * hogging the CPU. |
| 23 | */ |
| 24 | #define CACHE_TIME HZ |
| 25 | |
| 26 | #define BOARD_ID "MBIF" |
| 27 | #define METHOD_ENUMERATE "GGRP" |
| 28 | #define METHOD_READ "GITM" |
| 29 | #define METHOD_WRITE "SITM" |
| 30 | #define METHOD_OLD_READ_TMP "RTMP" |
| 31 | #define METHOD_OLD_READ_VLT "RVLT" |
| 32 | #define METHOD_OLD_READ_FAN "RFAN" |
| 33 | #define METHOD_OLD_ENUM_TMP "TSIF" |
| 34 | #define METHOD_OLD_ENUM_VLT "VSIF" |
| 35 | #define METHOD_OLD_ENUM_FAN "FSIF" |
| 36 | |
| 37 | #define ATK_MUX_HWMON 0x00000006ULL |
| 38 | |
| 39 | #define ATK_CLASS_MASK 0xff000000ULL |
| 40 | #define ATK_CLASS_FREQ_CTL 0x03000000ULL |
| 41 | #define ATK_CLASS_FAN_CTL 0x04000000ULL |
| 42 | #define ATK_CLASS_HWMON 0x06000000ULL |
| 43 | |
| 44 | #define ATK_TYPE_MASK 0x00ff0000ULL |
| 45 | #define HWMON_TYPE_VOLT 0x00020000ULL |
| 46 | #define HWMON_TYPE_TEMP 0x00030000ULL |
| 47 | #define HWMON_TYPE_FAN 0x00040000ULL |
| 48 | |
| 49 | #define HWMON_SENSOR_ID_MASK 0x0000ffffULL |
| 50 | |
| 51 | enum atk_pack_member { |
| 52 | HWMON_PACK_FLAGS, |
| 53 | HWMON_PACK_NAME, |
| 54 | HWMON_PACK_LIMIT1, |
| 55 | HWMON_PACK_LIMIT2, |
| 56 | HWMON_PACK_ENABLE |
| 57 | }; |
| 58 | |
| 59 | /* New package format */ |
| 60 | #define _HWMON_NEW_PACK_SIZE 7 |
| 61 | #define _HWMON_NEW_PACK_FLAGS 0 |
| 62 | #define _HWMON_NEW_PACK_NAME 1 |
| 63 | #define _HWMON_NEW_PACK_UNK1 2 |
| 64 | #define _HWMON_NEW_PACK_UNK2 3 |
| 65 | #define _HWMON_NEW_PACK_LIMIT1 4 |
| 66 | #define _HWMON_NEW_PACK_LIMIT2 5 |
| 67 | #define _HWMON_NEW_PACK_ENABLE 6 |
| 68 | |
| 69 | /* Old package format */ |
| 70 | #define _HWMON_OLD_PACK_SIZE 5 |
| 71 | #define _HWMON_OLD_PACK_FLAGS 0 |
| 72 | #define _HWMON_OLD_PACK_NAME 1 |
| 73 | #define _HWMON_OLD_PACK_LIMIT1 2 |
| 74 | #define _HWMON_OLD_PACK_LIMIT2 3 |
| 75 | #define _HWMON_OLD_PACK_ENABLE 4 |
| 76 | |
| 77 | |
| 78 | struct atk_data { |
| 79 | struct device *hwmon_dev; |
| 80 | acpi_handle atk_handle; |
| 81 | struct acpi_device *acpi_dev; |
| 82 | |
| 83 | bool old_interface; |
| 84 | |
| 85 | /* old interface */ |
| 86 | acpi_handle rtmp_handle; |
| 87 | acpi_handle rvlt_handle; |
| 88 | acpi_handle rfan_handle; |
| 89 | /* new inteface */ |
| 90 | acpi_handle enumerate_handle; |
| 91 | acpi_handle read_handle; |
| 92 | |
| 93 | int voltage_count; |
| 94 | int temperature_count; |
| 95 | int fan_count; |
| 96 | struct list_head sensor_list; |
| 97 | }; |
| 98 | |
| 99 | |
| 100 | typedef ssize_t (*sysfs_show_func)(struct device *dev, |
| 101 | struct device_attribute *attr, char *buf); |
| 102 | |
| 103 | static const struct acpi_device_id atk_ids[] = { |
| 104 | {ATK_HID, 0}, |
| 105 | {"", 0}, |
| 106 | }; |
| 107 | MODULE_DEVICE_TABLE(acpi, atk_ids); |
| 108 | |
| 109 | #define ATTR_NAME_SIZE 16 /* Worst case is "tempN_input" */ |
| 110 | |
| 111 | struct atk_sensor_data { |
| 112 | struct list_head list; |
| 113 | struct atk_data *data; |
| 114 | struct device_attribute label_attr; |
| 115 | struct device_attribute input_attr; |
| 116 | struct device_attribute limit1_attr; |
| 117 | struct device_attribute limit2_attr; |
| 118 | char label_attr_name[ATTR_NAME_SIZE]; |
| 119 | char input_attr_name[ATTR_NAME_SIZE]; |
| 120 | char limit1_attr_name[ATTR_NAME_SIZE]; |
| 121 | char limit2_attr_name[ATTR_NAME_SIZE]; |
| 122 | u64 id; |
| 123 | u64 type; |
| 124 | u64 limit1; |
| 125 | u64 limit2; |
| 126 | u64 cached_value; |
| 127 | unsigned long last_updated; /* in jiffies */ |
| 128 | bool is_valid; |
| 129 | char const *acpi_name; |
| 130 | }; |
| 131 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 132 | /* Return buffer format: |
| 133 | * [0-3] "value" is valid flag |
| 134 | * [4-7] value |
| 135 | * [8- ] unknown stuff on newer mobos |
| 136 | */ |
| 137 | struct atk_acpi_ret_buffer { |
| 138 | u32 flags; |
| 139 | u32 value; |
| 140 | u8 data[]; |
| 141 | }; |
| 142 | |
| 143 | /* Input buffer used for GITM and SITM methods */ |
| 144 | struct atk_acpi_input_buf { |
| 145 | u32 id; |
| 146 | u32 param1; |
| 147 | u32 param2; |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 148 | }; |
| 149 | |
| 150 | static int atk_add(struct acpi_device *device); |
| 151 | static int atk_remove(struct acpi_device *device, int type); |
| 152 | static void atk_print_sensor(struct atk_data *data, union acpi_object *obj); |
| 153 | static int atk_read_value(struct atk_sensor_data *sensor, u64 *value); |
| 154 | static void atk_free_sensors(struct atk_data *data); |
| 155 | |
| 156 | static struct acpi_driver atk_driver = { |
| 157 | .name = ATK_HID, |
| 158 | .class = "hwmon", |
| 159 | .ids = atk_ids, |
| 160 | .ops = { |
| 161 | .add = atk_add, |
| 162 | .remove = atk_remove, |
| 163 | }, |
| 164 | }; |
| 165 | |
| 166 | #define input_to_atk_sensor(attr) \ |
| 167 | container_of(attr, struct atk_sensor_data, input_attr) |
| 168 | |
| 169 | #define label_to_atk_sensor(attr) \ |
| 170 | container_of(attr, struct atk_sensor_data, label_attr) |
| 171 | |
| 172 | #define limit1_to_atk_sensor(attr) \ |
| 173 | container_of(attr, struct atk_sensor_data, limit1_attr) |
| 174 | |
| 175 | #define limit2_to_atk_sensor(attr) \ |
| 176 | container_of(attr, struct atk_sensor_data, limit2_attr) |
| 177 | |
| 178 | static ssize_t atk_input_show(struct device *dev, |
| 179 | struct device_attribute *attr, char *buf) |
| 180 | { |
| 181 | struct atk_sensor_data *s = input_to_atk_sensor(attr); |
| 182 | u64 value; |
| 183 | int err; |
| 184 | |
| 185 | err = atk_read_value(s, &value); |
| 186 | if (err) |
| 187 | return err; |
| 188 | |
| 189 | if (s->type == HWMON_TYPE_TEMP) |
| 190 | /* ACPI returns decidegree */ |
| 191 | value *= 100; |
| 192 | |
| 193 | return sprintf(buf, "%llu\n", value); |
| 194 | } |
| 195 | |
| 196 | static ssize_t atk_label_show(struct device *dev, |
| 197 | struct device_attribute *attr, char *buf) |
| 198 | { |
| 199 | struct atk_sensor_data *s = label_to_atk_sensor(attr); |
| 200 | |
| 201 | return sprintf(buf, "%s\n", s->acpi_name); |
| 202 | } |
| 203 | |
| 204 | static ssize_t atk_limit1_show(struct device *dev, |
| 205 | struct device_attribute *attr, char *buf) |
| 206 | { |
| 207 | struct atk_sensor_data *s = limit1_to_atk_sensor(attr); |
| 208 | u64 value = s->limit1; |
| 209 | |
| 210 | if (s->type == HWMON_TYPE_TEMP) |
| 211 | value *= 100; |
| 212 | |
| 213 | return sprintf(buf, "%lld\n", value); |
| 214 | } |
| 215 | |
| 216 | static ssize_t atk_limit2_show(struct device *dev, |
| 217 | struct device_attribute *attr, char *buf) |
| 218 | { |
| 219 | struct atk_sensor_data *s = limit2_to_atk_sensor(attr); |
| 220 | u64 value = s->limit2; |
| 221 | |
| 222 | if (s->type == HWMON_TYPE_TEMP) |
| 223 | value *= 100; |
| 224 | |
| 225 | return sprintf(buf, "%lld\n", value); |
| 226 | } |
| 227 | |
| 228 | static ssize_t atk_name_show(struct device *dev, |
| 229 | struct device_attribute *attr, char *buf) |
| 230 | { |
| 231 | return sprintf(buf, "atk0110\n"); |
| 232 | } |
| 233 | static struct device_attribute atk_name_attr = |
| 234 | __ATTR(name, 0444, atk_name_show, NULL); |
| 235 | |
| 236 | static void atk_init_attribute(struct device_attribute *attr, char *name, |
| 237 | sysfs_show_func show) |
| 238 | { |
| 239 | attr->attr.name = name; |
| 240 | attr->attr.mode = 0444; |
| 241 | attr->show = show; |
| 242 | attr->store = NULL; |
| 243 | } |
| 244 | |
| 245 | |
| 246 | static union acpi_object *atk_get_pack_member(struct atk_data *data, |
| 247 | union acpi_object *pack, |
| 248 | enum atk_pack_member m) |
| 249 | { |
| 250 | bool old_if = data->old_interface; |
| 251 | int offset; |
| 252 | |
| 253 | switch (m) { |
| 254 | case HWMON_PACK_FLAGS: |
| 255 | offset = old_if ? _HWMON_OLD_PACK_FLAGS : _HWMON_NEW_PACK_FLAGS; |
| 256 | break; |
| 257 | case HWMON_PACK_NAME: |
| 258 | offset = old_if ? _HWMON_OLD_PACK_NAME : _HWMON_NEW_PACK_NAME; |
| 259 | break; |
| 260 | case HWMON_PACK_LIMIT1: |
| 261 | offset = old_if ? _HWMON_OLD_PACK_LIMIT1 : |
| 262 | _HWMON_NEW_PACK_LIMIT1; |
| 263 | break; |
| 264 | case HWMON_PACK_LIMIT2: |
| 265 | offset = old_if ? _HWMON_OLD_PACK_LIMIT2 : |
| 266 | _HWMON_NEW_PACK_LIMIT2; |
| 267 | break; |
| 268 | case HWMON_PACK_ENABLE: |
| 269 | offset = old_if ? _HWMON_OLD_PACK_ENABLE : |
| 270 | _HWMON_NEW_PACK_ENABLE; |
| 271 | break; |
| 272 | default: |
| 273 | return NULL; |
| 274 | } |
| 275 | |
| 276 | return &pack->package.elements[offset]; |
| 277 | } |
| 278 | |
| 279 | |
| 280 | /* New package format is: |
| 281 | * - flag (int) |
| 282 | * class - used for de-muxing the request to the correct GITn |
| 283 | * type (volt, temp, fan) |
| 284 | * sensor id | |
| 285 | * sensor id - used for de-muxing the request _inside_ the GITn |
| 286 | * - name (str) |
| 287 | * - unknown (int) |
| 288 | * - unknown (int) |
| 289 | * - limit1 (int) |
| 290 | * - limit2 (int) |
| 291 | * - enable (int) |
| 292 | * |
| 293 | * The old package has the same format but it's missing the two unknown fields. |
| 294 | */ |
| 295 | static int validate_hwmon_pack(struct atk_data *data, union acpi_object *obj) |
| 296 | { |
| 297 | struct device *dev = &data->acpi_dev->dev; |
| 298 | union acpi_object *tmp; |
| 299 | bool old_if = data->old_interface; |
| 300 | int const expected_size = old_if ? _HWMON_OLD_PACK_SIZE : |
| 301 | _HWMON_NEW_PACK_SIZE; |
| 302 | |
| 303 | if (obj->type != ACPI_TYPE_PACKAGE) { |
| 304 | dev_warn(dev, "Invalid type: %d\n", obj->type); |
| 305 | return -EINVAL; |
| 306 | } |
| 307 | |
| 308 | if (obj->package.count != expected_size) { |
| 309 | dev_warn(dev, "Invalid package size: %d, expected: %d\n", |
| 310 | obj->package.count, expected_size); |
| 311 | return -EINVAL; |
| 312 | } |
| 313 | |
| 314 | tmp = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS); |
| 315 | if (tmp->type != ACPI_TYPE_INTEGER) { |
| 316 | dev_warn(dev, "Invalid type (flag): %d\n", tmp->type); |
| 317 | return -EINVAL; |
| 318 | } |
| 319 | |
| 320 | tmp = atk_get_pack_member(data, obj, HWMON_PACK_NAME); |
| 321 | if (tmp->type != ACPI_TYPE_STRING) { |
| 322 | dev_warn(dev, "Invalid type (name): %d\n", tmp->type); |
| 323 | return -EINVAL; |
| 324 | } |
| 325 | |
| 326 | /* Don't check... we don't know what they're useful for anyway */ |
| 327 | #if 0 |
| 328 | tmp = &obj->package.elements[HWMON_PACK_UNK1]; |
| 329 | if (tmp->type != ACPI_TYPE_INTEGER) { |
| 330 | dev_warn(dev, "Invalid type (unk1): %d\n", tmp->type); |
| 331 | return -EINVAL; |
| 332 | } |
| 333 | |
| 334 | tmp = &obj->package.elements[HWMON_PACK_UNK2]; |
| 335 | if (tmp->type != ACPI_TYPE_INTEGER) { |
| 336 | dev_warn(dev, "Invalid type (unk2): %d\n", tmp->type); |
| 337 | return -EINVAL; |
| 338 | } |
| 339 | #endif |
| 340 | |
| 341 | tmp = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1); |
| 342 | if (tmp->type != ACPI_TYPE_INTEGER) { |
| 343 | dev_warn(dev, "Invalid type (limit1): %d\n", tmp->type); |
| 344 | return -EINVAL; |
| 345 | } |
| 346 | |
| 347 | tmp = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2); |
| 348 | if (tmp->type != ACPI_TYPE_INTEGER) { |
| 349 | dev_warn(dev, "Invalid type (limit2): %d\n", tmp->type); |
| 350 | return -EINVAL; |
| 351 | } |
| 352 | |
| 353 | tmp = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE); |
| 354 | if (tmp->type != ACPI_TYPE_INTEGER) { |
| 355 | dev_warn(dev, "Invalid type (enable): %d\n", tmp->type); |
| 356 | return -EINVAL; |
| 357 | } |
| 358 | |
| 359 | atk_print_sensor(data, obj); |
| 360 | |
| 361 | return 0; |
| 362 | } |
| 363 | |
Luca Tettamanti | b900870 | 2009-05-08 20:27:28 +0200 | [diff] [blame] | 364 | #ifdef DEBUG |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 365 | static char const *atk_sensor_type(union acpi_object *flags) |
| 366 | { |
| 367 | u64 type = flags->integer.value & ATK_TYPE_MASK; |
| 368 | char const *what; |
| 369 | |
| 370 | switch (type) { |
| 371 | case HWMON_TYPE_VOLT: |
| 372 | what = "voltage"; |
| 373 | break; |
| 374 | case HWMON_TYPE_TEMP: |
| 375 | what = "temperature"; |
| 376 | break; |
| 377 | case HWMON_TYPE_FAN: |
| 378 | what = "fan"; |
| 379 | break; |
| 380 | default: |
| 381 | what = "unknown"; |
| 382 | break; |
| 383 | } |
| 384 | |
| 385 | return what; |
| 386 | } |
Luca Tettamanti | b900870 | 2009-05-08 20:27:28 +0200 | [diff] [blame] | 387 | #endif |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 388 | |
| 389 | static void atk_print_sensor(struct atk_data *data, union acpi_object *obj) |
| 390 | { |
| 391 | #ifdef DEBUG |
| 392 | struct device *dev = &data->acpi_dev->dev; |
| 393 | union acpi_object *flags; |
| 394 | union acpi_object *name; |
| 395 | union acpi_object *limit1; |
| 396 | union acpi_object *limit2; |
| 397 | union acpi_object *enable; |
| 398 | char const *what; |
| 399 | |
| 400 | flags = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS); |
| 401 | name = atk_get_pack_member(data, obj, HWMON_PACK_NAME); |
| 402 | limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1); |
| 403 | limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2); |
| 404 | enable = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE); |
| 405 | |
| 406 | what = atk_sensor_type(flags); |
| 407 | |
| 408 | dev_dbg(dev, "%s: %#llx %s [%llu-%llu] %s\n", what, |
| 409 | flags->integer.value, |
| 410 | name->string.pointer, |
| 411 | limit1->integer.value, limit2->integer.value, |
| 412 | enable->integer.value ? "enabled" : "disabled"); |
| 413 | #endif |
| 414 | } |
| 415 | |
| 416 | static int atk_read_value_old(struct atk_sensor_data *sensor, u64 *value) |
| 417 | { |
| 418 | struct atk_data *data = sensor->data; |
| 419 | struct device *dev = &data->acpi_dev->dev; |
| 420 | struct acpi_object_list params; |
| 421 | union acpi_object id; |
| 422 | acpi_status status; |
| 423 | acpi_handle method; |
| 424 | |
| 425 | switch (sensor->type) { |
| 426 | case HWMON_TYPE_VOLT: |
| 427 | method = data->rvlt_handle; |
| 428 | break; |
| 429 | case HWMON_TYPE_TEMP: |
| 430 | method = data->rtmp_handle; |
| 431 | break; |
| 432 | case HWMON_TYPE_FAN: |
| 433 | method = data->rfan_handle; |
| 434 | break; |
| 435 | default: |
| 436 | return -EINVAL; |
| 437 | } |
| 438 | |
| 439 | id.type = ACPI_TYPE_INTEGER; |
| 440 | id.integer.value = sensor->id; |
| 441 | |
| 442 | params.count = 1; |
| 443 | params.pointer = &id; |
| 444 | |
| 445 | status = acpi_evaluate_integer(method, NULL, ¶ms, value); |
| 446 | if (status != AE_OK) { |
| 447 | dev_warn(dev, "%s: ACPI exception: %s\n", __func__, |
| 448 | acpi_format_exception(status)); |
| 449 | return -EIO; |
| 450 | } |
| 451 | |
| 452 | return 0; |
| 453 | } |
| 454 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 455 | static union acpi_object *atk_ggrp(struct atk_data *data, u16 mux) |
| 456 | { |
| 457 | struct device *dev = &data->acpi_dev->dev; |
| 458 | struct acpi_buffer buf; |
| 459 | acpi_status ret; |
| 460 | struct acpi_object_list params; |
| 461 | union acpi_object id; |
| 462 | union acpi_object *pack; |
| 463 | |
| 464 | id.type = ACPI_TYPE_INTEGER; |
| 465 | id.integer.value = mux; |
| 466 | params.count = 1; |
| 467 | params.pointer = &id; |
| 468 | |
| 469 | buf.length = ACPI_ALLOCATE_BUFFER; |
| 470 | ret = acpi_evaluate_object(data->enumerate_handle, NULL, ¶ms, &buf); |
| 471 | if (ret != AE_OK) { |
| 472 | dev_err(dev, "GGRP[%#x] ACPI exception: %s\n", mux, |
| 473 | acpi_format_exception(ret)); |
| 474 | return ERR_PTR(-EIO); |
| 475 | } |
| 476 | pack = buf.pointer; |
| 477 | if (pack->type != ACPI_TYPE_PACKAGE) { |
| 478 | /* Execution was successful, but the id was not found */ |
| 479 | ACPI_FREE(pack); |
| 480 | return ERR_PTR(-ENOENT); |
| 481 | } |
| 482 | |
| 483 | if (pack->package.count < 1) { |
| 484 | dev_err(dev, "GGRP[%#x] package is too small\n", mux); |
| 485 | ACPI_FREE(pack); |
| 486 | return ERR_PTR(-EIO); |
| 487 | } |
| 488 | return pack; |
| 489 | } |
| 490 | |
| 491 | static union acpi_object *atk_gitm(struct atk_data *data, u64 id) |
| 492 | { |
| 493 | struct device *dev = &data->acpi_dev->dev; |
| 494 | struct atk_acpi_input_buf buf; |
| 495 | union acpi_object tmp; |
| 496 | struct acpi_object_list params; |
| 497 | struct acpi_buffer ret; |
| 498 | union acpi_object *obj; |
| 499 | acpi_status status; |
| 500 | |
| 501 | buf.id = id; |
| 502 | buf.param1 = 0; |
| 503 | buf.param2 = 0; |
| 504 | |
| 505 | tmp.type = ACPI_TYPE_BUFFER; |
| 506 | tmp.buffer.pointer = (u8 *)&buf; |
| 507 | tmp.buffer.length = sizeof(buf); |
| 508 | |
| 509 | params.count = 1; |
| 510 | params.pointer = (void *)&tmp; |
| 511 | |
| 512 | ret.length = ACPI_ALLOCATE_BUFFER; |
| 513 | status = acpi_evaluate_object_typed(data->read_handle, NULL, ¶ms, |
| 514 | &ret, ACPI_TYPE_BUFFER); |
| 515 | if (status != AE_OK) { |
| 516 | dev_warn(dev, "GITM[%#llx] ACPI exception: %s\n", id, |
| 517 | acpi_format_exception(status)); |
| 518 | return ERR_PTR(-EIO); |
| 519 | } |
| 520 | obj = ret.pointer; |
| 521 | |
| 522 | /* Sanity check */ |
| 523 | if (obj->buffer.length < 8) { |
| 524 | dev_warn(dev, "Unexpected ASBF length: %u\n", |
| 525 | obj->buffer.length); |
| 526 | ACPI_FREE(obj); |
| 527 | return ERR_PTR(-EIO); |
| 528 | } |
| 529 | return obj; |
| 530 | } |
| 531 | |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 532 | static int atk_read_value_new(struct atk_sensor_data *sensor, u64 *value) |
| 533 | { |
| 534 | struct atk_data *data = sensor->data; |
| 535 | struct device *dev = &data->acpi_dev->dev; |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 536 | union acpi_object *obj; |
| 537 | struct atk_acpi_ret_buffer *buf; |
| 538 | int err = 0; |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 539 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 540 | obj = atk_gitm(data, sensor->id); |
| 541 | if (IS_ERR(obj)) |
| 542 | return PTR_ERR(obj); |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 543 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 544 | buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer; |
| 545 | if (buf->flags == 0) { |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 546 | /* The reading is not valid, possible causes: |
| 547 | * - sensor failure |
| 548 | * - enumeration was FUBAR (and we didn't notice) |
| 549 | */ |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 550 | dev_warn(dev, "Read failed, sensor = %#llx\n", sensor->id); |
| 551 | err = -EIO; |
| 552 | goto out; |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 553 | } |
| 554 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 555 | *value = buf->value; |
| 556 | out: |
| 557 | ACPI_FREE(obj); |
| 558 | return err; |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 559 | } |
| 560 | |
| 561 | static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) |
| 562 | { |
| 563 | int err; |
| 564 | |
| 565 | if (!sensor->is_valid || |
| 566 | time_after(jiffies, sensor->last_updated + CACHE_TIME)) { |
| 567 | if (sensor->data->old_interface) |
| 568 | err = atk_read_value_old(sensor, value); |
| 569 | else |
| 570 | err = atk_read_value_new(sensor, value); |
| 571 | |
| 572 | sensor->is_valid = true; |
| 573 | sensor->last_updated = jiffies; |
| 574 | sensor->cached_value = *value; |
| 575 | } else { |
| 576 | *value = sensor->cached_value; |
| 577 | err = 0; |
| 578 | } |
| 579 | |
| 580 | return err; |
| 581 | } |
| 582 | |
| 583 | static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) |
| 584 | { |
| 585 | struct device *dev = &data->acpi_dev->dev; |
| 586 | union acpi_object *flags; |
| 587 | union acpi_object *name; |
| 588 | union acpi_object *limit1; |
| 589 | union acpi_object *limit2; |
| 590 | union acpi_object *enable; |
| 591 | struct atk_sensor_data *sensor; |
| 592 | char const *base_name; |
| 593 | char const *limit1_name; |
| 594 | char const *limit2_name; |
| 595 | u64 type; |
| 596 | int err; |
| 597 | int *num; |
| 598 | int start; |
| 599 | |
| 600 | if (obj->type != ACPI_TYPE_PACKAGE) { |
| 601 | /* wft is this? */ |
| 602 | dev_warn(dev, "Unknown type for ACPI object: (%d)\n", |
| 603 | obj->type); |
| 604 | return -EINVAL; |
| 605 | } |
| 606 | |
| 607 | err = validate_hwmon_pack(data, obj); |
| 608 | if (err) |
| 609 | return err; |
| 610 | |
| 611 | /* Ok, we have a valid hwmon package */ |
| 612 | type = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS)->integer.value |
| 613 | & ATK_TYPE_MASK; |
| 614 | |
| 615 | switch (type) { |
| 616 | case HWMON_TYPE_VOLT: |
| 617 | base_name = "in"; |
| 618 | limit1_name = "min"; |
| 619 | limit2_name = "max"; |
| 620 | num = &data->voltage_count; |
| 621 | start = 0; |
| 622 | break; |
| 623 | case HWMON_TYPE_TEMP: |
| 624 | base_name = "temp"; |
| 625 | limit1_name = "max"; |
| 626 | limit2_name = "crit"; |
| 627 | num = &data->temperature_count; |
| 628 | start = 1; |
| 629 | break; |
| 630 | case HWMON_TYPE_FAN: |
| 631 | base_name = "fan"; |
| 632 | limit1_name = "min"; |
| 633 | limit2_name = "max"; |
| 634 | num = &data->fan_count; |
| 635 | start = 1; |
| 636 | break; |
| 637 | default: |
| 638 | dev_warn(dev, "Unknown sensor type: %#llx\n", type); |
| 639 | return -EINVAL; |
| 640 | } |
| 641 | |
| 642 | enable = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE); |
| 643 | if (!enable->integer.value) |
| 644 | /* sensor is disabled */ |
| 645 | return 0; |
| 646 | |
| 647 | flags = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS); |
| 648 | name = atk_get_pack_member(data, obj, HWMON_PACK_NAME); |
| 649 | limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1); |
| 650 | limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2); |
| 651 | |
| 652 | sensor = kzalloc(sizeof(*sensor), GFP_KERNEL); |
| 653 | if (!sensor) |
| 654 | return -ENOMEM; |
| 655 | |
| 656 | sensor->acpi_name = kstrdup(name->string.pointer, GFP_KERNEL); |
| 657 | if (!sensor->acpi_name) { |
| 658 | err = -ENOMEM; |
| 659 | goto out; |
| 660 | } |
| 661 | |
| 662 | INIT_LIST_HEAD(&sensor->list); |
| 663 | sensor->type = type; |
| 664 | sensor->data = data; |
| 665 | sensor->id = flags->integer.value; |
| 666 | sensor->limit1 = limit1->integer.value; |
Luca Tettamanti | 8d28249 | 2009-07-28 16:31:39 +0200 | [diff] [blame] | 667 | if (data->old_interface) |
| 668 | sensor->limit2 = limit2->integer.value; |
| 669 | else |
| 670 | /* The upper limit is expressed as delta from lower limit */ |
| 671 | sensor->limit2 = sensor->limit1 + limit2->integer.value; |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 672 | |
| 673 | snprintf(sensor->input_attr_name, ATTR_NAME_SIZE, |
| 674 | "%s%d_input", base_name, start + *num); |
| 675 | atk_init_attribute(&sensor->input_attr, |
| 676 | sensor->input_attr_name, |
| 677 | atk_input_show); |
| 678 | |
| 679 | snprintf(sensor->label_attr_name, ATTR_NAME_SIZE, |
| 680 | "%s%d_label", base_name, start + *num); |
| 681 | atk_init_attribute(&sensor->label_attr, |
| 682 | sensor->label_attr_name, |
| 683 | atk_label_show); |
| 684 | |
| 685 | snprintf(sensor->limit1_attr_name, ATTR_NAME_SIZE, |
| 686 | "%s%d_%s", base_name, start + *num, limit1_name); |
| 687 | atk_init_attribute(&sensor->limit1_attr, |
| 688 | sensor->limit1_attr_name, |
| 689 | atk_limit1_show); |
| 690 | |
| 691 | snprintf(sensor->limit2_attr_name, ATTR_NAME_SIZE, |
| 692 | "%s%d_%s", base_name, start + *num, limit2_name); |
| 693 | atk_init_attribute(&sensor->limit2_attr, |
| 694 | sensor->limit2_attr_name, |
| 695 | atk_limit2_show); |
| 696 | |
| 697 | list_add(&sensor->list, &data->sensor_list); |
| 698 | (*num)++; |
| 699 | |
| 700 | return 1; |
| 701 | out: |
| 702 | kfree(sensor->acpi_name); |
| 703 | kfree(sensor); |
| 704 | return err; |
| 705 | } |
| 706 | |
| 707 | static int atk_enumerate_old_hwmon(struct atk_data *data) |
| 708 | { |
| 709 | struct device *dev = &data->acpi_dev->dev; |
| 710 | struct acpi_buffer buf; |
| 711 | union acpi_object *pack; |
| 712 | acpi_status status; |
| 713 | int i, ret; |
| 714 | int count = 0; |
| 715 | |
| 716 | /* Voltages */ |
| 717 | buf.length = ACPI_ALLOCATE_BUFFER; |
| 718 | status = acpi_evaluate_object_typed(data->atk_handle, |
| 719 | METHOD_OLD_ENUM_VLT, NULL, &buf, ACPI_TYPE_PACKAGE); |
| 720 | if (status != AE_OK) { |
| 721 | dev_warn(dev, METHOD_OLD_ENUM_VLT ": ACPI exception: %s\n", |
| 722 | acpi_format_exception(status)); |
| 723 | |
| 724 | return -ENODEV; |
| 725 | } |
| 726 | |
| 727 | pack = buf.pointer; |
| 728 | for (i = 1; i < pack->package.count; i++) { |
| 729 | union acpi_object *obj = &pack->package.elements[i]; |
| 730 | |
| 731 | ret = atk_add_sensor(data, obj); |
| 732 | if (ret > 0) |
| 733 | count++; |
| 734 | } |
| 735 | ACPI_FREE(buf.pointer); |
| 736 | |
| 737 | /* Temperatures */ |
| 738 | buf.length = ACPI_ALLOCATE_BUFFER; |
| 739 | status = acpi_evaluate_object_typed(data->atk_handle, |
| 740 | METHOD_OLD_ENUM_TMP, NULL, &buf, ACPI_TYPE_PACKAGE); |
| 741 | if (status != AE_OK) { |
| 742 | dev_warn(dev, METHOD_OLD_ENUM_TMP ": ACPI exception: %s\n", |
| 743 | acpi_format_exception(status)); |
| 744 | |
| 745 | ret = -ENODEV; |
| 746 | goto cleanup; |
| 747 | } |
| 748 | |
| 749 | pack = buf.pointer; |
| 750 | for (i = 1; i < pack->package.count; i++) { |
| 751 | union acpi_object *obj = &pack->package.elements[i]; |
| 752 | |
| 753 | ret = atk_add_sensor(data, obj); |
| 754 | if (ret > 0) |
| 755 | count++; |
| 756 | } |
| 757 | ACPI_FREE(buf.pointer); |
| 758 | |
| 759 | /* Fans */ |
| 760 | buf.length = ACPI_ALLOCATE_BUFFER; |
| 761 | status = acpi_evaluate_object_typed(data->atk_handle, |
| 762 | METHOD_OLD_ENUM_FAN, NULL, &buf, ACPI_TYPE_PACKAGE); |
| 763 | if (status != AE_OK) { |
| 764 | dev_warn(dev, METHOD_OLD_ENUM_FAN ": ACPI exception: %s\n", |
| 765 | acpi_format_exception(status)); |
| 766 | |
| 767 | ret = -ENODEV; |
| 768 | goto cleanup; |
| 769 | } |
| 770 | |
| 771 | pack = buf.pointer; |
| 772 | for (i = 1; i < pack->package.count; i++) { |
| 773 | union acpi_object *obj = &pack->package.elements[i]; |
| 774 | |
| 775 | ret = atk_add_sensor(data, obj); |
| 776 | if (ret > 0) |
| 777 | count++; |
| 778 | } |
| 779 | ACPI_FREE(buf.pointer); |
| 780 | |
| 781 | return count; |
| 782 | cleanup: |
| 783 | atk_free_sensors(data); |
| 784 | return ret; |
| 785 | } |
| 786 | |
| 787 | static int atk_enumerate_new_hwmon(struct atk_data *data) |
| 788 | { |
| 789 | struct device *dev = &data->acpi_dev->dev; |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 790 | union acpi_object *pack; |
| 791 | int err; |
| 792 | int i; |
| 793 | |
| 794 | dev_dbg(dev, "Enumerating hwmon sensors\n"); |
| 795 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 796 | pack = atk_ggrp(data, ATK_MUX_HWMON); |
| 797 | if (IS_ERR(pack)) |
| 798 | return PTR_ERR(pack); |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 799 | |
| 800 | for (i = 0; i < pack->package.count; i++) { |
| 801 | union acpi_object *obj = &pack->package.elements[i]; |
| 802 | |
| 803 | atk_add_sensor(data, obj); |
| 804 | } |
| 805 | |
| 806 | err = data->voltage_count + data->temperature_count + data->fan_count; |
| 807 | |
Luca Tettamanti | 18e25555 | 2009-10-09 20:35:18 +0200 | [diff] [blame^] | 808 | ACPI_FREE(pack); |
Luca Tettamanti | 2c03d07 | 2009-04-07 15:32:59 +0200 | [diff] [blame] | 809 | return err; |
| 810 | } |
| 811 | |
| 812 | static int atk_create_files(struct atk_data *data) |
| 813 | { |
| 814 | struct atk_sensor_data *s; |
| 815 | int err; |
| 816 | |
| 817 | list_for_each_entry(s, &data->sensor_list, list) { |
| 818 | err = device_create_file(data->hwmon_dev, &s->input_attr); |
| 819 | if (err) |
| 820 | return err; |
| 821 | err = device_create_file(data->hwmon_dev, &s->label_attr); |
| 822 | if (err) |
| 823 | return err; |
| 824 | err = device_create_file(data->hwmon_dev, &s->limit1_attr); |
| 825 | if (err) |
| 826 | return err; |
| 827 | err = device_create_file(data->hwmon_dev, &s->limit2_attr); |
| 828 | if (err) |
| 829 | return err; |
| 830 | } |
| 831 | |
| 832 | err = device_create_file(data->hwmon_dev, &atk_name_attr); |
| 833 | |
| 834 | return err; |
| 835 | } |
| 836 | |
| 837 | static void atk_remove_files(struct atk_data *data) |
| 838 | { |
| 839 | struct atk_sensor_data *s; |
| 840 | |
| 841 | list_for_each_entry(s, &data->sensor_list, list) { |
| 842 | device_remove_file(data->hwmon_dev, &s->input_attr); |
| 843 | device_remove_file(data->hwmon_dev, &s->label_attr); |
| 844 | device_remove_file(data->hwmon_dev, &s->limit1_attr); |
| 845 | device_remove_file(data->hwmon_dev, &s->limit2_attr); |
| 846 | } |
| 847 | device_remove_file(data->hwmon_dev, &atk_name_attr); |
| 848 | } |
| 849 | |
| 850 | static void atk_free_sensors(struct atk_data *data) |
| 851 | { |
| 852 | struct list_head *head = &data->sensor_list; |
| 853 | struct atk_sensor_data *s, *tmp; |
| 854 | |
| 855 | list_for_each_entry_safe(s, tmp, head, list) { |
| 856 | kfree(s->acpi_name); |
| 857 | kfree(s); |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | static int atk_register_hwmon(struct atk_data *data) |
| 862 | { |
| 863 | struct device *dev = &data->acpi_dev->dev; |
| 864 | int err; |
| 865 | |
| 866 | dev_dbg(dev, "registering hwmon device\n"); |
| 867 | data->hwmon_dev = hwmon_device_register(dev); |
| 868 | if (IS_ERR(data->hwmon_dev)) |
| 869 | return PTR_ERR(data->hwmon_dev); |
| 870 | |
| 871 | dev_dbg(dev, "populating sysfs directory\n"); |
| 872 | err = atk_create_files(data); |
| 873 | if (err) |
| 874 | goto remove; |
| 875 | |
| 876 | return 0; |
| 877 | remove: |
| 878 | /* Cleanup the registered files */ |
| 879 | atk_remove_files(data); |
| 880 | hwmon_device_unregister(data->hwmon_dev); |
| 881 | return err; |
| 882 | } |
| 883 | |
| 884 | static int atk_check_old_if(struct atk_data *data) |
| 885 | { |
| 886 | struct device *dev = &data->acpi_dev->dev; |
| 887 | acpi_handle ret; |
| 888 | acpi_status status; |
| 889 | |
| 890 | /* RTMP: read temperature */ |
| 891 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret); |
| 892 | if (status != AE_OK) { |
| 893 | dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n", |
| 894 | acpi_format_exception(status)); |
| 895 | return -ENODEV; |
| 896 | } |
| 897 | data->rtmp_handle = ret; |
| 898 | |
| 899 | /* RVLT: read voltage */ |
| 900 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret); |
| 901 | if (status != AE_OK) { |
| 902 | dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n", |
| 903 | acpi_format_exception(status)); |
| 904 | return -ENODEV; |
| 905 | } |
| 906 | data->rvlt_handle = ret; |
| 907 | |
| 908 | /* RFAN: read fan status */ |
| 909 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret); |
| 910 | if (status != AE_OK) { |
| 911 | dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n", |
| 912 | acpi_format_exception(status)); |
| 913 | return -ENODEV; |
| 914 | } |
| 915 | data->rfan_handle = ret; |
| 916 | |
| 917 | return 0; |
| 918 | } |
| 919 | |
| 920 | static int atk_check_new_if(struct atk_data *data) |
| 921 | { |
| 922 | struct device *dev = &data->acpi_dev->dev; |
| 923 | acpi_handle ret; |
| 924 | acpi_status status; |
| 925 | |
| 926 | /* Enumeration */ |
| 927 | status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret); |
| 928 | if (status != AE_OK) { |
| 929 | dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n", |
| 930 | acpi_format_exception(status)); |
| 931 | return -ENODEV; |
| 932 | } |
| 933 | data->enumerate_handle = ret; |
| 934 | |
| 935 | /* De-multiplexer (read) */ |
| 936 | status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret); |
| 937 | if (status != AE_OK) { |
| 938 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", |
| 939 | acpi_format_exception(status)); |
| 940 | return -ENODEV; |
| 941 | } |
| 942 | data->read_handle = ret; |
| 943 | |
| 944 | return 0; |
| 945 | } |
| 946 | |
| 947 | static int atk_add(struct acpi_device *device) |
| 948 | { |
| 949 | acpi_status ret; |
| 950 | int err; |
| 951 | struct acpi_buffer buf; |
| 952 | union acpi_object *obj; |
| 953 | struct atk_data *data; |
| 954 | |
| 955 | dev_dbg(&device->dev, "adding...\n"); |
| 956 | |
| 957 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 958 | if (!data) |
| 959 | return -ENOMEM; |
| 960 | |
| 961 | data->acpi_dev = device; |
| 962 | data->atk_handle = device->handle; |
| 963 | INIT_LIST_HEAD(&data->sensor_list); |
| 964 | |
| 965 | buf.length = ACPI_ALLOCATE_BUFFER; |
| 966 | ret = acpi_evaluate_object_typed(data->atk_handle, BOARD_ID, NULL, |
| 967 | &buf, ACPI_TYPE_PACKAGE); |
| 968 | if (ret != AE_OK) { |
| 969 | dev_dbg(&device->dev, "atk: method MBIF not found\n"); |
| 970 | err = -ENODEV; |
| 971 | goto out; |
| 972 | } |
| 973 | |
| 974 | obj = buf.pointer; |
| 975 | if (obj->package.count >= 2 && |
| 976 | obj->package.elements[1].type == ACPI_TYPE_STRING) { |
| 977 | dev_dbg(&device->dev, "board ID = %s\n", |
| 978 | obj->package.elements[1].string.pointer); |
| 979 | } |
| 980 | ACPI_FREE(buf.pointer); |
| 981 | |
| 982 | /* Check for hwmon methods: first check "old" style methods; note that |
| 983 | * both may be present: in this case we stick to the old interface; |
| 984 | * analysis of multiple DSDTs indicates that when both interfaces |
| 985 | * are present the new one (GGRP/GITM) is not functional. |
| 986 | */ |
| 987 | err = atk_check_old_if(data); |
| 988 | if (!err) { |
| 989 | dev_dbg(&device->dev, "Using old hwmon interface\n"); |
| 990 | data->old_interface = true; |
| 991 | } else { |
| 992 | err = atk_check_new_if(data); |
| 993 | if (err) |
| 994 | goto out; |
| 995 | |
| 996 | dev_dbg(&device->dev, "Using new hwmon interface\n"); |
| 997 | data->old_interface = false; |
| 998 | } |
| 999 | |
| 1000 | if (data->old_interface) |
| 1001 | err = atk_enumerate_old_hwmon(data); |
| 1002 | else |
| 1003 | err = atk_enumerate_new_hwmon(data); |
| 1004 | if (err < 0) |
| 1005 | goto out; |
| 1006 | if (err == 0) { |
| 1007 | dev_info(&device->dev, |
| 1008 | "No usable sensor detected, bailing out\n"); |
| 1009 | err = -ENODEV; |
| 1010 | goto out; |
| 1011 | } |
| 1012 | |
| 1013 | err = atk_register_hwmon(data); |
| 1014 | if (err) |
| 1015 | goto cleanup; |
| 1016 | |
| 1017 | device->driver_data = data; |
| 1018 | return 0; |
| 1019 | cleanup: |
| 1020 | atk_free_sensors(data); |
| 1021 | out: |
| 1022 | kfree(data); |
| 1023 | return err; |
| 1024 | } |
| 1025 | |
| 1026 | static int atk_remove(struct acpi_device *device, int type) |
| 1027 | { |
| 1028 | struct atk_data *data = device->driver_data; |
| 1029 | dev_dbg(&device->dev, "removing...\n"); |
| 1030 | |
| 1031 | device->driver_data = NULL; |
| 1032 | |
| 1033 | atk_remove_files(data); |
| 1034 | atk_free_sensors(data); |
| 1035 | hwmon_device_unregister(data->hwmon_dev); |
| 1036 | |
| 1037 | kfree(data); |
| 1038 | |
| 1039 | return 0; |
| 1040 | } |
| 1041 | |
| 1042 | static int __init atk0110_init(void) |
| 1043 | { |
| 1044 | int ret; |
| 1045 | |
| 1046 | ret = acpi_bus_register_driver(&atk_driver); |
| 1047 | if (ret) |
| 1048 | pr_info("atk: acpi_bus_register_driver failed: %d\n", ret); |
| 1049 | |
| 1050 | return ret; |
| 1051 | } |
| 1052 | |
| 1053 | static void __exit atk0110_exit(void) |
| 1054 | { |
| 1055 | acpi_bus_unregister_driver(&atk_driver); |
| 1056 | } |
| 1057 | |
| 1058 | module_init(atk0110_init); |
| 1059 | module_exit(atk0110_exit); |
| 1060 | |
| 1061 | MODULE_LICENSE("GPL"); |