Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1066942imc; Mon, 11 Mar 2019 05:53:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhZ6jdOcUJZ0ZCJ8tQkUpjwag8u3L1P5rtYeTwZqeri0b+xMylDQfEeVvmrVXsshCD0UTB X-Received: by 2002:a63:6bc6:: with SMTP id g189mr30239199pgc.427.1552308799148; Mon, 11 Mar 2019 05:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552308799; cv=none; d=google.com; s=arc-20160816; b=qdbstWq57C9sCFOIQd+cN7+khyqBmrSz6nTne623ATfvtrtIuV7gZbLTcY1mLi+n6W zYj37999gP0lB27SRQLnaDZhFC/7BA7MmYtJU/0It3Icvuh8uUIlRzeamaBoreHlRSDP ujlcpUeEUHeFXk4zBeRLw2nHKKPZyNUyoT6PRau6OLKJ1sCv02yUVfA6pw3HkOQctcAs QRj/fGACU347YpR1htRGhTBWpbrbKB3sfWvqf+UKvNM4SqF03Emux0XD137aXDA9tVm6 RNxgyuJhGq9O1HUD4YrpPUwOWwtAyZ/DYo+S96AW4SFKO7W43gbprhr9iPZ5BfIUYsml aU/Q== 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=jKujQ2AQ89Ug02IszYMHfyIHfpL7/ZHPFCiVHz5vW8Q=; b=Kf/rTtQrp7snbtr90bRR9x36YyQx0I8ALute8wI/eKtbJ8mZ9G/RSdluvO6P+8L49V C8TPBVT2KCzVHmtm3Xz497mORNI5W3VckH6NM66WDuitQY8zXQdF039j0wGEPNQLR+nM DnBOlpyF7h0kAziVuzbInO+CLuZsCX6RR9jSfpJUci4cqJ5qtjsiOudTESM+TPdlOA+4 kHIvMNDEHxJ3njq9hnOI+YCy9vrUDL3prngVaA0a6mPlkBlZAaplv1vtYwFkMwEtQznl 2PgwjSKsti0+vpJQthJpJ8l46vRytnepAHx14ZKYGoIukOPPKKGd18H79CrejbWqBRhj QhJA== 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 k190si5030858pgd.288.2019.03.11.05.53.03; Mon, 11 Mar 2019 05:53:19 -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 S1727360AbfCKMwL (ORCPT + 99 others); Mon, 11 Mar 2019 08:52:11 -0400 Received: from mga14.intel.com ([192.55.52.115]:22053 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbfCKMwL (ORCPT ); Mon, 11 Mar 2019 08:52:11 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2019 05:52:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,467,1544515200"; d="scan'208";a="140980163" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga002.jf.intel.com with ESMTP; 11 Mar 2019 05:52:08 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h3KPX-0005L6-4C; Mon, 11 Mar 2019 14:52:07 +0200 Date: Mon, 11 Mar 2019 14:52:07 +0200 From: Andy Shevchenko To: Hans de Goede Cc: Jarkko Nikula , 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: <20190311125207.GR9224@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: <20190311112216.31391-2-hdegoede@redhat.com> 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 Mon, Mar 11, 2019 at 12:22:15PM +0100, 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. > > This commit adds support for setting a "linux,use-dynamic-adapter-nr" > device property on the device to make i2c-designware-platdrv use dynamic > adapter-nrs on devices without an ACPI fwnode, together with changes to > drivers/mfd/intel-lpss-pci.c to set this, this fixes the WARN. > > Before this commit the setting of the adapter.nr was somewhat convoluted, > in the acpi_companion case it was set from dw_i2c_acpi_configure, in the > non acpi_companion case it was set from dw_i2c_set_fifo_size() based on > tx_fifo_depth not being set yet. This commit also cleans this up. Can we split this to two patches, i.e. one is almost the same as this one, except the second one adds a new property check to the conditional? If you agree to do so, you may add mine Rb tag to the first one out of three. > Note the "linux,use-dynamic-adapter-nr" is meant for kernel internal use > only, therefor it is NOT documented under Documents/devicetree/bindings. To the second and third ones, can we rather check if the device has fwnode either ACPI or swnode? AFAIU now we have swnode assigned during MFD device registration and can easily distinguish this w/o any additional properties. -- With Best Regards, Andy Shevchenko