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 5815AC678D5 for ; Wed, 8 Mar 2023 16:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbjCHQax (ORCPT ); Wed, 8 Mar 2023 11:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbjCHQaw (ORCPT ); Wed, 8 Mar 2023 11:30:52 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 947911993; Wed, 8 Mar 2023 08:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678293051; x=1709829051; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=oKN2YVAhWdMDazYxC3zM74ycX+IfIN3U3RFFhR2hNWA=; b=dWMAnVcd/PRJl2RFXuO3za6tlkmaAdG4GwlfqC2C7GLKniTqmd/hzUbZ aV6ukO2HWsils+keP/NuI6URB/H5PwtgMc3fDR9r7g7spWXIrF6MJyw53 DvRX+sG++5v5M7kOr2WfzadacnD6tLVjP8JV3EHEOYA01j3U2F58pkcCw eUtL745mi7eqYfD18FA5Od8CWOSwaaLCY/DaxrMH2rpSbZtiH942UOi1h uKA2RI0O7xFI6HVMmsPOlQOFnJAq7cmXVlZNToT+K8dID86SjIp9/op/C u+RgcwrOgAr8M27LWJGpcVEuaFGSh/8EvS2LdLuKaeOtJbFhsP/zfA1om Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10642"; a="422473108" X-IronPort-AV: E=Sophos;i="5.98,244,1673942400"; d="scan'208";a="422473108" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2023 08:30:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10642"; a="820290156" X-IronPort-AV: E=Sophos;i="5.98,244,1673942400"; d="scan'208";a="820290156" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP; 08 Mar 2023 08:30:48 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pZwgg-00HVnO-1D; Wed, 08 Mar 2023 18:30:46 +0200 Date: Wed, 8 Mar 2023 18:30:46 +0200 From: Andy Shevchenko To: Benjamin Tissoires Cc: Daniel Kaehn , Hans de Goede , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jikos@kernel.org, bartosz.golaszewski@linaro.org, dmitry.torokhov@gmail.com, devicetree@vger.kernel.org, linux-input@vger.kernel.org, ethan.twardy@plexus.com Subject: Re: [PATCH v8 3/3] HID: cp2112: Fwnode Support Message-ID: References: <20230307131706.olnb4qzo4ynu7gce@mail.corp.redhat.com> <20230307144852.ueyaotkeeqfjlgk7@mail.corp.redhat.com> <20230308152611.tae2pnmflakrcyhh@mail.corp.redhat.com> <20230308155527.jnrsowubvnk22ica@mail.corp.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230308155527.jnrsowubvnk22ica@mail.corp.redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Mar 08, 2023 at 04:55:27PM +0100, Benjamin Tissoires wrote: > On Mar 08 2023, Daniel Kaehn wrote: > > On Wed, Mar 8, 2023 at 9:26 AM Benjamin Tissoires > > wrote: > > > But if I refer "\\_SB_.PCI0.USB0.RHUB.CP21.GPIO", the IRQ is never assigned. > > > With the parent (CP21), it works. > > > > > > So I wonder if the cp2112 driver is correctly assigning the gc->parent > > > field. > > Did you make a change to the CP2112 driver patch to look for uppercase > > "I2C" and "GPIO"? > > yes, sorry I should have mentioned it. This is the only modification I > have compared to the upstream kernel plus your patch series. > > > Otherwise, it won't assign those child nodes appropriately, and the > > gpiochip code will use > > the parent node by default if the gpiochip's fwnode isn't assigned (I believe). > > I don't think it's a fwnode issue, but a problem with the assignment of > the parent of the gc: > --- > dev->gc.parent = &hdev->dev; > --- I don't think so. The parent should point to the _physical_ device, which is CP2112, which is correct in my opinion. > Because the function acpi_gpiochip_find() in drivers/gpio/gpiolib-acpi.c > compares the acpi handle returned by fetching the ACPI path > ("\\_SB_.PCI0.USB0.RHUB.CP21.GPIO") and the one of gc->parent, which in > the hid-cp2112 case is the HID device itself. We have specifically gc->fwnode for cases like this. ... > Device (CP21) // the USB-hid & CP2112 shared node > { > Name (_ADR, One) > Name (_DSD, Package () > { > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), > Package () { > Package () { "cell-names", Package () { "i2c", "gpio" } > } Yeah, looking at this, I think it still fragile. First of all, either this is missing, or simply wrong. We would need to access indices. ACPI _ADR is in the specification. As much as with PCI it may be considered reliable. So, that said, forget about it, and simply use _ADR as indicator of the node. See how MFD (in the Linux kernel) cares about this. Ex. Diolan DLN-2 driver. > }) > > Device (I2C) > { > Name (_ADR, Zero) > Name (_STA, 0x0F) > } > > Device (GPIO) > { > Name (_ADR, One) > Name (_STA, 0x0F) > > Name (_DSD, Package () { > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), > Package () { > Package () { "gpio-hog", 1 }, > Package () { "gpios", Package () { 4, 0 } }, > Package () { "output-high", 1 }, > Package () { "line-name", "gpio4-pullup" }, > }, > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), > Package () { > Package () { "gpio-line-names", Package () { > "", > "", > "irq-rmi4", > "", > "power", // set to 1 with gpio-hog above > "", > "", > "", > ""}}, > } > }) > } > } -- With Best Regards, Andy Shevchenko