From patchwork Mon May 27 11:39:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Curutchet X-Patchwork-Id: 799667 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6887A15D5C3; Mon, 27 May 2024 11:39:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716809962; cv=none; b=DYNG4n2eAtjJgiA2nNwj2OiBOyWIV5oLHKgfGTcI/u+Tog6YoNKRM7cpiTGeO9JHodW0lKXGC5MzaGNxgM2HDaEsYvN8YJY7M2oP9V34UixqUp0w+WyMnSLpkCFG7CLG2qzz4O6iX/VTB00xGw13zXs6czi1CgnJVIXZB+C9Juc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716809962; c=relaxed/simple; bh=jp4l2cKZ3kPzx+YzlZn5iKXhCwveluRmsHImkFLgtQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vj5JN6+KR9afp/TUpD35+A5YitzBbavIRaMvQKNGnd7005Z3nk2lHEEwgcGh6REMZSPxFqEqZSQBKZXzGZZ8oXwioxSwTNe3hLa7u3DTlJ40kZocjdkmFdDA0T8rw/6YvGjlJdg7666Da38bwcXuLdkZTj6Io8FfkRtQ6+EgKgg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=djJ5GFy2; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="djJ5GFy2" Received: by mail.gandi.net (Postfix) with ESMTPA id C10351C0005; Mon, 27 May 2024 11:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716809953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VSbn3scxBR7pISeAAMOGeMfLewlqMDPKt8ZoFX66cY=; b=djJ5GFy2WSmb6BNkKYzu7J2APQ70qxENMuLTwg9ghag15vXSTbFwLoaOjsjdfuM8AfYQLG mvXoyQBTOEHMUjp4chAsfthZslpBB8kGjpvvJQ51iMUOnslu3YpsyqWGwOXp68FqTUL+t4 R7iOspku0Rv5TDxUf2rdMpBr4VT2Xw7WSzfVvT0lpzrTO6Z9vJbz6gnvOoT3m4cAkFDcqJ btPBU+XACApiHzREgsm9CHEuSgxcB0j9KUkHoJiOAmwai20NwOzVCqzK9S7Dpxr/taS/W4 Qy9VjNmaYCvmZ0cJzjcoA0rm2AGKScp6Ghggh6GptNtEjxiKvfNiMTj/VJZ9Ag== From: Bastien Curutchet To: Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Korsgaard , Wolfram Sang Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca, Bastien Curutchet Subject: [PATCH 1/3] dt-bindings: i2c: gpio: Add 'transition-delay-ms' property Date: Mon, 27 May 2024 13:39:06 +0200 Message-ID: <20240527113908.127893-2-bastien.curutchet@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240527113908.127893-1-bastien.curutchet@bootlin.com> References: <20240527113908.127893-1-bastien.curutchet@bootlin.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: bastien.curutchet@bootlin.com The i2c-gpio-mux can be used to describe a multiplexer built upon several i2c isolators having an enable pin (such as LTC4310). These isolators can need some time between their enable pin's assertion and the first i2c transfer. Add a 'transition-delay-ms' property that indicates the delay to be respected before doing the first i2c transfer. Signed-off-by: Bastien Curutchet --- Documentation/devicetree/bindings/i2c/i2c-mux-gpio.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.yaml index f34cc7ad5a00..5bca58b78359 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.yaml @@ -57,6 +57,9 @@ properties: last value used. $ref: /schemas/types.yaml#/definitions/uint32 + transition-delay-ms: + description: Delay to wait before doing any transfer when a new bus gets selected. + allOf: - $ref: i2c-mux.yaml From patchwork Mon May 27 11:39:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Curutchet X-Patchwork-Id: 799328 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD66815D5D8; Mon, 27 May 2024 11:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716809965; cv=none; b=rju2dpbXEB+xJX4ezhWstCgoaQ60nMGARnE/Avk8OqI/KeGwM2lY3fUDCjqGID+f5EdmgGyvxGGPTECoxEmLYyYJbFCOfN3MhaGfOPvlPaf2p9kLl9IiyAVZHZuloKxPn3Cz6T0WQf18Ue7tPADI3uqai+5HRCrIAuKIvfy1oac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716809965; c=relaxed/simple; bh=8Q8bUe5t7Cc3xBL4MsSFOl/19C3f3eghMC1wwMxip+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nV/ieg+43DmMLHyLuvm3Cyrd44MD9KUD8/aUmCqiBrfmB9zPhB8yXtdqyEX9kmWvSQZyVE7CaBGU2Q03BITaUJemu4FCJSCaHtC2krMryrVVLR0dlvuctVbb1aR4scyhBU5BMgA/tB1iOgwdtqiUN6RCoAkxrA2k1MV/tKFh0Mk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VeRbRvUl; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VeRbRvUl" Received: by mail.gandi.net (Postfix) with ESMTPA id 35B541C0009; Mon, 27 May 2024 11:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716809954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ltCzBYQuXG2u5FgNITnslerb1IuiczmEUWFQZ/f86s=; b=VeRbRvUllm8G5mHocd47dPjG6HfWX050s61cslirc8h6i7kYsoBbBbxIRAL5azOMZJtcYM OusN6PMXjautJR+fM19G3zhYJmnYJ8liW75Zuk7I77a7gLiVEGqRY8Y/MpttYbRoQWBYBA X9hudvyOggofFvMSBoJB58tyXap3nyWHD/zyWuG6I5X+S2DlSJA0K0R6PqROZollUySEid l/fxeZXY7Bo/7vr3KRSKktLHP9I/S6dm8ZlzTDXjsCRqYQS/LP5ugSf/SRyiyokvsjDWPY pcm/gqWpex6QX6bdGnkg2ebWIYvd7LCbYATrf67zwyVtcKQg5sHs4ury6GBgQw== From: Bastien Curutchet To: Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Korsgaard , Wolfram Sang Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca, Bastien Curutchet Subject: [PATCH 2/3] i2c: mux: gpio: Re-order #include to match alphabetic order Date: Mon, 27 May 2024 13:39:07 +0200 Message-ID: <20240527113908.127893-3-bastien.curutchet@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240527113908.127893-1-bastien.curutchet@bootlin.com> References: <20240527113908.127893-1-bastien.curutchet@bootlin.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: bastien.curutchet@bootlin.com The #includes don't match alphabetic order. Re-order #includes to match the alphabetic order before adding a new one. Signed-off-by: Bastien Curutchet --- drivers/i2c/muxes/i2c-mux-gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index d6bbb8b68333..c61e9d9ea695 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -5,16 +5,16 @@ * Peter Korsgaard */ +#include +#include +#include #include #include +#include #include #include #include -#include #include -#include -#include -#include struct gpiomux { struct i2c_mux_gpio_platform_data data; From patchwork Mon May 27 11:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Curutchet X-Patchwork-Id: 799666 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5559815DBC6; Mon, 27 May 2024 11:39:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716809965; cv=none; b=f8oijMWzHKdejf7VDLJz9Q50UezRIdPjp0Qgl9mFtCHYfYQTOn6D3UrbgRyBIpWwwHrlZYHWz8KVlFElQdEVfpliDHRdNzF6tYdcsnpr+G0vursBZwp6yB62h3nG4Cn2J38qW1Tc1kiG6B1ozSwzqVavnPiq/KZKIS35IXjoOCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716809965; c=relaxed/simple; bh=CziR8tGg5qwYNvJIC+QQYLKyVrnjY04Q5lyj/7UJ7ts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GUul2IMY59h61Zmxp63qh/sv8V3ogoUk1z5diW4HnA7qL9to23RhKxVaTaapQxUmHedLf/rBjDigJnRHKaSPJUlwXCp9jeMyydooGL4lvj9zu5W8i5n4OVywZbzw7IzeunLsTXhWL9OzCPXrYShlyIc71V98LOtsgFAJKqNHcEQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=YWG0pUdO; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="YWG0pUdO" Received: by mail.gandi.net (Postfix) with ESMTPA id B4BA61C0008; Mon, 27 May 2024 11:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716809956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bzjZT6VO3PxtG5290LSf4VPSnmjoCdCbJpas0iFjQn4=; b=YWG0pUdOVE5ttqrJyGb+Y9ye+4BRUS6/YkTrUf+78IMYXx8jFDFyaPYa1Fj/cEYPtuAmbC 8lmCWTvWanyDCzHd5zuq30E4O+i2G74wW5dqt856qXVCE+JqaDPFlfNKMdQIAnv/U5R+Ky 4FcHVkstnXr3R4eSSgB/VwFyLuS2L82wQBqFaxppOxc6CBUx3YMfN/As5cC9fhKqNHcsCG EDmRIUfC0nc/LZqh7tB6ST78SuHrYuDGxaZ+CB5A3SPGw6ykF70tsfJXkTKkUqqA3z2+eM qCeWsHKHOFtivTHWQPVPWw4Nwx2Jk/uh23u9qf6utgYGOJmMVyDGXe/5nFYpZg== From: Bastien Curutchet To: Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Korsgaard , Wolfram Sang Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca, Bastien Curutchet Subject: [PATCH 3/3] i2c: mux: gpio: Add support for the 'transition-delay-ms' property Date: Mon, 27 May 2024 13:39:08 +0200 Message-ID: <20240527113908.127893-4-bastien.curutchet@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240527113908.127893-1-bastien.curutchet@bootlin.com> References: <20240527113908.127893-1-bastien.curutchet@bootlin.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: bastien.curutchet@bootlin.com Some hardware need some time to switch from a bus to another. This can cause the first transfers following the selection of a bus to fail. There is no way to configure this kind of waiting time in the driver. Add support for the 'transition-delay-ms' device-tree property. When set, the i2c_mux_gpio_select() applies a delay before returning, leaving enough time to the hardware to switch to the new bus. Signed-off-by: Bastien Curutchet --- drivers/i2c/muxes/i2c-mux-gpio.c | 6 ++++++ include/linux/platform_data/i2c-mux-gpio.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index c61e9d9ea695..d2cbbaa09485 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -37,6 +38,9 @@ static int i2c_mux_gpio_select(struct i2c_mux_core *muxc, u32 chan) i2c_mux_gpio_set(mux, chan); + if (mux->data.transition_delay) + mdelay(mux->data.transition_delay); + return 0; } @@ -116,6 +120,8 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, if (device_property_read_u32(dev, "idle-state", &mux->data.idle)) mux->data.idle = I2C_MUX_GPIO_NO_IDLE; + device_property_read_u32(dev, "transition-delay-ms", &mux->data.transition_delay); + return 0; } diff --git a/include/linux/platform_data/i2c-mux-gpio.h b/include/linux/platform_data/i2c-mux-gpio.h index 816a4cd3ccb5..c449f714d32b 100644 --- a/include/linux/platform_data/i2c-mux-gpio.h +++ b/include/linux/platform_data/i2c-mux-gpio.h @@ -19,6 +19,7 @@ * position * @n_values: Number of multiplexer positions (busses to instantiate) * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used + * @transition_delay: Delay to wait when a new bus is selected */ struct i2c_mux_gpio_platform_data { int parent; @@ -26,6 +27,7 @@ struct i2c_mux_gpio_platform_data { const unsigned *values; int n_values; unsigned idle; + int transition_delay; }; #endif /* _LINUX_I2C_MUX_GPIO_H */