Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2154733imc; Tue, 12 Mar 2019 08:05:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNsIaRP0wzqr6pMw6bseLX7XoYpQXdmZIgkZYuR5OWjLvdYRo7/iBXSXUujIZMksfw/Mry X-Received: by 2002:a62:bd17:: with SMTP id a23mr38487351pff.233.1552403158370; Tue, 12 Mar 2019 08:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552403158; cv=none; d=google.com; s=arc-20160816; b=WOUX0/SIrsRhWKbJulnY6BAxzbto2tyiCdyI1aolgkzATUhP9ITfwruqYtNP0thGLr CAwsPW84MKVTycV6rxtdRSv1UzXyJy2pAbjLgMWYs0ZnZoFdu4CqFcKGfBPrwz6ear27 84vy2SZGSaTLD4iXfz1MxEFc2mkkH3v655eiIG+BSzrTyVcILQMWtCmWmpvJ1Cy4BJg4 yUwk1unH5OVp594JR4YM2MB6/GDuiIkfMemdaweYf8n3y2QMhyRzt4nIQU9Pqow77MVM NfJW75I1tdzgwYJhqG8eV7eRzqTot7lJeZXMOvPrKhRICyZC89fO2d6CjiA3abdIIFfw Si2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VOK2Xs/bqIa3fxVdU/MYqDW5LiTAI5lO3wBgOZC1WtY=; b=NvASKXHeoQKLCkOCZnHniKGWZhF5yXaQaTmgbYe1YclmHfcel06zLHqPqhLbgkM05/ 19lcGMWTJmqJwSEl3eTHMXadr6TehoZPN9FKz7JesYXYNr7j1yk/T4xNsKdgiwhO7he7 DnPDr+a8tMeDRsUIkhqBnndw2hFuNL8YYi0563xrbN+fbAS5SI7zk6oNJswl2/PJ4vRr uYa0PqHhZS4VTQ/CgOOhSi6PSe5rwGUs97ixyf2XMKI/Eh4FuVfnS4oOZCxB1Xf6w2Yd z2V/2PlZPLC3eSaniE7SnlZygBpVdCHKdB0gyvZWwusATFRAgUS1BBavl2C8Lrf0DnBG v7/w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x15si8008776pgi.420.2019.03.12.08.05.42; Tue, 12 Mar 2019 08:05:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbfCLPFR (ORCPT + 99 others); Tue, 12 Mar 2019 11:05:17 -0400 Received: from mga04.intel.com ([192.55.52.120]:54652 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbfCLPFQ (ORCPT ); Tue, 12 Mar 2019 11:05:16 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2019 08:05:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,471,1544515200"; d="scan'208";a="130980841" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga008.fm.intel.com with ESMTP; 12 Mar 2019 08:05:14 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h3ixt-00089O-D3; Tue, 12 Mar 2019 17:05:13 +0200 Date: Tue, 12 Mar 2019 17:05:13 +0200 From: Andy Shevchenko To: Jarkko Nikula Cc: Hans de Goede , Wolfram Sang , Mika Westerberg , Lee Jones , linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] i2c: i2c-designware-platdrv: Allow a dynamic adap. nr without an ACPI fwnode Message-ID: <20190312150513.GE9224@smile.fi.intel.com> References: <20190311112216.31391-1-hdegoede@redhat.com> <20190311112216.31391-2-hdegoede@redhat.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 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 12, 2019 at 04:47:48PM +0200, Jarkko Nikula wrote: > On 3/11/19 1:22 PM, Hans de Goede wrote: > > Before this commit the i2c-designware-platdrv assumes that if the pdev > > has an apci-companion it should use a dynamic adapter-nr and otherwise > > it will use pdev->id as adapter-nr. > > > > On some devices e.g. the Apollo Lake using Acer TravelMate Spin B118, > > some of the LPSS i2c-adapters are enumerated through PCI and do not have > > an ACPI fwnode. These devices are handled as mfd devices so they end up > > using the i2c-designware-platdrv driver. > > > > This results in the i2c-adapter being registered with the mfd generated > > pdev->id as adapter-nr, which conflicts with existing adapters, triggering > > a WARN(id < 0, "couldn't get idr") in i2c-core-base.c and causing the > > adapter registration to fail. > > > I went thinking would we get a regression if we switch the > i2c-designware-platdrv to dynamic numbering unconditionally? > > Only drivers/mfd/intel-lpss.c and drivers/mfd/intel_quark_i2c_gpio.c > register platform device "i2c_designware" and otherwise in the driver itself > for known ACPI IDs and device tree bindings. > > Things should be fine for ACPI cases if slave devices are also described in > ACPI tables. As far as I've understood with device tree matching adapter > number is irrelevant in slave device registration? Seems like Hans came to the same conclusion. > Andy: could you tell by commit 918fe70cf475 ("mfd: intel_quark_i2c_gpio: > support devices behind i2c bus") are those devices described in ACPI or in > some i2c_board_infos with referring to fixed adapter number either in or out > of kernel tree code? As far as I remember they are coming from ACPI, but you may easily check on real hardware we have in our lab. > Then drivers/platform/chrome/chromeos_laptop.c is the only code searching > for adapter named as "Synopsys DesignWare I2C adapter" without assuming any > fixed adapter numbering. > What's unclear to me can there be device tree cases where i2c-designware > probing comes with pdev->id not starting from zero or in different order? > I.e. would it make difference do we use pdev->id or dynamic adapter > numbering? -- With Best Regards, Andy Shevchenko