From nobody Sat Dec 24 08:36:59 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NfHTm1wTRz1HSkk; Sat, 24 Dec 2022 08:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NfHTm1HBsz3NwB; Sat, 24 Dec 2022 08:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671871020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i3HZpeYWlQDM3zZiV/5xEfAKhz7W8Vsj/et9MRPiC3w=; b=oRFYYcCQDJoJv0dwyKNaU26SAPJr0ztGtxLPSc2lBXuAFc7WHuPp+juDqHOGQWslM4BvFm QmuK0mxKwUaf0BVNmEsUtdKEVAETINNPxSEdysWO4fm2OBKOHd13iVfR1b1/K8xv4FK4zX leAunX9/A8PeUs+mLm0a1H2Tc5Ehw8IHQyS1FPlPFipFpcX5m02/j7km3Il7WTeScrihfU koVll8Umyd1ttcaVOlbIAs08UNAaqmbizo8zbvRvtNHe13IuWScS8JiO9TV7DLrD6VoMxa BY4s6Lk1YpI69s+1WfiL+A5rsmm6T+L317wRLSBQUAg4zyjqtZQKI5TWIOmV1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671871020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i3HZpeYWlQDM3zZiV/5xEfAKhz7W8Vsj/et9MRPiC3w=; b=qAtA7RZ4MoRR/D0HAO8tU8bDCvueVRKKhz4X1CnjMS9grjFTZ51qf5a6ZzYFQxT2eG6/mD 79Tj7o5fiMIRohBtOt7OwtYWKvaxYKO29I/xxakkxPIrVnvOfpzW9Y9hctD8dfnK2q19wW wkSmksfEW1dLYMmzLLUamQoIIIZiwYKqBZaEyjH/UHkFEjeX+NR7Z71610rBFnNmcad2++ W/+znyvQXAIVMYPGk4Cy3KzfsViCFktcIKu8uhBLs7qycfrjsxj4n9eEKRzYCqTHjki1gV xEL+OghSxsd0F4TdWBlWZF2lUATJ+6YG1RO2qUtTcJ2rxFhbebS4B5OEweLpcQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671871020; a=rsa-sha256; cv=none; b=s4XL1JtsIcfxC20qLEsqg7pUr2XEABxxBTCbMD43hw6TG2cOQq3PWsOtFhXoidP8KsW9if FuG+xpxn0Aq5GTIJ+ok9BjYuCdwFGOS80BqR8Ri5VclOY44SonI94sbzD2iAixD0vGWe3O bK0hQW+ESSfh0U+dGec6i4k1sBAL9EG4h0kDbsVNMPF31QpMenFBQGHjd4AR1RRDnF0MS2 QP8JPWumbRXA4NhaYBdL8kk8Wm9+TcVdsvrj3ZsyWVG3P81mwD6rq38S9VffS6A0+I1Lmi /xuHoMoYlfQRL7X6Xk5ggKaQhiM70TMQ10MY1qHM0eiAqCk7K6nuXVxnvFgZeg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NfHTm0CZFz16Wg; Sat, 24 Dec 2022 08:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BO8axNP083424; Sat, 24 Dec 2022 08:36:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BO8axi3083423; Sat, 24 Dec 2022 08:36:59 GMT (envelope-from git) Date: Sat, 24 Dec 2022 08:36:59 GMT Message-Id: <202212240836.2BO8axi3083423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: c0c7847d4950 - stable/13 - iichid(4): Add support for ASUS C300 chromebook. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c0c7847d4950f7d379e6421fe418e459e8997bc4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c0c7847d4950f7d379e6421fe418e459e8997bc4 commit c0c7847d4950f7d379e6421fe418e459e8997bc4 Author: Vladimir Kondratyev AuthorDate: 2022-03-02 23:35:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-12-24 08:33:26 +0000 iichid(4): Add support for ASUS C300 chromebook. Some chromebooks e.g. ASUS C300 have no valid _CID and _DSM ACPI objects required for device identification and HID descriptor address detection. Add quirk to allow required data to be hardcoded in to driver. (cherry picked from commit 34e051c45cfc25f74dbfaa42e0dee45d670fecd3) --- sys/dev/iicbus/iichid.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index a8b5c930be19..bb8945245a2e 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -130,10 +130,18 @@ struct i2c_hid_desc { uint32_t reserved; } __packed; -static char *iichid_ids[] = { - "PNP0C50", - "ACPI0C50", - NULL +#define IICHID_REG_NONE -1 +#define IICHID_REG_ACPI (UINT16_MAX + 1) +#define IICHID_REG_ELAN 0x0001 + +static const struct iichid_id { + char *id; + int reg; +} iichid_ids[] = { + { "ELAN0000", IICHID_REG_ELAN }, + { "PNP0C50", IICHID_REG_ACPI }, + { "ACPI0C50", IICHID_REG_ACPI }, + { NULL, 0 }, }; enum iichid_powerstate_how { @@ -197,18 +205,21 @@ static int iichid_reset_callout(struct iichid_softc *); static void iichid_teardown_callout(struct iichid_softc *); #endif -static __inline bool +static inline int acpi_is_iichid(ACPI_HANDLE handle) { - char **ids; + const struct iichid_id *ids; UINT32 sta; + int reg; - for (ids = iichid_ids; *ids != NULL; ids++) { - if (acpi_MatchHid(handle, *ids)) + for (ids = iichid_ids; ids->id != NULL; ids++) { + if (acpi_MatchHid(handle, ids->id)) { + reg = ids->reg; break; + } } - if (*ids == NULL) - return (false); + if (ids->id == NULL) + return (IICHID_REG_NONE); /* * If no _STA method or if it failed, then assume that @@ -216,9 +227,9 @@ acpi_is_iichid(ACPI_HANDLE handle) */ if (ACPI_FAILURE(acpi_GetInteger(handle, "_STA", &sta)) || ACPI_DEVICE_PRESENT(sta)) - return (true); + return (reg); - return (false); + return (IICHID_REG_NONE); } static ACPI_STATUS @@ -1007,7 +1018,7 @@ iichid_probe(device_t dev) ACPI_HANDLE handle; char buf[80]; uint16_t config_reg; - int error; + int error, reg; sc = device_get_softc(dev); sc->dev = dev; @@ -1028,11 +1039,15 @@ iichid_probe(device_t dev) if (handle == NULL) return (ENXIO); - if (!acpi_is_iichid(handle)) + reg = acpi_is_iichid(handle); + if (reg == IICHID_REG_NONE) return (ENXIO); - if (ACPI_FAILURE(iichid_get_config_reg(handle, &config_reg))) - return (ENXIO); + if (reg == IICHID_REG_ACPI) { + if (ACPI_FAILURE(iichid_get_config_reg(handle, &config_reg))) + return (ENXIO); + } else + config_reg = (uint16_t)reg; DPRINTF(sc, " IICbus addr : 0x%02X\n", sc->addr >> 1); DPRINTF(sc, " HID descriptor reg: 0x%02X\n", config_reg);