Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer

2018-03-08 Thread Laxman Dewangan



On Thursday 08 March 2018 08:01 PM, Guenter Roeck wrote:

On 03/07/2018 10:06 PM, Laxman Dewangan wrote:



The RPM is measured speed via PWM signal capture  which is output 
from fan.

So should we have the fan[1..n]_output_rpm?



No. I hear you clearly that you for some reason dislike fan[1..n]_input.
While ABIs are not always to our liking, that doesn't mean that we get
to change them at our whim. If that is not acceptable for you, I can't
help you. And you can't change inX_input to inX_voltage either, sorry.


My opinion is only to not use "input" as this is not really the input to 
fan.

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer

2018-03-07 Thread Laxman Dewangan



On Wednesday 07 March 2018 07:50 PM, Guenter Roeck wrote:

On 03/07/2018 01:47 AM, Rajkumar Rampelli wrote:




While I am not opposed to ABI changes, the merits of those would 
need to be

discussed on the mailing list. But replacing "fan1_input" with "rpm" is
not an acceptable ABI change, even if it may measure something that 
turns

but isn't a fan.

If this _is_ in fact supposed to be used for something else but 
fans, we
would have to discuss what that might be, and if hwmon is the 
appropriate
subsystem to measure and report it. This does to some degree lead 
back to
my concern of having the "fan" part of this patch series in the pwm 
core.

I am still not sure if that makes sense.

Thanks,
Guenter
I am planning to add tachometer support in pwm-fan.c driver 
(drivers/hwmon/) instead of adding new generic-pwm-tachometer.c 
driver. Measuring RPM value will be done in pwm-fan driver itself 
using pwm capture feature and will add new sysfs attributes under 
this driver to report rpm value of fan.


There is an existing attribute to report the RPM of fans. It is called 
fan[1..n]_input.


"replacing "fan1_input" with "rpm" is not an acceptable ABI change"

Preemptive NACK.


The RPM is measured speed via PWM signal capture  which is output from fan.
So should we have the fan[1..n]_output_rpm?


--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] iio: adc: ina3221: Add support for IIO ADC driver for TI INA3221

2016-06-08 Thread Laxman Dewangan


On Wednesday 08 June 2016 08:34 PM, Andrew F. Davis wrote:

On 06/07/2016 05:30 PM, Guenter Roeck wrote:

On Fri, Jun 03, 2016 at 10:17:55AM -0500, Andrew F. Davis wrote:

On 06/03/2016 09:14 AM, Laxman Dewangan wrote:

On Friday 03 June 2016 06:59 PM, Guenter Roeck wrote:

On 06/03/2016 03:06 AM, Jonathan Cameron wrote:

On 01/06/16 13:34, Laxman Dewangan wrote:

The INA3221 is a three-channel, high-side current and bus voltage
monitor
with an I2C interface from Texas Instruments. The INA3221 monitors both
shunt voltage drops and bus supply voltages in addition to having
programmable conversion times and averaging modes for these signals.
The INA3221 offers both critical and warning alerts to detect multiple
programmable out-of-range conditions for each channel.

Add support for INA3221 SW driver via IIO ADC interface. The device is
register as iio-device and provides interface for voltage/current
and power
monitor. Also provide interface for setting oneshot/continuous mode and
critical/warning threshold for the shunt voltage drop.

Signed-off-by: Laxman Dewangan <ldewan...@nvidia.com>

Hi Laxman,

