From nobody Mon Feb 9 07:43:38 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB146230D1E for ; Fri, 21 Mar 2025 20:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589009; cv=none; b=K/EDnyU+EavVwdoR/rgSEqJ6sfKASUrWJozV/KUrPQ8M1wYk5FSvV/hfLm1NL/rkHqU+y0V/zg24KScCrVX0T+LvMu2gbeq/tSsZmkI6WMeGFYJ1yRczhig8d2jgELm4YfP6mNBDshMIZSwceQTdkFOfzxGArwYOvGz8PPi9wOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589009; c=relaxed/simple; bh=YC4T+Fxmel7++n7zPsX37ONlH8IUA0Cd+K60/qZjzk0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QFEIsEitmpaglcGrmoHiXU10Q7enCxOa3N3VMga1g+jIc1KNe579Hb72eiHOHb9Az/4On+s4OOQp470d3gloOfcYjX1bX1CXFdCEiY5rIpnVG2piJRnox6u7X6H+3VQvw/l1gGeYNQ569+FN9E694RHQzbZPSBNZNBAWG0VelHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=xT2SzOz3; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="xT2SzOz3" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43d0782d787so16961415e9.0 for ; Fri, 21 Mar 2025 13:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1742589006; x=1743193806; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BrUIumItvCNnNNN+MtX5Y60lKBBj+tPu5adwP5ucCjc=; b=xT2SzOz3ASgDiQxSQJyEkSvMwLMhEo8w2kkCGnuIGjIM953gzRPXzPj1WP+Vx5XVjR lVqWWS25WjYcLj/ZKIPmhylxuUR0hMYqWgVQz5c21CpwMFk3dtUn3rWfrvjem7ZjjjqF /7LQfKQdAmKYjEa/8Wzi7uw5UROip3TPoVA3YIZ2FDxl6cx0kzOOIXEpIe4h0rm/eA4B grquOP5ScFV8a+kE03m7RmGW6cAqjb8GiAPiJy7RTBIO2punm1f4mJ6O26z5GwuzQ1/h Oo0KbexlDegvMXNzkrl7tpmARCC/yrOOWF4zJlfpCievuSK0SM5oZvVZUhWxOUah0KLQ 7J2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742589006; x=1743193806; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BrUIumItvCNnNNN+MtX5Y60lKBBj+tPu5adwP5ucCjc=; b=lcMExFsbKm4w61MUYld5NwJ1DZXpjVRC8GM4Vc0Blo2GNHB8RFMcw314yCh8Nt086a 7APpyXeyKlXEumi22sSCuvHDdbYetHbyC8klyw1mcR0RZvqxmO7ei16VTSXrUAWH3sGW JRF/jrpBI67FrIaWBUZTnzQ4LXHkbipf2Wh46oWlZ54Ozn11sXVv0BbjvsSpXB3/L2E7 36O5EH8haFAbzDL+OlvIHrFA6tQ2mmMsXa00rJaYvIIo8/4Svx0TJ7y8G2gWFBz97QTH kcOymg8LpnDsjGAC9PyO4fKubRMMfvOnceESfriXn+xHPQcIm99datC2SFDTA7odD7SZ RSBA== X-Forwarded-Encrypted: i=1; AJvYcCX5YaOYKNkM9465zGpp7vDheLGcDJY03KyXw/s/Zam0dt2FAuwkbJqm7fBb7PQtThHsKLD7dlQmVczMWIQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwDWc4Py29QH+ImvW2znpYi2UMTitu/3firKea/wZUdNQLFuYXF aoHJtrifSzYHB04A1br7P33lN53qkFnVMTi4kMwcBqOjYARj1f3jL+srWPqcamc= X-Gm-Gg: ASbGncvT7oEMV7J3gPO6bsVxDeiK7WCsg7Xwx0z9LZjme7BJtjQ/rmQd0eN6Hh0xTZA 1s0iQ0IUDK0tKx7wMxUfl3I60YJXdmU2ShQzom4tGhc+DRDATJ7YUyA2E2XynWTlr9KFeErgF09 mJHrow6fqXvXUe+QXQRPFo8GE+S2VTxwxpHV8qkMiSv9Srno9TRVkd/Lqi+MtwN0tD13hvy1wWQ yfkIVjiZFuwRjLV+/VgKzGNYhZQZhGvu1qb8LiGkp9njRdDZbQ4ngy/+oPrwI6CalnTCo7McCCl FOzYYrNJTK7dcw54APSyNA69JYdLlG8K/a7XdiNu+14aSuBvBuFPN6ALcVldXJtnU1eTDoqMDPN L5ZA8la9WgOmuzg== X-Google-Smtp-Source: AGHT+IF0enc0SoBKgZE9ptV5JlSLStbIP21CY/7llnPzyfEnIzCO5p0eB6iQvZVUBHy0w0u/ovLT0A== X-Received: by 2002:a05:600c:4e87:b0:43c:fe15:41c9 with SMTP id 5b1f17b1804b1-43d509ec508mr40324515e9.9.1742589005643; Fri, 21 Mar 2025 13:30:05 -0700 (PDT) Received: from [127.0.1.1] (host-87-8-62-49.retail.telecomitalia.it. [87.8.62.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9955c0sm3258380f8f.3.2025.03.21.13.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 13:30:05 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 21 Mar 2025 21:28:48 +0100 Subject: [PATCH 1/4] docs: iio: add documentation for ad3552r driver 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: quoted-printable Message-Id: <20250321-wip-bl-ad3552r-fixes-v1-1-3c1aa249d163@baylibre.com> References: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> In-Reply-To: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> To: =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Lars-Peter Clausen , Jonathan Corbet , Olivier Moysan , Michael Hennerich Cc: linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.2 From: Angelo Dureghello Add documentation for ad3552r driver, needed to describe the high-speed driver debugfs attributes and shows how the user may use them. Signed-off-by: Angelo Dureghello --- Documentation/iio/ad3552r.rst | 65 +++++++++++++++++++++++++++++++++++++++= ++++ Documentation/iio/index.rst | 1 + MAINTAINERS | 1 + 3 files changed, 67 insertions(+) diff --git a/Documentation/iio/ad3552r.rst b/Documentation/iio/ad3552r.rst new file mode 100644 index 0000000000000000000000000000000000000000..638a62c99fb876cca026a0b1df4= 69c81ba39ff29 --- /dev/null +++ b/Documentation/iio/ad3552r.rst @@ -0,0 +1,65 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +AD3552R driver +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Device driver for Analog Devices Inc. AD35XXR series of DACs. The module n= ame +is ``ad3552r``. +With the same module name, two different driver variants are available, the +``generic spi`` variant, to be used with any classic SPI controllers, and = the +``hs`` (high speed) variant, for an ADI ``axi-dac`` (IP core) based contro= ller +that allows to reach the maximum sample rate supported from the DACs, usin= g the +DMA transfer and all the SPI lines available (D/QDSPI).. +The high speed driver variant is intended to be used with the ``adi-axi-da= c`` +backend support enabled, that is enabled by default when the driver is sel= ected. + +Supported devices +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +* `AD3541R `_ +* `AD3542R `_ +* `AD3551R `_ +* `AD3552R `_ + +Wiring connections +------------------ + +:: + + .-----------------. .-------. + | |--- D/QSPI -----| | + | DAC IP CORE |--- SPI S_CLK --| DAC | + | |--- SPI CS -----| | + | |--- LDAC -------| | + | |--- RESET ------| | + |_________________| |_______| + + +High speed features +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Device attributes +----------------- + +The following table shows the ad35xxr related device debug files, found in= the +specific device debug folder path ``/sys/kernel/debug/iio/iio:deviceX``. + ++----------------------+--------------------------------------------------= -----+ +| Debugfs device files | Description = | ++----------------------+--------------------------------------------------= -----+ +| data_source | The used data source, = | +| | as ``iio-buffer`` or ``backend-ramp-generator``. = | ++----------------------+--------------------------------------------------= -----+ + +Usage examples +-------------- + +. code-block:: bash + root:/sys/bus/iio/devices/iio:device0# cat data_source + iio-buffer + root:/sys/bus/iio/devices/iio:device0# echo -n backend-ramp-generator > d= ata_source + root:/sys/bus/iio/devices/iio:device0# cat data_source=E2=8F=8E + backend-ramp-generator + + diff --git a/Documentation/iio/index.rst b/Documentation/iio/index.rst index bbb2edce8272e7483acca500d1a757bbcc11c1e0..2d6afc5a8ed54a90cd8d5723f0d= c5212b8593d16 100644 --- a/Documentation/iio/index.rst +++ b/Documentation/iio/index.rst @@ -19,6 +19,7 @@ Industrial I/O Kernel Drivers .. toctree:: :maxdepth: 1 =20 + ad3552r ad4000 ad4030 ad4695 diff --git a/MAINTAINERS b/MAINTAINERS index 57eaab00f6cb53df52a4799eb2c1afbbd1e77a1e..52bc56a9ee22c66b90555681c47= 57ea4399adae1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1295,6 +1295,7 @@ L: linux-iio@vger.kernel.org S: Supported W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml +F: Documentation/iio/ad3552r.rst F: drivers/iio/dac/ad3552r.c =20 ANALOG DEVICES INC AD4000 DRIVER --=20 2.49.0 From nobody Mon Feb 9 07:43:38 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 109B3230D3A for ; Fri, 21 Mar 2025 20:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589011; cv=none; b=KoRuVxpMy2mnuyuJ90su8eXpnamo3S6CTtbV/JHVeXM4Ya/NsDCMA/1vkgYs3PNj94REptxHSGV6CfI8NAPw3+x+Mv66YBNdweXPL5Rye7Rrpl2Lq/oxlFEyIYmwwW/F8Myzrua5Q6eYgrYg+CFiQxAUIzYck8Go6/j1gUjx/uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589011; c=relaxed/simple; bh=hWSr+N4q8jPBwyhE+M9punDDVddf1n2Qdd8iVHO9YtM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MSoFRV2OGP1XJvCCssVe+/PFFZrkxtarbnhlWgX+RC9ArWsuu3z7V6SWskhGH3LWLMENT86t+Kwxu5rLtKyjM1n1L7tLLXQI/pDZ8ukFelJvutgHe+xZRpQZpze2x4gGZGc1ZGUi5UGFO7cWQcYZHbMxCvyrqo4t3+fAzs/zVTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=qxw+Q4b7; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="qxw+Q4b7" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3912d2c89ecso2181173f8f.2 for ; Fri, 21 Mar 2025 13:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1742589007; x=1743193807; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Hl8ec5RDehNYBKLIScFWmbMlzzx1NzVQIVCz8eQlZvo=; b=qxw+Q4b7IJ7P8+PLD0Elrll/p4/sRkpufAO5EvF5cHRpsrkMcumqf8ykd+wZdVbSL2 +yXg5SyBkfZRrruYKZi1WY/JaUhAiVhunRr8ARDTzNPSG8JETEeUbgXyJh+rYUaVcPZP iPWjjiOi8OiWzTysG6G909G3d1i/SdSjbpjhhvGUqUGkbOlfWxwsTzSYUYWgQuIyunrq 5paWU3l/3QfD7jNljDn+GgDH8m3n6RGnKF1L5iBe1cIrnuk3+zQfQNxfhiP5u+to2lzX c0OtDMnMbZDhGG7MlvYqD3aWPuxkJmFkFJYjIwiB83Bj16DJ/8W8NN/wi66Vq/HzuKX6 HBrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742589007; x=1743193807; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hl8ec5RDehNYBKLIScFWmbMlzzx1NzVQIVCz8eQlZvo=; b=Nd21Qb/XSQHgzpMkyqrkrkOwUwQltBW/vFXe2kkYfZJcaQXXDa3AvQF+F6DICJHKF7 0w9qhYtkWFFVKJtNy2hWJ0l9czYxnEHpR1yT3gU9ml0WEAb1CktfethkaszEa2MNFQlR jfuF0DBQ33w80viIwNmdz68SDvmJFzNAd8ZtFlUaRFSWG93qu8yfVjdNI1Se/IF2XX2p twsuH+Ehmidi84GPk/t28SUvUu37nL7DGaUAnsPUVjGtIJkq7U74IbnohBw9vQpssxWG WJB5SltWGsKejHL/Kgf9jGDorDF/um5IsmDk4/FBK9KiYcYjjuaVI+GAymct4/qcGrhK 27Hg== X-Forwarded-Encrypted: i=1; AJvYcCXrtYNZjv/sCeKLlWGw+UF7IUJ1mxXE1yfd6EMJLfrMBr4b1jrInWtYw6WH5dnAKdOywTDRhbRlsnazhS0=@vger.kernel.org X-Gm-Message-State: AOJu0Yzpry1m3rzzY1QgJ3H0MEkifNjKB37QLgmslMwQiHxRHFabjIfZ j3NaRWFo3/h8zZab0FK1H7hAHrdODUP3goHNC35zd5w1H/N+G4UIrQh45Fzapbs= X-Gm-Gg: ASbGncvDuNudv7/4I1/XAomMMGopVBzyJXaWQTACyWSEFqW8xSIWoT6A6wF0BD9EuQo vwBrLdmlnhWzH4Y022O6AUI3N6j/WyuqYXUrfFT2mLm07l8SHXs13Lb2bfULh35N/htwUzqR/bQ uFuIJ4WbVMsMYj2Ouyyl0huUs3RPIPpxMFdWbyNDUHH7xfcYa1ifwTgnkRMAmQPCQr6wZEXfUqm QmoxyVeRzo0hBjXiDgjgt5dBDIQnk2d4M49BiSF+oA6EBwmUUYwX4YHK1ojHxg3nZCbdmOsbtE3 /zN7wX/1p38ymqlx8dn+kXQu5n9LQJJPXl/NrVaRL/axwpWn9bdPIT/QTbbAkz0/uhMo+gyCtKV jxOs3WqYJXOQZ8g== X-Google-Smtp-Source: AGHT+IHCTLucmhuzq/4rYnKJArEU8s60wFNIODgk7NLbKNSu1KiGUCksZNi/AgFQk55m9xo5mz+pag== X-Received: by 2002:a05:6000:400e:b0:391:3f94:dc9e with SMTP id ffacd0b85a97d-3997f90394emr5540891f8f.16.1742589007075; Fri, 21 Mar 2025 13:30:07 -0700 (PDT) Received: from [127.0.1.1] (host-87-8-62-49.retail.telecomitalia.it. [87.8.62.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9955c0sm3258380f8f.3.2025.03.21.13.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 13:30:06 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 21 Mar 2025 21:28:49 +0100 Subject: [PATCH 2/4] iio: backend: add support for data source get 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: quoted-printable Message-Id: <20250321-wip-bl-ad3552r-fixes-v1-2-3c1aa249d163@baylibre.com> References: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> In-Reply-To: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> To: =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Lars-Peter Clausen , Jonathan Corbet , Olivier Moysan , Michael Hennerich Cc: linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.2 From: Angelo Dureghello Add backend support for getting the data source used. The ad3552r HDL implements an internal ramp generator, so adding the getter to allow data source get/set by debugfs. Signed-off-by: Angelo Dureghello --- drivers/iio/industrialio-backend.c | 28 ++++++++++++++++++++++++++++ include/linux/iio/backend.h | 5 +++++ 2 files changed, 33 insertions(+) diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-= backend.c index a43c8d1bb3d0f4dda4277cac94b0ea9232c071e4..c1eb9ef9db08aec8437d0d00cf7= 7914ad6611b72 100644 --- a/drivers/iio/industrialio-backend.c +++ b/drivers/iio/industrialio-backend.c @@ -380,6 +380,34 @@ int iio_backend_data_source_set(struct iio_backend *ba= ck, unsigned int chan, } EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_set, "IIO_BACKEND"); =20 +/** + * iio_backend_data_source_get - Get current data source + * @back: Backend device + * @chan: Channel number + * @data: Pointer to receive the current source value + * + * A given backend may have different sources to stream/sync data. This al= lows + * to know what source is in use. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int iio_backend_data_source_get(struct iio_backend *back, unsigned int cha= n, + enum iio_backend_data_source *data) +{ + int ret; + + ret =3D iio_backend_op_call(back, data_source_get, chan, data); + if (ret) + return ret; + + if (*data >=3D IIO_BACKEND_DATA_SOURCE_MAX) + return -EINVAL; + + return 0; +} +EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_get, "IIO_BACKEND"); + /** * iio_backend_set_sampling_freq - Set channel sampling rate * @back: Backend device diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h index e45b7dfbec35c094942a3034fc6057a7960b9772..e59d909cb65924b4872cadd4b7e= 5e894c13c189f 100644 --- a/include/linux/iio/backend.h +++ b/include/linux/iio/backend.h @@ -84,6 +84,7 @@ enum iio_backend_interface_type { * @chan_disable: Disable one channel. * @data_format_set: Configure the data format for a specific channel. * @data_source_set: Configure the data source for a specific channel. + * @data_source_get: Data source getter for a specific channel. * @set_sample_rate: Configure the sampling rate for a specific channel. * @test_pattern_set: Configure a test pattern. * @chan_status: Get the channel status. @@ -115,6 +116,8 @@ struct iio_backend_ops { const struct iio_backend_data_fmt *data); int (*data_source_set)(struct iio_backend *back, unsigned int chan, enum iio_backend_data_source data); + int (*data_source_get)(struct iio_backend *back, unsigned int chan, + enum iio_backend_data_source *data); int (*set_sample_rate)(struct iio_backend *back, unsigned int chan, u64 sample_rate_hz); int (*test_pattern_set)(struct iio_backend *back, @@ -176,6 +179,8 @@ int iio_backend_data_format_set(struct iio_backend *bac= k, unsigned int chan, const struct iio_backend_data_fmt *data); int iio_backend_data_source_set(struct iio_backend *back, unsigned int cha= n, enum iio_backend_data_source data); +int iio_backend_data_source_get(struct iio_backend *back, unsigned int cha= n, + enum iio_backend_data_source *data); int iio_backend_set_sampling_freq(struct iio_backend *back, unsigned int c= han, u64 sample_rate_hz); int iio_backend_test_pattern_set(struct iio_backend *back, --=20 2.49.0 From nobody Mon Feb 9 07:43:38 2026 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79EE7231CA5 for ; Fri, 21 Mar 2025 20:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589012; cv=none; b=AXrz6I069MpOtGg8lGXBGh9QKNWX/tIFLDqJTqEw2EJIgRGwlQbFZzvSKMnKR1bqgGg+4qdAmYnibrZIpCj23syGwdsnHaj1AaP4+QyRCe0dYv9AQIyYYbxDzqyup1qfYwYkUQl4bYYl4lK/rXCcAw3KNuupF9RwktZFAIJvu6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589012; c=relaxed/simple; bh=v4x4imsy5YbeHXwQ1xMUyqRuJG1xvnmjMKbMtujlpgM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e+m7mkSRKMwnUh1NyAiQwlYQ5qrxQlkIVzE7k7NTJxeL4rHNiC/mxOjb4DpQHkrzaHJk4y6DGOdwrBZNaFAB/P10b/pz625PfVMrgBQHDqCPH9fnZmxaKgd3S16g1PBn6I4TyDxDbaoAZW1tRJMK6pNDmkmGgbm0GsWrDVY66j0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=EmqRGcaN; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="EmqRGcaN" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3997205e43eso1975056f8f.0 for ; Fri, 21 Mar 2025 13:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1742589009; x=1743193809; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6eD3Dwg/bosoHeBveeP0hmUHF2AuEcJYQ+8dX6IEYkU=; b=EmqRGcaN09z1fnbzxCHLqoEAFqstLrW4cMfGTBzpr25pRDZheRRB+HdkctrAID+Qnz iYnceBbqlfRpvdig78rOrF1TjRnji5C70c8UX8SsRmbTL/tjsl0C2Www30K2Mi6GQ5+U a8t5hHuKpcJo0Cty3PHnB5TkfLjX3fpie2wZZWlIs/TWQ5T4/BXCX3E0FvaVwmRpGURE D3YxQNCBHdoe6sqFrY4izU0ldj0j+vMf5StXabp4ir6ZBGQlNZTFjRhoHd5GTWVOcTSh 1pVu55yI5HAfQ01eR/5Ac/8eqjr5sDjCVruO1RLigFlgiFHdCKAVyI7Ilola/PjVM8sj VUdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742589009; x=1743193809; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6eD3Dwg/bosoHeBveeP0hmUHF2AuEcJYQ+8dX6IEYkU=; b=gZ64OSfarsysb0qqcVFwZG89Onge+qr/9EQLw7sBbK4rKo+LkNhPMycY/Ca9ektFwb ARkKk7tRxwcdZekVKgInEaiKvrC/rO8PJA73K+KG8Nbjc6O5BQ5dK7JaGLiCIuQT6xuj SsBIQNOI0UDGJakr8sqhqt8KKFBcGxHR7fCD7DAa4QA4zkXoshC8SslDj2uZk+ZXLpBG GiZ5RBf7Qu2zc0PayEFcnPGBn6MSlNDMq7NYvA0/XMehKK7TFFaHqB3JUZNf7uKzTfYa E0jeNpCCz7NNLZw5OtZ6qq5BS8FMxYzvQ9OtBU3IfXkFNmm+Y57FwzAAC/72dZcYdAB6 EgSQ== X-Forwarded-Encrypted: i=1; AJvYcCVl8VSB/qZHV3eDdrVE3xVG9BBNICe1uoobkC9DN2lwCPQ6oCqQZT/2712DUcX6jz6KcpaenNF/9Yc+j+M=@vger.kernel.org X-Gm-Message-State: AOJu0YweCX3/40qTPeM1TXS7aZJmgnfrqUdt6WnNEnATly/ybGk44IqB pCQuqW09ro6ZCkI33yOzpeJuOmREqsRLjbGR/WhUu4knTadIrnT2VPezFBc2Zq8= X-Gm-Gg: ASbGncv4LcdnU32z+AW1CfAztNL4hoWUmpEmk6Es5ukeNOaUieFCE/qtpTVWZ+WvKv/ AY2aRsCHIF/TelKoXgi4Ed7thg1jQftrvPC/hiMQXjJiCys09qk8KFuweuYMIFRNMJrh8FyhNaU Y6RT86rxQiqCK0FmMFDXLpw3X6irfz4VrNaurZl6q6ejWWiZllAa376X/vbsBzBulTmhll89lFx Y0qOBswGo+DAWyx+ywPZmCDv4eJxWSxD7f4GjDXhTaYvM7NWPAKniyuGmbCZbt0l3Vh3ew5UGcL CSDDkBmYbG1cGbYEsAF06QgY4/2R2pfLqe84kmWXjRv+gWnBw6h6pdnvcvLkdabKhyfyjnbtObb wMybH8Gz4RJ1akA== X-Google-Smtp-Source: AGHT+IELd83dYCLpu4krqWNQj9A+sofZQSmerqTYYZH1bItX2o5eghXCKYp/HNm41o+hSItzK0uPeQ== X-Received: by 2002:a5d:5f92:0:b0:391:212:459a with SMTP id ffacd0b85a97d-3997f90ff74mr4849355f8f.22.1742589008556; Fri, 21 Mar 2025 13:30:08 -0700 (PDT) Received: from [127.0.1.1] (host-87-8-62-49.retail.telecomitalia.it. [87.8.62.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9955c0sm3258380f8f.3.2025.03.21.13.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 13:30:07 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 21 Mar 2025 21:28:50 +0100 Subject: [PATCH 3/4] iio: dac: adi-axi-dac: add data source get 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: quoted-printable Message-Id: <20250321-wip-bl-ad3552r-fixes-v1-3-3c1aa249d163@baylibre.com> References: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> In-Reply-To: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> To: =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Lars-Peter Clausen , Jonathan Corbet , Olivier Moysan , Michael Hennerich Cc: linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.2 From: Angelo Dureghello Add data source getter. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/adi-axi-dac.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c index 892d770aec69c4259de777058801c9ab33c79923..a6abd828ebdb34800cc08a2151e= 52a9acda9eba1 100644 --- a/drivers/iio/dac/adi-axi-dac.c +++ b/drivers/iio/dac/adi-axi-dac.c @@ -514,6 +514,32 @@ static int axi_dac_data_source_set(struct iio_backend = *back, unsigned int chan, } } =20 +static int axi_dac_data_source_get(struct iio_backend *back, unsigned int = chan, + enum iio_backend_data_source *data) +{ + struct axi_dac_state *st =3D iio_backend_get_priv(back); + int ret; + u32 val; + + ret =3D regmap_read(st->regmap, AXI_DAC_CHAN_CNTRL_7_REG(chan), &val); + if (ret) + return ret; + + switch (val) { + case AXI_DAC_DATA_INTERNAL_TONE: + *data =3D IIO_BACKEND_INTERNAL_CONTINUOUS_WAVE; + return 0; + case AXI_DAC_DATA_DMA: + *data =3D IIO_BACKEND_EXTERNAL; + return 0; + case AXI_DAC_DATA_INTERNAL_RAMP_16BIT: + *data =3D IIO_BACKEND_INTERNAL_RAMP_16BIT; + return 0; + default: + return -EINVAL; + } +} + static int axi_dac_set_sample_rate(struct iio_backend *back, unsigned int = chan, u64 sample_rate) { @@ -794,6 +820,7 @@ static const struct iio_backend_ops axi_ad3552r_ops =3D= { .request_buffer =3D axi_dac_request_buffer, .free_buffer =3D axi_dac_free_buffer, .data_source_set =3D axi_dac_data_source_set, + .data_source_get =3D axi_dac_data_source_get, .ddr_enable =3D axi_dac_ddr_enable, .ddr_disable =3D axi_dac_ddr_disable, .data_stream_enable =3D axi_dac_data_stream_enable, --=20 2.49.0 From nobody Mon Feb 9 07:43:38 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C31C8232785 for ; Fri, 21 Mar 2025 20:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589013; cv=none; b=VEPH8RjOlOJvjPunAKPqrizcsbDnTKEhVrF9WlBpG601AVQ9ch6ISjrOBXO0nZxc5U0mEXRnznN3HJCFfeoPgi+Ptz33aoTajjfNVwpje9T54kEadsFvJrwpcrAEqH9oxWfIaoSu1JZkavxftKjHF5E+AzdL6JjH15SwwXLtbek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742589013; c=relaxed/simple; bh=lzaSJ/be6is8Rty2tbrCLJKH6+jdZRvilPwu+v8J4Cs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RnUpGyt+JOHOHRRLF+NABmYl3nbvYNx+zBiZbW2TieahhbTFDQM9LwWHVnvEYDhRMf0Sy4M1C9SQEf2mregUrfrPDMZhSbhVIa7hbmD+M0zM7At8DnYNK0v8CYQSvjm+z1uMSosoiLrv55ZlzzBOzDaIVU/uXNpltbMC36TCN6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=LaHXZn6J; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="LaHXZn6J" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43cfb6e9031so22375585e9.0 for ; Fri, 21 Mar 2025 13:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1742589010; x=1743193810; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IKB6yQ/p4p5H9UdGeKJqY+C71MSKxypTKujViSujDac=; b=LaHXZn6JNPGfznqTGqNxxz0/9SWD3RNBiXmugdQJKD4Jt7+TUb/E0jb0uyzm1qpL8u dR1utsSXX05dTQ8k23aws3sXkphrbwrbYZGI9CungIA3LyhHmyIffho5rhlDCmt/Xvpl jCnuhrQ24TOyW7KfoL8ee8jaYds0Lcjdx9wPj60TlzvzaSOWooxuog6wgScKZ9QIACHM I9ogDKrrOJqrdUJQYS6TknGKU2XTFKTw5dbHR4Pp+NEN0Akh4y2UukC/8l/JURVx+nJt mvUhbxvXWPM6fCFyX+CUtGbXPdi8QcsHIrNWWSr3ofTg8o/6FmQc/+AmLhpRzhYV/pRi Poyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742589010; x=1743193810; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IKB6yQ/p4p5H9UdGeKJqY+C71MSKxypTKujViSujDac=; b=Tm43Gp3azwKSI7o98kEVUV1XI/2CH+iofLsNPwUohN7nQAUXrIk/VU0BnNJ1miQHDi W/8Xx3TnFdQ2wJQi4oUJEeOg5Q7s+kF0kwyPm2ETpDbzT2XsSWIOgkLqVzHIATd6SgTD G9tJzSE7O7n6OwRmCIrmcFM7K45yJNyShtSrfrak5dpIJVLoi65lV8WNxsivkjRuNdC0 0A20SPo6JeGoCVhmzqa8uK9Gmv4QC6mBSgg4XrJoqQMAeMlXtFKzjCSlpYm0cYcgTzTp 1ti1pQKACuFJ/AQiyg4rctApF6LCZSXJt44D5h0AEeebQzumEV0NT71YF1VKEXnIJWVx cXoQ== X-Forwarded-Encrypted: i=1; AJvYcCWMwX9WXv7JRDKkarLjXSFmLUT+yc4CqcmQtUBgsEHrXQS38dSwib06qmifigKgUT7HhfTrAua7moK3g+w=@vger.kernel.org X-Gm-Message-State: AOJu0YzIrvn0BH/WqsSsgCWbeYSHjpmG8CF/FOLiPg5Zy9EXFn48ouPi oFDEG73839iio7q0SJ9ta/Zo3q9B2ls/OigSy5cD/BRmvmYQjbfpY2AkIe6fxYA= X-Gm-Gg: ASbGncst3XT+up+77HhnLn4FX9nqJsbMotAr9z2nBDAgaUymU86NFpr2JFV/VMstvNd ap6pccoapB9JxFVsDqxNwrEyLXOe9oCAGsdHPn2oBYeuvAglcxfPQcEs5bNyvhzrplV8k2uNdMl MCoxPfzxk2sFSs4DlXqkXkPa2BuJGHIYY6FjHT85ArXFQE0L9MlLN/h6NixsJcfCM5H18L+Ohgw pDQs+FYzL/nKyCOjfOxZtNGaGxq+cwj9czko4kqCYZIXBnBCtud4rc6Lam4g47c4GxoWA6uJTI7 tlNPqa4TTbgl3ZmA86rbOOkhuvjqhxeL5xk8RP+3n/6X356z19EPvMbDN+f30rBP/sqF/ev4tQD kxpsLa5cUOW0R7Q== X-Google-Smtp-Source: AGHT+IGW0KT9uYhjfvzDuW5HrybppxMZ12fXv96hH0ZZ7RsY03Ppzqsltv2FqtvQ54zHcEEm7eOWKg== X-Received: by 2002:a5d:588b:0:b0:399:737f:4de6 with SMTP id ffacd0b85a97d-3997f8f8c35mr4323719f8f.3.1742589009965; Fri, 21 Mar 2025 13:30:09 -0700 (PDT) Received: from [127.0.1.1] (host-87-8-62-49.retail.telecomitalia.it. [87.8.62.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9955c0sm3258380f8f.3.2025.03.21.13.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 13:30:09 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 21 Mar 2025 21:28:51 +0100 Subject: [PATCH 4/4] iio: dac: ad3552r-hs: add support for internal ramp 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: quoted-printable Message-Id: <20250321-wip-bl-ad3552r-fixes-v1-4-3c1aa249d163@baylibre.com> References: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> In-Reply-To: <20250321-wip-bl-ad3552r-fixes-v1-0-3c1aa249d163@baylibre.com> To: =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Lars-Peter Clausen , Jonathan Corbet , Olivier Moysan , Michael Hennerich Cc: linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.2 From: Angelo Dureghello The ad3552r can be feeded from the HDL controller by an internally generated 16bit ramp, useful for debug pourposes. Add debugfs a file to enable or disable it. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-hs.c | 106 +++++++++++++++++++++++++++++++++++++++= +--- 1 file changed, 100 insertions(+), 6 deletions(-) diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 37397e188f225a8099745ec03f7c604da76960b1..41fe78d982a68980db059b095fc= 27b37ea1a461b 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -7,6 +7,7 @@ */ =20 #include +#include #include #include #include @@ -65,6 +66,18 @@ static int ad3552r_hs_reg_read(struct ad3552r_hs_state *= st, u32 reg, u32 *val, return st->data->bus_reg_read(st->back, reg, val, xfer_size); } =20 +static int ad3552r_hs_set_data_source(struct ad3552r_hs_state *st, + enum iio_backend_data_source type) +{ + int ret; + + ret =3D iio_backend_data_source_set(st->back, 0, type); + if (ret) + return ret; + + return iio_backend_data_source_set(st->back, 1, type); +} + static int ad3552r_hs_update_reg_bits(struct ad3552r_hs_state *st, u32 reg, u32 mask, u32 val, size_t xfer_size) { @@ -483,6 +496,66 @@ static int ad3552r_hs_reg_access(struct iio_dev *indio= _dev, unsigned int reg, return st->data->bus_reg_write(st->back, reg, writeval, 1); } =20 +static ssize_t ad3552r_hs_show_data_source(struct file *f, char __user *us= erbuf, + size_t count, loff_t *ppos) +{ + struct ad3552r_hs_state *st =3D file_inode(f)->i_private; + enum iio_backend_data_source type; + int ret; + + ret =3D iio_backend_data_source_get(st->back, 0, &type); + if (ret) + return ret; + + switch (type) { + case IIO_BACKEND_INTERNAL_RAMP_16BIT: + return simple_read_from_buffer(userbuf, count, ppos, + "backend-ramp-generator", 22); + case IIO_BACKEND_EXTERNAL: + return simple_read_from_buffer(userbuf, count, ppos, + "iio-buffer", 10); + default: + return -EINVAL; + } +} + +static ssize_t ad3552r_hs_write_data_source(struct file *f, + const char __user *userbuf, + size_t count, loff_t *ppos) +{ + struct ad3552r_hs_state *st =3D file_inode(f)->i_private; + char buf[64]; + int ret; + + ret =3D simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf, + count); + if (ret < 0) + return ret; + + buf[count] =3D 0; + + if (count =3D=3D 10 && !strncmp(buf, "iio-buffer", 10)) { + ret =3D ad3552r_hs_set_data_source(st, IIO_BACKEND_EXTERNAL); + if (ret) + return ret; + } else if (count =3D=3D 22 && !strncmp(buf, "backend-ramp-generator", 22)= ) { + ret =3D ad3552r_hs_set_data_source(st, + IIO_BACKEND_INTERNAL_RAMP_16BIT); + if (ret) + return ret; + } else { + return -EINVAL; + } + + return count; +} + +static const struct file_operations ad3552r_hs_data_source_fops =3D { + .owner =3D THIS_MODULE, + .write =3D ad3552r_hs_write_data_source, + .read =3D ad3552r_hs_show_data_source, +}; + static int ad3552r_hs_setup(struct ad3552r_hs_state *st) { u16 id; @@ -550,11 +623,7 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *s= t) if (ret) return ret; =20 - ret =3D iio_backend_data_source_set(st->back, 0, IIO_BACKEND_EXTERNAL); - if (ret) - return ret; - - ret =3D iio_backend_data_source_set(st->back, 1, IIO_BACKEND_EXTERNAL); + ret =3D ad3552r_hs_set_data_source(st, IIO_BACKEND_EXTERNAL); if (ret) return ret; =20 @@ -661,6 +730,24 @@ static const struct iio_info ad3552r_hs_info =3D { .debugfs_reg_access =3D &ad3552r_hs_reg_access, }; =20 +static void ad3552r_hs_debugfs_init(struct iio_dev *indio_dev) +{ + struct ad3552r_hs_state *st =3D iio_priv(indio_dev); + struct dentry *d =3D iio_get_debugfs_dentry(indio_dev); + + if (!IS_ENABLED(CONFIG_DEBUG_FS)) + return; + + d =3D iio_get_debugfs_dentry(indio_dev); + if (!d) { + dev_warn(st->dev, "can't set debugfs in driver dir\n"); + return; + } + + debugfs_create_file("data_source", 0600, d, st, + &ad3552r_hs_data_source_fops); +} + static int ad3552r_hs_probe(struct platform_device *pdev) { struct ad3552r_hs_state *st; @@ -705,7 +792,14 @@ static int ad3552r_hs_probe(struct platform_device *pd= ev) if (ret) return ret; =20 - return devm_iio_device_register(&pdev->dev, indio_dev); + ret =3D devm_iio_device_register(&pdev->dev, indio_dev); + if (ret) + return ret; + + ad3552r_hs_debugfs_init(indio_dev); + + return ret; + } =20 static const struct of_device_id ad3552r_hs_of_id[] =3D { --=20 2.49.0