Unverified Commit 660f029a authored by Brent Lu's avatar Brent Lu Committed by Mark Brown
Browse files

ASoC: Intel: sof_da7219: remove local max98373 ops



Since maxim-module could detect tdm slot number in runtime, we could
remove local ops and use maxim-module to handle max98373.

Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240527193552.165567-18-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 459d71f1
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -86,12 +86,10 @@ enum {
/*
 * sof_da7219_private: private data for da7219 machine driver
 *
 * @is_jsl_board: true for JSL boards
 * @mclk_en: true for mclk pin is connected
 * @pll_bypass: true for PLL bypass mode
 */
struct sof_da7219_private {
	bool is_jsl_board;
	bool mclk_en;
	bool pll_bypass;
};
+0 −44
Original line number Diff line number Diff line
@@ -178,40 +178,6 @@ static void da7219_codec_exit(struct snd_soc_pcm_runtime *rtd)
	snd_soc_component_set_jack(component, NULL, NULL);
}

static int max98373_hw_params(struct snd_pcm_substream *substream,
			      struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_runtime *runtime = snd_soc_substream_to_rtd(substream);
	int ret, j;

	for (j = 0; j < runtime->dai_link->num_codecs; j++) {
		struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, j);

		if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) {
			/* vmon_slot_no = 0 imon_slot_no = 1 for TX slots */
			ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 3, 4, 16);
			if (ret < 0) {
				dev_err(runtime->dev, "DEV0 TDM slot err:%d\n", ret);
				return ret;
			}
		}
		if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) {
			/* vmon_slot_no = 2 imon_slot_no = 3 for TX slots */
			ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xC, 3, 4, 16);
			if (ret < 0) {
				dev_err(runtime->dev, "DEV1 TDM slot err:%d\n", ret);
				return ret;
			}
		}
	}

	return 0;
}

static const struct snd_soc_ops max98373_ops = {
	.hw_params = max98373_hw_params,
};

static int card_late_probe(struct snd_soc_card *card)
{
	return sof_intel_board_card_late_probe(card);
@@ -276,14 +242,6 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
		break;
	case CODEC_MAX98373:
		max_98373_dai_link(dev, ctx->amp_link);

		if (ctx->da7219.is_jsl_board) {
			ctx->amp_link->ops = &max98373_ops; /* use local ops */
		} else {
			/* TBD: implement the amp for later platform */
			dev_err(dev, "max98373 not support yet\n");
			return -EINVAL;
		}
		break;
	case CODEC_MAX98390:
		max_98390_dai_link(dev, ctx->amp_link);
@@ -388,8 +346,6 @@ static int audio_probe(struct platform_device *pdev)
			break;
		}
	} else if (board_quirk & SOF_DA7219_JSL_BOARD) {
		ctx->da7219.is_jsl_board = true;

		/* overwrite the DAI link order for JSL boards */
		ctx->link_order_overwrite = JSL_LINK_ORDER;