From nobody Tue Feb 10 02:43:41 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 C848522A1E2 for ; Mon, 7 Apr 2025 08:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744016014; cv=none; b=fG2P+8zNB9CmPLpYPTFfMkU1nzy4clCCtjWQOVhEp0oxdrjRjx8tDKNOP9MUhNAcQwoPUdqaZWSAkiivleVqtEvv0P7Dse7Brx7LLDBDcda3ENRLdkJy92AW9GEGhYEu04sPgcO63tSEr+8d4qWd/H8IZ+LEClm0mRdHdbABSQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744016014; c=relaxed/simple; bh=hWSr+N4q8jPBwyhE+M9punDDVddf1n2Qdd8iVHO9YtM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N0JnpfGCGXE57QPjYB1Ae5UoJj6K1IPC0cb4DJ+M7BQRcJAD2rMkDc9eEjeHy2t5MfotnkyIZm/m6pqBecMm9cdIJmExsAJPjQgNZP0o+bU+D9z+e7pGwV17HCugfOVN9asnwR9PlOTjSAxapAhgBAkgQvNQHwd9sgPO4h2zIDA= 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=2O4wOAlN; arc=none smtp.client-ip=209.85.128.42 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="2O4wOAlN" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43cfebc343dso25979405e9.2 for ; Mon, 07 Apr 2025 01:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1744016010; x=1744620810; 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=2O4wOAlNGCiq2nxlgwd1CsF5NbTgt9kPZZifV12aJtl2XZUF+QioxxQ+Rf/DOFDyFS h4ztn60U8xR2AGkAh3vbptL/yOExaF6AZ9hAEAsuL+rfRmmw7c+qoKUlXkWjVpvavVvw gXTjMWWj8rZ3ndrDLSl4NC0pFNwq4Pu8Sz7TB5KzILykjkEGnueY7EpwwjrT43vtUZth nddioDKEqUIWaQcyK4hm3cMeMjss1CLkBxNKeKNiGxOHWwhhP9+PUCQVSJueukcsfdIx CrdRghWvZ+GIy3M24jC4sI2T1/FBKEVcMb6SBH95XvcrxaZGKKzoRlyEQNYS7Z53l8+o dk1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744016010; x=1744620810; 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=oWyw/x+p3eHf431Qn/ErHnUQ8moXz/foU/yP4YM5RyK0JWdulKrcil3Nh9p6S+h6xD bVqTK2LqQaPtC3+fjtIx2ZcXuHqANAO60U1MY5Ez2tfGUHBhUnIu1tuYbOaKh86QOjK5 7eCWVzmpSxpQAWV+6r9aa7uIIfa/BUonZybAexmu9cJ2E1GQh2F0VvgpEEp1RhCXIycP HCBMBYhE4ANT8oIFnXNzVTVdsKRWbJa8Iw0uqNRiMYMbTWrj7yxaFkVO3PDHPK9pF6d7 NjZNs2Wu80CzLmxk1Lj0IhAxK98wQd4Rxr6lv9ngOX15EEYWHKR0QHbN/PFPCcGAUg47 Is9g== X-Forwarded-Encrypted: i=1; AJvYcCXEVZdqPg0aRFXrlGzNI6AbnnPe5jSt4nqHX7wpqHf4F03/eiHC+2d9WJ6MJkTBJCNyWIbiIXVLQ1q4bWY=@vger.kernel.org X-Gm-Message-State: AOJu0YxLY7pQCUgemIsftLRFYujU6TPozu/JGROSPy3GMm6pndIyTHPi ZdTyA0JP4yUJprdFY1hr8p4ltkbS6E+IPh0dj3ikbR7nv+3N9wAoJloDobaP/Rk= X-Gm-Gg: ASbGncs9IV84eYZb5UmeqIlH4pgLHAx1HoU0eEd2a83Z4Wqt8LzulNBFCWvuIvricB3 7BGiLbvhHDwsL5NGUlirTN8be2j2pMp7BI7JDROleaRlFrVtbgt7IzvRPaUtd5aRqQ1KfN3fnIQ 4RY+PWXMMa4Pl1FVM+1Z2vWup4zajF/iQGdYrNlHPmloC0iDVhqvmzu/AqplQCm09C5amI3hOVf sT6dMZWdO07t1C67itqk7E0I1i29+eD0hrKE7Bs16y4RDzurtQpBMBCOiEkLxoy5xLE2L9ogz9c IBB6K6+FVVqg0MNLELUPbfq0hTnN7DG9bmgtFzvo46rXoEg3JOWugps6F1wmRp7Qg5sSQrX+98n UMvCB9GvHZpcaZ3qlpclMiA== X-Google-Smtp-Source: AGHT+IEoRKYzi4XTLVyzGQCHVUJlc2/nLNfGyDANP2bSxKBD7Syi4BAXA2v3/anNoWltCaKQJP3DQQ== X-Received: by 2002:a05:600c:4712:b0:43b:ca39:6c75 with SMTP id 5b1f17b1804b1-43ecf8cfb3cmr114706865e9.16.1744016010047; Mon, 07 Apr 2025 01:53:30 -0700 (PDT) Received: from [192.168.0.2] (host-87-15-70-119.retail.telecomitalia.it. [87.15.70.119]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43ec3174cf0sm126966995e9.0.2025.04.07.01.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 01:53:29 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Mon, 07 Apr 2025 10:52:05 +0200 Subject: [PATCH v3 3/5] 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: <20250407-wip-bl-ad3552r-fixes-v3-3-61874065b60f@baylibre.com> References: <20250407-wip-bl-ad3552r-fixes-v3-0-61874065b60f@baylibre.com> In-Reply-To: <20250407-wip-bl-ad3552r-fixes-v3-0-61874065b60f@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 X-Developer-Signature: v=1; a=openpgp-sha256; l=3489; i=adureghello@baylibre.com; h=from:subject:message-id; bh=/X5T/C4urb1TZY56QZlmQtSfqpUWNyuJBZpY7qU/VIg=; b=owGbwMvMwCXGf3bn1e/btlsznlZLYkj/PMkmoczqgCDDtUeWqZsvtzIYMG2xXml75fUX/nNJO ZOfKHl86ihlYRDjYpAVU2SpS4wwCb0dKqW8gHE2zBxWJpAhDFycAjCRt5WMDJ/DNovujT/9T1X0 zI4NNbbCwVH/cuz26P+b4342dC2zzASG/7GWJQxyt2Z0iukHG93h/PaibU8lT4s6k0LLV7es6ER RDgA= X-Developer-Key: i=adureghello@baylibre.com; a=openpgp; fpr=703CDFAD8B573EB00850E38366D1CB9419AF3953 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 Reviewed-by: Nuno S=C3=A1 --- 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