From patchwork Mon Mar 24 09:07:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pop Ioan Daniel X-Patchwork-Id: 14026947 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 6B3B325D8EE; Mon, 24 Mar 2025 09:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807434; cv=none; b=pwDTYo1IHcsY5ZGWAZqTPIDimH7T+g37TnicsKXMq/HTKyc33v3+q0BJdFjKrYVVtopwZFIyceVyn0SuBwIJ72O+bwcaDDdPjHdIQLqXP024aB+IY9+6wclsmmw/sh22cMKnvxaZSjIKs2zWH1EQLG5lQMGwRyoH6pXOUJXX1ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807434; c=relaxed/simple; bh=CjNTzR4/nvfwUgi7RgAsnsshhfhx+xVUbp2/z30Ng+g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Sd1zZNKTv1PG8uKduOwFcEn87iaDAiGijm63I63yRJrU/f4njbA4oMjujgMSjAIByMM9LU/U5QzX78QGLPmvhBj4PvQqq3Gcf1zrhowTmBTEQCbgahX6eCRx02w25RgUzk2yna0OFHEA68QE80aakcix72HM+2l5qvzack3xyqs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=I7FmANxc; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="I7FmANxc" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52O6nv2q017231; Mon, 24 Mar 2025 05:10:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=9dDeX z8GVfSLGoHR6PTTJ3SLeZDPmKSATrYHoZC5vMk=; b=I7FmANxcd7gRzmZutS6ra uJvtsgopWFku50rfJUEPe0PP8Jwtamt044W6dBbkt0O6oKwMCFCN1k02Nt5BjJTH vMTFcTsgfzr0Wk4AijyzGLwSyXwpYHZ69+xNaSYVJVncP4N3DPtXprYXIjl/gwFI pl+WLDN0LHvTZprKEUEu08VemHArxLyS3c+vkCPSmC/iGe25znXZOYNsrWK4bbVW MBNREhisLHtcV72JYVxUsLXw8uvYWGxeFPU8i4pKG5HmOYjDfENYWuHI6mecBLF3 nLbi2VdOny3aAxL2I8rjppCpjszqKHSqnmh71gojTdmTfNf+yHvXef1x8QenM4L2 g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 45k2fmgncj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Mar 2025 05:10:08 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 52O9A7v3058902 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Mar 2025 05:10:07 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:07 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 24 Mar 2025 05:10:07 -0400 Received: from romlx5.adlk.analog.com ([10.48.65.73]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52O99Y6A001058; Mon, 24 Mar 2025 05:09:57 -0400 From: Pop Ioan Daniel To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nuno Sa , Olivier Moysan , David Lechner , Javier Carrasco , Andy Shevchenko , Guillaume Stols , Trevor Gamblin , Dumitru Ceclan , Matteo Martelli , =?utf-8?q?Jo=C3=A3o_Paulo_Gon?= =?utf-8?q?=C3=A7alves?= , Alisa-Dariana Roman , Thomas Bonnefille , Herve Codina , Marcelo Schmitt , Dragos Bogdan , , , CC: Pop Ioan Daniel Subject: [PATCH 1/5] iio: backend: add support for decimation ratio set Date: Mon, 24 Mar 2025 11:07:56 +0200 Message-ID: <20250324090813.2775011-2-pop.ioan-daniel@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> References: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=As/u3P9P c=1 sm=1 tr=0 ts=67e12170 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=Vs1iUdzkB0EA:10 a=gAnH3GRIAAAA:8 a=l9A8joCuJueiPxiydrAA:9 X-Proofpoint-ORIG-GUID: DK3IPOc7C6JPx7ExsH_P_o_lYx5fcUCn X-Proofpoint-GUID: DK3IPOc7C6JPx7ExsH_P_o_lYx5fcUCn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-24_04,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1011 bulkscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503240066 Add backend support for setting the decimation ratio used. Signed-off-by: Pop Ioan Daniel --- drivers/iio/industrialio-backend.c | 18 ++++++++++++++++++ include/linux/iio/backend.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c index 363281272035..f4db6514944a 100644 --- a/drivers/iio/industrialio-backend.c +++ b/drivers/iio/industrialio-backend.c @@ -417,6 +417,24 @@ int iio_backend_test_pattern_set(struct iio_backend *back, } EXPORT_SYMBOL_NS_GPL(iio_backend_test_pattern_set, "IIO_BACKEND"); +/** + * iio_backend_set_dec_rate - set decimation ratio + * @back: Backend device + * @rate: Rate in decimal + + * Return: + * 0 on success, negative error number on failure. + */ + +int iio_backend_set_dec_rate(struct iio_backend *back, unsigned int rate) +{ + if (!rate) + return -EINVAL; + + return iio_backend_op_call(back, set_dec_rate, rate); +} +EXPORT_SYMBOL_NS_GPL(iio_backend_set_dec_rate, "IIO_BACKEND"); + /** * iio_backend_chan_status - Get the channel status * @back: Backend device diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h index 10be00f3b120..e73d7d265a16 100644 --- a/include/linux/iio/backend.h +++ b/include/linux/iio/backend.h @@ -80,6 +80,7 @@ enum iio_backend_sample_trigger { * @data_source_set: Configure the data source for a specific channel. * @set_sample_rate: Configure the sampling rate for a specific channel. * @test_pattern_set: Configure a test pattern. + * @set_dec_rate: Set decimation ratio * @chan_status: Get the channel status. * @iodelay_set: Set digital I/O delay. * @data_sample_trigger: Control when to sample data. @@ -111,6 +112,7 @@ struct iio_backend_ops { int (*test_pattern_set)(struct iio_backend *back, unsigned int chan, enum iio_backend_test_pattern pattern); + int (*set_dec_rate)(struct iio_backend *back, unsigned int rate); int (*chan_status)(struct iio_backend *back, unsigned int chan, bool *error); int (*iodelay_set)(struct iio_backend *back, unsigned int chan, @@ -167,6 +169,7 @@ int iio_backend_set_sampling_freq(struct iio_backend *back, unsigned int chan, int iio_backend_test_pattern_set(struct iio_backend *back, unsigned int chan, enum iio_backend_test_pattern pattern); +int iio_backend_set_dec_rate(struct iio_backend *back, unsigned int rate); int iio_backend_chan_status(struct iio_backend *back, unsigned int chan, bool *error); int iio_backend_iodelay_set(struct iio_backend *back, unsigned int lane, From patchwork Mon Mar 24 09:07:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pop Ioan Daniel X-Patchwork-Id: 14026948 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 4BB9325D8FE; Mon, 24 Mar 2025 09:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807445; cv=none; b=iiqrdJDXLfMaUZvNj53h0RugqECJ9MzkR2KlUftNmGw1AAJ2VAfxLD3OuwrG2+MCg0CeEF17+prCg+5nZtT5QTNVAjmefsu8zh3Y0PvIIXM722gjsLvNdUlR1jckklfA1uOJJoswqC9zvXuCTvmY2Jx571WA+Mosz6oQwaDuPLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807445; c=relaxed/simple; bh=xIj27Y7KtRteFLRWCMPuPG4fnslDopomKDgwbdfpbHc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pr8oGNje+ZOjSQ8MW2WWNYv6bvBRx4nMav9y1OJP/jTlyK4YygkZ+MPwcnsd5G46AMj9iz0z/Wy3dGhgk5Saynk7Msp/g3SnMQSXNoTfCJlkGV2+SRP+DOY65WiWRH1DSaH7wgK7YAqTKrcKvRdGzXInaAo/kNJW3fMR+k9i4RM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=j1quF8Qo; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="j1quF8Qo" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52O5q88S032462; Mon, 24 Mar 2025 05:10:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=lIbnp xgREJX5ezsaXtDGge4N1KqqlmrjgSo5e/Lh4Ts=; b=j1quF8QoTDHxKuQ/eFilK l49IMVTv8T2F7K+sa75T6TSBCVrMSVVZDQjA2oTp6V/XjzJOGCK/eKQIHkEfkXer QvIZgVc3LBUb/RBx3sqkw+y8rPZJjdnssIgW861NJKql9sjTq5kdlDcLnsJTPE+6 n4EAZTgZtbKgzVysYD3S98DUGQXSU7+AT/xFoRA8kCNtc7zhZSkzFriSAWejy56B dDZgQwP/CBsloKgo4q0oaw8VtcAaQq0yn5B/PRGwaPn9KJslWlz6Q6DYp8agRez0 ojo8xCX+SOMbEtcwmq3J+LquqfwXWmbai/G1AO6hByEoLgf33cJUYUkdGW6w8ojT w== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 45hq27a5n9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Mar 2025 05:10:20 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 52O9AJ2C058942 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Mar 2025 05:10:19 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:19 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:18 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 24 Mar 2025 05:10:18 -0400 Received: from romlx5.adlk.analog.com ([10.48.65.73]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52O99Y6B001058; Mon, 24 Mar 2025 05:10:08 -0400 From: Pop Ioan Daniel To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Rob Herring" , Krzysztof Kozlowski , "Conor Dooley" , Nuno Sa , Olivier Moysan , David Lechner , "Javier Carrasco" , Andy Shevchenko , Guillaume Stols , Trevor Gamblin , Dumitru Ceclan , Matteo Martelli , =?utf-8?q?Jo=C3=A3o_Paulo_Gon?= =?utf-8?q?=C3=A7alves?= , Alisa-Dariana Roman , Marcelo Schmitt , Herve Codina , "Ramona Alexandra Nechita" , Dragos Bogdan , , , CC: Pop Ioan Daniel Subject: [PATCH 2/5] iio: adc: adi-axi-adc: add set decimation rate Date: Mon, 24 Mar 2025 11:07:57 +0200 Message-ID: <20250324090813.2775011-3-pop.ioan-daniel@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> References: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: Rwt4kiP-WitRnTEc6kwbvBNnVLg3KkgJ X-Proofpoint-GUID: Rwt4kiP-WitRnTEc6kwbvBNnVLg3KkgJ X-Authority-Analysis: v=2.4 cv=DoZW+H/+ c=1 sm=1 tr=0 ts=67e1217c cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=Vs1iUdzkB0EA:10 a=gAnH3GRIAAAA:8 a=p9lpGC_FqOwZuuFCcoMA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-24_04,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 lowpriorityscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503240066 Add support for setting decimation rate. Add separate compatible string for the custom AD7405 IP and implement the necessary changes. Signed-off-by: Pop Ioan Daniel --- drivers/iio/adc/adi-axi-adc.c | 43 ++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c index 766406f45396..0ed609e294ba 100644 --- a/drivers/iio/adc/adi-axi-adc.c +++ b/drivers/iio/adc/adi-axi-adc.c @@ -70,6 +70,9 @@ #define ADI_AXI_ADC_REG_CHAN_CTRL_3(c) (0x0418 + (c) * 0x40) #define ADI_AXI_ADC_CHAN_PN_SEL_MASK GENMASK(19, 16) +#define ADI_AXI_ADC_REG_CHAN_USR_CTRL_2 0x0424 +#define ADI_AXI_ADC_DEC_RATE_MASK GENMASK(15, 0) + /* IO Delays */ #define ADI_AXI_ADC_REG_DELAY(l) (0x0800 + (l) * 0x4) #define AXI_ADC_DELAY_CTRL_MASK GENMASK(4, 0) @@ -232,6 +235,16 @@ static int axi_adc_test_pattern_set(struct iio_backend *back, } } +static int axi_adc_set_dec_rate(struct iio_backend *back, + unsigned int rate) +{ + struct adi_axi_adc_state *st = iio_backend_get_priv(back); + + return regmap_update_bits(st->regmap, (ADI_AXI_ADC_REG_CHAN_USR_CTRL_2), + ADI_AXI_ADC_DEC_RATE_MASK, + FIELD_PREP(ADI_AXI_ADC_DEC_RATE_MASK, rate)); +} + static int axi_adc_read_chan_status(struct adi_axi_adc_state *st, unsigned int chan, unsigned int *status) { @@ -465,6 +478,28 @@ static const struct iio_backend_info adi_axi_adc_generic = { .ops = &adi_axi_adc_ops, }; +static const struct iio_backend_ops adi_ad7405_ops = { + .enable = axi_adc_enable, + .disable = axi_adc_disable, + .data_format_set = axi_adc_data_format_set, + .chan_enable = axi_adc_chan_enable, + .chan_disable = axi_adc_chan_disable, + .request_buffer = axi_adc_request_buffer, + .free_buffer = axi_adc_free_buffer, + .data_sample_trigger = axi_adc_data_sample_trigger, + .iodelay_set = axi_adc_iodelays_set, + .test_pattern_set = axi_adc_test_pattern_set, + .set_dec_rate = axi_adc_set_dec_rate, + .chan_status = axi_adc_chan_status, + .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), + .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), +}; + +static const struct iio_backend_info axi_ad7405 = { + .name = "axi-ad7405", + .ops = &adi_ad7405_ops, +}; + static int adi_axi_adc_probe(struct platform_device *pdev) { struct adi_axi_adc_state *st; @@ -522,7 +557,7 @@ static int adi_axi_adc_probe(struct platform_device *pdev) return -ENODEV; } - ret = devm_iio_backend_register(&pdev->dev, &adi_axi_adc_generic, st); + ret = devm_iio_backend_register(&pdev->dev, st->info->backend_info, st); if (ret) return dev_err_probe(&pdev->dev, ret, "failed to register iio backend\n"); @@ -575,10 +610,16 @@ static const struct axi_adc_info adc_ad7606 = { .has_child_nodes = true, }; +static const struct axi_adc_info adi_axi_ad7405 = { + .version = ADI_AXI_PCORE_VER(10, 0, 'a'), + .backend_info = &axi_ad7405, +}; + /* Match table for of_platform binding */ static const struct of_device_id adi_axi_adc_of_match[] = { { .compatible = "adi,axi-adc-10.0.a", .data = &adc_generic }, { .compatible = "adi,axi-ad7606x", .data = &adc_ad7606 }, + { .compatible = "adi,axi-ad7405", .data = &adi_axi_ad7405}, { /* end of list */ } }; MODULE_DEVICE_TABLE(of, adi_axi_adc_of_match); From patchwork Mon Mar 24 09:07:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pop Ioan Daniel X-Patchwork-Id: 14026949 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 09C3325DCE3; Mon, 24 Mar 2025 09:10:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807449; cv=none; b=r1dZWH1Mj6yyJp1TMWlvxgy7sYp/5lnZdeQnE31ewJ79kECMp3xRclquEJ9YKirXyfodFBULr8WQmVSP+42Vwoi2JVSdAbk+p3JCZH7lXGssdrq8hg83fcDU17Y87w5C1CUYu69lCGKdX+UOzY+Z3cLdAAk3lELSOgbBrAcCEzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807449; c=relaxed/simple; bh=UdDI1Te8uMOT0XIapN8tSxQLCFG3a6nyUStR7kIfAHc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MaXkzpPGq18qDdIp5fWD/q2n2oSCXDS9IV/z2494RF8hSEa+ygErGB3Q5OA8lqsGadEADHK/piNL0AZI9QwX+H+ZsGIbYiXOi5xXuUQYW/OrzZyBwpxBHZ/pMmcopdcXsubY08Hdpfmew80tAijEDAL8sRgnSGkR2Ua7Hp8mWEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=mKEOYXVE; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="mKEOYXVE" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52O6nv6P017279; Mon, 24 Mar 2025 05:10:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=CKXnS E7YgkgNdQyxFicCRtT1M3XQxNnTgmpKxLRHEAo=; b=mKEOYXVEh6sdJD1bBHzKg kG2NdYgsb84BTTH7LNVwQnu7LMxWYDpYLpjgqQxdxHpCb85RkRS0kDT/kS29nD5L V8TK87l+Kwf6ht1Rv8R8/IQiQ4cq4MVhzqOBMfFNImU2QX8I6t1yr2kdrwU2oKMF cqOBOEVZCHKKmTg5xhg9ByUHSYNjMUKixwLLnz2NuMsTZ6rNbnT3rHihSJcgvVB3 XYGnPBk9FgwVa06nK8AVVupUeewhN12fsPBCfqyt+6mSFK27bWi8BtOC5GW7SRtX LtoKAwdc5ImnXCXTwLKpTSn+0+ve5eygCXN7XaAsyzwS0zBs7+90iwBnpLbxur7i g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 45k2fmgnf2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Mar 2025 05:10:27 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 52O9AQm4058960 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Mar 2025 05:10:26 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:26 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 24 Mar 2025 05:10:26 -0400 Received: from romlx5.adlk.analog.com ([10.48.65.73]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52O99Y6C001058; Mon, 24 Mar 2025 05:10:18 -0400 From: Pop Ioan Daniel To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nuno Sa , Olivier Moysan , David Lechner , Javier Carrasco , Andy Shevchenko , Trevor Gamblin , Guillaume Stols , Dumitru Ceclan , Matteo Martelli , Marcelo Schmitt , Alisa-Dariana Roman , Thomas Bonnefille , Ramona Alexandra Nechita , Pop Ioan Daniel , Dragos Bogdan , , , Subject: [PATCH 3/5] dt-bindings: iio: adc: add ad7405 axi variant Date: Mon, 24 Mar 2025 11:07:58 +0200 Message-ID: <20250324090813.2775011-4-pop.ioan-daniel@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> References: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=As/u3P9P c=1 sm=1 tr=0 ts=67e12183 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=Vs1iUdzkB0EA:10 a=gAnH3GRIAAAA:8 a=wI1k2SEZAAAA:8 a=jiw2UTfpILs8DVZZAT8A:9 a=6HWbV-4b7c7AdzY24d_u:22 X-Proofpoint-ORIG-GUID: 0X-Eq4EWDFCpwrT0h2orRDdWOScbwrd0 X-Proofpoint-GUID: 0X-Eq4EWDFCpwrT0h2orRDdWOScbwrd0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-24_04,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 bulkscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=921 spamscore=0 phishscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503240066 Add a new compatible and related bindings for the fpga-based ad7405 AXI IP core, a variant of the generic AXI ADC IP. The AXI AD7405 IP is a very similar HDL (fpga) variant of the generic AXI ADC IP, intended to control ad7405/adum770x family. Signed-off-by: Pop Ioan Daniel --- Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml b/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml index 4fa82dcf6fc9..1b02217ff8b5 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml @@ -27,6 +27,7 @@ description: | the ad7606 family. https://wiki.analog.com/resources/fpga/docs/axi_adc_ip + https://analogdevicesinc.github.io/hdl/library/axi_ad7405/index.html http://analogdevicesinc.github.io/hdl/library/axi_ad7606x/index.html properties: @@ -34,6 +35,7 @@ properties: enum: - adi,axi-adc-10.0.a - adi,axi-ad7606x + - adi,axi-ad7405 reg: maxItems: 1 From patchwork Mon Mar 24 09:07:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pop Ioan Daniel X-Patchwork-Id: 14026950 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 79AB6AD24; Mon, 24 Mar 2025 09:10:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807459; cv=none; b=kHGH1iYJiKn69TIpbe5YQr/zCDYtcgUDfoJojpohsPZsTWwOnRbAYsUuCKF45QJKsfLbv9QW6jejP5ytr/ReDZE9hQyTp7i0z5v+sK0d877W7AHJVvK1mlsYmzt8cE5rsZh6G20BUrbvDC2zL2oZQT6/h8AzpWJIa+HQ3rmJQbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807459; c=relaxed/simple; bh=y2vLuUOaNW23Vn/y8DkDFJTAYRTtno1A5bPSLxNWZQQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S8VEtRCcw3Z1sQgi1kxrMaOeyisnKGx0hJIVA5sIISag8S6fXDpOtwI5dJwjrdkmyz4v1xkCby7HkE0caaJ2MnffQlrnk+hEnMMBQeGPZRBEhz7v1hqEkaERwg8M7izA6G9knA4c8CgoZsslJ+GctMmYUkXWaMwWST41qOm7byg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=WdzHEhtC; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="WdzHEhtC" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52O55WS6032458; Mon, 24 Mar 2025 05:10:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=p9dei fXUnM0oYorHf6U+gjSrt/yAkn7mGhCreCwEXFM=; b=WdzHEhtCv+VZ2qVXv5p0/ 987RLz1sFssynplZ8K+3qGStRSF46BPMQlGQfPt3HsmyPzwgWHOk04G/c7Grg7v0 qEyTgatEOArIzbBk5K9FfXC2V1vrC3iJiv8PQz0i3D0vmoCV24nCxHP4/lZsvShh tenmwl0oS86L9msrEvILAWSTvebcjW36gfdkQPMnH+IW9EmEdVQfQ9FjbwMWCHU5 p394JeES6zlUsHnzqjqp20FKTLVVjYyELWD8QBQ/bM1pVVHSlVoFzHDUVXJEAhVP 82TPXBFzFdWKuPdQz/xYfcRnQCur2wRAhSZMRSOvAd4bmyIJu04KRji5iCHDPDFI g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 45hq27a5p4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Mar 2025 05:10:37 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 52O9Aa9j058978 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Mar 2025 05:10:36 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:35 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 24 Mar 2025 05:10:35 -0400 Received: from romlx5.adlk.analog.com ([10.48.65.73]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52O99Y6D001058; Mon, 24 Mar 2025 05:10:27 -0400 From: Pop Ioan Daniel To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nuno Sa , Olivier Moysan , David Lechner , Javier Carrasco , Andy Shevchenko , Trevor Gamblin , Guillaume Stols , Dumitru Ceclan , Matteo Martelli , Marcelo Schmitt , Alisa-Dariana Roman , Ramona Alexandra Nechita , Thomas Bonnefille , Dragos Bogdan , , , CC: Pop Ioan Daniel Subject: [PATCH 4/5] dt-bindings: iio: adc: add ad7405 Date: Mon, 24 Mar 2025 11:07:59 +0200 Message-ID: <20250324090813.2775011-5-pop.ioan-daniel@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> References: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: YQeHfJ_FoijthZ7tQ8h2wHNtSbspzRcg X-Proofpoint-GUID: YQeHfJ_FoijthZ7tQ8h2wHNtSbspzRcg X-Authority-Analysis: v=2.4 cv=DoZW+H/+ c=1 sm=1 tr=0 ts=67e1218d cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=gEfo2CItAAAA:8 a=gAnH3GRIAAAA:8 a=BlUfrHhC_0NcX1HyLxIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=sptkURWiP4Gy88Gu7hUp:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-24_04,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503240066 Add devicetree bindings for ad7405/adum770x family. Signed-off-by: Pop Ioan Daniel Reviewed-by: Rob Herring (Arm) --- .../bindings/iio/adc/adi,ad7405.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad7405.yaml diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7405.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7405.yaml new file mode 100644 index 000000000000..e312fa0cdb05 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7405.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2025 Analog Devices Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/adi,ad7405.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices AD7405 family + +maintainers: + - Dragos Bogdan + +description: | + Analog Devices AD7405 is a high performance isolated ADC, 1-channel, + 16-bit with a second-order Σ-Δ modulator that converts an analog input signal + into a high speed, single-bit data stream. + + https://www.analog.com/media/en/technical-documentation/data-sheets/ad7405.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/adum7701.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/adum7702.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/ADuM7703.pdf + +properties: + compatible: + enum: + - adi,ad7405 + - adi,adum7701 + - adi,adum7702 + - adi,adum7703 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + vdd1-supply: true + + vdd2-supply: true + + clocks: + maxitems: 1 + + io-backends: + maxItems: 1 + +required: + - compatible + - vdd1-supply + - vdd2-supply + - clocks + - io-backends + +unevaluatedProperties: false + +examples: + - | + #include + adc { + #address-cells = <1>; + #size-cells = <0>; + compatible = "adi,ad7405"; + clocks = <&axi_clk_gen 0>; + vdd1-supply = <&vdd1>; + vdd2-supply = <&vdd2>; + io-backends = <&iio_backend>; + }; +... \ No newline at end of file From patchwork Mon Mar 24 09:08:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pop Ioan Daniel X-Patchwork-Id: 14026951 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 70A8C14EC46; Mon, 24 Mar 2025 09:11:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807473; cv=none; b=E+Rs7Wb68IdkbzsBVdAYfcnffF7WhenPn7mYZQZtDT0y2oLusY90Jkc8SgU7w8zDbhRl0WEzlEt5cewCP+DRPsdSaUK7KaRbGHUTrSWoBG4hwSVahZTXVAlmo7ZEGCkcKJLPvxKkSJkvraW6DHQgc4ioIMpsr7GD3NU5RR1vUQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742807473; c=relaxed/simple; bh=Q/bMuKRNaJxK8Xj+Cj3p0bILcfFYQhz+mkD/FNKINsA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MjFLuzyaCkHgiaAK81rnU9vTLceLtmLTXXjgPXfhQ6oMn3wvLjylwKMyCipg/bQijW2IOLWdN2l4lOgNu3fzt5GO6KmJrQmF1dAX9SosZNrO2ybIrlL6Gp02POMgDcxURbfy3S9eIFDKZWRaS6buD8cPDrAPOvoyLsXl8o8uhGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=t9Tq5xJ0; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="t9Tq5xJ0" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52O5tB4q000579; Mon, 24 Mar 2025 05:10:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=qosvk KF90iXKnrJt1urw7U6F0qXU4/S9Zt0tJgi00JU=; b=t9Tq5xJ0Wq+6jQaV2+9uS oe7gQoh57rhiVAEIoyNN2rDg0trQMeJVbEDQyI1gb2uBoZytTjZPPsyfZ6W4cOQ8 qJPVHz/TT+ZW8DOq7TqcNoaviVYncvOHaPI1G+yD9x2g3q5YmXYFwfL10g66HCcY Nqkrjr9d6gRe/SOjQ7tSdAXSeBNSAPGnECaEu3Vs5TKye0KqIaNI2Bwdq7JtLLKM mweaz+D91MhxJwm+NXyb+jEm/IQNUNZVHRR8+otEaZF8y98RF8lhiz177obAoos0 eDf3BI0Osk49h20qEcYgQb5jNpPtN/yPDQxfRa4p/XtfEiBlbJeKEt3WhtBiG8Sm A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 45hq27a5py-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Mar 2025 05:10:50 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 52O9Anwp059021 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Mar 2025 05:10:49 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:49 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 24 Mar 2025 05:10:49 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 24 Mar 2025 05:10:48 -0400 Received: from romlx5.adlk.analog.com ([10.48.65.73]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52O99Y6E001058; Mon, 24 Mar 2025 05:10:39 -0400 From: Pop Ioan Daniel To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Rob Herring" , Krzysztof Kozlowski , "Conor Dooley" , Nuno Sa , Olivier Moysan , David Lechner , "Javier Carrasco" , Andy Shevchenko , Guillaume Stols , Trevor Gamblin , Dumitru Ceclan , Matteo Martelli , AngeloGioacchino Del Regno , Alisa-Dariana Roman , Michael Walle , Herve Codina , "Thomas Bonnefille" , Pop Ioan Daniel , Dragos Bogdan , , , Subject: [PATCH 5/5] iio: adc: ad7405: add ad7405 driver Date: Mon, 24 Mar 2025 11:08:00 +0200 Message-ID: <20250324090813.2775011-6-pop.ioan-daniel@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> References: <20250324090813.2775011-1-pop.ioan-daniel@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: 7Q0XEZaNTTlgPCfJpx1qciN6bpKcMM8z X-Proofpoint-GUID: 7Q0XEZaNTTlgPCfJpx1qciN6bpKcMM8z X-Authority-Analysis: v=2.4 cv=DoZW+H/+ c=1 sm=1 tr=0 ts=67e1219a cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=gAnH3GRIAAAA:8 a=3EAs76dHXMSs3TCrLnMA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-24_04,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 lowpriorityscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503240066 Add support for the AD7405/ADUM770x, a high performance isolated ADC, 1-channel, 16-bit with a second-order Σ-Δ modulator that converts an analog input signal into a high speed, single-bit data stream. Signed-off-by: Pop Ioan Daniel --- drivers/iio/adc/Kconfig | 10 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ad7405.c | 301 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 312 insertions(+) create mode 100644 drivers/iio/adc/ad7405.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index f64b5faeb257..321a1ee7304f 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -203,6 +203,16 @@ config AD7380 To compile this driver as a module, choose M here: the module will be called ad7380. +config AD7405 + tristate "Analog Device AD7405 ADC Driver" + select IIO_BACKEND + help + Say yes here to build support for Analog Devices AD7405, ADUM7701, + ADUM7702, ADUM7703 analog to digital converters (ADC). + + To compile this driver as a module, choose M here: the module will be + called ad7405. + config AD7476 tristate "Analog Devices AD7476 1-channel ADCs driver and other similar devices from AD and TI" depends on SPI diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index ee19afba62b7..0c3c1c69b6b4 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_AD7291) += ad7291.o obj-$(CONFIG_AD7292) += ad7292.o obj-$(CONFIG_AD7298) += ad7298.o obj-$(CONFIG_AD7380) += ad7380.o +obj-$(CONFIG_AD7405) += ad7405.o obj-$(CONFIG_AD7476) += ad7476.o obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o diff --git a/drivers/iio/adc/ad7405.c b/drivers/iio/adc/ad7405.c new file mode 100644 index 000000000000..40fe072369d5 --- /dev/null +++ b/drivers/iio/adc/ad7405.c @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Analog Devices AD7405 driver + * + * Copyright 2025 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AD7405_DEFAULT_DEC_RATE 1024 + +const unsigned int ad7405_dec_rates[] = { + 4096, 2048, 1024, 512, 256, 128, 64, 32, +}; + +struct ad7405_chip_info { + const char *name; + unsigned int num_channels; + unsigned int max_rate; + unsigned int min_rate; + struct iio_chan_spec channel[3]; + const unsigned long *available_mask; +}; + +struct ad7405_state { + struct iio_backend *back; + struct clk *axi_clk_gen; + /* lock to protect multiple accesses to the device registers */ + struct mutex lock; + struct regmap *regmap; + struct iio_info iio_info; + const struct ad7405_chip_info *info; + unsigned int sample_frequency_tbl[ARRAY_SIZE(ad7405_dec_rates)]; + unsigned int sample_frequency; + unsigned int ref_frequency; +}; + +static void ad7405_fill_samp_freq_table(struct ad7405_state *st) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ad7405_dec_rates); i++) + st->sample_frequency_tbl[i] = DIV_ROUND_CLOSEST_ULL(st->ref_frequency, ad7405_dec_rates[i]); +} + +static int ad7405_set_sampling_rate(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + unsigned int samp_rate) +{ + struct ad7405_state *st = iio_priv(indio_dev); + unsigned int dec_rate, idx; + int ret; + + dec_rate = DIV_ROUND_CLOSEST_ULL(st->ref_frequency, samp_rate); + + idx = find_closest_descending(dec_rate, ad7405_dec_rates, + ARRAY_SIZE(ad7405_dec_rates)); + + dec_rate = ad7405_dec_rates[idx]; + + ret = iio_backend_set_dec_rate(st->back, dec_rate); + if (ret) + return ret; + + st->sample_frequency = DIV_ROUND_CLOSEST_ULL(st->ref_frequency, dec_rate); + + return 0; +} + +static int ad7405_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *scan_mask) +{ + struct ad7405_state *st = iio_priv(indio_dev); + unsigned int c; + int ret; + + for (c = 0; c < indio_dev->num_channels; c++) { + if (test_bit(c, scan_mask)) + ret = iio_backend_chan_enable(st->back, c); + else + ret = iio_backend_chan_disable(st->back, c); + if (ret) + return ret; + } + + return 0; +} + +static int ad7405_read_raw(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, int *val, + int *val2, long info) +{ + struct ad7405_state *st = iio_priv(indio_dev); + + switch (info) { + case IIO_CHAN_INFO_SAMP_FREQ: + *val = st->sample_frequency; + + return IIO_VAL_INT; + default: + return -EINVAL; + } +} + +static int ad7405_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, + int val2, long info) +{ + switch (info) { + case IIO_CHAN_INFO_SAMP_FREQ: + + return ad7405_set_sampling_rate(indio_dev, chan, val); + + default: + return -EINVAL; + } +} + +static int ad7405_read_avail(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + const int **vals, int *type, int *length, + long info) +{ + struct ad7405_state *st = iio_priv(indio_dev); + + switch (info) { + case IIO_CHAN_INFO_SAMP_FREQ: + *vals = st->sample_frequency_tbl; + *length = ARRAY_SIZE(st->sample_frequency_tbl); + *type = IIO_VAL_INT; + return IIO_AVAIL_LIST; + default: + return -EINVAL; + } +} + +static const struct iio_info ad7405_iio_info = { + .read_raw = &ad7405_read_raw, + .write_raw = &ad7405_write_raw, + .read_avail = &ad7405_read_avail, + .update_scan_mode = ad7405_update_scan_mode, +}; + +#define AD7405_IIO_CHANNEL(_chan, _bits, _sign) \ + { .type = IIO_VOLTAGE, \ + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .info_mask_shared_by_all_available = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .indexed = 1, \ + .channel = _chan, \ + .scan_type = { \ + .sign = _sign, \ + .realbits = _bits, \ + .storagebits = 16, \ + .shift = 0, \ + }, \ + } + +static const unsigned long ad7405_channel_masks[] = { + BIT(0), + 0, +}; + +static const struct ad7405_chip_info ad7405_chip_info = { + .name = "AD7405", + .max_rate = 625000UL, + .min_rate = 4883UL, + .num_channels = 1, + .channel = { + AD7405_IIO_CHANNEL(0, 16, 'u'), + }, + .available_mask = ad7405_channel_masks, +}; + +static const struct ad7405_chip_info adum7701_chip_info = { + .name = "ADUM7701", + .max_rate = 656250UL, + .min_rate = 5127UL, + .num_channels = 1, + .channel = { + AD7405_IIO_CHANNEL(0, 16, 'u'), + }, + .available_mask = ad7405_channel_masks, +}; + +static const char * const ad7405_power_supplies[] = { + "vdd1", "vdd2", +}; + +static int ad7405_probe(struct platform_device *pdev) +{ + const struct ad7405_chip_info *chip_info; + struct device *dev = &pdev->dev; + struct iio_dev *indio_dev; + struct ad7405_state *st; + int ret; + + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); + if (!indio_dev) + return -ENOMEM; + + st = iio_priv(indio_dev); + + ret = devm_mutex_init(dev, &st->lock); + if (ret) + return ret; + + chip_info = &ad7405_chip_info; + + platform_set_drvdata(pdev, indio_dev); + + st->axi_clk_gen = devm_clk_get(dev, NULL); + if (IS_ERR(st->axi_clk_gen)) + return PTR_ERR(st->axi_clk_gen); + + ret = clk_prepare_enable(st->axi_clk_gen); + if (ret) + return ret; + + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(ad7405_power_supplies), + ad7405_power_supplies); + + if (ret) + return dev_err_probe(dev, ret, "failed to get and enable supplies"); + + st->ref_frequency = clk_get_rate(st->axi_clk_gen); + + ad7405_fill_samp_freq_table(st); + + indio_dev->dev.parent = dev; + indio_dev->name = pdev->dev.of_node->name; + indio_dev->modes = INDIO_DIRECT_MODE; + + indio_dev->channels = chip_info->channel; + indio_dev->num_channels = chip_info->num_channels; + + st->iio_info = ad7405_iio_info; + indio_dev->info = &st->iio_info; + + st->back = devm_iio_backend_get(dev, NULL); + if (IS_ERR(st->back)) + return dev_err_probe(dev, PTR_ERR(st->back), + "failed to get IIO backend"); + + ret = devm_iio_backend_request_buffer(dev, st->back, indio_dev); + if (ret) + return ret; + + ret = devm_iio_backend_enable(dev, st->back); + if (ret) + return ret; + + /* Reset all HDL Cores */ + iio_backend_disable(st->back); + iio_backend_enable(st->back); + + ret = ad7405_set_sampling_rate(indio_dev, &indio_dev->channels[0], + chip_info->max_rate); + if (ret) + return ret; + + ret = devm_iio_device_register(dev, indio_dev); + if (ret) + return ret; + + return 0; +} + +/* Match table for of_platform binding */ +static const struct of_device_id ad7405_of_match[] = { + { .compatible = "adi,ad7405", .data = &ad7405_chip_info, }, + { .compatible = "adi,adum7701", .data = &adum7701_chip_info, }, + { .compatible = "adi,adum7702", .data = &adum7701_chip_info, }, + { .compatible = "adi,adum7703", .data = &adum7701_chip_info, }, + { /* end of list */ }, +}; + +MODULE_DEVICE_TABLE(of, ad7405_of_match); + +static struct platform_driver ad7405_driver = { + .driver = { + .name = "ad7405", + .owner = THIS_MODULE, + .of_match_table = ad7405_of_match, + }, + .probe = ad7405_probe, +}; + +module_platform_driver(ad7405_driver); + +MODULE_AUTHOR("Dragos Bogdan "); +MODULE_DESCRIPTION("Analog Devices AD7405 driver"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("IIO_BACKEND");