Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752919AbcD2J3d (ORCPT ); Fri, 29 Apr 2016 05:29:33 -0400 Received: from mail-am1on0109.outbound.protection.outlook.com ([157.56.112.109]:57002 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751225AbcD2J30 (ORCPT ); Fri, 29 Apr 2016 05:29:26 -0400 Authentication-Results: codeaurora.org; dkim=none (message not signed) header.d=none;codeaurora.org; dmarc=none action=none header.from=axentia.se; Subject: Re: [PATCH] iio: inv_mpu6050: Add support for auxiliary I2C master To: Crestez Dan Leonard , Jonathan Cameron , References: <5b1937140558514b3e43ed2c21ee860ecbac61ec.1461172603.git.leonard.crestez@intel.com> <6ab228db-9695-ac22-9c65-fd15c4837c45@axentia.se> <5721E871.8010003@intel.com> CC: , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Daniel Baluta , , Wolfram Sang , , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala From: Peter Rosin Message-ID: <14f3be16-2912-cbed-ab89-08b1c22d827c@axentia.se> Date: Fri, 29 Apr 2016 11:29:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <5721E871.8010003@intel.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: HE1PR09CA0023.eurprd09.prod.outlook.com (10.162.19.33) To DB5PR02MB1302.eurprd02.prod.outlook.com (10.164.177.148) X-MS-Office365-Filtering-Correlation-Id: 73e9571e-10ff-4382-ea7d-08d37010bef3 X-Microsoft-Exchange-Diagnostics: 1;DB5PR02MB1302;2:X/o0soLstaX0+W4bX/if12v7XzlF16/Ki4zjyoNxX2Llkv7scZ+oxSJWyLgFtQIFXzrG0OFY+vbxLX19eHzvdt7gcR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= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(6040130)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041072)(6043046);SRVR:DB5PR02MB1302;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB1302; X-Microsoft-Exchange-Diagnostics: 1;DB5PR02MB1302;4:Ozvzhl2SdeCxPm2DXBVS5jI7G2wsJYukvAkKrEhufUb7xU1RPQa77ZpRdSkIb1oksaZLOmg0JCI4QBbLAU/N3BGJUV3yJxNuyr4dguU1UNQoaK4p5vjGUaKBEIFJsoXRnuQaJAXXMpp4VhlcaC7LP5q4Nt/A3S+b+1iS3uKEkS1As1HXiT3Fz9x/versVpqD1hxCqjN7fRW/O7IbgkNWxcZWKE6T/eDHiBTZwyZQJy7XmILILMRuWZUTKx7CG2ve6tCYj80A6ro5SUJNcil0cY89jhZUmrVE/zJSU7OrWn+xvgGTSB7RyKJ9xyjBsEWssYPtyDbzXIdZKK5jOkEnZ1BmDiAG8lUpgKLktVI5/hiqsh02j5pZ5tuKS5puRF8tssi1csjucjotysW0z6q6Q+p2wTjOvZ0fHkNBpQ73jg5ZdYMPImFNdI0qIwE5niulT54oRNDphUccaLNjbenCLg== X-Forefront-PRVS: 0927AA37C7 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(209900001)(24454002)(377424004)(377454003)(4326007)(5890100001)(65956001)(66066001)(74482002)(50466002)(31686004)(19580405001)(19580395003)(64126003)(36756003)(4001350100001)(5001770100001)(586003)(6116002)(42186005)(23746002)(117156001)(86362001)(81166005)(83506001)(3846002)(1096002)(50986999)(93886004)(189998001)(77096005)(76176999)(54356999)(15975445007)(5008740100001)(2950100001)(31696002)(2906002)(230700001)(33646002)(15395725005)(5004730100002)(65826006)(42262002)(6606295002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB5PR02MB1302;H:[192.168.0.125];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB5PR02MB1302;23:M8kcdZ9lgISi2RhD3OKgp163An6+SbKEafRaM?= =?Windows-1252?Q?4HOQx4ZiiwGHeKT/VzwS4BXKSp1q/qq+vRq3yfc38yRG1Bmwpvt394vh?= =?Windows-1252?Q?3M20BMa6Mcp8wafV9egOugG25YMdrsxPaMKDV7jLYNnYjZI+lZP/1BBv?= =?Windows-1252?Q?gbCVTXjgJ4u+pdO0FwLDkAtUFr3CQ9j4jAOlwvBqyppWvu0EkDEmxcrL?= =?Windows-1252?Q?x7jTDUaV6kN/j8TNwdwryzhAfXPJyYNc2H63lEb9xpjoQ0rTK2musHAx?= =?Windows-1252?Q?jAsvQuJtcy++cWY+PW6B+2v9yDNHcS5q9QVTeoxNQ0kIrHEXt98rfnM3?= =?Windows-1252?Q?a74SQaZk+19bJKY+012+I7UJPnpU7WRgzrxf2SCiUvCWIsgBSCRIwIqi?= =?Windows-1252?Q?Xz0BYdsJ3kYb2GcqYJArxam/GSnvyxT/u0eM9VfmrvzbGNS1gjP+NrBp?= =?Windows-1252?Q?UZcfLo70pP8PkxIXffcy0HKJOgKlaa/MgXIrMABrpyNkXsxGz+xTEQj/?= =?Windows-1252?Q?4LC9+oojtMSZuSagHf68E7FheKVhnl6kKPAM3AQMOb7tpD+PXFxhVoP8?= =?Windows-1252?Q?LNeXDMLOg8+CSwBvDNJRBq549vX95zFEnEJ1b0Fv+dBqrbG1ZLH246Ig?= =?Windows-1252?Q?Y0vCOuLURbek5tGUVDkcut88iQkLkPNizvye84HumiMnRJDQgOhuMGzr?= =?Windows-1252?Q?GMlBeQCXrO4Wdx+3PAl8AbAkrPbCJXTHbcv8M44d4/SqhkmHRY/PL3eA?= =?Windows-1252?Q?h8g/ZhNpbWAb5gkiEhuERupa7LfYUnNBWUW8dLb73mhzR6cb+jSfHMl9?= =?Windows-1252?Q?0AiLRw9gitKhSBybX/cMZ+iK9rC6ASNNz5c+gFmo3Ohn2rXhe7731fpd?= =?Windows-1252?Q?ZLbQobbNPfi5EPI81AcWHOHYYMze5yi3o7ToH45GwWPSQfh9J2SSyM9r?= =?Windows-1252?Q?JUlNk+VDMsAEbOVy3e2NdqSfjYzft+Hz81ARnvP6Yh/QBLHVLpW7Cv5S?= =?Windows-1252?Q?bDgWdJv3Mg72CfZy336NIo2SYX3jFDjSbxFQ5ugilrsoQpoXWKjyLZHk?= =?Windows-1252?Q?IN+rwoj13TtZqz54KdAeWHeQaMEzyp8P3+gChUTSIgc8gf6Nw3AmeNk0?= =?Windows-1252?Q?CYe5jWloi+Xl+5edm7wP06QLzy+UhZy4dO9NYaNZKV0CSJG5nk8CwcXY?= =?Windows-1252?Q?rRkN84LCDBC/Q/fA4yP5Yo3PKwLRV7HnBv8e+Eaz8n0vUgRniHVu0R0I?= =?Windows-1252?Q?uPGnKZCMQaBq0Ijszo7xvHOVsh8TZtURKXE7EMLiwwhzFvnYicoMNkSr?= =?Windows-1252?Q?nBAHKJ9yuUGfLHcZ06yZ+xW9gxDcLYVJmgRn07y4NrKwyHAPo6qGoHzH?= =?Windows-1252?Q?/TwOrwlxeP/?= X-Microsoft-Exchange-Diagnostics: 1;DB5PR02MB1302;5:zJLSYiajLCkd9qpO98EVIJkjdObKgbkXqntDf/zX1ugD7QH7eD+H69YIOkwTHaQmKf532/uPpIlFitU4scinniSxn9j0gruzYW0h0i5VFGUIr8lNWBbUIJsjqqW0nBmj+GStbyJe2utzBV0SoNjBUw==;24:bxAGSQXwHYcT0NseoTeETtJsKSG5yY81UQxFWU5WTHKca+oikDlBljHnByhRqrqx2LTtvZWW7a+BqPJrCJJXkRrDV2Wv9zYTnVvxEXTYLXI=;7:vD8/VY1g1j4OpYvKc3y7Q8rdNJwu+8nLMzs1zOO4i+9RDpXejqIP002Fp012qRr4yemZj3Qy6HbPpHw9NQF/KGGpY5LB8uJSNBvuVMDgICUEUYVq/GFSX3RkfGzY2bQl9GlDeLTZGDtsAHvtVPFmHizbJO3CqCsP9FOcHwOo4/hwyUHdjZqsjKqkg91GrWm/ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2016 09:29:19.4815 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR02MB1302 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3532 Lines: 98 On 2016-04-28 12:39, Crestez Dan Leonard wrote: > On 04/27/2016 11:39 AM, Peter Rosin wrote: >> On 2016-04-23 23:32, Jonathan Cameron wrote: >>> On 20/04/16 18:17, Crestez Dan Leonard wrote: >>>> The MPU has an auxiliary I2C bus for connecting external >>>> sensors. This bus has two operating modes: >>>> * pass-through, which connects the primary and auxiliary busses >>>> together. This is already supported via an i2c mux. >>>> * I2C master mode, where the mpu60x0 acts as a master to any external >>>> connected sensors. This is implemented by this patch. >>>> >>>> This I2C master mode also works when the MPU itself is connected via >>>> SPI. >>>> >>>> I2C master supports up to 5 slaves. Slaves 0-3 have a common operating >>>> mode while slave 4 is different. This patch implements an i2c adapter >>>> using slave 4 because it has a cleaner interface and it has an >>>> interrupt that signals when data from slave to master arrived. >>>> >>>> Signed-off-by: Crestez Dan Leonard >>> This one needs acks from: >>> >>> Device tree maintainer (odd binding ;) >>> Peter Rosin (odd binding interacting with the mux support) >>> Wolfram (it has a whole i2c master driver in here). >>> >>> (just thought I'd list these for the avoidance of doubt). >> I spot some overlap with the questions in "[RFC] i2c: device-tree: >> Handling child nodes which are not i2c devices" >> http://marc.info/?l=linux-i2c&m=146073452819116&w=2 >> >> And I think I agree with Stephen Warren that an intermediate placeholder >> node would make sense. I.e. >> >> mpu6050@68 { >> compatible = "..."; >> reg = <0x68>; >> ... >> i2c-aux-mux { >> i2c@0 { >> #address-cells = <1>; >> #size-cells = <0>; >> reg = <0>; >> >> foo@44 { >> compatible = "bar"; >> reg = <0x44>; >> ... >> } >> } >> } >> } >> >> Or >> >> mpu6050@68 { >> compatible = "..."; >> reg = <0x68>; >> ... >> i2c-aux-master { >> #address-cells = <1>; >> #size-cells = <0>; >> >> gazonk@44 { >> compatible = "baz"; >> reg = <0x44>; >> ... >> } >> } >> } >> >> depending on if you want an aux-mux or an aux-master. >> >> But I don't know if that intermediate i2c-aux-mux node causes any >> problems? > It's not clear how that would be implemented. It seems to me that right > now i2c_add_mux_adapter assumes that the parent device is a dedicated > mux device and all it's children are mux branches. Would this require > introducing a new "struct device" for the i2c-aux-master node? > > It might make sense to make the automatic processing of the parents > node's of_node optional and let the caller assign the of_node describing > the attached devices. > > I think the most natural solution would be to require child nodes named > i2c-aux-mux and i2c-aux-master to describe aux devices. For backwards > compatibility it would be easiest to go with i2c@0/i2c@1 (identified by > reg=0/1). > > But I don't know much about devicetree and I'd rather accept an external > suggestion. > I was thinking that with the new i2c_mux_core in place, it should be pretty simple to add a hook to point to another node and only use dev->of_node as a default value for where to look for the mux child adapters? Cheers, Peter