mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
hwmon: Remove generic pwm tachometer
Remove HW monitor based generic PWM tachometer driver as it is not required. Along with driver, remove DT binding document and dkms entry. Bug 4061216 Change-Id: I28e1bf9d5223ad7f56332d90501ea7ddb55cd366 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2883862 Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
ed630178bb
commit
013ae1a966
@@ -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 <ldewangan@nvidia.com>
|
|
||||||
|
|
||||||
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>;
|
|
||||||
};
|
|
||||||
...
|
|
||||||
@@ -111,12 +111,8 @@ BUILT_MODULE_NAME[26]="pinctrl-tegra234-dpaux"
|
|||||||
BUILT_MODULE_LOCATION[26]="drivers/pinctrl"
|
BUILT_MODULE_LOCATION[26]="drivers/pinctrl"
|
||||||
DEST_MODULE_LOCATION[26]="/extra"
|
DEST_MODULE_LOCATION[26]="/extra"
|
||||||
|
|
||||||
BUILT_MODULE_NAME[27]="generic-pwm-tachometer"
|
BUILT_MODULE_NAME[27]="cpuidle-debugfs"
|
||||||
BUILT_MODULE_LOCATION[27]="drivers/hwmon"
|
BUILT_MODULE_LOCATION[27]="drivers/cpuidle"
|
||||||
DEST_MODULE_LOCATION[27]="/extra"
|
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"
|
AUTO_INSTALL="yes"
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ obj-m += firmware/tegra/
|
|||||||
ifdef CONFIG_TEGRA_HOST1X
|
ifdef CONFIG_TEGRA_HOST1X
|
||||||
obj-m += gpu/
|
obj-m += gpu/
|
||||||
endif
|
endif
|
||||||
obj-m += hwmon/
|
|
||||||
ifdef CONFIG_I2C
|
ifdef CONFIG_I2C
|
||||||
obj-m += i2c/busses/
|
obj-m += i2c/busses/
|
||||||
obj-m += mfd/
|
obj-m += mfd/
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
|
||||||
|
|
||||||
obj-m += generic-pwm-tachometer.o
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
// Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/platform_device.h>
|
|
||||||
#include <linux/err.h>
|
|
||||||
#include <linux/pwm.h>
|
|
||||||
#include <linux/hwmon.h>
|
|
||||||
#include <linux/hwmon-sysfs.h>
|
|
||||||
|
|
||||||
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 <ldewangan@nvidia.com>");
|
|
||||||
MODULE_AUTHOR("R Raj Kumar <rrajk@nvidia.com>");
|
|
||||||
MODULE_LICENSE("GPL v2");
|
|
||||||
Reference in New Issue
Block a user