All of lore.kernel.org
 help / color / mirror / Atom feed
* pinctrl in phosphor-hwmon
@ 2019-12-09 12:15 Deng Tyler
  2019-12-09 14:58 ` Matt Spinler
  0 siblings, 1 reply; 10+ messages in thread
From: Deng Tyler @ 2019-12-09 12:15 UTC (permalink / raw)
  To: OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

Hi all:
    Does phosphor-hwmon support changing gpio pin before read
/sys/class/hwmon/hwmon0/fan*_input while monitoring fan sensor? In my
platform, fans gpio are connect to pin-mux and I need control gpio before
get fan tach rpm.

Regards,
Tyler

[-- Attachment #2: Type: text/html, Size: 319 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-09 12:15 pinctrl in phosphor-hwmon Deng Tyler
@ 2019-12-09 14:58 ` Matt Spinler
  2019-12-10  5:08   ` Deng Tyler
  0 siblings, 1 reply; 10+ messages in thread
From: Matt Spinler @ 2019-12-09 14:58 UTC (permalink / raw)
  To: Deng Tyler, OpenBMC Maillist



On 12/9/2019 6:15 AM, Deng Tyler wrote:
> Hi all:
>     Does phosphor-hwmon support changing gpio pin before read 
> /sys/class/hwmon/hwmon0/fan*_input while monitoring fan sensor? In my 
> platform, fans gpio are connect to pin-mux and I need control gpio 
> before get fan tach rpm.

It does have the ability to modify a GPIO before/after a reading:
https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447

configured by some lines in the conf file, like:
https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4

>
> Regards,
> Tyler

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-09 14:58 ` Matt Spinler
@ 2019-12-10  5:08   ` Deng Tyler
  2019-12-10 16:28     ` Matt Spinler
  0 siblings, 1 reply; 10+ messages in thread
From: Deng Tyler @ 2019-12-10  5:08 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 1037 bytes --]

Hi Matt:
    Thank for your response that's really helpful. I check the link and it
seems allow a gpio set to high before/after reading a correspond sensor. Is
it possible change 2 gpio to high/low for reading a correspond sensor?

Regards,
Tyler

Matt Spinler <mspinler@linux.ibm.com> 於 2019年12月9日 週一 下午10:58寫道:

>
>
> On 12/9/2019 6:15 AM, Deng Tyler wrote:
> > Hi all:
> >     Does phosphor-hwmon support changing gpio pin before read
> > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan sensor? In my
> > platform, fans gpio are connect to pin-mux and I need control gpio
> > before get fan tach rpm.
>
> It does have the ability to modify a GPIO before/after a reading:
> https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
>
> configured by some lines in the conf file, like:
>
> https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
>
> >
> > Regards,
> > Tyler
>
>

