From patchwork Tue Feb 18 19:29:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13980785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0DFCC021AD for ; Tue, 18 Feb 2025 20:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=L/I1LYNGV5m8X00owyPrcMUNrxNHv9J3mejGBm6Nh5Q=; b=XWg8Yf5eedKgCo tX0JZSR0+mKMzxOWqwQg65pJQxVsWZtF/GbAp+hKGOYagaj6g3I/9FNN1JcPtt+L7epeV4nMrMNYm mGi49MLZmDBpd40tD6jdNLMg0NCKSfxYP7xUmKnRhtTI3QG+Oszh6NBkH1pjLabeR35l8yj+IsTGJ XpsDhIfz9OR0spz6WliRnDeo0oL+6zOEm7yjWy5wQ832sIOHp7uLJ3Lr9LmG3eaFpDrXOzNORHM2m 3D8BZyN6QytHDXUsp+cpYfUSGpqgTMqr0PBQHif50/3ereB0FTzU52iiejKioKY/HaDsEKVV/Ubib fwuuNrTHwS1Wod+YPFgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tkTvy-00000009hjU-0Fga; Tue, 18 Feb 2025 20:11:10 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tkTIg-00000009a07-3Rtj for linux-amlogic@lists.infradead.org; Tue, 18 Feb 2025 19:30:37 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5e05717755bso3947659a12.0 for ; Tue, 18 Feb 2025 11:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1739907033; x=1740511833; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=mIW3Tj0XdfJSfKxjiYcsy2cS5srx8ZXffTdS0QjWZns=; b=gMBk2uU98Mhyk4MYJXQvDTlgO431bhH99LvAoXG4tnDKLou7jw7GA2sRLmdkL16KF9 kz1y691wjtm1lRbFzsXqeii5h4onOxhv65shSoG9dfO+PvAvqrpJqWOF+uwk92cFPkiy t80Byj/A8/USxUot5+QHba3H/jmPIegQ9DqP/QM2GMkP7hcKSy3KNn/HSbIzIrPKvllj 1EnK/1kWIaqVMi4K3zqUfqO6/KJE64NxPCnxC4SQYIuPaRh26+0EIM9G0eJx0dbCebe4 uD7mGasylRTJsOsk+R2SqnpRRzs4EGcC+80KcxA8BjR0lZ8JLHz5NVtS9cfpwO7PlsMG cXpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739907033; x=1740511833; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mIW3Tj0XdfJSfKxjiYcsy2cS5srx8ZXffTdS0QjWZns=; b=Frp6lNhQAN/gnK2L3xfqcl6eMpbOPWArY50r924tzMjvP/72xuOzEedsyoX8bFf8tF jKe2NFCqzeubFTiJUcHsTnZEmCpk1/1Lc5oa9YA7YL+z5jSoBwlAq9f8TmAxZ9TmrIFA WyVwDhbMShNn0N275j852NaOzjlEUzxO2izQO4xFcupSIMnTWprX3tTQT8cWdPZuK/rs bNm6+d8TMdvMZ8z925nuOAHqxejG1zdxnRdcqvuFUh7aCowDGsywbxx2fHuxouj7QQTF GQXspCab88ELiiCpsC4jvMk9KHOivUXhHqbekNhhYl5VUsElzkOz4IrI1rulOILm2g7b cXdg== X-Forwarded-Encrypted: i=1; AJvYcCVf0KiUbxoKw//Kc1y6Kk+y3Po7krVGMKpbR6LbVcEOU3z4Bdh3FOVgPKPaaLZQcty7gUIXV11tJKc9V7si@lists.infradead.org X-Gm-Message-State: AOJu0YxF6ZEXP87FjYHXcNaejdl8XYHE8hpTKln+Caq32wOAVZXQo1wV PWfrPDhGoAkXwttrrX1mRDp4EWgT5MipWbESJn69KsSPK0Pv3kl8ZBHYFy5bvZQ= X-Gm-Gg: ASbGncujaYE3bUVaQpouZo2Zs1bo9xFM0r5DXOoCQK8S5PGOEkxKGj/i1HJhdkZbHFy GA3GxIGOyEq7KBxcuZJs/+dihpvNbtc/4jBdZv5YWR1Ed97Bqivy8eEJxTsuDDBFIhr2vKXazbM h1YbvEBdmlHo1XzKiqFIwAmafYxn9SWcBwVjcBdZXD9pdGbYJ7J0X8fbSGB+LKkpy4VlgJPLKS7 9oqyMOSojw+lPembxyu+SS90nlKTJ11JNUcs9w0iT/sDAqqIWzITGTevXLrOv26HHBMXqxkb0Px 6mU4UzpNG3J+6MMs087B6MUFoPoN X-Google-Smtp-Source: AGHT+IEsUkQkmLnMxncHVAOTmPsKmvVPSTaQR78ji9vJrVN7d833EMl3VWJfxC45bU7tBdks7OZrJg== X-Received: by 2002:a05:6402:51d4:b0:5e0:51a9:d410 with SMTP id 4fb4d7f45d1cf-5e051a9d59cmr11065896a12.25.1739907032830; Tue, 18 Feb 2025 11:30:32 -0800 (PST) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:cbaf:af0:839d:fb4a]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5dece1c3ce5sm9338985a12.17.2025.02.18.11.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 11:30:32 -0800 (PST) From: Jerome Brunet Subject: [PATCH v4 0/8] driver core: auxiliary bus: add device creation helper Date: Tue, 18 Feb 2025 20:29:45 +0100 Message-Id: <20250218-aux-device-create-helper-v4-0-c3d7dfdea2e6@baylibre.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAKnftGcC/42NQQ6CMBBFr0Jm7RimLbG48h6GRSmDNEEgUyQQw t2tnMDl+/n//R0iS+AI92wH4SXEMA4JzCUD37nhxRiaxKByZUhRju6zYpOKntELu5mx435iwVK ToUIZLpSGNJ+E27Ce6meVuAtxHmU7nxb6pX9IF0LCwtpbaxpb6tw+arf1oRa++vEN1XEcXzgI+ /LDAAAA X-Change-ID: 20241210-aux-device-create-helper-93141524e523 To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , "Rafael J. Wysocki" , Stephen Boyd , Arnd Bergmann , Danilo Krummrich , Conor Dooley , Daire McNamara , Philipp Zabel , Douglas Anderson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Bryan O'Donoghue , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Michael Turquette , Abel Vesa , Peng Fan , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kevin Hilman , Martin Blumenstingl Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Jerome Brunet X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3639; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=5jr0njrsEqh+gx0/hryuSdGRgOG6j3FS8QheXHGTwG0=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBntN/OWNreQDN/vUjV7hrjtf9acN+LfunziKrQQ 0+55m0edLGJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZ7TfzgAKCRDm/A8cN/La hRMsD/9ziamapLyta7b2bnUpuc3WwKbKpFZ9GL/J7nw2y3cw/h5jQBYbDSF9JrRSKgzBbfv6Sey QRNn8YHjpUuiMQoo8wdF8JQAlfzz2s0Us6Or+rdpDD/QESOXyHDqj4MUG6FTXYd6FP3XToJ42vi o298p/RQJt7nZk755yQCNu+oz2gqK2ZaQnsfxtwRPjODRR7EFCDtt6GzOIQ6gMys62o6Mk/PRs+ l1rKan/fK30ltLDStso25MaxLWBWV+npLFI35BMTlhMEwG+JTun3VMmjlWz9kiBjMqGBx2qiste CCASomjcV/H2nDkNLAKwD/UefscVOHz9VIb3RNV4bBZIaCNqPYvjtZw8poWesaxupOoNpkApV1I iuOjXT0pkOdE3AtkaBQ/6cVd15in+oW9zqTzplE86661VuagqxrOQ+l8pbmbmk0R89TtIXS6KLO hLZG6xJCG94i6UMTAU0hCmZlQU/CW22okUfGUHjgTYK6ptzPX+PDffsa4fBWg7IHfxtdZ2bKtln RgJlvATKPKlyz7ds7JlS5NJM9MAPT8rPBlDL08q9TxYGO1jW1mxv3I14XfLQ7XXv+yTGVoSNwA0 XUgHQc8fDO8z2hMMyQDJqxbCfvG5BaZ42qT2FGwEEHgMmmQe7i0RN0x7Le1Ppt/hMQ35Cpsysif vfaUCrYJTwsPKFQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250218_113035_121780_5D6D74CC X-CRM114-Status: GOOD ( 15.67 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The suggestion for this change was initially discussed here: [1] This patchset adds and use a helper to create a simple auxiliary device. The goal is to remove boilerplate code that tends to get repeated for simple cases. Only the last change was tested on actual HW. The other usage of the helper have only been compile tested with x64_64 allmodconfig. There are many other simple cases of auxiliary device creation but those tend to use the 'container_of' trick to allocate the auxiliary device. It is possible to convert these drivers to use the provided helper but the conversion is slightly more complex. NOTE: This series is based on -rc1. Only the first change is meant to applied. The reset will likely wait for the helper to land in mainline. Rebase on the corresponding subsystem will be done when/if necessary. [1]: https://lore.kernel.org/linux-clk/df0a53ee859e450d84e81547099f5f36.sboyd@kernel.org Changes in v4: - Added eyeq reset patch from Theo (Thanks) - Changed returned value to 'valid or NULL'. Consumers should return -ENODEV if translation to int is necessary. - Export the non-managed function helpers - Default id to 0 for the simpler devm_auxiliary_device_create() as suggested by Conor - Fix clk-imx8mp-audiomix config problem reported by Ira - Rebased on drm-next for ti-sn65dsi86 - Link to v3: https://lore.kernel.org/r/20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com Changes in v3: - Implement Ira's suggestion to use KBUILD_MODNAME by default, same as auxiliary_driver_register() - Link to v2: https://lore.kernel.org/r/20250206-aux-device-create-helper-v2-0-fa6a0f326527@baylibre.com Changes in v2: - Add usage examples, as requested. - Add 'id' as function parameter: Adding the example usage showed that handling IDA allocation was not appropriate and making the usage more complex for simple use case. - Also add 'modname' as parameter: Most driver have been using KBUILD_MODNAME and this actually rarely align with the driver name. - Link to v1: https://lore.kernel.org/r/20241210-aux-device-create-helper-v1-1-5887f4d89308@baylibre.com Signed-off-by: Jerome Brunet --- Jerome Brunet (7): driver core: auxiliary bus: add device creation helpers reset: mpfs: use the auxiliary device creation drm/bridge: ti-sn65dsi86: use the auxiliary device platform: arm64: lenovo-yoga-c630: use the auxiliary device creation helper clk: eyeq: use the auxiliary device creation helper clk: clk-imx8mp-audiomix: use the auxiliary device creation helper clk: amlogic: axg-audio: use the auxiliary reset driver - take 2 Théo Lebrun (1): reset: eyeq: drop device_set_of_node_from_dev() done by parent drivers/base/auxiliary.c | 108 ++++++++++++++++++++++++++++ drivers/clk/clk-eyeq.c | 57 ++++----------- drivers/clk/imx/clk-imx8mp-audiomix.c | 49 +++---------- drivers/clk/meson/Kconfig | 2 +- drivers/clk/meson/axg-audio.c | 114 ++++-------------------------- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 49 ++----------- drivers/platform/arm64/lenovo-yoga-c630.c | 40 +---------- drivers/reset/reset-eyeq.c | 13 +--- drivers/reset/reset-mpfs.c | 56 ++------------- include/linux/auxiliary_bus.h | 17 +++++ 10 files changed, 176 insertions(+), 329 deletions(-) --- base-commit: 0ed1356af8f629ae807963b7db4e501e3b580bc2 change-id: 20241210-aux-device-create-helper-93141524e523 Best regards,