Good afternoon, dear Nvidia! I already successful attached PWM2 to sysfs but now I have to read its tacho that we attached to pin PV0.
I tried to find in the internet common solution how to throw tacho to sysfs but couldn’t find anything. Then I tried to create pwm-fan2 and encountered the next problem:
turn4:~$ ls /sys/devices/pwm-fan
cur_pwm driver_override fan_kickstart fan_rpm_in_limit kickstart_params of_node pwm_cap pwm_state_map state_cap subsystem target_pwm uevent
driver fan_available_profiles fan_profile hwmon modalias power pwm_rpm_table rpm_measured step_time tach_enable temp_control
turn4:~$ ls /sys/devices/pwm-fan2
driver_override modalias of_node power subsystem uevent
It seems that the driver was not attached smoothly. How could I fix this? My devtree:
tegra210-porg-pwm-fen.dtsi:
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
*/
#include <dt-bindings/pwm/pwm.h>
/ {
pwm_fan_shared_data: pfsd {
num_resources = <0>;
secret = <47>;
active_steps = <10>;
active_rpm = <0 1000 2000 3000 4000 5000 6000 7000 10000 11000>;
active_rru = <40 2 1 1 1 1 1 1 1 1>;
active_rrd = <40 2 1 1 1 1 1 1 1 1>;
state_cap_lookup = <2 2 2 2 3 3 3 4 4 4>;
pwm_period = <45334>;
pwm_id = <3>;
step_time = <100>; /* mesecs */
state_cap = <7>;
active_pwm_max = <255>;
tach_gpio = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PZ2 */
pwm_gpio = <&gpio TEGRA_GPIO(E, 7) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PE7 */
pwm_polarity = <PWM_POLARITY_NORMAL>;
suspend_state = <0>;
tach_period = <1000>;
};
pwm-fan {
compatible = "pwm-fan";
status = "okay";
pwms = <&tegra_pwm 3 45334>;
shared_data = <&pwm_fan_shared_data>;
active_pwm = <0 80 120 160 255 255 255 255 255 255>;
};
pwm_fan_shared_data2: pfsd {
num_resources = <0>;
secret = <47>;
active_steps = <10>;
active_rpm = <0 1000 2000 3000 4000 5000 6000 7000 10000 11000>;
active_rru = <40 2 1 1 1 1 1 1 1 1>;
active_rrd = <40 2 1 1 1 1 1 1 1 1>;
state_cap_lookup = <2 2 2 2 3 3 3 4 4 4>;
pwm_period = <45334>;
pwm_id = <2>;
step_time = <100>; /* mesecs */
state_cap = <7>;
active_pwm_max = <255>;
tach_gpio = <&gpio TEGRA_GPIO(V, 0) GPIO_ACTIVE_LOW>;
pwm_gpio = <&gpio TEGRA_GPIO(E, 6) GPIO_ACTIVE_LOW>;
pwm_polarity = <PWM_POLARITY_NORMAL>;
suspend_state = <0>;
tach_period = <1000>;
};
pwm-fan2 {
compatible = "pwm-fan";
status = "okay";
pwms = <&tegra_pwm 2 45334>;
shared_data = <&pwm_fan_shared_data2>;
active_pwm = <0 80 120 160 255 255 255 255 255 255>;
};
};
pinmux for pwm and tacho pins:
pe6 {
nvidia,pins = "pe6";
nvidia,function = "pwm2";
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_DISABLE>;
};
lcd_bl_pwm_pv0 {
nvidia,pins = "lcd_bl_pwm_pv0";
nvidia,pull = <TEGRA_PIN_PULL_UP>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
pe7 {
nvidia,pins = "pe7";
nvidia,function = "pwm3";
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_DISABLE>;
};
pz2 {
nvidia,pins = "pz2";
nvidia,pull = <TEGRA_PIN_PULL_UP>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
pwm-fan is working well and tacho is working well too but my pwm-fan2 (that I created) is not at all.
I need to configure pwm-fan2 like pwm-fan with the tacho or you could help me to forward tacho2 to sysfs without pwm2 then I continue to use pwm2 separately from sysfs and will read tacho2 from sysfs separately too.