Linux-Hwmon Archive mirror
 help / color / mirror / Atom feed
From: Delphine_CC_Chiu/WYHQ/Wiwynn <Delphine_CC_Chiu@wiwynn.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Delphine_CC_Chiu/WYHQ/Wiwynn <Delphine_CC_Chiu@wiwynn.com>
Cc: "patrick@stwcx.xyz" <patrick@stwcx.xyz>,
	Jean Delvare <jdelvare@suse.com>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v1] hwmon: max31790: revise the scale to write pwm
Date: Tue, 16 Apr 2024 01:48:45 +0000	[thread overview]
Message-ID: <TYZPR04MB585382F43299E49FE1D2F2D0D6082@TYZPR04MB5853.apcprd04.prod.outlook.com> (raw)
In-Reply-To: <d82d5585-ec6c-4611-ad33-9c2d00745176@roeck-us.net>



> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Friday, April 12, 2024 9:03 PM
> To: Delphine_CC_Chiu/WYHQ/Wiwynn <Delphine_CC_Chiu@wiwynn.com>
> Cc: patrick@stwcx.xyz; Jean Delvare <jdelvare@suse.com>;
> linux-hwmon@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v1] hwmon: max31790: revise the scale to write pwm
> 
>   Security Reminder: Please be aware that this email is sent by an external
> sender.
> 
> On Fri, Apr 12, 2024 at 11:25:58AM +0800, Delphine CC Chiu wrote:
> > Since the value for PWMOUT Target Duty Cycle register is a 9 bit
> > left-justified value that ranges from 0 to 511 and is contained in 2
> > bytes.
> >
> > There is an issue that the LSB of the 9 bit would always be zero if it
> > just left shift 8 bit for the value that write to PWMOUT Target Duty
> > Cycle register.
> >
> > Therefore, revise the scale of the value that was writen to pwm input
> > from 255 to 511 and modify the value to left-justified value.
> >
> 
> The only difference is that it writes 511 instead of 510. All other values are the
> same. I am not sure if that is really worth the trouble. It would have made a
> little more sense to me if you had used DIV_ROUND_CLOSEST(), but you didn't
> do that. As it is, I really don't understand the point. If it is really important to
> write 511 instead of 510, the commit description should explain that and not
> talk about the last bit always being zero (which it still is after this patch except,
> again, when writing 511 instead of 510).
> 
> Thanks,
> Guenter
> 
Hi Guenter,
Thanks for your reviewing.
I'll revise the code to use DIV_ROUND_CLOSEST().
The reason why we add this patch is that we saw an issue that the PWM signal we get with oscilloscope would not be on consistently if we set PWM to 100% to the driver, which would fail our hardware testing.
I'll describe more detail in the commit message.
Thanks.

      reply	other threads:[~2024-04-16  1:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12  3:25 [PATCH v1] hwmon: max31790: revise the scale to write pwm Delphine CC Chiu
2024-04-12 13:03 ` Guenter Roeck
2024-04-16  1:48   ` Delphine_CC_Chiu/WYHQ/Wiwynn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TYZPR04MB585382F43299E49FE1D2F2D0D6082@TYZPR04MB5853.apcprd04.prod.outlook.com \
    --to=delphine_cc_chiu@wiwynn.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=patrick@stwcx.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).