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

Unverified Commit 4e8f557b authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'asoc/topic/ssm2518', 'asoc/topic/ssm2602',...

Merge remote-tracking branches 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/ssm4567', 'asoc/topic/sta32x' and 'asoc/topic/sta350' into asoc-next
Loading
Loading
Loading
Loading
+25 −32
Original line number Diff line number Diff line
@@ -336,8 +336,8 @@ static int ssm2518_lookup_mcs(struct ssm2518 *ssm2518,
static int ssm2518_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_component *component = dai->component;
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(component);
	unsigned int rate = params_rate(params);
	unsigned int ctrl1, ctrl1_mask;
	int mcs;
@@ -391,7 +391,7 @@ static int ssm2518_hw_params(struct snd_pcm_substream *substream,

static int ssm2518_mute(struct snd_soc_dai *dai, int mute)
{
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec);
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
	unsigned int val;

	if (mute)
@@ -405,7 +405,7 @@ static int ssm2518_mute(struct snd_soc_dai *dai, int mute)

static int ssm2518_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec);
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
	unsigned int ctrl1 = 0, ctrl2 = 0;
	bool invert_fclk;
	int ret;
@@ -498,10 +498,10 @@ static int ssm2518_set_power(struct ssm2518 *ssm2518, bool enable)
	return ret;
}

static int ssm2518_set_bias_level(struct snd_soc_codec *codec,
static int ssm2518_set_bias_level(struct snd_soc_component *component,
	enum snd_soc_bias_level level)
{
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec);
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(component);
	int ret = 0;

	switch (level) {
@@ -510,7 +510,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec,
	case SND_SOC_BIAS_PREPARE:
		break;
	case SND_SOC_BIAS_STANDBY:
		if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF)
		if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
			ret = ssm2518_set_power(ssm2518, true);
		break;
	case SND_SOC_BIAS_OFF:
@@ -524,7 +524,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec,
static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
	unsigned int rx_mask, int slots, int width)
{
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec);
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
	unsigned int ctrl1, ctrl2;
	int left_slot, right_slot;
	int ret;
@@ -609,7 +609,7 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
static int ssm2518_startup(struct snd_pcm_substream *substream,
	struct snd_soc_dai *dai)
{
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec);
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);

	if (ssm2518->constraints)
		snd_pcm_hw_constraint_list(substream->runtime, 0,
@@ -641,10 +641,10 @@ static struct snd_soc_dai_driver ssm2518_dai = {
	.ops = &ssm2518_dai_ops,
};

static int ssm2518_set_sysclk(struct snd_soc_codec *codec, int clk_id,
static int ssm2518_set_sysclk(struct snd_soc_component *component, int clk_id,
	int source, unsigned int freq, int dir)
{
	struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec);
	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(component);
	unsigned int val;

	if (clk_id != SSM2518_SYSCLK)
@@ -710,19 +710,18 @@ static int ssm2518_set_sysclk(struct snd_soc_codec *codec, int clk_id,
			SSM2518_POWER1_NO_BCLK, val);
}

static const struct snd_soc_codec_driver ssm2518_codec_driver = {
static const struct snd_soc_component_driver ssm2518_component_driver = {
	.set_bias_level		= ssm2518_set_bias_level,
	.set_sysclk		= ssm2518_set_sysclk,
	.idle_bias_off = true,

	.component_driver = {
	.controls		= ssm2518_snd_controls,
	.num_controls		= ARRAY_SIZE(ssm2518_snd_controls),
	.dapm_widgets		= ssm2518_dapm_widgets,
	.num_dapm_widgets	= ARRAY_SIZE(ssm2518_dapm_widgets),
	.dapm_routes		= ssm2518_routes,
	.num_dapm_routes	= ARRAY_SIZE(ssm2518_routes),
	},
	.use_pmdown_time	= 1,
	.endianness		= 1,
	.non_legacy_dai_naming	= 1,
};

static const struct regmap_config ssm2518_regmap_config = {
@@ -792,16 +791,11 @@ static int ssm2518_i2c_probe(struct i2c_client *i2c,
	if (ret)
		return ret;

	return snd_soc_register_codec(&i2c->dev, &ssm2518_codec_driver,
	return devm_snd_soc_register_component(&i2c->dev,
			&ssm2518_component_driver,
			&ssm2518_dai, 1);
}

static int ssm2518_i2c_remove(struct i2c_client *client)
{
	snd_soc_unregister_codec(&client->dev);
	return 0;
}

#ifdef CONFIG_OF
static const struct of_device_id ssm2518_dt_ids[] = {
	{ .compatible = "adi,ssm2518", },
@@ -822,7 +816,6 @@ static struct i2c_driver ssm2518_driver = {
		.of_match_table = of_match_ptr(ssm2518_dt_ids),
	},
	.probe = ssm2518_i2c_probe,
	.remove = ssm2518_i2c_remove,
	.id_table = ssm2518_i2c_ids,
};
module_i2c_driver(ssm2518_driver);
+0 −7
Original line number Diff line number Diff line
@@ -27,12 +27,6 @@ static int ssm2602_i2c_probe(struct i2c_client *client,
		devm_regmap_init_i2c(client, &ssm2602_regmap_config));
}

static int ssm2602_i2c_remove(struct i2c_client *client)
{
	snd_soc_unregister_codec(&client->dev);
	return 0;
}

static const struct i2c_device_id ssm2602_i2c_id[] = {
	{ "ssm2602", SSM2602 },
	{ "ssm2603", SSM2602 },
@@ -55,7 +49,6 @@ static struct i2c_driver ssm2602_i2c_driver = {
		.of_match_table = ssm2602_of_match,
	},
	.probe = ssm2602_i2c_probe,
	.remove = ssm2602_i2c_remove,
	.id_table = ssm2602_i2c_id,
};
module_i2c_driver(ssm2602_i2c_driver);
+0 −7
Original line number Diff line number Diff line
@@ -20,12 +20,6 @@ static int ssm2602_spi_probe(struct spi_device *spi)
		devm_regmap_init_spi(spi, &ssm2602_regmap_config));
}

static int ssm2602_spi_remove(struct spi_device *spi)
{
	snd_soc_unregister_codec(&spi->dev);
	return 0;
}

static const struct of_device_id ssm2602_of_match[] = {
	{ .compatible = "adi,ssm2602", },
	{ }
@@ -38,7 +32,6 @@ static struct spi_driver ssm2602_spi_driver = {
		.of_match_table = ssm2602_of_match,
	},
	.probe		= ssm2602_spi_probe,
	.remove		= ssm2602_spi_remove,
};
module_spi_driver(ssm2602_spi_driver);

+39 −38
Original line number Diff line number Diff line
@@ -280,8 +280,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params,
	struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_component *component = dai->component;
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
	int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params));
	unsigned int iface;

