Received: by 10.223.185.116 with SMTP id b49csp1105747wrg; Sat, 3 Mar 2018 15:43:42 -0800 (PST) X-Google-Smtp-Source: AG47ELuLN4S591mXche7BEKwwnnz7LYiOeGdlbBhKFJJoOtYFssn27XOdSsDfpB+AHMpgn+2wGE5 X-Received: by 2002:a17:902:8541:: with SMTP id d1-v6mr8912823plo.54.1520120622738; Sat, 03 Mar 2018 15:43:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520120622; cv=none; d=google.com; s=arc-20160816; b=NDBUHnQduaHcSD7434XLrtV1wKx6apkZ/d9ej4pj4shB7NEuvf9sfp3uQFyiss4p9Z 3aoioh92x9afhRW4iaZCGJMERX7XQdMo70JLebj2BQB8J8dz+QNonCPCr20IH65quwAb 6Dm1zSDRurqRnURt1ieQmLUQTA6m5UhPZi3K0rXvgNK5OLwwMx7fq0YQk1XU05LMuSMd XBA6jvw1CkrCwivqMZ//jSA3xeH8/GHYby7ow6svFfS1DfHEpBkpzBJnkZ64HuBwnGLe 935ySqhAJvi6vmDY4k/ZKQeww1atj09UsOjzrf/O1gAl9GBld0tAZXHuP7ovS0HD/2/a v7EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=jUOUx0DRfsqRE+cwHLf8+bsBF1MdtuVPcpmx+MBzfIQ=; b=qa/WB0i042Hv3gQTkBxRGRoOPucQ9cbSeE4/2jFpkg5nxO3RxERvLmg5evrC6sd6lI UwPzpJO6/TV4yBs/PmlbKzgN11fEXRb42gaJT/8EJVsDjOHwc4cRT7e/w6ggvXxMdTmG eJUO3BzDyZ0vTRubsN1fmgO05wAcxUj2APd4wSN2mU5TuaX98EOHJqTX93o9yG6Y62I9 huKL6wZZwUBJF/q4OXtYvC1kvvbmvb8IV3RYnuafuSUoZVppWXPHWcculk3eenh7omDA dtw2zIDR5wvd9/pz/sZNZIEji3j5eDGfrrC4oNb5uELssp5d+dlcF+G5zkh3xFRr3fVT HWLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=iyfjX3BB; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i30si6148331pgn.252.2018.03.03.15.43.28; Sat, 03 Mar 2018 15:43:42 -0800 (PST) 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=@microsoft.com header.s=selector1 header.b=iyfjX3BB; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934329AbeCCXl1 (ORCPT + 99 others); Sat, 3 Mar 2018 18:41:27 -0500 Received: from mail-by2nam03on0128.outbound.protection.outlook.com ([104.47.42.128]:42080 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934294AbeCCWe5 (ORCPT ); Sat, 3 Mar 2018 17:34:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jUOUx0DRfsqRE+cwHLf8+bsBF1MdtuVPcpmx+MBzfIQ=; b=iyfjX3BBU4GoetinH0czUpJqtFFaj+vUW3WzK8+cFLbSrp8M2SibFqLhiFTPNnRr/zt2wTH8weG7IPViESkXjY0O1uE3LFL3Kx0+Gs7nE9LM2mQlaUJ4P4Lx5AVthDjocPcWfiOI1gT876R0xsU1Vh/HRWp8YPE6jLBM8XgakLs= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1068.namprd21.prod.outlook.com (52.132.149.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:34:48 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:34:48 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jeffy Chen , Sean Paul , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 130/219] drm/rockchip: vop: Enable pm domain before vop_initial Thread-Topic: [PATCH AUTOSEL for 4.9 130/219] drm/rockchip: vop: Enable pm domain before vop_initial Thread-Index: AQHTsz8NyuUYPkf4VUqao+bAJSbjUg== Date: Sat, 3 Mar 2018 22:29:11 +0000 Message-ID: <20180303222716.26640-130-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1068;7:7Ob4RXCT7Urd7SLWfqoMrkqc5dEvVUHviuH7scH4pXg5dkoXOnL/YO2Q71wtU8bcAXfRiXOou1TB4gPKOlyS2ZaYTdSIiKcg0c91p0ei9ZVnlhY0zt3ZbEMwtp0DL9X1fx0hspY/eEvJ8REMV4gj1Ih+98/vPAERFbt9j7ddgofcNBED8+R/rzeUwXLZjudAMnLJ4EnUQBeTEZ5V4UO0C1NHb+8ydvmJEWLOTyLZaFOy0nvZNMI5oeenwGWcmmW5 x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e61db248-31a0-4a06-9c0a-08d58156f8f6 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1068; x-ms-traffictypediagnostic: MW2PR2101MB1068: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231220)(944501244)(52105095)(10201501046)(6055026)(61426038)(61427038)(6041288)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1068;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1068; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39380400002)(366004)(376002)(39860400002)(346002)(199004)(189003)(102836004)(59450400001)(6506007)(26005)(66066001)(4326008)(1076002)(105586002)(966005)(10290500003)(478600001)(72206003)(86612001)(14454004)(186003)(2906002)(2501003)(305945005)(7736002)(36756003)(3660700001)(5250100002)(25786009)(2950100002)(5660300001)(3846002)(2900100001)(3280700002)(6116002)(106356001)(22452003)(97736004)(316002)(81166006)(10090500001)(81156014)(8936002)(8676002)(76176011)(6436002)(110136005)(53936002)(6486002)(54906003)(6306002)(6512007)(86362001)(107886003)(68736007)(99286004)(6666003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1068;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: gVeDxC+fqYQC7NhSpBfUj/LBSAWp/dcz1NPCHvSE2Wi+q+0pBVvgdUUVcEEHy7Wan9lSXWjDvwd6mmfyUUjK4PXMYUi992KNAxRB0fw84CH+HvSuSJZpgkapo+8XcyXTjBM9cG9dVkSzQvzJOSYBuVN6qwDJpZA1e39nh6B58r0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e61db248-31a0-4a06-9c0a-08d58156f8f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:29:11.7132 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1068 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeffy Chen [ Upstream commit 5e570373c015b60a68828b1cd9d475cb33d3be4b ] We're trying to access vop registers here, so need to make sure the pm domain is on. Normally it should be enabled by the bootloader, but there's no guarantee of it. And if we wanna do unbind/bind, it would also cause the device to hang. And this patch also does these: 1/ move vop_initial to the end of vop_bind for eaiser error handling. 2/ correct the err_put_pm_runtime of vop_enable. Signed-off-by: Jeffy Chen Signed-off-by: Sean Paul Link: http://patchwork.freedesktop.org/patch/msgid/1491481885-13775-8-git-s= end-email-jeffy.chen@rock-chips.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 29 +++++++++++++++++++++----= ---- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/= rockchip/rockchip_drm_vop.c index c7eba305c488..6e3c4acb16ac 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -503,7 +503,7 @@ static int vop_enable(struct drm_crtc *crtc) ret =3D pm_runtime_get_sync(vop->dev); if (ret < 0) { dev_err(vop->dev, "failed to get pm runtime: %d\n", ret); - goto err_put_pm_runtime; + return ret; } =20 ret =3D clk_enable(vop->hclk); @@ -1348,10 +1348,16 @@ static int vop_initial(struct vop *vop) return PTR_ERR(vop->dclk); } =20 + ret =3D pm_runtime_get_sync(vop->dev); + if (ret < 0) { + dev_err(vop->dev, "failed to get pm runtime: %d\n", ret); + return ret; + } + ret =3D clk_prepare(vop->dclk); if (ret < 0) { dev_err(vop->dev, "failed to prepare dclk\n"); - return ret; + goto err_put_pm_runtime; } =20 /* Enable both the hclk and aclk to setup the vop */ @@ -1411,6 +1417,8 @@ static int vop_initial(struct vop *vop) =20 vop->is_enabled =3D false; =20 + pm_runtime_put_sync(vop->dev); + return 0; =20 err_disable_aclk: @@ -1419,6 +1427,8 @@ err_disable_hclk: clk_disable_unprepare(vop->hclk); err_unprepare_dclk: clk_unprepare(vop->dclk); +err_put_pm_runtime: + pm_runtime_put_sync(vop->dev); return ret; } =20 @@ -1519,12 +1529,6 @@ static int vop_bind(struct device *dev, struct devic= e *master, void *data) if (!vop->regsbak) return -ENOMEM; =20 - ret =3D vop_initial(vop); - if (ret < 0) { - dev_err(&pdev->dev, "cannot initial vop dev - err %d\n", ret); - return ret; - } - irq =3D platform_get_irq(pdev, 0); if (irq < 0) { dev_err(dev, "cannot find irq for vop\n"); @@ -1551,8 +1555,17 @@ static int vop_bind(struct device *dev, struct devic= e *master, void *data) =20 pm_runtime_enable(&pdev->dev); =20 + ret =3D vop_initial(vop); + if (ret < 0) { + dev_err(&pdev->dev, "cannot initial vop dev - err %d\n", ret); + goto err_disable_pm_runtime; + } + return 0; =20 +err_disable_pm_runtime: + pm_runtime_disable(&pdev->dev); + vop_destroy_crtc(vop); err_enable_irq: enable_irq(vop->irq); /* To balance out the disable_irq above */ return ret; --=20 2.14.1