[-- Attachment #2: Type: text/html, Size: 1734 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-10  5:08   ` Deng Tyler
@ 2019-12-10 16:28     ` Matt Spinler
  2019-12-11  6:40       ` Deng Tyler
  0 siblings, 1 reply; 10+ messages in thread
From: Matt Spinler @ 2019-12-10 16:28 UTC (permalink / raw)
  To: Deng Tyler; +Cc: OpenBMC Maillist



On 12/9/2019 11:08 PM, Deng Tyler wrote:
> Hi Matt:
>     Thank for your response that's really helpful. I check the link 
> and it seems allow a gpio set to high before/after reading a 
> correspond sensor. Is it possible change 2 gpio to high/low for 
> reading a correspond sensor?

That isn't possible in the current code, but I don't see why someone 
couldn't add that feature.

>
> Regards,
> Tyler
>
> Matt Spinler <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>> 
> 於 2019年12月9日 週一 下午10:58寫道:
>
>
>
>     On 12/9/2019 6:15 AM, Deng Tyler wrote:
>     > Hi all:
>     >     Does phosphor-hwmon support changing gpio pin before read
>     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan sensor?
>     In my
>     > platform, fans gpio are connect to pin-mux and I need control gpio
>     > before get fan tach rpm.
>
>     It does have the ability to modify a GPIO before/after a reading:
>     https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
>
>     configured by some lines in the conf file, like:
>     https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
>
>     >
>     > Regards,
>     > Tyler
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-10 16:28     ` Matt Spinler
@ 2019-12-11  6:40       ` Deng Tyler
  2019-12-12 20:33         ` Matt Spinler
  0 siblings, 1 reply; 10+ messages in thread
From: Deng Tyler @ 2019-12-11  6:40 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 1880 bytes --]

I added gpio control in my fan driver but I still met some problem. While
phosphor-hwmon reading fan0_input, the fan tach driver change 2 gpio pin
and sleep 2 seconds to return rpm value for stable. There are 12 fan
sensors in my platform so the phosphor-hwmon need wait 24 senconds at least
to get rpm. The waiting time cause dbus hang while issuing ipmi sensor
command. Do you have any suggestions?

Tyler

Matt Spinler <mspinler@linux.ibm.com> 於 2019年12月11日 週三 上午12:29寫道:

>
>
> On 12/9/2019 11:08 PM, Deng Tyler wrote:
> > Hi Matt:
> >     Thank for your response that's really helpful. I check the link
> > and it seems allow a gpio set to high before/after reading a
> > correspond sensor. Is it possible change 2 gpio to high/low for
> > reading a correspond sensor?
>
> That isn't possible in the current code, but I don't see why someone
> couldn't add that feature.
>
> >
> > Regards,
> > Tyler
> >
> > Matt Spinler <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>>
> > 於 2019年12月9日 週一 下午10:58寫道:
> >
> >
> >
> >     On 12/9/2019 6:15 AM, Deng Tyler wrote:
> >     > Hi all:
> >     >     Does phosphor-hwmon support changing gpio pin before read
> >     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan sensor?
> >     In my
> >     > platform, fans gpio are connect to pin-mux and I need control gpio
> >     > before get fan tach rpm.
> >
> >     It does have the ability to modify a GPIO before/after a reading:
> >
> https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
> >
> >     configured by some lines in the conf file, like:
> >
> https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
> >
> >     >
> >     > Regards,
> >     > Tyler
> >
>
>

[-- Attachment #2: Type: text/html, Size: 2887 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-11  6:40       ` Deng Tyler
@ 2019-12-12 20:33         ` Matt Spinler
  2019-12-12 21:15           ` Kun Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Matt Spinler @ 2019-12-12 20:33 UTC (permalink / raw)
  To: Deng Tyler; +Cc: OpenBMC Maillist



On 12/11/2019 12:40 AM, Deng Tyler wrote:
> I added gpio control in my fan driver but I still met some problem. 
> While phosphor-hwmon reading fan0_input, the fan tach driver change 2 
> gpio pin and sleep 2 seconds to return rpm value for stable. There are 
> 12 fan sensors in my platform so the phosphor-hwmon need wait 24 
> senconds at least to get rpm. The waiting time cause dbus hang while 
> issuing ipmi sensor command. Do you have any suggestions?

I vaguely remember someone else had this problem before, and it turned 
out to be a device driver
problem as the reason it was so slow.

Otherwise, the reads could probably be changed to be asynchronous, but 
that could be a pretty big
change to the application.

>
> Tyler
>
> Matt Spinler <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>> 
> 於 2019年12月11日 週三 上午12:29寫道:
>
>
>
>     On 12/9/2019 11:08 PM, Deng Tyler wrote:
>     > Hi Matt:
>     >     Thank for your response that's really helpful. I check the link
>     > and it seems allow a gpio set to high before/after reading a
>     > correspond sensor. Is it possible change 2 gpio to high/low for
>     > reading a correspond sensor?
>
>     That isn't possible in the current code, but I don't see why someone
>     couldn't add that feature.
>
>     >
>     > Regards,
>     > Tyler
>     >
>     > Matt Spinler <mspinler@linux.ibm.com
>     <mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com
>     <mailto:mspinler@linux.ibm.com>>>
>     > 於 2019年12月9日 週一 下午10:58寫道:
>     >
>     >
>     >
>     >     On 12/9/2019 6:15 AM, Deng Tyler wrote:
>     >     > Hi all:
>     >     >     Does phosphor-hwmon support changing gpio pin before read
>     >     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan
>     sensor?
>     >     In my
>     >     > platform, fans gpio are connect to pin-mux and I need
>     control gpio
>     >     > before get fan tach rpm.
>     >
>     >     It does have the ability to modify a GPIO before/after a
>     reading:
>     >
>     https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
>     >
>     >     configured by some lines in the conf file, like:
>     >
>     https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
>     >
>     >     >
>     >     > Regards,
>     >     > Tyler
>     >
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-12 20:33         ` Matt Spinler
@ 2019-12-12 21:15           ` Kun Yi
  2019-12-17 12:27             ` Deng Tyler
  0 siblings, 1 reply; 10+ messages in thread
From: Kun Yi @ 2019-12-12 21:15 UTC (permalink / raw)
  To: Matt Spinler; +Cc: Deng Tyler, OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 3178 bytes --]

On Thu, Dec 12, 2019 at 12:34 PM Matt Spinler <mspinler@linux.ibm.com>
wrote:

>
>
> On 12/11/2019 12:40 AM, Deng Tyler wrote:
> > I added gpio control in my fan driver but I still met some problem.
> > While phosphor-hwmon reading fan0_input, the fan tach driver change 2
> > gpio pin and sleep 2 seconds to return rpm value for stable. There are
> > 12 fan sensors in my platform so the phosphor-hwmon need wait 24
> > senconds at least to get rpm. The waiting time cause dbus hang while
> > issuing ipmi sensor command. Do you have any suggestions?
>
> I vaguely remember someone else had this problem before, and it turned
> out to be a device driver
> problem as the reason it was so slow.
>

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)


>
> Otherwise, the reads could probably be changed to be asynchronous, but
> that could be a pretty big
> change to the application.


There is some work-in-progress patch to add async read support. The patch
works, although the code change is not clean enough.
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/24337


>


> >
> > Tyler
> >
> > Matt Spinler <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>>
> > 於 2019年12月11日 週三 上午12:29寫道:
> >
> >
> >
> >     On 12/9/2019 11:08 PM, Deng Tyler wrote:
> >     > Hi Matt:
> >     >     Thank for your response that's really helpful. I check the link
> >     > and it seems allow a gpio set to high before/after reading a
> >     > correspond sensor. Is it possible change 2 gpio to high/low for
> >     > reading a correspond sensor?
> >
> >     That isn't possible in the current code, but I don't see why someone
> >     couldn't add that feature.
> >
> >     >
> >     > Regards,
> >     > Tyler
> >     >
> >     > Matt Spinler <mspinler@linux.ibm.com
> >     <mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com
> >     <mailto:mspinler@linux.ibm.com>>>
> >     > 於 2019年12月9日 週一 下午10:58寫道:
> >     >
> >     >
> >     >
> >     >     On 12/9/2019 6:15 AM, Deng Tyler wrote:
> >     >     > Hi all:
> >     >     >     Does phosphor-hwmon support changing gpio pin before read
> >     >     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan
> >     sensor?
> >     >     In my
> >     >     > platform, fans gpio are connect to pin-mux and I need
> >     control gpio
> >     >     > before get fan tach rpm.
> >     >
> >     >     It does have the ability to modify a GPIO before/after a
> >     reading:
> >     >
> >
> https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
> >     >
> >     >     configured by some lines in the conf file, like:
> >     >
> >
> https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
> >     >
> >     >     >
> >     >     > Regards,
> >     >     > Tyler
> >     >
> >
>
>

-- 
Regards,
Kun

[-- Attachment #2: Type: text/html, Size: 5471 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: pinctrl in phosphor-hwmon
  2019-12-12 21:15           ` Kun Yi
@ 2019-12-17 12:27             ` Deng Tyler
  2019-12-19  8:37               ` [External] " Derek Lin23
  0 siblings, 1 reply; 10+ messages in thread
From: Deng Tyler @ 2019-12-17 12:27 UTC (permalink / raw)
  To: Kun Yi; +Cc: Matt Spinler, OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 4217 bytes --]

