Prechádzať zdrojové kódy

asoc: lpass-cdc: Update swr pdev initialize order

During sound card register init call, if swr pdev
is not initialized yet respective soundwire port
config is not updated to soundwire controller device.
In macro drivers, update swr pdev into macro private
data prior to platform device add.

Change-Id: Ifa67471cfc7a10b102b573df6285e598bb0b5e5e
Signed-off-by: Laxminath Kasam <[email protected]>
Laxminath Kasam 4 rokov pred
rodič
commit
01756036b5

+ 10 - 11
asoc/codecs/bolero/rx-macro.c

@@ -4054,17 +4054,7 @@ static void rx_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (rx_swr_master_node) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct rx_swr_ctrl_data),
@@ -4077,10 +4067,19 @@ static void rx_macro_add_child_devices(struct work_struct *work)
 			swr_ctrl_data[ctrl_num].rx_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			rx_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (rx_priv->child_count < RX_MACRO_CHILD_DEVICES_MAX)
 			rx_priv->pdev_child_devices[
 					rx_priv->child_count++] = pdev;

+ 10 - 11
asoc/codecs/bolero/tx-macro.c

@@ -3322,17 +3322,7 @@ static void tx_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (tx_swr_master_node) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct tx_macro_swr_ctrl_data),
@@ -3345,10 +3335,19 @@ static void tx_macro_add_child_devices(struct work_struct *work)
 			swr_ctrl_data[ctrl_num].tx_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			tx_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (tx_priv->child_count < TX_MACRO_CHILD_DEVICES_MAX)
 			tx_priv->pdev_child_devices[
 					tx_priv->child_count++] = pdev;

+ 10 - 11
asoc/codecs/bolero/va-macro.c

@@ -2944,17 +2944,7 @@ static void va_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (va_swr_master_node) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct va_macro_swr_ctrl_data),
@@ -2967,10 +2957,19 @@ static void va_macro_add_child_devices(struct work_struct *work)
 			swr_ctrl_data[ctrl_num].va_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			va_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (va_priv->child_count < VA_MACRO_CHILD_DEVICES_MAX)
 			va_priv->pdev_child_devices[
 					va_priv->child_count++] = pdev;

+ 11 - 12
asoc/codecs/bolero/wsa-macro.c

@@ -3076,17 +3076,7 @@ static void wsa_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (!strcmp(node->name, "wsa_swr_master")) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct wsa_macro_swr_ctrl_data),
@@ -3094,16 +3084,25 @@ static void wsa_macro_add_child_devices(struct work_struct *work)
 			if (!temp) {
 				dev_err(&pdev->dev, "out of memory\n");
 				ret = -ENOMEM;
-				goto err;
+				goto fail_pdev_add;
 			}
 			swr_ctrl_data = temp;
 			swr_ctrl_data[ctrl_num].wsa_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			wsa_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (wsa_priv->child_count < WSA_MACRO_CHILD_DEVICES_MAX)
 			wsa_priv->pdev_child_devices[
 					wsa_priv->child_count++] = pdev;

+ 10 - 11
asoc/codecs/lpass-cdc/lpass-cdc-rx-macro.c

@@ -4027,17 +4027,7 @@ static void lpass_cdc_rx_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (rx_swr_master_node) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct rx_swr_ctrl_data),
@@ -4050,10 +4040,19 @@ static void lpass_cdc_rx_macro_add_child_devices(struct work_struct *work)
 			swr_ctrl_data[ctrl_num].rx_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			rx_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (rx_priv->child_count < LPASS_CDC_RX_MACRO_CHILD_DEVICES_MAX)
 			rx_priv->pdev_child_devices[
 					rx_priv->child_count++] = pdev;

+ 10 - 11
asoc/codecs/lpass-cdc/lpass-cdc-va-macro.c

@@ -2160,17 +2160,7 @@ static void lpass_cdc_va_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (va_swr_master_node) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct lpass_cdc_va_macro_swr_ctrl_data),
@@ -2183,10 +2173,19 @@ static void lpass_cdc_va_macro_add_child_devices(struct work_struct *work)
 			swr_ctrl_data[ctrl_num].va_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			va_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (va_priv->child_count < LPASS_CDC_VA_MACRO_CHILD_DEVICES_MAX)
 			va_priv->pdev_child_devices[
 					va_priv->child_count++] = pdev;

+ 11 - 12
asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c

@@ -2930,17 +2930,7 @@ static void lpass_cdc_wsa_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (!strcmp(node->name, "wsa_swr_master")) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct lpass_cdc_wsa_macro_swr_ctrl_data),
@@ -2948,16 +2938,25 @@ static void lpass_cdc_wsa_macro_add_child_devices(struct work_struct *work)
 			if (!temp) {
 				dev_err(&pdev->dev, "out of memory\n");
 				ret = -ENOMEM;
-				goto err;
+				goto fail_pdev_add;
 			}
 			swr_ctrl_data = temp;
 			swr_ctrl_data[ctrl_num].wsa_swr_pdev = pdev;
 			ctrl_num++;
 			dev_dbg(&pdev->dev,
-				"%s: Added soundwire ctrl device(s)\n",
+				"%s: Adding soundwire ctrl device(s)\n",
 				__func__);
 			wsa_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (wsa_priv->child_count < LPASS_CDC_WSA_MACRO_CHILD_DEVICES_MAX)
 			wsa_priv->pdev_child_devices[
 					wsa_priv->child_count++] = pdev;

+ 10 - 11
asoc/codecs/lpass-cdc/lpass-cdc-wsa2-macro.c

@@ -2929,17 +2929,7 @@ static void lpass_cdc_wsa2_macro_add_child_devices(struct work_struct *work)
 					__func__, ctrl_num);
 				goto fail_pdev_add;
 			}
-		}
-
-		ret = platform_device_add(pdev);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"%s: Cannot add platform device\n",
-				__func__);
-			goto fail_pdev_add;
-		}
 
-		if (!strcmp(node->name, "wsa2_swr_master")) {
 			temp = krealloc(swr_ctrl_data,
 					(ctrl_num + 1) * sizeof(
 					struct lpass_cdc_wsa2_macro_swr_ctrl_data),
@@ -2947,7 +2937,7 @@ static void lpass_cdc_wsa2_macro_add_child_devices(struct work_struct *work)
 			if (!temp) {
 				dev_err(&pdev->dev, "out of memory\n");
 				ret = -ENOMEM;
-				goto err;
+				goto fail_pdev_add;
 			}
 			swr_ctrl_data = temp;
 			swr_ctrl_data[ctrl_num].wsa2_swr_pdev = pdev;
@@ -2957,6 +2947,15 @@ static void lpass_cdc_wsa2_macro_add_child_devices(struct work_struct *work)
 				__func__);
 			wsa2_priv->swr_ctrl_data = swr_ctrl_data;
 		}
+
+		ret = platform_device_add(pdev);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"%s: Cannot add platform device\n",
+				__func__);
+			goto fail_pdev_add;
+		}
+
 		if (wsa2_priv->child_count < LPASS_CDC_WSA2_MACRO_CHILD_DEVICES_MAX)
 			wsa2_priv->pdev_child_devices[
 					wsa2_priv->child_count++] = pdev;