Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2732667pxf; Sun, 14 Mar 2021 09:49:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh0Ys5vafTI9iamsdH+qyghYfd3ErdPJeCCYiFZGPXEfykMf5aYTh9aR51+Vr3paZLBqI6 X-Received: by 2002:a17:907:3ea0:: with SMTP id hs32mr19039845ejc.411.1615740577060; Sun, 14 Mar 2021 09:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615740577; cv=none; d=google.com; s=arc-20160816; b=mYlxf5YsR9c0FxrDGhyVhTanWrkfuAfWS+g6nPtehiHocj1YpmVoy7KQk27J3r3+Pl u/8kcR6IcnRZi3qjdnS5JG/2vATZxbvV/yrjME7CpStgKQPvfvxTnirtZ6jFlPffxrOy S7zKDbAyzq4r9/76CbolOe0I672EUZSxZrgyqXotzsuxGrUffABYpVnAzQ9EMaDdBkMO Q894tqkmT8lyEkWj3FYDQD5Fe1yE0HbNlLbaefOzM78cnReFmPSuZrbx/4+GzADGaTfa TRACKkkw19tnSw+fEMTzIQVKC2dijFMb9ZrLuz2BqnZWfG5naFpeEWagNXTz+olxmXM6 I1Bw== 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 :dkim-signature; bh=mgZKFLRFAbBRu7Q5z215LMK01y6B/VlLhTD6jZqDHxk=; b=xiyI4oQVUya+JdB5jKb6sX92HDgOJLrvQOc7LFl2F5jBK18+R5LLAkUNfHMxx1/iZL n0OBwzQcux576R+ArqyDga1MEUtALV+9ABi2joF8s5GWOz+OPOEBl7paDzzYyK8ZXxdD 1gidyRFkZq1Htsh2eCWGH54mHsOC5Hs1TMpbhMTe1xn4m8g7TgpNzKqR3aMV/WgF6giO 59PPex8CaFeVsPmVs+bQVeOSE8kE2y7t/S0lvRvlSr9Eu5mVp8EuedePLjB6Z3lbLvu/ 46bYg3sR+PNqBDUGVdEl7jc0FiBMjYI0HAH+lba+7I6nnY9LNog4xYflHXnTdjUJrCee wAVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H8o2FrMf; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 3si8588744ejz.371.2021.03.14.09.49.14; Sun, 14 Mar 2021 09:49:37 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H8o2FrMf; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234894AbhCNQgv (ORCPT + 99 others); Sun, 14 Mar 2021 12:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234211AbhCNQfB (ORCPT ); Sun, 14 Mar 2021 12:35:01 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A6F7C061762; Sun, 14 Mar 2021 09:35:00 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id t9so4484619wrn.11; Sun, 14 Mar 2021 09:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mgZKFLRFAbBRu7Q5z215LMK01y6B/VlLhTD6jZqDHxk=; b=H8o2FrMfH9tVu1ztan+gWiBd5bSVUm05dSFXZPAoZffhE06GKaXK7RxLEX2BIZ+OSg KmSaaU1WbXyqIzqzbi4zmt4+Zz1ark29b9LV0ic78Irq7sIv+PRFji3Ht8MMMFTvs/WG R6rLeHeZQ0fInZZchJpX7vd9vxb3hDGw6d/bHB6xzSstme+lgVDvHrn5ilkZDuSw8Cy4 NGS+cBsEtmktgYM2PICmTgp5kmLeZIn9q3pgc7idtv+GgAPwtDgfyNgy8+QpfB62MN0c hN7U4R348CTb70GQ15NLtWFsJNSF0ifkPMrnYf4SLCgu8BzQ5S3L+nbbns+OXXy8iyCg AiuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mgZKFLRFAbBRu7Q5z215LMK01y6B/VlLhTD6jZqDHxk=; b=UbwQK9ZBIXG6YjkGIJGTwlYo4/EEWKurblqBf/bAvTUkbmXl5cCOBiAJnRwFqpE3fQ ArJnK1EstLFmRu8uqRxNvx9ZH0WLUkMkt7yOr3leu4yqnr+5AF2Mwl14FSjkeuhASCkF Zmp6CVO930FAbraYjCZhaJxeP6Xy1QGZMAEdHMz1ATXNtJFagBm4N5bFBfp3EpQZ1qWJ iIBnS4A+UoOvOC3NEU1LGdjDxXXFedhfaBHli3O7nGpi3vTDOlu3Y8YJvV28jo5C5+q1 NX8qdP9CCjLpLLDFRgrqjDA57LV/XKkjPM3mg2lwhDvDLTYzfoD9gRZ8jjpuNjMt+ygo /EkA== X-Gm-Message-State: AOAM530jCQkk2QZIC84pRXik9xL5YfTrv0OZE53/zfVgikZc7Wt1RpIG 0LB36/5emEJ/BO7Z7MySqek= X-Received: by 2002:adf:fa08:: with SMTP id m8mr23720418wrr.12.1615739699340; Sun, 14 Mar 2021 09:34:59 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:59 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 14/15] media: venus: Convert to use resource-managed OPP API Date: Sun, 14 Mar 2021 19:34:07 +0300 Message-Id: <20210314163408.22292-15-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangtao Li Use resource-managed OPP API to simplify code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/media/platform/qcom/venus/core.h | 1 - .../media/platform/qcom/venus/pm_helpers.c | 35 +++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index a252ed32cc14..d35f60d2cb56 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -125,7 +125,6 @@ struct venus_core { struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; struct icc_path *video_path; struct icc_path *cpucfg_path; - struct opp_table *opp_table; bool has_opp_table; struct device *pmdomains[VIDC_PMDOMAINS_NUM_MAX]; struct device_link *opp_dl_venus; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 43c4e3d9e281..e61317220b9a 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -756,7 +756,6 @@ static int venc_power_v4(struct device *dev, int on) static int vcodec_domains_get(struct device *dev) { int ret; - struct opp_table *opp_table; struct device **opp_virt_dev; struct venus_core *core = dev_get_drvdata(dev); const struct venus_resources *res = core->res; @@ -779,11 +778,9 @@ static int vcodec_domains_get(struct device *dev) return 0; /* Attach the power domain for setting performance state */ - opp_table = dev_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); - if (IS_ERR(opp_table)) { - ret = PTR_ERR(opp_table); + ret = devm_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); + if (ret) goto opp_attach_err; - } core->opp_pmdomain = *opp_virt_dev; core->opp_dl_venus = device_link_add(dev, core->opp_pmdomain, @@ -792,13 +789,11 @@ static int vcodec_domains_get(struct device *dev) DL_FLAG_STATELESS); if (!core->opp_dl_venus) { ret = -ENODEV; - goto opp_dl_add_err; + goto opp_attach_err; } return 0; -opp_dl_add_err: - dev_pm_opp_detach_genpd(core->opp_table); opp_attach_err: for (i = 0; i < res->vcodec_pmdomains_num; i++) { if (IS_ERR_OR_NULL(core->pmdomains[i])) @@ -830,8 +825,6 @@ static void vcodec_domains_put(struct device *dev) if (core->opp_dl_venus) device_link_del(core->opp_dl_venus); - - dev_pm_opp_detach_genpd(core->opp_table); } static int core_get_v4(struct device *dev) @@ -860,45 +853,33 @@ static int core_get_v4(struct device *dev) if (legacy_binding) return 0; - core->opp_table = dev_pm_opp_set_clkname(dev, "core"); - if (IS_ERR(core->opp_table)) - return PTR_ERR(core->opp_table); + ret = devm_pm_opp_set_clkname(dev, "core"); + if (ret) + return ret; if (core->res->opp_pmdomain) { - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (!ret) { core->has_opp_table = true; } else if (ret != -ENODEV) { dev_err(dev, "invalid OPP table in device tree\n"); - dev_pm_opp_put_clkname(core->opp_table); return ret; } } ret = vcodec_domains_get(dev); - if (ret) { - if (core->has_opp_table) - dev_pm_opp_of_remove_table(dev); - dev_pm_opp_put_clkname(core->opp_table); + if (ret) return ret; - } return 0; } static void core_put_v4(struct device *dev) { - struct venus_core *core = dev_get_drvdata(dev); - if (legacy_binding) return; vcodec_domains_put(dev); - - if (core->has_opp_table) - dev_pm_opp_of_remove_table(dev); - dev_pm_opp_put_clkname(core->opp_table); - } static int core_power_v4(struct device *dev, int on) -- 2.30.2