Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1247707lqb; Thu, 30 May 2024 05:08:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgR73I4KrvxEbqC/WgX1VecIy3Q8CqmpJwOtrJX5Q5F5Ktmcu/Xd/7gnDJ9Uik3USSLbqzKNBS8gc9EM9F+nt7fTXsmcYJco6eu9Rftw== X-Google-Smtp-Source: AGHT+IFoy0Hh0uoz+BMFyhUAghLA8rdyqIxT8ioxPu7//SZRQXjGSwKKXJSqX2tNsxcRA/KOVorI X-Received: by 2002:a05:6e02:1d1a:b0:36b:1e1:552f with SMTP id e9e14a558f8ab-3747dfb525fmr17818585ab.23.1717070926941; Thu, 30 May 2024 05:08:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717070926; cv=pass; d=google.com; s=arc-20160816; b=g0qFtkQV6e9b2O3nOrLAI8A8g/TLMqA6G0g3edWWH+JQnNtFxL4mgMLvpczgHB8AOC elhhy0m5nk3f88j/B0Adgy47x8HmuKE8U3uTyn45mAOA/yQKyRPdOyPTQTaRxdY7MDnf onbzTzuL0P7ex4QTuc9ENR0mnm7Hl0pmASAOKobFh4c+51G3KU07uhqI3GJQcZyNBLpq nGT5hxGhpbKs3LxNz4d71WdiLM+6qE8JHjEvyi+Bnp7rLkR7fDffSUNTWebOYkrNV0ob HR1R5QRs4TfuaTUZbJa8ZPzysiRLbGk9LWIK64fjYc+OAFFO5eOJxjbmQSceAYpSSIyX N+WQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=c6gdrGT+DPkIVxxp4qzmBwk4r2zcQMHwCWc4ci7Wbdw=; fh=bjj5BysdOmWi0sEWWQ/skyQ5IREBdX2Jthv0IOqEsoI=; b=C4Ykh1P/H6UFJlqkpvSNWHS2MxRSkWnJkmFi/KSftGSDg+6+Lksa39a0YVo85Ieyk6 mqiZ1vD12j057vEQJb7pK6+HMbVC0ILe1t/EWYVjmX0vy4JsJp0buJ77TWW8XhxJguaa M9Hl+dZaZqvlYaIVfsv+ymIipUYXthWnmbaGzhwEod3fANaSazK//jGKVaxZFPBoCZ/r mi3GBnuUjB2vp0hLiGI7pf1cTr3T28/ret+GPICdQOrN5AMxKR77cZbbwXrukqEKjG6/ OfcgbR5PeTBMACSKLc6S+ag3Lwe6YvBb+vovgTtHHrqMmMl3Dr1TthARbA7SWHdDKAiw 6IUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fzDN8bqq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195338-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195338-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6bdb13b570bsi2214274a12.659.2024.05.30.05.08.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 05:08:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195338-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fzDN8bqq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195338-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195338-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 31D59B23AA0 for ; Thu, 30 May 2024 12:08:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87DDF183A89; Thu, 30 May 2024 12:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fzDN8bqq" 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 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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"); -- 2.43.0