Hi Kun
    Thank for your response and that's highly appreciated.
I patch the async read support but it still not working, following is my
configuration. Anything I missing?
LABEL_fan0=fan1A
LABEL_fan1=fan1B
LABEL_fan2=fan2A
LABEL_fan3=fan2B
LABEL_fan4=fan3A
LABEL_fan5=fan3B
LABEL_fan6=fan4A
LABEL_fan7=fan4B
LABEL_fan8=fan5A
LABEL_fan9=fan5B
LABEL_fan10=fan6A
LABEL_fan11=fan6B
ASYNC_READ_TIMEOUT_fan0 = "3000"
ASYNC_READ_TIMEOUT_fan1 = "3000"
ASYNC_READ_TIMEOUT_fan2 = "3000"
ASYNC_READ_TIMEOUT_fan3 = "3000"
ASYNC_READ_TIMEOUT_fan4 = "3000"
ASYNC_READ_TIMEOUT_fan5 = "3000"
ASYNC_READ_TIMEOUT_fan6 = "3000"
ASYNC_READ_TIMEOUT_fan7 = "3000"
ASYNC_READ_TIMEOUT_fan8 = "3000"
ASYNC_READ_TIMEOUT_fan9 = "3000"
ASYNC_READ_TIMEOUT_fan10 = "3000"
ASYNC_READ_TIMEOUT_fan11 = "3000"
INTERVAL=10000000

