Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1251651

Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz
Date 2015-10-20 15:00 +0200
Message-ID <qlEGe-4bA-17@gated-at.bofh.it> (permalink)
References <qlu49-5wE-21@gated-at.bofh.it> <qlAsV-6zL-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/20/2015 01:20 AM, Marc Titinger wrote:
> With the current implementation, the driver will prevent a readout at a
> pace faster than the default conversion time (2ms) times the averaging
> setting, min AVG being 1:1.
>
> Any sysfs "show" read access from the client app faster than 500 Hz will be
> 'cached' by the driver, but actually since do_update reads all 8 registers,
> the best achievable measurement rate is roughly 8*800 us (for the time
> spent in i2c-core) i.e. <= 156Hz with Beagle Bone Black.
>
> This change set uses a register mask to allow for the readout of a single
> i2c register at a time. Furthermore, performing subsequent reads on the
> same register will make use of the ability of the i2c chip to retain the
> last reg offset, hence use a shorter i2c message (roughly 400us instead of
> 800us spent in i2c-core.c).
>
That doesn't work. There could be accesses from other sources (such as through
i2c-dev, or in multi-master systems) between two reads.

> The best readout rate for a single measurement is now around 2kHz. And for
> four measurements around (1/(4*800us) = 312 Hz. Since for any readout rate
> faster than 160 Hz the interval is set by the i2c transactions completion,
> the 'last-update' anti-flooding code will not have a limiting effect in
> practice. Hence I also remove the elapsed time checking in the hwmon driver
> for ina2xx.
>
> To summarize, the patch provides a max bandwidth improvement with hwmon
> client apps from ~160 Hz to ~320 Hz, and better in single-channel
> polling mode.
>
Overall your patch pretty much re-implements regmap. Since you drop caching,
it is also unnecessary to read all registers at a time, so you can just use
a function to read _one_ register and returns its value (with retries).
Or use regmap. Either case, do_update() and ina2xx_update_device() are no
longer needed.

If you want to convert the driver to regmap, just look for 'regmap' in
drivers/hwmon for examples.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-19 18:30 +0200
  Re: [RFC] hwmon: ina2xx: allow for actual measurement bandwidth above  160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 03:40 +0200
    Re: [RFC] hwmon: ina2xx: allow for actual measurement bandwidth above  160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 10:00 +0200
    [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 10:30 +0200
      Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 15:00 +0200
        Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 15:20 +0200
          Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 15:40 +0200
            Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 15:50 +0200
              Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 19:10 +0200
                Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-21 09:50 +0200
            Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth above  160 Hz Michael Turquette <mturquette@baylibre.com> - 2015-10-20 16:00 +0200
        [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Marc Titinger <mtitinger@baylibre.com> - 2015-10-23 18:20 +0200
          Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Guenter Roeck <linux@roeck-us.net> - 2015-10-23 19:00 +0200
            Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Marc Titinger <mtitinger@baylibre.com> - 2015-10-23 22:40 +0200
              Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Guenter Roeck <linux@roeck-us.net> - 2015-10-24 04:30 +0200
              Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Guenter Roeck <linux@roeck-us.net> - 2015-10-24 14:50 +0200
                [PATCH 0/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-26 17:30 +0100
                [PATCH 2/2] hwmon: ina2xx: give precedence to DT over checking for platform data. Marc Titinger <mtitinger@baylibre.com> - 2015-10-26 17:30 +0100
                Re: [PATCH 2/2] hwmon: ina2xx: give precedence to DT over checking  for platform data. Guenter Roeck <linux@roeck-us.net> - 2015-10-27 02:20 +0100
                [PATCH 1/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-26 17:30 +0100
                Re: [PATCH 1/2] hwmon: ina2xx: convert driver to using regmap Guenter Roeck <linux@roeck-us.net> - 2015-10-27 02:10 +0100
                Re: [PATCH 1/2] hwmon: ina2xx: convert driver to using regmap Guenter Roeck <linux@roeck-us.net> - 2015-10-27 02:20 +0100
                [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-27 11:00 +0100
                [PATCH v2 2/2] hwmon: ina2xx: give precedence to DT over checking for platform data. Marc Titinger <mtitinger@baylibre.com> - 2015-10-27 11:00 +0100
                Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap Guenter Roeck <linux@roeck-us.net> - 2015-10-28 03:50 +0100
                Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-28 10:30 +0100
          Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. kbuild test robot <lkp@intel.com> - 2015-10-23 19:00 +0200

csiph-web