From patchwork Wed Nov 30 14:02:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 27820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp944426wrr; Wed, 30 Nov 2022 06:08:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jByxVP3MIxEmpWT+fvDuiK90LGQCn2SA57J1f7i2Yp5c+GzP02e+IZcLq2mnzrwf+izJA X-Received: by 2002:a17:902:7296:b0:189:a9d7:7880 with SMTP id d22-20020a170902729600b00189a9d77880mr2914525pll.24.1669817322574; Wed, 30 Nov 2022 06:08:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669817322; cv=pass; d=google.com; s=arc-20160816; b=jOCgTfpVjM2moJe8jTp6llOwkyMIORXUSODJxQgaYg/2e76hqenpZFIYKTnaByTuP/ +WvUrcRJG29JI2CH8R5t3CN5sjmuT1FdOL9zue0L4PYJCrFvqauK6oZrHcGnZS68w0Yw 2jbAkxMWKhdJZHTIehtkUG2V/ZZ08w5LkJI7xXhbLYvfBePZZmgwfpwnqNQ01DsxOIMc JMFDJRc7JX0mwFDXk1BKFusnH28c/gZxkyw0Q/gD6E9Y2i5fM9PBGFdWTS8nPaHG2Vew jfzKqsOQxtYU160757+/uJMMoZRvGQVeGsI9o4UoitC4lD2HBIxpWrSnDZl/p0fqBC7/ w/nQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6cDyi0OTsNQOIgW/SJKknwhnPQ0UTKsEknXjOztyylU=; b=ESXfhRw7aymvePYD3EDzZ24tpQ8c4WudEvYyM84bXGISV1C1ClX5iVQZlksIcfFeFp bDxr6LYtCLSx6yvwPluce2gteus7kO455on8K7PpP8sFUufn+HgIn8Djlo1+kDI/dTlR jrlI7RGU8M3JTPPPUgPzhD/O6t9lV8SZ/molO06Cd6UGCvamz63qsBvyjIdDXYWg7rrI 36Fqqw12tHzqpy9fncTR79koAFIp4k9juUMAuN+kEELYlbOcTtdfQ1u9gyMRSkhZ2Bsu 3cu3E4oB0vmpwCdL9+56nfemvyneqO4g3I7ZnQUpaKxEKMgAymnN6q22mTiO7zBIcB2W B93Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=QE3ZFpMy; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a631103000000b00477ca5b5617si1381937pgl.147.2022.11.30.06.08.15; Wed, 30 Nov 2022 06:08:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=QE3ZFpMy; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbiK3OD0 (ORCPT + 99 others); Wed, 30 Nov 2022 09:03:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiK3ODJ (ORCPT ); Wed, 30 Nov 2022 09:03:09 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2040.outbound.protection.outlook.com [40.107.8.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CE9286CB; Wed, 30 Nov 2022 06:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E1+4tiiGkBI4RPpaWUUmEgGwOEOr+zTYEmkZmVO79xEM5cIXwG9Z3W+xh8MH83T5g3pm4xbCnK65ydFbDNBPjGVGiBxPcWFq8o8OSO1oAXZ3KXPl2vERjLapjydwBs7/AAoY7ar1r93frWGSxmDRE1/KJA5VmWInToGZLRoi4lpE1wBGKuf4PsS4l7O7kHVUgNIFF3C1RRlZ+Fumxz1wkRhgrC/g0zZ4V54wZD7+CfuunL3P3C2AWXu4NBIFGcVohCZH7aCeOCVuaXtcE5M15gKCcOVJX3dkTmSWCC3xxN2UpQY1P6b1K9YbF5qDNyUuKfiVln852iQKZYK7ySKTvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6cDyi0OTsNQOIgW/SJKknwhnPQ0UTKsEknXjOztyylU=; b=h0lMtUfe8OQDO5ahYN0kk0Bhq58hggC7Hf7AdKLQtbNbdlAuN0rQdD8DZcT1Vhc7kFonVteRuNp38Ouf1MFV97pAU0Zx5F4N7fMVRQgFTTM4pQhw2ZrdeY1xnbXSL3Exv4/LHHHwFRIlC6SYkGrgKxDLlxk9N9cv7DkFu1zBtr1tl3AhF0KXUJJ3TFVL7aEzl5a6Dg86g6442GE7SO+7MAaxZ0txwClzBhTNJ7pB6WKzYQOy8xTbUPNk3QqWa6Ghpq4qsWufgQGGr30vXb01nR+/BxkxS6Nmcl/jMZu5tGk/U/gjPHW/x0BNd0CDK5T3WEoP75gBdcLN5fmf65M4qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6cDyi0OTsNQOIgW/SJKknwhnPQ0UTKsEknXjOztyylU=; b=QE3ZFpMyCWSiIApjr2D198mPOYpAb9j0xeQCG+g4HldUUyMInso1Rsr9HRdOsa/q51BVRaB4TvP3G1iYxqsEnrUWa4hgAOzEiR5eVdQGFZXBFhcHYVYtxUT5feEBX5iRKjJMC8GB28NR3GIwzMVFZk457LKGgvTHDzw4B3Nv9b4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) by AS2PR08MB8695.eurprd08.prod.outlook.com (2603:10a6:20b:55e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Wed, 30 Nov 2022 14:02:54 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::3643:6226:28c:e637]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::3643:6226:28c:e637%2]) with mapi id 15.20.5880.008; Wed, 30 Nov 2022 14:02:54 +0000 From: Michael Riesch To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Sandy Huang , David Airlie , Daniel Vetter , Sascha Hauer , Michael Riesch Subject: [PATCH 4/5] drm/rockchip: vop2: add support for the rgb output block Date: Wed, 30 Nov 2022 15:02:16 +0100 Message-Id: <20221130140217.3196414-5-michael.riesch@wolfvision.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221130140217.3196414-1-michael.riesch@wolfvision.net> References: <20221130140217.3196414-1-michael.riesch@wolfvision.net> X-ClientProxiedBy: ZR0P278CA0182.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::15) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|AS2PR08MB8695:EE_ X-MS-Office365-Filtering-Correlation-Id: 717d083a-cace-4fab-15ba-08dad2db9317 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6SC+QDAgmDW+xl0jl0dF9L18C1Y41kwANkHMd7Fdd/i8FvkztEEmTRp8ATZiDy+yOBSmdLq4Qyu6vmqFXWBtBs1WAdxtQzOGSCQx/K2Zd3CWlTZd7OP2zOVBnyDujKx06qMw00rIOMDvanf9zeGKKm7XHREEtnRDS1XORak0wYpsBiYqup1EqqL/rjZu/Hu0VlPxpJLsq6tM0Ud/2rG6/Mmsc3Zf54i+tpaUeg4SyzdE47K2GUKkw5aSezpo8vrT7t2gEckZwa1570prZR6HI4ha5rQOPijM7yQcLS4v8EjBDBMAmlRj5YlxuBso0LSKypupvLLNJ+b3/sleq1n1riWvh1mHjQUJrqOPLR2GeoIoMbvnk/SnyIkqWjNhFqKp6xL7vOnMqkfeUFz8Tu0yThcsgaeYpK3n0nyg/J/+KMzrWe05uS2qQMiRREfeOSbgwrf2QIStASJGAuNbsqg+UBOP+8dC55lkWxJroQtE1xY2W5TUynuMBFejU+t3yMYmrKBsU4fUbVwB4ZwE9Qo+1Svu6cYb3epG8NmhpPmTHtNbY9RAuOf5lpaUhP64qoyzZ2ekQX06TwYDEaIKJb6sYfjQL+QNwFb/5CRyZ79jYSLgQ4HEJV2KUTQ1VZj+bVbn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9155.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(366004)(136003)(396003)(376002)(39850400004)(451199015)(38100700002)(6486002)(54906003)(478600001)(316002)(8936002)(2906002)(41300700001)(83380400001)(1076003)(2616005)(86362001)(6512007)(107886003)(6666004)(36756003)(52116002)(6506007)(66556008)(7416002)(186003)(8676002)(66476007)(44832011)(5660300002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3uf6Qzhbk6TPykBonLg4JnUHp88CwgX4jFbaZjn5pRFSZB+BU4y3aCaTfqSx2YC6BtG6Jm2U7ZWMMzp8InEc0/pNxv19Df4jF1J7jHwpmJ6Ze1k9vbAZRBmYSF6RBt5smDHxayRp5/kFoz9bQEHUv6kQU2G1ojiAKMpzJOO4AyqhToEquk7TGzMOUPwr4tvpOEDkWYcTC3plOulBnA62e5ymhWOAMZ1S7FbTRDrRyQ6hGiozhM4wQDC+rCCqdN6RpZOfxZaxun//pWgmWoY52hYBMytIvXCewkpYSDrxs6rVlFC3jbu2yLcLBouyR3ZErhAjPqSd43CU51J77NC1KYgWLBzFL9MLjYcjhiRNGEJfkxuPdkeaR+Ty7Jk8Yt30mYuHwRDdfyhl7Sr62LKCOE+/tMkfYd2OtO/RLqG1zu8UPduhLkEA819c/5YuOBA1f0ga2DdijQLfj300g7/tnUOU9bihwE1/R+jaHJf1il3iEjSa0doSS712ma/tXDDe6OdxKnLepOfcNkhYPYzgOrtZxFhQc0E+MjbmIFLXm7tB1sszBFC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Fl4FI1Mtd7FKI2Yrq2PCfsg/aw== X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 717d083a-cace-4fab-15ba-08dad2db9317 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2022 14:02:53.4717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4dJhy4tidPGgn77tE9SAlfrzdooUayq/J+JR8BE/TkGY4rFoR9BH4WjHLGk2Yj2u/4YT86+6DRSCA6+sCNGFOxZ27soK54Unwd3baxUAMG0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8695 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750930268226264320?= X-GMAIL-MSGID: =?utf-8?q?1750930369140059482?= The Rockchip VOP2 features an internal RGB output block, which can be attached to the video port 2 of the VOP2. Add support for this output block. Signed-off-by: Michael Riesch --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 94fddbf70ff6..16041c79d228 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -39,6 +39,7 @@ #include "rockchip_drm_gem.h" #include "rockchip_drm_fb.h" #include "rockchip_drm_vop2.h" +#include "rockchip_rgb.h" /* * VOP2 architecture @@ -212,6 +213,9 @@ struct vop2 { struct clk *hclk; struct clk *aclk; + /* optional internal rgb encoder */ + struct rockchip_rgb *rgb; + /* must be put at the end of the struct */ struct vop2_win win[]; }; @@ -2697,11 +2701,25 @@ static int vop2_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; + vop2->rgb = rockchip_rgb_init(dev, &vop2->vps[2].crtc, vop2->drm, 2); + if (IS_ERR(vop2->rgb)) { + if (PTR_ERR(vop2->rgb) == -EPROBE_DEFER) { + ret = PTR_ERR(vop2->rgb); + goto err_crtcs; + } + vop2->rgb = NULL; + } + rockchip_drm_dma_init_device(vop2->drm, vop2->dev); pm_runtime_enable(&pdev->dev); return 0; + +err_crtcs: + vop2_destroy_crtcs(vop2); + + return ret; } static void vop2_unbind(struct device *dev, struct device *master, void *data) @@ -2710,6 +2728,9 @@ static void vop2_unbind(struct device *dev, struct device *master, void *data) pm_runtime_disable(dev); + if (vop2->rgb) + rockchip_rgb_fini(vop2->rgb); + vop2_destroy_crtcs(vop2); }