From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 4283C30E0ED for ; Mon, 11 May 2026 11:37:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778499456; cv=none; b=E23E2bU0xEC4RIaDD5Jpt2rgWEF9qLLIeD/FmEKNzSHFaZkdAilw6B9B7LnmNW1m0TXEINVIAdPPrIluuWglx5caUiL2mw4TW3YxYEzbNe3yrIWyDWYKDwDpH96hMaDCEbB2IuVKAHwJIYiDPyfDmP8/4tcduE+j0I4d60MdCdg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778499456; c=relaxed/simple; bh=Tym/BVOy9NE1Qeg8K8Acp0oOf3Og5IzMWvx+9ry5rNA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aT7i7fHEANCXVBg3RAJk4+ytwsbSTNIvoIwfTDju6M4qXxL1/zY7TUxCtjGJiXl94GZ9wyCtADwtGlhHHBl1v3WrPIcuKAYkSNM9KUp7WYMH6pQ7TiZevEjodRoKg+C2HNG7boABIseCsvXTcpqttgHvVikUZ9AOXDFK76WjGQs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E1cUmrgP; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E1cUmrgP" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5a88de2b52eso5424792e87.2 for ; Mon, 11 May 2026 04:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778499451; x=1779104251; 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; bh=VhUH2tKMkut60kZmw5C1AVWBW1sMGkeiu0EpNEsXCho=; b=E1cUmrgPv8JTetP+QYDI4HvOH5SuGPwmaSvakbw4dxvGTN88Ei5B2ab+OKYl1FNbJ7 KGRQiNzAniMQ3dvgrXSMobtXOajoWIude4ViiY92nie5bKzrlKENfSOmlXVbth7W91OT S9BBq+5wvTO2N9I27YEZsmOIF4arj7lN91g68EG8LF4fKacDspeF1p5OVGbmS9TBT8vP 5U6RaBwX2nyOwkLpvu/Gx2MzI4qdz0WZ9vbyTyJv1jXcpfR7cZtkvbeDtdiOxXGmVLfR VA0qMaExmaIE3Kq130MOGhLmkBjtL18pLZqFPr0iNFDQcqFkdaHcDWyYO6Hw01wBSsyY 4ixQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778499451; x=1779104251; 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; bh=VhUH2tKMkut60kZmw5C1AVWBW1sMGkeiu0EpNEsXCho=; b=jBvz+Lt8g+YR4xK+m0sJ5kh416l1lECsFWnat035UcwwI4n7rRkZ6VTT6tPNXq13zg myIxjGM/f4kRntAxOWyK/UCQoDA/rP1hslzL8WpSmQYuO0KkuC1BO/2/RURsCTlceJwO OSI63ZirA3Y8M3uy5Rmnzgwfe905qc/CUe5WHDI7ZszR383ztI3mzyl67c+gZ8Sxm4XP mcnYuPR+Me/2ut02cu3L+csXolw2O50DIdsHRvQAADC9wOrm5UqdtVPhFRq5Wj70KSRL Lhj7y2XZaSgq5FpQlA7TnQFKEBhM6V93ijzR2bV1GWShHJtYreQTinImXSEqb+xPeq40 BbKQ== X-Forwarded-Encrypted: i=1; AFNElJ+SA8/7Bz8YCVjIUng0TJ74uZ3iULQVIytNmy0F1DY+w+vlxlzFJhEASLiv1jv5XIqcnpXHzwToEWUWfH8=@vger.kernel.org X-Gm-Message-State: AOJu0YxpxpfHW6TgzF7lzP3Bt+KzFyflxrbvbcgeoFcgknOpQdyU0dst ys2gyMg5dpF+hKMtMiojIcyGX7nF8h3Foxl6GiNFws3IcOV1jpWZPk/K X-Gm-Gg: Acq92OHnvkRo7Qs13YAb/Kp2snEO7POFVx4KG50N3Zh7HSfLK7HEfsaZbe9C3Opi1OF QBc61AuPHrMvibVa2tbGc4voajEgi77jizj6eHa854zEJ9XebQBfPO9J9Nb5sIVqVMfzrx7KdEM PPXGOdbPbf1rxLVttaaG495GK57I7E/bPTxgv+buRhxFR7QEBAHQbKRRhGfjAgUK+PaxcuhAwwi /9gU8IIUvcATJSIToiH4UsyALP9RCUl+nYDJm+Zk1+8b+0vdq0MIzvCvGqBqvlcCloMyjHjf4Vl KMBuMfwiskgXbUZS24ps5YAi489yaJ5ICl2ek6pVSQIDE9glfLI36dIXH8yHlAGpttkOnDIBtYG mmvFUipGL4vPM5R9vgYFX2h3uYNvspuKRfkYiHCX11O4SzPpMz2uWEKkdIiWHUZN1gxIRjmIQeX uR4zxnL82AjVjlX8FkaGjWlCkbtcMdE5AQjz6xg6u1JkoAHg== X-Received: by 2002:a05:6512:1543:10b0:5a8:886a:1164 with SMTP id 2adb3069b0e04-5a8886a11ccmr6107757e87.28.1778499451179; Mon, 11 May 2026 04:37:31 -0700 (PDT) Received: from C-PF5D4647.localdomain ([147.161.186.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a8a956b1cfsm2593967e87.73.2026.05.11.04.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 04:37:30 -0700 (PDT) From: Jie Li X-Google-Original-From: Jie Li To: Bartosz Golaszewski , Linus Walleij Cc: Wolfram Sang , Wolfram Sang , linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Jie Li Subject: [PATCH v5 0/2] i2c: improve bus recovery for single-ended GPIOs Date: Mon, 11 May 2026 13:37:24 +0200 Message-ID: <20260511113726.49041-1-jie.i.li@nokia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Bartosz, Wolfram, This is a respin of the series rebased on v7.1-rc1, as requested by Linus Walleij. No code changes versus v4; only the base has moved. The series addresses a limitation in the I2C bus recovery mechanism where certain open-drain GPIOs are incorrectly identified as input-only, preventing the recovery logic from functioning. Following the earlier suggestion from Linus Walleij, the previously proposed "force-set-sda" DT property has been dropped in favor of a generic helper in the GPIO subsystem to identify single-ended configurations. This allows the I2C core to reliably enable recovery for open-drain lines regardless of the instantaneous hardware direction reporting. Merging strategy (suggested by Linus Walleij) ============================================= Patch 2/2 depends on the new gpiolib helper gpiod_is_single_ended() introduced in patch 1/2. To keep this bisectable and avoid build breakage, the recommended flow is: 1. Bartosz applies patch 1/2 to the GPIO tree and exposes it as an immutable branch. 2. Wolfram pulls that immutable branch into the I2C tree and queues patch 2/2 on top. Bartosz: per Linus's note, please could you pick up patch 1/2 and offer an immutable branch to Wolfram? Patch 2/2 does not touch any GPIO file, but it is the sole user of the new helper, so it cannot land via the I2C tree until 1/2 is available there. Changes in v5: - Rebased onto v7.1-rc1 (no code changes vs v4). Changes in v4: - Patch 2: - Use GPIO_LINE_DIRECTION_OUT instead of the literal '0' when checking the return value of gpiod_get_direction(), and drop the now-obsolete FIXME comment (suggested by Wolfram Sang). - Added Acked-by: Wolfram Sang. Changes in v3: - Patch 1: - Changed return type of gpiod_is_single_ended() from int to bool. - Updated return values from 0/1 to false/true. - Added Reviewed-by: Linus Walleij. - Patch 2: - Added Reviewed-by: Linus Walleij. Changes in v2: - Replaced DT-based "force-set-sda" with a gpiolib helper. - Added gpiod_is_single_ended() to drivers/gpio/gpiolib.c. - Updated i2c-core-base.c to use the new helper. Jie Li (2): gpiolib: add gpiod_is_single_ended() helper i2c: core: support recovery for single-ended GPIOs drivers/gpio/gpiolib.c | 22 ++++++++++++++++++++++ drivers/i2c/i2c-core-base.c | 4 ++-- include/linux/gpio/consumer.h | 5 +++++ 3 files changed, 29 insertions(+), 2 deletions(-) base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731 -- 2.43.0