w83627ehf.c (cb54b53adae70701bdd77d848cea4b9b39b61cf9) | w83627ehf.c (a8b3a3a53f9a814e9938ea9cc179086ff5c0a387) |
---|---|
1/* 2 * w83627ehf - Driver for the hardware monitoring functionality of 3 * the Winbond W83627EHF Super-I/O chip 4 * Copyright (C) 2005-2012 Jean Delvare <khali@linux-fr.org> 5 * Copyright (C) 2006 Yuan Mu (Winbond), 6 * Rudolf Marek <r.marek@assembler.cz> 7 * David Hubbard <david.c.hubbard@gmail.com> 8 * Daniel J Blueman <daniel.blueman@gmail.com> --- 659 unchanged lines hidden (view full) --- 668 w83627ehf_write_value(data, W83627EHF_REG_DIODE, reg); 669 break; 670 } 671} 672 673static void w83627ehf_write_fan_div_common(struct device *dev, 674 struct w83627ehf_data *data, int nr) 675{ | 1/* 2 * w83627ehf - Driver for the hardware monitoring functionality of 3 * the Winbond W83627EHF Super-I/O chip 4 * Copyright (C) 2005-2012 Jean Delvare <khali@linux-fr.org> 5 * Copyright (C) 2006 Yuan Mu (Winbond), 6 * Rudolf Marek <r.marek@assembler.cz> 7 * David Hubbard <david.c.hubbard@gmail.com> 8 * Daniel J Blueman <daniel.blueman@gmail.com> --- 659 unchanged lines hidden (view full) --- 668 w83627ehf_write_value(data, W83627EHF_REG_DIODE, reg); 669 break; 670 } 671} 672 673static void w83627ehf_write_fan_div_common(struct device *dev, 674 struct w83627ehf_data *data, int nr) 675{ |
676 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 676 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
677 678 if (sio_data->kind == nct6776) 679 ; /* no dividers, do nothing */ 680 else if (sio_data->kind == nct6775) 681 nct6775_write_fan_div(data, nr); 682 else 683 w83627ehf_write_fan_div(data, nr); 684} --- 34 unchanged lines hidden (view full) --- 719 i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT); 720 data->fan_div[3] |= (i >> 5) & 0x04; 721 } 722} 723 724static void w83627ehf_update_fan_div_common(struct device *dev, 725 struct w83627ehf_data *data) 726{ | 677 678 if (sio_data->kind == nct6776) 679 ; /* no dividers, do nothing */ 680 else if (sio_data->kind == nct6775) 681 nct6775_write_fan_div(data, nr); 682 else 683 w83627ehf_write_fan_div(data, nr); 684} --- 34 unchanged lines hidden (view full) --- 719 i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT); 720 data->fan_div[3] |= (i >> 5) & 0x04; 721 } 722} 723 724static void w83627ehf_update_fan_div_common(struct device *dev, 725 struct w83627ehf_data *data) 726{ |
727 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 727 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
728 729 if (sio_data->kind == nct6776) 730 ; /* no dividers, do nothing */ 731 else if (sio_data->kind == nct6775) 732 nct6775_update_fan_div(data); 733 else 734 w83627ehf_update_fan_div(data); 735} --- 40 unchanged lines hidden (view full) --- 776 777 data->tolerance[i] = (tolerance >> (i == 1 ? 4 : 0)) & 0x0f; 778 } 779} 780 781static void w83627ehf_update_pwm_common(struct device *dev, 782 struct w83627ehf_data *data) 783{ | 728 729 if (sio_data->kind == nct6776) 730 ; /* no dividers, do nothing */ 731 else if (sio_data->kind == nct6775) 732 nct6775_update_fan_div(data); 733 else 734 w83627ehf_update_fan_div(data); 735} --- 40 unchanged lines hidden (view full) --- 776 777 data->tolerance[i] = (tolerance >> (i == 1 ? 4 : 0)) & 0x0f; 778 } 779} 780 781static void w83627ehf_update_pwm_common(struct device *dev, 782 struct w83627ehf_data *data) 783{ |
784 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 784 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
785 786 if (sio_data->kind == nct6775 || sio_data->kind == nct6776) 787 nct6775_update_pwm(data); 788 else 789 w83627ehf_update_pwm(data); 790} 791 792static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) 793{ 794 struct w83627ehf_data *data = dev_get_drvdata(dev); | 785 786 if (sio_data->kind == nct6775 || sio_data->kind == nct6776) 787 nct6775_update_pwm(data); 788 else 789 w83627ehf_update_pwm(data); 790} 791 792static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) 793{ 794 struct w83627ehf_data *data = dev_get_drvdata(dev); |
795 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 795 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
796 797 int i; 798 799 mutex_lock(&data->update_lock); 800 801 if (time_after(jiffies, data->last_updated + HZ + HZ/2) 802 || !data->valid) { 803 /* Fan clock dividers */ --- 583 unchanged lines hidden (view full) --- 1387show_pwm_reg(pwm) 1388 1389static ssize_t 1390store_pwm_mode(struct device *dev, struct device_attribute *attr, 1391 const char *buf, size_t count) 1392{ 1393 struct w83627ehf_data *data = dev_get_drvdata(dev); 1394 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 796 797 int i; 798 799 mutex_lock(&data->update_lock); 800 801 if (time_after(jiffies, data->last_updated + HZ + HZ/2) 802 || !data->valid) { 803 /* Fan clock dividers */ --- 583 unchanged lines hidden (view full) --- 1387show_pwm_reg(pwm) 1388 1389static ssize_t 1390store_pwm_mode(struct device *dev, struct device_attribute *attr, 1391 const char *buf, size_t count) 1392{ 1393 struct w83627ehf_data *data = dev_get_drvdata(dev); 1394 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
1395 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 1395 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
1396 int nr = sensor_attr->index; 1397 unsigned long val; 1398 int err; 1399 u16 reg; 1400 1401 err = kstrtoul(buf, 10, &val); 1402 if (err < 0) 1403 return err; --- 39 unchanged lines hidden (view full) --- 1443 return count; 1444} 1445 1446static ssize_t 1447store_pwm_enable(struct device *dev, struct device_attribute *attr, 1448 const char *buf, size_t count) 1449{ 1450 struct w83627ehf_data *data = dev_get_drvdata(dev); | 1396 int nr = sensor_attr->index; 1397 unsigned long val; 1398 int err; 1399 u16 reg; 1400 1401 err = kstrtoul(buf, 10, &val); 1402 if (err < 0) 1403 return err; --- 39 unchanged lines hidden (view full) --- 1443 return count; 1444} 1445 1446static ssize_t 1447store_pwm_enable(struct device *dev, struct device_attribute *attr, 1448 const char *buf, size_t count) 1449{ 1450 struct w83627ehf_data *data = dev_get_drvdata(dev); |
1451 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 1451 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
1452 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1453 int nr = sensor_attr->index; 1454 unsigned long val; 1455 int err; 1456 u16 reg; 1457 1458 err = kstrtoul(buf, 10, &val); 1459 if (err < 0) --- 62 unchanged lines hidden (view full) --- 1522 return count; 1523} 1524 1525static ssize_t 1526store_tolerance(struct device *dev, struct device_attribute *attr, 1527 const char *buf, size_t count) 1528{ 1529 struct w83627ehf_data *data = dev_get_drvdata(dev); | 1452 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1453 int nr = sensor_attr->index; 1454 unsigned long val; 1455 int err; 1456 u16 reg; 1457 1458 err = kstrtoul(buf, 10, &val); 1459 if (err < 0) --- 62 unchanged lines hidden (view full) --- 1522 return count; 1523} 1524 1525static ssize_t 1526store_tolerance(struct device *dev, struct device_attribute *attr, 1527 const char *buf, size_t count) 1528{ 1529 struct w83627ehf_data *data = dev_get_drvdata(dev); |
1530 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 1530 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
1531 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1532 int nr = sensor_attr->index; 1533 u16 reg; 1534 long val; 1535 int err; 1536 1537 err = kstrtol(buf, 10, &val); 1538 if (err < 0) --- 521 unchanged lines hidden (view full) --- 2060 data->has_fan_min |= (1 << 4); 2061 } 2062 } 2063} 2064 2065static int w83627ehf_probe(struct platform_device *pdev) 2066{ 2067 struct device *dev = &pdev->dev; | 1531 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1532 int nr = sensor_attr->index; 1533 u16 reg; 1534 long val; 1535 int err; 1536 1537 err = kstrtol(buf, 10, &val); 1538 if (err < 0) --- 521 unchanged lines hidden (view full) --- 2060 data->has_fan_min |= (1 << 4); 2061 } 2062 } 2063} 2064 2065static int w83627ehf_probe(struct platform_device *pdev) 2066{ 2067 struct device *dev = &pdev->dev; |
2068 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 2068 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
2069 struct w83627ehf_data *data; 2070 struct resource *res; 2071 u8 en_vrm10; 2072 int i, err = 0; 2073 2074 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 2075 if (!request_region(res->start, IOREGION_LENGTH, DRVNAME)) { 2076 err = -EBUSY; --- 536 unchanged lines hidden (view full) --- 2613 2614 return 0; 2615} 2616 2617#ifdef CONFIG_PM 2618static int w83627ehf_suspend(struct device *dev) 2619{ 2620 struct w83627ehf_data *data = w83627ehf_update_device(dev); | 2069 struct w83627ehf_data *data; 2070 struct resource *res; 2071 u8 en_vrm10; 2072 int i, err = 0; 2073 2074 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 2075 if (!request_region(res->start, IOREGION_LENGTH, DRVNAME)) { 2076 err = -EBUSY; --- 536 unchanged lines hidden (view full) --- 2613 2614 return 0; 2615} 2616 2617#ifdef CONFIG_PM 2618static int w83627ehf_suspend(struct device *dev) 2619{ 2620 struct w83627ehf_data *data = w83627ehf_update_device(dev); |
2621 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 2621 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
2622 2623 mutex_lock(&data->update_lock); 2624 data->vbat = w83627ehf_read_value(data, W83627EHF_REG_VBAT); 2625 if (sio_data->kind == nct6775) { 2626 data->fandiv1 = w83627ehf_read_value(data, NCT6775_REG_FANDIV1); 2627 data->fandiv2 = w83627ehf_read_value(data, NCT6775_REG_FANDIV2); 2628 } 2629 mutex_unlock(&data->update_lock); 2630 2631 return 0; 2632} 2633 2634static int w83627ehf_resume(struct device *dev) 2635{ 2636 struct w83627ehf_data *data = dev_get_drvdata(dev); | 2622 2623 mutex_lock(&data->update_lock); 2624 data->vbat = w83627ehf_read_value(data, W83627EHF_REG_VBAT); 2625 if (sio_data->kind == nct6775) { 2626 data->fandiv1 = w83627ehf_read_value(data, NCT6775_REG_FANDIV1); 2627 data->fandiv2 = w83627ehf_read_value(data, NCT6775_REG_FANDIV2); 2628 } 2629 mutex_unlock(&data->update_lock); 2630 2631 return 0; 2632} 2633 2634static int w83627ehf_resume(struct device *dev) 2635{ 2636 struct w83627ehf_data *data = dev_get_drvdata(dev); |
2637 struct w83627ehf_sio_data *sio_data = dev->platform_data; | 2637 struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); |
2638 int i; 2639 2640 mutex_lock(&data->update_lock); 2641 data->bank = 0xff; /* Force initial bank selection */ 2642 2643 /* Restore limits */ 2644 for (i = 0; i < data->in_num; i++) { 2645 if ((i == 6) && data->in6_skip) --- 250 unchanged lines hidden --- | 2638 int i; 2639 2640 mutex_lock(&data->update_lock); 2641 data->bank = 0xff; /* Force initial bank selection */ 2642 2643 /* Restore limits */ 2644 for (i = 0; i < data->in_num; i++) { 2645 if ((i == 6) && data->in6_skip) --- 250 unchanged lines hidden --- |