Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc80e4f2 authored by Meng Wang's avatar Meng Wang
Browse files

asoc: wsa883x: update irq_drv_data per wsa device



regmap_irq_chip->irq_drv_data is shared by all attached wsa
devices and pointed to last probbed wsa device. This will cause
interrupt handle issue. Update irq_drv_data per wsa deviece to
resolve this issue.

Change-Id: Ib22629340d895c3c56d4987949c253589165b579
Signed-off-by: default avatarMeng Wang <quic_mengw@quicinc.com>
parent 997c13ca
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -1622,12 +1622,20 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
	const char *wsa883x_name_prefix_of = NULL;
	char buffer[MAX_NAME_LEN];
	int dev_index = 0;
	struct regmap_irq_chip *wsa883x_sub_regmap_irq_chip = NULL;

	wsa883x = devm_kzalloc(&pdev->dev, sizeof(struct wsa883x_priv),
			    GFP_KERNEL);
	if (!wsa883x)
		return -ENOMEM;

	wsa883x_sub_regmap_irq_chip = devm_kzalloc(&pdev->dev, sizeof(struct regmap_irq_chip),
			GFP_KERNEL);
	if (!wsa883x_sub_regmap_irq_chip)
		return -ENOMEM;
	memcpy(wsa883x_sub_regmap_irq_chip, &wsa883x_regmap_irq_chip,
		sizeof(struct regmap_irq_chip));

	ret = wsa883x_enable_supplies(&pdev->dev, wsa883x);
	if (ret) {
		ret = -EPROBE_DEFER;
@@ -1670,11 +1678,11 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
	}

	/* Set all interrupts as edge triggered */
	for (i = 0; i < wsa883x_regmap_irq_chip.num_regs; i++)
	for (i = 0; i < wsa883x_sub_regmap_irq_chip->num_regs; i++)
		regmap_write(wsa883x->regmap, (WSA883X_INTR_LEVEL0 + i), 0);

	wsa883x_regmap_irq_chip.irq_drv_data = wsa883x;
	wsa883x->irq_info.wcd_regmap_irq_chip = &wsa883x_regmap_irq_chip;
	wsa883x_sub_regmap_irq_chip->irq_drv_data = wsa883x;
	wsa883x->irq_info.wcd_regmap_irq_chip = wsa883x_sub_regmap_irq_chip;
	wsa883x->irq_info.codec_name = "WSA883X";
	wsa883x->irq_info.regmap = wsa883x->regmap;
	wsa883x->irq_info.dev = &pdev->dev;