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

Commit 6b418383 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd-spi: Remove debugfs node on unbind"

parents 80299358 b894d912
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -592,6 +592,7 @@ static void wcd9xxx_device_exit(struct wcd9xxx *wcd9xxx)
{
	device_init_wakeup(wcd9xxx->dev, false);
	wcd9xxx_irq_exit(&wcd9xxx->core_res);
	mfd_remove_devices(wcd9xxx->dev);
	wcd9xxx_bringdown(wcd9xxx->dev);
	wcd9xxx_reset_low(wcd9xxx->dev);
	wcd9xxx_core_res_deinit(&wcd9xxx->core_res);
+26 −1
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ static int phyirq_to_virq(
	struct wcd9xxx_core_resource *wcd9xxx_res, int irq);
static unsigned int wcd9xxx_irq_get_upstream_irq(
	struct wcd9xxx_core_resource *wcd9xxx_res);
static void wcd9xxx_irq_put_downstream_irq(
	struct wcd9xxx_core_resource *wcd9xxx_res);
static void wcd9xxx_irq_put_upstream_irq(
	struct wcd9xxx_core_resource *wcd9xxx_res);
static int wcd9xxx_map_irq(
@@ -632,6 +634,7 @@ void wcd9xxx_irq_exit(struct wcd9xxx_core_resource *wcd9xxx_res)
		disable_irq_wake(wcd9xxx_res->irq);
		free_irq(wcd9xxx_res->irq, wcd9xxx_res);
		wcd9xxx_res->irq = 0;
		wcd9xxx_irq_put_downstream_irq(wcd9xxx_res);
		wcd9xxx_irq_put_upstream_irq(wcd9xxx_res);
	}
	mutex_destroy(&wcd9xxx_res->irq_lock);
@@ -754,6 +757,29 @@ static unsigned int wcd9xxx_irq_get_upstream_irq(
	return data->irq;
}

static void wcd9xxx_irq_put_downstream_irq(
			struct wcd9xxx_core_resource *wcd9xxx_res)
{
	int irq, virq, ret;

	/*
	 * IRQ migration hits error if the chip data and handles
	 * are not made NULL. make associated data and handles
	 * to NULL at irq_exit
	 */
	for (irq = 0; irq < wcd9xxx_res->num_irqs; irq++) {
		virq = wcd9xxx_map_irq(wcd9xxx_res, irq);
		pr_debug("%s: irq %d -> %d\n", __func__, irq, virq);
		ret = irq_set_chip_data(virq, NULL);
		if (ret) {
			pr_err("%s: Failed to configure irq %d (%d)\n",
				__func__, irq, ret);
			return;
		}
		irq_set_chip_and_handler(virq, NULL, NULL);
	}
}

static void wcd9xxx_irq_put_upstream_irq(
			struct wcd9xxx_core_resource *wcd9xxx_res)
{
@@ -821,7 +847,6 @@ static int wcd9xxx_irq_remove(struct platform_device *pdev)
	wmb();
	irq_domain_remove(data->domain);
	kfree(data);
	domain->host_data = NULL;

	return 0;
}
+7 −4
Original line number Diff line number Diff line
@@ -79,11 +79,16 @@ void swr_remove_device(struct swr_device *swr_dev)
{
	struct swr_device *swr_dev_loop, *safe;

	/*
	 * master still has reference to all nodes and deletes
	 * at platform_unregister, so need to init the deleted
	 * entry
	 */
	list_for_each_entry_safe(swr_dev_loop, safe,
				 &swr_dev->master->devices,
				 dev_list) {
		if (swr_dev == swr_dev_loop)
			list_del(&swr_dev_loop->dev_list);
			list_del_init(&swr_dev_loop->dev_list);
	}
}
EXPORT_SYMBOL(swr_remove_device);
@@ -789,9 +794,7 @@ static void swr_unregister_device(struct swr_device *swr)

static void swr_master_release(struct device *dev)
{
	struct swr_master *master = to_swr_master(dev);

	kfree(master);
	/* kfree of master done at swrm_remove of device */
}

#define swr_master_attr_gr NULL
+4 −0
Original line number Diff line number Diff line
@@ -1374,6 +1374,10 @@ static void wcd_spi_component_unbind(struct device *dev,
{
	struct spi_device *spi = to_spi_device(dev);
	struct wcd_spi_priv *wcd_spi = spi_get_drvdata(spi);
	struct wcd_spi_debug_data *dbg_data = &wcd_spi->debug_data;

	debugfs_remove_recursive(dbg_data->dir);
	dbg_data->dir = NULL;

	wcd_spi->m_dev = NULL;
	wcd_spi->m_ops = NULL;
+36 −4
Original line number Diff line number Diff line
@@ -128,6 +128,8 @@ static const struct snd_kcontrol_new name##_mux = \
#define WCD934X_DIG_CORE_REG_MIN  WCD934X_CDC_ANC0_CLK_RESET_CTL
#define WCD934X_DIG_CORE_REG_MAX  0xFFF

#define WCD934X_CHILD_DEVICES_MAX	6

#define WCD934X_MAX_MICBIAS 4
#define DAPM_MICBIAS1_STANDALONE "MIC BIAS1 Standalone"
#define DAPM_MICBIAS2_STANDALONE "MIC BIAS2 Standalone"
@@ -626,6 +628,11 @@ struct tavil_priv {
	int power_active_ref;
	int sidetone_coeff_array[IIR_MAX][BAND_MAX]
		[WCD934X_CDC_SIDETONE_IIR_COEFF_MAX];

	struct spi_device *spi;
	struct platform_device *pdev_child_devices
		[WCD934X_CHILD_DEVICES_MAX];
	int child_count;
};

static const struct tavil_reg_mask_val tavil_spkr_default[] = {
@@ -5105,6 +5112,13 @@ static void tavil_restore_iir_coeff(struct tavil_priv *tavil, int iir_idx)
	int band_idx = 0, coeff_idx = 0;
	struct snd_soc_codec *codec = tavil->codec;

	/*
	 * snd_soc_write call crashes at rmmod if there is no machine
	 * driver and hence no codec pointer available
	 */
	if (!codec)
		return;

	for (band_idx = 0; band_idx < BAND_MAX; band_idx++) {
		snd_soc_write(codec,
		(WCD934X_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
@@ -9397,6 +9411,9 @@ static int tavil_soc_codec_remove(struct snd_soc_codec *codec)

	control = dev_get_drvdata(codec->dev->parent);
	devm_kfree(codec->dev, control->rx_chs);
	/* slimslave deinit in wcd core looks for this value */
	control->num_rx_port = 0;
	control->num_tx_port = 0;
	control->rx_chs = NULL;
	control->tx_chs = NULL;
	tavil_cleanup_irqs(tavil);
@@ -9736,6 +9753,7 @@ static void tavil_codec_add_spi_device(struct tavil_priv *tavil,
		goto err_dt_parse;
	}

	tavil->spi = spi;
	/* Put the reference to SPI master */
	put_device(&master->dev);

@@ -9782,6 +9800,7 @@ static void tavil_add_child_devices(struct work_struct *work)
	}

	platdata = &tavil->swr.plat_data;
	tavil->child_count = 0;

	for_each_child_of_node(wcd9xxx->dev->of_node, node) {

@@ -9849,6 +9868,10 @@ static void tavil_add_child_devices(struct work_struct *work)
				__func__);
			tavil->swr.ctrl_data = swr_ctrl_data;
		}
		if (tavil->child_count < WCD934X_CHILD_DEVICES_MAX)
			tavil->pdev_child_devices[tavil->child_count++] = pdev;
		else
			goto err_mem;
	}

	return;
@@ -10076,11 +10099,24 @@ static int tavil_probe(struct platform_device *pdev)
static int tavil_remove(struct platform_device *pdev)
{
	struct tavil_priv *tavil;
	int count = 0;

	tavil = platform_get_drvdata(pdev);
	if (!tavil)
		return -EINVAL;

	/* do dsd deinit before codec->component->regmap becomes freed */
	if (tavil->dsd_config) {
		tavil_dsd_deinit(tavil->dsd_config);
		tavil->dsd_config = NULL;
	}

	if (tavil->spi)
		spi_unregister_device(tavil->spi);
	for (count = 0; count < tavil->child_count &&
				count < WCD934X_CHILD_DEVICES_MAX; count++)
		platform_device_unregister(tavil->pdev_child_devices[count]);

	mutex_destroy(&tavil->micb_lock);
	mutex_destroy(&tavil->svs_mutex);
	mutex_destroy(&tavil->codec_mutex);
@@ -10091,10 +10127,6 @@ static int tavil_remove(struct platform_device *pdev)
	snd_soc_unregister_codec(&pdev->dev);
	clk_put(tavil->wcd_ext_clk);
	wcd_resmgr_remove(tavil->resmgr);
	if (tavil->dsd_config) {
		tavil_dsd_deinit(tavil->dsd_config);
		tavil->dsd_config = NULL;
	}
	devm_kfree(&pdev->dev, tavil);
	return 0;
}
Loading