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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A517FEB64DC for ; Wed, 14 Jun 2023 08:13:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235449AbjFNINT (ORCPT ); Wed, 14 Jun 2023 04:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234277AbjFNINR (ORCPT ); Wed, 14 Jun 2023 04:13:17 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58546170E; Wed, 14 Jun 2023 01:13:16 -0700 (PDT) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 01DFC838; Wed, 14 Jun 2023 10:12:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1686730363; bh=EOB+XTys8buj3IJtQdqls61sGqyEJtwNJtRIoWEZ9uM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LYw1K6BAkpTabXiS+mthzurbmsN8oIJaQASbtfjFxsclKy+q78EuJ7fDjwCg54Kv5 8T8f8dXNtS5BiMOsjzeZim6/HS8l5/KAwWACDYrcpRAQ12X0Yqf7UznVXxUn8qDikc CSZ2uCgX0+H5ySWns17ifQQTvbRHQ9isBheOOy0g= Date: Wed, 14 Jun 2023 11:13:14 +0300 From: Laurent Pinchart To: Biju Das Cc: Wolfram Sang , Geert Uytterhoeven , Alexandre Belloni , Mark Brown , Krzysztof Kozlowski , Rob Herring , Conor Dooley , Andrzej Hajda , Neil Armstrong , Robert Foss , David Airlie , Daniel Vetter , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Alessandro Zummo , Jonas Karlman , Jernej Skrabec , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Corey Minyard , Marek =?utf-8?B?QmVow7pu?= , Jiasheng Jiang , Antonio Borneo , Abhinav Kumar , Ahmad Fatoum , "dri-devel@lists.freedesktop.org" , "linux-i2c@vger.kernel.org" , "linux-media@vger.kernel.org" , Fabrizio Castro , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH v5 01/11] i2c: Enhance i2c_new_ancillary_device API Message-ID: <20230614081314.GD17519@pendragon.ideasonboard.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Tue, Jun 13, 2023 at 07:31:46PM +0000, Biju Das wrote: > > Subject: RE: [PATCH v5 01/11] i2c: Enhance i2c_new_ancillary_device API > > > Subject: RE: [PATCH v5 01/11] i2c: Enhance i2c_new_ancillary_device API > > > > Subject: Re: [PATCH v5 01/11] i2c: Enhance i2c_new_ancillary_device API > > > > > > > > Hi everyone, > > > > > > > > > Perhaps we should first think through what an ancillary device > > > > > really is. My understanding is that it is used to talk to > > > > > secondary addresses of a multi-address I2C slave device. > > > > > > > > As I mentioned somewhere before, this is not the case. Ancillary > > > > devices are when one *driver* handles more than one address. > > > > Everything else has been handled differently in the past (for all > > > > the uses I am aware of). > > > > > > > > Yet, I have another idea which is so simple that I wonder if it > > > > maybe has already been discussed so far? > > > > > > > > * have two regs in the bindings > > > > > > OK, it is inline with DT maintainers expectation as it is matching > > > with real hw as single device node having two regs. > > > > > > > * use the second reg with i2c_new_client_device to instantiate the > > > > RTC sibling. 'struct i2c_board_info', which is one parameter, should > > > > have enough options to pass data, e.g it has a software_node. > > > > > > OK, I can see the below can be passed from PMIC to new client device. > > > > > > client->addr = info->addr; > > > > > > client->init_irq = info->irq; > > > > > > > > > > > Should work or did I miss something here? > > > > > > I guess it will work. We instantiate appropriate device based On PMIC > > > revision and slave address and IRQ resource passed through 'struct > > > i2c_board_info' > > > > > > Will check this and update you. > > > > info.irq = irq; -->Irq fine > > info.addr = addr; -->slave address fine > > size = strscpy(info.type, name, sizeof(info.type)); -->instantiation based > > on PMIC version fine. > > > > 1) How do we share clk details on instantiated device to find is it > > connected to external crystal or external clock source? as we cannot pass > > of_node between PMIC and "i2c_board_info" as it results in pinctrl > > failure. info->platformdata and > > Client->dev.platformdata to retrieve this info?? > > Or > > I2C instantiation based on actual oscillator bit value, ie, two i2c_device_id's > with one for setting oscillator bit and another for clearing oscillator bit > > PMIC driver parses the clock details. Based on firmware version and clock, > It instantiates either i2c_device_id with setting oscillator bit or > clearing oscillator bit. I don't like that hack. I still think that two DT nodes is the best option, I think you're trying hard to hack around a problem that is actually not a problem. -- Regards, Laurent Pinchart