Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7099337imu; Mon, 3 Dec 2018 07:44:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VbqruAJpSmNIjHKPWOcbYTGFEfEpvxHJ9Whm+hMxHXB60sdUKWkrnz7zlIoRi2zYWOxkqK X-Received: by 2002:a62:60c5:: with SMTP id u188mr16422511pfb.4.1543851897885; Mon, 03 Dec 2018 07:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543851897; cv=none; d=google.com; s=arc-20160816; b=fQYA6olE/Grv0bnlTJK8rPHVjwrf3HlUWKwRcRVCXNoHj3gaLRy6nkIbpCymp3dvR5 SCE94AMCoZmhcRXuENWa12QE+l23mcWRq1KKn9pcJqlc/9YWqyGObcHxWzDBU5I7wAFj jEfFse6ILX/76m6/Up3GA2n/AilCAUNLYRZRACCiDlz9/PZiJELtttmrFmdnXcA1Jz3i w78GW6If9s4PqAEe1OAgeOcT7sxHJBHzi9IgEojy+21wZI65sdVIQb03gFMi7AcbY7Lg dm4xk33wZJI/jWC6BqXYZED9eh6TSG+ImjUPwIMXrwIYNvD2Z3zdhJauqzshlYILa0bK VFXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=qbKtRVsSqvj/oG5dCIOO9l9S/nDq6xZ5rvOLPBisWws=; b=DX8O13d0/q6xE8xPfMhzm9knFjc4uj0x0zdQ8ToEu6Au9xrf1Y0IH6MxDB5oetFYuQ VKszoufk+7G+w8Wclzv2ojbaApidYYYiq8nGKAS4fCIxW6sOkvvZvlnYbv9jXWMKgu7T Ue8kI1aZEIgyu3+EH4Vwwz0JZVBljSS5uBQ3F5MgAwp9ytteuZTV6IMlSW9IFmT1IZcW JqnOzky6HGRUXwg1kbwEXejSBuf9rqqjy5KYuSAUE33FONfdqPClujShSkJ2V0tm11iY ewTgf/38Xr/cQef4Kx5lJkTtxBPPQC62QgxrtG7DwBRxScJr0tOTjP9oiRaGsf44pa28 IEwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uv3b73Ul; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r59si3522421plb.247.2018.12.03.07.44.33; Mon, 03 Dec 2018 07:44:57 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=uv3b73Ul; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbeLCPn7 (ORCPT + 99 others); Mon, 3 Dec 2018 10:43:59 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:43509 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbeLCPn6 (ORCPT ); Mon, 3 Dec 2018 10:43:58 -0500 Received: by mail-qt1-f194.google.com with SMTP id i7so14192975qtj.10; Mon, 03 Dec 2018 07:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=qbKtRVsSqvj/oG5dCIOO9l9S/nDq6xZ5rvOLPBisWws=; b=uv3b73UlNt8IYRWn20EjfNUc1rFNpZIZBAe0FwHiEjfhaKTT6rExvmN4aT+H4KGZhJ y7ornXT6hwkCVd27ztRhsGgvYgtHz068hI3OPLn8B6q3BBkj/jIasL0swg5vnYoimhUd DhQCX148CXtL23w2lOy3PjUMHFSz7Vmy5jdjmmV+u+DaxcKOVhQxXqgsUJod82RdjZPP 0JTc9Nnrp1PzYKL7ri3V0sB923QoAFK8jTfbB93xGmb+lnB3NF4Q6PLFVvpLjHjC+oUK OoRg19n7gfuqIiv71Bxk4RZl2yl720eoc/AkY6XdIVOaIfw+1YSVviRquG9Kw1YBOQoN Ub/g== 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:content-transfer-encoding; bh=qbKtRVsSqvj/oG5dCIOO9l9S/nDq6xZ5rvOLPBisWws=; b=EiGOk6xY3EJCzbq2I/YPmVsX5hugjZefe56s6/tNWM5RNkywCD4cowboVnbIekfIGe FYJvK3Pe1w1rtgWXoA6V8t2yK0feP//8l7IHw3fqXhU0neBpQr2RsixEbBsfdxmImv8S V6Co9wzJ5BJ7hQN2hHO3dJmV6e5vzWbiLaUEVg8onI4qjprvi5kNkgD7UScDHzZtespu URAuOSheYQam5eTYo5msH20OzLi3/yq/0DOUWGi2PTBtTtHjkKuxc6RCGZywZZoWq7vZ Qx+Xe1xrFhHypLWZsIhujdD0Ig+v/rxEVvRMdQ3Ol+lJZmsdII4wndAzzzPtuxf9wU1r 1IjA== X-Gm-Message-State: AA+aEWYtuy2MBRAQORIYn5d3CncMQ6Wt2hG8VuhdivcIDsVek0amLAGP d8IggsH0nH8HpNqVTV1Mba5lm0wMJFXZl08W8Tc= X-Received: by 2002:aed:3e49:: with SMTP id m9mr14650015qtf.99.1543851831458; Mon, 03 Dec 2018 07:43:51 -0800 (PST) MIME-Version: 1.0 References: <20181127132508.5501-1-fe@dev.tdt.de> <583ca922b4a877a4b0577994e40ddf5f@dev.tdt.de> <70e7b8e2346b9837273b5edce0524584@dev.tdt.de> <51e0d3f36dc23de801f2fdfc990f6c23@dev.tdt.de> In-Reply-To: <51e0d3f36dc23de801f2fdfc990f6c23@dev.tdt.de> From: Andy Shevchenko Date: Mon, 3 Dec 2018 17:43:39 +0200 Message-ID: Subject: Re: [PATCH v5 0/2] Add device driver for APU2/APU3 GPIOs To: Florian Eckert Cc: Linus Walleij , Bartosz Golaszewski , Darren Hart , Andy Shevchenko , Eckert.Florian@googlemail.com, Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Platform Driver Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 3, 2018 at 9:58 AM Florian Eckert wrote: > >> > Btw, is the statement in above email still actual? "...I can fix > >> > required things." > > > >> Yes i will fix your hints tomorrow and send a v6 of my patchset. > >> Thank you for your hints and time > >> It would be nice if you could fix ACPI problemmatik. > > > > I would like to see the ACPI dump for that... > > See https://github.com/openwrt/openwrt/pull/1232#issuecomment-443224576 > In this comment Micha=C5=82 =C5=BBygowski appended to this thread the mis= sing > files you want to have. Thanks! So, let me clarify what we have: - some platforms are in the wild with old BIOS with broken ACPI tables - you still may fix the things for new BIOS version for all affected platf= orms - you need to support both Is this all correct? For broken firmware you need to do the following: - create an MFD driver, which would instantiate GPIO and GPIO keys support (at least) - create one of each above drivers w/o any DMI crap (should be done as a part of MFD driver) For fixed BIOS you need to add the following (example, not a fully correct solution) at the level behind SB: Scope (SB) { Device(GPIO) { Name (_ADR, Zero) // _ADR: Address Name (_HID, "AMDxxxx") // One ID per platform, so, APU2 : 1, APU 3: 1 =3D> 2 unique IDs, in this case no need to add neither _HRV nor _UID Name (_HRV, 2) // Other approach is to have one ID but different _HRV: e.g. 2 for APU2, 3 for APU3 Name (_UID, Zero) // Another approach is to have one device per community of pins and several _UID:s Name (_DDN, "AMD APU General Purpose Input/Output (GPIO) control= ler") Method (_CRS, 0, NotSerialized) { Name (RBUF, ResourceTemplate () { Memory32Fixed (ReadWrite, 0xFED80000 // + offset + community0 offset 0x0000xxxx, // + size of the community0 ) ... Memory32Fixed (ReadWrite, 0xFED80000 // + offset + communityN offset 0x0000xxxx, // + size of the communityN ) /* IRQ resource if needed and present on real HW */ Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,= , ) { 0x000000xx, } }) Return (RBUF) /* \_SB_.GPIO._CRS.RBUF */ } Method (_STA, 0, NotSerialized) { Return (0x0F) } } Device (BTNS) { Name (_HID, "PRP0001") Name (_DDN, "GPIO buttons device") Name (_CRS, ResourceTemplate () { GpioIo ( Exclusive, // Not shared PullUp, // Pull up the line 0, // Debounce timeout 0, // Drive strength IoRestrictionInputOnly, // Only used as input "\\_SB.GPIO", // GPIO controller 0) // Must be 0 { x0, // GPIO pin offset in corresponding controller for Button 0 x1, // for Button 1, and so on ... } }) Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () {"compatible", "gpio-keys-polled"}, Package () {"poll-interval", 100}, Package () {"autorepeat", 1} }, ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { Package () {"button-0", "BTN0"}, Package () {"button-1", "BTN1"}, ... } }) // For more information about these bindings see: // Documentation/devicetree/bindings/input/gpio-keys-polled.txt // and Documentation/acpi/gpio-properties.txt. Name (BTN0, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () {"linux,code", 105}, Package () {"linux,input-type", 1}, Package () {"gpios", Package () {^BTNS, 0, 0, 1}} } }) } } After updating firmware you would need just an ACPI ID table to be added to the GPIO driver. MFD driver should not be enumerated at all. --=20 With Best Regards, Andy Shevchenko