Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1191459rdg; Fri, 13 Oct 2023 13:06:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnIKBzLH5P0YbVtuwZEcIG+HCDA2Jub0uULxlsMvb/njR0kMKtwNGu8E2jxKxSlp8Bssou X-Received: by 2002:a05:6e02:1789:b0:357:3e6d:d543 with SMTP id y9-20020a056e02178900b003573e6dd543mr14064049ilu.23.1697227560957; Fri, 13 Oct 2023 13:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697227560; cv=none; d=google.com; s=arc-20160816; b=DpPkm4AW9u3eSoOUf525aXJNf9IzkPMNhCZkh/XndatiDtS22kl+FQ8L0MOmvzw8kk WWyd9pZN4zwCrQaD1sg0W9vPdGcSvwwx4e89QbSkD8kn2/FWOSgTMk19Ys4/Em0QN5gQ UYR7k6oRZnY9GqjucUR2j1uge7p6O0ponL1IWFC2HBMDK/zBPyMYCA8Hf+HphFFza1iQ dKjvxRmLRS45Vk+2+0LjPzzLwzG/bV/H7u0fX+Cev9A5529xSpM+iqFyh1+koQTIIpcF qXQDDlC399uhmRui48sfPUnnHZxv2b2WnS4SrDSk0+4d6Qy0ZjwGNiTs+YwNJpkpt55V /9ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Fn2VoH+jO52PLfkUz+eAZthMXBL+t50k4/YkKONMS2g=; fh=7zbyT+VJble42sk91HAiTCeJwG14UF9g0FSXOQ+kWPs=; b=x1B5mNDSgbczFGtXNU4vDT6auqq0lrSs31GQLokeTVgC2ySdI3Le92Rm7qiLq2XclU v/dGjMSFGadiUyK0g+k9dcze4MgxGCjR+/JWEncxDtgizkCLOnCdzFgwUe3KG6pTTSkU CKn20FcJsbXAg8OHamX9Cjm+fIPFd2EnJeRsjTDK5dgsuxjmOkvrFvh3X5FKuMhRpcJa in0TlDubR4aWPpE1Uy8tiCeUjMmQkGNIzCkb3rNA5u8RM5yqzZvH1oSydJh8b9H+ywBP 5SzGqc4MpKYa74ySb6KzyYz77CP9yKx2kNvN99MsxqGImZEh/KN+I1rRo/NTIq4r6Zkw JC6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="keF77/CC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id j22-20020aa78016000000b0068a3c575900si16212499pfi.84.2023.10.13.13.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="keF77/CC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6A05181C00C7; Fri, 13 Oct 2023 13:05:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231902AbjJMUFq (ORCPT + 99 others); Fri, 13 Oct 2023 16:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbjJMUFp (ORCPT ); Fri, 13 Oct 2023 16:05:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 497DCB7; Fri, 13 Oct 2023 13:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697227544; x=1728763544; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5it+lZKtnoTVXQpnj5JtqmDZwGeKWf9KR13g1UL7qjw=; b=keF77/CCV/rnVrm2KhscP506Z7cLsHRpF32Bx9d+P2VbzatSsuplSHwm 8ti5nl+Pkvx/Y3MyRHd79vq5j1yyBE1CkfhTbnoQfnDO6tkgwsKtNJ2Gr D41bvFcWVKSO/HPivYY80hS0paiEWkXl5u4sL9qKGpS3gX+pQxBV1VhWi vr3f1GRkuNXMPAtWhhP/Ec3h+5um0pgZrH59vRDwr5RoPMja/SbBrWBzP 2+Jy48igYMZJiwBWdyTbew6wXmDgGL3xp6rjArR6Pi5Kk15hgQbqx9oiM Yia5T5GcUL7/n53fVD9j0lHyzqD/UddmY9AdNYQi7UDhdCuLjbYxLHIG6 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10862"; a="389115490" X-IronPort-AV: E=Sophos;i="6.03,223,1694761200"; d="scan'208";a="389115490" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2023 13:05:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10862"; a="789976484" X-IronPort-AV: E=Sophos;i="6.03,223,1694761200"; d="scan'208";a="789976484" Received: from unknown (HELO smile.fi.intel.com) ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2023 13:05:40 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC1) (envelope-from ) id 1qrOPg-00000005Jz1-2wkn; Fri, 13 Oct 2023 23:05:36 +0300 Date: Fri, 13 Oct 2023 23:05:36 +0300 From: "Shevchenko, Andriy" To: Hans de Goede Cc: "Wu, Wentong" , "gregkh@linuxfoundation.org" , "oneukum@suse.com" , "wsa@kernel.org" , "andi.shyti@linux.intel.com" , "broonie@kernel.org" , "bartosz.golaszewski@linaro.org" , "linus.walleij@linaro.org" , "linux-usb@vger.kernel.org" , "linux-i2c@vger.kernel.org" , "linux-spi@vger.kernel.org" , "sakari.ailus@linux.intel.com" , "Wang, Zhifeng" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v20 1/4] usb: Add support for Intel LJCA device Message-ID: References: <1696833205-16716-1-git-send-email-wentong.wu@intel.com> <1696833205-16716-2-git-send-email-wentong.wu@intel.com> <6a87b43a-0648-28d4-6c69-e0f684e44eb6@redhat.com> <5d2e9eba-a941-ea9a-161a-5b97d09d5d35@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5d2e9eba-a941-ea9a-161a-5b97d09d5d35@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 13:05:58 -0700 (PDT) On Thu, Oct 12, 2023 at 01:14:23PM +0200, Hans de Goede wrote: > On 10/11/23 14:50, Wu, Wentong wrote: > >> On 10/11/23 12:21, Andy Shevchenko wrote: > >>> On Mon, Oct 09, 2023 at 02:33:22PM +0800, Wentong Wu wrote: > >>>> Implements the USB part of Intel USB-I2C/GPIO/SPI adapter device > >>>> named "La Jolla Cove Adapter" (LJCA). > >>>> > >>>> The communication between the various LJCA module drivers and the > >>>> hardware will be muxed/demuxed by this driver. Three modules ( I2C, > >>>> GPIO, and SPI) are supported currently. > >>>> > >>>> Each sub-module of LJCA device is identified by type field within the > >>>> LJCA message header. > >>>> > >>>> The sub-modules of LJCA can use ljca_transfer() to issue a transfer > >>>> between host and hardware. And ljca_register_event_cb is exported to > >>>> LJCA sub-module drivers for hardware event subscription. > >>>> > >>>> The minimum code in ASL that covers this board is Scope > >>>> (\_SB.PCI0.DWC3.RHUB.HS01) > >>>> { > >>>> Device (GPIO) > >>>> { > >>>> Name (_ADR, Zero) > >>>> Name (_STA, 0x0F) > >>>> } > >>>> > >>>> Device (I2C) > >>>> { > >>>> Name (_ADR, One) > >>>> Name (_STA, 0x0F) > >>>> } > >>>> > >>>> Device (SPI) > >>>> { > >>>> Name (_ADR, 0x02) > >>>> Name (_STA, 0x0F) > >>>> } > >>>> } > >>> > >>> This commit message is not true anymore, or misleading at bare minimum. > >>> The ACPI specification is crystal clear about usage _ADR and _HID, i.e. > >>> they must NOT be used together for the same device node. So, can you > >>> clarify how the DSDT is organized and update the commit message and it > >>> may require (quite likely) to redesign the architecture of this > >>> driver. Sorry I missed this from previous rounds as I was busy by > >>> something else. > >> > >> This part of the commit message unfortunately is not accurate. > >> _ADR is not used in either DSDTs of shipping hw; nor in the code. > > > > We have covered the _ADR in the code like below, it first try to find the > > child device based on _ADR, if not found, it will check the _HID, and there > > is clear comment in the function. > > > > /* bind auxiliary device to acpi device */ > > static void ljca_auxdev_acpi_bind(struct ljca_adapter *adap, > > struct auxiliary_device *auxdev, > > u64 adr, u8 id) > > { > > struct ljca_match_ids_walk_data wd = { 0 }; > > struct acpi_device *parent, *adev; > > struct device *dev = adap->dev; > > char uid[4]; > > > > parent = ACPI_COMPANION(dev); > > if (!parent) > > return; > > > > /* > > * get auxdev ACPI handle from the ACPI device directly > > * under the parent that matches _ADR. > > */ > > adev = acpi_find_child_device(parent, adr, false); > > if (adev) { > > ACPI_COMPANION_SET(&auxdev->dev, adev); > > return; > > } > > > > /* > > * _ADR is a grey area in the ACPI specification, some > > * platforms use _HID to distinguish children devices. > > */ > > switch (adr) { > > case LJCA_GPIO_ACPI_ADR: > > wd.ids = ljca_gpio_hids; > > break; > > case LJCA_I2C1_ACPI_ADR: > > case LJCA_I2C2_ACPI_ADR: > > snprintf(uid, sizeof(uid), "%d", id); > > wd.uid = uid; > > wd.ids = ljca_i2c_hids; > > break; > > case LJCA_SPI1_ACPI_ADR: > > case LJCA_SPI2_ACPI_ADR: > > wd.ids = ljca_spi_hids; > > break; > > default: > > dev_warn(dev, "unsupported _ADR\n"); > > return; > > } > > > > acpi_dev_for_each_child(parent, ljca_match_device_ids, &wd); > > Ah ok, I see. So the code: > > 1. First tries to find the matching child acpi_device for the auxdev by ADR > > 2. If 1. fails then falls back to HID + UID matching > > And there are DSDTs which use either: > > 1. Only use _ADR to identify which child device is which, like the example > DSDT snippet from the commit msg. > > 2. Only use _HID + _UID like the 2 example DSDT snippets from me email > > But there never is a case where both _ADR and _HID are used at > the same time (which would be an ACPI spec violation as Andy said). > > So AFAICT there is no issue here since _ADR and _HID are never > user at the same time and the commit message correctly describes > scenario 1. from above, so the commit message is fine too. > > So I believe that we can continue with this patch series in > its current v20 form, which has already been staged for > going into -next by Greg. > > Andy can you confirm that moving ahead with the current > version is ok ? Yes as we have a few weeks to fix corner cases. What I'm worrying is that opening door for _ADR that seems never used is kinda an overkill here (resolving non-existing problem). Looking at the design of the driver I'm not sure why ACPI HIDs are collected somewhere else than in the respective drivers. And looking at the ID lists themselves I am not sure why the firmware of the respective hardware platforms are not using _CID. -- With Best Regards, Andy Shevchenko