Commit Graph

50 Commits

Author SHA1 Message Date
Alexander Monakov 67712fa4a6 hwmon: (k10temp) Add AMD family 17h model 60h PCI match
commit 279f0b3a4b80660fba6faadc2ca2fa426bf3f7e9 upstream.

Add support for retrieving Tdie and Tctl on AMD Renoir (4000-series
Ryzen CPUs).

It appears SMU offsets for reading current/voltage and CCD temperature
have changed for this generation (reads from currently used offsets
yield zeros), so those features cannot be enabled so trivially.

Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lkml.kernel.org/r/20200510204842.2603-3-amonakov@ispras.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-22 09:31:19 +02:00
Marcel Bocu 12163cfbfc hwmon: (k10temp) Add support for AMD family 17h, model 70h CPUs
It would seem like model 70h is behaving in the same way as model 30h,
so let's just add the new F3 PCI ID to the list of compatible devices.

Unlike previous Ryzen/Threadripper, Ryzen gen 3 processors do not need
temperature offsets anymore. This has been reported in the press and
verified on my Ryzen 3700X by checking that the idle temperature
reported by k10temp is matching the temperature reported by the
firmware.

Vicki Pfau sent an identical patch after I checked that no-one had
written this patch. I would have been happy about dropping my patch but
unlike for his patch series, I had already Cc:ed the x86 people and
they already reviewed the changes. Since Vicki has not answered to
any email after his initial series, let's assume she is on vacation
and let's avoid duplication of reviews from the maintainers and merge
my series. To acknowledge Vicki's anteriority, I added her S-o-b to
the patch.

v2, suggested by Guenter Roeck and Brian Woods:
  - rename from 71h to 70h

Signed-off-by: Vicki Pfau <vi@endrift.com>
Signed-off-by: Marcel Bocu <marcel.p.bocu@gmail.com>
Tested-by: Marcel Bocu <marcel.p.bocu@gmail.com>

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: "Woods, Brian" <Brian.Woods@amd.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Link: https://lore.kernel.org/r/20190722174653.2391-1-marcel.p.bocu@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-09-03 12:47:17 -07:00
Thomas Gleixner 6e7c109443 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 56
Based on 1 normalized pattern(s):

  this driver is free software you can redistribute it and or modify
  it under the terms of the gnu general public license either version
  2 of the license or at your option any later version this driver is
  distributed in the hope that it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details you should have received a copy of the gnu general
  public license along with this driver if not see http www gnu org
  licenses

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 2 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.296418152@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24 17:36:43 +02:00
Linus Torvalds 8754040378 hwmon updates for v4.21
The big change in this series is for the most part automatic: Introducing
 SENSOR[_DEVICE]_ATTR_{RO,RW,WO} variants and conversion of various drivers
 to use it. This is similar to DEVICE_ATTR variants.
 
 Other than that, we have
 - Some conversions of S_<PERMS> with octal values, also automated
 - Added support for Hygon Dhyana CPUs to k10temp driver
 - Added support for STLM75 to lm75 driver
 - B57891S0103 to ntc_thermistor
 - Added pm-runtime support to ina3221 driver
 - Support for PowerPC On-Chip Controller (OCC)
 - Various minor bug fices and improvements
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJcHbaJAAoJEMsfJm/On5mB+IEP/R79N2zXdhtH3jPYhpdJiUIF
 gwXqP7mO9JliDyQBjqwutO2QE73Zdftr7UWvaryVnBySG3LTRBmDefhD5NyvaSna
 20yl0cIVqbo5cNaXlyhrZRE/ZAy6hyqGNNz28ArmNg9/w3S6dAwIUIrhy06tXrW8
 bOf/k3SGNIRvSeRaFJ/2Agh83e2Vg4ckCUvGW7YIUcXUlhQITO1m71hhqDLt0XY5
 enjpDafg0eSid0Jhy4aMWuiVRMdl7WR+2R+15Pm4HkH3SG/WDqNrpCcybDJoJeIv
 PIsFFj5ctwcnU7IDx12TOuIWJB3hhZyAe+WitYA71VAlWQ39/1FInZ2x1fgxW17Q
 lKQQYQaKa/4qNA44eEFLcsV7NiasOOwWYONWRHOvffCP6PvBmnD6VBZAhbz5dRCP
 8JjmS/yhUY35dPBeTHOXEEbifTMPNajZjQrr3DtyTeuQTeaOBgU/dprJBzU/I1ie
 +NYv0kEvRlWb39wZeiU1Pz93YhIcTy9EunqPhaay9P95AFn/lw1s9Ova+zrJh9oJ
 aYN0sXfSsPaa+EhgqpyzH62r4bn7BVtAIsYyPqcm7z6hGnY9eNQgAC/YQEpqJq0k
 wOlDb+3mLUXDPpnzoI9zg73dajTT3UAqpkjd0/ILpYltcfb5oTfbc/pRsUIjYIT2
 2y7VH2Vb1dFgUlrfmxjM
 =tRyC
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:
 "The big change in this series is for the most part automatic:
  Introducing SENSOR[_DEVICE]_ATTR_{RO,RW,WO} variants and conversion of
  various drivers to use it. This is similar to DEVICE_ATTR variants.

  Other than that, we have

   - Some conversions of S_<PERMS> with octal values, also automated

   - Added support for Hygon Dhyana CPUs to k10temp driver

   - Added support for STLM75 to lm75 driver

   - B57891S0103 to ntc_thermistor

   - Added pm-runtime support to ina3221 driver

   - Support for PowerPC On-Chip Controller (OCC)

   - Various minor bug fices and improvements"

