Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752887AbdGFBtc (ORCPT ); Wed, 5 Jul 2017 21:49:32 -0400 Received: from mga11.intel.com ([192.55.52.93]:21176 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbdGFBta (ORCPT ); Wed, 5 Jul 2017 21:49:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,314,1496127600"; d="scan'208";a="282632365" From: "Mani, Rajmohan" To: "'Andy Shevchenko'" CC: "'linux-kernel@vger.kernel.org'" , "'linux-gpio@vger.kernel.org'" , "'linux-acpi@vger.kernel.org'" , "'Lee Jones'" , "'Linus Walleij'" , "'Alexandre Courbot'" , "'Rafael J. Wysocki'" , "'Len Brown'" Subject: RE: [PATCH v2 2/3] gpio: Add support for TPS68470 GPIOs Thread-Topic: [PATCH v2 2/3] gpio: Add support for TPS68470 GPIOs Thread-Index: AQHS4npdZUk6+PbrsU2O384zfXas5aIgIe2AgADRHWCAJTjiUA== Date: Thu, 6 Jul 2017 01:49:28 +0000 Message-ID: <6F87890CF0F5204F892DEA1EF0D77A59725D5A39@FMSMSX114.amr.corp.intel.com> References: <1497161395-36504-1-git-send-email-rajmohan.mani@intel.com> <1497161395-36504-3-git-send-email-rajmohan.mani@intel.com> <6F87890CF0F5204F892DEA1EF0D77A59725BF44A@FMSMSX114.amr.corp.intel.com> In-Reply-To: <6F87890CF0F5204F892DEA1EF0D77A59725BF44A@FMSMSX114.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v661ngFb027378 Content-Length: 2141 Lines: 48 Hi Andy and all, Thanks for your patience. > > > > Main points (some I already told in an answer to Sakari's mail): > > 1. Consider 2 GPIO chips over 1. > > I am looking into this. > For the second GPIO chip, the call to acpi_attach_data() fails with AE_ALREADY_EXISTS, as below with 4.12 rc3 kernel. acpi_gpiochip_add() acpi_attach_data() acpi_ns_attach_data() fails with AE_ALREADY_EXISTS for the second GPIO chip. /* We only allow one attachment per handler */ drivers/acpi/acpica/nsobject.c Also, I tried the following experiment, since we know the number of GPIOs for the second GPIO chip is 3, just to see if I can get further along after a successful call to acpi_attach_data(). Since the acpi_gpio_chip_dh is used as the handler in all acpi_gpiochip_* calls, I tried to use another handler (acpi_gpio_chip_dh2). But now, as expected, acpi_gpiochip_request_regions() failed inside acpi_gpiochip_add(), as only one OpRegion handler can be installed for a given OpRegion code. Due to this, when I try to set the GPIO 9 (which is now GPIO 2 of the second GPIO chip of 2 GPIO chips implementation), the OpRegion handler is called with the information / region_context pointer of the first GPIO chip, which is not desired. It sounds like there are 2 issues with the 2 GPIO chips implementation. 1) How to get acpi_ns_attach_data() done successfully for the second GPIO chip, given the observation above and 2) How to get the GPIO OpRegion handler to be called with the right GPIO chip information / region_context pointer I need pointers to make further progress here. > > 2. Fix FIXME(s). > > Leaving this on, until I see how this can be fixed. > These FIXME code will be removed from the driver, as we are working to get this done through platform firmware. > > 3. If there is hardware bug we should work around it must be clarified. > > Ack > If this is about initializing the GPIOs with zero, I have removed this code for > now. > > > 4. You missed Linus' comments here (switch to the data pointer inside > > GPIO chip and remove platform driver data stuff from the driver). > > > > I have fixed this with v3