diff --git a/Documentation/devicetree/bindings/hwmon/generic-pwm-tachometer.yaml b/Documentation/devicetree/bindings/hwmon/generic-pwm-tachometer.yaml deleted file mode 100644 index 4778eca9..00000000 --- a/Documentation/devicetree/bindings/hwmon/generic-pwm-tachometer.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) -%YAML 1.2 ---- -$id: http://devicetree.org/schemas/hwmon/generic-pwm-tachometer.yaml# -$schema: http://devicetree.org/meta-schemas/core.yaml# - -title: Generic PWM based tachometer HW monitor driver - -maintainers: - - Laxman Dewangan - -description: | - Generic PWM based tachometer driver which captures the PWM signal and reports - the speed of the device which generates the PWM signal. This helps in monitor - the speed of fan. - -properties: - compatible: - enum: - - generic-pwm-tachometer - - pwms: - maxItems: 1 - description: | - This property contains the phandle of the PWM controller which capture the - PWM signal. - -required: - - compatible - - pwms - -additionalProperties: false - -examples: - - | - tegra_tachometer: tachometer@39c0000 { - reg = <0x39c0000 0x0>; - #pwm-cells = <2>; - /* Other properties of tachometer */ - }; - - generic_pwm_tachometer { - compatible = "generic-pwm-tachometer"; - pwms = <&tegra_tachometer 0 1000000>; - }; -... diff --git a/dkms.conf b/dkms.conf index 7f4089a2..d7606932 100644 --- a/dkms.conf +++ b/dkms.conf @@ -111,12 +111,8 @@ BUILT_MODULE_NAME[26]="pinctrl-tegra234-dpaux" BUILT_MODULE_LOCATION[26]="drivers/pinctrl" DEST_MODULE_LOCATION[26]="/extra" -BUILT_MODULE_NAME[27]="generic-pwm-tachometer" -BUILT_MODULE_LOCATION[27]="drivers/hwmon" +BUILT_MODULE_NAME[27]="cpuidle-debugfs" +BUILT_MODULE_LOCATION[27]="drivers/cpuidle" DEST_MODULE_LOCATION[27]="/extra" -BUILT_MODULE_NAME[28]="cpuidle-debugfs" -BUILT_MODULE_LOCATION[28]="drivers/cpuidle" -DEST_MODULE_LOCATION[28]="/extra" - AUTO_INSTALL="yes" diff --git a/drivers/Makefile b/drivers/Makefile index 61a2e816..f79e3692 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -22,7 +22,6 @@ obj-m += firmware/tegra/ ifdef CONFIG_TEGRA_HOST1X obj-m += gpu/ endif -obj-m += hwmon/ ifdef CONFIG_I2C obj-m += i2c/busses/ obj-m += mfd/ diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile deleted file mode 100644 index a361bc47..00000000 --- a/drivers/hwmon/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. - -obj-m += generic-pwm-tachometer.o diff --git a/drivers/hwmon/generic-pwm-tachometer.c b/drivers/hwmon/generic-pwm-tachometer.c deleted file mode 100644 index 92650ff6..00000000 --- a/drivers/hwmon/generic-pwm-tachometer.c +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. - -#include -#include -#include -#include -#include -#include - -struct pwm_hwmon_tach { - struct device *dev; - struct pwm_device *pwm; - struct device *hwmon; -}; - -static ssize_t show_rpm(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct pwm_hwmon_tach *ptt = dev_get_drvdata(dev); - struct pwm_device *pwm = ptt->pwm; - struct pwm_capture result; - unsigned int rpm = 0; - int ret; - - ret = pwm_capture(pwm, &result, 0); - if (ret < 0) { - dev_err(ptt->dev, "Failed to capture PWM: %d\n", ret); - return ret; - } - - if (result.period) - rpm = DIV_ROUND_CLOSEST_ULL(60ULL * NSEC_PER_SEC, - result.period); - - return sprintf(buf, "%u\n", rpm); -} -static SENSOR_DEVICE_ATTR(rpm, 0444, show_rpm, NULL, 0); - -static struct attribute *pwm_tach_attrs[] = { - &sensor_dev_attr_rpm.dev_attr.attr, - NULL, -}; -ATTRIBUTE_GROUPS(pwm_tach); - -static int pwm_tach_probe(struct platform_device *pdev) -{ - struct pwm_hwmon_tach *ptt; - - ptt = devm_kzalloc(&pdev->dev, sizeof(*ptt), GFP_KERNEL); - if (!ptt) - return -ENOMEM; - - ptt->dev = &pdev->dev; - - platform_set_drvdata(pdev, ptt); - dev_set_drvdata(&pdev->dev, ptt); - - ptt->pwm = devm_fwnode_pwm_get(&pdev->dev, &pdev->dev.of_node->fwnode, NULL); - if (IS_ERR(ptt->pwm)) { - if (PTR_ERR(ptt->pwm) != -EPROBE_DEFER) { - dev_err(&pdev->dev, "Failed to get pwm: %ld\n", - PTR_ERR(ptt->pwm)); - } - return PTR_ERR(ptt->pwm); - } - - ptt->hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, - "pwm_tach", ptt, pwm_tach_groups); - if (IS_ERR(ptt->hwmon)) { - dev_err(&pdev->dev, "Failed to register hwmon device: %d\n", - PTR_ERR_OR_ZERO(ptt->hwmon)); - return PTR_ERR_OR_ZERO(ptt->hwmon); - } - - return 0; -} - -static const struct of_device_id pwm_tach_of_match[] = { - { .compatible = "generic-pwm-tachometer" }, - {} -}; -MODULE_DEVICE_TABLE(of, pwm_tach_of_match); - -static struct platform_driver pwm_tach_driver = { - .driver = { - .name = "generic-pwm-tachometer", - .of_match_table = pwm_tach_of_match, - }, - .probe = pwm_tach_probe, -}; - -module_platform_driver(pwm_tach_driver); - -MODULE_DESCRIPTION("PWM based Generic Tachometer driver"); -MODULE_AUTHOR("Laxman Dewangan "); -MODULE_AUTHOR("R Raj Kumar "); -MODULE_LICENSE("GPL v2");