From patchwork Mon Jan 23 15:12:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2667 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B74333F039 for ; Mon, 23 Jan 2023 16:14:05 +0100 (CET) Received: by mail-pl1-f197.google.com with SMTP id z10-20020a170902ccca00b001898329db72sf7359660ple.21 for ; Mon, 23 Jan 2023 07:14:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674486844; cv=pass; d=google.com; s=arc-20160816; b=xln3x+m5IF5UL4qhP7mh3t8NaKNc4TKs2tXjZAi1iv4mZWgAYkLDKmLiwm9RGP7j/w Q9mavGUzWv2CPSCxluiXMBuwv5FITZVrqmqSsBHqZPpEubDz+lZz5H8UBbDUiFV2C/zT 7vmcawVtQeYVMQEHAxoDMcGsN1JqKRnTZFB03658F4GhGGwJIWuHWp/Bq33fOvXE+Hpx obC2i0+zsGSu7AGnDXtAoqh9eYYF02PPPeFmPyUQ1Xfu7aSxLRq2WdCFL1gTqYYJYfQw S70LgT+zjrOVYJCxgQp5Rl+GPU14KEQiG3MJA8moGshmv47wMezjKOLOvARuHv/MEEG/ rK9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yjUjd/+zZiBR1jYnWcbv0DNt0lGn7PKBS3ru7C4XiLQ=; b=pPkt8U5HTRpRIwzQbgG6ND5U1qwPw/7JwyN/Fp8wAlx9VTtdKb2O/HD26bC8VZdNS3 ik1AutXYyHEdpLGAFkhjz0S9OkJNzeiNwwhmBfu1lpVqBzUNdDskq8rTW6DDI0QozTmM IZ5JuGOZyh/ySlrzYsWPq+2uclk1gr0ePws/bVAqeXlqJ6trdo+5j7HJwYjCqRrvPK+c yZz8bXBFTA9wHvr3YAod/Wi6BHPchYjNokwctUFdGaiR01wn6Z7pu/avvR35Z4zvZ46Z EjTB2A0Ha0b38M0WhRambaVxwAFEyhMp408ZwzOlGf4DvePFRoEPlXedZ0lsqHPg9R/5 oKSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="bzEq6n/w"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=yjUjd/+zZiBR1jYnWcbv0DNt0lGn7PKBS3ru7C4XiLQ=; b=JaxEKtfDWFQ1PyCsZlCSJZR6buj3dJOVxqGDzigurcz/gRSV+xBW7ZZYHI4Wep1z1w niVACucaPkza5LoBw7cDpbP8CZw1TszN7Ve59xMgzuRx4RhgAkhM9dmxjS1EvveeUcWY dpz/KJecNrt9gEkNXqT6TOfuJWv4APjToc9Nk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yjUjd/+zZiBR1jYnWcbv0DNt0lGn7PKBS3ru7C4XiLQ=; b=HpIO+XLesvZo5vnnN+WHmhtkvmXqnBPzSUS8949vNraVp0A8GKcY6fkkDpZh2P3dYn xitzrDitLZhbWLpNT29rZwa72npk27zEwcPO3GB3IZtCIf2t9m5Wnf2GGp15W/l6YXgo mk7k0lWf0LtBzUs1YN53LK5kCDpn/bC2aNkYEUUo8R580CXqzI8P6bgA8WIDHN5OxCrq OGh3KSZxBhb+PSaQpfM/+bSV9QH+KlDhZ2JgAMNhX68kib/sSPoiRR6Pz2vtK/h/0YKh DUB39x1tpt32z4K+/6VcCu+PmabpVt9NRkEFyml+S8K7LQXmN3x02piwVPwyu7Qec7A2 ZjGw== X-Gm-Message-State: AFqh2kpGwV8zSg6q/+jH1rAiCJ8to2UsLvHUJqqeQG3MEML3Q2Eyn+uY 76624Nps8+E4HekSlaiC/TjFnX/v X-Google-Smtp-Source: AMrXdXveKCduJKPynxI23lUWq3ABvzmCvGt8qjD0wS3S6XmjmpC/wR+nyjcm38SVD1EF30SBWUT1Og== X-Received: by 2002:a17:90a:c004:b0:227:1f55:158d with SMTP id p4-20020a17090ac00400b002271f55158dmr2797682pjt.92.1674486844462; Mon, 23 Jan 2023 07:14:04 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8c06:b0:210:6f33:e22d with SMTP id a6-20020a17090a8c0600b002106f33e22dls13313957pjo.2.-pod-control-gmail; Mon, 23 Jan 2023 07:14:03 -0800 (PST) X-Received: by 2002:a17:903:210d:b0:193:3a92:f4bd with SMTP id o13-20020a170903210d00b001933a92f4bdmr22491319ple.47.1674486843650; Mon, 23 Jan 2023 07:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486843; cv=none; d=google.com; s=arc-20160816; b=bqRm574agZ5WsQKV7h556rurRl+ik5LAlGbh24Hl1rYu6NSZxyizmzmNM3AY1i7ICm c06Wf0kWqzPLTc6/zKPLtCl0fRiaeoqHTIrjWdz7h7j6OKLNUGbt7ezemDOTYsoVOEnv j+RcYH2qPp1YjFoZ5bzmQ6SmuJESppoVSHph1u+hMjrUbEgOOXS1oIWdzDiPw4n6i11U 74NWR0UMryqAs1opLDOntv3MdjGXMMnOSkQv42mVvj9GOrJtwmFgM1UEeBO0cS+H40wv IHSiPjjCy/S0/CMh2ilGZ56RXKpt0rhv7Hd9r8dy7PRPnKZkvisWoTsascIjTU1x0+dE Fb3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=F6pfGP8F/CZnmySkaMhl1te7xx0K6up+05928JeSO18=; b=V+ij4BbSQqZnKIzDlKh1Rnm2bIwhL4PNkod479gOwLf/W1a++Z+Q3VvSvucvL85qeG hjw2kY0TGSkljdqV9THf+HIHcDRMpL/Cfbhso/98Fit2uSFjfIUjB3Xq19OUOVBRonsy h7TijviYdYteZ/uc/OfRHgyaJz7CQ/fQUaXoQce79/vX9QPUHUvJNKUc3v8+iQWVzvMp gGkvlCzBLJYyl8x90Lix/81Labq6JeCQghtblpNwcBJl2b6fYyVttMxSOymSl4qP75dp Fx3t16JZyHrvwTKJRKY2/PPcO7805AflA07gWIKzgvC8Jz58xWjjcLNxBvPMOUhD95X7 sIug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="bzEq6n/w"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id u1-20020a170902e5c100b00188bc622106sor11962759plf.91.2023.01.23.07.14.03 for (Google Transport Security); Mon, 23 Jan 2023 07:14:03 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:903:32d1:b0:195:e86f:ff18 with SMTP id i17-20020a17090332d100b00195e86fff18mr15065335plr.42.1674486843206; Mon, 23 Jan 2023 07:14:03 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id d5-20020a170903230500b001754fa42065sm19207111plh.143.2023.01.23.07.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:14:02 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RESEND PATCH v11 13/18] drm: exynos: dsi: Add Exynos based host irq hooks Date: Mon, 23 Jan 2023 20:42:07 +0530 Message-Id: <20230123151212.269082-14-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123151212.269082-1-jagan@amarulasolutions.com> References: <20230123151212.269082-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="bzEq6n/w"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Enable and disable of te_gpio's are Exynos platform specific irq handling, so add the exynos based irq operations and hook them for exynos plat_data. Signed-off-by: Jagan Teki --- Changes for v11: - none Changes for v10: - split from previous series patch "drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge" drivers/gpu/drm/exynos/exynos_drm_dsi.c | 55 +++++++++++++++++++++---- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index fc7f00ab01b4..5e672209ed5f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -290,9 +290,15 @@ struct exynos_dsim_host_ops { int (*detach)(struct exynos_dsi *dsim, struct mipi_dsi_device *device); }; +struct exynos_dsim_irq_ops { + void (*enable)(struct exynos_dsi *dsim); + void (*disable)(struct exynos_dsi *dsim); +}; + struct exynos_dsi_plat_data { enum exynos_dsi_type hw_type; const struct exynos_dsim_host_ops *host_ops; + const struct exynos_dsim_irq_ops *irq_ops; }; struct exynos_dsi { @@ -307,7 +313,6 @@ struct exynos_dsi { struct clk **clks; struct regulator_bulk_data supplies[2]; int irq; - struct gpio_desc *te_gpio; u32 pll_clk_rate; u32 burst_clk_rate; @@ -331,6 +336,7 @@ struct exynos_dsi { struct exynos_dsi_enc { struct drm_encoder encoder; + struct gpio_desc *te_gpio; }; #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) @@ -1344,18 +1350,38 @@ static irqreturn_t exynos_dsi_te_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } -static void exynos_dsi_enable_irq(struct exynos_dsi *dsi) +static void _exynos_dsi_enable_irq(struct exynos_dsi *dsim) { - enable_irq(dsi->irq); + struct _exynos_dsi *dsi = dsim->priv; if (dsi->te_gpio) enable_irq(gpiod_to_irq(dsi->te_gpio)); } -static void exynos_dsi_disable_irq(struct exynos_dsi *dsi) +static void _exynos_dsi_disable_irq(struct exynos_dsi *dsim) { + struct _exynos_dsi *dsi = dsim->priv; + if (dsi->te_gpio) disable_irq(gpiod_to_irq(dsi->te_gpio)); +} + +static void exynos_dsi_enable_irq(struct exynos_dsi *dsi) +{ + const struct exynos_dsi_plat_data *pdata = dsi->plat_data; + + enable_irq(dsi->irq); + + if (pdata->irq_ops && pdata->irq_ops->enable) + pdata->irq_ops->enable(dsi); +} + +static void exynos_dsi_disable_irq(struct exynos_dsi *dsi) +{ + const struct exynos_dsi_plat_data *pdata = dsi->plat_data; + + if (pdata->irq_ops && pdata->irq_ops->disable) + pdata->irq_ops->disable(dsi); disable_irq(dsi->irq); } @@ -1384,9 +1410,10 @@ static int exynos_dsi_init(struct exynos_dsi *dsi) return 0; } -static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, +static int exynos_dsi_register_te_irq(struct exynos_dsi *dsim, struct device *panel) { + struct _exynos_dsi *dsi = dsim->priv; int ret; int te_gpio_irq; @@ -1394,7 +1421,7 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, if (!dsi->te_gpio) { return 0; } else if (IS_ERR(dsi->te_gpio)) { - dev_err(dsi->dev, "gpio request failed with %ld\n", + dev_err(dsim->dev, "gpio request failed with %ld\n", PTR_ERR(dsi->te_gpio)); return PTR_ERR(dsi->te_gpio); } @@ -1404,7 +1431,7 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, 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); + dev_err(dsim->dev, "request interrupt failed with %d\n", ret); gpiod_put(dsi->te_gpio); return ret; } @@ -1412,8 +1439,10 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, return 0; } -static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) +static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsim) { + struct _exynos_dsi *dsi = dsim->priv; + if (dsi->te_gpio) { free_irq(gpiod_to_irq(dsi->te_gpio), dsi); gpiod_put(dsi->te_gpio); @@ -2033,6 +2062,11 @@ static const struct dev_pm_ops exynos_dsi_pm_ops = { pm_runtime_force_resume) }; +static const struct exynos_dsim_irq_ops exynos_dsi_irq_ops = { + .enable = _exynos_dsi_enable_irq, + .disable = _exynos_dsi_disable_irq, +}; + static const struct exynos_dsim_host_ops exynos_dsi_host_ops = { .register_host = exynos_dsi_register_host, .unregister_host = exynos_dsi_unregister_host, @@ -2043,26 +2077,31 @@ static const struct exynos_dsim_host_ops exynos_dsi_host_ops = { static const struct exynos_dsi_plat_data exynos3250_dsi_pdata = { .hw_type = DSIM_TYPE_EXYNOS3250, .host_ops = &exynos_dsi_host_ops, + .irq_ops = &exynos_dsi_irq_ops, }; static const struct exynos_dsi_plat_data exynos4210_dsi_pdata = { .hw_type = DSIM_TYPE_EXYNOS4210, .host_ops = &exynos_dsi_host_ops, + .irq_ops = &exynos_dsi_irq_ops, }; static const struct exynos_dsi_plat_data exynos5410_dsi_pdata = { .hw_type = DSIM_TYPE_EXYNOS5410, .host_ops = &exynos_dsi_host_ops, + .irq_ops = &exynos_dsi_irq_ops, }; static const struct exynos_dsi_plat_data exynos5422_dsi_pdata = { .hw_type = DSIM_TYPE_EXYNOS5422, .host_ops = &exynos_dsi_host_ops, + .irq_ops = &exynos_dsi_irq_ops, }; static const struct exynos_dsi_plat_data exynos5433_dsi_pdata = { .hw_type = DSIM_TYPE_EXYNOS5433, .host_ops = &exynos_dsi_host_ops, + .irq_ops = &exynos_dsi_irq_ops, }; static const struct of_device_id exynos_dsi_of_match[] = {