From patchwork Mon Nov 9 20:53:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 321489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 146CAC2D0A3 for ; Mon, 9 Nov 2020 20:53:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B659420731 for ; Mon, 9 Nov 2020 20:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727311AbgKIUxt (ORCPT ); Mon, 9 Nov 2020 15:53:49 -0500 Received: from mga17.intel.com ([192.55.52.151]:41590 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725946AbgKIUxt (ORCPT ); Mon, 9 Nov 2020 15:53:49 -0500 IronPort-SDR: hRLFbvkRU0yRKkiFexBVJvYVDIlEZtpKYgzXIg3beUP7GkxN7aSM+Q1nHJMldt+L1df12etP+k q+uHaKHMyc+w== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="149719600" X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="149719600" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 12:53:47 -0800 IronPort-SDR: 7Wleu15OxicyFEQvj474dliGnY0+wqWTqXGYiPL2lhljdmCp4udcQFC4U9F8vqOvjavBFLPLxT GkaizfsF/U+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,464,1596524400"; d="scan'208";a="541019875" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2020 12:53:45 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9A51517C; Mon, 9 Nov 2020 22:53:44 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Mika Westerberg , Hans de Goede , Andy Shevchenko , Jamie McClymont Subject: [PATCH v5 00/17] gpiolib: acpi: pin configuration fixes Date: Mon, 9 Nov 2020 22:53:15 +0200 Message-Id: <20201109205332.19592-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are fixes (and plenty cleanups) that allow to take into consideration more parameters in ACPI, i.e. bias for GpioInt() and debounce timeout for Operation Regions, Events and GpioInt() resources. During review Hans noted, that gpiod_set_debounce() returns -ENOTSUPP for the cases when feature is not supported either by driver or a controller. It appears that we have slightly messy API here: FUNC Relation with ENOTSUPP gpiod_set_config() returns if not supported gpiod_set_debounce() as gpiod_set_config() above gpio_set_debounce() legacy wrapper on top of gpiod_set_debounce() gpiod_set_transitory() skips it (returns okay) with debug message gpio_set_config() returns if not supported gpio_set_bias() skips it (returns okay) Last two functions are internal to GPIO library, while the rest is exported API. In order to be consistent with both naming schemas the series introduces gpio_set_debounce_timeout() that considers the feature optional. New API is only for internal use. While at it, the few first patches do clean up the current GPIO library code to unify it to some extend. The above is followed by changes made in ACPI GPIO library part. The bias patch highly depends on Intel pin control driver changes (they are material for v5.10 [1]), due to this and amount of the prerequisite changes this series is probably not supposed to be backported (at least right now). The last patch adds Intel GPIO tree as official one for ACPI GPIO changes. Assuming [1] makes v5.10 this series can be sent as PR to Linus for v5.11 cycle. Note, some patches are also depend to the code from GPIO fixes / for-next repositories. Unfortunately there is no one repository which contains all up to date for-next changes against GPIO subsystem. That's why I have merged Bart's for-current followed by Linus' fixes followed by Bart's for-next followed by Linus' for-next branches as prerequisites to the series. Cc: Jamie McClymont [1]: https://lore.kernel.org/linux-gpio/20201106181938.GA41213@black.fi.intel.com/ Changelog v5: - introduced gpio_set_debounce_timeout() - made a prerequisite refactoring in GPIO library code - updated the rest accordingly Changelog v4: - extended debounce setting to ACPI events and Operation Regions - added Ack (Linus) - added few more cleanup patches, including MAINTAINERS update Changelog v3: - dropped upstreamed OF patch - added debounce fix Andy Shevchenko (17): gpiolib: Replace unsigned by unsigned int gpiolib: add missed break statement gpiolib: use proper API to pack pin configuration parameters gpiolib: Add temporary variable to gpiod_set_transitory() for cleaner code gpiolib: Extract gpio_set_config_with_argument() for future use gpiolib: move bias related code from gpio_set_config() to gpio_set_bias() gpiolib: Extract gpio_set_config_with_argument_optional() helper gpiolib: Extract gpio_set_debounce_timeout() for internal use gpiolib: acpi: Respect bias settings for GpioInt() resource gpiolib: acpi: Use named item for enum gpiod_flags variable gpiolib: acpi: Take into account debounce settings gpiolib: acpi: Move acpi_gpio_to_gpiod_flags() upper in the code gpiolib: acpi: Make acpi_gpio_to_gpiod_flags() usable for GpioInt() gpiolib: acpi: Extract acpi_request_own_gpiod() helper gpiolib: acpi: Convert pin_index to be u16 gpiolib: acpi: Use BIT() macro to increase readability gpiolib: acpi: Make Intel GPIO tree official for GPIO ACPI work MAINTAINERS | 1 + drivers/gpio/gpiolib-acpi.c | 130 ++++++++++++++++++++-------------- drivers/gpio/gpiolib-acpi.h | 2 + drivers/gpio/gpiolib.c | 97 ++++++++++++++----------- drivers/gpio/gpiolib.h | 1 + include/linux/gpio/consumer.h | 4 +- 6 files changed, 141 insertions(+), 94 deletions(-) Reviewed-by: Mika Westerberg Reviewed-by: Mika Westerberg Reviewed-by: Mika Westerberg Reviewed-by: Mika Westerberg Reviewed-by: Mika Westerberg Reviewed-by: Mika Westerberg Reviewed-by: Mika Westerberg