From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 F05514446FA for ; Tue, 11 Aug 2026 12:20:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786450853; cv=none; b=Lv8CiyyOJXziW3sty+pdS6yv/NBY+4iRz2PzPs9elCcLQ6k+2TS8LbCidAhvYFAZ+odXztl+7JnIhuGW64gBG/kBaJnNXmvfLXXHPp6fL0RsL8Mw/VTJIVfLHWy7oGELydm9KZ2OMzINKHFa5cJ/DepawvRtpPpCqN5T0qUmcPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786450853; c=relaxed/simple; bh=uirJlTrzUDnDWGluHgHaYZhmNeiDmkFi3DnjsuZpHfI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h+VSHiP10so9W6JxqjjK09iyJ/BncKnPiCUWvkAf+YxwpgtkFI2SjD4fVdCpGs+febYX2kQHIYrjkpJVHfE9hKu3xug50OiDWj7A3DbOhrUD5Hr07+e13FalnGGrty+TTv0pTQuJiuOGGqqOeIY6Fx1uZBdw8Dvni9QH0VDcQew= 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=AHysLrxK; arc=none smtp.client-ip=209.85.210.175 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="AHysLrxK" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-8487b7b3fc8so732742b3a.3 for ; Tue, 11 Aug 2026 05:20:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1786450851; x=1787055651; 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=GsFbGvUc+lL3nEmcNAop98oZPFXcbP5zb4ZbtxDxx0U=; b=AHysLrxKBQRBWDPQAOCDHjM1n5xvZQ2q4T4wopMN1EbGiPvP79efhy6Y3H7y6zDD72 lyfi2zZZ8MGtj8/g5V/hUMa8gIMA8lo5N2dUIF8D11cVzr9S9opuhIFIzZiQirmuKigP xwvegTrWzYjUhwxR0dEjzjN0A14QdcOpuXZTQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786450851; x=1787055651; 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=GsFbGvUc+lL3nEmcNAop98oZPFXcbP5zb4ZbtxDxx0U=; b=lsjKAw7fF5bJ89oiMkv6wX2JCP4BnqbmdwzFG0ylU1NgbRhwz28vEk3++SmuUKUjJB OnrGHteyONg+X0kNb94opIfwzXTxKT3yXtDn+hnX07g74NKzZP1LoMm2mxQA3COPG3q/ PXjIPoi5C9Kn0fdSnU43W9inH+8rHYWdthnzkZblzhZ37DwHWZRXlvKC+IzpM8mXDpGw 0iYzTYK129/dcZb1ZwAniBwclGeI+xDt0DMs3FA2gaPnsFxeOhS/PEFxaUx7LX6DYDFE cSM1fNzZyZaiepHIJQZzL1F8fzoDTI5IXQfDxssrhQnpw80IX8KVLMdzX9bcLIEt2Eue 7WPQ== X-Forwarded-Encrypted: i=1; AHgh+RpXvBOnoEjf/tL/mhztdN6XefNEGLP7GgEz8XuyyyxzOPpT5cddy+Au6ZeOXWE8Ay7FVGHywEmdNQmneuw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8Ka/YDiOdpzbA+xPxzTZgmzRuppYTgp1sE7/syzL05ULE8bqP cjYYDPWhO/0zj0roIhNjXykeQhpaCRqESFdt4IznbLhcOjbDlXF9R8TFmF9cIYaLzQ== X-Gm-Gg: AR+sD10b38EmS9lF8w+dXMCjYUorZBZRahH5BigcpiTNgsKbPZ04lSeXgSttXZfywyB l3DAi7u67gnpKx3Ko1OTMBiuvyICzLJoD/GWhUVPFX21HU3/WJsIx3WC1uDA9PpXiRXAKhOkTv6 NHRSCfp/OFt1F/HrNPEkSdwMHVADLvrslK3cAoadWo0ATwuk0n8DIhxnv8psVrFuCwoE6Hr5Ece NYCDA8KEe5guHZndk8Gtn+1tJMw5TBGNOzxqB25ZE15/nB6n+VzcIEpLz6WexSAFyS2kIIojzcv A3kB+0D3fjPMEoEVGFRvInTGYSmmEmAO4RmDyhPRv7067Jj23Ng8gutJyhKg/4BRpHsTw6EarQd FUMjNu0qWrPv66BxsAQEA8oLEYuxP5BKTiM39jssZGC63SygXi5hjRYOiidYLPKyU2Kr9rLRM9/ w4nnZlbqobGWyeO2lPVtrJzHZGLOvCj2zL8+Y0j4NKHbFQudYKrDzvZFfRkWPm+0er2aQIgqKyq w1l8ZRDN3khNToS9CkXeSVjZbl5diopM4n9OscdVY+TBg== X-Received: by 2002:a05:6a00:8d1:b0:846:22ea:e171 with SMTP id d2e1a72fcca58-84fa872c289mr2761703b3a.3.1786450851388; Tue, 11 Aug 2026 05:20:51 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:12e1:df26:6add:1ea7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84fa9574e9dsm662454b3a.54.2026.08.11.05.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 05:20:50 -0700 (PDT) From: Chen-Yu Tsai To: Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Benson Leung , Tzung-Bi Shih , Dmitry Torokhov , Jiri Kosina , Andi Shyti Cc: Chen-Yu Tsai , 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 v4 4/9] HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long Date: Tue, 11 Aug 2026 20:20:04 +0800 Message-ID: <20260811122011.3539250-5-wenst@chromium.org> X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog In-Reply-To: <20260811122011.3539250-1-wenst@chromium.org> References: <20260811122011.3539250-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: 8bit 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 #include "i2c-hid.h" @@ -48,16 +49,14 @@ static int i2c_hid_of_power_up(struct i2chid_ops *ops) struct device *dev = &ihid_of->client->dev; int ret; - ret = regulator_bulk_enable(ARRAY_SIZE(ihid_of->supplies), - ihid_of->supplies); + ret = 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; } - 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); -- 2.55.0.679.g6767b8d81c-goog