Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp231948rdg; Thu, 12 Oct 2023 04:16:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7ouGBRciBIJGNohQtAaIaSwQmJK4fbmXLw/f2WXQG6ITXAtdvuFvq4V9ImWQwBrlR7mrg X-Received: by 2002:a05:6a20:8e12:b0:161:28dd:c09d with SMTP id y18-20020a056a208e1200b0016128ddc09dmr29668372pzj.15.1697109397325; Thu, 12 Oct 2023 04:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697109397; cv=none; d=google.com; s=arc-20160816; b=xYi8ZAoub71BFF/2jbJBFjDBmAKTT+bDFgXAm9fJlJuIrXodVFvkbVdoxL0cUeXwq1 0GiEGpzapEZAe79P5tFWtUl41FQsICzDyRzmrHoO2qWJqJxPSZ2KcYFP8MbqtSFKZIz8 iGKvrXvL1ybQoVlskv01rIPc/NMEa6aILNSyIUdns+siVJQXPTuVXmR+3iF79qNY2Mn6 Gt7HOy5ciKfdon/cc7cQlRv+YEKTHWFPV9J4od2fdUZ5JP1qkGMiiGa7/e6NbT4VuDEN Wn7ST22pStG2G4fz3x08YEKjfrPnNlD6CqxgoGsRyxSFoPgAWVLXYJbSNWQLfg30IRBV 4psA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=DRaC+0mMS0mqrKmBhT+mt/F7wkHtGnlArsECVSA7S7c=; fh=nprCEB46onyacwhcJE1CQ2p0V9uPdFHHQUAZrsoHvsw=; b=TOeArvQnxuAuvLpamPFhZFCCWOdypszzS0CpbDboxbGcKw7SQL5gm5qc/glhxXtJWT igz9dKVC9sLh2DdkJRsKVrp9hNgo/VCWm4wCCgA8evuRwJ6AKVXBfV+6vk9X1214zN28 qkTwD40n7QovusnHWF6SigwVBeHVqbEfzu+UyKRu9BUn3Amg1GunJdr/1419hP8p6fPl 4vxiM5/o57WOoTYYHRZftLvDm0ApnRe8gAtQsxyQqGaRyn/TuoeNvVXaGRSifXRvpuk/ 37VyXX9wG2VoqAsNhL/ggLUA1waGgRsD5T2K6xj3PwP35EvWakhV3lJFJflBl0Z6CEBD U+sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hR1OMGRo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id i1-20020a635841000000b00578b8d202b0si2093108pgm.536.2023.10.12.04.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hR1OMGRo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 01533809B9DA; Thu, 12 Oct 2023 04:15:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377950AbjJLLPU (ORCPT + 99 others); Thu, 12 Oct 2023 07:15:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbjJLLPS (ORCPT ); Thu, 12 Oct 2023 07:15:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C86E0 for ; Thu, 12 Oct 2023 04:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697109268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DRaC+0mMS0mqrKmBhT+mt/F7wkHtGnlArsECVSA7S7c=; b=hR1OMGRooprtHII45+wgrGi+9TtD06edMnrSIcFallTokFYwT+ro7IrwQqtARldXlp20un tLhPVFlMGiqfB4FwXRsb20Wn4OyTcxmis7mMZg/usMUv9hCoKlX5whHPNSGk0z6kMjia5Z BiGy9d4J35E5qJ3aBRhaZAO3j3TzjAc= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-bt7fktxVPcyexyEM-FrQ1w-1; Thu, 12 Oct 2023 07:14:26 -0400 X-MC-Unique: bt7fktxVPcyexyEM-FrQ1w-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9bd7c682b33so63735166b.3 for ; Thu, 12 Oct 2023 04:14:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697109265; x=1697714065; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DRaC+0mMS0mqrKmBhT+mt/F7wkHtGnlArsECVSA7S7c=; b=QMWa3aZtZKXdKrhoi6traJtFW8IEadTzRTa04WNKAHZ4CJQP/KYCjcVAuG2fUfpcKg 656YgRMTbWVCDFO3YIS6BijotUUxb+4QneonvPgqMimlfMXQ/YvEaRUwmRhDuSqiFEkT 3V4pZX55Q6Wu2Z+Pl+4Clbhho3QyF52qYurfvAzGfMmsV1WrnsWrr7+atFa7R+zcTlh4 8LUIzoXYnVUNUqULfFaXWECn8GCJKdw2W8yrpXkVcm3jrNOrf+imw7r3dc25QUdwClyd TsRV2YtnvZNuS+5NZzauR1nUpHg5qFttj+pJVEVElHN3ALOmHd3h1Sg4QGBR6rAy54XK HV6Q== X-Gm-Message-State: AOJu0YwSv4GWV5LpkR14Sx4aAS1WurKDPNi5uEr5W9bQ05K6DWgZPrn0 OKGg8+s1oguIGRUMqLPlZaKulnvexDfmiozXs36ywi/z/2e1ffPkE18iAtiID7DrybPnfApN5md CgKaLC2H9f0gMXCgVPliirOAY X-Received: by 2002:a17:907:720b:b0:9a1:f4e8:87b9 with SMTP id dr11-20020a170907720b00b009a1f4e887b9mr25620939ejc.45.1697109265305; Thu, 12 Oct 2023 04:14:25 -0700 (PDT) X-Received: by 2002:a17:907:720b:b0:9a1:f4e8:87b9 with SMTP id dr11-20020a170907720b00b009a1f4e887b9mr25620912ejc.45.1697109264928; Thu, 12 Oct 2023 04:14:24 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id ks8-20020a170906f84800b0099b6becb107sm11078691ejb.95.2023.10.12.04.14.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 04:14:24 -0700 (PDT) Message-ID: <5d2e9eba-a941-ea9a-161a-5b97d09d5d35@redhat.com> Date: Thu, 12 Oct 2023 13:14:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v20 1/4] usb: Add support for Intel LJCA device Content-Language: en-US, nl To: "Wu, Wentong" , "Shevchenko, Andriy" Cc: "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" 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> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:15:29 -0700 (PDT) Hi, On 10/11/23 14:50, Wu, Wentong wrote: >> From: Hans de Goede >> >> Hi, >> >> 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 ? Regards, Hans