lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77d205ef-469d-cfa3-f742-b009b2b05992@xs4all.nl>
Date:   Mon, 13 Sep 2021 12:37:51 +0200
From:   Hans Verkuil <hverkuil@...all.nl>
To:     Dmitry Osipenko <digetx@...il.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Viresh Kumar <vireshk@...nel.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Peter De Schrijver <pdeschrijver@...dia.com>,
        Mikko Perttunen <mperttunen@...dia.com>,
        Peter Chen <peter.chen@...nel.org>,
        Mark Brown <broonie@...nel.org>,
        Lee Jones <lee.jones@...aro.org>,
        Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        Nishanth Menon <nm@...com>,
        Vignesh Raghavendra <vigneshr@...com>,
        Richard Weinberger <richard@....at>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Lucas Stach <dev@...xeye.de>, Stefan Agner <stefan@...er.ch>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Michael Turquette <mturquette@...libre.com>
Cc:     linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-usb@...r.kernel.org,
        linux-staging@...ts.linux.dev, linux-spi@...r.kernel.org,
        linux-pwm@...r.kernel.org, linux-mtd@...ts.infradead.org,
        linux-mmc@...r.kernel.org, linux-media@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
        linux-clk@...r.kernel.org
Subject: Re: [PATCH v11 24/34] media: staging: tegra-vde: Support generic
 power domain

On 12/09/2021 22:08, Dmitry Osipenko wrote:
> Currently driver supports legacy power domain API, this patch adds generic
> power domain support. This allows us to utilize a modern GENPD API for
> newer device-trees.
> 
> Tested-by: Peter Geis <pgwipeout@...il.com> # Ouya T30
> Tested-by: Paul Fertser <fercerpav@...il.com> # PAZ00 T20
> Tested-by: Nicolas Chauvet <kwizart@...il.com> # PAZ00 T20 and TK1 T124
> Tested-by: Matt Merhar <mattmerhar@...tonmail.com> # Ouya T30
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>

Acked-by: Hans Verkuil <hverkuil-cisco@...all.nl>

Regards,

	Hans

> ---
>  drivers/staging/media/tegra-vde/vde.c | 57 +++++++++++++++++++++------
>  1 file changed, 46 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c
> index ed4c1250b303..bb3079a2c0b5 100644
> --- a/drivers/staging/media/tegra-vde/vde.c
> +++ b/drivers/staging/media/tegra-vde/vde.c
> @@ -20,6 +20,7 @@
>  #include <linux/slab.h>
>  #include <linux/uaccess.h>
>  
> +#include <soc/tegra/common.h>
>  #include <soc/tegra/pmc.h>
>  
>  #include "uapi.h"
> @@ -920,13 +921,17 @@ static __maybe_unused int tegra_vde_runtime_suspend(struct device *dev)
>  	struct tegra_vde *vde = dev_get_drvdata(dev);
>  	int err;
>  
> -	err = tegra_powergate_power_off(TEGRA_POWERGATE_VDEC);
> -	if (err) {
> -		dev_err(dev, "Failed to power down HW: %d\n", err);
> -		return err;
> +	if (!dev->pm_domain) {
> +		err = tegra_powergate_power_off(TEGRA_POWERGATE_VDEC);
> +		if (err) {
> +			dev_err(dev, "Failed to power down HW: %d\n", err);
> +			return err;
> +		}
>  	}
>  
>  	clk_disable_unprepare(vde->clk);
> +	reset_control_release(vde->rst);
> +	reset_control_release(vde->rst_mc);
>  
>  	return 0;
>  }
> @@ -936,14 +941,41 @@ static __maybe_unused int tegra_vde_runtime_resume(struct device *dev)
>  	struct tegra_vde *vde = dev_get_drvdata(dev);
>  	int err;
>  
> -	err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_VDEC,
> -						vde->clk, vde->rst);
> +	err = reset_control_acquire(vde->rst_mc);
>  	if (err) {
> -		dev_err(dev, "Failed to power up HW : %d\n", err);
> +		dev_err(dev, "Failed to acquire mc reset: %d\n", err);
>  		return err;
>  	}
>  
> +	err = reset_control_acquire(vde->rst);
> +	if (err) {
> +		dev_err(dev, "Failed to acquire reset: %d\n", err);
> +		goto release_mc_reset;
> +	}
> +
> +	if (!dev->pm_domain) {
> +		err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_VDEC,
> +							vde->clk, vde->rst);
> +		if (err) {
> +			dev_err(dev, "Failed to power up HW : %d\n", err);
> +			goto release_reset;
> +		}
> +	}
> +
> +	err = clk_prepare_enable(vde->clk);
> +	if (err) {
> +		dev_err(dev, "Failed to enable clock: %d\n", err);
> +		goto release_reset;
> +	}
> +
>  	return 0;
> +
> +release_reset:
> +	reset_control_release(vde->rst);
> +release_mc_reset:
> +	reset_control_release(vde->rst_mc);
> +
> +	return err;
>  }
>  
>  static int tegra_vde_probe(struct platform_device *pdev)
> @@ -1001,14 +1033,14 @@ static int tegra_vde_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	vde->rst = devm_reset_control_get(dev, NULL);
> +	vde->rst = devm_reset_control_get_exclusive_released(dev, NULL);
>  	if (IS_ERR(vde->rst)) {
>  		err = PTR_ERR(vde->rst);
>  		dev_err(dev, "Could not get VDE reset %d\n", err);
>  		return err;
>  	}
>  
> -	vde->rst_mc = devm_reset_control_get_optional(dev, "mc");
> +	vde->rst_mc = devm_reset_control_get_optional_exclusive_released(dev, "mc");
>  	if (IS_ERR(vde->rst_mc)) {
>  		err = PTR_ERR(vde->rst_mc);
>  		dev_err(dev, "Could not get MC reset %d\n", err);
> @@ -1066,6 +1098,10 @@ static int tegra_vde_probe(struct platform_device *pdev)
>  	pm_runtime_use_autosuspend(dev);
>  	pm_runtime_set_autosuspend_delay(dev, 300);
>  
> +	err = devm_tegra_core_dev_init_opp_table_common(dev);
> +	if (err)
> +		goto err_pm_runtime;
> +
>  	/*
>  	 * VDE partition may be left ON after bootloader, hence let's
>  	 * power-cycle it in order to put hardware into a predictable lower
> @@ -1133,8 +1169,7 @@ static void tegra_vde_shutdown(struct platform_device *pdev)
>  	 * On some devices bootloader isn't ready to a power-gated VDE on
>  	 * a warm-reboot, machine will hang in that case.
>  	 */
> -	if (pm_runtime_status_suspended(&pdev->dev))
> -		tegra_vde_runtime_resume(&pdev->dev);
> +	pm_runtime_get_sync(&pdev->dev);
>  }
>  
>  static __maybe_unused int tegra_vde_pm_suspend(struct device *dev)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