Tyler

Kun Yi <kunyi@google.com> 於 2019年12月13日 週五 上午5:15寫道:

>
>
> On Thu, Dec 12, 2019 at 12:34 PM Matt Spinler <mspinler@linux.ibm.com>
> wrote:
>
>>
>>
>> On 12/11/2019 12:40 AM, Deng Tyler wrote:
>> > I added gpio control in my fan driver but I still met some problem.
>> > While phosphor-hwmon reading fan0_input, the fan tach driver change 2
>> > gpio pin and sleep 2 seconds to return rpm value for stable. There are
>> > 12 fan sensors in my platform so the phosphor-hwmon need wait 24
>> > senconds at least to get rpm. The waiting time cause dbus hang while
>> > issuing ipmi sensor command. Do you have any suggestions?
>>
>> I vaguely remember someone else had this problem before, and it turned
>> out to be a device driver
>> problem as the reason it was so slow.
>>
>
> 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)
>
>
>>
>> Otherwise, the reads could probably be changed to be asynchronous, but
>> that could be a pretty big
>> change to the application.
>
>
> There is some work-in-progress patch to add async read support. The patch
> works, although the code change is not clean enough.
> https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/24337
>
>
>>
>
>
>> >
>> > Tyler
>> >
>> > Matt Spinler <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>>
>> > 於 2019年12月11日 週三 上午12:29寫道:
>> >
>> >
>> >
>> >     On 12/9/2019 11:08 PM, Deng Tyler wrote:
>> >     > Hi Matt:
>> >     >     Thank for your response that's really helpful. I check the
>> link
>> >     > and it seems allow a gpio set to high before/after reading a
>> >     > correspond sensor. Is it possible change 2 gpio to high/low for
>> >     > reading a correspond sensor?
>> >
>> >     That isn't possible in the current code, but I don't see why someone
>> >     couldn't add that feature.
>> >
>> >     >
>> >     > Regards,
>> >     > Tyler
>> >     >
>> >     > Matt Spinler <mspinler@linux.ibm.com
>> >     <mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com
>> >     <mailto:mspinler@linux.ibm.com>>>
>> >     > 於 2019年12月9日 週一 下午10:58寫道:
>> >     >
>> >     >
>> >     >
>> >     >     On 12/9/2019 6:15 AM, Deng Tyler wrote:
>> >     >     > Hi all:
>> >     >     >     Does phosphor-hwmon support changing gpio pin before
>> read
>> >     >     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan
>> >     sensor?
>> >     >     In my
>> >     >     > platform, fans gpio are connect to pin-mux and I need
>> >     control gpio
>> >     >     > before get fan tach rpm.
>> >     >
>> >     >     It does have the ability to modify a GPIO before/after a
>> >     reading:
>> >     >
>> >
>> https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
>> >     >
>> >     >     configured by some lines in the conf file, like:
>> >     >
>> >
>> https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
>> >     >
>> >     >     >
>> >     >     > Regards,
>> >     >     > Tyler
>> >     >
>> >
>>
>>
>
> --
> Regards,
> Kun
>

