| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * amc6821.c - Part of lm_sensors, Linux kernel modules for hardware |
|---|
| 3 | 4 | * monitoring |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Based on max6650.c: |
|---|
| 7 | 8 | * Copyright (C) 2007 Hans J. Koch <hjk@hansjkoch.de> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | | - * (at your option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public License |
|---|
| 20 | | - * along with this program; if not, write to the Free Software |
|---|
| 21 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 22 | 9 | */ |
|---|
| 23 | 10 | |
|---|
| 24 | 11 | #include <linux/kernel.h> /* Needed for KERN_INFO */ |
|---|
| .. | .. |
|---|
| 44 | 31 | */ |
|---|
| 45 | 32 | |
|---|
| 46 | 33 | static int pwminv; /*Inverted PWM output. */ |
|---|
| 47 | | -module_param(pwminv, int, S_IRUGO); |
|---|
| 34 | +module_param(pwminv, int, 0444); |
|---|
| 48 | 35 | |
|---|
| 49 | 36 | static int init = 1; /*Power-on initialization.*/ |
|---|
| 50 | | -module_param(init, int, S_IRUGO); |
|---|
| 37 | +module_param(init, int, 0444); |
|---|
| 51 | 38 | |
|---|
| 52 | 39 | enum chips { amc6821 }; |
|---|
| 53 | 40 | |
|---|
| .. | .. |
|---|
| 277 | 264 | return data; |
|---|
| 278 | 265 | } |
|---|
| 279 | 266 | |
|---|
| 280 | | -static ssize_t get_temp( |
|---|
| 281 | | - struct device *dev, |
|---|
| 282 | | - struct device_attribute *devattr, |
|---|
| 283 | | - char *buf) |
|---|
| 267 | +static ssize_t temp_show(struct device *dev, struct device_attribute *devattr, |
|---|
| 268 | + char *buf) |
|---|
| 284 | 269 | { |
|---|
| 285 | 270 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 286 | 271 | int ix = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 288 | 273 | return sprintf(buf, "%d\n", data->temp[ix] * 1000); |
|---|
| 289 | 274 | } |
|---|
| 290 | 275 | |
|---|
| 291 | | -static ssize_t set_temp( |
|---|
| 292 | | - struct device *dev, |
|---|
| 293 | | - struct device_attribute *attr, |
|---|
| 294 | | - const char *buf, |
|---|
| 295 | | - size_t count) |
|---|
| 276 | +static ssize_t temp_store(struct device *dev, struct device_attribute *attr, |
|---|
| 277 | + const char *buf, size_t count) |
|---|
| 296 | 278 | { |
|---|
| 297 | 279 | struct amc6821_data *data = dev_get_drvdata(dev); |
|---|
| 298 | 280 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 314 | 296 | return count; |
|---|
| 315 | 297 | } |
|---|
| 316 | 298 | |
|---|
| 317 | | -static ssize_t get_temp_alarm( |
|---|
| 318 | | - struct device *dev, |
|---|
| 319 | | - struct device_attribute *devattr, |
|---|
| 320 | | - char *buf) |
|---|
| 299 | +static ssize_t temp_alarm_show(struct device *dev, |
|---|
| 300 | + struct device_attribute *devattr, char *buf) |
|---|
| 321 | 301 | { |
|---|
| 322 | 302 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 323 | 303 | int ix = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 352 | 332 | return sprintf(buf, "0"); |
|---|
| 353 | 333 | } |
|---|
| 354 | 334 | |
|---|
| 355 | | -static ssize_t get_temp2_fault( |
|---|
| 356 | | - struct device *dev, |
|---|
| 357 | | - struct device_attribute *devattr, |
|---|
| 358 | | - char *buf) |
|---|
| 335 | +static ssize_t temp2_fault_show(struct device *dev, |
|---|
| 336 | + struct device_attribute *devattr, char *buf) |
|---|
| 359 | 337 | { |
|---|
| 360 | 338 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 361 | 339 | if (data->stat1 & AMC6821_STAT1_RTF) |
|---|
| .. | .. |
|---|
| 364 | 342 | return sprintf(buf, "0"); |
|---|
| 365 | 343 | } |
|---|
| 366 | 344 | |
|---|
| 367 | | -static ssize_t get_pwm1( |
|---|
| 368 | | - struct device *dev, |
|---|
| 369 | | - struct device_attribute *devattr, |
|---|
| 370 | | - char *buf) |
|---|
| 345 | +static ssize_t pwm1_show(struct device *dev, struct device_attribute *devattr, |
|---|
| 346 | + char *buf) |
|---|
| 371 | 347 | { |
|---|
| 372 | 348 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 373 | 349 | return sprintf(buf, "%d\n", data->pwm1); |
|---|
| 374 | 350 | } |
|---|
| 375 | 351 | |
|---|
| 376 | | -static ssize_t set_pwm1( |
|---|
| 377 | | - struct device *dev, |
|---|
| 378 | | - struct device_attribute *devattr, |
|---|
| 379 | | - const char *buf, |
|---|
| 380 | | - size_t count) |
|---|
| 352 | +static ssize_t pwm1_store(struct device *dev, |
|---|
| 353 | + struct device_attribute *devattr, const char *buf, |
|---|
| 354 | + size_t count) |
|---|
| 381 | 355 | { |
|---|
| 382 | 356 | struct amc6821_data *data = dev_get_drvdata(dev); |
|---|
| 383 | 357 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 393 | 367 | return count; |
|---|
| 394 | 368 | } |
|---|
| 395 | 369 | |
|---|
| 396 | | -static ssize_t get_pwm1_enable( |
|---|
| 397 | | - struct device *dev, |
|---|
| 398 | | - struct device_attribute *devattr, |
|---|
| 399 | | - char *buf) |
|---|
| 370 | +static ssize_t pwm1_enable_show(struct device *dev, |
|---|
| 371 | + struct device_attribute *devattr, char *buf) |
|---|
| 400 | 372 | { |
|---|
| 401 | 373 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 402 | 374 | return sprintf(buf, "%d\n", data->pwm1_enable); |
|---|
| 403 | 375 | } |
|---|
| 404 | 376 | |
|---|
| 405 | | -static ssize_t set_pwm1_enable( |
|---|
| 406 | | - struct device *dev, |
|---|
| 407 | | - struct device_attribute *attr, |
|---|
| 408 | | - const char *buf, |
|---|
| 409 | | - size_t count) |
|---|
| 377 | +static ssize_t pwm1_enable_store(struct device *dev, |
|---|
| 378 | + struct device_attribute *attr, |
|---|
| 379 | + const char *buf, size_t count) |
|---|
| 410 | 380 | { |
|---|
| 411 | 381 | struct amc6821_data *data = dev_get_drvdata(dev); |
|---|
| 412 | 382 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 451 | 421 | return count; |
|---|
| 452 | 422 | } |
|---|
| 453 | 423 | |
|---|
| 454 | | -static ssize_t get_pwm1_auto_channels_temp( |
|---|
| 455 | | - struct device *dev, |
|---|
| 456 | | - struct device_attribute *devattr, |
|---|
| 457 | | - char *buf) |
|---|
| 424 | +static ssize_t pwm1_auto_channels_temp_show(struct device *dev, |
|---|
| 425 | + struct device_attribute *devattr, |
|---|
| 426 | + char *buf) |
|---|
| 458 | 427 | { |
|---|
| 459 | 428 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 460 | 429 | return sprintf(buf, "%d\n", data->pwm1_auto_channels_temp); |
|---|
| 461 | 430 | } |
|---|
| 462 | 431 | |
|---|
| 463 | | -static ssize_t get_temp_auto_point_temp( |
|---|
| 464 | | - struct device *dev, |
|---|
| 465 | | - struct device_attribute *devattr, |
|---|
| 466 | | - char *buf) |
|---|
| 432 | +static ssize_t temp_auto_point_temp_show(struct device *dev, |
|---|
| 433 | + struct device_attribute *devattr, |
|---|
| 434 | + char *buf) |
|---|
| 467 | 435 | { |
|---|
| 468 | 436 | int ix = to_sensor_dev_attr_2(devattr)->index; |
|---|
| 469 | 437 | int nr = to_sensor_dev_attr_2(devattr)->nr; |
|---|
| .. | .. |
|---|
| 481 | 449 | } |
|---|
| 482 | 450 | } |
|---|
| 483 | 451 | |
|---|
| 484 | | -static ssize_t get_pwm1_auto_point_pwm( |
|---|
| 485 | | - struct device *dev, |
|---|
| 486 | | - struct device_attribute *devattr, |
|---|
| 487 | | - char *buf) |
|---|
| 452 | +static ssize_t pwm1_auto_point_pwm_show(struct device *dev, |
|---|
| 453 | + struct device_attribute *devattr, |
|---|
| 454 | + char *buf) |
|---|
| 488 | 455 | { |
|---|
| 489 | 456 | int ix = to_sensor_dev_attr(devattr)->index; |
|---|
| 490 | 457 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| .. | .. |
|---|
| 513 | 480 | return 0; |
|---|
| 514 | 481 | } |
|---|
| 515 | 482 | |
|---|
| 516 | | -static ssize_t set_temp_auto_point_temp( |
|---|
| 517 | | - struct device *dev, |
|---|
| 518 | | - struct device_attribute *attr, |
|---|
| 519 | | - const char *buf, |
|---|
| 520 | | - size_t count) |
|---|
| 483 | +static ssize_t temp_auto_point_temp_store(struct device *dev, |
|---|
| 484 | + struct device_attribute *attr, |
|---|
| 485 | + const char *buf, size_t count) |
|---|
| 521 | 486 | { |
|---|
| 522 | 487 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 523 | 488 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 586 | 551 | return count; |
|---|
| 587 | 552 | } |
|---|
| 588 | 553 | |
|---|
| 589 | | -static ssize_t set_pwm1_auto_point_pwm( |
|---|
| 590 | | - struct device *dev, |
|---|
| 591 | | - struct device_attribute *attr, |
|---|
| 592 | | - const char *buf, |
|---|
| 593 | | - size_t count) |
|---|
| 554 | +static ssize_t pwm1_auto_point_pwm_store(struct device *dev, |
|---|
| 555 | + struct device_attribute *attr, |
|---|
| 556 | + const char *buf, size_t count) |
|---|
| 594 | 557 | { |
|---|
| 595 | 558 | struct amc6821_data *data = dev_get_drvdata(dev); |
|---|
| 596 | 559 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 626 | 589 | return count; |
|---|
| 627 | 590 | } |
|---|
| 628 | 591 | |
|---|
| 629 | | -static ssize_t get_fan( |
|---|
| 630 | | - struct device *dev, |
|---|
| 631 | | - struct device_attribute *devattr, |
|---|
| 632 | | - char *buf) |
|---|
| 592 | +static ssize_t fan_show(struct device *dev, struct device_attribute *devattr, |
|---|
| 593 | + char *buf) |
|---|
| 633 | 594 | { |
|---|
| 634 | 595 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 635 | 596 | int ix = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 638 | 599 | return sprintf(buf, "%d\n", (int)(6000000 / data->fan[ix])); |
|---|
| 639 | 600 | } |
|---|
| 640 | 601 | |
|---|
| 641 | | -static ssize_t get_fan1_fault( |
|---|
| 642 | | - struct device *dev, |
|---|
| 643 | | - struct device_attribute *devattr, |
|---|
| 644 | | - char *buf) |
|---|
| 602 | +static ssize_t fan1_fault_show(struct device *dev, |
|---|
| 603 | + struct device_attribute *devattr, char *buf) |
|---|
| 645 | 604 | { |
|---|
| 646 | 605 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 647 | 606 | if (data->stat1 & AMC6821_STAT1_FANS) |
|---|
| .. | .. |
|---|
| 650 | 609 | return sprintf(buf, "0"); |
|---|
| 651 | 610 | } |
|---|
| 652 | 611 | |
|---|
| 653 | | -static ssize_t set_fan( |
|---|
| 654 | | - struct device *dev, |
|---|
| 655 | | - struct device_attribute *attr, |
|---|
| 656 | | - const char *buf, size_t count) |
|---|
| 612 | +static ssize_t fan_store(struct device *dev, struct device_attribute *attr, |
|---|
| 613 | + const char *buf, size_t count) |
|---|
| 657 | 614 | { |
|---|
| 658 | 615 | struct amc6821_data *data = dev_get_drvdata(dev); |
|---|
| 659 | 616 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 682 | 639 | return count; |
|---|
| 683 | 640 | } |
|---|
| 684 | 641 | |
|---|
| 685 | | -static ssize_t get_fan1_div( |
|---|
| 686 | | - struct device *dev, |
|---|
| 687 | | - struct device_attribute *devattr, |
|---|
| 688 | | - char *buf) |
|---|
| 642 | +static ssize_t fan1_div_show(struct device *dev, |
|---|
| 643 | + struct device_attribute *devattr, char *buf) |
|---|
| 689 | 644 | { |
|---|
| 690 | 645 | struct amc6821_data *data = amc6821_update_device(dev); |
|---|
| 691 | 646 | return sprintf(buf, "%d\n", data->fan1_div); |
|---|
| 692 | 647 | } |
|---|
| 693 | 648 | |
|---|
| 694 | | -static ssize_t set_fan1_div( |
|---|
| 695 | | - struct device *dev, |
|---|
| 696 | | - struct device_attribute *attr, |
|---|
| 697 | | - const char *buf, size_t count) |
|---|
| 649 | +static ssize_t fan1_div_store(struct device *dev, |
|---|
| 650 | + struct device_attribute *attr, const char *buf, |
|---|
| 651 | + size_t count) |
|---|
| 698 | 652 | { |
|---|
| 699 | 653 | struct amc6821_data *data = dev_get_drvdata(dev); |
|---|
| 700 | 654 | struct i2c_client *client = data->client; |
|---|
| .. | .. |
|---|
| 734 | 688 | return count; |
|---|
| 735 | 689 | } |
|---|
| 736 | 690 | |
|---|
| 737 | | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, |
|---|
| 738 | | - get_temp, NULL, IDX_TEMP1_INPUT); |
|---|
| 739 | | -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, get_temp, |
|---|
| 740 | | - set_temp, IDX_TEMP1_MIN); |
|---|
| 741 | | -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, get_temp, |
|---|
| 742 | | - set_temp, IDX_TEMP1_MAX); |
|---|
| 743 | | -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO | S_IWUSR, get_temp, |
|---|
| 744 | | - set_temp, IDX_TEMP1_CRIT); |
|---|
| 745 | | -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, |
|---|
| 746 | | - get_temp_alarm, NULL, IDX_TEMP1_MIN); |
|---|
| 747 | | -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, |
|---|
| 748 | | - get_temp_alarm, NULL, IDX_TEMP1_MAX); |
|---|
| 749 | | -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, |
|---|
| 750 | | - get_temp_alarm, NULL, IDX_TEMP1_CRIT); |
|---|
| 751 | | -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, |
|---|
| 752 | | - get_temp, NULL, IDX_TEMP2_INPUT); |
|---|
| 753 | | -static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, |
|---|
| 754 | | - set_temp, IDX_TEMP2_MIN); |
|---|
| 755 | | -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO | S_IWUSR, get_temp, |
|---|
| 756 | | - set_temp, IDX_TEMP2_MAX); |
|---|
| 757 | | -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO | S_IWUSR, get_temp, |
|---|
| 758 | | - set_temp, IDX_TEMP2_CRIT); |
|---|
| 759 | | -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, |
|---|
| 760 | | - get_temp2_fault, NULL, 0); |
|---|
| 761 | | -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, |
|---|
| 762 | | - get_temp_alarm, NULL, IDX_TEMP2_MIN); |
|---|
| 763 | | -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, |
|---|
| 764 | | - get_temp_alarm, NULL, IDX_TEMP2_MAX); |
|---|
| 765 | | -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, |
|---|
| 766 | | - get_temp_alarm, NULL, IDX_TEMP2_CRIT); |
|---|
| 767 | | -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, get_fan, NULL, IDX_FAN1_INPUT); |
|---|
| 768 | | -static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO | S_IWUSR, |
|---|
| 769 | | - get_fan, set_fan, IDX_FAN1_MIN); |
|---|
| 770 | | -static SENSOR_DEVICE_ATTR(fan1_max, S_IRUGO | S_IWUSR, |
|---|
| 771 | | - get_fan, set_fan, IDX_FAN1_MAX); |
|---|
| 772 | | -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, get_fan1_fault, NULL, 0); |
|---|
| 773 | | -static SENSOR_DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR, |
|---|
| 774 | | - get_fan1_div, set_fan1_div, 0); |
|---|
| 691 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, IDX_TEMP1_INPUT); |
|---|
| 692 | +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, IDX_TEMP1_MIN); |
|---|
| 693 | +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, IDX_TEMP1_MAX); |
|---|
| 694 | +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp, IDX_TEMP1_CRIT); |
|---|
| 695 | +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_alarm, IDX_TEMP1_MIN); |
|---|
| 696 | +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_alarm, IDX_TEMP1_MAX); |
|---|
| 697 | +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_alarm, IDX_TEMP1_CRIT); |
|---|
| 698 | +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, IDX_TEMP2_INPUT); |
|---|
| 699 | +static SENSOR_DEVICE_ATTR_RW(temp2_min, temp, IDX_TEMP2_MIN); |
|---|
| 700 | +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp, IDX_TEMP2_MAX); |
|---|
| 701 | +static SENSOR_DEVICE_ATTR_RW(temp2_crit, temp, IDX_TEMP2_CRIT); |
|---|
| 702 | +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp2_fault, 0); |
|---|
| 703 | +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_alarm, IDX_TEMP2_MIN); |
|---|
| 704 | +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_alarm, IDX_TEMP2_MAX); |
|---|
| 705 | +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_alarm, IDX_TEMP2_CRIT); |
|---|
| 706 | +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, IDX_FAN1_INPUT); |
|---|
| 707 | +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan, IDX_FAN1_MIN); |
|---|
| 708 | +static SENSOR_DEVICE_ATTR_RW(fan1_max, fan, IDX_FAN1_MAX); |
|---|
| 709 | +static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan1_fault, 0); |
|---|
| 710 | +static SENSOR_DEVICE_ATTR_RW(fan1_div, fan1_div, 0); |
|---|
| 775 | 711 | |
|---|
| 776 | | -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, get_pwm1, set_pwm1, 0); |
|---|
| 777 | | -static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, |
|---|
| 778 | | - get_pwm1_enable, set_pwm1_enable, 0); |
|---|
| 779 | | -static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO, |
|---|
| 780 | | - get_pwm1_auto_point_pwm, NULL, 0); |
|---|
| 781 | | -static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IWUSR | S_IRUGO, |
|---|
| 782 | | - get_pwm1_auto_point_pwm, set_pwm1_auto_point_pwm, 1); |
|---|
| 783 | | -static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO, |
|---|
| 784 | | - get_pwm1_auto_point_pwm, NULL, 2); |
|---|
| 785 | | -static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IRUGO, |
|---|
| 786 | | - get_pwm1_auto_channels_temp, NULL, 0); |
|---|
| 787 | | -static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO, |
|---|
| 788 | | - get_temp_auto_point_temp, NULL, 1, 0); |
|---|
| 789 | | -static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IWUSR | S_IRUGO, |
|---|
| 790 | | - get_temp_auto_point_temp, set_temp_auto_point_temp, 1, 1); |
|---|
| 791 | | -static SENSOR_DEVICE_ATTR_2(temp1_auto_point3_temp, S_IWUSR | S_IRUGO, |
|---|
| 792 | | - get_temp_auto_point_temp, set_temp_auto_point_temp, 1, 2); |
|---|
| 712 | +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm1, 0); |
|---|
| 713 | +static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm1_enable, 0); |
|---|
| 714 | +static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm1_auto_point_pwm, 0); |
|---|
| 715 | +static SENSOR_DEVICE_ATTR_RW(pwm1_auto_point2_pwm, pwm1_auto_point_pwm, 1); |
|---|
| 716 | +static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point3_pwm, pwm1_auto_point_pwm, 2); |
|---|
| 717 | +static SENSOR_DEVICE_ATTR_RO(pwm1_auto_channels_temp, pwm1_auto_channels_temp, |
|---|
| 718 | + 0); |
|---|
| 719 | +static SENSOR_DEVICE_ATTR_2_RO(temp1_auto_point1_temp, temp_auto_point_temp, |
|---|
| 720 | + 1, 0); |
|---|
| 721 | +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_point2_temp, temp_auto_point_temp, |
|---|
| 722 | + 1, 1); |
|---|
| 723 | +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_point3_temp, temp_auto_point_temp, |
|---|
| 724 | + 1, 2); |
|---|
| 793 | 725 | |
|---|
| 794 | | -static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IWUSR | S_IRUGO, |
|---|
| 795 | | - get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 0); |
|---|
| 796 | | -static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IWUSR | S_IRUGO, |
|---|
| 797 | | - get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 1); |
|---|
| 798 | | -static SENSOR_DEVICE_ATTR_2(temp2_auto_point3_temp, S_IWUSR | S_IRUGO, |
|---|
| 799 | | - get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 2); |
|---|
| 726 | +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_point1_temp, temp_auto_point_temp, |
|---|
| 727 | + 2, 0); |
|---|
| 728 | +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_point2_temp, temp_auto_point_temp, |
|---|
| 729 | + 2, 1); |
|---|
| 730 | +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_point3_temp, temp_auto_point_temp, |
|---|
| 731 | + 2, 2); |
|---|
| 800 | 732 | |
|---|
| 801 | 733 | static struct attribute *amc6821_attrs[] = { |
|---|
| 802 | 734 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
|---|
| .. | .. |
|---|
| 968 | 900 | return 0; |
|---|
| 969 | 901 | } |
|---|
| 970 | 902 | |
|---|
| 971 | | -static int amc6821_probe(struct i2c_client *client, |
|---|
| 972 | | - const struct i2c_device_id *id) |
|---|
| 903 | +static int amc6821_probe(struct i2c_client *client) |
|---|
| 973 | 904 | { |
|---|
| 974 | 905 | struct device *dev = &client->dev; |
|---|
| 975 | 906 | struct amc6821_data *data; |
|---|
| .. | .. |
|---|
| 1008 | 939 | .driver = { |
|---|
| 1009 | 940 | .name = "amc6821", |
|---|
| 1010 | 941 | }, |
|---|
| 1011 | | - .probe = amc6821_probe, |
|---|
| 942 | + .probe_new = amc6821_probe, |
|---|
| 1012 | 943 | .id_table = amc6821_id, |
|---|
| 1013 | 944 | .detect = amc6821_detect, |
|---|
| 1014 | 945 | .address_list = normal_i2c, |
|---|