As ever with any driver lying on the border of IIO and hwmon, please
include
a short justification of why you need an IIO driver and also cc the
hwmon list + maintainers. (cc'd on this reply).

I simply won't take a driver where the hwmon maintainers aren't happy.
As it stands I'm not seeing obvious reasons in the code for why this
should be an IIO device.


Me not either.

I have a hwmon driver for the same chip pending from Andrew Davis (TI)
which I am just about to accept. We had directed Andrew back in April
to write a hwmon driver for the chip, which he did.


Thanks Guenter,  I found the series

[PATCH v2 0/2] Add support for INA3221 Triple Current/Voltage Monitors
Looks fine to me. I can use the hwmon.


If you search even further back you can see I originally went with an
IIO driver as well, comparing the IIO and hwmon version for the simple
use cases I needed the hwmod version turned out much simpler, so it was
probably the right framework for now.


However, some of the stuff from my patch are not there which I will add
later once original patch applied:
- Dynamic mode changes for continuous and one-shot from sysfs.
- In one shot, when try to read voltage data, do conversion and then read.


My attempt is rather minimal, to be honest I like your stab at this
driver better in some ways, especially relating to DT putting each
channel in its own node with labels, I think this is a bit more clean
and will be more extendable if/when new multi-channel monitor chips are
made.


Not sure whether exporting the following will help or not. Can you
please confirm?
- Oversampling time i.e. average sample
- conversion time for bus voltage and shunt voltage if default is not
suited for system.



These can always be added as needed, but the DT changes are not as easy.
I would like it if this got in this cycle but if you think something
will be needed to help your improvements, that can not be added
incrementally, it would probably be best to get them into the initial DT
binding doc now.


Andrew,

with this, the hwmon driver is pretty much on hold. What do you want me to do ?
Should I wait for DT updates ?


If Laxman would like to commit to making these changes I do not problem
waiting a bit to get this right the first time.

If we don't hear back soon then I'd just take it as is and anything
needing to be fixed can be later.




I will be able to post the patch tomorrow.
I think this series can be applied and then on top of it, I will post 
the dt changes and other my changes.


As this is new driver and no one using now, it will be fine to have dt 
changes if everything complete in one cycle.


I will work from the tree on which this applied to post my patches.

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] iio: adc: ina3221: Add support for IIO ADC driver for TI INA3221

2016-06-03 Thread Laxman Dewangan


On Friday 03 June 2016 05:39 PM, Jonathan Cameron wrote:

On 03/06/16 12:26, Laxman Dewangan wrote:

On Friday 03 June 2016 03:36 PM, Jonathan Cameron wrote:

I thought that all ADC or monitors are going to be part of IIO device
framework. I saw the ina2xx which is same (single channel) which was
my reference point.

That had a rather specific use case IIRC - they needed the buffered support
to get the data fast enough.


I think in our particular  requirements, we dont need the buffering 
support but HW keep monitor and check with warning/critical threshold to 
generate HW signal.

Funily enough I know this datasheet a little as was evaluating
it for use on some boards at the day job a week or so ago.

Various comments inline. Major points are:
* Don't use 'fake' channels to control events. If the events infrastructure
doesn't handle your events, then fix that rather than working around it.
* There is a lot of ABI in here concerned with oneshot vs continuous.
This seems to me to be more than it should be. We wouldn't expect to
see stuff changing as a result of switching between these modes other
than wrt to when the data shows up.  So I'd expect to not see this
directly exposed at all - but rather sit in oneshot unless either:
1) Buffered mode is running (not currently supported)
2) Alerts are on - which I think requires it to be in continuous mode.

Other question to my mind is whether we should be reporting vshunt or
(using device tree to pass resistance) current.

This is bus and shunt voltage device for power monitoring. In our
platforms, we use this device for bus current and so power monitor.

We have two usecases, one is one shot, read when it needs it. And
other continuous when we have multiple core running then continuous
mode to get the power consumption by rail.

That's fine, but continuous should be using the buffered interfaces
really as that's there explicitly to support groups of channels
captured using a sequencer.

Then the abi ends up much more standard which is nice. Also allows
for high speed ish continuous monitoring which is what the was
I think the point of the single channel driver.


The requirement for continuous monitoring is to ADC generate alert when 
the current on bus cross the threshold of warning/critical level so that 
alert signal can be used for throttling.

So in my this particular usecase, we may not need buffered data.



Yaah, alert is used only on continuous mode and mainly used for
throttling when rail power goes beyond some limit.

Of interesting in Linux, or routed directly to hardware?


Yaah, In some platform this is routed to the hardware for throttling.

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] iio: adc: ina3221: Add support for IIO ADC driver for TI INA3221

