Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp3996962ooa; Mon, 13 Aug 2018 22:53:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwtJLjL4+F83reuUUgd8iO7AE/YLXmIiILmQ9ioNbm7rCpXtzG2GwJ0tgXQDqhouSTcZLPG X-Received: by 2002:a65:60cd:: with SMTP id r13-v6mr19692152pgv.232.1534225986526; Mon, 13 Aug 2018 22:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534225986; cv=none; d=google.com; s=arc-20160816; b=0JMpQPgYNsC4DSw+9Jc42PWAmPQrK/1ZsVVqrFPxK8D3l41sXWAW8SmtPmmpiJQUS+ uvr+70XqZ7dUWChHOCvj72OgTrldFht7iT+VWI8hU2A1as9hp3AcUedaDGoopdhgaHyQ pk7HsRUeu2AdU8zS5tjuRAIfiXBC2gCIXOIZa1/QS15AdDlW3ZovsGC1SsMaOEvpKhxH EQHCY8oOq3jUhU+hk1UVfVagooZ0q5Pcr770lJ8k5uo18wqCvDWyjHdDncFCErD81ITR WWjD9wgTm185TrABK0WiJ7O0EAcZyERhs0fdgK79L+tipqngfMEq2pBf8a/xOs1+fbhh tB6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=PX1ZUxbKLWXONQQNQxB8tb+sEVxHpQebMi8wWDj02xU=; b=aMwteFgomrMOaXS+/WedCsj+RbFLjRe/rvE/Vfun4/gLTF7k+knRAIQyS8NLZn2AWU ZqvlwOAQh75dX54zQ1fnga4mCu1p4YGgbMGJreDApqUYKxrWpj+Zy5DOIIZK8pbUEPcz 2fzQmHrAmhOMAOnhOCvVfNlI5biYc9CaKlICbf17Qr6VmzYVNYUuVL0mcusu8za3jVHz GOumhlXsaDiWgBHuDtCyDtjKJ8yqkD+xsFg0doOibhEb09gAdcy3d3UUP9tCNuN1u9Dj uN9DHcWSm9oDZyp5jWAc7py5iMF6TtPQYSn2zRjjoCGB4tNtKWtjYk3jLgGnZRztE9vw K+pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=pYJ+p1mG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si16338554plk.95.2018.08.13.22.52.51; Mon, 13 Aug 2018 22:53:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=pYJ+p1mG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731902AbeHNIZ0 (ORCPT + 99 others); Tue, 14 Aug 2018 04:25:26 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:48962 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729055AbeHNIZ0 (ORCPT ); Tue, 14 Aug 2018 04:25:26 -0400 Received: from avalon.localnet (h-17-125.A137.corp.bahnhof.se [94.254.17.125]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 85105CE; Tue, 14 Aug 2018 07:39:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1534225188; bh=eJYtQlJ+nPBtkRtsJmvlsaRsuTsuqaFaQKEGqfXTcwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pYJ+p1mG3prTr48p9nrbJAi18/J1Brh4xb6UaJ9WQn0BQ+0YVSq6YATCTZnh8BvAP 422U1YNXLcbNmR1+AH80Q4JxbvDBbJwH4NYWcZmBdzH0bn2O69mL3YPTSi/WyfaKNf LqyPytt8uEc7eoJRZmOpUKSMMUBpgJLWljihBdhA= From: Laurent Pinchart To: Rob Herring Cc: Kieran Bingham , Mauro Carvalho Chehab , Mark Rutland , Hans Verkuil , Linux Media Mailing List , "open list:MEDIA DRIVERS FOR RENESAS - FCP" , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3] dt-bindings: media: adv748x: Document re-mappable addresses Date: Tue, 14 Aug 2018 08:40:37 +0300 Message-ID: <2887621.fdKYYZGugR@avalon> Organization: Ideas on Board Oy In-Reply-To: References: <20180809192944.7371-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, On Tuesday, 14 August 2018 01:48:05 EEST Rob Herring wrote: > On Mon, Aug 13, 2018 at 1:17 PM Kieran Bingham wrote: > > On 13/08/18 18:45, Rob Herring wrote: > > > On Thu, Aug 09, 2018 at 08:29:44PM +0100, Kieran Bingham wrote: > > >> The ADV748x supports configurable slave addresses for its I2C pages. > > >> Document the page names, and provide an example for setting each of the > > >> pages explicitly. > > > > > > It would be good to say why you need this. > > > > In fact - I should probably have added a fixes tag here, which would > > have added more context: > > > > Fixes: 67537fe960e5 ("media: i2c: adv748x: Add support for > > i2c_new_secondary_device") > > That doesn't really explain things from a DT perspective. > > > Should I repost with this fixes tag? > > Or can it be collected with the RB tag? > > I'll leave that to Hans. > > > > The only use I can think of > > > is if there are other devices on the bus and you need to make sure the > > > addresses don't conflict. > > > > Yes, precisely. This driver has 'slave pages' which are created and > > mapped by the driver. The device has default addresses which are used by > > the driver - but it's very easy for these to conflict with other devices > > on the same I2C bus. > > > > Because the mappings are simply a software construct, we have a means to > > specify the desired mappings through DT at the board level - which > > allows the boards to ensure that conflicts do not appear. > > > > > Arguably, that information could be figured out without this in DT. > > > > How so ? > > > > Scanning the bus is error prone, and dependant upon driver state (and > > presence), and we have no means currently of requesting 'free/unused' > > addresses from the I2C core framework. > > True. But assuming all devices are in DT, then you just need to scan > the child nodes of the bus and get a map of the used addresses. Though > if you had 2 or more devices like this, then you'd need to maintain > s/w allocated addresses too. It could all be maintained with a bitmap > which you initialize with addresses in DT. We've discussed this topic with Wolfram before, and unfortunately the base assumption of assuming all devices are in DT often doesn't hold :-( For all kind of reasons vendors often don't provide a full description of I2C buses, especially when slave devices don't need to be accessed from Linux. Sometimes they lack DT bindings for some I2C slaves that are not essential and still want to provide a partial but functional DT. Sometimes devices are hooked up to an I2C bus for debugging purposes only and end up never being used, so nobody bothers describing them. Sometimes an I2C slave has multiple slave addresses which DT writes are not aware of. Those are just a few examples. One alternative would be to add a DT property to the I2C master node to list the known to be free addresses. I'm not sure that's better though. We should also keep in mind that some I2C slaves could have restrictions on which secondary addresses can be used, so we would need to pass constraints to the I2C address allocator, which would quickly become a mess. -- Regards, Laurent Pinchart