@@ -315,8 +315,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
static int ssm2602_startup(struct snd_pcm_substream *substream,
			   struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_component *component = dai->component;
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);

	if (ssm2602->sysclk_constraints) {
		snd_pcm_hw_constraint_list(substream->runtime, 0,
@@ -329,7 +329,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,

static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
{
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(dai->codec);
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(dai->component);

	if (mute)
		regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI,
@@ -344,8 +344,8 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
		int clk_id, unsigned int freq, int dir)
{
	struct snd_soc_codec *codec = codec_dai->codec;
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_component *component = codec_dai->component;
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);

	if (dir == SND_SOC_CLOCK_IN) {
		if (clk_id != SSM2602_SYSCLK)
@@ -396,7 +396,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai,
		unsigned int fmt)
{
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec_dai->codec);
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(codec_dai->component);
	unsigned int iface = 0;

	/* set master/slave audio interface */
@@ -452,10 +452,10 @@ static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai,
	return 0;
}

static int ssm2602_set_bias_level(struct snd_soc_codec *codec,
static int ssm2602_set_bias_level(struct snd_soc_component *component,
				 enum snd_soc_bias_level level)
{
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);

	switch (level) {
	case SND_SOC_BIAS_ON:
@@ -518,19 +518,19 @@ static struct snd_soc_dai_driver ssm2602_dai = {
	.symmetric_samplebits = 1,
};

static int ssm2602_resume(struct snd_soc_codec *codec)
static int ssm2602_resume(struct snd_soc_component *component)
{
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);

	regcache_sync(ssm2602->regmap);

	return 0;
}

static int ssm2602_codec_probe(struct snd_soc_codec *codec)
static int ssm2602_component_probe(struct snd_soc_component *component)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
	int ret;

	regmap_update_bits(ssm2602->regmap, SSM2602_LOUT1V,
@@ -538,7 +538,7 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec)
	regmap_update_bits(ssm2602->regmap, SSM2602_ROUT1V,
			    ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH);

	ret = snd_soc_add_codec_controls(codec, ssm2602_snd_controls,
	ret = snd_soc_add_component_controls(component, ssm2602_snd_controls,
			ARRAY_SIZE(ssm2602_snd_controls));
	if (ret)
		return ret;
@@ -552,9 +552,9 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec)
			ARRAY_SIZE(ssm2602_routes));
}

static int ssm2604_codec_probe(struct snd_soc_codec *codec)
static int ssm2604_component_probe(struct snd_soc_component *component)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
	int ret;

	ret = snd_soc_dapm_new_controls(dapm, ssm2604_dapm_widgets,
@@ -566,14 +566,14 @@ static int ssm2604_codec_probe(struct snd_soc_codec *codec)
			ARRAY_SIZE(ssm2604_routes));
}

static int ssm260x_codec_probe(struct snd_soc_codec *codec)
static int ssm260x_component_probe(struct snd_soc_component *component)
{
	struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
	int ret;

	ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
		dev_err(component->dev, "Failed to issue reset: %d\n", ret);
		return ret;
	}

