Re: [hwmon-next PATCH v4 3/4] hwmon: (adt7470) Expose fan control via PWM framework

Guenter Roeck <[email protected]> Wed, 29 Jul 2026 07:22:10 -0700
Newsgroups org.kernel.vger.linux-pwm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-hwmon,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 7/29/26 04:49, Uwe Kleine-König wrote:
> On Tue, Jul 28, 2026 at 10:56:04PM -0700, Guenter Roeck wrote:
>> On 7/28/26 21:46, Luiz Angelo Daros de Luca wrote:
>>> The ADT7470 features four PWM outputs designed to control fans.
>>> Previously, these were only accessible through the legacy hwmon
>>> sysfs interface.
>>>
>>> Expose the ADT7470 fan control lines through the generic PWM framework.
>>> This allows generic PWM consumers described in Device Tree, such as
>>> "pwm-fan", to use the device through the "#pwm-cells" property.  This is
>>> particularly necessary for boards where the ADT7470 external temperature
>>> sensors are not populated and the chip is used strictly as a fan
>>> controller (e.g., Edgecore ECS-2100-52T switches). In such setups,
>>> delegating control to the generic PWM subsystem allows the kernel's
>>> thermal framework to manage the fans based on unrelated temperature
>>> zones, such as internal SoC sensors.
>>>
>>> When a PWM consumer applies a new PWM state, the driver automatically
>>> switches the corresponding PWM channel to manual mode so that the
>>> requested duty cycle takes effect. The duty cycle specified by the PWM
>>> framework is internally converted to the 0-255 scale expected by the
>>> hardware registers.
>>>
>>> The legacy sysfs interface remains unaffected and operates in parallel.
>>
>> No, I won't accept this. It has to be either or. A pwm channel modeled as pwm
>> subsystem channel must not be visible via hwmon attributes.
> 
> I didn't look in detail, but maybe my red line is a bit more lax. IMHO
> it's not OK to be able to modify a setting that results from pushing
> hwmon knobs using PWM operations or vice-versa. Switching between
> exclusive use at runtime is IMHO ok.
> 
It is my call to make, and my call is either-or to avoid confusion.

Thanks,
Guenter