0001 .. SPDX-License-Identifier: GPL-2.0-or-later
0002
0003 Kernel driver sbrmi
0004 ===================
0005
0006 Supported hardware:
0007
0008 * Sideband Remote Management Interface (SB-RMI) compliant AMD SoC
0009 device connected to the BMC via the APML.
0010
0011 Prefix: 'sbrmi'
0012
0013 Addresses scanned: This driver doesn't support address scanning.
0014
0015 To instantiate this driver on an AMD CPU with SB-RMI
0016 support, the i2c bus number would be the bus connected from the board
0017 management controller (BMC) to the CPU.
0018 The SMBus address is really 7 bits. Some vendors and the SMBus
0019 specification show the address as 8 bits, left justified with the R/W
0020 bit as a write (0) making bit 0. Some vendors use only the 7 bits
0021 to describe the address.
0022 As mentioned in AMD's APML specification, The SB-RMI address is
0023 normally 78h(0111 100W) or 3Ch(011 1100) for socket 0 and 70h(0111 000W)
0024 or 38h(011 1000) for socket 1, but it could vary based on hardware
0025 address select pins.
0026
0027 Datasheet: The SB-RMI interface and protocol along with the Advanced
0028 Platform Management Link (APML) Specification is available
0029 as part of the open source SoC register reference at:
0030
0031 https://www.amd.com/en/support/tech-docs?keyword=55898
0032
0033 Author: Akshay Gupta <akshay.gupta@amd.com>
0034
0035 Description
0036 -----------
0037
0038 The APML provides a way to communicate with the SB Remote Management interface
0039 (SB-RMI) module from the external SMBus master that can be used to report socket
0040 power on AMD platforms using mailbox command and resembles a typical 8-pin remote
0041 power sensor's I2C interface to BMC.
0042
0043 This driver implements current power with power cap and power cap max.
0044
0045 sysfs-Interface
0046 ---------------
0047 Power sensors can be queried and set via the standard ``hwmon`` interface
0048 on ``sysfs``, under the directory ``/sys/class/hwmon/hwmonX`` for some value
0049 of ``X`` (search for the ``X`` such that ``/sys/class/hwmon/hwmonX/name`` has
0050 content ``sbrmi``)
0051
0052 ================ ===== ========================================================
0053 Name Perm Description
0054 ================ ===== ========================================================
0055 power1_input RO Current Power consumed
0056 power1_cap RW Power limit can be set between 0 and power1_cap_max
0057 power1_cap_max RO Maximum powerlimit calculated and reported by the SMU FW
0058 ================ ===== ========================================================
0059
0060 The following example show how the 'Power' attribute from the i2c-addresses
0061 can be monitored using the userspace utilities like ``sensors`` binary::
0062
0063 # sensors
0064 sbrmi-i2c-1-38
0065 Adapter: bcm2835 I2C adapter
0066 power1: 61.00 W (cap = 225.00 W)
0067
0068 sbrmi-i2c-1-3c
0069 Adapter: bcm2835 I2C adapter
0070 power1: 28.39 W (cap = 224.77 W)
0071 #
0072
0073 Also, Below shows how get and set the values from sysfs entries individually::
0074 # cat /sys/class/hwmon/hwmon1/power1_cap_max
0075 225000000
0076
0077 # echo 180000000 > /sys/class/hwmon/hwmon1/power1_cap
0078 # cat /sys/class/hwmon/hwmon1/power1_cap
0079 180000000