<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:新細明體;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@新細明體";
        panose-1:2 1 6 1 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"新細明體",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"新細明體",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-TW" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">Hi all:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">          We’ve met the similar situation, so use this thread to follow-up.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">         
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">          We have two fan tachs that share the same PWM, and we have a GPIO mux which switches between the two fan tachs.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">          We would like to setup two different sensors, e.g. fan_a1 and fan_a2, but use the same GPIO mux to identify the fan_input should link to one of the two
 sensors.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">          For example, when the mux is high, then fan_a1 gets RPM readings from fanx_input, and when the mux is low, then fan_a2 gets RPM readings from the same fanx_input.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">          Please provide some ideas.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D">Thank you,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D"><br>
Derek <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> openbmc <openbmc-bounces+dlin23=lenovo.com@lists.ozlabs.org>
<b>On Behalf Of </b>Deng Tyler<br>
<b>Sent:</b> Tuesday, December 17, 2019 8:28 PM<br>
<b>To:</b> Kun Yi <kunyi@google.com><br>
<b>Cc:</b> OpenBMC Maillist <openbmc@lists.ozlabs.org>; Matt Spinler <mspinler@linux.ibm.com><br>
<b>Subject:</b> [External] Re: pinctrl in phosphor-hwmon<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi Kun<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">    Thank for your response and that's highly appreciated.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I patch the async read support but it still not working, following is my configuration. Anything I missing?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">LABEL_fan0=fan1A<br>
LABEL_fan1=fan1B<br>
LABEL_fan2=fan2A<br>
LABEL_fan3=fan2B<br>
LABEL_fan4=fan3A<br>
LABEL_fan5=fan3B<br>
LABEL_fan6=fan4A<br>
LABEL_fan7=fan4B<br>
LABEL_fan8=fan5A<br>
LABEL_fan9=fan5B<br>
LABEL_fan10=fan6A<br>
LABEL_fan11=fan6B<br>
ASYNC_READ_TIMEOUT_fan0 = "3000"<br>
ASYNC_READ_TIMEOUT_fan1 = "3000"<br>
ASYNC_READ_TIMEOUT_fan2 = "3000"<br>
ASYNC_READ_TIMEOUT_fan3 = "3000"<br>
ASYNC_READ_TIMEOUT_fan4 = "3000"<br>
ASYNC_READ_TIMEOUT_fan5 = "3000"<br>
ASYNC_READ_TIMEOUT_fan6 = "3000"<br>
ASYNC_READ_TIMEOUT_fan7 = "3000"<br>
ASYNC_READ_TIMEOUT_fan8 = "3000"<br>
ASYNC_READ_TIMEOUT_fan9 = "3000"<br>
ASYNC_READ_TIMEOUT_fan10 = "3000"<br>
ASYNC_READ_TIMEOUT_fan11 = "3000"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">INTERVAL=10000000<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Tyler<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Kun Yi <<a href="mailto:kunyi@google.com">kunyi@google.com</a>>
</span>於<span lang="EN-US"> 2019</span>年<span lang="EN-US">12</span>月<span lang="EN-US">13</span>日 週五 上午<span lang="EN-US">5:15</span>寫道:<span lang="EN-US"><o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">On Thu, Dec 12, 2019 at 12:34 PM Matt Spinler <<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a>> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><span lang="EN-US"><br>
<br>
On 12/11/2019 12:40 AM, Deng Tyler wrote:<br>
> I added gpio control in my fan driver but I still met some problem. <br>
> While phosphor-hwmon reading fan0_input, the fan tach driver change 2 <br>
> gpio pin and sleep 2 seconds to return rpm value for stable. There are <br>
> 12 fan sensors in my platform so the phosphor-hwmon need wait 24 <br>
> senconds at least to get rpm. The waiting time cause dbus hang while <br>
> issuing ipmi sensor command. Do you have any suggestions?<br>
<br>
I vaguely remember someone else had this problem before, and it turned <br>
out to be a device driver<br>
problem as the reason it was so slow.<o:p></o:p></span></p>
</blockquote>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Yea the best test is to read from the kernel sysfs interface and post how long it takes. If the device is misbehaving or the physical bus (i2c/fantach) is not working properly, the delay could easily be O(seconds)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><span lang="EN-US"><br>
Otherwise, the reads could probably be changed to be asynchronous, but <br>
that could be a pretty big<br>
change to the application.<o:p></o:p></span></p>
</blockquote>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">There is some work-in-progress patch to add async read support. The patch works, although the code change is not clean enough.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><a href="https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/24337" target="_blank">https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/24337</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</blockquote>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US"><br>
><br>
> Tyler<br>
><br>
> Matt Spinler <<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a> <mailto:<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a>>>
<br>
> </span>於<span lang="EN-US"> 2019</span>年<span lang="EN-US">12</span>月<span lang="EN-US">11</span>日 週三 上午<span lang="EN-US">12:29</span>寫道:<span lang="EN-US"><br>
><br>
><br>
><br>
>     On 12/9/2019 11:08 PM, Deng Tyler wrote:<br>
>     > Hi Matt:<br>
>     >     Thank for your response that's really helpful. I check the link<br>
>     > and it seems allow a gpio set to high before/after reading a<br>
>     > correspond sensor. Is it possible change 2 gpio to high/low for<br>
>     > reading a correspond sensor?<br>
><br>
>     That isn't possible in the current code, but I don't see why someone<br>
>     couldn't add that feature.<br>
><br>
>     ><br>
>     > Regards,<br>
>     > Tyler<br>
>     ><br>
>     > Matt Spinler <<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a><br>
>     <mailto:<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a>> <mailto:<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a><br>
>     <mailto:<a href="mailto:mspinler@linux.ibm.com" target="_blank">mspinler@linux.ibm.com</a>>>><br>
>     > </span>於<span lang="EN-US"> 2019</span>年<span lang="EN-US">12</span>月<span lang="EN-US">9</span>日 週一 下午<span lang="EN-US">10:58</span>寫道:<span lang="EN-US"><br>
>     ><br>
>     ><br>
>     ><br>
>     >     On 12/9/2019 6:15 AM, Deng Tyler wrote:<br>
>     >     > Hi all:<br>
>     >     >     Does phosphor-hwmon support changing gpio pin before read<br>
>     >     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan<br>
>     sensor?<br>
>     >     In my<br>
>     >     > platform, fans gpio are connect to pin-mux and I need<br>
>     control gpio<br>
>     >     > before get fan tach rpm.<br>
>     ><br>
>     >     It does have the ability to modify a GPIO before/after a<br>
>     reading:<br>
>     ><br>
>     <a href="https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447" target="_blank">https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447</a><br>
>     ><br>
>     >     configured by some lines in the conf file, like:<br>
>     ><br>
>     <a href="https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4" target="_blank">https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4</a><br>
>     ><br>
>     >     ><br>
>     >     > Regards,<br>
>     >     > Tyler<br>
>     ><br>
><o:p></o:p></span></p>
</blockquote>
</div>
<p class="MsoNormal"><span lang="EN-US"><br clear="all">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US">-- <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Regards,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Kun<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>