From patchwork Tue Nov 2 02:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 12597753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64F96C433EF for ; Tue, 2 Nov 2021 02:21:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3769E61242 for ; Tue, 2 Nov 2021 02:21:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3769E61242 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=usp.br Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=AInXmtGz9mvais+bfSTkjGUXO94QT86zEeEiV/FvAW0=; b=W0fYoLSwZ4D6As LXgO6dA7HhF0rjrCjmMK/pBYWCJjJlmssuRLJHBWQDAL3ZwgV2DVtUKnEyoUARxAwEWLUJiNHfMWl auKQjak1QzP39HMQ8jO32ptoM0GMHrWmsajSFwoJ77n7cmenNi5udl+QbrCkdpKP8yqtCHeSqQqLW TlRn70SsXk6bUNBpKkujUqytaON6+oCxA+abNAOyWj98qqTElvuRUGixngLT794oIkx9RYSnKfKZc RM8RbL/ViNZaOQA5XHa7vP1bFTURwfgUyL4UYefs/5SdIHJwPjYSpzll3QGnpxh5Zz2LXF680P+1u P9PFHnj121uPZU0wTS6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhjPO-000GaW-2V; Tue, 02 Nov 2021 02:20:18 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhjPI-000GX4-0D for linux-arm-kernel@lists.infradead.org; Tue, 02 Nov 2021 02:20:13 +0000 Received: by mail-qt1-x82e.google.com with SMTP id h14so16881153qtb.3 for ; Mon, 01 Nov 2021 19:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=TeHGklbsWJ2iSzr/5MHFyU8553eNgPnreRe65lH6NhU=; b=BZwfWggd+/dvjEMDdNmiEIqpxvWCv6b4m28LKY5geUgyiIj794SoJpPfXVxERVaEI9 tLyML6H4F7sl5fxcmB6LPxYyUJJsbKaQOIUz8Zvn6hRiYi51XMqVI83OsGive+XfWcn3 QajSdbJixF+6l492FHi5cEgzbKkIc9vef/TzbcUIkE0UQ9vqThJI8iFO/cpHNYmSnpKp ZiLI8y6C/rhnu2m9dolNE/THLnOqAcomq3TkQL8i+M2q2r+PlvMFS8VpxIirV6daZOf0 Nf5K8geoGMhdgWWgwwcXrU+VTHG3Yo7TDJv79ZLb44O1ZkewXOhJ95WSBN9wKm9t0uke ittA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=TeHGklbsWJ2iSzr/5MHFyU8553eNgPnreRe65lH6NhU=; b=g0IMZM5Haatl4b/nL+gaOqAa2DzTxlhZgDeEMmDi11tRa0M2TpBgeyT1iU8WKZGgro P9YB2ThSn0kzCVVrj3GM158tBulCEIbRB7Now+rpRSJd5euFkBjX4zLOTUe6GCrSuIc9 lTQ1XEPIcBKBoeB/neYB2LukJp/vtcR5K8UF5tdDurFjkGjSPzSJ6cauGOwyBHzJy4wP VH6O4K75ilzb/yy9tJey8Ifp3Az1WvhOZ6sqmdVGrFD7gyt1aWee5vXlsW50+xlG65ze KYMHuIDPNfat9BBSy7GH9xWy2ymh9ewOn3d6dFqaOCXUlEdS9XJt9lJTPuiqsJFutQIO wuhw== X-Gm-Message-State: AOAM533HtStvuRAuUQhISpQ7a6tNyy9NnnsOV0xRCsgweFifhFEALF9n /xp0GN9W5568zC8Ves1tyrgUMw== X-Google-Smtp-Source: ABdhPJx/+fhidZPfS99qL6EEqlinvO5UtYVgf0uJS1+T+dApyVeMcfKWjGbA05SOC+8r94GMNJ5T6Q== X-Received: by 2002:a05:622a:2c3:: with SMTP id a3mr9430222qtx.3.1635819609361; Mon, 01 Nov 2021 19:20:09 -0700 (PDT) Received: from fedora ([187.64.134.142]) by smtp.gmail.com with ESMTPSA id v16sm1371671qtw.90.2021.11.01.19.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 19:20:09 -0700 (PDT) Date: Mon, 1 Nov 2021 23:20:03 -0300 From: =?iso-8859-1?q?Ma=EDra?= Canal To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, krzysztof.kozlowski@canonical.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/exynos: Replace legacy gpio interface for gpiod interface Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211101_192012_089459_BC3CC8CC X-CRM114-Status: GOOD ( 15.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Considering the current transition of the GPIO subsystem, remove all dependencies of the legacy GPIO interface (linux/gpio.h and linux /of_gpio.h) and replace it with the descriptor-based GPIO approach. Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 42 +++++++++---------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 8d137857818c..b0b1acb7e712 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -265,7 +264,7 @@ struct exynos_dsi { struct clk **clks; struct regulator_bulk_data supplies[2]; int irq; - int te_gpio; + struct gpio_desc *te_gpio; u32 pll_clk_rate; u32 burst_clk_rate; @@ -1298,14 +1297,14 @@ static void exynos_dsi_enable_irq(struct exynos_dsi *dsi) { enable_irq(dsi->irq); - if (gpio_is_valid(dsi->te_gpio)) - enable_irq(gpio_to_irq(dsi->te_gpio)); + if (dsi->te_gpio) + enable_irq(gpiod_to_irq(dsi->te_gpio)); } static void exynos_dsi_disable_irq(struct exynos_dsi *dsi) { - if (gpio_is_valid(dsi->te_gpio)) - disable_irq(gpio_to_irq(dsi->te_gpio)); + if (dsi->te_gpio) + disable_irq(gpiod_to_irq(dsi->te_gpio)); disable_irq(dsi->irq); } @@ -1335,29 +1334,20 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, int ret; int te_gpio_irq; - dsi->te_gpio = of_get_named_gpio(panel->of_node, "te-gpios", 0); - if (dsi->te_gpio == -ENOENT) - return 0; - - if (!gpio_is_valid(dsi->te_gpio)) { - ret = dsi->te_gpio; - dev_err(dsi->dev, "cannot get te-gpios, %d\n", ret); + dsi->te_gpio = devm_gpiod_get_optional(dsi->dev, "te", GPIOD_IN); + if (IS_ERR(dsi->te_gpio)) { + dev_err(dsi->dev, "gpio request failed with %ld\n", + PTR_ERR(dsi->te_gpio)); goto out; } - ret = gpio_request(dsi->te_gpio, "te_gpio"); - if (ret) { - dev_err(dsi->dev, "gpio request failed with %d\n", ret); - goto out; - } - - te_gpio_irq = gpio_to_irq(dsi->te_gpio); + te_gpio_irq = gpiod_to_irq(dsi->te_gpio); ret = request_threaded_irq(te_gpio_irq, exynos_dsi_te_irq_handler, NULL, IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN, "TE", dsi); if (ret) { dev_err(dsi->dev, "request interrupt failed with %d\n", ret); - gpio_free(dsi->te_gpio); + gpiod_put(dsi->te_gpio); goto out; } @@ -1367,10 +1357,9 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) { - if (gpio_is_valid(dsi->te_gpio)) { - free_irq(gpio_to_irq(dsi->te_gpio), dsi); - gpio_free(dsi->te_gpio); - dsi->te_gpio = -ENOENT; + if (dsi->te_gpio) { + free_irq(gpiod_to_irq(dsi->te_gpio), dsi); + gpiod_put(dsi->te_gpio); } } @@ -1745,9 +1734,6 @@ static int exynos_dsi_probe(struct platform_device *pdev) if (!dsi) return -ENOMEM; - /* To be checked as invalid one */ - dsi->te_gpio = -ENOENT; - init_completion(&dsi->completed); spin_lock_init(&dsi->transfer_lock); INIT_LIST_HEAD(&dsi->transfer_list);