From patchwork Thu May 30 12:07:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceclan via B4 Relay X-Patchwork-Id: 13680308 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 8F5A755882; Thu, 30 May 2024 12:08:03 +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=1717070883; cv=none; b=RMGG8Zq0Vn43AjhXw9HVe7QYJxXTTA+sGuYVBMWdps+GaEhwe8rKfMU5OZPr/YMWM5GPjcW/nMJdNnVmmgkKxdkjvgaHHGOJ2sueQ7CoAhL1okZsCAtdBKpvR3J/4gEMnLYhAUyeHH3dZCtqeSGLGXYxp0FubbMZfo24HuKReIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717070883; c=relaxed/simple; bh=BscWCvxLlRzWKhpkBSkVww2bcZM3ZdgJi0FGOnKCD8A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aQ/rqCUOzVvqDKjWN3PmDiD7xbB1NObXn0zRBNhqEk3pDusPdaj9kONNkAwpQJvQdx7K17T5imB5A0iW5Jzzvr6Tkoi0ryO+fohejBAI2L+a7+5B7OAPbe8QzLedSHb7u07UImzv+vpTawKe5onnrVz3xi4f2jWkA5UxbprbU88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fzDN8bqq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fzDN8bqq" Received: by smtp.kernel.org (Postfix) with ESMTPS id 38C89C3277B; Thu, 30 May 2024 12:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717070883; bh=BscWCvxLlRzWKhpkBSkVww2bcZM3ZdgJi0FGOnKCD8A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=fzDN8bqqvI89rM+CoyNbY+p2kbgcR/o7MEpRbxU9ZAV0DjrocUXo7r9ZEFbY/dkuu 4pbo0z9OnNUC2fkcX7PYh1MbwABwwty703NMJ7aaKzOMXrhzhr2ZfGdeA8uyK0o0QV h+dO8b8+jGa0x0Soax2Uuv046Ni5uusiiRL897v+tlXirOO/+ootV7HwGWTrn+7QQw kpGNuEVeP+5uEmzw0hr8/7LFwzAvSseppHbYXo80rSTmClxgl9/0I7UNFuG0Gs47Tp kpJI/n6MVLij/ZJdHQe0XCh+l65dp/37YXn9zxjLZfM2GKr/MqKTtrvNbcChS8LDI4 khF63a9C52bgg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 233EAC27C44; Thu, 30 May 2024 12:08:03 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Thu, 30 May 2024 15:07:49 +0300 Subject: [PATCH v3 1/5] iio: adc: ad7173: fix buffers enablement for ad7176-2 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240530-ad7173-fixes-v3-1-b85f33079e18@analog.com> References: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> In-Reply-To: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan , Dumitru Ceclan , David Lechner X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717070881; l=3513; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=YO3jbx93xkkdS8bNTk3Nk05937RhLKSs/ejH6uQRBSk=; b=FzPa9r6lTyIFZ21C+bTDhgDWHb91iNZNgNcsGvI+KkD5AASV7LNSSsGHniKZ7gp8YoW52L+8f b+yPnN1Ll5DCmHliqqMXKYH9t4yh0xBEDtYfU4BlqRk6KRxFRqdZNuy X-Developer-Key: i=dumitru.ceclan@analog.com; a=ed25519; pk=HdqMlVyrcazwoiai7oN6ghU+Bj1pusGUFRl30jhS7Bo= X-Endpoint-Received: by B4 Relay for dumitru.ceclan@analog.com/20240313 with auth_id=140 X-Original-From: Dumitru Ceclan Reply-To: dumitru.ceclan@analog.com From: Dumitru Ceclan AD7176-2 does not feature input buffers and marks corespondent register bits as read only. Enable buffers only on supported models. Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver") Reviewed-by: David Lechner Signed-off-by: Dumitru Ceclan --- drivers/iio/adc/ad7173.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index f6d29abe1d04..850574437bda 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -145,6 +145,7 @@ struct ad7173_device_info { unsigned int id; char *name; bool has_temp; + bool has_input_buf; bool has_int_ref; bool has_ref2; u8 num_gpios; @@ -212,6 +213,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 4, .num_gpios = 2, .has_temp = true, + .has_input_buf = true, .has_int_ref = true, .clock = 2 * HZ_PER_MHZ, .sinc5_data_rates = ad7173_sinc5_data_rates, @@ -224,6 +226,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 8, .num_gpios = 4, .has_temp = false, + .has_input_buf = true, .has_ref2 = true, .clock = 2 * HZ_PER_MHZ, .sinc5_data_rates = ad7173_sinc5_data_rates, @@ -237,6 +240,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 8, .num_gpios = 4, .has_temp = true, + .has_input_buf = true, .has_int_ref = true, .has_ref2 = true, .clock = 2 * HZ_PER_MHZ, @@ -251,6 +255,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 4, .num_gpios = 2, .has_temp = true, + .has_input_buf = true, .has_int_ref = true, .clock = 16 * HZ_PER_MHZ, .sinc5_data_rates = ad7175_sinc5_data_rates, @@ -263,6 +268,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 8, .num_gpios = 4, .has_temp = true, + .has_input_buf = true, .has_int_ref = true, .has_ref2 = true, .clock = 16 * HZ_PER_MHZ, @@ -277,6 +283,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 4, .num_gpios = 2, .has_temp = false, + .has_input_buf = false, .has_int_ref = true, .clock = 16 * HZ_PER_MHZ, .sinc5_data_rates = ad7175_sinc5_data_rates, @@ -289,6 +296,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_configs = 4, .num_gpios = 2, .has_temp = true, + .has_input_buf = true, .has_int_ref = true, .clock = 16 * HZ_PER_MHZ, .odr_start_value = AD7177_ODR_START_VALUE, @@ -932,7 +940,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev) AD7173_CH_ADDRESS(chan_arr[chan_index].channel, chan_arr[chan_index].channel2); chan_st_priv->cfg.bipolar = false; - chan_st_priv->cfg.input_buf = true; + chan_st_priv->cfg.input_buf = st->info->has_input_buf; chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF; st->adc_mode |= AD7173_ADC_MODE_REF_EN; @@ -989,7 +997,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev) chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]); chan_st_priv->chan_reg = chan_index; - chan_st_priv->cfg.input_buf = true; + chan_st_priv->cfg.input_buf = st->info->has_input_buf; chan_st_priv->cfg.odr = 0; chan_st_priv->cfg.bipolar = fwnode_property_read_bool(child, "bipolar"); From patchwork Thu May 30 12:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceclan via B4 Relay X-Patchwork-Id: 13680310 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 99740176183; Thu, 30 May 2024 12:08:03 +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=1717070883; cv=none; b=V7KEdwZ+EN1Ls4VLhMAscC2WcYKJRqS45di9xDkX9uWa1l6kpz8DlibdMIJA1VzsXBEqGDxo5lYlw5RoVw2Mvkb2y/bmPa5wCIuir7WrrBIBKxYz0JMdI8rVICF99Z06w96ruCzso6xLDiAof+o7NeAQK+0F5if1e+7rD0FTpUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717070883; c=relaxed/simple; bh=Sg1hOu3VEG/1Zs7niRX5/Vpq317beg+1Hh4A8ALk38o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PQRiZciEBpNK7Z4WXpR9qM+43ems5zOdB6nYXw1r/OV58GtRYrLE0oiloiyIEmcpGOYKTSKJAXWeZ/wYbKPe/hY26Q9rlIPCgtBmvCpipfiXLSqBHsnBtS8AvN7AatImVBdFtzSbmSkLLrztcE/3kkQifqj9c59FKP6VqA+Im6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k25+vziB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k25+vziB" Received: by smtp.kernel.org (Postfix) with ESMTPS id 45F29C32789; Thu, 30 May 2024 12:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717070883; bh=Sg1hOu3VEG/1Zs7niRX5/Vpq317beg+1Hh4A8ALk38o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=k25+vziBpoiI26hc8mqD/ADcr/eGRoNYx6hWJfWcjoE9D3xKEcY8SJQ/ewtrxohut gVMxMOfhTyuHc1v0LEdzHOSrSs3b94TAzDrjxo//paOUa0pUdaMEyGLwvCJc21eXP2 92hnCnFVMr8Ut7sYqGYAXuDE3wYcrCOhuAMDlWo7cze1o9XHBk5KdpoU2s1lqrhV5K hJtnlZdWR3IkW5AtOYStBiu+Glsb2ybo576FSafupPjzrv/WFaXYG5JWYrQ4PPaXn2 4cXm419xQHi5hrO09CmNasng4UzNmNYz9505LmLmPRGxUycWdVf6nHfZ29MTrvh1+d kZqxJnPqW97nA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F22C27C4F; Thu, 30 May 2024 12:08:03 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Thu, 30 May 2024 15:07:50 +0300 Subject: [PATCH v3 2/5] iio: adc: ad7173: Add ad7173_device_info names Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240530-ad7173-fixes-v3-2-b85f33079e18@analog.com> References: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> In-Reply-To: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan , Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717070881; l=1300; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=jyW8M3kG3uqXuCNPYLLJGiYuxqeZCfGKeCCNwqrSJqE=; b=4ER/UoEn/wZkI/mak5zAphUNqZ5UqOLKaguF+1NemNuXpdxwqAYvU7JqWghs5G4GC1++u9dYk QcklpdWm3gDCBALYdzKaYyoU2WcJ5jcZdZ03thUV592FTTXKtZ/1XUo X-Developer-Key: i=dumitru.ceclan@analog.com; a=ed25519; pk=HdqMlVyrcazwoiai7oN6ghU+Bj1pusGUFRl30jhS7Bo= X-Endpoint-Received: by B4 Relay for dumitru.ceclan@analog.com/20240313 with auth_id=140 X-Original-From: Dumitru Ceclan Reply-To: dumitru.ceclan@analog.com From: Dumitru Ceclan Add missing names from the device info struct for 3 models to ensure consistency with the rest of the models. Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Dumitru Ceclan --- drivers/iio/adc/ad7173.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index 850574437bda..58620be41ef5 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -220,6 +220,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates), }, [ID_AD7172_4] = { + .name = "ad7172-4", .id = AD7172_4_ID, .num_inputs = 9, .num_channels = 8, @@ -262,6 +263,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates), }, [ID_AD7175_8] = { + .name = "ad7175-8", .id = AD7175_8_ID, .num_inputs = 17, .num_channels = 16, @@ -290,6 +292,7 @@ static const struct ad7173_device_info ad7173_device_info[] = { .num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates), }, [ID_AD7177_2] = { + .name = "ad7177-2", .id = AD7177_ID, .num_inputs = 5, .num_channels = 4, From patchwork Thu May 30 12:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceclan via B4 Relay X-Patchwork-Id: 13680309 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 996F71586C8; Thu, 30 May 2024 12:08:03 +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=1717070883; cv=none; b=VaBiGP0QrT8hK8MZbKlvKKpSQ0YzccVJpa3L6Ss+ut5IBmMlxpc1Pr6d0wz/dtZm24z43Y4P2z1pyJ9d4t4JJpzxWSf74DnuBzqUtIMkmvk/mdP3CpFbePgBL6+/T+fe/A3RhiHCOMDUzkumm1Mo9wvUqjFN/akWTEfB1VnfGmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717070883; c=relaxed/simple; bh=C5v4/fLzS6Bdo8dJf1AM1vOKlChKS52Cq8X9QRh1u/I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Pvl+522L4lZ7VzuRUzD0BJ+lUudEVwcEdux2b4g/j4Ctojz3mkidAi8kudjRxp6IwSSuTfHhGAmYd/wPFpbam15Tu9hoei/9VBWhRjM0lPcwQ2hi1TWOzumgmQlFiXJi6geUqGBUGoPX07VrkrDrGOL8k5F/DzDKtwOBTYMOK84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=An3Upmex; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="An3Upmex" Received: by smtp.kernel.org (Postfix) with ESMTPS id 50D1DC32786; Thu, 30 May 2024 12:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717070883; bh=C5v4/fLzS6Bdo8dJf1AM1vOKlChKS52Cq8X9QRh1u/I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=An3UpmexAyQUMe/fqa/Pj1UpvI6rhIzmThA7emAxMtOeRHYbttqBMQjdZxPxB66al HdpHe/MSYpna8Q5MDbvUGFlv4KITyYO1z2gsR9cbmWZnfRJk68a0oxSazsVO3N1GYL iSPBYZQCxaDga1FT6J5B0Dp3y9mCZZ10s+gnJLat729Q65COw+fUKSlAw6GI2lisFm XSnzHl+RYRIG+zs+8a2xk/xYH/9YoQRQ/5WY+JLQSTQVRB73OLBwSk1snK6UW9lxAE GvOjQqvqHm+u5TmZiiux9+998hLiYN51ENA/uOAYsIbNVVnmmaJJqS5JpyKozMR183 M9ILUvjAOEzvA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4304FC27C43; Thu, 30 May 2024 12:08:03 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Thu, 30 May 2024 15:07:51 +0300 Subject: [PATCH v3 3/5] iio: adc: ad7173: Remove index from temp channel Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240530-ad7173-fixes-v3-3-b85f33079e18@analog.com> References: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> In-Reply-To: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan , Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717070881; l=851; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=qHzAb3Lr8QOhPoRlBg0Itkn9NRPMWDsCz2unbRqp8RE=; b=/16b4nMtXcLOu4ow4Fo36AISvbGQFYNZfcH6Ew8bLJc677ALZIM/4O0JxSjII5wclXnV8aT2m nWG7G+MZxNRCAuXDy3y7k7xXZJy0ST3XJcydCTvt7PkOv1o7cfGWCwC X-Developer-Key: i=dumitru.ceclan@analog.com; a=ed25519; pk=HdqMlVyrcazwoiai7oN6ghU+Bj1pusGUFRl30jhS7Bo= X-Endpoint-Received: by B4 Relay for dumitru.ceclan@analog.com/20240313 with auth_id=140 X-Original-From: Dumitru Ceclan Reply-To: dumitru.ceclan@analog.com From: Dumitru Ceclan Temperature channel is unique per device, index is not needed. This is breaking userspace: Include fixes tag to be released within the same rc cycle. Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Dumitru Ceclan --- drivers/iio/adc/ad7173.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index 58620be41ef5..eb512878c30e 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -815,7 +815,6 @@ static const struct iio_chan_spec ad7173_channel_template = { static const struct iio_chan_spec ad7173_temp_iio_channel_template = { .type = IIO_TEMP, - .indexed = 1, .channel = AD7173_AIN_TEMP_POS, .channel2 = AD7173_AIN_TEMP_NEG, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | From patchwork Thu May 30 12:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceclan via B4 Relay X-Patchwork-Id: 13680311 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 B23A5179955; Thu, 30 May 2024 12:08:03 +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=1717070883; cv=none; b=DRp3sS4PjXg95kEn9/mxr+pqoDrlibOX/tZ+e1nCSH8WmDWJTyCmMwAFx3LY2jLuwP2Yh72Yuama6nA9auPdVviLTg88JVOYQ/ori6/GykfkZdjgJZhWoTY+YP/DW+lPxRWiarU8g7oNT8oJw6s7Cr2EKtDeu259DkxK2fEQ8pg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717070883; c=relaxed/simple; bh=jDeJ/2LLIq3QhO9uL4NshnL3jZave7YV0UkfwYZ8P+4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZRNo+fRxTipp7hMkZGH+iXT4v7xuylGlFYMcW4N5S+FozKNfF9ZLRdkJSQub0KH314VsQ6lX7NK1k3r7PZeIyrx0qoZOncZUa3Kq6Nb5HMkofy4OvdiC+f+HcPcCMLmhQnR6zHSVPw0TUDWq6ESZfs+g9b8B6IIsU8oczg3QqgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uOy+f4dn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uOy+f4dn" Received: by smtp.kernel.org (Postfix) with ESMTPS id 588DFC4AF07; Thu, 30 May 2024 12:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717070883; bh=jDeJ/2LLIq3QhO9uL4NshnL3jZave7YV0UkfwYZ8P+4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uOy+f4dnG1Roxul3BaWOcsOczqLX51vutErzDzQ9hA3X1Zzuu7+khAEiW06wEp3cP I0ovYTNZl/IktaxAEhIXuSWhYZxOxI64UFQ0LhRpbM8Cb/xl4lvbWpT2w3zqimY+G3 OLIUXaRJZYrkFTWNoG3taiJaiWHmFLZp1nz+b7fRqG2iBsBo5XNs75wGIZ6XNl9TvT 2MfmNwhX/ZJheylgBzt/j56ip8jczdcG7k2JXv8KbVh75i1yuvn2NMPDXXjno3Ksqs vzGndhAWEhyAFWsj6Fd16eBGjdMS3w2iAXxN/EyEfe2CzkcNODIzzvsCautYpfvlu/ WPFV/ufOj2otQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51867C25B74; Thu, 30 May 2024 12:08:03 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Thu, 30 May 2024 15:07:52 +0300 Subject: [PATCH v3 4/5] iio: adc: ad7173: Clear append status bit Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240530-ad7173-fixes-v3-4-b85f33079e18@analog.com> References: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> In-Reply-To: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan , Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717070881; l=1000; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=3Lih309+QmE+/CCcvFgIQ2n+1Fi+3MwieGtcQTnVs2U=; b=tfCorgq0OSKRQvM2Q3NGFOUZ1X2YYA74t5jLnItpkypqPxNNNi3vR/gUXjZgy9xDWyb8j/uLq NDCDOpATRj3CWE2Yawyq8iYYrUX1Tu74KX8etJRApoMR6nCL1zl+TDQ X-Developer-Key: i=dumitru.ceclan@analog.com; a=ed25519; pk=HdqMlVyrcazwoiai7oN6ghU+Bj1pusGUFRl30jhS7Bo= X-Endpoint-Received: by B4 Relay for dumitru.ceclan@analog.com/20240313 with auth_id=140 X-Original-From: Dumitru Ceclan Reply-To: dumitru.ceclan@analog.com From: Dumitru Ceclan The previous value of the append status bit was not cleared before setting the new value. This caused the bit to remain set after enabling buffered mode for multiple channels and not permit further buffered reads from a single channel after the fact. Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Dumitru Ceclan --- drivers/iio/adc/ad7173.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index eb512878c30e..e66a137a76be 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -543,6 +543,7 @@ static int ad7173_append_status(struct ad_sigma_delta *sd, bool append) unsigned int interface_mode = st->interface_mode; int ret; + interface_mode &= ~AD7173_INTERFACE_DATA_STAT; interface_mode |= AD7173_INTERFACE_DATA_STAT_EN(append); ret = ad_sd_write_reg(&st->sd, AD7173_REG_INTERFACE_MODE, 2, interface_mode); if (ret) From patchwork Thu May 30 12:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceclan via B4 Relay X-Patchwork-Id: 13680312 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 78B94183A84; Thu, 30 May 2024 12:08:04 +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=1717070884; cv=none; b=joYqLWpmJ4TtRvjIUdNvmQ2KnLEC83A65v8dB9YS0s5ZQorZK0Y5PJ01yvrInGGpyIK31YhAZbzKEgmlIy9N3JzD/abQ7JKk2vNBH9d3j9mIOwjEE0lf9IT1BuNKk3X7vRXhWASsqBsDXIaoMhOBUyL+YfkNZO+lG8NQ0fvqq/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717070884; c=relaxed/simple; bh=NGupSVFAf3w4i+B0v6O8ZHgy6jsWt10FDsN0sCp/Jv0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XEN4YzYyK8kacxtIPLfemilqwiFNxed6r5l3GQxyc40yofwz6hP8HC1o/LgAYlYMhhvHCSHDE4fWENhTRMiaFsYsLafPZ6Rn6VxrpYWF93yV4i/oW7E8J2cKYwqiJaAKYx+Jc6Vi4HFv0AwtjONJziV7I6ToOGHq9LuDSvkMoWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ik3hzkB+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ik3hzkB+" Received: by smtp.kernel.org (Postfix) with ESMTPS id 25E15C4AF0A; Thu, 30 May 2024 12:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717070884; bh=NGupSVFAf3w4i+B0v6O8ZHgy6jsWt10FDsN0sCp/Jv0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Ik3hzkB+9mYBamTB93UN+zjnXx+a/wgxzF7Mm8b9vQBS+pc4Me5N8QrLbcsnoceho vrrPfHMUMDgfiPhbxVOQ+kKO/fwtPlojRlErrhCU1reQfXg9RwlDtgoLh7d7tVtfm1 vIM9xZCPVrr2LhbZPXMmOMcvFBYOWdgemwTKLqU0wsb6W11QAaLLM3dfWHic6v/eGd uQmWMKhhAXCm5R7a4cfFcdy++ahXmcOBu5QtFIk0m2FN3la/vmTxzAL81+K4VsW3c4 m/sGa8ajWbjfufjofU+CAFHcTLxyjMnYrMRX6g39POlhaQ+B0WWp2GUuO2aZuBpPha tgeUXAPuh6hcQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CEF3C25B74; Thu, 30 May 2024 12:08:04 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Thu, 30 May 2024 15:07:53 +0300 Subject: [PATCH v3 5/5] iio: adc: ad7173: Fix sampling frequency setting Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240530-ad7173-fixes-v3-5-b85f33079e18@analog.com> References: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> In-Reply-To: <20240530-ad7173-fixes-v3-0-b85f33079e18@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan , Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717070881; l=2969; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=SBPCEDIHiCkBTrkchaltcj60L2/HmJ7NW2rt8H7uZxM=; b=1yI8EuMNC1kGPCv+tv4qpgt9g1y7ShB+N4rgprlmp+0NraSAwqk4cxA7tfpVxGYlbztHEub0w 3gVkgAXonMJAdtMh4xcWYt0oz0VLNdOjvpi2DvO9z3NmxYa60LMCN+Z X-Developer-Key: i=dumitru.ceclan@analog.com; a=ed25519; pk=HdqMlVyrcazwoiai7oN6ghU+Bj1pusGUFRl30jhS7Bo= X-Endpoint-Received: by B4 Relay for dumitru.ceclan@analog.com/20240313 with auth_id=140 X-Original-From: Dumitru Ceclan Reply-To: dumitru.ceclan@analog.com From: Dumitru Ceclan This patch fixes two issues regarding the sampling frequency setting: -The attribute was set as per device, not per channel. As such, when setting the sampling frequency, the configuration was always done for the slot 0, and the correct configuration was applied on the next channel configuration call by the LRU mechanism. -The LRU implementation does not take into account external settings of the slot registers. When setting the sampling frequency directly to a slot register in write_raw(), there is no guarantee that other channels were not also using that slot and now incorrectly retain their config as live. Set the sampling frequency attribute as separate in the channel templates. Do not set the sampling directly to the slot register in write_raw(), just mark the config as not live and let the LRU mechanism handle it. As the reg variable is no longer used, remove it. Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Dumitru Ceclan --- drivers/iio/adc/ad7173.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index e66a137a76be..ebf248741b34 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -717,7 +717,7 @@ static int ad7173_write_raw(struct iio_dev *indio_dev, { struct ad7173_state *st = iio_priv(indio_dev); struct ad7173_channel_config *cfg; - unsigned int freq, i, reg; + unsigned int freq, i; int ret; ret = iio_device_claim_direct_mode(indio_dev); @@ -733,16 +733,7 @@ static int ad7173_write_raw(struct iio_dev *indio_dev, cfg = &st->channels[chan->address].cfg; cfg->odr = i; - - if (!cfg->live) - break; - - ret = ad_sd_read_reg(&st->sd, AD7173_REG_FILTER(cfg->cfg_slot), 2, ®); - if (ret) - break; - reg &= ~AD7173_FILTER_ODR0_MASK; - reg |= FIELD_PREP(AD7173_FILTER_ODR0_MASK, i); - ret = ad_sd_write_reg(&st->sd, AD7173_REG_FILTER(cfg->cfg_slot), 2, reg); + cfg->live = false; break; default: @@ -804,8 +795,7 @@ static const struct iio_chan_spec ad7173_channel_template = { .type = IIO_VOLTAGE, .indexed = 1, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_SCALE), - .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ), .scan_type = { .sign = 'u', .realbits = 24, @@ -819,8 +809,8 @@ static const struct iio_chan_spec ad7173_temp_iio_channel_template = { .channel = AD7173_AIN_TEMP_POS, .channel2 = AD7173_AIN_TEMP_NEG, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), - .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SAMP_FREQ), .scan_type = { .sign = 'u', .realbits = 24,