From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2A1E17DFE8; Sun, 27 Oct 2024 20:05:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730059541; cv=none; b=tQCr4U7yGGETCl2Gh1SP9ncL5dax7niIL5863K+UXBcJnSuvGcHIQJFjaENAsar5NL9PTvAiNQMe+ZKjCtm4RnKAtp10tKe2k3QCqgW0qjsjsl5fUVihs2poYHbq0UQaEBJN99e2pOP3jE+8cyXlLyplxFanE64UOzJMPvZUKFs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730059541; c=relaxed/simple; bh=hLdnlnRd4TSsr2U4ETJnkSflQ4aREENISviowFqNzgg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gSz6uSVUN7yuTRzEA1Ed9j/QE9jeBDA63DvHveWnrfr3AP0zMWQqz5/q+HInMp3wqX5XRyqw9IeRAYsP0hFBSFTYqhhwOEaRLOA7azCb2KfVgner11BTuHgS/EMS6LLnWOCPz7bfrYWqWYVM6bLcRwu78IJ/KeGz4qKpm/O3GIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eUaDYCyS; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eUaDYCyS" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7ea8c4ce232so2929690a12.0; Sun, 27 Oct 2024 13:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730059539; x=1730664339; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=vFZEXMmx7eg7D7l6iGlYMICtrOffVApchYTvOrISmwM=; b=eUaDYCyS3gIRYDUn/zA3/ixzrnFucl3u41r6BHPe0d4edzH53g8Ovysas/v/L+TLh3 6FtXrQrZywAnsDVnWK78OUJqoVApFTmCvmuHAWigWJExsa1A0qAzyz8IdQUGoqTKiF9D JM+zZiYJv6RLfI8qXR8nb4mhu7Blf0JGsY8x/lFOP4pg7rJigSVcLivRemq6Wx/CZa6p 5azz6Kkgni65QvHL7s99oAHWFey3NKKGLDBuuxeKpVQANytVIBKHJ3OzAC4V0lR9Q0k8 NBfAFp7Eie6hmciRm3KIxFBRJ/Lhi4HNjN+mOU7wq60UHk3k3HqZ0go7pOnKaYSmef3j IORw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730059539; x=1730664339; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vFZEXMmx7eg7D7l6iGlYMICtrOffVApchYTvOrISmwM=; b=i7iyrxF9bjRY1CbLRQwvDdDshPp5WATQWBTjgoOgmBzu3bzvC3o4pSCvxR1COE7azP /SrFPuykeIDEzgr51tTdAbMZtEr4idAPObFBYZX2j9cfebjvfXcn2XAnCUMHE8+6SCL/ lqWhcArh4/IE7eLDyhnis3tjD8cyrGgSGPqrK6r/Werl/6oEIL+1eSvTQQ4eCz0Gr2EP ykW20W0nJtGfhaPqchGCaq3fuhXTfQsRVQuHH6iv43BsfzEVw0yCPyG2+Q0uwJHJOi8T mjP0JpKIsVEoGIKFBVZaYNEdXdbT0T5dq+tZDKlLjJKsIbg7Fh6BmEaSpOxfD6hjq8lz Zi2A== X-Forwarded-Encrypted: i=1; AJvYcCUbtkW5ioOS97kDm1HOodj90YzV6Ss5oSjQ6EsIOgwPFC2+gbW2HEY5SJXcWrwOSjP2dZbAELUtewoVIw==@vger.kernel.org, AJvYcCWVPDBunTyqV/v2MNWu1/P2QO8PeKfwQxfOeRzw7NGUZkXZFXqCXYILPBbHEbTjPvBgTwLJgIo7pKLVVGUJ@vger.kernel.org X-Gm-Message-State: AOJu0YxszQATDsrPhvEaA/6aBw8jV6Q4X07UwJNM71ElRGqfAK47gO4s TPNVlFC48p7m/K23Mdr2yU5XN8i2zDsnKzyF0GQ1OBgUHZK/aK8T X-Google-Smtp-Source: AGHT+IFfhFYEWZp37igfRwqS7InfMWLhpblCUSK2x3mWF84MhB63F38CbVqns8thLOYV74WQ6BrGIA== X-Received: by 2002:a05:6a21:178a:b0:1d9:275b:4eed with SMTP id adf61e73a8af0-1d9a8511786mr8721351637.42.1730059538850; Sun, 27 Oct 2024 13:05:38 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720579360f5sm4400017b3a.88.2024.10.27.13.05.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Oct 2024 13:05:37 -0700 (PDT) Sender: Guenter Roeck Message-ID: <528fed98-4fe0-41b6-b148-cf950866cdb3@roeck-us.net> Date: Sun, 27 Oct 2024 13:05:36 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] hwmon: pwm_enable clarification To: Derek John Clark Cc: Jean Delvare , Jonathan Corbet , Cryolita PukNgae , linux-hwmon@vger.kernel.org, open list , =?UTF-8?Q?Joaqu=C3=ADn_Ignacio_Aramend=C3=ADa?= References: <20241027174836.8588-1-derekjohn.clark@gmail.com> <24dc65c2-b6c9-4909-a784-fb81d9299f1c@roeck-us.net> <715afccb-56a5-4e8a-b7fd-e6151f241535@roeck-us.net> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY2st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of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/27/24 12:10, Derek John Clark wrote: > On Sun, Oct 27, 2024 at 11:59 AM Guenter Roeck wrote: >> >> On 10/27/24 11:29, Derek John Clark wrote: >>> On Sun, Oct 27, 2024 at 11:16 AM Guenter Roeck wrote: >>>> >>>> On 10/27/24 10:48, Derek J. Clark wrote: >>>>> Greetings all, >>>>> >>>>> I am working with Cryolita to fix up the GPD driver she submitted recently: >>>>> https://lore.kernel.org/all/20240718-gpd_fan-v4-0-116e5431a9fe@gmail.com/ >>>>> >>>>> We are currently having a discussion about the meaning of this part of the >>>>> documentation and are seeking some guidance from upstream. >>>>> >> pwm[1-*]_enable >>>>>> Fan speed control method: >>>>>> 0: no fan speed control (i.e. fan at full speed) >>>>>> 1: manual fan speed control enabled (using pwm[1-*]) >>>>>> 2+: automatic fan speed control enabled >>>>>> Check individual chip documentation files for automatic mode >>>>>> details. >>>>>> RW >>>>> >>>>> In oxp-sensors we took 0 to mean "no kernel control" so a setting of 0 is >>>>> technically "automatic" but fully controlled by the hardware with no >>>>> interaction from the driver. In her original driver draft she had taken this >>>> >>>> That is wrong. It should be (or have been) 2 or higher. Ah yes, I can see that >>>> the code sets fan control to automatic when oxp_pwm_disable() is called. >>>> Again, that is wrong. Congratulations to the submitters, you sneaked that by >>>> my review. That doesn't make it better. It is still wrong, and I call it "sneaky" >>>> because the function is not called "oxp_pwm_automatic()" or similar, it is >>>> called "oxp_pwm_disable(). Setting fan control to automatic does not disable >>>> fan control. >>>> >>>> My bad, I should have paid closer attention, and/or maybe not have trusted >>>> the submitters as much as I did. I guess I'll have to pay closer attention >>>> in the future. >>>> >>>>> literally to have the driver set the fan speed to 100% on this setting rather >>>>> then give back control to the hardware. My question is simply what is the >>>>> correct interpretation here? Ideally I would like to see this interface match >>>> >>>> It seems to me that the above text is well defined. >>>> >>>>> as existing userspace software is expecting 0 as hardware controlled and 1 as >>>>> manually controlled, but we also want to ensure this is correct before we >>>>> submit a v5. >>>>> >>>> >>>> Any such userspace expectations are simply wrong. The ABI definition is above >>>> and, again, it is well defined. >>>> >>>> 0: no fan speed control (i.e. fan at full speed) >>>> >>>> I don't really see any ambiguity in this text. This isn't about kernel control, >>>> it is an absolute statement. There is no "kernel" in "no fan speed control". >>>> "fan at full speed" should make this even more obvious. >>>> >>>> Guenter >>> >>> Guenter, >>> >>> I'll keep this in mind in the future, and I will send a patch soon to fix the >>> oxp_sensors driver. One final question, is a "0" setting mandatory? >>> >> >> No, if the hardware can not support it it doesn't make sense to mandate it. >> If the hardware does not support disabling fan control, one option would be to >> set it to manual and set the fan speed to 100%, but that isn't mandatory. > > Okay, thanks for the insight. > >> Note though that people can now argue that fixing the driver would be an ABI >> violation in itself, because after all there is some userspace code which assumes >> that setting pwm_enable to 0 fro this driver would enable automatic mode (while >> other more generic applications reasonably expect fan control to be disabled if >> the value is set to 0). In other words, fixing one ABI violation creates another. >> That is why I am really unhappy about this. >> >> Guenter > > Understandable, and I apologize for not understanding during the initial driver > development. Joaquín maintains the most prominent userspace application to use > this interface and I'm in contact with the two other developers who > use it as well. > We can certainly correct this oversight and get everyone on-board with > the correct > ABI, unless you prefer we keep it as is. > I would most definitely prefer to get it fixed. Thanks, Guenter