Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: filter: admv8818: Support frequencies >= 2^32

This patch allows writing u64 values to the ADMV8818's high and low-pass
filter frequencies. It includes the following changes:

- Rejects negative frequencies in admv8818_write_raw.
- Adds a write_raw_get_fmt function to admv8818's iio_info, returning
IIO_VAL_INT_64 for the high and low-pass filter 3dB frequency channels.

Fixes: f34fe888ad05 ("iio:filter:admv8818: add support for ADMV8818")
Signed-off-by: Brian Pellegrino <bpellegrino@arka.org>
Signed-off-by: Sam Winchenbach <swinchenbach@arka.org>
Link: https://patch.msgid.link/20250328174831.227202-7-sam.winchenbach@framepointer.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Brian Pellegrino and committed by
Jonathan Cameron
9016776f c31752b1

+17
+17
drivers/iio/filter/admv8818.c
··· 402 402 return ret; 403 403 } 404 404 405 + static int admv8818_write_raw_get_fmt(struct iio_dev *indio_dev, 406 + struct iio_chan_spec const *chan, 407 + long mask) 408 + { 409 + switch (mask) { 410 + case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: 411 + case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: 412 + return IIO_VAL_INT_64; 413 + default: 414 + return -EINVAL; 415 + } 416 + } 417 + 405 418 static int admv8818_write_raw(struct iio_dev *indio_dev, 406 419 struct iio_chan_spec const *chan, 407 420 int val, int val2, long info) ··· 422 409 struct admv8818_state *st = iio_priv(indio_dev); 423 410 424 411 u64 freq = ((u64)val2 << 32 | (u32)val); 412 + 413 + if ((s64)freq < 0) 414 + return -EINVAL; 425 415 426 416 switch (info) { 427 417 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: ··· 587 571 588 572 static const struct iio_info admv8818_info = { 589 573 .write_raw = admv8818_write_raw, 574 + .write_raw_get_fmt = admv8818_write_raw_get_fmt, 590 575 .read_raw = admv8818_read_raw, 591 576 .debugfs_reg_access = &admv8818_reg_access, 592 577 };