* tag 'hwmon-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (80 commits)
  hwmon: (lm80) fix a missing check of bus read in lm80 probe
  hwmon: (lm80) fix a missing check of the status of SMBus read
  hwmon: (asus_atk0110) Fix debugfs_simple_attr.cocci warnings
  hwmon: (ftsteutates) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (fschmd) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (emc6w201) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (emc2103) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (emc1403) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (ds620) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (ds1621) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (dell-smm-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (da9055-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (da9052-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (coretemp) Replace S_<PERMS> with octal values
  hwmon: (asus_atk0110) Replace S_<PERMS> with octal values
  hwmon: (aspeed-pwm-tacho) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (applesmc) Replace S_<PERMS> with octal values
  hwmon: (amc6821) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (adt7x10) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (adt7475) Use permission specific SENSOR[_DEVICE]_ATTR variants
  ...
2018-12-28 19:48:25 -08:00
Pu Wen d93217d84c hwmon: (k10temp) Add Hygon Dhyana support
Add support for Hygon Dhyana family 18h processor for k10temp to get the
temperature. As Hygon Dhyana shares the same function interface with AMD
family 17h, so add Hygon PCI Vendor ID and reuse the code path of AMD.

Signed-off-by: Pu Wen <puwen@hygon.cn>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16 15:13:30 -08:00
Guenter Roeck fac5ba6f5b hwmon: (k10temp) Auto-convert to use SENSOR_DEVICE_ATTR_{RO, RW, WO}
Auto-conversion was done done using the coccinelle script at
https://github.com/groeck/coccinelle-patches/blob/master/hwmon/sensor-devattr-w6.cocci

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16 15:13:23 -08:00
Woods, Brian 210ba1201f hwmon/k10temp: Add support for AMD family 17h, model 30h CPUs
Add support for AMD family 17h model 30h processors for k10temp. Model
30h is functionally the same as model 01h processors (as far as k10temp
is concerned), just the PCI device IDs need to be updated.

Signed-off-by: Brian Woods <brian.woods@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
CC: Bjorn Helgaas <bhelgaas@google.com>
CC: Clemens Ladisch <clemens@ladisch.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: Jean Delvare <jdelvare@suse.com>
CC: Jia Zhang <qianyue.zj@alibaba-inc.com>
CC: <linux-hwmon@vger.kernel.org>
CC: <linux-pci@vger.kernel.org>
CC: Pu Wen <puwen@hygon.cn>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/20181106200754.60722-5-brian.woods@amd.com
2018-11-07 21:39:13 +01:00
Woods, Brian dedf7dce4c hwmon/k10temp, x86/amd_nb: Consolidate shared device IDs
Consolidate shared PCI_DEVICE_IDs that were scattered through k10temp
and amd_nb, and move them into pci_ids.

Signed-off-by: Brian Woods <brian.woods@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
CC: Bjorn Helgaas <bhelgaas@google.com>
CC: Clemens Ladisch <clemens@ladisch.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: Jean Delvare <jdelvare@suse.com>
CC: Jia Zhang <qianyue.zj@alibaba-inc.com>
CC: <linux-hwmon@vger.kernel.org>
CC: <linux-pci@vger.kernel.org>
CC: Pu Wen <puwen@hygon.cn>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/20181106200754.60722-2-brian.woods@amd.com
2018-11-07 21:28:04 +01:00
Guenter Roeck 53dfa0088e hwmon: (k10temp) Support all Family 15h Model 6xh and Model 7xh processors
BIOS developer guides refer to Family 15h Models 60h-6fh and Family 15h
Models 70h-7fh. So far the driver only checked for Models 60h and 70h.
However, there are now processors with other model numbers in the same
families. Example is A10-9620P family 15h model 65h. Follow the developer
guides and mask the lower 4 bit of the model number to determine the
registers to use for reading temperatures and temperature limits.

Reported-by: Guglielmo Fanini <g.fanini@gmail.com>
Cc: Guglielmo Fanini <g.fanini@gmail.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-10-10 20:37:13 -07:00
Guenter Roeck cd6a2064db hwmon: k10temp: Support Threadripper 2920X, 2970WX; simplify offset table
All announced Threadripper 29xx models have a temperature offset of
27 degrees C. Simplify temperature offset table to match all 29xx
Threadripper models with a single entry. Also simplify the table to match
all 19xx Threadripper models with a single entry. This effectively drops
entries for Threadripper 1910/1920/1950 which never saw the light of day.

Cc: Michael Larabel <Michael@phoronix.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-08-09 12:56:56 -07:00
Michael Larabel 484a84f25c hwmon: (k10temp) 27C Offset needed for Threadripper2
For at least the Threadripper 2950X and Threadripper 2990WX,
it's confirmed a 27 degree offset is needed.

Signed-off-by: Michael Larabel <michael@phoronix.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-08-07 09:18:32 -07:00
Colin Ian King fb8eefd3b4 hwmon: (k10temp) Make function get_raw_temp static
The function get_raw_temp is local to the source and does not need to
be in global scope, so make it static.

Cleans up sparse warning:
drivers/hwmon/k10temp.c:149:14: warning: symbol 'get_raw_temp' was not
declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-06-01 08:56:35 -07:00
Guenter Roeck f934c0599e hwmon: (k10temp) Display both Tctl and Tdie
On some AMD CPUs, there is a different between the die temperature
(Tdie) and the reported temperature (Tctl). Tdie is the real measured
temperature, and Tctl is used for fan control. Lets report both for
affected CPUs.

Tested-by: Gabriel Craciunescu <nix.or.die@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-05-21 07:51:58 -07:00
Guenter Roeck ccaf63b4d6 hwmon: (k10temp) Add support for Stoney Ridge and Bristol Ridge CPUs
Add support for Stoney Ridge and Bristol Ridge (Family 15h Model 0x70)
CPUs. Registers match those of Family 15h Model 0x60.

Cc: stable@vger.kernel.org # v4.16+
Tested-by: Gabriel Craciunescu <nix.or.die@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-05-21 07:51:57 -07:00
Guenter Roeck 3b031622f5 hwmon: (k10temp) Use API function to access System Management Network
The SMN (System Management Network) on Family 17h AMD CPUs is also accessed
from other drivers, specifically EDAC. Accessing it directly is racy.
On top of that, accessing the SMN through root bridge 00:00 is wrong on
multi-die CPUs and may result in reading the temperature from the wrong
die. Use available API functions to fix the problem.

For this to work, add dependency on AMD_NB. Also change the Raven Ridge
PCI device ID to point to Data Fabric Function 3, since this ID is used
by the API functions to find the CPU node.

Cc: stable@vger.kernel.org # v4.16+
Tested-by: Gabriel Craciunescu <nix.or.die@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-05-13 09:00:49 -07:00
Guenter Roeck 40626a1bf6 hwmon: (k10temp) Fix reading critical temperature register
The HTC (Hardware Temperature Control) register has moved
for recent chips.

Cc: stable@vger.kernel.org # v4.16+
Tested-by: Gabriel Craciunescu <nix.or.die@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-04-29 14:21:45 -07:00
Guenter Roeck 877d8948d0 hwmon: (k10temp) Add support for AMD Ryzen w/ Vega graphics
Enable k10temp for AMD Ryzen APUs w/ Vega Mobile Gfx.

Based on patch from René Rebe <rene@exactcode.de>. Dropped temperature
offsets since those are not supposed to apply for the affected CPUs.

Cc: stable@vger.kernel.org # v4.16+
Cc: René Rebe <rene@exactcode.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-04-25 05:31:06 -07:00
Guenter Roeck 1b59788979 hwmon: (k10temp) Add temperature offset for Ryzen 2700X
Ryzen 2700X has a temperature offset of 10 degrees C. If bit 19 of the
Temperature Control register is set, there is an additional offset of
49 degrees C. Take this into account as well.

Cc: stable@vger.kernel.org # v4.16+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-04-25 05:23:20 -07:00
Linus Torvalds 3e9f4df0ea Fix bad temperature display on Ryzen/Threadripper
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJahgQ1AAoJEMsfJm/On5mBNfgQAJgCjg4gatr0U2pqd40IPtwS
 V/KrAfLtt9+zv6HSdW1zc1vUKb3mAvi9roVIX6i4nuSjS9eitPRyvcSN+UW9X01t
 r8jqwtStssaXEKLzRkEGBoACy7/A0fNCcjHMOj1EPftKIOZdfGnZ6r4cI+/wGyLR
 ybBjcvfMNkLGgJbRKy/2Acib/Jp9OoJpjLMVyIFnhRGgRmvYKSDu7rK6ecmW2KSG
 mgKyzxL29PLfWu8jVwnkXfZcdG97akEv90BfUUa16KXA3+hgvscM5+7jQmap4N3p
 nh3yLc7MyTXvfOhKauer4czTwbr3JoDZ+BZ38a1qoD+cPX6e5GkGJnFR1E0NBG/p
 7m2w1u7LVhab5t7NFA8JgKB8J8PfyGVCiHfF0szil6lA0LiRVN/rgMcAEIavIO7K
 7C5OBjVYWk0PeJULU66r81kILvZMtc6xh6XC2gc8Z+t6uu4Ld4FSUsIWL6Muu0l6
 i2h8WX5HSMjSqCylPBTRD0a/hvPuQjWE0fkLoAtgPCt112Je6xitJzZM+RPDKonV
 8+zG1NM9eePnSNt3TsdMeF6HOR9fR9n7E3D0xsM2cbHXa1BOwlVCkPYYqNA6QkaM
 ZKTRKysZn3fYfMT0fVfdZ7E0ODZPpY/gwdqE4bduH9pMksqO0E2/g9PX/JQV13bN
 IwpMFO9aHMqVc+U8Xwhu
 =kHhI
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-linus-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:
 "Fix bad temperature display on Ryzen/Threadripper"

* tag 'hwmon-for-linus-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (k10temp) Only apply temperature offset if result is positive
2018-02-15 14:31:28 -08:00
Linus Torvalds d4667ca142 Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 PTI and Spectre related fixes and updates from Ingo Molnar:
 "Here's the latest set of Spectre and PTI related fixes and updates:

  Spectre:
   - Add entry code register clearing to reduce the Spectre attack
     surface
   - Update the Spectre microcode blacklist
   - Inline the KVM Spectre helpers to get close to v4.14 performance
     again.
   - Fix indirect_branch_prediction_barrier()
   - Fix/improve Spectre related kernel messages
   - Fix array_index_nospec_mask() asm constraint
   - KVM: fix two MSR handling bugs

  PTI:
   - Fix a paranoid entry PTI CR3 handling bug
   - Fix comments

  objtool:
   - Fix paranoid_entry() frame pointer warning
   - Annotate WARN()-related UD2 as reachable
   - Various fixes
   - Add Add Peter Zijlstra as objtool co-maintainer

  Misc:
   - Various x86 entry code self-test fixes
   - Improve/simplify entry code stack frame generation and handling
     after recent heavy-handed PTI and Spectre changes. (There's two
     more WIP improvements expected here.)
   - Type fix for cache entries

  There's also some low risk non-fix changes I've included in this
  branch to reduce backporting conflicts:

   - rename a confusing x86_cpu field name
   - de-obfuscate the naming of single-TLB flushing primitives"

* 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (41 commits)
  x86/entry/64: Fix CR3 restore in paranoid_exit()
  x86/cpu: Change type of x86_cache_size variable to unsigned int
  x86/spectre: Fix an error message
  x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping
  selftests/x86/mpx: Fix incorrect bounds with old _sigfault
  x86/mm: Rename flush_tlb_single() and flush_tlb_one() to __flush_tlb_one_[user|kernel]()
  x86/speculation: Add <asm/msr-index.h> dependency
  nospec: Move array_index_nospec() parameter checking into separate macro
  x86/speculation: Fix up array_index_nospec_mask() asm constraint
  x86/debug: Use UD2 for WARN()
  x86/debug, objtool: Annotate WARN()-related UD2 as reachable
  objtool: Fix segfault in ignore_unreachable_insn()
  selftests/x86: Disable tests requiring 32-bit support on pure 64-bit systems
  selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c
  selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c
  selftests/x86: Fix build bug caused by the 5lvl test which has been moved to the VM directory
  selftests/x86/pkeys: Remove unused functions
  selftests/x86: Clean up and document sscanf() usage
  selftests/x86: Fix vDSO selftest segfault for vsyscall=none
  x86/entry/64: Remove the unused 'icebp' macro
  ...
2018-02-14 17:02:15 -08:00
Jia Zhang b399151cb4 x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping
x86_mask is a confusing name which is hard to associate with the
processor's stepping.

Additionally, correct an indent issue in lib/cpu.c.

Signed-off-by: Jia Zhang <qianyue.zj@alibaba-inc.com>
[ Updated it to more recent kernels. ]
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@alien8.de
Cc: tony.luck@intel.com
Link: http://lkml.kernel.org/r/1514771530-70829-1-git-send-email-qianyue.zj@alibaba-inc.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-15 01:15:52 +01:00
Guenter Roeck aef17ca127 hwmon: (k10temp) Only apply temperature offset if result is positive
A user reports a really bad temperature on Ryzen 1950X.

k10temp-pci-00cb
Adapter: PCI adapter
temp1: +4294948.3°C (high = +70.0°C)

This will happen if the temperature reported by the chip is lower than
the offset temperature. This has been seen in the field if "Sense MI Skew"
and/or "Sense MI Offset" BIOS parameters were set to unexpected values.
Let's report a temperature of 0 degrees C in that case.

Fixes: 1b50b77635 ("hwmon: (k10temp) Add support for temperature offsets")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-02-12 14:23:29 -08:00
Guenter Roeck 6509614fdd hwmon: (k10temp) Add temperature offset for Ryzen 1900X
Like the other CPUs from the same series, the 1900X has a
temperature offset of 27 degrees C.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-01-19 06:38:03 -08:00
Guenter Roeck ab5ee24615 hwmon: (k10temp) Correct model name for Ryzen 1600X
Ryzen 1600X is a Ryzen 5 processor.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-11-16 00:59:45 -08:00
Guenter Roeck 1b50b77635 hwmon: (k10temp) Add support for temperature offsets
Add support for handling temperature offset values for various AMD CPUs,
similar to the code used in the coretemp driver for Intel CPUs. This is
primarily for Ryzen CPUs (which has documented temperature offsets),
but the code is kept generic to simplify adding additional CPUs.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29 18:36:03 -07:00
Guenter Roeck 9af0a9aecd hwmon: (k10temp) Add support for family 17h
Add support for temperature sensors on Family 17h (Ryzen) processors.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29 18:36:03 -07:00
Guenter Roeck 68546abf7a hwmon: (k10temp) Move chip specific code into probe function
Introduce a local data structure and determine the temperature read
function at probe time to reduce runtime complexity.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29 18:36:03 -07:00
Julia Lawall 0c36d72e57 hwmon: (k10temp) use permission-specific DEVICE_ATTR variants
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.

The conversion was done automatically using coccinelle. It was validated
by compiling both the old and the new source code and comparing its text,
data, and bss size.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-01-02 10:19:45 -08:00
Adam Majer ba953391e0 hwmon: (k10temp) Remove duplicate pci-id define
PCI_DEVICE_ID_AMD_15H_M60H_NB_F3 is now defined in pci_ids.h

Signed-off-by: Adam Majer <adamm@zombino.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
2015-11-09 10:14:29 +01:00
Guenter Roeck 3e3e102251 hwmon: (k10temp) Convert to devm_hwmon_device_register_with_groups
Use devm_hwmon_device_register_with_groups() to simplify the code
and reduce code size.

Cc: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Aravind Gopalakrishnan f89ce2706d hwmon: (k10temp) Add support for F15h M60h
This patch adds temperature monitoring support for F15h M60h processor.
 - Add new pci device id for the relevant processor
 - The functionality of REG_REPORTED_TEMPERATURE is moved to
   D0F0xBC_xD820_0CA4 [Reported Temperature Control]
   - So, use this to get CUR_TEMP value
   - Since we need an indirect register access, protect this with
     a mutex lock
 - Add Kconfig, Doc entries to indicate support for this processor.

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
[Guenter Roeck: Declare new mutex and function static]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-09-22 11:14:52 -07:00
Aravind Gopalakrishnan ec0159503a hwmon: (k10temp) Add support for AMD F16 M30h processor
Adding new PCI ID to support AMD F16 M30h processor (Mullins).
While at it, modify Kconfig and Doc files to reflect the
support for newer processors

Note: PCI ID for this processor will make it into pci_ids.h
as part of this patch:
http://marc.info/?l=linux-kernel&m=139291362126057&w=2
which should be pulled into 3.15 when merge window opens
(It currently sits in 'for-next' branch of bp.git-
https://git.kernel.org/cgit/linux/kernel/git/bp/bp.git/log/?h=for-next)

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-04-02 22:09:14 -07:00
Phil Pokorny d303b1b5fb hwmon: (k10temp) Add support for Kaveri CPUs
Add new PCI ID to support new model "Kaveri" family.

Signed-off-by: Philip Pokorny <ppokorny@penguincomputing.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:54 -08:00
Jingoo Han cd9bb0564c hwmon: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-01-14 21:36:30 -08:00
Jingoo Han 0b77f766f3 hwmon: (k10temp) remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-09-12 08:17:40 -07:00
Wei Hu 30b146d1cb hwmon: (k10temp) Add support for Fam16h (Kabini)
The temperature reporting interface stays the same, so we just
add the PCI-ID to the list.

Verified on AMD Olive Hill.

Signed-off-by: Wei Hu <wei@aristanetworks.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27 08:28:01 -07:00
Bill Pemberton 281dfd0b6e hwmon: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Alistair John Strachan <alistair@devzero.co.uk>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Rudolf Marek <r.marek@assembler.cz>
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Roger Lucas <vt8231@hiddenengine.co.uk>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 11:50:34 -08:00
Bill Pemberton 6c931ae1c0 hwmon: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Alistair John Strachan <alistair@devzero.co.uk>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Rudolf Marek <r.marek@assembler.cz>
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Roger Lucas <vt8231@hiddenengine.co.uk>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 11:49:40 -08:00
Bill Pemberton 9e5e9b7a92 hwmon: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Alistair John Strachan <alistair@devzero.co.uk>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Rudolf Marek <r.marek@assembler.cz>
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Roger Lucas <vt8231@hiddenengine.co.uk>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 11:48:59 -08:00
Borislav Petkov 24214449b0 x86, amd_nb: Export model 0x10 and later PCI id
Add the F3 PCI id of F15h, model 0x10 to pci_ids.h and to the amd_nb
code which generates the list of northbridges on an AMD box. Shorten
define name while at it so that it fits into pci_ids.h.

Acked-by: Clemens Ladisch <clemens@ladisch.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
2012-06-07 12:43:41 +02:00
Axel Lin f71f5a550a hwmon: use module_pci_driver
This patch converts the drivers in drivers/hwmon/* to use module_pci_driver()
macro which makes the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-05-20 19:41:48 -07:00
Andre Przywara fbc729a446 hwmon: (k10temp) Add support for AMD Trinity CPUs
The on-chip northbridge's temperature sensor of the upcoming
AMD Trinity CPUs works the same as for the previous CPUs.
Since it has a different PCI-ID, we just add the new one to the list
supported by k10temp.
This allows to use the k10temp driver on those CPUs.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Cc: stable@vger.kernel.org # 3.0+
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-04-01 10:25:56 -07:00
Frans Meulenbroeks 600151b9de hwmon: use DEFINE_PCI_DEVICE_TABLE
fix all checkpatch warnings about DEFINE_PCI_DEVICE_TABLE

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-03-18 18:26:29 -07:00
Andre Przywara 9e58131112 hwmon: (k10temp) Add support for Fam15h (Bulldozer)
AMDs upcoming CPUs use the same mechanism for the internal
temperature reporting as the Fam10h CPUs, so we just needed to add
the appropriate PCI-ID to the list.
This allows to use the k10temp driver on those CPUs.
While at it change the Kconfig entry to be more generic.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-05-25 20:43:31 +02:00
Jean Delvare 95de3b2575 hwmon: Use helper functions to set and get driver data
Use helper functions to set and get driver data. This is more elegant.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-05-25 20:43:31 +02:00
Clemens Ladisch aa4790a628 hwmon: (k10temp) add support for AMD Family 12h/14h CPUs
Add the PCI ID to support the internal temperature sensor of the
AMD "Llano" and "Brazos" processor families.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: stable@kernel.org # ca86828: x86, AMD, PCI: Add AMD northbridge PCI device
Cc: stable@kernel.org
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-02-18 06:14:24 -08:00
Jean Delvare eefc2d9e3d hwmon: (k10temp) Do not blacklist known working CPU models
When detecting AM2+ or AM3 socket with DDR2, only blacklist cores
which are known to exist in AM2+ format.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: stable@kernel.org
2010-06-20 09:22:31 +02:00
Márton Németh 3dd3a15635 hwmon: Make PCI device ids constant
The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make pci_device_id also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-01-10 20:52:35 +01:00
Clemens Ladisch c5114a1cd6 hwmon: (k10temp) Blacklist more family 10h processors
The latest version of the Revision Guide for AMD Family 10h Processors
lists two more processor revisions which may be affected by erratum 319.
Change the blacklisting code to correctly detect those processors, by
implementing AMD's recommended algorithm.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Andreas Herrmann <herrmann.der.user@googlemail.com>
2010-01-10 20:52:34 +01:00
Clemens Ladisch 3c57e89b46 hwmon: New driver for AMD Family 10h/11h CPUs
This adds a driver for the internal temperature sensor of AMD Family 10h
and 11h CPUs.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-16 21:38:25 +01:00