summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-25 13:56:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-25 13:56:18 -0700
commit8350e8331b3971533d6e6112ab596eda2c2ffffd (patch)
tree1add05c103644650616f17f1ae90ae2fc91482ee /drivers/hwmon
parente35a4a4e13c35f500a8d38e836b5e335c7515494 (diff)
parentd99460ed5cdcc28feba6b992630b04650e410902 (diff)
Merge tag 'mfd-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Drivers: - Add support for Maxim MAX77714 PMIC Removed Drivers: - Remove support for ST-Ericsson AB8500 DebugFS New Device Support: - Add support for Silergy SY7636A to Simple MFD I2C - Add support for MediaTek MT6366 PMIC to MT6358 IRQ - Add support for Charger to Intel PMIC CRC - Add support for Raptor Lake to Intel LPSS PCI New Functionality: - Add support for Reboot to Rockchip RK808 Fix-ups: - Device Tree changes (includcing YAML conversion) for silergy,sy7636a, maxim,max77843, google,cros-ec, maxim,max14577, maxim,max77802, maxim,max77714, qcom,tcsr, qcom,spmi-pmic, stericsson,ab8500, stericsson,db8500-prcmu, samsung,exynos5433-lpass, mt6397, syscon, brcm,cru - Visible to menuconfig; simple-mfd-i2c - Clean-up or clarify code; max77686, intel_soc_pmic_crc - Improve error handling; mc13xxx-core, stmfx, asic3 - Pass device information to child devices; iqs62x, intel-lpss-acpi - Individually identify IRQ domains; intel_soc_pmic_core - Remove superfluous code; dbx500-prcmu, exynos-lpass - Staticify and constify; arizona-i2c - Mark sometimes used data as __maybe_unused; atmel-flexcom - Account for different ACPI tables on AOSP/Windows platforms; arizona-spi - Use provided (platform) APIs; ab8500-core - Trivial (whitespace, spelling); rohm-bd9576" * tag 'mfd-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (50 commits) dt-bindings: mfd: syscon: Add microchip,lan966x-cpu-syscon compatible mfd: bd9576: fix typos in comments mfd: Use platform_get_irq() to get the interrupt mfd: db8500-prcmu: Remove unused inline function mfd: arizona-spi: Add Android board ACPI table handling mfd: arizona-spi: Split Windows ACPI init code into its own function mfd: asic3: Add missing iounmap() on error asic3_mfd_probe MAINTAINERS: Rectify entry for ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS mfd: intel-lpss: Provide an SSP type to the driver dt-bindings: mfd: brcm,cru: Rename pinctrl node dt-bindings: Add compatibles for undocumented trivial syscons mfd: atmel-flexcom: Fix compilation warning dt-bindings: mfd: Add compatible for the MediaTek MT6366 PMIC dt-bindings: mfd: samsung,exynos5433-lpass: Convert to dtschema mfd: exynos-lpass: Drop unneeded syscon.h include mfd: intel-lpss: Add Intel Raptor Lake PCH-S PCI IDs mfd: ab8500: Drop debugfs module mfd: sta2x11: Use GFP_KERNEL instead of GFP_ATOMIC mfd: ab8500: Rewrite bindings in YAML mfd: qcom-spmi-pmic: Add pm8953 compatible ...
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/Kconfig9
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/sy7636a-hwmon.c106
3 files changed, 116 insertions, 0 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 9ab4e9b3d27b..db8bc55e5f50 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1689,6 +1689,15 @@ config SENSORS_SIS5595
This driver can also be built as a module. If so, the module
will be called sis5595.
+config SENSORS_SY7636A
+ tristate "Silergy SY7636A"
+ help
+ If you say yes here you get support for the thermistor readout of
+ the Silergy SY7636A PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called sy7636a-hwmon.
+
config SENSORS_DME1737
tristate "SMSC DME1737, SCH311x and compatibles"
depends on I2C && !PPC
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 4ed138d0621f..7fd5e94d88f6 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -187,6 +187,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o
obj-$(CONFIG_SENSORS_STTS751) += stts751.o
+obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o
obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o
obj-$(CONFIG_SENSORS_TC74) += tc74.o
obj-$(CONFIG_SENSORS_THMC50) += thmc50.o
diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c
new file mode 100644
index 000000000000..6dd9c2a0f0e0
--- /dev/null
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -0,0 +1,106 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Functions to access SY3686A power management chip temperature
+ *
+ * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/
+ *
+ * Authors: Lars Ivar Miljeteig <lars.ivar.miljeteig@remarkable.com>
+ * Alistair Francis <alistair@alistair23.me>
+ */
+
+#include <linux/err.h>
+#include <linux/hwmon.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/machine.h>
+
+#include <linux/mfd/sy7636a.h>
+
+static int sy7636a_read(struct device *dev, enum hwmon_sensor_types type,
+ u32 attr, int channel, long *temp)
+{
+ struct regmap *regmap = dev_get_drvdata(dev);
+ int ret, reg_val;
+
+ ret = regmap_read(regmap,
+ SY7636A_REG_TERMISTOR_READOUT, &reg_val);
+ if (ret)
+ return ret;
+
+ *temp = reg_val * 1000;
+
+ return 0;
+}
+
+static umode_t sy7636a_is_visible(const void *data,
+ enum hwmon_sensor_types type,
+ u32 attr, int channel)
+{
+ if (type != hwmon_temp)
+ return 0;
+
+ if (attr != hwmon_temp_input)
+ return 0;
+
+ return 0444;
+}
+
+static const struct hwmon_ops sy7636a_hwmon_ops = {
+ .is_visible = sy7636a_is_visible,
+ .read = sy7636a_read,
+};
+
+static const struct hwmon_channel_info *sy7636a_info[] = {
+ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
+ NULL
+};
+
+static const struct hwmon_chip_info sy7636a_chip_info = {
+ .ops = &sy7636a_hwmon_ops,
+ .info = sy7636a_info,
+};
+
+static int sy7636a_sensor_probe(struct platform_device *pdev)
+{
+ struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
+ struct regulator *regulator;
+ struct device *hwmon_dev;
+ int err;
+
+ if (!regmap)
+ return -EPROBE_DEFER;
+
+ regulator = devm_regulator_get(&pdev->dev, "vcom");
+ if (IS_ERR(regulator))
+ return PTR_ERR(regulator);
+
+ err = regulator_enable(regulator);
+ if (err)
+ return err;
+
+ hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev,
+ "sy7636a_temperature", regmap,
+ &sy7636a_chip_info, NULL);
+
+ if (IS_ERR(hwmon_dev)) {
+ err = PTR_ERR(hwmon_dev);
+ dev_err(&pdev->dev, "Unable to register hwmon device, returned %d\n", err);
+ return err;
+ }
+
+ return 0;
+}
+
+static struct platform_driver sy7636a_sensor_driver = {
+ .probe = sy7636a_sensor_probe,
+ .driver = {
+ .name = "sy7636a-temperature",
+ },
+};
+module_platform_driver(sy7636a_sensor_driver);
+
+MODULE_DESCRIPTION("SY7636A sensor driver");
+MODULE_LICENSE("GPL");