Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5696728yba; Thu, 11 Apr 2019 03:57:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCrE6fikbzwkFal0iqIpDi1lTooeFL2azcqR34+kB7DQucvRscF3o2VAwqHB+Uip9R12Aj X-Received: by 2002:a63:4f52:: with SMTP id p18mr45850312pgl.333.1554980224122; Thu, 11 Apr 2019 03:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554980224; cv=none; d=google.com; s=arc-20160816; b=Awc9mJc29gDNDndnf1qWJdj67ggckWrO4oJdiEF5ScofUsLW9U9jNIAxEDZkH4yOkC TdShf/Baz3G4wFTr/NP9TCMBiZc8TS6Kf4VjDfxXsxLLM4scTIU+aFuSc+qtVZcTTcl1 fOcb9QwN1sALKdRH2F/+XpOT+Zrgi6r1Ebb2f1s7yuOX0Qdzo4buAuCHwEi9oT0ZNSif C3M8nBKlGv0gbXiN86lGK4KRzUfbhNaKfSRyKL8S2vS6C3OR+dYapxaeyb63mpYHK6Rx RyyYiZtsEDVXT5xaDPQT7cINg0We9h0jI0s+kqsVLpsivkH//tSd5Pa2h3ECeY6Zxaz2 77Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=o7OiOdVA5wDwNKWk2i4kftupGzN+IIRXiTSHIiUx/Wk=; b=fk81lFdoNnp/z9usWz7B1Ut8UGtJ4tLw84/E+ROdT6QrWxZIVVuD3jd2X70TXqXA0F sMz21jKCxuyXCbbWsOdDlvkoqs9JsI8R+RxR6Bdzwu8kpFqiJP5W72TU42wCy5Dl6MFY ee8C5QbgVqj0hczl2KJ5VA6OsxnhIotQqtzQ/04H70LYMVUj1BXxQEE70ZI3N3R5nKRi fXGlEh8tmtGtVcdXpefpKkQXUvoUiONwoJYGVhd3KwJR6j8R3Hol6AjBD3i5rQ3VHHjh X6U7LixwHu0ihvhBhw+f/vaSbDSxPCLZKfO08bdiXZryN+ewtp7Wl2Uiu3hKLKDUDgmQ pzEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=uwfWXJDS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si17346299plb.317.2019.04.11.03.56.48; Thu, 11 Apr 2019 03:57:04 -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; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=uwfWXJDS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbfDKK4I (ORCPT + 99 others); Thu, 11 Apr 2019 06:56:08 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:43249 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726628AbfDKK4H (ORCPT ); Thu, 11 Apr 2019 06:56:07 -0400 Received: by mail-qk1-f195.google.com with SMTP id c20so3118126qkc.10 for ; Thu, 11 Apr 2019 03:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o7OiOdVA5wDwNKWk2i4kftupGzN+IIRXiTSHIiUx/Wk=; b=uwfWXJDSD529M0KIrkvTfwOAeNhKy4CiUzZd9+fn6yDPBYCS6z76hT2jIzUCJzHnZS LgbTMbuj6vwy8pf+RSkZmlXbCVQV/mr2lBwSshsCu0w62UXeUGWOdRt+3LNTIcDNd9Yf 1LDU4pNZ5kmKP8cvQ5roQzsrS1VqKxdxAJ3dbv2WmOOIskqT1fxujStZlDO3oeatd+8V kzxOYdFDulEkbFT+vwI/Jhn0hEeRCGpLLqtyaJuAGS8KND3PHUgRrq1lyKk/ZcEjuT75 WTDTwcHOjXpO1jaySDFfNJChmkstwefMCJyaIF7MEvJh3uFLwrDVfKFnP5r+wTYUm6YV m4xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o7OiOdVA5wDwNKWk2i4kftupGzN+IIRXiTSHIiUx/Wk=; b=XW4l6sukeVdapIDN5MOIZP9c59TxfTdMhFyFQGZg9O6KFw/7W15F6zOoTjq5NYuS9l 3i7zoMkYjfKtZzVbScYmKjSyodz8fIVzV+XTPaDv8L7W389Gp1pEsR73uhOMay/fsEgs 3HwzasW7o50OYjYWC/vA7HXBvJY5196KJQKyTZrOeAk65y2FKeqUnONspRawL+FoVRvI XEh6PyJdKg56w5LARUnmxkdgXsJQiCpBlcxe5kB5fBs6Jj/OBKq6JG00fTrQyc9V4I8O ktDDqPRILlLetP77rI5a/5GQgrTa3ugFk4zQ8ASxnWeDSR4rNYy5Kk8TKs1bfvOLLMo8 nNfA== X-Gm-Message-State: APjAAAVQkK97gY1ydjOPx0u3bNIP8R5NuPhLrIKtho3eIavldSPTmB0n KS2Y+X0GMxhUnfnFi9zy93HuHjzHyiTP63pBzFFS2g== X-Received: by 2002:a37:ad15:: with SMTP id f21mr36011256qkm.152.1554980166706; Thu, 11 Apr 2019 03:56:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Daniel Drake Date: Thu, 11 Apr 2019 18:55:55 +0800 Message-ID: Subject: Re: [PATCH 04/11] platform/x86: asus-wmi: Add quirk to force DSTS WMI method detection To: Yurii Pavlovskyi Cc: Corentin Chary , Darren Hart , Andy Shevchenko , acpi4asus-user , Platform Driver , Linux Kernel , Endless Linux Upstreaming Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 11, 2019 at 4:28 AM Yurii Pavlovskyi wrote: > The DSTS method detection fails, as nothing is returned if method is not > defined in WMNB. As a result the control of keyboard backlight is not > functional for TUF Gaming series laptops (at the time the only > functionality of the driver on this model implemented with WMI methods). > > Patch was tested on a newer TUF Gaming FX505GM and older K54C model. > > FX505GM: > Method (WMNB, 3, Serialized) > { ... > If ((Local0 == 0x53545344)) > { > ... > Return (Zero) > } > ... > // No return > } > > K54C: > Method (WMNB, 3, Serialized) > { ... > If ((Local0 == 0x53545344)) > { > ... > Return (0x02) > } > ... > Return (0xFFFFFFFE) > } > > The non-existing method ASUS_WMI_METHODID_DSTS=0x53544344 (actually it is > DCTS in little endian ASCII) is selected in asus->dsts. > > One way to fix this would be to call both for every known device ID until > some answers - this would increase module load time. > > Another option is to check some device that is known to exist on every > model - none known at the time. > > Last option, which is implemented, is to check for presence of the > ASUS7000 device in ACPI tree (it is a dummy device), which is the > condition used for loading the vendor driver for this model. This might > not fix every affected model ever produced, but it likely does not > introduce any regressions. The patch introduces a quirk that is enabled > when ASUS7000 is found. > > Scope (_SB) > { > Device (ATK) > { > Name (_HID, "ASUS7000") // _HID: Hardware ID > } > } Hmm, tricky! But about time we did something about the DSTS vs DCTS guessing. While we don't have definitive knowledge of the right thing to do here, I think I have enough info available to solidify some assumptions we'd otherwise be afraid to make, and then we can implement a better approach here. In our database of 144 Asus DSDTs, 14 of them respond to DCTS: AS_D520MT D425MC D640SA D320SF-K D415MT D830MT G11DF M32CD4-K V221ID V272UN_SKU3 Z240IE ZN220IC-K ZN241IC ZN270IE Of those 14, they all additionally respond to DSTS, except for D415MT and AS_D520MT. In all 14 cases, the DCTS handling is done inside a device with _UID ASUSWMI. None of the other 130 products have a device with that _UID. Furthermore, we recently received access to the ASUS spec, which confirms that the Instance Name for EeePC is "ACPI\PNP0C14\ASUSWMI_0" whereas the Instance Name for other notebooks is "ACPI\PNP0C14\ATK_0". The 12 devices that respond to both DCTS and DSTS, do it on separate different devices, albeit with the same _WDG UUID. The one with _UID ASUSWMI responds to DCTS, and the one with _UID ATK responds to DSTS. So that seems fairly convincing. My thinking is that we can check the _UID of the underlying device, and use DCTS for ASUSWMI, DSTS otherwise. To do that, I think you'd have to rework the driver probing so that it happens through wmi_driver_register(). Then from the probe function onwards you will get a wmi_device, and hopefully you can get the _UID through that instance somehow. There's a separate issue of what happens on those 12 machines where there are two WMI devs, with the same _WDG GUID. drivers/platform/x86/wmi.c drops duplicates, so one of them is being ignored in that case. We'd ideally find a way to ignore the ASUSWMI node and go with ATK in that situation. But I think this can be separated from your work here. Thanks for these patches and welcome to the world of kernel development! Daniel