@@ -588,30 +588,31 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)

	switch (ssm2602->type) {
	case SSM2602:
		ret = ssm2602_codec_probe(codec);
		ret = ssm2602_component_probe(component);
		break;
	case SSM2604:
		ret = ssm2604_codec_probe(codec);
		ret = ssm2604_component_probe(component);
		break;
	}

	return ret;
}

static const struct snd_soc_codec_driver soc_codec_dev_ssm2602 = {
	.probe =	ssm260x_codec_probe,
static const struct snd_soc_component_driver soc_component_dev_ssm2602 = {
	.probe			= ssm260x_component_probe,
	.resume			= ssm2602_resume,
	.set_bias_level		= ssm2602_set_bias_level,
	.suspend_bias_off = true,

	.component_driver = {
	.controls		= ssm260x_snd_controls,
	.num_controls		= ARRAY_SIZE(ssm260x_snd_controls),
	.dapm_widgets		= ssm260x_dapm_widgets,
	.num_dapm_widgets	= ARRAY_SIZE(ssm260x_dapm_widgets),
	.dapm_routes		= ssm260x_routes,
	.num_dapm_routes	= ARRAY_SIZE(ssm260x_routes),
	},
	.suspend_bias_off	= 1,
	.idle_bias_on		= 1,
	.use_pmdown_time	= 1,
	.endianness		= 1,
	.non_legacy_dai_naming	= 1,
};

static bool ssm2602_register_volatile(struct device *dev, unsigned int reg)
@@ -648,7 +649,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type,
	ssm2602->type = type;
	ssm2602->regmap = regmap;

	return snd_soc_register_codec(dev, &soc_codec_dev_ssm2602,
	return devm_snd_soc_register_component(dev, &soc_component_dev_ssm2602,
		&ssm2602_dai, 1);
}
EXPORT_SYMBOL_GPL(ssm2602_probe);
+18 −26
Original line number Diff line number Diff line
@@ -199,8 +199,8 @@ static const struct snd_soc_dapm_route ssm4567_routes[] = {
static int ssm4567_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_component *component = dai->component;
	struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(component);
	unsigned int rate = params_rate(params);
	unsigned int dacfs;

@@ -223,7 +223,7 @@ static int ssm4567_hw_params(struct snd_pcm_substream *substream,

static int ssm4567_mute(struct snd_soc_dai *dai, int mute)
{
	struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(dai->codec);
	struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(dai->component);
	unsigned int val;

	val = mute ? SSM4567_DAC_MUTE : 0;
@@ -366,10 +366,10 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
	return ret;
}

static int ssm4567_set_bias_level(struct snd_soc_codec *codec,
static int ssm4567_set_bias_level(struct snd_soc_component *component,
	enum snd_soc_bias_level level)
{
	struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(codec);
	struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(component);
	int ret = 0;

	switch (level) {
@@ -378,7 +378,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec,
	case SND_SOC_BIAS_PREPARE:
		break;
	case SND_SOC_BIAS_STANDBY:
		if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF)
		if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
			ret = ssm4567_set_power(ssm4567, true);
		break;
	case SND_SOC_BIAS_OFF:
@@ -417,18 +417,17 @@ static struct snd_soc_dai_driver ssm4567_dai = {
	.ops = &ssm4567_dai_ops,
};

static const struct snd_soc_codec_driver ssm4567_codec_driver = {
static const struct snd_soc_component_driver ssm4567_component_driver = {
	.set_bias_level		= ssm4567_set_bias_level,
	.idle_bias_off = true,

	.component_driver = {
	.controls		= ssm4567_snd_controls,
	.num_controls		= ARRAY_SIZE(ssm4567_snd_controls),
	.dapm_widgets		= ssm4567_dapm_widgets,
	.num_dapm_widgets	= ARRAY_SIZE(ssm4567_dapm_widgets),
	.dapm_routes		= ssm4567_routes,
	.num_dapm_routes	= ARRAY_SIZE(ssm4567_routes),
	},
	.use_pmdown_time	= 1,
	.endianness		= 1,
	.non_legacy_dai_naming	= 1,
};

static const struct regmap_config ssm4567_regmap_config = {
@@ -469,16 +468,10 @@ static int ssm4567_i2c_probe(struct i2c_client *i2c,
	if (ret)
		return ret;

	return snd_soc_register_codec(&i2c->dev, &ssm4567_codec_driver,
	return devm_snd_soc_register_component(&i2c->dev, &ssm4567_component_driver,
			&ssm4567_dai, 1);
}

static int ssm4567_i2c_remove(struct i2c_client *client)
{
	snd_soc_unregister_codec(&client->dev);
	return 0;
}

static const struct i2c_device_id ssm4567_i2c_ids[] = {
	{ "ssm4567", 0 },
	{ }
@@ -510,7 +503,6 @@ static struct i2c_driver ssm4567_driver = {
		.acpi_match_table = ACPI_PTR(ssm4567_acpi_match),
	},
	.probe = ssm4567_i2c_probe,
	.remove = ssm4567_i2c_remove,
	.id_table = ssm4567_i2c_ids,
};
module_i2c_driver(ssm4567_driver);
Loading