From nobody Fri Oct 3 20:55:18 2025 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 501242DE6FB; Mon, 25 Aug 2025 10:52:50 +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=1756119171; cv=none; b=ZZh5fjvZlsrNt7DyUoGh28QzUeQlWrs1eEn5YHry1qb7/ay/hVgIdZalfclAEyFGcMCfZ93QAkBG1uiIx1w9+vspLlOItlsz2Um/fUQgeKoUFA6Nky/WDFveRRNGvCqi94rFnDmHy5WQEpwgk085u/wIZOo5PoYJeAxFiq4UXzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756119171; c=relaxed/simple; bh=0PhTECnQWmkaQFRhGO8C6E3vapKDPdS2Qf5gumshVt0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XMJkrr59zs6XRd58SeTWZfdeejFTUr2eFzfYzSSxJfBMNpA/hGb82XCXaIEEOAu8jMtQbm9hBxUpFO06oVcg2tnDfzvPUAZko2em0/xNZFNgptZm96AO6e3nIwfFRRz1rKBHOwmYbnh/O7p3WeKMdzXwNyyt9SLLDOdgU5H0FI0= 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=v4QWmirp; 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="v4QWmirp" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57P8QCBL018328; Mon, 25 Aug 2025 06:52:30 -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=ExXkZ LkAnFa2N+cqsaGjGupmUoFpB2ygkHZfTYbtPck=; b=v4QWmirp3IP3pL0xKUlfD TRXb2KzS59dCtZ9DiISFLwOAbhwik7Z9x5V+OJn+n7Zsb+x+U2nWz3Nz+USWdRLp ovTCJXxP1ug+TgNZAhpB6DiRIW3lZVRiHfC9ueN4ZIfQB6lvGudvRW07s2I0/icT eJiEiNsxj6Q14zLgl52kYIqojSn1UhpwRQ2ZK9PGAXYXgLLJmXfinYUDOCJJUrrU ZLW+w0JuOyJ4ZmPsIIkAgWOibqeDxmxtviZ3zUDpF0fIQyXekLQByIs1IoG0Upoq PQlYwi+flHTlvrnBYtDzrzWjfiSFM41RGYP+e1d7nDEeOwIZcPNDQPafU0Kvdw81 w== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 48rmafgj8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Aug 2025 06:52:30 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 57PAqTdZ038568 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Aug 2025 06:52:29 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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.1748.10; Mon, 25 Aug 2025 06:52:28 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 25 Aug 2025 06:52:29 -0400 Received: from IRISTEIU-L01.ad.analog.com ([10.65.213.1]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 57PAq608026383; Mon, 25 Aug 2025 06:52:22 -0400 From: Ioana Risteiu To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ramona Nechita , , , CC: Ioana Risteiu Subject: [PATCH v5 1/4] iio: adc: adi-axi-adc: add axi_adc_num_lanes_set Date: Mon, 25 Aug 2025 13:51:16 +0300 Message-ID: <20250825105121.19848-2-Ioana.Risteiu@analog.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250825105121.19848-1-Ioana.Risteiu@analog.com> References: <20250825105121.19848-1-Ioana.Risteiu@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODI1MDA3NSBTYWx0ZWRfX9kOYfuICYtek qseA+Y8vcLD8VEtOBR9iMCdnfa/DJodV0/Mh2WAW6iQHZQuzTEaktVt0ZzPlnKY2zrKgPs4Cppd m7kjKDmJrlcUPV8yOxILAmXg1bA388i5R3yaf7ZYSX0lRjFGuS8NvvQgK6O56uLDrXXbeN742Xj SFLgCP3RSHPtUb8cHSqhYLu9Rh9M2IeZjFJ6bbQYISpW0ycjQ5zjBGazXRyZv8QiN/wJ8m5kLbv K/IemWMG4BswfZRyKrJc1VrqC4xRtQZ6SVU6dglxi6HfOgtoMy/Rj5mkpLI1PO7zrCmmExVhxI5 GHvvrInA3GWs7RxC/XQt2s+PFmn6H1yCiGcO/qkNru2Kl8nsmFBiuxeT8EXDDMwNNbMc7DVVnQX AHJEgdbQ X-Proofpoint-ORIG-GUID: Jt-1b9jmtD-NLjl_6Uujvm8CZAbkTQgp X-Proofpoint-GUID: Jt-1b9jmtD-NLjl_6Uujvm8CZAbkTQgp X-Authority-Analysis: v=2.4 cv=AoXu3P9P c=1 sm=1 tr=0 ts=68ac406e cx=c_pps a=PpDZqlmH/M8setHirZLBMw==:117 a=PpDZqlmH/M8setHirZLBMw==:17 a=2OwXVqhp2XgA:10 a=gAnH3GRIAAAA:8 a=uNKIQ4TcjcV5qgwVPWcA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-25_05,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508250075 Content-Type: text/plain; charset="utf-8" Assign num_lanes_set in the adi_axi_adc_ops to axi_adc_num_lanes_set() to support setting number of lanes used by AXI ADC. This operation is included in the generic structure because the number of lanes is a configurable parameter of the generic AXI ADC IP core, not specific to a device. Signed-off-by: Ioana Risteiu Reviewed-by: Andy Shevchenko --- changes in v5: - improve patch description drivers/iio/adc/adi-axi-adc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c index 2d86bb0e08a7..20bb59c24acf 100644 --- a/drivers/iio/adc/adi-axi-adc.c +++ b/drivers/iio/adc/adi-axi-adc.c @@ -617,6 +617,7 @@ static const struct iio_backend_ops adi_axi_adc_ops =3D= { .chan_status =3D axi_adc_chan_status, .interface_type_get =3D axi_adc_interface_type_get, .oversampling_ratio_set =3D axi_adc_oversampling_ratio_set, + .num_lanes_set =3D axi_adc_num_lanes_set, .debugfs_reg_access =3D iio_backend_debugfs_ptr(axi_adc_reg_access), .debugfs_print_chan_status =3D iio_backend_debugfs_ptr(axi_adc_debugfs_pr= int_chan_status), }; --=20 2.47.2 From nobody Fri Oct 3 20:55:18 2025 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 618731A9F8F; Mon, 25 Aug 2025 10:52:51 +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=1756119172; cv=none; b=jMrO7GcHc0jm4YLo748WNhPP0aUA42GanXPORWsmdpiWiZJn8qWA8U5wxffBZrLDtJfxjJuA21puCtYwh1bKdCkGze62CsMZc1ytUrsjvAXaJCNP39+Jt7LGFDFo5ac/o2g28FsaB3J5rbhhIkWhjkZQZT+gxMMLU0E5ChGNqUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756119172; c=relaxed/simple; bh=EdIhSMplJqn1dvkVFAqYH59dhlcVLWaCHL7fiFjgxZ0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eCjaQe0GYYhklExFOAz9w/mpwcVvvjr9Q2Yf7YJvZagGjr22OSA0D7pfevhuCF3aWuC5go5YdZ4FosRKrseVaP83FqjD2IwlkWaR0tdbhnwN3k80I+P8bYZOat5PMSxVyR2484I7I9kQGMtst+FWeF/q1d6eY0aYxxoc1wsEe40= 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=KND6goq9; 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="KND6goq9" 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 57P9sAug007925; Mon, 25 Aug 2025 06:52:36 -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=YPDkd KCckwLLxqt2JnKqv2DSnn/2KBKE2Lvaf89Pihw=; b=KND6goq92TWgwmoQOsvW3 cv6pTlw7RfeRQL8Nm00Y2c9i6IkU2Dv66Hr+vE9NCdIuyJZRMQ9JPVt+bHBDo81t pgWEaVrJkS7MwgdAZ9hLH/ou97uXCxhwrzrRZxyjwr7WraLM5x4gJ0azJ0X/49hS hCZuqFbLhSiszXqy/sRz4Ubev/zaTqeKZs7dQyrdhbOKVn+cQi3jsY/Q84xgDKce fysDRAkXo75m45brmYOEultwt8InjOu0R5AiNZB96O0/9mkKjonG/ZRB38aKN1VY B5OawmjYxL0FII4edpK3lqCu+QRABffjLI7q5Kv4791aFgLlkIQ0/vZa/5zMwviM w== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 48q7g40re5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Aug 2025 06:52:36 -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 57PAqZlW006401 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Aug 2025 06:52:35 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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.1748.10; Mon, 25 Aug 2025 06:52:35 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 25 Aug 2025 06:52:35 -0400 Received: from IRISTEIU-L01.ad.analog.com ([10.65.213.1]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 57PAq609026383; Mon, 25 Aug 2025 06:52:28 -0400 From: Ioana Risteiu To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ramona Nechita , , , CC: Ioana Risteiu , Krzysztof Kozlowski Subject: [PATCH v5 2/4] dt-bindings: iio: adc: add IIO backend support Date: Mon, 25 Aug 2025 13:51:17 +0300 Message-ID: <20250825105121.19848-3-Ioana.Risteiu@analog.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250825105121.19848-1-Ioana.Risteiu@analog.com> References: <20250825105121.19848-1-Ioana.Risteiu@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: 5vRbzI9zHtSr-NA8XDVLDw2xm0LE6tRT X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIzMDA1MSBTYWx0ZWRfXzR5OmTGQBM4o NzZZo8z21Ktuq9Jc/zmF53CTwi6+DiieAEE5NybHanw6kv1qgqbHWGWFwTTWMHychXz7LGQrfAv 8sxCo+eg2DtQwYQcWvMMRpg+YCCQ73C4La+B8+F2Auodph5q3qfrXoXMDjkOUS4f2anbT41lA6e 2XQl2bRrJi6nJDtdfe24gJzNCHfdnMqv4WcqxRMvHdSwDyovF3sgYzc07jaqPwzLIlh4Xly7p17 UxIW0V4XYNRSZ06cJcwY/siAxucnlWqkJ7hpntg2E+rprTjG6jZXiRRyJJkRUy1GUJuBVbvrj89 E/94aOOfQbjVvAxCy2BzIeVcs3DAtbDdj9+S9vTY8RFHH5OXUSlyNDxafTm6+UB0DCIK1IqOPHV 45fHjMms X-Proofpoint-GUID: 5vRbzI9zHtSr-NA8XDVLDw2xm0LE6tRT X-Authority-Analysis: v=2.4 cv=PNQP+eqC c=1 sm=1 tr=0 ts=68ac4074 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=2OwXVqhp2XgA:10 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=gAnH3GRIAAAA:8 a=vK1i7N8imb33MzeTDgYA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-25_05,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 clxscore=1015 malwarescore=0 impostorscore=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508230051 Content-Type: text/plain; charset="utf-8" Add the generic io-backends property to the AD7779 binding to enable support for the IIO backend framework. Also add the adi,num-lanes property to set the number of lanes used by AD7779. Reviewed-by: Rob Herring (Arm) Reviewed-by: Krzysztof Kozlowski Signed-off-by: Ioana Risteiu --- no changes in v5. .../bindings/iio/adc/adi,ad7779.yaml | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7779.yaml b/Do= cumentation/devicetree/bindings/iio/adc/adi,ad7779.yaml index 044f92f39cfa..ba3f7b2bd6cf 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7779.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7779.yaml @@ -80,11 +80,36 @@ properties: reset-gpios: maxItems: 1 =20 + io-backends: + maxItems: 1 + + adi,num-lanes: + description: + Number of lanes on which the data is sent on the output when the data + output interface is used. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2, 4] + default: 4 + required: - compatible - reg - clocks - - interrupts + +allOf: + - if: + not: + required: + - io-backends + then: + properties: + adi,num-lanes: false + +oneOf: + - required: + - interrupts + - required: + - io-backends =20 unevaluatedProperties: false =20 @@ -107,4 +132,21 @@ examples: clocks =3D <&adc_clk>; }; }; + + - | + #include + spi { + #address-cells =3D <1>; + #size-cells =3D <0>; + + adc@0 { + compatible =3D "adi,ad7779"; + reg =3D <0>; + start-gpios =3D <&gpio0 87 GPIO_ACTIVE_LOW>; + reset-gpios =3D <&gpio0 93 GPIO_ACTIVE_LOW>; + clocks =3D <&adc_clk>; + io-backends =3D <&iio_backend>; + adi,num-lanes =3D <4>; + }; + }; ... --=20 2.47.2 From nobody Fri Oct 3 20:55:18 2025 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 A98A42E03F2; Mon, 25 Aug 2025 10:52:55 +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=1756119177; cv=none; b=foFKFXKR3wmuUO3ADmMTMwFrOVPPoXjurVCDISiz3ZIocnzfGZaXLD+XCzSXQTemoniiS3J6Mgm3FqG6fIpe+sIAQZCIevJDmFLWa+hsZr8FRyUT4Kxwbd3YTCC0pmND2zwfkoRz4jNJn5YOyzxWd4Bp3upnGx712zVpty/VZEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756119177; c=relaxed/simple; bh=ppEOVBjtii7HdVVYjIzkJHuJSJViqIcKx9C7+sf9HUA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TTURpZMrSIC0cYg3xqOblRG5zBwOygsEuA453bvDXpcvl9MhoctoQseY/Y3RsyCQPN3uhf6FajrXN1vLjSaWuTqE0g0cyK0le8NuftMOI9seiLotBzEzgOFQpDbv7OPj5taZo1DYyLMoLS7GiFecuevwqy92wbH2mns+VSz4+dQ= 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=efWgevYW; 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="efWgevYW" 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 57P9kb6H007933; Mon, 25 Aug 2025 06:52:42 -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=t6V/n cizTRkWgJ4SEQ8wwi4NP2i9xdX2CHvig99ucY0=; b=efWgevYWJLy2EVAAcya2G vEhBuRiGqdOk+mW4KU8iGd95lEeBAGkJXuxJWNNwv/Jn/kkdXSocBmzdwlOCBbmP 5bAJtZ8NmcTrnYu034ZmybX1R79WTy7u8n0IUbwv4larhH5olSJp0HftTyNntokC /AxmIDR9A7szhvkZPoho9B67AwbzlU6QbTevn4nlUcWK6PN9HlCQ/xpDBfOO5OXy J6R8nJyi1dni6V0mWD2H+3saaVKcaq6BLMiBW+p0F+VlhL9DXqDTuJqMVf1ldAmK gxCsBnYZB2bqRCA8e4aWS0sOO0trVpr2g+olQzeqfyFka80tzY9bnoYOUc3ToPPF A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 48q7g40rec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Aug 2025 06:52:41 -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 57PAqeif006407 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Aug 2025 06:52:40 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) 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.1748.10; Mon, 25 Aug 2025 06:52:40 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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.1748.10; Mon, 25 Aug 2025 06:52:40 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 25 Aug 2025 06:52:40 -0400 Received: from IRISTEIU-L01.ad.analog.com ([10.65.213.1]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 57PAq60A026383; Mon, 25 Aug 2025 06:52:33 -0400 From: Ioana Risteiu To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "David Lechner" , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ramona Nechita , , , CC: Ioana Risteiu Subject: [PATCH v5 3/4] iio: adc: extract setup function without backend Date: Mon, 25 Aug 2025 13:51:18 +0300 Message-ID: <20250825105121.19848-4-Ioana.Risteiu@analog.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250825105121.19848-1-Ioana.Risteiu@analog.com> References: <20250825105121.19848-1-Ioana.Risteiu@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: QGtxKTbi9cPx-vIoJFjHdTDDnqN5_SkK X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIzMDA1MSBTYWx0ZWRfXz+oISvKgG2T3 K5JUqFRLwsElE1B/s+SJd3JOJwVqz0SKAmiPhwuIb09RjyIdxuLILK9fTddycI1KdYUpOsSwN9I WDzglm2MIRwgistMNXyo65XCKyGHlNA3+sKHyhJjEzz1ECIR0yYy6Xd46nRLHGQYWnfRA1oQkjV 1GHJJUrO73m8SrX3W6T0kKg5If9yFJ/SSB+lJZIRnYKQCAc1jYlAZZW9Z8CMdyn6UcugvciZlhd ocg4F2eoPLYNAqZXNXy6QjEtL7tes8nZ/u6tjnmGBWGiXKibMcn7mrg8ru05KBXFCa/y2tdy2A9 pHgRDT3oOYjiaHYJdIMxC+7iX5YoxpRUsPztK8y2Ld0HdGcHcYRTEvgX8gTNYHOsP9yqUGOnzsa iQnnvBJQ X-Proofpoint-GUID: QGtxKTbi9cPx-vIoJFjHdTDDnqN5_SkK X-Authority-Analysis: v=2.4 cv=PNQP+eqC c=1 sm=1 tr=0 ts=68ac4079 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=2OwXVqhp2XgA:10 a=gAnH3GRIAAAA:8 a=e6B03PNIoHuVPIBsO9AA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-25_05,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 clxscore=1015 malwarescore=0 impostorscore=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508230051 Content-Type: text/plain; charset="utf-8" Refactor probe function by moving the initialization specific to communication without iio-backend into a separate setup function. The purpose of this modification is better code organization. No functional changes intended. Signed-off-by: Ioana Risteiu Reviewed-by: Andy Shevchenko --- changes in v5: - fix indentation - remove blank line drivers/iio/adc/ad7779.c | 84 +++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/drivers/iio/adc/ad7779.c b/drivers/iio/adc/ad7779.c index 845adc510239..b4e56983201c 100644 --- a/drivers/iio/adc/ad7779.c +++ b/drivers/iio/adc/ad7779.c @@ -752,6 +752,50 @@ static int ad7779_conf(struct ad7779_state *st, struct= gpio_desc *start_gpio) return 0; } =20 +static int ad7779_setup_without_backend(struct ad7779_state *st, struct ii= o_dev *indio_dev) +{ + int ret; + struct device *dev =3D &st->spi->dev; + + indio_dev->info =3D &ad7779_info; + indio_dev->channels =3D st->chip_info->channels; + + st->trig =3D devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name, + iio_device_id(indio_dev)); + if (!st->trig) + return -ENOMEM; + + st->trig->ops =3D &ad7779_trigger_ops; + + iio_trigger_set_drvdata(st->trig, st); + + ret =3D devm_request_irq(dev, st->spi->irq, iio_trigger_generic_data_rdy_= poll, + IRQF_ONESHOT | IRQF_NO_AUTOEN, indio_dev->name, + st->trig); + if (ret) + return dev_err_probe(dev, ret, "request IRQ %d failed\n", + st->spi->irq); + + ret =3D devm_iio_trigger_register(dev, st->trig); + if (ret) + return ret; + + indio_dev->trig =3D iio_trigger_get(st->trig); + + init_completion(&st->completion); + + ret =3D devm_iio_triggered_buffer_setup(dev, indio_dev, + &iio_pollfunc_store_time, + &ad7779_trigger_handler, + &ad7779_buffer_setup_ops); + if (ret) + return ret; + + return ad7779_spi_write_mask(st, AD7779_REG_DOUT_FORMAT, + AD7779_DCLK_CLK_DIV_MSK, + FIELD_PREP(AD7779_DCLK_CLK_DIV_MSK, 7)); +} + static int ad7779_probe(struct spi_device *spi) { struct iio_dev *indio_dev; @@ -760,9 +804,6 @@ static int ad7779_probe(struct spi_device *spi) struct device *dev =3D &spi->dev; int ret =3D -EINVAL; =20 - if (!spi->irq) - return dev_err_probe(dev, ret, "DRDY irq not present\n"); - indio_dev =3D devm_iio_device_alloc(dev, sizeof(*st)); if (!indio_dev) return -ENOMEM; @@ -804,45 +845,10 @@ static int ad7779_probe(struct spi_device *spi) return ret; =20 indio_dev->name =3D st->chip_info->name; - indio_dev->info =3D &ad7779_info; indio_dev->modes =3D INDIO_DIRECT_MODE; - indio_dev->channels =3D st->chip_info->channels; indio_dev->num_channels =3D ARRAY_SIZE(ad7779_channels); =20 - st->trig =3D devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name, - iio_device_id(indio_dev)); - if (!st->trig) - return -ENOMEM; - - st->trig->ops =3D &ad7779_trigger_ops; - - iio_trigger_set_drvdata(st->trig, st); - - ret =3D devm_request_irq(dev, spi->irq, iio_trigger_generic_data_rdy_poll, - IRQF_ONESHOT | IRQF_NO_AUTOEN, indio_dev->name, - st->trig); - if (ret) - return dev_err_probe(dev, ret, "request IRQ %d failed\n", - st->spi->irq); - - ret =3D devm_iio_trigger_register(dev, st->trig); - if (ret) - return ret; - - indio_dev->trig =3D iio_trigger_get(st->trig); - - init_completion(&st->completion); - - ret =3D devm_iio_triggered_buffer_setup(dev, indio_dev, - &iio_pollfunc_store_time, - &ad7779_trigger_handler, - &ad7779_buffer_setup_ops); - if (ret) - return ret; - - ret =3D ad7779_spi_write_mask(st, AD7779_REG_DOUT_FORMAT, - AD7779_DCLK_CLK_DIV_MSK, - FIELD_PREP(AD7779_DCLK_CLK_DIV_MSK, 7)); + ret =3D ad7779_setup_without_backend(st, indio_dev); if (ret) return ret; =20 --=20 2.47.2 From nobody Fri Oct 3 20:55:18 2025 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 894A92DCF64; Mon, 25 Aug 2025 10:53:01 +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=1756119183; cv=none; b=OEoljmCvi7sOnNbxvhS/ChUgg6SToq6mxax/0aZr7fcIwBFPXHajzR7rg9tynSdMuD77UrCYtuvoeXlJmg9/CAaUkrXC9H884JDbJWG7W+BjwS3QLmgrySjfpxs3PWLlyMfNNdjAVLLERPHkDLFKJ0xFbLqrexPuKFQALmYhTTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756119183; c=relaxed/simple; bh=wdZYUMne+Lmr0HjcxpIYc7EqPbXB+XMoJW+5h2pW0F8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RMneXJnzttBW2gQvEJy9Aw8AERXejvXsjrle5p5wKr+NZu/9RXJJFRcDF4OImZeRAehCnlUs13kl2qP9N8UJpnVkw35TyctKqPtL7So24IRyBznwxbgZEiBR4YkEaOdwtDdUS2+SfczP/9p/6UljqMqDOKg3v9+PHgkSXv5+9RM= 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=RsCv72ze; 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="RsCv72ze" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57P8PZs9017762; Mon, 25 Aug 2025 06:52:47 -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=pxIR4 7s3gDl8iPSUtYmYSVY9J+7YMVUQgVKh9fvUCsQ=; b=RsCv72ze+4T2SAa2RIJkt 9D9lV4n1Ol5WAYuhVWmC53jXHsYI4pOGIxHfwBADEzR+7rsRkRAeZX//JkMb1Pei KeMHUvxgGVr7vSDiz5IfXTbCjaOrkTwfyyl3XwyuAaiM08l9I+UKVeoH9cHyLI1g 7v0g1r9GsXxkuMSjib+CBv91x63isWVoFVsT8ZIrF461xKg/MWMcsf8kpuGRzKu0 vZlhanZ14vp9BTPYm/ryJ8VzEGXMSjef3NEEm/po1syoRFS+BBZ8L9owzwe61fnP wHRZ1J4TpdDCslAFAM7T+41qdxfID5+f1cl7A9oHxk6uZctd+09PMxft+heyZEOP Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 48rmafgj9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Aug 2025 06:52:46 -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 57PAqjcF006419 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Aug 2025 06:52:45 -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.1748.10; Mon, 25 Aug 2025 06:52:45 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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.1748.10; Mon, 25 Aug 2025 06:52:45 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 25 Aug 2025 06:52:45 -0400 Received: from IRISTEIU-L01.ad.analog.com ([10.65.213.1]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 57PAq60B026383; Mon, 25 Aug 2025 06:52:37 -0400 From: Ioana Risteiu To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "David Lechner" , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ramona Nechita , , , CC: Ioana Risteiu Subject: [PATCH v5 4/4] iio: adc: update ad7779 to use IIO backend Date: Mon, 25 Aug 2025 13:51:19 +0300 Message-ID: <20250825105121.19848-5-Ioana.Risteiu@analog.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250825105121.19848-1-Ioana.Risteiu@analog.com> References: <20250825105121.19848-1-Ioana.Risteiu@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODI1MDA3NSBTYWx0ZWRfX1UULtcJjLjvm 7SJjunQf8QKBVexsrrVFQ54v9MfbUzSbHeI+X24i7tj27T0DkIzf+mrJoDZp79lV4jQ5sRPTdcB ko1mZ8xYp5FRzweRk5u8CyAOwf2SmFVsduPpdMwnD4SKh7kowQO43coOx19NavSjGobGAeQwV22 uImhcUaGlAtHs585Qo5qKFqXkJyrTJ1BMQ+Uqu3EKi/q7eYfr9/2y/H8paEiQoXEppsS5syf8Yl 3gGP1A5QWlXDgLzEHywHgv9+JZI6QPgggg92HX1KFPFsLmbN/3ubV+wB9f24YEDWJgNj5qEjtWn MZ8YXpI1e7aPNkCbLkVa2bI5nbMG2+NoaS05CrlCKOogT663TamSKBTgvRpGIjBh7p0e79m7Ajn Aplr/8yV X-Proofpoint-ORIG-GUID: k7_6OvaCPGVdfNNqJ24mrhrJWZtPrzx0 X-Proofpoint-GUID: k7_6OvaCPGVdfNNqJ24mrhrJWZtPrzx0 X-Authority-Analysis: v=2.4 cv=AoXu3P9P c=1 sm=1 tr=0 ts=68ac407f cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=2OwXVqhp2XgA:10 a=gAnH3GRIAAAA:8 a=VjRcvFoKhyOr0kwuT1sA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-25_05,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508250075 Content-Type: text/plain; charset="utf-8" Add a new functionality to ad7779 driver that streams data through data output interface using IIO backend interface. Signed-off-by: Ioana Risteiu Reviewed-by: Andy Shevchenko --- changes in v5: - fix indentation=20 - change num_lanes variable from int to u32 type - use unsigned int in for loop declaration drivers/iio/adc/ad7779.c | 115 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7779.c b/drivers/iio/adc/ad7779.c index b4e56983201c..3776af1c65e9 100644 --- a/drivers/iio/adc/ad7779.c +++ b/drivers/iio/adc/ad7779.c @@ -25,6 +25,7 @@ #include =20 #include +#include #include #include #include @@ -116,6 +117,12 @@ #define AD7779_CRC8_POLY 0x07 DECLARE_CRC8_TABLE(ad7779_crc8_table); =20 +enum ad7779_data_lines { + AD7779_1LINE =3D 1, + AD7779_2LINES =3D 2, + AD7779_4LINES =3D 4, +}; + enum ad7779_filter { AD7779_SINC3, AD7779_SINC5, @@ -145,6 +152,7 @@ struct ad7779_state { struct completion completion; unsigned int sampling_freq; enum ad7779_filter filter_enabled; + struct iio_backend *back; /* * DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. @@ -630,12 +638,38 @@ static int ad7779_reset(struct iio_dev *indio_dev, st= ruct gpio_desc *reset_gpio) return ret; } =20 +static int ad7779_update_scan_mode(struct iio_dev *indio_dev, + const unsigned long *scan_mask) +{ + struct ad7779_state *st =3D iio_priv(indio_dev); + unsigned int c; + int ret; + + for (c =3D 0; c < AD7779_NUM_CHANNELS; c++) { + if (test_bit(c, scan_mask)) + ret =3D iio_backend_chan_enable(st->back, c); + else + ret =3D iio_backend_chan_disable(st->back, c); + if (ret) + return ret; + } + + return 0; +} + static const struct iio_info ad7779_info =3D { .read_raw =3D ad7779_read_raw, .write_raw =3D ad7779_write_raw, .debugfs_reg_access =3D &ad7779_reg_access, }; =20 +static const struct iio_info ad7779_info_data =3D { + .read_raw =3D ad7779_read_raw, + .write_raw =3D ad7779_write_raw, + .debugfs_reg_access =3D &ad7779_reg_access, + .update_scan_mode =3D &ad7779_update_scan_mode, +}; + static const struct iio_enum ad7779_filter_enum =3D { .items =3D ad7779_filter_type, .num_items =3D ARRAY_SIZE(ad7779_filter_type), @@ -752,6 +786,48 @@ static int ad7779_conf(struct ad7779_state *st, struct= gpio_desc *start_gpio) return 0; } =20 +static int ad7779_set_data_lines(struct iio_dev *indio_dev, u32 num_lanes) +{ + struct ad7779_state *st =3D iio_priv(indio_dev); + int ret; + + if (num_lanes !=3D AD7779_1LINE && + num_lanes !=3D AD7779_2LINES && + num_lanes !=3D AD7779_4LINES) + return -EINVAL; + + ret =3D ad7779_set_sampling_frequency(st, num_lanes * AD7779_DEFAULT_SAMP= LING_1LINE); + if (ret) + return ret; + + ret =3D iio_backend_num_lanes_set(st->back, num_lanes); + if (ret) + return ret; + + return ad7779_spi_write_mask(st, AD7779_REG_DOUT_FORMAT, + AD7779_DOUT_FORMAT_MSK, + FIELD_PREP(AD7779_DOUT_FORMAT_MSK, 2 - ilog2(num_lanes))); +} + +static int ad7779_setup_channels(struct iio_dev *indio_dev, const struct a= d7779_state *st) +{ + struct iio_chan_spec *channels; + struct device *dev =3D &st->spi->dev; + + channels =3D devm_kmemdup_array(dev, st->chip_info->channels, + ARRAY_SIZE(ad7779_channels), + sizeof(*channels), GFP_KERNEL); + if (!channels) + return -ENOMEM; + + for (unsigned int i =3D 0; i < ARRAY_SIZE(ad7779_channels); i++) + channels[i].scan_type.endianness =3D IIO_CPU; + + indio_dev->channels =3D channels; + + return 0; +} + static int ad7779_setup_without_backend(struct ad7779_state *st, struct ii= o_dev *indio_dev) { int ret; @@ -796,6 +872,39 @@ static int ad7779_setup_without_backend(struct ad7779_= state *st, struct iio_dev FIELD_PREP(AD7779_DCLK_CLK_DIV_MSK, 7)); } =20 +static int ad7779_setup_backend(struct ad7779_state *st, struct iio_dev *i= ndio_dev) +{ + struct device *dev =3D &st->spi->dev; + int ret; + u32 num_lanes; + + indio_dev->info =3D &ad7779_info_data; + + ret =3D ad7779_setup_channels(indio_dev, st); + if (ret) + return ret; + + st->back =3D 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 =3D devm_iio_backend_request_buffer(dev, st->back, indio_dev); + if (ret) + return ret; + + ret =3D devm_iio_backend_enable(dev, st->back); + if (ret) + return ret; + + num_lanes =3D 4; + ret =3D device_property_read_u32(dev, "adi,num-lanes", &num_lanes); + if (ret && ret !=3D -EINVAL) + return ret; + + return ad7779_set_data_lines(indio_dev, num_lanes); +} + static int ad7779_probe(struct spi_device *spi) { struct iio_dev *indio_dev; @@ -848,7 +957,10 @@ static int ad7779_probe(struct spi_device *spi) indio_dev->modes =3D INDIO_DIRECT_MODE; indio_dev->num_channels =3D ARRAY_SIZE(ad7779_channels); =20 - ret =3D ad7779_setup_without_backend(st, indio_dev); + if (device_property_present(dev, "io-backends")) + ret =3D ad7779_setup_backend(st, indio_dev); + else + ret =3D ad7779_setup_without_backend(st, indio_dev); if (ret) return ret; =20 @@ -942,3 +1054,4 @@ module_spi_driver(ad7779_driver); MODULE_AUTHOR("Ramona Alexandra Nechita "); MODULE_DESCRIPTION("Analog Devices AD7779 ADC"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("IIO_BACKEND"); --=20 2.47.2