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 C1C76C636D3 for ; Tue, 31 Jan 2023 14:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232027AbjAaONy (ORCPT ); Tue, 31 Jan 2023 09:13:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjAaONv (ORCPT ); Tue, 31 Jan 2023 09:13:51 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA733C0A; Tue, 31 Jan 2023 06:13:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675174430; x=1706710430; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=/BEyfGW0W/aNEviei4kNEG3m+BpXMjr5t7OGNNmaDWM=; b=ioz6Nc7Ln4FiaXhcghfkBaYM7jKk6skuQ8CBvZ/D0LLVMv+UOHGT+ju+ 5eQ03jQOzmxZB/fX7W79XkYAkP4KrFTmiXIlOxQy1GDsmK748q9DSQU8D O2EKm0qWPV+VinplluWbcoBpVsfWR8Kt0Ifhw6doKjQYSQV4//6/gQzhn 6a4i9jgJBQpU4EluU5995lDhLVyhsyq8802iD6hZGmMds//VE+qCdkEPE jqqRI9ia6vmO6Jgmm1a61Uk5noMEw4sLtqwHQzqNtiIaE/ZWmOQVHBh0N 1XBuyJVW4FqgLpM4QWq2kXckWw1BRcAlzSX8A08NEd933A5f+ogk0dgyW Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="392399983" X-IronPort-AV: E=Sophos;i="5.97,261,1669104000"; d="scan'208";a="392399983" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2023 06:13:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="727958871" X-IronPort-AV: E=Sophos;i="5.97,261,1669104000"; d="scan'208";a="727958871" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga008.fm.intel.com with ESMTP; 31 Jan 2023 06:13:03 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pMrNd-000Hgz-30; Tue, 31 Jan 2023 16:13:01 +0200 Date: Tue, 31 Jan 2023 16:13:01 +0200 From: Andy Shevchenko To: "Sahin, Okan" Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Jonathan Cameron , Lars-Peter Clausen , ChiYuan Huang , "Bolboaca, Ramona" , Caleb Connolly , William Breathitt Gray , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-iio@vger.kernel.org" Subject: Re: [PATCH v3 3/5] drivers: regulator: Add ADI MAX77541/MAX77540 Regulator Support Message-ID: References: <20230118063822.14521-1-okan.sahin@analog.com> <20230118063822.14521-4-okan.sahin@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 31, 2023 at 01:59:45PM +0000, Sahin, Okan wrote: > On Tue, 31 Jan 2022 4:30 PM > Andy Shevchenko wrote: > >On Tue, Jan 31, 2023 at 01:23:33PM +0000, Sahin, Okan wrote: > >> On Tue, 31 Jan 2022 3:27 PM > >> Andy Shevchenko wrote: > >> >On Tue, Jan 31, 2023 at 09:27:48AM +0000, Sahin, Okan wrote: ... > >> >> Sorry for second question. I do not want to bother you, but I > >> >> realized that I need to be sure about driver_data before sending > >> >> new patch. You said that you need to use pointers directly for > >> >> driver_data then I fixed that part in mfd, but I do not need or > >> >> use driver_data in regulator since chip_id comes from mfd device so > >> >> I think using like below should be enough for my implementation. > >> >> > >> >> static const struct platform_device_id max77541_regulator_platform_id[] = > >{ > >> >> { "max77540-regulator", }, > >> >> { "max77541-regulator", }, > >> >> { /* sentinel */ } > >> >> }; > >> >> MODULE_DEVICE_TABLE(platform, max77541_regulator_platform_id); > >> >> > >> >> static const struct of_device_id max77541_regulator_of_id[] = { > >> >> { .compatible = "adi,max77540-regulator", }, > >> >> { .compatible = "adi,max77541-regulator", }, > >> >> { /* sentinel */ } > >> >> }; > >> >> MODULE_DEVICE_TABLE(of, max77541_regulator_of_id); > >> >> > >> >> What do you think? > >> > > >> >If you have got all necessary data from the upper layer, why do you > >> >need to have an ID table here? I'm not sure I understand how this OF > >> >ID table works in this case. > > > >> I added it since there is regulator node in device tree. With the help > >> of devm_regulator_register(..), driver takes parameters of regulator > >> node. I also used id to select and to initialize regulator descriptors > >> which are chip specific. So far there is no comment about OF ID table > >> so I kept it. I thought I need to add both of id table and platform id > >> table as name matching is required to initialize platform device from mfd. > > > >For platform device is one mechanism how to enumerate device, and bind it to > >the driver. The OF ID table needs to be present in case you are using it for direct > >DT enumeration (there is also something related to MFD child nodes, but you > >need to check and explain how your device is enumerated by this driver). > > > >I.o.w. please clarify how the OF ID table is being used. > > I do not use "of id table" directly in max77541-regulator.c so do I need to exclude it? Exactly my point. How does this OF ID table affect the device enumeration? > However, devm_regulator_register(..) method initialize each regulator with > the nodes under "regulators node". If of_match in desc and name of node > matches, then regulator will be initialized with parameters in the node under > the regulators node in the device tree. Since I am using device tree to > initialize regulators, I added of id table. I hope I explained the situation > clearly. This is confusing. If your regulator is enumerated via DT, why do you need MFD? -- With Best Regards, Andy Shevchenko