All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Angel Iglesias <ang.iglesiasg@gmail.com>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Paul Cercueil <paul@crapouillou.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 5/5] iio: pressure: bmp280: Add more tunable config parameters for BMP380
Date: Mon, 8 Aug 2022 11:13:56 +0200	[thread overview]
Message-ID: <CAHp75VeNctrQjW4RHwbsF-y--9bAzg3XTFTZzXk+6whRFJcFYg@mail.gmail.com> (raw)
In-Reply-To: <680e7218234676ba78fc5eccd5f93e29c06c3983.1659872590.git.ang.iglesiasg@gmail.com>

On Sun, Aug 7, 2022 at 2:44 PM Angel Iglesias <ang.iglesiasg@gmail.com> wrote:
>
> Allows sampling frequency and IIR filter coefficients configuration
> using sysfs ABI.
>
> The IIR filter coefficient is configurable using the sysfs attribute
> "filter_low_pass_3db_frequency".

...

> +static const int bmp380_odr_table[][2] = {

s32_fract ?

> +       [BMP380_ODR_200HZ]      = {200, 0},
> +       [BMP380_ODR_100HZ]      = {100, 0},
> +       [BMP380_ODR_50HZ]       = {50, 0},
> +       [BMP380_ODR_25HZ]       = {25, 0},
> +       [BMP380_ODR_12_5HZ]     = {12, 500000},
> +       [BMP380_ODR_6_25HZ]     = {6, 250000},
> +       [BMP380_ODR_3_125HZ]    = {3, 125000},
> +       [BMP380_ODR_1_5625HZ]   = {1, 562500},
> +       [BMP380_ODR_0_78HZ]     = {0, 781250},
> +       [BMP380_ODR_0_39HZ]     = {0, 390625},
> +       [BMP380_ODR_0_2HZ]      = {0, 195313},
> +       [BMP380_ODR_0_1HZ]      = {0, 97656},
> +       [BMP380_ODR_0_05HZ]     = {0, 48828},
> +       [BMP380_ODR_0_02HZ]     = {0, 24414},
> +       [BMP380_ODR_0_01HZ]     = {0, 12207},
> +       [BMP380_ODR_0_006HZ]    = {0, 6104},
> +       [BMP380_ODR_0_003HZ]    = {0, 3052},
> +       [BMP380_ODR_0_0015HZ]   = {0, 1526},
> +};

...

> +               ret = regmap_write_bits(data->regmap, BMP380_REG_POWER_CONTROL,
> +                                       BMP380_MODE_MASK,

> +                                       FIELD_PREP(BMP380_MODE_MASK,
> +                                                  BMP380_MODE_SLEEP));

One line?

...

> +               ret = regmap_write_bits(data->regmap, BMP380_REG_POWER_CONTROL,
> +                                       BMP380_MODE_MASK,

> +                                       FIELD_PREP(BMP380_MODE_MASK,
> +                                                  BMP380_MODE_NORMAL));

Ditto.

...

> +static const int bmp380_iir_filter_coeffs_avail[] = { 0, 1, 3, 7, 15, 31, 63, 127 };

This seems like a power of two - 1, can it be replaced by a formula in the code?

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2022-08-08  9:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 11:52 [PATCH v5 0/5] Add support for pressure sensor Bosch BMP380 Angel Iglesias
2022-08-07 11:54 ` [PATCH v5 1/5] iio: pressure: bmp280: simplify driver initialization logic Angel Iglesias
2022-08-08  8:18   ` Andy Shevchenko
2022-08-14 13:43   ` Jonathan Cameron
2022-08-14 14:26     ` Angel Iglesias
2022-08-07 11:55 ` [PATCH v5 2/5] iio: pressure: bmp280: Fix alignment for DMA safety Angel Iglesias
2022-08-08  8:53   ` Andy Shevchenko
2022-08-12  9:59     ` Angel Iglesias
2022-08-14 13:52       ` Jonathan Cameron
2022-08-14 14:03   ` Jonathan Cameron
2022-08-07 11:55 ` [PATCH v5 3/5] iio: pressure: bmp280: Add support for BMP380 sensor family Angel Iglesias
2022-08-08  9:08   ` Andy Shevchenko
2022-08-12 10:47     ` Angel Iglesias
2022-08-14 14:11       ` Jonathan Cameron
2022-08-14 14:15   ` Jonathan Cameron
2022-08-14 14:37     ` Angel Iglesias
2022-08-14 16:56       ` Jonathan Cameron
2022-08-07 11:56 ` [PATCH v5 4/5] dt-bindings: iio: pressure: bmp085: Add BMP380 compatible string Angel Iglesias
2022-08-07 11:57 ` [PATCH v5 5/5] iio: pressure: bmp280: Add more tunable config parameters for BMP380 Angel Iglesias
2022-08-08  9:13   ` Andy Shevchenko [this message]
2022-09-12  0:53     ` Angel Iglesias
2022-09-15 13:33       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75VeNctrQjW4RHwbsF-y--9bAzg3XTFTZzXk+6whRFJcFYg@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=ang.iglesiasg@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.