Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5932316pxb; Thu, 27 Jan 2022 02:46:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJybLc0Q9IiLZLzSaPBXTFC6rBhxAdPPwn/UZNArZByAUho0aqYZ+9iATCCXg8nBL446okKi X-Received: by 2002:aa7:9f1b:: with SMTP id g27mr2961529pfr.30.1643280415947; Thu, 27 Jan 2022 02:46:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643280415; cv=none; d=google.com; s=arc-20160816; b=LgOiFfONz8n8+ZeecnanIfpsjK2psimGoHfIOqWKK5JkIlCToqn3lTdGCguHuLQVV6 V8GIvT39JtWVws1DhDW1X3GzQ1bexYcdx4h+RHndXL2hT/UKWjRrZKBrrMFssMykhN9n YFMuXKLilnFny9O7T1edBSyRcZ/Yung89BbDrHDmduBBiag1uTrlQK54HdzKd23VO0IE 7Vpz+zAigMS3NXf29EO8m+MKBdldr8V+aks6r0WGsqBB4D5rvPr46U0hEGto6D/kYjV8 3JdNOH2iZ0EbGAzP5X7E9q8k5VN3iLtCDeCsyqHBVRGWhQTYPZ64n0cF+DyoL7U3LCS1 p+lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Kek552SjJ2XtaE0pyhCIfLvYTGIcIoCLk6M4S1Aej48=; b=JkXZ3m/FWAA0ovo+gWImxZnC/QZn78NuK7gQX6oWCOaae+LfNN9nqRCIKTNa5sOfER krhg1HqSLK0BGmK0motyTgAORRP4FpDZfLYqeJV6tX3858j7bXa1wK31OUndbBY/MLfo U2qpZeQjbfSamf5kJh39YVdOUUNeT1BqGJHujSnHvEeHGnOcxVhsiPQBMNsOB33H3XCY /z9OUnuNeoFDhBGiKr2zOtAwd4yvr9rjgFnwb2ECeP50meWIeYktB5k90iQ90p466F6o BaV2LC9NVTREicCLKWvHvcdYGrpddTCNPPkYkEvD/QSiYJy2bgpmvNIMWWAfmlPWzbE3 0gDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si1763710plq.183.2022.01.27.02.46.38; Thu, 27 Jan 2022 02:46:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbiA0C4C (ORCPT + 99 others); Wed, 26 Jan 2022 21:56:02 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:49280 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S235455AbiA0Cz4 (ORCPT ); Wed, 26 Jan 2022 21:55:56 -0500 X-UUID: b80d963d5b94480fbf5e8e1f66cb4ff8-20220127 X-UUID: b80d963d5b94480fbf5e8e1f66cb4ff8-20220127 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2079973334; Thu, 27 Jan 2022 10:55:54 +0800 Received: from mtkexhb01.mediatek.inc (172.21.101.102) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 27 Jan 2022 10:55:52 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb01.mediatek.inc (172.21.101.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 27 Jan 2022 10:55:52 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 27 Jan 2022 10:55:50 +0800 From: Yunfei Dong To: Yunfei Dong , Alexandre Courbot , Hans Verkuil , "Tzung-Bi Shih" , AngeloGioacchino Del Regno , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa CC: George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Dafna Hirschfeld , Benjamin Gaignard , Daniel Vetter , dri-devel , Irui Wang , Steve Cho , , , , , , , Subject: [PATCH v1, 2/8] media: mtk-vcodec: Add to support lat soc hardware Date: Thu, 27 Jan 2022 10:55:38 +0800 Message-ID: <20220127025544.10854-3-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127025544.10854-1-yunfei.dong@mediatek.com> References: <20220127025544.10854-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add lat soc compatible and to support lat soc power/clk helper. Signed-off-by: Yunfei Dong --- .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c | 12 +++++++++--- .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h | 2 ++ .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 16 ++++++++++++++++ .../media/platform/mtk-vcodec/mtk_vcodec_drv.h | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c index 7b5da3e4cac2..7374d5a5c156 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c @@ -28,6 +28,10 @@ static const struct of_device_id mtk_vdec_hw_match[] = { .compatible = "mediatek,mtk-vcodec-core", .data = (void *)MTK_VDEC_CORE, }, + { + .compatible = "mediatek,mtk-vcodec-lat-soc", + .data = (void *)MTK_VDEC_LAT_SOC, + }, {}, }; MODULE_DEVICE_TABLE(of, mtk_vdec_hw_match); @@ -166,9 +170,11 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) subdev_dev->reg_base[VDEC_HW_SYS] = main_dev->reg_base[VDEC_HW_SYS]; set_bit(subdev_dev->hw_idx, main_dev->subdev_bitmap); - ret = mtk_vdec_hw_init_irq(subdev_dev); - if (ret) - goto err; + if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) { + ret = mtk_vdec_hw_init_irq(subdev_dev); + if (ret) + goto err; + } subdev_dev->reg_base[VDEC_HW_MISC] = devm_platform_ioremap_resource(pdev, 0); diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h index a63e4b1b81c3..b8938c6c3e72 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h @@ -17,6 +17,8 @@ #define VDEC_IRQ_CLR 0x10 #define VDEC_IRQ_CFG_REG 0xa4 +#define IS_SUPPORT_VDEC_HW_IRQ(hw_idx) (hw_idx != MTK_VDEC_LAT_SOC) + /** * enum mtk_vdec_hw_reg_idx - subdev hardware register base index * @VDEC_HW_SYS : vdec soc register index diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c index 1581a1277473..76e1442fc6f9 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c @@ -203,6 +203,14 @@ static void mtk_vcodec_dec_child_dev_on(struct mtk_vcodec_dev *vdec_dev, mtk_vcodec_dec_pw_on(pm); mtk_vcodec_dec_clock_on(pm); } + + if (hw_idx == MTK_VDEC_LAT0) { + pm = mtk_vcodec_dec_get_pm(vdec_dev, MTK_VDEC_LAT_SOC); + if (pm) { + mtk_vcodec_dec_pw_on(pm); + mtk_vcodec_dec_clock_on(pm); + } + } } static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dev *vdec_dev, @@ -215,6 +223,14 @@ static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dev *vdec_dev, mtk_vcodec_dec_clock_off(pm); mtk_vcodec_dec_pw_off(pm); } + + if (hw_idx == MTK_VDEC_LAT0) { + pm = mtk_vcodec_dec_get_pm(vdec_dev, MTK_VDEC_LAT_SOC); + if (pm) { + mtk_vcodec_dec_clock_off(pm); + mtk_vcodec_dec_pw_off(pm); + } + } } void mtk_vcodec_dec_enable_hardware(struct mtk_vcodec_ctx *ctx, int hw_idx) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index cd2939b47790..363b999dd709 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -104,6 +104,7 @@ enum mtk_vdec_hw_id { MTK_VDEC_CORE, MTK_VDEC_LAT0, MTK_VDEC_LAT1, + MTK_VDEC_LAT_SOC, MTK_VDEC_HW_MAX, }; -- 2.25.1