From patchwork Wed May 23 09:31:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10420803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F46B60327 for ; Wed, 23 May 2018 09:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEA9928C7D for ; Wed, 23 May 2018 09:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E284228DDC; Wed, 23 May 2018 09:40:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BCE928C7D for ; Wed, 23 May 2018 09:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EHt8da/n3JYN6swAA5q5ABGUaF4NJ9XH0wtuOrBeTLQ=; b=P5lE9HOZcHTEKr gcMRRvtJR7Xtn4/5dRz94PXgWJTRtTqgA8xy8IRzdF6zoQpnCyrDh0YBOkwKR4c7Mhnw5rP7CLktQ qhXpkkgJR/g+uEXr3D4thVBkREIeC+rLeZB0qcQ0lYpju9V+YuUiLGvSji32P2b6sdiglgeCHrzOI lRhNVBbnfnQ+XRtw1qaT4Z5NVTxbBMk3G09TmK3g9NCatztR/gABljheXy3MbdCnc55gHZ9o6I1tZ xR2Qhv5+CKta/xEX7Pbv+oPEgv+hatSRamFArIVmgXwEUzY6OyrKrj7wZIepLDDj8qQhyLnkp4/ET KUzUPg9g5c7RHQ7cuttg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLQFd-0000nF-Cf; Wed, 23 May 2018 09:40:09 +0000 Received: from mail-he1eur01on0094.outbound.protection.outlook.com ([104.47.0.94] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLQ8T-0004Ey-Kp for linux-arm-kernel@lists.infradead.org; Wed, 23 May 2018 09:33:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a7c2bPTXc9HAYBzwdXdhtCHYamnTVOPoEjOul9JmQ3k=; b=fcZlQpTcWTGiXgJvKbSYYmX6suDhn8yI59ERM5ZZSPLflXbf/+ibnVuvewHlDwOWNLZTVI5KwMVmumN9BfbIoq1wjEPUxJNFu9Qlo7yciKxStIzW4+XFKHiat/evQlk/meAbjFiFNphX9ocpcdROiaRZ9AAMQiySflfLXLc18ik= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Received: from orc.pedanet (85.226.244.23) by VI1PR0202MB2782.eurprd02.prod.outlook.com (2603:10a6:800:db::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.16; Wed, 23 May 2018 09:31:54 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [PATCH v5 5/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Date: Wed, 23 May 2018 11:31:20 +0200 Message-Id: <20180523093122.27859-6-peda@axentia.se> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180523093122.27859-1-peda@axentia.se> References: <20180523093122.27859-1-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [85.226.244.23] X-ClientProxiedBy: HE1PR0102CA0046.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::23) To VI1PR0202MB2782.eurprd02.prod.outlook.com (2603:10a6:800:db::7) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(5600026)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:VI1PR0202MB2782; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2782; 3:1kIKAFzdE3dtNrW7rAaB24LncUKP8hz3DBkWrDrxfi2MhvS6Y1X81TedmNnUhyFgaY2zv97EsSSVe1ZddnkwtH/p8IL8G8wXWor9uCMTYtYJZTXtEhtG2GXcKsoj1OuV37MJtBHip+fReHmUCbBHhW2vNR9AzrodXM7gPU4J0hG7TlBL8Ycj43Ky0h39KrjL1684VjhRJneRj6/RrFZ7lPyxHjOwwPPiBEB0/3u5Vkz24T0nf01oCisqUNXmYvbb; 25:hTqzlhO/xMRani+BI23BQpGI4MPAKLvaQvyl0IxlzMnhS08fRHFZE1HRVqk3PgFEhbpSj/7zT018EjqZ7HqgrNq13j2vl34yjXfEAP0JtLq8TQSkxywkxW/5BFqMyL0HWs7IXLQQ9ZIp7sYbuiE3ry5YQj3zhlQ02QVkXGFhGXHhoFto501ap4nTJLOnR/imiDRppmPsQgx1nBkJfwH/XIjHv5Ce9j9yJQspsmyrP2v2BUN1D99vQgikh3NgWRY4vQxwKa069YOtQiL5EPwlcbsMuI+CUYmr0IjmHat+0thsjrKBObqwxOlyCLMKyrRleDiizuDYcCbOpV/jlLDMPg==; 31:82IwzKONrhM/E85xmX3P7wSMmD7myWSzteYGtNQaKeV3sTayVrYE1rIdehcJmej1KJ+4XhGzl9m98HaqPjnpPVabBtzRBJxCPMHbK/aFtkkPSY+KrOM8RHxGDjIIVa92s3bTh8y/9rBfEJXbvwb9dzRR+pC3ZSR4XADI4Sd6SwZpP4y8ZYT5Fn2hIK77wD8Zwu/sX894mtguanFvW63vq8Gl0g/MvefGZXH99oXWOV0= X-MS-TrafficTypeDiagnostic: VI1PR0202MB2782: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(2016111802025)(20161123560045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:VI1PR0202MB2782; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0202MB2782; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2782; 4:cYaCC8tNEXm/BK/5N3iDudraWPl0d6lpUaATJEwgDerSax1/sOFJX2A/rB38ToazTp6NcRE84b+sKxCiIyml1ax/pN6641xG66700JdX5hAEV8n90WkgmrnbvIZT067/jvi4D2AqPYzFK6Urlx0cSoEUn4+YVG33yYygReJXsOVV5X7KXw/lEeL4VTZdhJ4jubh2UljVUaGJjClqzBxPF6dlczyWkvlLsTr2LjilDM6CTEGvb2npcE2z0HPIqB8qp+SdpSzIJ+Oe2XCEqCklRw== X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39380400002)(376002)(346002)(39840400004)(366004)(189003)(199004)(486006)(68736007)(956004)(476003)(3846002)(97736004)(6116002)(478600001)(2616005)(5660300001)(6916009)(6666003)(53936002)(2906002)(4326008)(11346002)(6512007)(446003)(1076002)(36756003)(15760500003)(575784001)(86362001)(16586007)(7736002)(76176011)(52116002)(51416003)(25786009)(7416002)(305945005)(8936002)(6486002)(2361001)(48376002)(106356001)(66066001)(74482002)(50466002)(47776003)(26005)(316002)(6506007)(81156014)(105586002)(16526019)(186003)(386003)(8676002)(81166006)(50226002)(2351001)(54906003)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0202MB2782; H:orc.pedanet; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0202MB2782; 23:doJNn7Hjd4EQFj8k8U1h6nHAknMeysGp9H2gJMl?= =?us-ascii?Q?UcqAjaJhMSSEFPWeb+1xoD5d+iPj1RCP6HDCdnlxBYqP8Qto5PrX5JBbX/Hs?= =?us-ascii?Q?IuYTuA585BcwpiSW4YXFyZ6uPIrBgWoZdFz1N7Goow16xJKezoh6QWsIxS9K?= =?us-ascii?Q?uw6DCGoAkd40ykQrJVCohI5MJ4q9yFrA5b5xNRjW6WE8sZbgZfIao9Ldd63d?= =?us-ascii?Q?eZHsPszSgQDraXuxY3NC6/uCZbQuupFW2n0QKwOVqwV2i7imah7SNjSFiCao?= =?us-ascii?Q?2zI9T8rMsrZwB0FoW5jU2BbHxrDXZUxar3lHwcEkRYzgdw5d8dmBxNbUeT63?= =?us-ascii?Q?oHLw07jgashjj8Z4uc70Pm6U+/fJ3BSM1nEeMYSCgHLvRgzYnSWdgx5S/Oad?= =?us-ascii?Q?Mz23yW499hJOom1mVsX2q+krkBUDYl0jnNiWDOwmNZyS2gX4YamrdIxUL7Dh?= =?us-ascii?Q?35e6FScyXH47pEtlp67pHmAssDfR06d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Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2782; 7:cV0CIQMF3Q23qe5On/r/0EI3qJzt4KT6PrgioRrZCppBpTBOHV51DxsaK/4f5wDG+R3t3WsRoNNLEFi1FCa864lTmHrrMJn7ecVc0I2Lb7Qa7SZJ/I6hCtL5UJ67YwyqR/IWh+CG2/SiLGKxUpw16eX6ACJmdQZ125E9RGVKXih2ZvKZuWu2MkKRh2TJKxgLyOPR9pD0dJYFdM9hiKSYTLtfZHa09iwl/oLZDP6guiqkrXOm5XOsBLLARhZwZ5mT X-MS-Office365-Filtering-Correlation-Id: 71878c4b-5fe4-4114-aaf7-08d5c090063f X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 09:31:54.3733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71878c4b-5fe4-4114-aaf7-08d5c090063f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0202MB2782 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180523_023245_722751_2DDE35D7 X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Alexandre Belloni , Andrzej Hajda , David Airlie , Jyri Sarha , dri-devel@lists.freedesktop.org, Russell King , Boris Brezillon , Rob Herring , Jacopo Mondi , Laurent Pinchart , Daniel Vetter , Peter Rosin , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This fits better with the drm_bridge callbacks for when this driver becomes a drm_bridge. Suggested-by: Laurent Pinchart Signed-off-by: Peter Rosin --- drivers/gpu/drm/i2c/tda998x_drv.c | 64 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 933d309d2e0f..3dda07a2fd2f 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1163,36 +1163,42 @@ static int tda998x_connector_init(struct tda998x_priv *priv, /* DRM encoder functions */ -static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) +static void tda998x_enable(struct tda998x_priv *priv) { - struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); - bool on; + if (priv->is_on) + return; - /* we only care about on or off: */ - on = mode == DRM_MODE_DPMS_ON; + /* enable video ports, audio will be enabled later */ + reg_write(priv, REG_ENA_VP_0, 0xff); + reg_write(priv, REG_ENA_VP_1, 0xff); + reg_write(priv, REG_ENA_VP_2, 0xff); + /* set muxing after enabling ports: */ + reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0); + reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1); + reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); - if (on == priv->is_on) - return; + priv->is_on = true; +} - if (on) { - /* enable video ports, audio will be enabled later */ - reg_write(priv, REG_ENA_VP_0, 0xff); - reg_write(priv, REG_ENA_VP_1, 0xff); - reg_write(priv, REG_ENA_VP_2, 0xff); - /* set muxing after enabling ports: */ - reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0); - reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1); - reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); - - priv->is_on = true; - } else { - /* disable video ports */ - reg_write(priv, REG_ENA_VP_0, 0x00); - reg_write(priv, REG_ENA_VP_1, 0x00); - reg_write(priv, REG_ENA_VP_2, 0x00); +static void tda998x_disable(struct tda998x_priv *priv) +{ + /* disable video ports */ + reg_write(priv, REG_ENA_VP_0, 0x00); + reg_write(priv, REG_ENA_VP_1, 0x00); + reg_write(priv, REG_ENA_VP_2, 0x00); - priv->is_on = false; - } + priv->is_on = false; +} + +static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) +{ + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); + + /* we only care about on or off: */ + if (mode == DRM_MODE_DPMS_ON) + tda998x_enable(priv); + else + tda998x_disable(priv); } static void @@ -1606,12 +1612,16 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) static void tda998x_encoder_prepare(struct drm_encoder *encoder) { - tda998x_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); + + tda998x_disable(priv); } static void tda998x_encoder_commit(struct drm_encoder *encoder) { - tda998x_encoder_dpms(encoder, DRM_MODE_DPMS_ON); + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); + + tda998x_enable(priv); } static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = {