how to bind thermal sensor with cooling device using lookup table in code

我只是一个虾纸丫 提交于 2020-03-05 04:34:26

问题


i want to bind thermal sensor with cooling device ( fan ) using lookup table. I know how to do it using DTs ( device tree) but never worked using lookup table in code for same. I need help on how to do same on code using lookup table what we use to do using device tree. for example

thermal-zones {
    cpu_thermal: cpu-thermal {
        polling-delay-passive = <250>; /* milliseconds */
        polling-delay = <1000>; /* milliseconds */

        thermal-sensors = <&bandgap0>;

        trips {
            cpu_alert0: cpu-alert0 {
                temperature = <90000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "active";
            };
            cpu_alert1: cpu-alert1 {
                temperature = <100000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "passive";
            };
            cpu_crit: cpu-crit {
                temperature = <125000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "critical";
            };
        };

        cooling-maps {
            map0 {
                trip = <&cpu_alert0>;
                cooling-device = <&fan0 THERMAL_NO_LIMIT 4>;
            };
            map1 {
                trip = <&cpu_alert1>;
                cooling-device = <&fan0 5 THERMAL_NO_LIMIT>, <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
            };
        };
    };
};

how can i do same binding in code itself


回答1:


Just don't use the devicetree bindings, instead use examples of non-DT thermal drivers such as drivers/acpi/thermal.c, drivers/net/ethernet/mellanox/mlxsw/core_thermal.c



来源:https://stackoverflow.com/questions/60289063/how-to-bind-thermal-sensor-with-cooling-device-using-lookup-table-in-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!