2016-06-03 Thread Laxman Dewangan


On Friday 03 June 2016 05:34 PM, Jonathan Cameron wrote:

On 03/06/16 12:31, Laxman Dewangan wrote:

On Friday 03 June 2016 03:46 PM, Jonathan Cameron wrote:

On 03/06/16 11:06, Jonathan Cameron wrote:

Code looks good, bu these more fundamental bits need sorting.

Another minor point - why do the power calculations in driver?
no hardware support for it, so why not just leave it to userspace?

Device supports the bus and shunt voltage monitoring. So even no current. Also 
the warning/critical limit is for the voltage across shunt.

So should we only expose the shunt/bus voltage, no power/current?

I am thinking that user space should not know the platform and hence shunt 
resistance and so exposing the current and power on bus is better option.


I'd go for current and voltage rather than current and power, but
otherwise agree.


OK, I will have the voltage (bus voltage) and current (on bus).
User space can get power out of this.

Thanks for suggestion.

The critical limits will be still in current. And it should be 
customized sysfs instead of the iio_chan_spec i.e. iio_device attribute 
interface.





--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] iio: adc: ina3221: Add support for IIO ADC driver for TI INA3221

2016-06-03 Thread Laxman Dewangan


On Friday 03 June 2016 03:46 PM, Jonathan Cameron wrote:

On 03/06/16 11:06, Jonathan Cameron wrote:


Code looks good, bu these more fundamental bits need sorting.

Another minor point - why do the power calculations in driver?
no hardware support for it, so why not just leave it to userspace?


Device supports the bus and shunt voltage monitoring. So even no 
current. Also the warning/critical limit is for the voltage across shunt.


So should we only expose the shunt/bus voltage, no power/current?

I am thinking that user space should not know the platform and hence 
shunt resistance and so exposing the current and power on bus is better 
option.



--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] iio: adc: ina3221: Add support for IIO ADC driver for TI INA3221

2016-06-03 Thread Laxman Dewangan


On Friday 03 June 2016 03:36 PM, Jonathan Cameron wrote:

On 01/06/16 13:34, Laxman Dewangan wrote:

Add support for INA3221 SW driver via IIO ADC interface. The device is
register as iio-device and provides interface for voltage/current and power
monitor. Also provide interface for setting oneshot/continuous mode and
critical/warning threshold for the shunt voltage drop.

Signed-off-by: Laxman Dewangan <ldewan...@nvidia.com>

Hi Laxman,

As ever with any driver lying on the border of IIO and hwmon, please include
a short justification of why you need an IIO driver and also cc the
hwmon list + maintainers. (cc'd on this reply).

I simply won't take a driver where the hwmon maintainers aren't happy.
As it stands I'm not seeing obvious reasons in the code for why this
should be an IIO device.


I thought that all ADC or monitors are going to be part of IIO device 
framework. I saw the ina2xx which is same (single channel) which was my 
reference point.




Funily enough I know this datasheet a little as was evaluating
it for use on some boards at the day job a week or so ago.

Various comments inline. Major points are:
* Don't use 'fake' channels to control events. If the events infrastructure
doesn't handle your events, then fix that rather than working around it.
* There is a lot of ABI in here concerned with oneshot vs continuous.
This seems to me to be more than it should be. We wouldn't expect to
see stuff changing as a result of switching between these modes other
than wrt to when the data shows up.  So I'd expect to not see this
directly exposed at all - but rather sit in oneshot unless either:
1) Buffered mode is running (not currently supported)
2) Alerts are on - which I think requires it to be in continuous mode.

Other question to my mind is whether we should be reporting vshunt or
(using device tree to pass resistance) current.


This is bus and shunt voltage  device for power monitoring. In our 
platforms, we use this device for bus current and so  power monitor.


We have two usecases, one is one shot, read when it needs it. And other 
continuous when we have multiple core running then continuous mode to 
get the power consumption by rail.


Yaah, alert is used only on continuous mode and mainly used for 
throttling when rail power goes beyond some limit.


--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html