From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1393D65C79 for ; Thu, 14 Nov 2024 11:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4Uv6YevP3+i7SC/MW8Jubo2mFXKKkdr9rTp5SyBc0IQ=; b=RAqj/Q13OVtmtlujk1LxEHnzVt HE/vCc/jetPQM+N8MG6jjT7PU+WJon+16Y1PYtadl4jtkYNvIisHrViy5qE08CTR50+4YZyglusFF y6fbVT55U+HZTMElRcGNgpha4k6xVd1WYbJBUoF3yVmFOUCOI2G1kRy6CABLcXDjPPXk2MOjAjfkg 9zWvLFRldO2fa+c9Q4e7bkgFUowLk6d0ySOEu4MNQIYgH+F3M6C6AB/5V5eTs7B7A5uvt5JoJNH24 C9RNHve+FnKVZJm6rRpRzoKKX03hdSGspwB9A1VN8YSlNmnc9t/aRZYSnHSIU9ahKF8UhpIoNeWnd 0pMTeR7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tBY9L-00000009kbJ-0Wtd; Thu, 14 Nov 2024 11:36:35 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tBXDk-00000009ZFF-2A12; Thu, 14 Nov 2024 10:37:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1731580623; bh=T/MDxXbZUP4sk05s7ha+rYRhJRWLrDhV5t3FMFK3PwY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cu6Bt1vAqlZr74pho2O4Qktzq0W86Mxr3EmRPxMsPIWK22YQBdbprcn09HtrlJ4By lq0H0aLC1WoLdQJTr2PX5V6aLPZ7vXxjEZ8heIUJFxYeGpzxhDFx0DySXkpLjuugkQ nEwub/Wn6Xwn6ljuks3v8yYG539Tlq5iBOXU1idwQJ2dSoiMHf4P6DX4rpGmR4w0ml +0QPVt5HMIW5tPzBrFmaDXw+hKOLLOOY5Uu1VynSQexy24FwQJBUrxxndTjH43vzKD zecZjxyYdvrI2OFuobuNucz9dKzU01CIS9mVJ3QoUa5+Hw9knAO4wVIY29I4/j+ONb VgiLv0ik93STQ== Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: kholk11) by bali.collaboradmins.com (Postfix) with ESMTPSA id 45DF117E35FC; Thu, 14 Nov 2024 11:37:02 +0100 (CET) Message-ID: Date: Thu, 14 Nov 2024 11:37:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 3/7] i2c: Introduce OF component probe function To: Chen-Yu Tsai , Matthias Brugger , Wolfram Sang Cc: Rob Herring , Saravana Kannan , Benson Leung , Tzung-Bi Shih , chrome-platform@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold , Jiri Kosina , Andy Shevchenko , linux-i2c@vger.kernel.org, Andrey Skvortsov References: <20241106093335.1582205-1-wenst@chromium.org> <20241106093335.1582205-4-wenst@chromium.org> From: AngeloGioacchino Del Regno Content-Language: en-US In-Reply-To: <20241106093335.1582205-4-wenst@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241114_023704_860569_0AB571AE X-CRM114-Status: GOOD ( 23.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Il 06/11/24 10:33, Chen-Yu Tsai ha scritto: > Some devices are designed and manufactured with some components having > multiple drop-in replacement options. These components are often > connected to the mainboard via ribbon cables, having the same signals > and pin assignments across all options. These may include the display > panel and touchscreen on laptops and tablets, and the trackpad on > laptops. Sometimes which component option is used in a particular device > can be detected by some firmware provided identifier, other times that > information is not available, and the kernel has to try to probe each > device. > > This change attempts to make the "probe each device" case cleaner. The > current approach is to have all options added and enabled in the device > tree. The kernel would then bind each device and run each driver's probe > function. This works, but has been broken before due to the introduction > of asynchronous probing, causing multiple instances requesting "shared" > resources, such as pinmuxes, GPIO pins, interrupt lines, at the same > time, with only one instance succeeding. Work arounds for these include > moving the pinmux to the parent I2C controller, using GPIO hogs or > pinmux settings to keep the GPIO pins in some fixed configuration, and > requesting the interrupt line very late. Such configurations can be seen > on the MT8183 Krane Chromebook tablets, and the Qualcomm sc8280xp-based > Lenovo Thinkpad 13S. > > Instead of this delicate dance between drivers and device tree quirks, > this change introduces a simple I2C component probe function. For a > given class of devices on the same I2C bus, it will go through all of > them, doing a simple I2C read transfer and see which one of them responds. > It will then enable the device that responds. > > This requires some minor modifications in the existing device tree. The > status for all the device nodes for the component options must be set > to "fail-needs-probe". This makes it clear that some mechanism is > needed to enable one of them, and also prevents the prober and device > drivers running at the same time. > > Signed-off-by: Chen-Yu Tsai > Reviewed-by: Andy Shevchenko > Reviewed-by: Douglas Anderson Reviewed-by: AngeloGioacchino Del Regno