RE: RE: [PATCH] Input: Change msleep to usleep_range for small msecs

From: Aniroop Mathur
Date: Thu Dec 01 2016 - 05:34:56 EST


Dear Mr. Albert Zhang,

Thank you for your confirmation!

Yes, I think usleep_range(2000, 2100) is better than usleep_range(2000, 2000)
because delta time will allow the kernel to batch the processes who need to
wake up around same time and generate single interrupt to wake up all of them.
So this would be beneficial from power saving point of view.


--
Best Regards,
Aniroop Mathur

Â
Â
--------- Original Message ---------
Sender : ZHANG Xu (BST/ESA3.1)Â<Xu.Zhang@xxxxxxxxxxxx>
Date : 2016-12-01 11:19 (GMT+5:30)
Title : RE: [PATCH] Input: Change msleep to usleep_range for small msecs
Â
HelloÂAniroopÂMathur
Â
ThankÂyouÂforÂyourÂmail.
Â
WeÂhaveÂusedÂtheÂÂusleep_range()ÂfunctionÂinÂourÂnewÂproduct'sÂdriverÂandÂtheÂverificationÂresultÂÂisÂworking.
YourÂpatchÂforÂbma150ÂisÂdefinitelyÂworkingÂforÂsure.Â
Â
JustÂoneÂquestionÂneedÂyourÂanswer.
ToÂreplaceÂtheÂmsleep(2),ÂÂÂisÂÂusleep_range(2000,Â2100)ÂÂbetterÂÂthanÂusleep_range(2000,Â2000)ÂÂ?
Â
BestÂregards
Â
AlbertÂ(Xu)ÂZHANG
BST/ESA3.1ÂÂ
Â
Â
Â
Â
-----OriginalÂMessage-----
From:Âmathur.aniroop@xxxxxxxxxÂ[mailto:mathur.aniroop@xxxxxxxxx]ÂOnÂBehalfÂOfÂAniroopÂMathur
Sent:ÂTuesday,ÂNovemberÂ29,Â2016Â12:36ÂAM
To:ÂZHANGÂXuÂ(BST/ESA3.1)Â<Xu.Zhang@xxxxxxxxxxxx>;ÂDmitryÂTorokhovÂ<dmitry.torokhov@xxxxxxxxx>;Âlinux-input@xxxxxxxxxxxxxxx;Âlinux-kernel@xxxxxxxxxxxxxxx
Cc:ÂAniroopÂMathurÂ<aniroop.mathur@xxxxxxxxx>;Âs.samuel@xxxxxxxxxxx;Âr.mahale@xxxxxxxxxxx;ÂAniroopÂMathurÂ<a.mathur@xxxxxxxxxxx>
Subject:ÂRe:Â[PATCH]ÂInput:ÂChangeÂmsleepÂtoÂusleep_rangeÂforÂsmallÂmsecs
Â
HelloÂMr.ÂAlbertÂZhang,
Â
IÂamÂAniroopÂMathurÂfromÂSamsungÂR&DÂInstitute,ÂIndia.
Â
IÂhaveÂsubmittedÂoneÂpatchÂasÂbelowÂforÂreviewÂtoÂLinuxÂOpenÂSource.
TheÂproblemÂisÂthatÂweÂdoÂnotÂhaveÂtheÂhardwareÂavailableÂwithÂusÂto
testÂitÂandÂweÂwouldÂlikeÂtoÂtestÂitÂbeforeÂactuallyÂapplyingÂit.
AsÂyouÂareÂtheÂauthorÂofÂthisÂdriver,ÂsoÂIÂwouldÂlikeÂtoÂrequest
youÂifÂyouÂcouldÂhelpÂtoÂtestÂthisÂpatchÂorÂprovideÂusÂtheÂcontactÂpoints
ofÂindividualsÂwhoÂcouldÂsupportÂtoÂgetÂthisÂpatchÂtested?
Â
ThankÂyou!
Â
BR,
AniroopÂMathur
Â
Â
OnÂThu,ÂNovÂ24,Â2016ÂatÂ9:33ÂPM,ÂAniroopÂMathurÂ<a.mathur@xxxxxxxxxxx>Âwrote:
>Âmsleep(1~20)ÂmayÂnotÂdoÂwhatÂtheÂcallerÂintends,ÂandÂwillÂoftenÂsleepÂlonger.
>Â(~20ÂmsÂactualÂsleepÂforÂanyÂvalueÂgivenÂinÂtheÂ1~20msÂrange)
>ÂThisÂisÂnotÂtheÂdesiredÂbehaviourÂforÂmanyÂcasesÂlikeÂdeviceÂresumeÂtime,
>ÂdeviceÂsuspendÂtime,ÂdeviceÂenableÂtime,Âetc.
>ÂThus,ÂchangeÂmsleepÂtoÂusleep_rangeÂforÂpreciseÂwakeups.
>
>ÂSigned-off-by:ÂAniroopÂMathurÂ<a.mathur@xxxxxxxxxxx>
>Â---
>ÂÂdrivers/input/misc/bma150.cÂ|Â4Â++--
>ÂÂ1ÂfileÂchanged,Â2Âinsertions(+),Â2Âdeletions(-)
>
>ÂdiffÂ--gitÂa/drivers/input/misc/bma150.cÂb/drivers/input/misc/bma150.c
>ÂindexÂ2124390..1fa8537Â100644
>Â---Âa/drivers/input/misc/bma150.c
>Â+++Âb/drivers/input/misc/bma150.c
>Â@@Â-207,7Â+207,7Â@@ÂstaticÂintÂbma150_set_mode(structÂbma150_dataÂ*bma150,Âu8Âmode)
>ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturnÂerror;
>
>ÂÂÂÂÂÂÂÂÂifÂ(modeÂ==ÂBMA150_MODE_NORMAL)
>Â-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmsleep(2);
>Â+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂusleep_range(2000,Â2100);
>
>ÂÂÂÂÂÂÂÂÂbma150->modeÂ=Âmode;
>ÂÂÂÂÂÂÂÂÂreturnÂ0;
>Â@@Â-222,7Â+222,7Â@@ÂstaticÂintÂbma150_soft_reset(structÂbma150_dataÂ*bma150)
>ÂÂÂÂÂÂÂÂÂifÂ(error)
>ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturnÂerror;
>
>Â-ÂÂÂÂÂÂÂmsleep(2);
>Â+ÂÂÂÂÂÂÂusleep_range(2000,Â2100);
>ÂÂÂÂÂÂÂÂÂreturnÂ0;
>ÂÂ}
>
>Â--
>Â2.6.2
>
Â