From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C9A222AE7F; Tue, 17 Jun 2025 16:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750177325; cv=none; b=QdA5LvXNRdDB1bq8u7HXVWA8xwsdWIDw+ZDyYRZXaHr45Me1MJJbKDdDGuR0NhzCqzJTxlBQ0MrnX2y+GEjVFJVrpueCevaNlgsq3Ds8IX38R9nnthMhVtmpjuVjxikIoJdT57HAywcY8x4iFozPvzTB/RMbfWYi/bgTOIxPBgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750177325; c=relaxed/simple; bh=P3WE7Zeq6ZxGmf26dZ5W2UuBHrEv55XMkxKNwYUyejY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cswCslzIz89y36Z4xqApLm33NCvwV0hWUY7YuRuPR++jzFCBmOvZ0ecOCEPiLVFlcl1YTawsanc6U/6Qv2rBsXZHcOkW9UTxqivz6/pqO3VJUYrZBOcptJlomHZ+45R+HllAGLS7xUIsmsT/YaU8/rq/5XWaGVhHfVWY5Cr4fa8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HpJXZufX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HpJXZufX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEA90C4CEF0; Tue, 17 Jun 2025 16:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750177325; bh=P3WE7Zeq6ZxGmf26dZ5W2UuBHrEv55XMkxKNwYUyejY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HpJXZufXRZudjbSQ6TZxbN9CYAgbJwHSEnvwGXGWP3iZ7eisaAPN8lkEIbraHtq0F ietn+04E+sioahlDqP54kLO5JAnlSkzhwXsbr4vWtLiN5YXrFYgmpf3NwWAauhCl+P GSGE6svlAwpO9vXQm6VaFs1DAj0TNsehcvkQny7c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Brian Pellegrino , Sam Winchenbach , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.12 327/512] iio: filter: admv8818: Support frequencies >= 2^32 Date: Tue, 17 Jun 2025 17:24:53 +0200 Message-ID: <20250617152432.852297225@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152419.512865572@linuxfoundation.org> References: <20250617152419.512865572@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brian Pellegrino [ Upstream commit 9016776f1301627de78a633bda7c898425a56572 ] 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 Signed-off-by: Sam Winchenbach Link: https://patch.msgid.link/20250328174831.227202-7-sam.winchenbach@framepointer.org Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/filter/admv8818.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c index 380e119b3cf54..cc8ce0fe74e7c 100644 --- a/drivers/iio/filter/admv8818.c +++ b/drivers/iio/filter/admv8818.c @@ -402,6 +402,19 @@ static int admv8818_read_lpf_freq(struct admv8818_state *st, u64 *lpf_freq) return ret; } +static int admv8818_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: + case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: + return IIO_VAL_INT_64; + default: + return -EINVAL; + } +} + static int admv8818_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long info) @@ -410,6 +423,9 @@ static int admv8818_write_raw(struct iio_dev *indio_dev, u64 freq = ((u64)val2 << 32 | (u32)val); + if ((s64)freq < 0) + return -EINVAL; + switch (info) { case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: return admv8818_lpf_select(st, freq); @@ -571,6 +587,7 @@ static int admv8818_set_mode(struct iio_dev *indio_dev, static const struct iio_info admv8818_info = { .write_raw = admv8818_write_raw, + .write_raw_get_fmt = admv8818_write_raw_get_fmt, .read_raw = admv8818_read_raw, .debugfs_reg_access = &admv8818_reg_access, }; -- 2.39.5