From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 47FB346EF69 for ; Tue, 1 Sep 2026 07:49:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788248996; cv=none; b=rSmTbAKN4SScFBIaScBnbpgqCpi0tGtXrloZqJhXU41t7he71KLoJMyoEZenL+uA6LrgIhRALNKA+zBQDopdCUf3yXmjstWDRRFzuC8nryTBx0VPdbGnjY/Sx9q4c9SLQsKUAtrYXPPPnsUeD+TzKoUlWf56PQunMwmwwe3a69g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788248996; c=relaxed/simple; bh=2j3Dm0aFz6+DYVPQ4bDg6M1hmAIxbGZ0tjnY1/wZ04w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VNu1/ZBV/0aaAooHbw2XWwa6yOtP17wbklPb8qWHoXn6Dd1kMdm/dh0vX8guTyZ+kIvx1X03cl/MaElzqdwfbQXNvlUIFkWgSIDdj3UPRrz2f3zH/qAKaNDU1zw6/N0ZjUM9OuZ2Kpxf+8bKllJBbMX7XfouAp3FP9/55e86kn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ZUVLsXo7; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZUVLsXo7" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2d715f4a587so8223355ad.2 for ; Tue, 01 Sep 2026 00:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788248994; x=1788853794; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NJMnm69J8RdOeWIBaNigEROVzoE1nH5G/6Xl+5Lr2x8=; b=ZUVLsXo721pJQvM/1c7s/r/p4G0xvGpVbxFn0+21L0W4R7F+1AbG3+LERt5CNJ97jq 1JEF42Uu9JjEJzOeLIcOZA2uDMu4gBalh/o972vlddjtUemVqPdFzW/fRHOiqRNzRF7J SC05R5vbCmzWiitxWN2WxdzFDjNh/CbvTMehg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788248994; x=1788853794; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NJMnm69J8RdOeWIBaNigEROVzoE1nH5G/6Xl+5Lr2x8=; b=qrcoK+VfQZ9LBE/x/cdus3RhPZv+VTvxsh9WHgQUp02mDkroCK6IEkozKPpwYsijrT 0lV/FfwtIDMawxVINvaatJlMRt54m9jwPlT7ussFbFUbBh/OgHGGdCUVQXr8nunzK92T cN28HPlS3G+eV5RY5c8fCdGRV/QDMJUje2udvlsjDvYWN45e6obty6G9nC3hRaT2Hc+d LwNo8B6WHV71RMZnU5O+lKc9QCFFULR0e2bDMVkenixANQc7SW9kfg8SMs3KAT8NPYGr yBGDERKlkPMRIrWj6ZZ0Gndt3xmvpY9CVYTQwCjljdjUMWqQ33UXUgkqPpU/wzDobLum BPGg== X-Forwarded-Encrypted: i=1; AKwUvBzcbwn46XaHsLxFmYXWlqS3dnCXhLodtx+gB562vajBUQ9X84ECuTpTA3v2GsN+QDpnvwPIWJH4J52QYHw=@vger.kernel.org X-Gm-Message-State: AFuF++mrP2J+RLOYAH2khjMUL5epx+fTDFpqmxJKB9Z2M1rrhqA0/QdT y9kd57A7Dg8n/wIRd+zqC3ZSsbbNwJp/4YYsKfk8RsjiT6rY5skypDLiPhjAcK/+ag== X-Gm-Gg: AYBFou2yt9dRhWTDeJwnqHQwEnw1vYLASD5SOXXSKlSyA39X5wnJnWppW0Xfso5rGIf lF/6EV8Fxfy6GjTnas7g1D3PnGXjVL9n6mjGgQsluLM0z/SHlknNUa2UX+Jx0zsr4o+D4G0tjsi TvlN9IG8Q5aBK9gxA8NYXBSoHIm225fuuTEK8E7uHND+HRmf2MZ2mjxWQGrqU/IYdO9cNJr45DC wwunDlk3ph/X2Wlij9t9wdj2EXdA/FCwAWwDbjuG2iAfeUNEwDA73l1wTa767IVf81uOtXgFe0J gBaWkc/BcDPfv1GdQz5v9wzpGYz0AXI5Xc/L6Beji2uzLWOuLgURVdpWB+unz3bPYOxGC8bofkz WcfuuJMgWKYVE8BkuWOa5rBZXaKxDAkJ+bccwlxX00rebwS6bKIzcKMryGd9QkqZyuaju5psTCO eOCvOffjVH5/sHe3XcmYD/0y0lHYEM3RkT6xINjEXjDQt1n1Q5jbJfmF9uyLmnjR58iwCrGXQNU 7kSqeV6Jyl+A55Ud7lVovtwf5whCh80QWroDoa+1DX6Bw== X-Received: by 2002:a17:902:fd85:b0:2d6:ffa1:429b with SMTP id d9443c01a7336-2d74dc6f7c3mr521877535ad.7.1788248993464; Tue, 01 Sep 2026 00:49:53 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:49:53 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/8] regulator: core: Add "enable and wait" functions Date: Tue, 1 Sep 2026 15:49:19 +0800 Message-ID: <20260901074930.764550-2-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" In device power sequencing and initialization use cases, it is common for the driver to enable the regulator and then wait for a certain period of time to pass before continuing. In cases where the regulator supply is always on, or has been turned on or left on by another consumer, the driver could shorten the delay or skip it altogether, provided that enough time has already passed since the regulator was _actually_ turned on. Tracking this requires support from the regulator core. Introduce a "last turned on" timestamp field to the regulator device, and "enable and wait" functions to the single and bulk regulator consumer APIs. The existing "enable without wait" functions are then converted to macros that expand to the new functions. The timestamp is updated each time the regulator is actually turned on. For regulators left on by hardware default or by firmware, the core will set the timestamp if it detects it was left on and its supply (and their supply, and so on) is on as well. This is unfortunately best effort only. The core can only assume a dangling regulator (one without a supply) has power. This also applies to the dummy regulator. Signed-off-by: Chen-Yu Tsai --- Changes since v5: - Correctly assign wait_us to all bulk consumers (Sashiko) - Check _regulator_is_enabled() > 0 to check for enabled regulators (Sashiko) - Lock regulator_dev on final _regulator_is_enabled() check in regulator_register() (Sashiko) - Make it clear that _regulator_is_enabled_recursive() assumes that supplies have been resolved (local AI review) - Consider supply's last_on timestamp for regulators that are already enabled or have no .is_enabled() ops (local AI review) Changes since v4: - Try to update last_on timestamp for regulators that were left on Changes since v3: - Added __private modified to regulator_bulk_data.wait_us field and switched to ACCESS_PRIVATE accessor for the field - Moved wait outside regulator lock scope - Moved "remaining" value assignment closer to conditional - Fixed variable unit name in regulator_enable_and_wait() prototype Changes since v2: - New patch --- drivers/regulator/core.c | 129 +++++++++++++++++++++++++---- include/linux/regulator/consumer.h | 21 +++-- include/linux/regulator/driver.h | 2 + 3 files changed, 131 insertions(+), 21 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6a4008f387b5..d7a193a3bcb2 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -99,7 +99,7 @@ struct regulator_event_work { unsigned long event; }; =20 -static int _regulator_enable(struct regulator *regulator); +static int _regulator_enable(struct regulator *regulator, ktime_t *last_on= ); static int _regulator_is_enabled(struct regulator_dev *rdev); static int _regulator_disable(struct regulator *regulator); static int _regulator_get_error_flags(struct regulator_dev *rdev, unsigned= int *flags); @@ -1675,7 +1675,7 @@ static int set_machine_constraints(struct regulator_d= ev *rdev, (rdev->constraints->always_on || !regulator_is_enabled(rdev->supply))) { ret =3D (is_locked - ? _regulator_enable(rdev->supply) + ? _regulator_enable(rdev->supply, NULL) : regulator_enable(rdev->supply)); if (ret < 0) { _regulator_put(rdev->supply); @@ -2186,6 +2186,45 @@ static struct regulator_dev *regulator_dev_lookup(st= ruct device *dev, return ERR_PTR(-ENODEV); } =20 +/** + * _regulator_is_enabled_recursive - is the regulator output enabled all + * the way to the root supply + * @rdev: regulator device + * + * Only intended for checking regulators that have been left on by + * hardware default or firmware. + * + * Assumes supplies have been resolved. Must be called with dependent + * locks held. + * + * Return: Positive if the regulator output backing the source/client, + * and all of its upstream supplies, have requested that their + * respective device be enabled, zero if any of them hasn't, + * else a negative error number. + */ +static int _regulator_is_enabled_recursive(struct regulator_dev *rdev) +{ + int ret; + + ret =3D _regulator_is_enabled(rdev); + if (ret <=3D 0) + return ret; + + /* + * If .last_on was set, then this rdev was either enabled through + * _regulator_do_enable(), or had been checked before as the target + * of regulator_resolve_supply(). + */ + if (rdev->last_on) + return ret; + + /* This is the root supply; we can only assume it actually has power */ + if (!rdev->supply) + return ret; + + return _regulator_is_enabled_recursive(rdev->supply->rdev); +} + static int regulator_resolve_supply(struct regulator_dev *rdev) { struct regulator_dev *r; @@ -2370,6 +2409,14 @@ static int regulator_resolve_supply(struct regulator= _dev *rdev) } rdev->constraints_pending =3D false; } + + /* + * regulator was left on but not enabled with .always_on or .boot_on + * constraints, and thus .last_on timestamp is still invalid. + */ + if (!rdev->last_on && _regulator_is_enabled_recursive(rdev) > 0) + rdev->last_on =3D ktime_get_boottime(); + regulator_unlock_dependent(rdev, &ww_ctx); =20 if (!do_final_setup) @@ -3061,6 +3108,8 @@ static int _regulator_do_enable(struct regulator_dev = *rdev) fsleep(delay); } =20 + rdev->last_on =3D ktime_get_boottime(); + trace_regulator_enable_complete(rdev_get_name(rdev)); =20 return 0; @@ -3130,16 +3179,18 @@ static int _regulator_handle_consumer_disable(struc= t regulator *regulator) return 0; } =20 -/* locks held by regulator_enable() */ -static int _regulator_enable(struct regulator *regulator) +/* locks held by regulator_enable_and_wait() */ +static int _regulator_enable(struct regulator *regulator, ktime_t *last_on) { struct regulator_dev *rdev =3D regulator->rdev; + ktime_t supply_last_on; int ret; =20 lockdep_assert_held_once(&rdev->mutex.base); =20 + supply_last_on =3D 0; if (rdev->use_count =3D=3D 0 && rdev->supply) { - ret =3D _regulator_enable(rdev->supply); + ret =3D _regulator_enable(rdev->supply, &supply_last_on); if (ret < 0) return ret; } @@ -3177,13 +3228,26 @@ static int _regulator_enable(struct regulator *regu= lator) } else if (ret < 0) { rdev_err(rdev, "is_enabled() failed: %pe\n", ERR_PTR(ret)); goto err_consumer_disable; + } else { + /* + * Either the regulator was already enabled somehow, or this regulator + * itself has no on/off control. Either way our timestamp cannot be + * earlier than its supply's timestamp. supply_last_on =3D=3D 0 if there + * is no supply. + */ + if (rdev->last_on < supply_last_on) + rdev->last_on =3D supply_last_on; + if (!rdev->last_on) + rdev->last_on =3D ktime_get_boottime(); } - /* Fallthrough on positive return values - already enabled */ } =20 if (regulator->enable_count =3D=3D 1) rdev->use_count++; =20 + if (last_on) + *last_on =3D rdev->last_on; + return 0; =20 err_consumer_disable: @@ -3197,31 +3261,49 @@ static int _regulator_enable(struct regulator *regu= lator) } =20 /** - * regulator_enable - enable regulator output + * regulator_enable_and_wait - enable regulator output and wait for time + * passed after regulator actually enabled * @regulator: regulator source + * @wait_us: time to wait after regulator actually turned on; 0 to not wait * * Request that the regulator be enabled with the regulator output at * the predefined voltage or current value. Calls to regulator_enable() * must be balanced with calls to regulator_disable(). * + * If wait_us is greater than zero, then check that wait_us has passed sin= ce + * the regulator is _actually_ enabled before returning. + * * NOTE: the output value can be set by other drivers, boot loader or may = be * hardwired in the regulator. * * Return: 0 on success or a negative error number on failure. */ -int regulator_enable(struct regulator *regulator) +int regulator_enable_and_wait(struct regulator *regulator, unsigned int wa= it_us) { struct regulator_dev *rdev =3D regulator->rdev; struct ww_acquire_ctx ww_ctx; + ktime_t last_on =3D 0; int ret; =20 regulator_lock_dependent(rdev, &ww_ctx); - ret =3D _regulator_enable(regulator); + ret =3D _regulator_enable(regulator, &last_on); regulator_unlock_dependent(rdev, &ww_ctx); =20 + if (ret) + return ret; + + if (wait_us) { + ktime_t end =3D ktime_add_us(last_on, wait_us); + s64 remaining; + + remaining =3D ktime_us_delta(end, ktime_get_boottime()); + if (remaining > 0) + fsleep(remaining); + } + return ret; } -EXPORT_SYMBOL_GPL(regulator_enable); +EXPORT_SYMBOL_GPL(regulator_enable_and_wait); =20 static int _regulator_do_disable(struct regulator_dev *rdev) { @@ -5390,30 +5472,38 @@ static void regulator_bulk_enable_async(void *data,= async_cookie_t cookie) { struct regulator_bulk_data *bulk =3D data; =20 - bulk->ret =3D regulator_enable(bulk->consumer); + bulk->ret =3D regulator_enable_and_wait(bulk->consumer, ACCESS_PRIVATE(bu= lk, wait_us)); } =20 /** - * regulator_bulk_enable - enable multiple regulator consumers + * regulator_bulk_enable_and_wait - enable multiple regulator consumers and + * wait for time passed after regulators are + * actually enabled * * @num_consumers: Number of consumers * @consumers: Consumer data; clients are stored here. + * @wait_us: time to wait after regulators actually turned on; 0 to not wa= it * * This convenience API allows consumers to enable multiple regulator * clients in a single API call. If any consumers cannot be enabled * then any others that were enabled will be disabled again prior to * return. * + * If wait_us is greater than zero, then check that wait_us has passed sin= ce + * the regulators are _actually_ enabled before returning. + * * Return: 0 on success or a negative error number on failure. */ -int regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers) +int regulator_bulk_enable_and_wait(int num_consumers, + struct regulator_bulk_data *consumers, + unsigned int wait_us) { ASYNC_DOMAIN_EXCLUSIVE(async_domain); int i; int ret =3D 0; =20 for (i =3D 0; i < num_consumers; i++) { + ACCESS_PRIVATE(&consumers[i], wait_us) =3D wait_us; async_schedule_domain(regulator_bulk_enable_async, &consumers[i], &async_domain); } @@ -5441,7 +5531,7 @@ int regulator_bulk_enable(int num_consumers, =20 return ret; } -EXPORT_SYMBOL_GPL(regulator_bulk_enable); +EXPORT_SYMBOL_GPL(regulator_bulk_enable_and_wait); =20 /** * regulator_bulk_disable - disable multiple regulator consumers @@ -6243,6 +6333,15 @@ regulator_register(struct device *dev, goto del_cdev_and_bdev; } =20 + /* + * If no supply was given, then the last_on timestamp could not have + * been updated in regulator_resolve_supply(). Check it here. + */ + regulator_lock(rdev); + if (!rdev->supply_name && !rdev->last_on && _regulator_is_enabled(rdev) >= 0) + rdev->last_on =3D ktime_get_boottime(); + regulator_unlock(rdev); + rdev_init_debugfs(rdev); =20 /* try to resolve regulators coupling since a new one was registered */ diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/c= onsumer.h index 56fe2693d9b2..0b83acc015d4 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -145,6 +145,7 @@ struct regulator_bulk_data { =20 /* private: Internal use */ int ret; + unsigned int __private wait_us; }; =20 #if defined(CONFIG_REGULATOR) @@ -192,7 +193,7 @@ int devm_regulator_bulk_register_supply_alias(struct de= vice *dev, int num_id); =20 /* regulator output control and status */ -int __must_check regulator_enable(struct regulator *regulator); +int __must_check regulator_enable_and_wait(struct regulator *regulator, un= signed int wait_us); int regulator_disable(struct regulator *regulator); int regulator_force_disable(struct regulator *regulator); int regulator_is_enabled(struct regulator *regulator); @@ -209,8 +210,9 @@ int __must_check devm_regulator_bulk_get_const( struct device *dev, int num_consumers, const struct regulator_bulk_data *in_consumers, struct regulator_bulk_data **out_consumers); -int __must_check regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers); +int __must_check regulator_bulk_enable_and_wait(int num_consumers, + struct regulator_bulk_data *consumers, + unsigned int wait_us); int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers, const char * const *id); int regulator_bulk_disable(int num_consumers, @@ -410,7 +412,8 @@ static inline int devm_regulator_bulk_register_supply_a= lias(struct device *dev, return 0; } =20 -static inline int regulator_enable(struct regulator *regulator) +static inline int regulator_enable_and_wait(struct regulator *regulator, + unsigned int wait_us) { return 0; } @@ -457,8 +460,9 @@ static inline int devm_regulator_bulk_get_const( return 0; } =20 -static inline int regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers) +static inline int regulator_bulk_enable_and_wait(int num_consumers, + struct regulator_bulk_data *consumers, + unsigned int wait_us) { return 0; } @@ -676,6 +680,11 @@ regulator_is_equal(struct regulator *reg1, struct regu= lator *reg2) } #endif =20 +#define regulator_enable(regulator) regulator_enable_and_wait(regulator, 0) + +#define regulator_bulk_enable(num_consumers, consumers) \ + regulator_bulk_enable_and_wait(num_consumers, consumers, 0) + #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_REGULATOR) struct regulator *__must_check of_regulator_get(struct device *dev, struct device_node *node, diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/dri= ver.h index cc6ce709ec86..8a74aa681df3 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -658,6 +658,8 @@ struct regulator_dev { unsigned int constraints_pending:1; unsigned int is_switch:1; =20 + /* time when this regulator was enabled last time */ + ktime_t last_on; /* time when this regulator was disabled last time */ ktime_t last_off; int cached_err; --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 2AB1B46EF98 for ; Tue, 1 Sep 2026 07:49:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788248999; cv=none; b=ulN0NTtpOdEH+b2fUH3At2GmuwnnDvJvCQHX0tu8EkBT812jIJ98eUj3Jb0hZ9P4HfqZEtXBnoyMaL0ovw+BGfXqSHSmPaSQbtZiLOU0pDE0QOerdecxytQs0qvczSLz1/0OzMwmCQLgndp4GBEaNQC8YqK1/WklDWjK2+OmMqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788248999; c=relaxed/simple; bh=rlbm//2B5OdqBjqqr608z7OgF45U9aPq6hwy3/UJHTE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HMtGBqZKvDG30R4nnQtodH/bbOJU8ECVKI+UZuCSrhZFN6BbAXfYUMnyxXRTPPunYRJ9/atYYOwPCtoSk1rkCWLUHn2D/gf9smb25M9KNKx4pSQGbKa5pKE5iE6V/xe1MWtui72nTaa0JRP5KLRLwGT6D71A2qI/ClMX2KFvCUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=VBP/nchK; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VBP/nchK" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2d9201076b3so22916515ad.0 for ; Tue, 01 Sep 2026 00:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788248997; x=1788853797; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ppTKN+ViX0ps4m1x8WbWgM6kLhXVltmE87oNPgspGL0=; b=VBP/nchKDZDalaoDZl/c3b3OHY3d9H9nDT0Ay8vR+0iR1ALVod1jsqaIQNBBtzbhWJ DMKJdyyEGJu6HMQ1AsWQR18Afjekvsm2nTRKHXPTyuXgJ1akYTXyO+Rexjpef19azrzq D5jCSe0A+6GJu5CmP8ephOuFZNMJ4XzTFWp4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788248997; x=1788853797; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ppTKN+ViX0ps4m1x8WbWgM6kLhXVltmE87oNPgspGL0=; b=KmpezBa1aJEE5TuGL418VZMBBHVlUG2XT2juplMQezFlXfaDL0qaXelKeM2H/V2L8Z 0WnqA24ERgERfHzmWMRTpifcj72rFfzHsGbRJ/sDtMuV4PCPfyydr+OryodwYlGBsPt+ n/R7VtyVP/vqoi2S10XXmiNAGhnfIgn4j3z5YzWHh7Ycnf1moFGFgcGpVtybnFCRA/Qv 0nNtXB+gTqS1RrvfPAWXMNA+7MZhd1USFAL0/7Ay9luUDQYsX5x2WzFB2eSrAyP+dufw 0Snez1ki6WBVAS5Yvmn9svkv/Y5yZ3+7yx36DMbd/qiWp0/9WnH8nfN6u1kfV9QYkm1N nPkw== X-Forwarded-Encrypted: i=1; AKwUvBzJrQUO3ZDsJWemo/i8NuV5nvLfBVUXlvAl2JWSKBKcsHmNM2lemIFwQmDhSsFf8fTRGirGlAg5cFq4g1M=@vger.kernel.org X-Gm-Message-State: AFuF++mzhBPZQ3lvrJf07ddCiPbSPRbhMA2mvEbLDLohvUDD2l/ep45z IG1lMLzNemu9Vaj1TLpA2pJZ8R3guTOJlciAuGbD4HA045JgGvl6RLe27gJmbeC+LA== X-Gm-Gg: AYBFou0X7QUhRd5M7XkZsi0k0Y5qXJy5MuD5+NIRug3Ytx6dI6Qk42nMRGuzxZiU4Hu ewvjCgQmi9dJf6EqDd/592dOaleTXx32PgT508wKWCDO+ERwMyRoAlyvp9HoWv0+ZmoRymw1ccx Ixwel/JF+6xTijhD2n5a8zYptGPHbKQBmwJ+l/hiFtKZrsJ7vY1oGRV3fnFva8xCSqzo77Xnv+B Duz3HOYzGVzQvqoKfUtjad2LBdORkh7hEVKIvJppV8/7LE/nuCceEBdljyRkpvV5Bij4PQArAFP +hKTuUGXdkNOh44U1sXMxWZxo3gIzVx+5ELClTxw+Lg/PxtzVJNbjK3MNYOcDq9eT/SnccZUl27 BYy0boW6cCQ5RlmP77o+w5Bo7Fm2tb9ORx1yUEzcujvITNqPFVCxXqMbTOdbO1Ud+OWQecaahFI cJdBgknwqcfHo+zfQ3iQJoEEl2F2vRI/YJQo4Foeyeg7Vo64qWmCgYmXVaEGsxnR01X0TBvERuX cb93GmFVTcUhm12Y7Mc5obdCyUuG+lZOLA0FVOOECtrAUc= X-Received: by 2002:a17:903:3883:b0:2d9:216a:cdd3 with SMTP id d9443c01a7336-2d94a93609cmr90196685ad.18.1788248997383; Tue, 01 Sep 2026 00:49:57 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:49:56 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, stable+noautosel@kernel.org Subject: [PATCH v6 2/8] Input: elan_i2c - Wait for initialization after enabling regulator supply Date: Tue, 1 Sep 2026 15:49:20 +0800 Message-ID: <20260901074930.764550-3-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" Elan trackpad controllers require some delay after enabling power to the controller for the hardware and firmware to initialize: - 2ms for hardware initialization - 100ms for firmware initialization Until then, the hardware will not respond to I2C transfers. This was observed on the MT8173 Chromebooks after the regulator supply for the trackpad was changed to "not always on". Switch to the new regulator_enable_and_wait(). This makes sure that enough time has passed since the regulator was first enabled, satisfying the power sequencing delay requirement. This allows the delay to be skipped if the regulator supply was already enabled by some other part of the kernel, such as the I2C OF component prober. Fixes: 6696777c6506 ("Input: add driver for Elan I2C/SMbus touchpad") Cc: # needs new regulator API Signed-off-by: Chen-Yu Tsai --- Changes since v5: - Added noautosel tag Changes since v2: - Switched to new regulator_enable_and_wait() API Changes since v1: - Delay only if the regulator was previously disabled / turned off - Link to v1 https://lore.kernel.org/all/20241001093815.2481899-1-wenst@chromium.org/ --- drivers/input/mouse/elan_i2c_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan= _i2c_core.c index f5e505edbc33..4bbc6cef8be6 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include =20 @@ -47,6 +48,8 @@ #define ETP_FWIDTH_REDUCE 90 #define ETP_FINGER_WIDTH 15 #define ETP_RETRY_COUNT 3 +/* H/W init 2 ms + F/W init 100 ms w/ round up */ +#define ETP_POWER_ON_DELAY_US (110 * USEC_PER_MSEC) =20 /* quirks to control the device */ #define ETP_QUIRK_QUICK_WAKEUP BIT(0) @@ -1260,7 +1263,7 @@ static int elan_probe(struct i2c_client *client) if (IS_ERR(data->vcc)) return dev_err_probe(dev, PTR_ERR(data->vcc), "Failed to get 'vcc' regul= ator\n"); =20 - error =3D regulator_enable(data->vcc); + error =3D regulator_enable_and_wait(data->vcc, ETP_POWER_ON_DELAY_US); if (error) { dev_err(dev, "Failed to enable regulator: %d\n", error); return error; @@ -1416,7 +1419,7 @@ static int elan_resume(struct device *dev) int error; =20 if (!device_may_wakeup(dev)) { - error =3D regulator_enable(data->vcc); + error =3D regulator_enable_and_wait(data->vcc, ETP_POWER_ON_DELAY_US); if (error) { dev_err(dev, "error %d enabling regulator\n", error); goto err; --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 A1AF1470136 for ; Tue, 1 Sep 2026 07:50:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249003; cv=none; b=K3Djq1QQT+m1RBkDUEB4YkGIMG+kL9HZGMyBDVNC9JF9bs6VTaFmx1jJNrjwMaGXihLEb4DuVkozeqp0eBzZWFF3evxcbGb58AXma4RJaqyyxm3cBaTKm3ZiQM4tchHc0+9YqRulwj340ABqkWOpRyEVL4RkdRxtc+HbkW81+fY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249003; c=relaxed/simple; bh=KSh5c40N/ncjUkxNS2dUoSiZ9wDsl5oOe77nz1eIIdQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oJdnJe1mY91g0dZQVwxivq265iSua5+xJLPRjn8fJdRLaZDzUoWBNM7i0vSYdl/GB5rFKqFA1IJHRO16SeMfoEuAi46G39bD8s/NsEcOZBs7TXfwoOszht5vcf7r2rijFS+S58H8zTeEWrQ9oAJD/vEy+ZCEqwW1Hkl93Nz03lM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Lq846xDp; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Lq846xDp" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2d7200b2e15so47414895ad.3 for ; Tue, 01 Sep 2026 00:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788249001; x=1788853801; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wJzWbza2zag3QhFxPq/teShXqDf76npySrhO2+9Jdis=; b=Lq846xDp2aXhMzO0BQBk2BNWZI23Zq2slbPd+5IkCZNq59bQxrB1RfACIKZaPBzzoE 7LeWfaoFDZW0aL0f6gq6AIjS5ZIJX1FYRrBjDf5VpyRADYTZNYCuQPPJhWyzanlDJfkh gE89DdoSmckyYlvPRmQWRk4B/75Im9he7yJcM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788249001; x=1788853801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=wJzWbza2zag3QhFxPq/teShXqDf76npySrhO2+9Jdis=; b=OirjuL1VqZtYhXnttcm/pDE+Ak/QKbK4lUpsA2fwQMR8j01FaO2iqVkwbbP/g6tClN vdcdaoRcUKLeZaTsxFE7QPTGYihj5H2GfFWkk2V7FuK+U4Hv+DVdXYfxLAQsnK1yikHW Fmv3iqcj7OqaUajtxVAqwLVtmRrw73Ed9dhKWOVGzw0xdyxtpfu34qEn6yFf14jZFh8S 8ZTsF1777M7qDZ+dy1MfxRcZMuPJ/1fSVK558GytgPXM9AL39/OX5ihhe67dwdOPf5OT j69gBdFtjuwmH5I6o/+Fyt7cW6QoOY2B2YEJii6VBoGp6lgUNZPHlo7fPapdAE0qzSSy DAyA== X-Forwarded-Encrypted: i=1; AKwUvBx8EMDoRuGR/2Nu+/S9hiq+SVIdH86OPZ0072NlvydrKEMQZryjSngl1KZJ6jH4mRkacRi0YIX5wq1/uBE=@vger.kernel.org X-Gm-Message-State: AFuF++kiBpaPTGvxyNNGn5nG5icFIwnS7etepf7NozxjRdCm8z7F76rA IAESf0G0dsoXZ0MbJ9k5tonQHMnTfuHm20VLXu/cdR3QG4hz+X1P7gsMBaIY1dMnKQ== X-Gm-Gg: AYBFou0uIaYYpto2VSKt0sihQ+WUwwslu27l4fJ+hGr3X4j3ZdMOVZDOMJHUxqrSlFW 0ZDyFjptcexP7fNproZPM+fNkWYPs3OcBGa32InDphKlK77ZirgblaHuhdPDncUUpttmZZ6SuSG NoVqRFIlF/PYCYJEeX+NEf1tgvRvtgt6prTgclcFkzvx12RNHs0vHL9zPvqU6uTMQZ4DQfepjTp Xe4/jyQv08hZWJNTqg9otvDazWgBkk6EFJqjp7IcQj6wOXqXo3sZOm0n+IDU+xJd1DOFWNtKo/8 WCqGR/1HwOAQ1eZXddm57WoTbcUJkkQmICsIuOEq8wup/fxdy7+4irTUXyNF8jhz59RqKNML4uC NfwGj/36pGJH/jHtpHGPCs/xdYgqgLxV7nLQyRnD92qcej2utTUty7xwekuEQRq3OK/EFx2gkFr xyM/GfaMsDDrzWU2Zu5CaTa8FWny2jcqNOrcKA93E3cfQ1g/QP5De5YuVkHTGFBx27SmxUPuy9X JaMPwWgFYBrwd6Vu6JXI7QJ/uR0if5xL19yOIi6qtL4RQ== X-Received: by 2002:a17:903:3d0e:b0:2d8:d4d7:f055 with SMTP id d9443c01a7336-2d94a930d44mr91456335ad.22.1788249000970; Tue, 01 Sep 2026 00:50:00 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:50:00 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 3/8] HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long Date: Tue, 1 Sep 2026 15:49:21 +0800 Message-ID: <20260901074930.764550-4-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" On some devices the HID device is powered from an always-on power rail, or the power rail has been left on by either POR defaults or the bootloader. By the time the driver probes, the device most certainly has finished initializing. There is no need for the delay. In such designs, the system integrators tend to work around the delay to avoid the boot time penalty by simply omitting it from the device tree. This is undesired, as the device tree is not fully describing the hardware. Switch to the new regulator_bulk_enable_and_wait() function that makes sure a certain amount of time has passed since the regulator supplies were actually enabled. Signed-off-by: Chen-Yu Tsai --- Changes since v2: - Switched to new regulator_bulk_enable_and_wait() API --- drivers/hid/i2c-hid/i2c-hid-of.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid= -of.c index 59393d71ddb9..fdaad451e710 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of.c +++ b/drivers/hid/i2c-hid/i2c-hid-of.c @@ -29,6 +29,7 @@ #include #include #include +#include =20 #include "i2c-hid.h" =20 @@ -48,16 +49,14 @@ static int i2c_hid_of_power_up(struct i2chid_ops *ops) struct device *dev =3D &ihid_of->client->dev; int ret; =20 - ret =3D regulator_bulk_enable(ARRAY_SIZE(ihid_of->supplies), - ihid_of->supplies); + ret =3D regulator_bulk_enable_and_wait(ARRAY_SIZE(ihid_of->supplies), + ihid_of->supplies, + ihid_of->post_power_delay_ms * USEC_PER_MSEC); if (ret) { dev_warn(dev, "Failed to enable supplies: %d\n", ret); return ret; } =20 - if (ihid_of->post_power_delay_ms) - msleep(ihid_of->post_power_delay_ms); - gpiod_set_value_cansleep(ihid_of->reset_gpio, 0); if (ihid_of->post_reset_delay_ms) msleep(ihid_of->post_reset_delay_ms); --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 156FB470450 for ; Tue, 1 Sep 2026 07:50:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249006; cv=none; b=EicOsepRTYEp6fIzfSN9vVCRYWmpcDWHarC+AIjYny7PhzMZa48xTEsmGum2uWZtyLZOSUAu5WmzPzoCJJJduT50rdVd3lpvxHA/LZbNyJN4v/hWNo7Bpmq4F/kie+FQW91Ea1tlAYoZ1Q5Jv8CPvY2MLY8bYR++UhFZiBYuhVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249006; c=relaxed/simple; bh=SPcW+mZp0p9SXTvYafIM3g/Oq10MKnc+TqcPitNlh8Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KbVBVSrz4c0vpaQJ4wH/kpEEYTKt5d2vmba530VZBStFHjCkrfktK3+8ZLRY/h41W0cuztqRSERK4dyJHTGHvHFKf8tph2b68l123leOUBicp1uhUFkONDqbe9AIAQdwivj5Z97LLrXt1jSRVhu0FHZ69UFCIXzC1SssjNW7YYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Zr/ZDFJ3; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Zr/ZDFJ3" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2d944747d41so17065765ad.0 for ; Tue, 01 Sep 2026 00:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788249004; x=1788853804; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Lkkm1waPZ+HrT9oYZpgc7xZ9xBFanNK2vNiOpJD6Fs8=; b=Zr/ZDFJ33z6iPtyMTtb6LEYHj0DKmGGV7xYUfeiTEx1TN65aGbYzIn6Ngx3GZPMBvQ kj0GCrxvwIRzY5r04DMSTdmuRiWaGs01ehvy0ynLmhArjdZ0pOMXwePMKcFPMg9vJ6/t PqEIK4SyadtP2uOUd+VAOc+pBrpLA4rMXCUaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788249004; x=1788853804; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Lkkm1waPZ+HrT9oYZpgc7xZ9xBFanNK2vNiOpJD6Fs8=; b=ks4Zc6LtcwMj/H3iCsFfyVNQkb+/rkOJibB+9cQjGXHJWBKBrz0SOyfRmHHjeoDD4p Sx8Uv6tD+r7gwvdpOLQlpv0YOHjSBjqnyWadGMiZlvnb2gUxpP/KAbSDUF6+FDSkuLXL BNuK2d7tV40RrX+9MKC9SOgC4NygTN3ggeG7pjpYntgcpOHOCLD1DDzaudYwidMlbAHH UjsApHH4Rq569LoPWi8XSli/KoFjRxgJITmYDifCZKdIMsAlYwxSxr0hFFE0bCmXRPkk pvBYxTVdIL0DND6G33L4ZK+pIkMuco6R5pepmFGHcK9/QpDaAu8q/S8dGzeZeliBIK7M 564w== X-Forwarded-Encrypted: i=1; AKwUvByfmuzFZq5myUOWGzzZYLpypmzR7DPj6yXL5K31iJRQ3CQnJR06CnpsM/uvdlWGwBsyIDPpChnjYhN0/co=@vger.kernel.org X-Gm-Message-State: AFuF++lZOJDoe0LdSCJ/HnPwcy3ZHInrZ1F6gfrLyDykdhyut2f6vf4B Rjgcd1rBr7QKJfuTxH31vzKv6ezJG/ioCt0MdT+ljWM/kcyCZWZpb+oi5ZTVKlADvg== X-Gm-Gg: AYBFou33xIfUGf4xexC9eEdN3/mZrJuF/FU8Jon1V3cqNRe0zvGzB8tGcbXRgWFoOix aa2niNip81lkR8Cwi5RjcBwl29rUA7xJr6p0loz+3A3x1W2qMgvt1dhJ9FLJoh0E3AA/1T4GL+G omGKT3DR1md4RC8J/9cBSTDUWUEPZNiehht0x+joceQIsNZCbsJmXwM1OWAFVkJr68HMANDySv0 QBEfTyAGrJZa4xhbsboTOsA5scYAak+1Qb5L09MVKyf4wLXHwxi0VrnsdXAoPE7/YJXKSPH56DV AWi6et/iGVAlZT8MXHG6nvOczHGuW1xkFJ/EZQQE06tZkBB46mIjJAGuoUCuZi7r0UshhPTwol2 lC/573s3yRDIDRgasaJXhlVOxhtLD4p7c9tGVdapiZMsnXyJhpW03OKMKJxW9P5yZNAiEuRaLa3 DLYYVa890PyV4JzhXKYNo3A9NIQdVcCF5AfWxYpmH0mKXuIqc7FawGueFzCco3ZQkE+1cXjUmyo UnOkwqTCictpMQRhyG3cyfU7dcgIwQrwtKmwMqy0q5Fzg== X-Received: by 2002:a17:903:3d0f:b0:2d8:d4ce:7e3b with SMTP id d9443c01a7336-2d95d5fc28amr40543015ad.16.1788249004522; Tue, 01 Sep 2026 00:50:04 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:50:04 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 4/8] i2c: of-prober: skip post-power-on delay if powered on sufficiently long Date: Tue, 1 Sep 2026 15:49:22 +0800 Message-ID: <20260901074930.764550-5-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" On some devices the I2C component is powered from an always-on power rail, or the power rail has been left on by either POR defaults or the bootloader. By the time the prober probes the device, the device most certainly has finished initializing and can respond. There is no need for the delay. In such designs, the system integrators tend to work around the delay to avoid the boot time penalty by simply omitting it from the device tree and the component prober. This is undesired, as the device tree is not fully describing the hardware. Switch to the new regulator_enable_and_wait() function that makes sure a certain amount of time has passed since the regulator supply was actually enabled. Signed-off-by: Chen-Yu Tsai --- Changes since v2: - Switched to new regulator_enable_and_wait() API --- drivers/i2c/i2c-core-of-prober.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/i2c-core-of-prober.c b/drivers/i2c/i2c-core-of-pro= ber.c index 6a82b03809d4..f9f3c0ef93ff 100644 --- a/drivers/i2c/i2c-core-of-prober.c +++ b/drivers/i2c/i2c-core-of-prober.c @@ -18,6 +18,7 @@ #include #include #include +#include =20 /* * Some devices, such as Google Hana Chromebooks, are produced by multiple @@ -226,13 +227,11 @@ static int i2c_of_probe_simple_enable_regulator(struc= t device *dev, struct i2c_o =20 dev_dbg(dev, "Enabling regulator supply \"%s\"\n", ctx->opts->supply_name= ); =20 - ret =3D regulator_enable(ctx->supply); + ret =3D regulator_enable_and_wait(ctx->supply, + ctx->opts->post_power_on_delay_ms * USEC_PER_MSEC); if (ret) return ret; =20 - if (ctx->opts->post_power_on_delay_ms) - msleep(ctx->opts->post_power_on_delay_ms); - return 0; } =20 --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 0294F470EB0 for ; Tue, 1 Sep 2026 07:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249010; cv=none; b=EU8TCPV/i5u8VtsqOgbYXMEINgwGY8mDIL5Kfpbhj+dNlfCagmQpmX7Dl1fpKGyzRWzdNWmPEVibbgyZNu2E6IVuJ3Zj3WSsQX8XYB9LzWkdFP8glGL4/D9s+HJo6+kiiVJOOoO69sFyaLKVkUJKj4H/EJgNHCpjlBQl8pnPj9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249010; c=relaxed/simple; bh=6ab1wCEQP5zPcBfT0PBKodK0oU1IQzXD1fGtvF3pHJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s8rp5PmXqD+3EQS/PAixeUNjVD/PS8E5tcFYEbDKLNr4uvfdWGUpO4LbmM0uWqQfiIHYT9+LYhZXc9K4lUTmP00260JIxOmAM9iWSS4YRUe50Vh6FCmPL1qYzYLGy/4vo3VRopCqo7oqpX/lypGjj8J+cqnVMfgCPQnnIjFC2L8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=GrVLjJRT; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GrVLjJRT" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2d9520b9155so5951125ad.3 for ; Tue, 01 Sep 2026 00:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788249008; x=1788853808; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=377z9agroO9vgw/MPipyApHAj2rPTrxxSFp/0FEh+cY=; b=GrVLjJRTUdU/jzM1vH5Wt5/vZikPdp2veR7YQ4ZPfhm11Vzid1cb2wpTIFi7MV+pW0 5P1nWbZ6I1p2r/lAKYLDXRCcfqoA2dSYcVjDmbl+AXMitvMzAjOgIVvdCXZXJBa8LKaG 7j+G0INHwm6iHmVC1S13o+0u1QLKzbg4eGtac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788249008; x=1788853808; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=377z9agroO9vgw/MPipyApHAj2rPTrxxSFp/0FEh+cY=; b=oOMI8CHANQ03o0ZBtYF5b1Y4LS1Ip5DU+jv59koCMXfhWM1tH45+bOIGCK+vHZ+Ii3 SNzart0E7VByNfQS65VvLQJHTtCeufIFxCpPxTmyyO3l4Pd8foJnfSS9oWZSE/t2uFm9 FIavgLqV1tBYqbzwt3WZ52MKbNtb1Z7eE1YlfVBvkhR2TvfsSo34OrmIlzUIp2CzLwug 4nWGEP6kyBeJheKBgCbGEeiSZDiI9qmM2rMAB4IWTvPtmso8DsWyct1FoKlmZIYRrhv1 2F0hSc8MheM9FSMq1IW50ki9BPD+VdEbHtgcmQr86Q47vGge987/JUZmHKoJnSz2lCSc FNbA== X-Forwarded-Encrypted: i=1; AKwUvBywZHKYDjXjMRiwlVZ9K15Jyn2Mb5ulAYukbuGiyWQfW0qPsUXAGejN1wPkNwg8fvmhqslVfzV/7C2l8ZM=@vger.kernel.org X-Gm-Message-State: AFuF++kf5/3TbTGo4UhbbZQELOzfczjILgNHwZcxUUK7rd/DKOSoijRG XgGD21GGtlvQwUhgLH05s6AV2vMffsqFW1jnaQw+5utc0iTr6nUNVblWMMQ6hBuadA== X-Gm-Gg: AYBFou3NFKM0nirDe6B5ruLuuFCV6qjZ3KoFGWnKcJoCigoE5uKIJi+pg9Mt09h6Fu4 wIe733QZQxyQnI2Eygc+ALqq4exIxRpVN0vr9YCqhN4sRLE7400bUP+HvKJnUUbpiuQXBpKO6aW JMd1reddIpgawud7rgSp4JEuRI356bIsw5tp7wA9b/RpA9PEcUXcDJBLDi38O9WAseDk+2GBf5R IRsrQmmDQvsiKU4RWStVIcTOBZMWkSie+Xcqf/CX/KM3ncgf5Xj7SlBkMU0nX03uGN5r5cpD1qr guGg9m3ZWTFn9UkriaPoIfvIMphhH2dQXLd4DmEwkoCvZ17foLxoO4u6PEholbDV15V3ydYa1hO 89CuNDLDlRsHw/MXcekHek3+6VGCiRuDDpGe/cpR869tYdbKpK9D1v50lSiy2WdC+84pzICGPHC pwXZ1VGYsrtzMjJwVI+XpBtRWX/XlNC/4n9PFm96uYmIIn622CVfY8onIoOuRN5FRx3l5Muggii K45IsaFJRHe2upVog5xG5nKR2DFfTDOhfVmGEuPMFhyIQ== X-Received: by 2002:a17:902:ef52:b0:2d9:383a:30f1 with SMTP id d9443c01a7336-2d9383a326bmr139940935ad.4.1788249008298; Tue, 01 Sep 2026 00:50:08 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:50:07 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 5/8] i2c: of-prober: Let cleanup op know if a device was found Date: Tue, 1 Sep 2026 15:49:23 +0800 Message-ID: <20260901074930.764550-6-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" The prober's cleanup op may want to do things differently if a device was found, such as wait for the actual device driver to pick up resources. Add a parameter to the cleanup op to pass this information in. Also fix up an incorrect reference in i2c_of_probe_ops's kernel-doc. Signed-off-by: Chen-Yu Tsai --- Changes since v5: - New patch --- drivers/i2c/i2c-core-of-prober.c | 8 ++++++-- include/linux/i2c-of-prober.h | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/i2c-core-of-prober.c b/drivers/i2c/i2c-core-of-pro= ber.c index f9f3c0ef93ff..97ef58bb4c04 100644 --- a/drivers/i2c/i2c-core-of-prober.c +++ b/drivers/i2c/i2c-core-of-prober.c @@ -130,6 +130,7 @@ int i2c_of_probe_component(struct device *dev, const st= ruct i2c_of_probe_cfg *cf const struct i2c_of_probe_ops *ops; const char *type; struct i2c_adapter *i2c; + bool device_found; int ret; =20 ops =3D cfg->ops ?: &i2c_of_probe_dummy_ops; @@ -159,6 +160,7 @@ int i2c_of_probe_component(struct device *dev, const st= ruct i2c_of_probe_cfg *cf if (ret) goto out_put_i2c_adapter; =20 + device_found =3D false; for_each_child_of_node_with_prefix(i2c_node, node, type) { union i2c_smbus_data data; u32 addr; @@ -171,12 +173,13 @@ int i2c_of_probe_component(struct device *dev, const = struct i2c_of_probe_cfg *cf /* Found a device that is responding */ if (ops->cleanup_early) ops->cleanup_early(dev, ctx); + device_found =3D true; ret =3D i2c_of_probe_enable_node(dev, node); break; } =20 if (ops->cleanup) - ops->cleanup(dev, ctx); + ops->cleanup(dev, ctx, device_found && !ret); out_put_i2c_adapter: i2c_put_adapter(i2c); =20 @@ -388,12 +391,13 @@ EXPORT_SYMBOL_NS_GPL(i2c_of_probe_simple_cleanup_earl= y, "I2C_OF_PROBER"); * i2c_of_probe_simple_cleanup - Clean up and release resources for I2C OF= prober simple helpers * @dev: Pointer to the &struct device of the caller, only used for dev_pr= intk() messages * @data: Pointer to &struct i2c_of_probe_simple_ctx helper context. + * @device_enabled: True if a device was found and enabled. * * * If a GPIO line was found and not yet released, set its value to the o= pposite of that * set in i2c_of_probe_simple_enable() and release it. * * If a regulator supply was found, disable that regulator and release i= t. */ -void i2c_of_probe_simple_cleanup(struct device *dev, void *data) +void i2c_of_probe_simple_cleanup(struct device *dev, void *data, bool devi= ce_enabled) { struct i2c_of_probe_simple_ctx *ctx =3D data; =20 diff --git a/include/linux/i2c-of-prober.h b/include/linux/i2c-of-prober.h index bb6d47f50ee5..f28a40780d1f 100644 --- a/include/linux/i2c-of-prober.h +++ b/include/linux/i2c-of-prober.h @@ -45,7 +45,7 @@ struct i2c_of_probe_ops { * * Only called if a matching component is actually found. If none are fou= nd, * resources that would have been released in this callback should be rel= eased in - * @free_resourcs_late instead. + * @cleanup instead. */ void (*cleanup_early)(struct device *dev, void *data); =20 @@ -53,8 +53,9 @@ struct i2c_of_probe_ops { * @cleanup: Opposite of @enable to balance refcounts and free resources = after probing. * * Should check if resources were already freed by @cleanup_early. + * |device_enabled| is true is a component was found and was enabled. */ - void (*cleanup)(struct device *dev, void *data); + void (*cleanup)(struct device *dev, void *data, bool device_enabled); }; =20 /** @@ -131,7 +132,7 @@ struct i2c_of_probe_simple_ctx { =20 int i2c_of_probe_simple_enable(struct device *dev, struct device_node *bus= _node, void *data); void i2c_of_probe_simple_cleanup_early(struct device *dev, void *data); -void i2c_of_probe_simple_cleanup(struct device *dev, void *data); +void i2c_of_probe_simple_cleanup(struct device *dev, void *data, bool devi= ce_enabled); =20 extern struct i2c_of_probe_ops i2c_of_probe_simple_ops; =20 --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 95BDA47124C for ; Tue, 1 Sep 2026 07:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249014; cv=none; b=BYUcoDLdwCHBUop9+XqM8l8AMc1OtYnkbV5djGRvwarwYgg0AJBKAHocxzBo7bkAc9ycvt1smhQqcp16rGM4hYtvANCKoKXRk9rgKWnQo1MabjISy1yyFRZFZmAhnPAJlAjip0WOAhAJqda376aBEBGNtNtk9SVmZLh1vLao5M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249014; c=relaxed/simple; bh=pi+LmqXIY9yJrLb+q4YTgitdGHvgUDFnXpm0aWGBEfY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fTvifK+9+iwd/awqZmXI2b7zXfV7AE9fWjDS7f3PnO5SCxKAxyRa/xe+9cMUGrpF9Dvlzfrb2qZQ37BWulK7a+pOK/xbLw/vpDkJ4mZfo0x5PXpfjvSzcM/QxfwFFBfW5Ug5OzU/+6HNZN/E5jWzuVhUGTY9ubY8BO8LAS06v2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=KHtxbtec; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KHtxbtec" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2ce98cb8165so8154095ad.1 for ; Tue, 01 Sep 2026 00:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788249012; x=1788853812; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wWs+YupxZ44ht1HfvkGhk8oEQeiiBAO5zBbFEZpHIfw=; b=KHtxbtecrHGyH+XwE+ribIyy5vwWhnwwS4g1x+nyBhn6vn76S1VBsV/WYVT6tXK9xS zPNOWw0nbXgkVF+PTMzKdDHISatwhwCY+Fnt5ermYtlHvSz5pYj9jRioCal1K2RrkU+o PDPR4xW2b+5vux1dCjEDPGy1oR4w4hvmQUOHs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788249012; x=1788853812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=wWs+YupxZ44ht1HfvkGhk8oEQeiiBAO5zBbFEZpHIfw=; b=bxhAL2SwtIwpWZYiE23ymi9M85BxCpB9A6wnWynighWZoLcah8RF7HNxsF4YhZGzqY m+Jktgh585hofeLRNRqyH4R7N+JFrNl79IYXY9B/D26H/+UHXG3aH7pPhkKdY+J+hM5k T1RoRIds3+7RCHbXzsDEfUCmU69VwF1wRABleqdAfq7i5VXxRbLaiioNMHFp/GPUb+w8 jcGagEODsnm5J7wEuuiNvZp3JAqaoxrklL44JzDml/iTfmwgKxk/15vpDO2sYSjQ1XNf teWxSCEP+rl1W/oBLb8xkQ2Oynso3DfmSaeUm/KY60KA1b2iRNYHFp/GhD4iH+IbecMu DtVA== X-Forwarded-Encrypted: i=1; AKwUvByZw9hmTM1Fn5NGvZktijo6t6Z0wDXTO5pyWw2qH/uSneccflf6wWfkUdDEQoeDj8i/xwSULXNfJmFLSQI=@vger.kernel.org X-Gm-Message-State: AFuF++kds5Uw2FhBJ7zSf0r1G3UQz+WMVzvrhSTT95USiI5sCg3EqUEr aUVcUMxYliQheYiSOiyvvA5Ko3yv7st1D6f2KGtkGmawAHVHnNMZe6qvAixghxyAkQ== X-Gm-Gg: AYBFou1aGRZJADYihR1ccxMO3VTcbFD/7w7TF+M84LU6FaoVOfDAlRHjXEtLwP6/36A 7CkbXU2P+APzV9xFPsIjCixJRKSOfb1QZ9B7/01SSzn+9UxQKlAWU41fGuhYfGGUPMc2t3Wxbt5 IheeLLCzZtoPDCYcq0qVQiebP2I7E9IhOuf89k1ugfaFt/PCDyH3geOYKN/bfOMEvIW7BotE8Yt Q1m8CnAyPlC96Ajxjl/h8LecP2E65diLAq2gLyMxT7U0ffSYS55C3ncKnnS2F6XTjDwlwLzD+yW rfWgOkL7aTAFS0Ssk+QmxAgFPga0akpHwHPPMe9gdbnu2FbGHVuPbzhSdgtTS4LYXUKauq3IjLx dakgvpyOr5yggj6FQd9VRHcSa748ZuLkMamfidl+howQ/PTvTyF2Ur3LupQxPLk3XTJm2fmEC14 IdzVYG+lVACND0yu9ZifGUWriJgsaaGbtmgMNgl3HSMOt+I5cJEHOloq45TJKmUEPkVznEMN9ww q+W73EClvKn8/7eJSBVZ16Rp5sbUzqBEeV/Z4RHuGxBeQ== X-Received: by 2002:a17:902:e747:b0:2d7:1b20:e98f with SMTP id d9443c01a7336-2d952687ef9mr35651975ad.2.1788249012058; Tue, 01 Sep 2026 00:50:12 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:50:11 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 6/8] i2c: of-prober: Defer regulator_disable() on successful probe in simple helper Date: Tue, 1 Sep 2026 15:49:24 +0800 Message-ID: <20260901074930.764550-7-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" When a I2C component is found, it's device node is immediately enabled. This triggers device creation and driver binding. The prober will hold the regulator enable reference across this part. If the driver probes synchronously, then it happens within this window. On the other hand, if the driver probes asynchronously, there is high chance that it happens after the prober's cleanup function was called, in which case the regulator would have been disabled when the driver's probe function is called. This would then require the driver to wait 100 ms for the hardware to reinitialize, even if the probe function was just a split second late and the regulator was disabled a few milliseconds ago. Recently, some of the drivers for the component that are targeted by the I2C OF component prober gained the ability to skip waiting for hardware initialization if the regulator was left enabled. This happens when the PMIC has them on by default, or if the component prober left them on after probing the component. Tests on the Hana Chromebook showed that if the prober and trackpad drivers are both builtin, then the time between the prober enabling the device node and the trackpad driver asynchronously probing is between 5 ms and 30 ms, though sometimes there are outliers exceeding 100 ms. Wait 100 ms before dropping the enable refcount on our end so that the actual driver has the opportunity to catch and increase the refcount on their end. Signed-off-by: Chen-Yu Tsai --- Changes since v5: - Only defer regulator disable if a device was found Changes since v3: - Added commit message section showing average delay needed --- drivers/i2c/i2c-core-of-prober.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/i2c-core-of-prober.c b/drivers/i2c/i2c-core-of-pro= ber.c index 97ef58bb4c04..f52ab3f54933 100644 --- a/drivers/i2c/i2c-core-of-prober.c +++ b/drivers/i2c/i2c-core-of-prober.c @@ -238,11 +238,23 @@ static int i2c_of_probe_simple_enable_regulator(struc= t device *dev, struct i2c_o return 0; } =20 -static void i2c_of_probe_simple_disable_regulator(struct device *dev, stru= ct i2c_of_probe_simple_ctx *ctx) +static void i2c_of_probe_simple_disable_regulator(struct device *dev, + struct i2c_of_probe_simple_ctx *ctx, + bool defer_disable) { if (!ctx->supply) return; =20 + /* + * Wait a bit of time for async drivers to probe and increase the + * regulator enable count. This allows the drivers to check and + * skip waiting for re-initialization. + */ + if (defer_disable) { + dev_dbg(dev, "Deferring regulator disable\n"); + msleep(100); + } + dev_dbg(dev, "Disabling regulator supply \"%s\"\n", ctx->opts->supply_nam= e); =20 regulator_disable(ctx->supply); @@ -359,7 +371,7 @@ int i2c_of_probe_simple_enable(struct device *dev, stru= ct device_node *bus_node, return 0; =20 out_disable_regulator: - i2c_of_probe_simple_disable_regulator(dev, ctx); + i2c_of_probe_simple_disable_regulator(dev, ctx, false); out_put_gpiod: i2c_of_probe_simple_put_gpiod(ctx); out_put_supply: @@ -405,7 +417,8 @@ void i2c_of_probe_simple_cleanup(struct device *dev, vo= id *data, bool device_ena i2c_of_probe_simple_disable_gpio(dev, ctx); i2c_of_probe_simple_put_gpiod(ctx); =20 - i2c_of_probe_simple_disable_regulator(dev, ctx); + /* defer regulator disable if another device driver could enable it in ti= me */ + i2c_of_probe_simple_disable_regulator(dev, ctx, device_enabled); i2c_of_probe_simple_put_supply(ctx); } EXPORT_SYMBOL_NS_GPL(i2c_of_probe_simple_cleanup, "I2C_OF_PROBER"); --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 75CCE3A168C for ; Tue, 1 Sep 2026 07:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249017; cv=none; b=loqmI412nd0AD1pMM9kTiVdLsBT1BK03UxprJa/GxgowfqfrOFqf3Ny03KRLuhZv3eHNggNx8u0RjrqreyB5WRr9QyQuMGMainNHitG/d0BDTL2ZornFgzo4WhZ6fd1GN25dvILqXoBEquk+vWZgUlMia6euRxVFSwr1IBFenCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249017; c=relaxed/simple; bh=389GhFdcHXE9CQfcu38KBKyKduXJD5XyKzkLeecuPRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KK1Bhpho2ZV1E/tkC8T+qh7lihQ/hPd2TgAjMoBVYAcXmoTKhS+bsDKVvJ8O1wQBaTolkM9sT1PpOZRr7H24UE2pBXAn32EY3kYBpyZMCRlLfiUl7j0uYGevuIncMaporF2guy4Yo0vKHyn8GQyLaROHmdygHN1QTFghF3cQ5L4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Tg8AePCp; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Tg8AePCp" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2d942c7cc2fso5203935ad.3 for ; Tue, 01 Sep 2026 00:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788249016; x=1788853816; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2khEECovfca18HsEnd2rATuHpO1VYqgGWGgT+k6yyKQ=; b=Tg8AePCpbOf6MvGlVsF35P4pqva7iJ4KwHIrmJrV3QsjGo0UwxXn+fcyFCqdF6f9I9 kVFUq5VZHKNeLfhOLpjf10Jh/h3/d+5x7Y/zRmgHqNi6TaETa8RnTqiS/r7DyAujX2IE 1OFOpgZ2yye9wHV3151nWzihuaPdiBcVcPhpk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788249016; x=1788853816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=2khEECovfca18HsEnd2rATuHpO1VYqgGWGgT+k6yyKQ=; b=BHQ8afox5j1pjJitr4DtJ7g6mnDIftK54v8E5192ke96jqH21SE0a0T51pVYtQtYqu rJih6wqkDUSR60b6CnTEzpG+tGjvGl/fm/tVvz+upWyOD4aeCklzRbssiqIA8j2uyP5d 5ghAluLeyyYx7GK/X1HFWhWIESKixBsNvjyDGf66oQBG5FYV7d+0u1KAHkxtmK6c//VT k5XqhzbU4/SwGkUemetNYqrbuuCYM4aerSf01fus4/yfvLSmCfoa0pOUY2BccW/Rd4He PYtmV3jfbm1d4Dxcn2h9/f+DYqO4xUbwhyqq35hlL1HbRnn2InYmP6j7P2yQ00DVX7K9 TE9w== X-Forwarded-Encrypted: i=1; AHgh+RoGLEEEX+IVr6hJMG0beeepoJI3Uabm4wBrsomNchb/fHZjkPo6IBrvvCx3xQopaE1codMI8yygErQCzjg=@vger.kernel.org X-Gm-Message-State: AFuF++l8RjS42CFJzLbUX020s7rde08kWHzS0yBL8SxL/NKJ2uK8ChzK sq3u9iEM1BUzHzPdQjXP6PLinTVjl9OA9xdv9EGQ5ZNHES8ZazKWPkQwA1r784PdBg== X-Gm-Gg: AYBFou3Hb5H6pWdtBPycijpLStn3S6wK7rnL45VI9G3tpnlbo5ZYcYOeBboFY4rs6mk XZgJ2BQPyIkzeoQUQN63/LTdyPaeFGz04yvcO615l8j33mzqPmC0iyyCgN6wThmqTDPaKqhKFyo OWQk3eo13nYePNl2azztiUQV3MQZJfoFclsq8BIz+tu0iYO0P3x5l7ozhds8N1wY8LbhdsCoaGp krjlAZ26A+flqUpYCV/ek3FuzY59pm8wIJqLicO/xMyNdqFGLODxzY7td/u0vgdNXOmi5f2MK8X 3r+hkbf7114Py1j929R0JAzEEPKWxSDAq9kJo7+BbSYOhw77I/8mhUf8mh4P++izC/H4qbkTv4F kfH/wup26V5KR0mvwOZemBZMoJv3FqSacdJU68TV0kTZDN4R65W2/uDqQzTnG4Eg74pZQ8kh2lh LkL82eNbNIG9UIIRa4/9XKkBLOovvKH647GHbD3v51pje6ZN05t+CFJCCOnyVZ1QCvAdUbVtlpR vSx7fJm8sfgZMz2ThEus0ZGNw5QRiCMy2osw1CtaI9oBg== X-Received: by 2002:a17:903:324c:b0:2c2:62ee:5a0d with SMTP id d9443c01a7336-2d74df1c634mr532551805ad.14.1788249015708; Tue, 01 Sep 2026 00:50:15 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:50:15 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, stable+noautosel@kernel.org Subject: [PATCH v6 7/8] arm64: dts: mediatek: mt8173-elm-hana: Unmark trackpad supply as always-on Date: Tue, 1 Sep 2026 15:49:25 +0800 Message-ID: <20260901074930.764550-8-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" Up until now, the MT8173 elm/hana device tree has set the dedicated regulator supplying the trackpad as always-on, simply because the Elan driver was missing proper delays. As a result the delay for the Synaptics trackpad was also omitted, as it was not strictly required under such a model and delayed the availability of the trackpad to the user. The Elan driver recently gained proper delays after power up, with opportunistic skipping of the delay when the regulator was originally on. The I2C HID driver gained similar opportunistic delay skipping. So has the I2C OF component prober library. Now fix the device tree to have the regulator not be always on, and let the I2C HID device have the correct post-power-on delay time. Cc: # needs matching driver changes Signed-off-by: Chen-Yu Tsai --- Changes since v5: - Added noautosel tag --- arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi | 8 +------- arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi b/arch/arm64= /boot/dts/mediatek/mt8173-elm-hana.dtsi index 1004eb8ea52c..b9e311fcd9a0 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtsi @@ -62,13 +62,7 @@ trackpad2: trackpad@2c { pinctrl-0 =3D <&trackpad_irq>; reg =3D <0x2c>; hid-descr-addr =3D <0x0020>; - /* - * The trackpad needs a post-power-on delay of 100ms, - * but at time of writing, the power supply for it on - * this board is always on. The delay is therefore not - * added to avoid impacting the readiness of the - * trackpad. - */ + post-power-on-delay-ms =3D <100>; vdd-supply =3D <&mt6397_vgp6_reg>; wakeup-source; status =3D "fail-needs-probe"; diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi b/arch/arm64/boot= /dts/mediatek/mt8173-elm.dtsi index a0573bc359fb..6b9f47f515c7 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi @@ -1093,7 +1093,6 @@ mt6397_vgp6_reg: ldo_vgp6 { regulator-min-microvolt =3D <3300000>; regulator-max-microvolt =3D <3300000>; regulator-enable-ramp-delay =3D <218>; - regulator-always-on; }; =20 mt6397_vibr_reg: ldo_vibr { --=20 2.55.0.897.gb25b4bd76c-goog From nobody Sat Sep 26 13:08:31 2026 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 08B39471CF5 for ; Tue, 1 Sep 2026 07:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249023; cv=none; b=hcKNNrioqoGoq9A2oMdkbCW/byb174NTqkKlu/rVqI8dutyIqK9V25FAOz4ZGuxZRvKC8Y0yVJFoouLNG92WnAf12AXC4/vz/SKVSCBM/pcy2s2SdJFDA+/fv6PTnyAjmtZdImAxOr2+MHY9cH+K4swBHDq2HmzKiymnNM4tRBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249023; c=relaxed/simple; bh=/rbvHcyLFzkOkhdGFkadotpTkB6WTk/HoLFqLifD8i0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WTV70wwFuX3f9ylb1/w2IAs6iP8IlirRH1dHKdL4enfXRu1uG3oC1ut+GCnc7GwyvEKLNVFUT+76OXagyBjDSqI4rOcoNQSnHMEzztoUe/HvC01nReHyRGW3RUW+Is5f+Kw4QJvOUz8l/lWmHWshLf4S4n8SXivbUyh2wgP+9CQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=M7oa4Oh5; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="M7oa4Oh5" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2d715f4a587so8231175ad.2 for ; Tue, 01 Sep 2026 00:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1788249021; x=1788853821; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3ehsC4fkcGYgZxU5YfTTtJEKH9Dtw/4IjhfNmBesfrM=; b=M7oa4Oh5JLb12LGDew9uMpM0cJ3sj6tPtJks2pmho0j2NlD/gc4quOMjE9GngiEICU 3wnNYCJWJuS41IGV8YksgZDr+hdc7WmVHt2P3xsd4jlCneumQey5pSJBGioxfMkic1yB wr3mxw+YYCPWyqzErw7dSeR4zXwkjNgGLl0UE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788249021; x=1788853821; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=3ehsC4fkcGYgZxU5YfTTtJEKH9Dtw/4IjhfNmBesfrM=; b=C9Q6gxSKpfl2bSxy7184NvR3t/LxBS0hGHc71dpQzGUi+ltAgPfikr24VHyzAsBZcv CDe07ZKWetPhX0dzyPOhoD2xC8guYHhBKbqvXSKFZHTg/gnY2544Kpkj933V8EfHtoD6 rjtHWtzyMHgXym0fBO4Q3DR/WWHT29ykxWdcfAVytpR7eK8krf8l6x1TnLaG1HmbQljd lRwkrmmQd5nGG3q+WUa5ibU8fgz/DMeCaoWEANC57Ifr8fKEIrEqKdSJUy/TkB8t2oPd Ra2Levvzg6ZFKTfTYSN5cxrWMVV+q2cHXP28x27y9FSEbnStbjj+sDGoXi+4PNoPm7bq rEMw== X-Forwarded-Encrypted: i=1; AHgh+RqI38yzDIQCT62qSPuppmk/uuOwUSiNr2Rayc+Lk0UANaVAkHBrlc5cM9cRIdPRSWoXAsLMBXEUIhpq6f0=@vger.kernel.org X-Gm-Message-State: AFuF++nX4S3geufPiLtRMrOtKvqgCTUSpbhzKag7Xz5Z0XIWJLFxZMgS KUZInyVf6jnLYBv2gdoKOV4fZ+ACSv8dx7crdNlSq/Y6m68rkxjodP4fqp2K9pVVCA== X-Gm-Gg: AYBFou1A5V6X9k9U/qLtMTSsxNJe3TnrABKadhspMOEQx4jh5dEbtMJu4WwNhJ7LmmI ckGaRyIQZ4g17cj3UoDnp+l5wheU3PPTFBzN0GPCpK5RFI/iFDfX4bcq8XGOAy1R4qhtayNXjZM 7mnq8/ZE83WhPinwcT+EZD3pRc7rDOEi9z/t2m5gpEpxTVFwRwMfPQFIVEDP3DGrzGcW6kFfhIU LVw1hYmTctyf/FNqE8wDburGHlvVx9nbxE6m6DdDaeiqnFEvCcoUdsHw9ssfq4iYC0QzdtV8ZuQ cOIudhGPu0xsasSSKzDf0Fxr5n9pLxStyMq3xVsbkya/sYAvBIUdLl1/yVG+pkVelSGXBvTUP/G UwKoKspEpcn652WHnki93L6AIa9JD3d21CDVOz8RZjmE2ms+j1GbKYplvJ4owzgq6Px/Ven5qDj hTyKxJt56nG7G900FH2xXynkHTOD9hObGUklc4+pOs335I5pebqugclhhC3LjyM+4MZXk38D7f/ NJQhadtophwntsdn/kdI9Gup7iwnqfFRAnd6k6fiOjfU3w= X-Received: by 2002:a17:902:f791:b0:2d9:1dee:43db with SMTP id d9443c01a7336-2d91dee456dmr196089085ad.15.1788249019467; Tue, 01 Sep 2026 00:50:19 -0700 (PDT) Received: from wenst-7875.tpe.corp.google.com ([2a00:79e0:201d:8:8cf:6df0:9c4e:f5e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d75988b699sm48142515ad.59.2026.09.01.00.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 00:50:19 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , Benson Leung , Tzung-Bi Shih , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, stable+noautosel@kernel.org Subject: [PATCH v6 8/8] arm64: dts: mediatek: mt8192-asurada-spherion: Add Synaptics trackpad's supply Date: Tue, 1 Sep 2026 15:49:26 +0800 Message-ID: <20260901074930.764550-9-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260901074930.764550-1-wenst@chromium.org> References: <20260901074930.764550-1-wenst@chromium.org> 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 Content-Type: text/plain; charset="utf-8" The Synaptics trackpad, like the Elan trackpad option, is fed from the system 3.3V power rail. Add it to the trackpad device node. Also add the correct post-power-on delay, even though in practice it is not required. The Synaptics trackpad requires 100ms after power-on (or deasserting the reset, whichever comes later) to fully initialize. The power is always on and the reset pin is not routed out, so the implementation could try skipping the delay. Cc: # Without driver changes only lengthens p= robe time Fixes: 925ebc0cd55c ("arm64: dts: mt8192-asurada-spherion: Add Synaptics tr= ackpad support") Signed-off-by: Chen-Yu Tsai --- I think this shouldn't be backported, as backporting it without the driver enhancements just delays the trackpad probing with no real gains. --- arch/arm64/boot/dts/mediatek/mt8192-asurada-spherion-r0.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada-spherion-r0.dts b/= arch/arm64/boot/dts/mediatek/mt8192-asurada-spherion-r0.dts index 68caf4c58cfe..8adbfc307fca 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192-asurada-spherion-r0.dts +++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada-spherion-r0.dts @@ -94,6 +94,8 @@ trackpad@2c { hid-descr-addr =3D <0x20>; interrupts-extended =3D <&pio 15 IRQ_TYPE_LEVEL_LOW>; wakeup-source; + vdd-supply =3D <&pp3300_u>; + post-power-on-delay-ms =3D <100>; status =3D "fail-needs-probe"; }; }; --=20 2.55.0.897.gb25b4bd76c-goog