From patchwork Fri May 22 14:35:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Grygorii.Strashko@linaro.org" X-Patchwork-Id: 6465031 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C54AC0020 for ; Fri, 22 May 2015 14:36:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DA7220498 for ; Fri, 22 May 2015 14:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2419020494 for ; Fri, 22 May 2015 14:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757087AbbEVOgb (ORCPT ); Fri, 22 May 2015 10:36:31 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:35432 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757055AbbEVOgG (ORCPT ); Fri, 22 May 2015 10:36:06 -0400 Received: by labbd9 with SMTP id bd9so14012917lab.2 for ; Fri, 22 May 2015 07:36:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6kzeWwcUbEMTI3wn//URHhEycUlIkvBWhfRABZys2xY=; b=RabNduT43SrBqD+bvuZR7ZtsG4qgs9/jwh7JcVGeWFthtjIKM7VQsxBOBynr0Vru3R lFhS/GUM4GpCaDr1SuYmHqapSf1ETY6ojXg2kgZd0dJ6EppdT5CZFE2zEQggM6cHehzK NITU5ZFLuvQocxyUUXGwEoaKjPrzKU761M86B2wuZSHkS12hpllHzzds0N7jJOJsDQs+ zL4lha+t665GRJCCBF13vCpQakRlU0bfrYdPa7u/4fNwv6tIrrJRcl9mo+vmJIV5ZMlf 7gSOJWEKJrrHC/AdIH8jyjaRX3eErX84IrBxEW81IVZMwSwHdN97EEtHJiWo/8AehyAR eUKA== X-Gm-Message-State: ALoCoQlh2wYkNXd+NcaeoF/Lq3Pmtluah5lSVE4Rgj3drsQ1SanyIb7OgdcJPqxydz8K6uEd2VOg X-Received: by 10.112.180.201 with SMTP id dq9mr6899615lbc.78.1432305364668; Fri, 22 May 2015 07:36:04 -0700 (PDT) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id h3sm529901laf.24.2015.05.22.07.36.03 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 07:36:04 -0700 (PDT) From: Grygorii Strashko To: Linus Walleij , Alexandre Courbot , tony@atomide.com Cc: Javier Martinez Canillas , ssantosh@kernel.org, Kevin Hilman , linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, Grygorii Strashko Subject: [PATCH 1/7] gpio: omap: fix omap_gpio_free to not clean up irq configuration Date: Fri, 22 May 2015 17:35:48 +0300 Message-Id: <1432305354-5968-2-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432305354-5968-1-git-send-email-grygorii.strashko@linaro.org> References: <1432305354-5968-1-git-send-email-grygorii.strashko@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes following issue: - GPIOn is used as IRQ by some dev, for example PCF8575.INT -> gpio6.11 - PCFx driver knows nothing about type of IRQ line (GPIO or not) so it doesn't request gpio and just do request_irq() - If gpio6.11 will be exported through the sysfs and then un-xeported then IRQs from PCFx will not be received any more, because IRQ configuration for gpio6.11 will be cleaned up unconditionally in omap_gpio_free. Fix this by removing all GPIO IRQ specific code from omap_gpio_free() and also do GPIO clean up (change direction to 'in' and disable debounce) only if corresponding GPIO is not used as IRQ too. GPIO IRQ will be properly cleaned up by GPIO irqchip code. Signed-off-by: Grygorii Strashko Acked-by: Javier Martinez Canillas --- drivers/gpio/gpio-omap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index b232397..bb60cbc 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -690,8 +690,11 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) spin_lock_irqsave(&bank->lock, flags); bank->mod_usage &= ~(BIT(offset)); + if (!LINE_USED(bank->irq_usage, offset)) { + omap_set_gpio_direction(bank, offset, 1); + omap_clear_gpio_debounce(bank, offset); + } omap_disable_gpio_module(bank, offset); - omap_reset_gpio(bank, offset); spin_unlock_irqrestore(&bank->lock, flags); /*