18c2ecf20Sopenharmony_ciNuvoton NPCM7xx PWM and Fan Tacho controller device
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe Nuvoton BMC NPCM7XX supports 8 Pulse-width modulation (PWM)
48c2ecf20Sopenharmony_cicontroller outputs and 16 Fan tachometer controller inputs.
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciRequired properties for pwm-fan node
78c2ecf20Sopenharmony_ci- #address-cells : should be 1.
88c2ecf20Sopenharmony_ci- #size-cells	: should be 0.
98c2ecf20Sopenharmony_ci- compatible	: "nuvoton,npcm750-pwm-fan" for Poleg NPCM7XX.
108c2ecf20Sopenharmony_ci- reg			: specifies physical base address and size of the registers.
118c2ecf20Sopenharmony_ci- reg-names	: must contain:
128c2ecf20Sopenharmony_ci					* "pwm" for the PWM registers.
138c2ecf20Sopenharmony_ci					* "fan" for the Fan registers.
148c2ecf20Sopenharmony_ci- clocks		: phandle of reference clocks.
158c2ecf20Sopenharmony_ci- clock-names	: must contain
168c2ecf20Sopenharmony_ci					* "pwm" for PWM controller operating clock.
178c2ecf20Sopenharmony_ci					* "fan" for Fan controller operating clock.
188c2ecf20Sopenharmony_ci- interrupts	: contain the Fan interrupts with flags for falling edge.
198c2ecf20Sopenharmony_ci- pinctrl-names	: a pinctrl state named "default" must be defined.
208c2ecf20Sopenharmony_ci- pinctrl-0	: phandle referencing pin configuration of the PWM and Fan
218c2ecf20Sopenharmony_ci					controller ports.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cifan subnode format:
248c2ecf20Sopenharmony_ci===================
258c2ecf20Sopenharmony_ciUnder fan subnode can be upto 8 child nodes, each child node representing a fan.
268c2ecf20Sopenharmony_ciEach fan subnode must have one PWM channel and atleast one Fan tach channel.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciFor PWM channel can be configured cooling-levels to create cooling device.
298c2ecf20Sopenharmony_ciCooling device could be bound to a thermal zone for the thermal control.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciRequired properties for each child node:
328c2ecf20Sopenharmony_ci- reg : specify the PWM output channel.
338c2ecf20Sopenharmony_ci	integer value in the range 0 through 7, that represent
348c2ecf20Sopenharmony_ci	the PWM channel number that used.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci- fan-tach-ch : specify the Fan tach input channel.
378c2ecf20Sopenharmony_ci		integer value in the range 0 through 15, that represent
388c2ecf20Sopenharmony_ci		the fan tach channel number that used.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci		At least one Fan tach input channel is required
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciOptional property for each child node:
438c2ecf20Sopenharmony_ci- cooling-levels: PWM duty cycle values in a range from 0 to 255
448c2ecf20Sopenharmony_ci                  which correspond to thermal cooling states.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciExamples:
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cipwm_fan:pwm-fan-controller@103000 {
498c2ecf20Sopenharmony_ci	#address-cells = <1>;
508c2ecf20Sopenharmony_ci	#size-cells = <0>;
518c2ecf20Sopenharmony_ci	compatible = "nuvoton,npcm750-pwm-fan";
528c2ecf20Sopenharmony_ci	reg = <0x103000 0x2000>,
538c2ecf20Sopenharmony_ci		<0x180000 0x8000>;
548c2ecf20Sopenharmony_ci	reg-names = "pwm", "fan";
558c2ecf20Sopenharmony_ci	clocks = <&clk NPCM7XX_CLK_APB3>,
568c2ecf20Sopenharmony_ci		<&clk NPCM7XX_CLK_APB4>;
578c2ecf20Sopenharmony_ci	clock-names = "pwm","fan";
588c2ecf20Sopenharmony_ci	interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>,
598c2ecf20Sopenharmony_ci			<GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
608c2ecf20Sopenharmony_ci			<GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
618c2ecf20Sopenharmony_ci			<GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
628c2ecf20Sopenharmony_ci			<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
638c2ecf20Sopenharmony_ci			<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
648c2ecf20Sopenharmony_ci			<GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
658c2ecf20Sopenharmony_ci			<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
668c2ecf20Sopenharmony_ci	pinctrl-names = "default";
678c2ecf20Sopenharmony_ci	pinctrl-0 = <&pwm0_pins &pwm1_pins &pwm2_pins
688c2ecf20Sopenharmony_ci			&fanin0_pins &fanin1_pins &fanin2_pins
698c2ecf20Sopenharmony_ci			&fanin3_pins &fanin4_pins>;
708c2ecf20Sopenharmony_ci	fan@0 {
718c2ecf20Sopenharmony_ci		reg = <0x00>;
728c2ecf20Sopenharmony_ci		fan-tach-ch = /bits/ 8 <0x00 0x01>;
738c2ecf20Sopenharmony_ci		cooling-levels = <127 255>;
748c2ecf20Sopenharmony_ci	};
758c2ecf20Sopenharmony_ci	fan@1 {
768c2ecf20Sopenharmony_ci		reg = <0x01>;
778c2ecf20Sopenharmony_ci		fan-tach-ch = /bits/ 8 <0x02 0x03>;
788c2ecf20Sopenharmony_ci	};
798c2ecf20Sopenharmony_ci	fan@2 {
808c2ecf20Sopenharmony_ci		reg = <0x02>;
818c2ecf20Sopenharmony_ci		fan-tach-ch = /bits/ 8 <0x04>;
828c2ecf20Sopenharmony_ci	};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci};
85