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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FE6DC3A5A2 for ; Tue, 3 Sep 2019 08:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21FE422D6D for ; Tue, 3 Sep 2019 08:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728109AbfICIsq (ORCPT ); Tue, 3 Sep 2019 04:48:46 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:46233 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbfICIsq (ORCPT ); Tue, 3 Sep 2019 04:48:46 -0400 Received: from [109.168.11.45] (port=41926 helo=[192.168.101.73]) by hostingweb31.netsons.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1i54UU-002hxn-8d; Tue, 03 Sep 2019 10:48:42 +0200 Subject: Re: [RFC,v2 2/6] i2c: add I2C Address Translator (ATR) support To: Wolfram Sang Cc: linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Kieran Bingham , Jacopo Mondi , Vladimir Zapolskiy , Peter Rosin References: <20190723203723.11730-1-luca@lucaceresoli.net> <20190723203723.11730-3-luca@lucaceresoli.net> <20190902204208.GA7253@kunai> From: Luca Ceresoli Message-ID: <8482d1e2-b1d9-3da5-5b1f-b7e492a87368@lucaceresoli.net> Date: Tue, 3 Sep 2019 10:48:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190902204208.GA7253@kunai> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi Wolfram, On 02/09/19 22:42, Wolfram Sang wrote: > Hi Luca, > >> + * Topology: >> + * >> + * Slave X @ 0x10 >> + * .-----. | >> + * .-----. | |---+---- B >> + * | CPU |--A--| ATR | >> + * `-----' | |---+---- C >> + * `-----' | >> + * Slave Y @ 0x10 >> + * >> + * Alias table: >> + * >> + * Client Alias >> + * ------------- >> + * X 0x20 >> + * Y 0x30 > > Great that you already provided docs for this driver! > > One huge drawback for me is the attach/detach callbacks. One year ago, I > removed a similar callback from the I2C core ("[PATCH 0/2] i2c: remove > deprecated attach_adapter callback") because some drivers did a lot of > crazy things there. It took years to remove all that. Oh dear, I was completely unaware, apologies! :-) > What I could imagine here: the adapter (B and C each in the picture > above) gets a flag like NEEDS_ATR before registering to the core. The > flag means all clients on that bus will have their address translated. > The core will figure out a free alias when a device is registered. We > can then have an ATR specific callback with the original and translated > address as arguments, so one can setup the HW as needed. Do you mean moving the alias selection code from i2c-atr.c to the i2c core? And the rest of the ATR core too? > Do you think that would work? Yes. -- Luca