diff mbox series

remoteproc: qcom: q6v5: Use _clk_get_optional for aggre2_clk

Message ID 20220714104309.4111334-1-abel.vesa@linaro.org
State Superseded
Headers show
Series remoteproc: qcom: q6v5: Use _clk_get_optional for aggre2_clk | expand

Commit Message

Abel Vesa July 14, 2022, 10:43 a.m. UTC
There is devm_clk_get_optional now, so lets drop the has_aggre2_clk
from adsp_data.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 drivers/remoteproc/qcom_q6v5_pas.c | 41 +++++-------------------------
 1 file changed, 7 insertions(+), 34 deletions(-)

Comments

Bjorn Andersson July 17, 2022, 3:51 a.m. UTC | #1
On Thu 14 Jul 05:43 CDT 2022, Abel Vesa wrote:

> There is devm_clk_get_optional now, so lets drop the has_aggre2_clk
> from adsp_data.

I like this patch, but for the history, could you please provide a
reason why you would like to do this?

Regards,
Bjorn

> 
> Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> ---
>  drivers/remoteproc/qcom_q6v5_pas.c | 41 +++++-------------------------
>  1 file changed, 7 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 6ae39c5653b1..beef7a09c380 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -34,7 +34,6 @@ struct adsp_data {
>  	const char *firmware_name;
>  	int pas_id;
>  	unsigned int minidump_id;
> -	bool has_aggre2_clk;
>  	bool auto_boot;
>  
>  	char **proxy_pd_names;
> @@ -64,7 +63,6 @@ struct qcom_adsp {
>  	int pas_id;
>  	unsigned int minidump_id;
>  	int crash_reason_smem;
> -	bool has_aggre2_clk;
>  	const char *info_name;
>  
>  	struct completion start_done;
> @@ -310,15 +308,13 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
>  		return ret;
>  	}
>  
> -	if (adsp->has_aggre2_clk) {
> -		adsp->aggre2_clk = devm_clk_get(adsp->dev, "aggre2");
> -		if (IS_ERR(adsp->aggre2_clk)) {
> -			ret = PTR_ERR(adsp->aggre2_clk);
> -			if (ret != -EPROBE_DEFER)
> -				dev_err(adsp->dev,
> -					"failed to get aggre2 clock");
> -			return ret;
> -		}
> +	adsp->aggre2_clk = devm_clk_get_optional(adsp->dev, "aggre2");
> +	if (IS_ERR(adsp->aggre2_clk)) {
> +		ret = PTR_ERR(adsp->aggre2_clk);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(adsp->dev,
> +				"failed to get aggre2 clock");
> +		return ret;
>  	}
>  
>  	return 0;
> @@ -457,7 +453,6 @@ static int adsp_probe(struct platform_device *pdev)
>  	adsp->rproc = rproc;
>  	adsp->minidump_id = desc->minidump_id;
>  	adsp->pas_id = desc->pas_id;
> -	adsp->has_aggre2_clk = desc->has_aggre2_clk;
>  	adsp->info_name = desc->sysmon_name;
>  	platform_set_drvdata(pdev, adsp);
>  
> @@ -531,7 +526,6 @@ static const struct adsp_data adsp_resource_init = {
>  		.crash_reason_smem = 423,
>  		.firmware_name = "adsp.mdt",
>  		.pas_id = 1,
> -		.has_aggre2_clk = false,
>  		.auto_boot = true,
>  		.ssr_name = "lpass",
>  		.sysmon_name = "adsp",
> @@ -542,7 +536,6 @@ static const struct adsp_data sdm845_adsp_resource_init = {
>  		.crash_reason_smem = 423,
>  		.firmware_name = "adsp.mdt",
>  		.pas_id = 1,
> -		.has_aggre2_clk = false,
>  		.auto_boot = true,
>  		.load_state = "adsp",
>  		.ssr_name = "lpass",
> @@ -554,7 +547,6 @@ static const struct adsp_data sm6350_adsp_resource = {
>  	.crash_reason_smem = 423,
>  	.firmware_name = "adsp.mdt",
>  	.pas_id = 1,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"lcx",
> @@ -571,7 +563,6 @@ static const struct adsp_data sm8150_adsp_resource = {
>  		.crash_reason_smem = 423,
>  		.firmware_name = "adsp.mdt",
>  		.pas_id = 1,
> -		.has_aggre2_clk = false,
>  		.auto_boot = true,
>  		.proxy_pd_names = (char*[]){
>  			"cx",
> @@ -587,7 +578,6 @@ static const struct adsp_data sm8250_adsp_resource = {
>  	.crash_reason_smem = 423,
>  	.firmware_name = "adsp.mdt",
>  	.pas_id = 1,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"lcx",
> @@ -604,7 +594,6 @@ static const struct adsp_data sm8350_adsp_resource = {
>  	.crash_reason_smem = 423,
>  	.firmware_name = "adsp.mdt",
>  	.pas_id = 1,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"lcx",
> @@ -621,7 +610,6 @@ static const struct adsp_data msm8996_adsp_resource = {
>  		.crash_reason_smem = 423,
>  		.firmware_name = "adsp.mdt",
>  		.pas_id = 1,
> -		.has_aggre2_clk = false,
>  		.auto_boot = true,
>  		.proxy_pd_names = (char*[]){
>  			"cx",
> @@ -636,7 +624,6 @@ static const struct adsp_data cdsp_resource_init = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.ssr_name = "cdsp",
>  	.sysmon_name = "cdsp",
> @@ -647,7 +634,6 @@ static const struct adsp_data sdm845_cdsp_resource_init = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.load_state = "cdsp",
>  	.ssr_name = "cdsp",
> @@ -659,7 +645,6 @@ static const struct adsp_data sm6350_cdsp_resource = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> @@ -676,7 +661,6 @@ static const struct adsp_data sm8150_cdsp_resource = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> @@ -692,7 +676,6 @@ static const struct adsp_data sm8250_cdsp_resource = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> @@ -708,7 +691,6 @@ static const struct adsp_data sc8280xp_nsp0_resource = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"nsp",
> @@ -723,7 +705,6 @@ static const struct adsp_data sc8280xp_nsp1_resource = {
>  	.crash_reason_smem = 633,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 30,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"nsp",
> @@ -738,7 +719,6 @@ static const struct adsp_data sm8350_cdsp_resource = {
>  	.crash_reason_smem = 601,
>  	.firmware_name = "cdsp.mdt",
>  	.pas_id = 18,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> @@ -756,7 +736,6 @@ static const struct adsp_data mpss_resource_init = {
>  	.firmware_name = "modem.mdt",
>  	.pas_id = 4,
>  	.minidump_id = 3,
> -	.has_aggre2_clk = false,
>  	.auto_boot = false,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> @@ -773,7 +752,6 @@ static const struct adsp_data sc8180x_mpss_resource = {
>  	.crash_reason_smem = 421,
>  	.firmware_name = "modem.mdt",
>  	.pas_id = 4,
> -	.has_aggre2_clk = false,
>  	.auto_boot = false,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> @@ -789,7 +767,6 @@ static const struct adsp_data slpi_resource_init = {
>  		.crash_reason_smem = 424,
>  		.firmware_name = "slpi.mdt",
>  		.pas_id = 12,
> -		.has_aggre2_clk = true,
>  		.auto_boot = true,
>  		.proxy_pd_names = (char*[]){
>  			"ssc_cx",
> @@ -804,7 +781,6 @@ static const struct adsp_data sm8150_slpi_resource = {
>  		.crash_reason_smem = 424,
>  		.firmware_name = "slpi.mdt",
>  		.pas_id = 12,
> -		.has_aggre2_clk = false,
>  		.auto_boot = true,
>  		.proxy_pd_names = (char*[]){
>  			"lcx",
> @@ -821,7 +797,6 @@ static const struct adsp_data sm8250_slpi_resource = {
>  	.crash_reason_smem = 424,
>  	.firmware_name = "slpi.mdt",
>  	.pas_id = 12,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"lcx",
> @@ -838,7 +813,6 @@ static const struct adsp_data sm8350_slpi_resource = {
>  	.crash_reason_smem = 424,
>  	.firmware_name = "slpi.mdt",
>  	.pas_id = 12,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"lcx",
> @@ -865,7 +839,6 @@ static const struct adsp_data sdx55_mpss_resource = {
>  	.crash_reason_smem = 421,
>  	.firmware_name = "modem.mdt",
>  	.pas_id = 4,
> -	.has_aggre2_clk = false,
>  	.auto_boot = true,
>  	.proxy_pd_names = (char*[]){
>  		"cx",
> -- 
> 2.34.3
>
diff mbox series

Patch

diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 6ae39c5653b1..beef7a09c380 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -34,7 +34,6 @@  struct adsp_data {
 	const char *firmware_name;
 	int pas_id;
 	unsigned int minidump_id;
-	bool has_aggre2_clk;
 	bool auto_boot;
 
 	char **proxy_pd_names;
@@ -64,7 +63,6 @@  struct qcom_adsp {
 	int pas_id;
 	unsigned int minidump_id;
 	int crash_reason_smem;
-	bool has_aggre2_clk;
 	const char *info_name;
 
 	struct completion start_done;
@@ -310,15 +308,13 @@  static int adsp_init_clock(struct qcom_adsp *adsp)
 		return ret;
 	}
 
-	if (adsp->has_aggre2_clk) {
-		adsp->aggre2_clk = devm_clk_get(adsp->dev, "aggre2");
-		if (IS_ERR(adsp->aggre2_clk)) {
-			ret = PTR_ERR(adsp->aggre2_clk);
-			if (ret != -EPROBE_DEFER)
-				dev_err(adsp->dev,
-					"failed to get aggre2 clock");
-			return ret;
-		}
+	adsp->aggre2_clk = devm_clk_get_optional(adsp->dev, "aggre2");
+	if (IS_ERR(adsp->aggre2_clk)) {
+		ret = PTR_ERR(adsp->aggre2_clk);
+		if (ret != -EPROBE_DEFER)
+			dev_err(adsp->dev,
+				"failed to get aggre2 clock");
+		return ret;
 	}
 
 	return 0;
@@ -457,7 +453,6 @@  static int adsp_probe(struct platform_device *pdev)
 	adsp->rproc = rproc;
 	adsp->minidump_id = desc->minidump_id;
 	adsp->pas_id = desc->pas_id;
-	adsp->has_aggre2_clk = desc->has_aggre2_clk;
 	adsp->info_name = desc->sysmon_name;
 	platform_set_drvdata(pdev, adsp);
 
@@ -531,7 +526,6 @@  static const struct adsp_data adsp_resource_init = {
 		.crash_reason_smem = 423,
 		.firmware_name = "adsp.mdt",
 		.pas_id = 1,
-		.has_aggre2_clk = false,
 		.auto_boot = true,
 		.ssr_name = "lpass",
 		.sysmon_name = "adsp",
@@ -542,7 +536,6 @@  static const struct adsp_data sdm845_adsp_resource_init = {
 		.crash_reason_smem = 423,
 		.firmware_name = "adsp.mdt",
 		.pas_id = 1,
-		.has_aggre2_clk = false,
 		.auto_boot = true,
 		.load_state = "adsp",
 		.ssr_name = "lpass",
@@ -554,7 +547,6 @@  static const struct adsp_data sm6350_adsp_resource = {
 	.crash_reason_smem = 423,
 	.firmware_name = "adsp.mdt",
 	.pas_id = 1,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"lcx",
@@ -571,7 +563,6 @@  static const struct adsp_data sm8150_adsp_resource = {
 		.crash_reason_smem = 423,
 		.firmware_name = "adsp.mdt",
 		.pas_id = 1,
-		.has_aggre2_clk = false,
 		.auto_boot = true,
 		.proxy_pd_names = (char*[]){
 			"cx",
@@ -587,7 +578,6 @@  static const struct adsp_data sm8250_adsp_resource = {
 	.crash_reason_smem = 423,
 	.firmware_name = "adsp.mdt",
 	.pas_id = 1,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"lcx",
@@ -604,7 +594,6 @@  static const struct adsp_data sm8350_adsp_resource = {
 	.crash_reason_smem = 423,
 	.firmware_name = "adsp.mdt",
 	.pas_id = 1,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"lcx",
@@ -621,7 +610,6 @@  static const struct adsp_data msm8996_adsp_resource = {
 		.crash_reason_smem = 423,
 		.firmware_name = "adsp.mdt",
 		.pas_id = 1,
-		.has_aggre2_clk = false,
 		.auto_boot = true,
 		.proxy_pd_names = (char*[]){
 			"cx",
@@ -636,7 +624,6 @@  static const struct adsp_data cdsp_resource_init = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.ssr_name = "cdsp",
 	.sysmon_name = "cdsp",
@@ -647,7 +634,6 @@  static const struct adsp_data sdm845_cdsp_resource_init = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.load_state = "cdsp",
 	.ssr_name = "cdsp",
@@ -659,7 +645,6 @@  static const struct adsp_data sm6350_cdsp_resource = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"cx",
@@ -676,7 +661,6 @@  static const struct adsp_data sm8150_cdsp_resource = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"cx",
@@ -692,7 +676,6 @@  static const struct adsp_data sm8250_cdsp_resource = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"cx",
@@ -708,7 +691,6 @@  static const struct adsp_data sc8280xp_nsp0_resource = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"nsp",
@@ -723,7 +705,6 @@  static const struct adsp_data sc8280xp_nsp1_resource = {
 	.crash_reason_smem = 633,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 30,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"nsp",
@@ -738,7 +719,6 @@  static const struct adsp_data sm8350_cdsp_resource = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
 	.pas_id = 18,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"cx",
@@ -756,7 +736,6 @@  static const struct adsp_data mpss_resource_init = {
 	.firmware_name = "modem.mdt",
 	.pas_id = 4,
 	.minidump_id = 3,
-	.has_aggre2_clk = false,
 	.auto_boot = false,
 	.proxy_pd_names = (char*[]){
 		"cx",
@@ -773,7 +752,6 @@  static const struct adsp_data sc8180x_mpss_resource = {
 	.crash_reason_smem = 421,
 	.firmware_name = "modem.mdt",
 	.pas_id = 4,
-	.has_aggre2_clk = false,
 	.auto_boot = false,
 	.proxy_pd_names = (char*[]){
 		"cx",
@@ -789,7 +767,6 @@  static const struct adsp_data slpi_resource_init = {
 		.crash_reason_smem = 424,
 		.firmware_name = "slpi.mdt",
 		.pas_id = 12,
-		.has_aggre2_clk = true,
 		.auto_boot = true,
 		.proxy_pd_names = (char*[]){
 			"ssc_cx",
@@ -804,7 +781,6 @@  static const struct adsp_data sm8150_slpi_resource = {
 		.crash_reason_smem = 424,
 		.firmware_name = "slpi.mdt",
 		.pas_id = 12,
-		.has_aggre2_clk = false,
 		.auto_boot = true,
 		.proxy_pd_names = (char*[]){
 			"lcx",
@@ -821,7 +797,6 @@  static const struct adsp_data sm8250_slpi_resource = {
 	.crash_reason_smem = 424,
 	.firmware_name = "slpi.mdt",
 	.pas_id = 12,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"lcx",
@@ -838,7 +813,6 @@  static const struct adsp_data sm8350_slpi_resource = {
 	.crash_reason_smem = 424,
 	.firmware_name = "slpi.mdt",
 	.pas_id = 12,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"lcx",
@@ -865,7 +839,6 @@  static const struct adsp_data sdx55_mpss_resource = {
 	.crash_reason_smem = 421,
 	.firmware_name = "modem.mdt",
 	.pas_id = 4,
-	.has_aggre2_clk = false,
 	.auto_boot = true,
 	.proxy_pd_names = (char*[]){
 		"cx",