From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 77F6B1F8189; Thu, 14 Nov 2024 10:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731580626; cv=none; b=L2Y4bDHqoxsRtuDr1EXJJMigzKjGYcz5A0NKw8CE37QJHRXZPGd2+sHVEqv3Us29p528C0yBVJaUSn+PEKYHXWAvFphfpYt0Umu8pLlh5yy8AbKwkyuN+kyEmJQV+hBuRwlF0mMEtZVP5elS4/CPJVXKciIeETxjI33cWttTenw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731580626; c=relaxed/simple; bh=T/MDxXbZUP4sk05s7ha+rYRhJRWLrDhV5t3FMFK3PwY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ei0wEfbswboOXC+z1oID9MkRThOF7+VkcDdV9BcibS9aTLWjk5oYyXpsO4lf18DLhtI2VkR/b+QDCKAKUjXVs+RqsDyEj8CPCFkp6/Buy2/B7QkHZ7PI+7OBW2p+XWlyddgIvbrOStmUjaNGl4ukbIhaMf9yY7xUUMKpM4tZUVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=cu6Bt1vA; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="cu6Bt1vA" 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 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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