[-- Attachment #2: Type: text/html, Size: 6903 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [External]  Re: pinctrl in phosphor-hwmon
  2019-12-17 12:27             ` Deng Tyler
@ 2019-12-19  8:37               ` Derek Lin23
  2020-01-06 18:51                 ` Matt Spinler
  0 siblings, 1 reply; 10+ messages in thread
From: Derek Lin23 @ 2019-12-19  8:37 UTC (permalink / raw)
  To: Deng Tyler, Kun Yi; +Cc: OpenBMC Maillist, Matt Spinler

[-- Attachment #1: Type: text/plain, Size: 5110 bytes --]

Hi all:

          We’ve met the similar situation, so use this thread to follow-up.

          We have two fan tachs that share the same PWM, and we have a GPIO mux which switches between the two fan tachs.
          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.
          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.

          Please provide some ideas.

Thank you,

Derek

From: openbmc <openbmc-bounces+dlin23=lenovo.com@lists.ozlabs.org> On Behalf Of Deng Tyler
Sent: Tuesday, December 17, 2019 8:28 PM
To: Kun Yi <kunyi@google.com>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>; Matt Spinler <mspinler@linux.ibm.com>
Subject: [External] Re: pinctrl in phosphor-hwmon

Hi Kun
    Thank for your response and that's highly appreciated.
I patch the async read support but it still not working, following is my configuration. Anything I missing?
LABEL_fan0=fan1A
LABEL_fan1=fan1B
LABEL_fan2=fan2A
LABEL_fan3=fan2B
LABEL_fan4=fan3A
LABEL_fan5=fan3B
LABEL_fan6=fan4A
LABEL_fan7=fan4B
LABEL_fan8=fan5A
LABEL_fan9=fan5B
LABEL_fan10=fan6A
LABEL_fan11=fan6B
ASYNC_READ_TIMEOUT_fan0 = "3000"
ASYNC_READ_TIMEOUT_fan1 = "3000"
ASYNC_READ_TIMEOUT_fan2 = "3000"
ASYNC_READ_TIMEOUT_fan3 = "3000"
ASYNC_READ_TIMEOUT_fan4 = "3000"
ASYNC_READ_TIMEOUT_fan5 = "3000"
ASYNC_READ_TIMEOUT_fan6 = "3000"
ASYNC_READ_TIMEOUT_fan7 = "3000"
ASYNC_READ_TIMEOUT_fan8 = "3000"
ASYNC_READ_TIMEOUT_fan9 = "3000"
ASYNC_READ_TIMEOUT_fan10 = "3000"
ASYNC_READ_TIMEOUT_fan11 = "3000"
INTERVAL=10000000

Tyler

Kun Yi <kunyi@google.com<mailto:kunyi@google.com>> 於 2019年12月13日 週五 上午5:15寫道:


On Thu, Dec 12, 2019 at 12:34 PM Matt Spinler <mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com>> wrote:


On 12/11/2019 12:40 AM, Deng Tyler wrote:
> I added gpio control in my fan driver but I still met some problem.
> While phosphor-hwmon reading fan0_input, the fan tach driver change 2
> gpio pin and sleep 2 seconds to return rpm value for stable. There are
> 12 fan sensors in my platform so the phosphor-hwmon need wait 24
> senconds at least to get rpm. The waiting time cause dbus hang while
> issuing ipmi sensor command. Do you have any suggestions?

I vaguely remember someone else had this problem before, and it turned
out to be a device driver
problem as the reason it was so slow.

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)


Otherwise, the reads could probably be changed to be asynchronous, but
that could be a pretty big
change to the application.

There is some work-in-progress patch to add async read support. The patch works, although the code change is not clean enough.
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/24337



>
> Tyler
>
> Matt Spinler <mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com>>>
> 於 2019年12月11日 週三 上午12:29寫道:
>
>
>
>     On 12/9/2019 11:08 PM, Deng Tyler wrote:
>     > Hi Matt:
>     >     Thank for your response that's really helpful. I check the link
>     > and it seems allow a gpio set to high before/after reading a
>     > correspond sensor. Is it possible change 2 gpio to high/low for
>     > reading a correspond sensor?
>
>     That isn't possible in the current code, but I don't see why someone
>     couldn't add that feature.
>
>     >
>     > Regards,
>     > Tyler
>     >
>     > Matt Spinler <mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com>
>     <mailto:mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com>> <mailto:mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com>
>     <mailto:mspinler@linux.ibm.com<mailto:mspinler@linux.ibm.com>>>>
>     > 於 2019年12月9日 週一 下午10:58寫道:
>     >
>     >
>     >
>     >     On 12/9/2019 6:15 AM, Deng Tyler wrote:
>     >     > Hi all:
>     >     >     Does phosphor-hwmon support changing gpio pin before read
>     >     > /sys/class/hwmon/hwmon0/fan*_input while monitoring fan
>     sensor?
>     >     In my
>     >     > platform, fans gpio are connect to pin-mux and I need
>     control gpio
>     >     > before get fan tach rpm.
>     >
>     >     It does have the ability to modify a GPIO before/after a
>     reading:
>     >
>     https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
>     >
>     >     configured by some lines in the conf file, like:
>     >
>     https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
>     >
>     >     >
>     >     > Regards,
>     >     > Tyler
>     >
>


--
Regards,
Kun

[-- Attachment #2: Type: text/html, Size: 15247 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [External] Re: pinctrl in phosphor-hwmon
  2019-12-19  8:37               ` [External] " Derek Lin23
@ 2020-01-06 18:51                 ` Matt Spinler
  0 siblings, 0 replies; 10+ messages in thread
From: Matt Spinler @ 2020-01-06 18:51 UTC (permalink / raw)
  To: Derek Lin23, Deng Tyler, Kun Yi; +Cc: OpenBMC Maillist



On 12/19/2019 2:37 AM, Derek Lin23 wrote:
>
> Hi all:
>
>           We’ve met the similar situation, so use this thread to 
> follow-up.
>
>           We have two fan tachs that share the same PWM, and we have a 
> GPIO mux which switches between the two fan tachs.
>
>           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.
>
>           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.
>
>           Please provide some ideas.
>

Could the driver be updated to handle that, so phosphor-hwmon doesn't 
have to care?


> Thank you,
>
>
> Derek
>
> *From:*openbmc <openbmc-bounces+dlin23=lenovo.com@lists.ozlabs.org> 
> *On Behalf Of *Deng Tyler
> *Sent:* Tuesday, December 17, 2019 8:28 PM
> *To:* Kun Yi <kunyi@google.com>
> *Cc:* OpenBMC Maillist <openbmc@lists.ozlabs.org>; Matt Spinler 
> <mspinler@linux.ibm.com>
> *Subject:* [External] Re: pinctrl in phosphor-hwmon
>
> Hi Kun
>
>     Thank for your response and that's highly appreciated.
>
> I patch the async read support but it still not working, following is 
> my configuration. Anything I missing?
>
> LABEL_fan0=fan1A
> LABEL_fan1=fan1B
> LABEL_fan2=fan2A
> LABEL_fan3=fan2B
> LABEL_fan4=fan3A
> LABEL_fan5=fan3B
> LABEL_fan6=fan4A
> LABEL_fan7=fan4B
> LABEL_fan8=fan5A
> LABEL_fan9=fan5B
> LABEL_fan10=fan6A
> LABEL_fan11=fan6B
> ASYNC_READ_TIMEOUT_fan0 = "3000"
> ASYNC_READ_TIMEOUT_fan1 = "3000"
> ASYNC_READ_TIMEOUT_fan2 = "3000"
> ASYNC_READ_TIMEOUT_fan3 = "3000"
> ASYNC_READ_TIMEOUT_fan4 = "3000"
> ASYNC_READ_TIMEOUT_fan5 = "3000"
> ASYNC_READ_TIMEOUT_fan6 = "3000"
> ASYNC_READ_TIMEOUT_fan7 = "3000"
> ASYNC_READ_TIMEOUT_fan8 = "3000"
> ASYNC_READ_TIMEOUT_fan9 = "3000"
> ASYNC_READ_TIMEOUT_fan10 = "3000"
> ASYNC_READ_TIMEOUT_fan11 = "3000"
>
> INTERVAL=10000000
>
> Tyler
>
> Kun Yi <kunyi@google.com <mailto:kunyi@google.com>> 於2019年12月13日 週五 
> 上午5:15寫道:
>
>     On Thu, Dec 12, 2019 at 12:34 PM Matt Spinler
>     <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>> wrote:
>
>
>
>         On 12/11/2019 12:40 AM, Deng Tyler wrote:
>         > I added gpio control in my fan driver but I still met some
>         problem.
>         > While phosphor-hwmon reading fan0_input, the fan tach driver
>         change 2
>         > gpio pin and sleep 2 seconds to return rpm value for stable.
>         There are
>         > 12 fan sensors in my platform so the phosphor-hwmon need
>         wait 24
>         > senconds at least to get rpm. The waiting time cause dbus
>         hang while
>         > issuing ipmi sensor command. Do you have any suggestions?
>
>         I vaguely remember someone else had this problem before, and
>         it turned
>         out to be a device driver
>         problem as the reason it was so slow.
>
>     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)
>
>
>         Otherwise, the reads could probably be changed to be
>         asynchronous, but
>         that could be a pretty big
>         change to the application.
>
>     There is some work-in-progress patch to add async read support.
>     The patch works, although the code change is not clean enough.
>
>     https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/24337
>
>
>         >
>         > Tyler
>         >
>         > Matt Spinler <mspinler@linux.ibm.com
>         <mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com
>         <mailto:mspinler@linux.ibm.com>>>
>         > 於2019年12月11日 週三 上午12:29寫道:
>         >
>         >
>         >
>         >     On 12/9/2019 11:08 PM, Deng Tyler wrote:
>         >     > Hi Matt:
>         >     >     Thank for your response that's really helpful. I
>         check the link
>         >     > and it seems allow a gpio set to high before/after
>         reading a
>         >     > correspond sensor. Is it possible change 2 gpio to
>         high/low for
>         >     > reading a correspond sensor?
>         >
>         >     That isn't possible in the current code, but I don't see
>         why someone
>         >     couldn't add that feature.
>         >
>         >     >
>         >     > Regards,
>         >     > Tyler
>         >     >
>         >     > Matt Spinler <mspinler@linux.ibm.com
>         <mailto:mspinler@linux.ibm.com>
>         >     <mailto:mspinler@linux.ibm.com
>         <mailto:mspinler@linux.ibm.com>>
>         <mailto:mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>
>         >     <mailto:mspinler@linux.ibm.com
>         <mailto:mspinler@linux.ibm.com>>>>
>         >     > 於2019年12月9日 週一 下午10:58寫道:
>         >     >
>         >     >
>         >     >
>         >     >     On 12/9/2019 6:15 AM, Deng Tyler wrote:
>         >     >     > Hi all:
>         >     >     >     Does phosphor-hwmon support changing gpio
>         pin before read
>         >     >     > /sys/class/hwmon/hwmon0/fan*_input
>         while monitoring fan
>         >     sensor?
>         >     >     In my
>         >     >     > platform, fans gpio are connect to pin-mux and I
>         need
>         >     control gpio
>         >     >     > before get fan tach rpm.
>         >     >
>         >     >     It does have the ability to modify a GPIO
>         before/after a
>         >     reading:
>         >     >
>         >
>         https://github.com/openbmc/phosphor-hwmon/blob/master/mainloop.cpp#L447
>         >     >
>         >     >     configured by some lines in the conf file, like:
>         >     >
>         >
>         https://github.com/openbmc/meta-ibm/blob/master/meta-romulus/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf#L4
>         >     >
>         >     >     >
>         >     >     > Regards,
>         >     >     > Tyler
>         >     >
>         >
>
>
>     -- 
>
>     Regards,
>
>     Kun
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-01-06 18:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 12:15 pinctrl in phosphor-hwmon Deng Tyler
2019-12-09 14:58 ` Matt Spinler
2019-12-10  5:08   ` Deng Tyler
2019-12-10 16:28     ` Matt Spinler
2019-12-11  6:40       ` Deng Tyler
2019-12-12 20:33         ` Matt Spinler
2019-12-12 21:15           ` Kun Yi
2019-12-17 12:27             ` Deng Tyler
2019-12-19  8:37               ` [External] " Derek Lin23
2020-01-06 18:51                 ` Matt Spinler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.