Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp609953imm; Wed, 23 May 2018 02:33:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZob/v9ooSiox5Ox8lgQ1ZlmlanDeBOiuVq/PKEgX823oAMLL7OcaFpWDYGqv5KriuTieo8B X-Received: by 2002:a63:7d19:: with SMTP id y25-v6mr1670356pgc.165.1527068036514; Wed, 23 May 2018 02:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527068036; cv=none; d=google.com; s=arc-20160816; b=PU/lqED16KZ74jjwm28T2Tjkc64EpHYE8dRqNWognBN58DB8Fxy2OkVQucwGGNJHHy d01bvXsS5MrWqq/SkU1Ui8Y9cWSs/OmXDeeu0frxHTXzs9gu7zvju26wbWXespZUyBMt tQ4W64mtC4Umgjqbf75P2TpXT9KgJ0G3ZUF6x0ypq4JgB2Zkn4b79si0p3z6UGD18NHi LyTNoju0YWiecOeaLS0eFErBtKhM46De3pjvziHfWEbQfnbb6quSlbm/P2P4HTlsKOiY Jcl3O6rZhdl/B+B9u74qI8ocw3UZmGAel8RD55Xj2L5GUHdt9Mnd2G0lN6ByrWA+rHRX 4mCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=a7c2bPTXc9HAYBzwdXdhtCHYamnTVOPoEjOul9JmQ3k=; b=Ip8XtCmi9XTdT2qBGyDNeW4epK4l0nuSWiPCXT26FpEJMgyLi3lAYMimmBMwN2rhbt AAyctPjEwiCdqjMUavYzwaqJyAfqUMvldNfogegJC3gtbkLpnVPQY/GBAOmieTxILIyy lkBZt1j4mzNcBhh7kSq9YwMOZ33dMCo6PB6T50oTn1knvTHxEd4xDISpVA4qRKzzBJxF EsnltDha3hlK061axT5PJvlNaE3T9aI6QeH9xyPKaq5RjxBvBoqT0E8ugW2tY4zuho+e Z0mtM0o0eX/OpT5MlL9yElUwOI6M9j8ANXcrYnEocrXs5g6hSxhzIDmHAHhm/vqEBxA8 /Rpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axentia.se header.s=selector1 header.b=fcZlQpTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2-v6si14879171pgq.444.2018.05.23.02.33.41; Wed, 23 May 2018 02:33:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@axentia.se header.s=selector1 header.b=fcZlQpTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932332AbeEWJcJ (ORCPT + 99 others); Wed, 23 May 2018 05:32:09 -0400 Received: from mail-he1eur01on0139.outbound.protection.outlook.com ([104.47.0.139]:55616 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932307AbeEWJcC (ORCPT ); Wed, 23 May 2018 05:32:02 -0400 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 Cc: Peter Rosin , David Airlie , Rob Herring , Mark Rutland , Nicolas Ferre , Alexandre Belloni , Boris Brezillon , Russell King , Laurent Pinchart , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jyri Sarha , Daniel Vetter , Andrzej Hajda , Jacopo Mondi 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 Content-Type: text/plain 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?uw6DCGoAkd40ykQrJ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XaPxOf2pd6oA2hXjTdbo4G+xIXNtPK74eOR5R8/mTYWBDABlw==;5:SipBnR+VN2hNkrS70/ATv5LC06IPjBBjKkC5OyZSUaKqymcGotwyDFZDwN//xSuKsc/czqSiXXSKgq1IC7C4GgPlh8Lp0fM4FhY8g1Qg7zOcVGMIlZsjrprg/whOdYcgxfXe/Bp8Af87w6Ch/laHqbmjoK5SR6pqHMuKjEcYxGU=;24:ZQSbTCP6Az6WAoDDBjk4rV51A8wg07eky/He7YDYdvxZmth+wsvXlBL79WbSl015jYDS5X71atG8y2tJSgrcOVEUpN/cbtaDcgBGYhg1ePI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = { -- 2.11.0