From patchwork Mon May 27 15:19: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: 13675507 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 7DAD261FEA; Mon, 27 May 2024 15:20:16 +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=1716823216; cv=none; b=PqBSOhNgIGw6sP1z/m29Hl5kmoPb4O9pF8qYQRYBxzF0ApIJ9X1IKwYWNa8ZlvhdmXipinwMUoEzZauJ51QHWVibKxI821kFT1/7sKrtFBh4NpV2StIHHf+Dy9bf8vrsTasBE9vk+d1aWac9u4oALh9GubKQFj32CcbSzCkP4uM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823216; c=relaxed/simple; bh=BscWCvxLlRzWKhpkBSkVww2bcZM3ZdgJi0FGOnKCD8A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=vBq3c/6PRNR1BhFcligrdzsOtNfVrubkqVRSdxBASppKyCyoCHQzVNWByqSF/duQvY27W5NiGRF3lMagTNrWf9YLgTA/HqZymfDUkSlxClVLPeX1K/QsaK4GA1jD5XhinTT5Aqlc7A3LqofZNPL2OEjAh4n8N0WDuxTgTzhKZV0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vL68RsHb; 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="vL68RsHb" Received: by smtp.kernel.org (Postfix) with ESMTPS id 27DDAC32789; Mon, 27 May 2024 15:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716823216; bh=BscWCvxLlRzWKhpkBSkVww2bcZM3ZdgJi0FGOnKCD8A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=vL68RsHbPefP1xgCClt4GxyyMIZbKjwrFDXfPpSUhtt0T6dBh/7pFInZLlx5w3rQo 2fkruSOXi9bRMUuOFuS2lj+3hZ63s/mUQUrZjKJ8uoEqumRcykdl9zDqa0N814pii1 XQFxKO6+jI3W9z8IXRSIRU73cuqqNNDjvqfge8KhmXJzS/84pOWLYG0bI1bh4bNBLr F3519tb4tBaLssLkNx6BSlQOAOMs9kcxwenrV+n+SJyEuJboyWneSaaywo43YaWVnm t3ONOhYtLeY9j5ac5jQS5koIXpWqBMzhWUTPwFPalC9b2Pllx8t5hzK3yPoA7bK5ww kHP1qKLG6hRnw== 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 0CCC8C25B78; Mon, 27 May 2024 15:20:16 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Mon, 27 May 2024 18:19:49 +0300 Subject: [PATCH v2 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: <20240527-ad7173-fixes-v2-1-8501b66adb1f@analog.com> References: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> In-Reply-To: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan , David Lechner X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716823214; l=3513; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=YO3jbx93xkkdS8bNTk3Nk05937RhLKSs/ejH6uQRBSk=; b=5peJNBAZud6iAOE4J6q+0sYQRuqmWLN2zGsrraewPKjaeirGNFw17pAHWQWCqbaxQo87zvzTj WhnTmKMrL4gCFcN1BS3tt1nka8mNH9RUvlv/wZdD5I2nF4MUi0MM1O0 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 Mon May 27 15:19: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: 13675506 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 7B77A61FE9; Mon, 27 May 2024 15:20:16 +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=1716823216; cv=none; b=sm3LRO5UvibSGuP9bWEtfbpy1nrWyYxqpFRaSo/EKmWuaYumDkngyvztsn4atrcROoHGO5VwPP8nDlQtqfvLXNzBZ/+bzaRTNIpEJs2drVID/3F6lCm6aqyjfGMzuI7Q2yHNJTvTM/1mbOEtKl0WZ95mcC4m4ZCVkpjCaCItsiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823216; 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=knUYDk6BYa1Tll+X/ueRL/UurBKAtFxGB+qhPi3i2MjLMvFwk9dE8cZ+kC4xLjgl08NKUfezw4+/nPHCGEQ73SxRqaiXx+DqU63eXt7Pb5Kx8TTOLUUpUiPKsvJEZzPe+e+H1TgLwAG4enWG5Z6Oo+CGNlavaUyfLWFAKaY6uIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eX40qdT8; 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="eX40qdT8" Received: by smtp.kernel.org (Postfix) with ESMTPS id 31C66C4AF08; Mon, 27 May 2024 15:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716823216; bh=Sg1hOu3VEG/1Zs7niRX5/Vpq317beg+1Hh4A8ALk38o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=eX40qdT8mZjQwz/N2RnWarBnbDo99SUwXPwDNDJau3RSFH71JjL3kWha7W5U95pWb pukP1hnoqjPQMipHzZLuTufTm2CoHdbI8x+tC4hrNwGO7onb/ZQapWSM14lp5W4TOW 6hlIFqEPjdZPsgRVjvkIIqj5xSNYvhM0sq/554MRyNeAoxwMSmHmndwPS1dT7B5vKv 6kLqRg0E+L3mL4fEozpGY11Oc0dYOoFLs5zmEMzv75DwhVzetBN3lEJQrny2m2Hjkz 116sXx5E68/uEu3NMyuy4N7ZLqh3yBVqZRwZNwQvZspAnHMPIaq40Xb/ELbX+QbHSP f9bPfhFfJTn2w== 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 1D258C27C43; Mon, 27 May 2024 15:20:16 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Mon, 27 May 2024 18:19:50 +0300 Subject: [PATCH v2 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: <20240527-ad7173-fixes-v2-2-8501b66adb1f@analog.com> References: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> In-Reply-To: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716823214; l=1300; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=jyW8M3kG3uqXuCNPYLLJGiYuxqeZCfGKeCCNwqrSJqE=; b=DrUTcD1R9ZuJnR/YZHCNSDJvJ7jjkjGobUazPnjtcvPyS6ICzb4aAMgcNMKT9fc7z0y/iQ9Ie xbTR9CZyf1rDHa51h7aA+qRrtpG3VM7y5hUs/TlfWgp7xM3bEjO7lzN 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 Mon May 27 15:19: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: 13675505 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 7FA2C61FEC; Mon, 27 May 2024 15:20:16 +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=1716823216; cv=none; b=kjv1K0Kywt2StB6Kb7ir9DDNarsOq9npCrCloVA8OFjiuSmT0UmazWrVDm+fCTIEZMSUYtwUhiEhnykoQmy8GNBdpipmX3Kxtqj8lpbCPCcDCmNutUbuuei8x/+AmwzYjpF7YIip8Af55gHouG/8pdeK8+KPrYA3CZ0C2fzxax0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823216; c=relaxed/simple; bh=C5v4/fLzS6Bdo8dJf1AM1vOKlChKS52Cq8X9QRh1u/I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uJRw1W/2M2sMXOSMiStT+zd3lZWF7Vg+IuaAzo/MnjdcUQLfzgYUhTmlHPTjcsrb/9PFzVG818X+j2P5bqBzCbRUzKwCr6iiM0C443Wi04kcf0ffI6Vv2MLu8yTXMxrNOSctGJ2js69cL4+D5yXVVUofv8dv3i+v3Ep5ll4Ud9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VK2K3EMr; 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="VK2K3EMr" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2ED53C2BBFC; Mon, 27 May 2024 15:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716823216; bh=C5v4/fLzS6Bdo8dJf1AM1vOKlChKS52Cq8X9QRh1u/I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=VK2K3EMrrl+8hpWnw4uKT46HNiMQ1ySQVE2IHpTFWofQm8RyoAGZeBvri7yCQvjrY xFvwbjFCd6qjHvYJ0P6/DIZew/oqwwvXaIZX5gpvuB6+sZjIW5h6AUsB9pg5FrnkQ4 9/T/3WSN4DmcvZKYNJMypAVVMqpdEItmRMofBM3kpWyAjuNSmZBgqhJSnOEH1MFSD4 Cf8Xfwx29TxX9i9qNaYqfEQyXwLZmRIN1JY2Mjx9OXNJ4iz8v+6ia8IxtaAwwQMVX9 xPSMG2kn8wrqsRKC73JYkHWIr0K0mrC9mNw6c59+EnZASI/4JBN7AGnBDXM3ZuDKNI GkhaJ9XPGX3+g== 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 28FC1C25B7E; Mon, 27 May 2024 15:20:16 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Mon, 27 May 2024 18:19:51 +0300 Subject: [PATCH v2 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: <20240527-ad7173-fixes-v2-3-8501b66adb1f@analog.com> References: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> In-Reply-To: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716823214; l=851; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=qHzAb3Lr8QOhPoRlBg0Itkn9NRPMWDsCz2unbRqp8RE=; b=m3a5lXaIuY0O7Uj3Tmt/3OKUjtu4tmQPul5KaV3j+ZXB5YLLGDyRzOt0+Hz39iI2piR38CwkH 56VwciTgcX7CemA0yuFV8O/swPwe8NrwzwFH0E5Hlq2nImv2OiCWoYD 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 Mon May 27 15:19: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: 13675509 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 9A22761FEF; Mon, 27 May 2024 15:20:16 +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=1716823216; cv=none; b=rsieb8pJ4S5kg08GtKMLUSCCU73P7vNEdyNM5YlM7Fdos9UNp+eds7XIjokil+a4tP8DmyQFiX1xibADbib3Ky8c/AoFsDzCf8fGacRDl3ji7VzcuxIr//4F9EQVfSaqu6/poTDHDJn4OdJyCMDNXEyBabT1Jkqwhq6WteDmHRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823216; c=relaxed/simple; bh=jDeJ/2LLIq3QhO9uL4NshnL3jZave7YV0UkfwYZ8P+4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BQnAYXZirpmir5I/yUgUiK9RyVbMoWlaUFXhAxgzx7qSDJlekWOK7WC3c2lSRnHb0qEdUMSCjw71QmFp0WNtkyZ5kquZLN8613aGqXl1Q2CQxBIWWU9Ub+Q1ZdPOd14t1mKKUDYxJz8X70hcD6t98stpQX6ZCIgxZ8+jIOeqEyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Pqq0Oumi; 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="Pqq0Oumi" Received: by smtp.kernel.org (Postfix) with ESMTPS id 462A8C4AF0A; Mon, 27 May 2024 15:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716823216; bh=jDeJ/2LLIq3QhO9uL4NshnL3jZave7YV0UkfwYZ8P+4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Pqq0Oumig8hpKuTe8LztOoZThZFNmcmVKansidyAQaTmV6OFEDnyifjM0bmoz0NR+ bZzYYfAyQx5Nxbfl/JTbpUuKrg9atfViMf+JLqO2x2YO4J0Tif1M+Uv8ob5746g8Ra VlRVMWuVyT9tsZBvLCwLrDh0HdtRRrIdQF6/krcJS9omio7WYyLs6/n1Sg7xs3V+KL ABZ1IAzISDJ5VGT0C4EDgxak4Rnxl4L9v5KQnihO+WNqJGdQPtBo4gzKyh6WZ3lelX PSps+VHTj6lgYk2+/IButh+YwzgJ9cP2QOKLaQ/fymbYTCeORwtD2U8UY8DZzp3aTc gSNzGeia3qIvA== 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 36C59C25B74; Mon, 27 May 2024 15:20:16 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Mon, 27 May 2024 18:19:52 +0300 Subject: [PATCH v2 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: <20240527-ad7173-fixes-v2-4-8501b66adb1f@analog.com> References: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> In-Reply-To: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716823214; l=1000; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=3Lih309+QmE+/CCcvFgIQ2n+1Fi+3MwieGtcQTnVs2U=; b=rkyQI3J/iTkzHVDAvv+RknEc66IoqXsONEJQUo/RgjWt3qq4jKv58P3m3YfQV59D6IFlE7VkS bDsxFrLnNTIB2LxSDoRYNkIPMOJhJvsnLYesmESFEr458lsW9Q+Qozp 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 Mon May 27 15:19: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: 13675510 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 A8CB461FF8; Mon, 27 May 2024 15:20:16 +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=1716823216; cv=none; b=cAeEDnhIyaOqoHRcp1eb5NUtk6mlkhYcsbHIe+KfcESECVcKQ3HjTngNix6MbmBWBLwQFdwebMiFdEnp+3EHa1fPNv6VZgYa+Q2MsNovree1MiUmJ/kMesuw4QSy0LASOmj0sVR4WDrwPrvTjP3kT1E7vF2TxlCPLYlaMM1Cac0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823216; c=relaxed/simple; bh=mZR6WGjhBRIUp1DvjTSkTj6PBfk83HjEYD3dZJuI26A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tW2Tt7cUkIC7K4BcG/USjoag/YO8+ssuvLMjwAh+Iflr9eH+BkLX8jro047tS0HM7AUc8lTc+4B6xFyXH0OMTdk9DUtpNv4O2sn2H31eHmuEDBBtSVkFOpPtHuhGxaKqgd5ZUxe4+crJDBSrv/B9x8Ca43Cpfc5SdYvxSUul8n8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EHYJIEpH; 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="EHYJIEpH" Received: by smtp.kernel.org (Postfix) with ESMTPS id 506EEC4AF0D; Mon, 27 May 2024 15:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716823216; bh=mZR6WGjhBRIUp1DvjTSkTj6PBfk83HjEYD3dZJuI26A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=EHYJIEpHL9/OS7TpqIGL2FxGYrTF2vS0D3WQ3bxVTERqeuTY2gbLocbZp1y8ZBKOn vYdi22cSzu6QTBe5IlKJFeKisgrdWGUBNkXuWublMwSeBh4uo3J3p5R1hAbPeo4QX9 7QZJMTUuST7FXcnnn6Y2JX8Pr/0JJf7zQFtM3IxBKbaxZ44D/uR4y7CkXtWCOuFWsm MjSMk3Q+5GRGuFRraOODpmnEhm+vFDb2dRlCNpG0WwH//rRBqlfsjCd01HI6ob/dEi NKS4orJzbrufTybXcN5XljFdD22BmMDN4H+OWj4iz7pQkV+gZ+rJaREVjsea3Ez4Ka 7tHVDek/OXwkA== 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 4361FC27C44; Mon, 27 May 2024 15:20:16 +0000 (UTC) From: Dumitru Ceclan via B4 Relay Date: Mon, 27 May 2024 18:19:53 +0300 Subject: [PATCH v2 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: <20240527-ad7173-fixes-v2-5-8501b66adb1f@analog.com> References: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> In-Reply-To: <20240527-ad7173-fixes-v2-0-8501b66adb1f@analog.com> To: Lars-Peter Clausen , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716823214; l=2927; i=dumitru.ceclan@analog.com; s=20240313; h=from:subject:message-id; bh=dDdO/qAAabV229bpLivTobOOzjAvKF9w+JcEWlTFL1A=; b=Zw+lJaM6gZoTMI1/Op0Dk7w4FE9AeHkL1i4oQWUL3o5t+R9U1ne7LfEQH4kpwYJexmE2EyO0A EPwv+MDC4d5B1cRV7azZWwQgG9JO+LVQadmgeChUvsbiJPvi+bv604o 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 | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index e66a137a76be..ebacdacf64b9 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,7 +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), + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), .scan_type = { .sign = 'u', @@ -819,7 +810,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), + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SAMP_FREQ), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), .scan_type = { .sign = 'u',