[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250722-topic-icc_rs-v1-2-9da731c14603@oss.qualcomm.com>
Date: Tue, 22 Jul 2025 23:14:26 +0200
From: Konrad Dybcio <konradybcio@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Georgi Djakov <djakov@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>,
Bjorn Andersson <bjorn.andersson@....qualcomm.com>
Cc: Marijn Suijten <marijn.suijten@...ainline.org>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-pm@...r.kernel.org, Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Subject: [PATCH DNM 2/2] interconnect: Add a test Rust consumer driver
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Do not merge, this is for illustration / CI purposes only.
Signed-off-by: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
---
drivers/interconnect/Makefile | 1 +
drivers/interconnect/test.rs | 47 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/interconnect/Makefile b/drivers/interconnect/Makefile
index b0a9a6753b9dc30083781163ccc01dafcfcd0485..913b92080cc0b79846b74c239e14959b45b5450c 100644
--- a/drivers/interconnect/Makefile
+++ b/drivers/interconnect/Makefile
@@ -2,6 +2,7 @@
CFLAGS_core.o := -I$(src)
icc-core-objs := core.o bulk.o debugfs-client.o
+icc-core-$(CONFIG_RUST) += test.o
obj-$(CONFIG_INTERCONNECT) += icc-core.o
obj-$(CONFIG_INTERCONNECT_IMX) += imx/
diff --git a/drivers/interconnect/test.rs b/drivers/interconnect/test.rs
new file mode 100644
index 0000000000000000000000000000000000000000..f4ba2000d0f1fd2d91aedf8aace0b0b54bfd48f2
--- /dev/null
+++ b/drivers/interconnect/test.rs
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+
+//! Test interconnect consumer driver
+use kernel::{
+ c_str, device::Core, icc::*, module_platform_driver, of, of::DeviceId, platform, prelude::*,
+};
+
+#[pin_data]
+struct IccTestConsumerDriver {
+ #[pin]
+ path: IccPath,
+}
+
+kernel::of_device_table!(
+ OF_TABLE,
+ MODULE_OF_TABLE,
+ <IccTestConsumerDriver as platform::Driver>::IdInfo,
+ [(DeviceId::new(c_str!("linux,icc-consumer-test")), ())]
+);
+
+impl platform::Driver for IccTestConsumerDriver {
+ type IdInfo = ();
+ const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
+
+ fn probe(
+ pdev: &platform::Device<Core>,
+ _id_info: Option<&Self::IdInfo>,
+ ) -> Result<Pin<KBox<Self>>> {
+ let path = IccPath::of_get(pdev.as_ref(), None)?;
+
+ path.set_bw(
+ IccBwUnit::from_megabits_per_sec(400),
+ IccBwUnit::from_megabits_per_sec(800),
+ )?;
+
+ Ok(KBox::pin_init(Self { path }, GFP_KERNEL)?.into())
+ }
+}
+
+module_platform_driver! {
+ type: IccTestConsumerDriver,
+ name: "icc-test-consumer",
+ authors: ["Konrad Dybcio <konrad.dybcio@....qualcomm.com>"],
+ description: "Test interconnect consumer driver",
+ license: "GPL",
+}
--
2.50.1
Powered by blists - more mailing lists