Unverified Commit b34a068c authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: remaining i2c_match_id i2c probe changes

Merge series from Stephen Kitt <steve@sk2.org>:

This series covers all the remaining changes to migrate
sound/soc/codecs i2c probes to probe_new, where the const struct
i2c_client * argument is still used. Instead of relying on the
parameter passed in, i2c_match_id is used instead.

With this set of patches, all the sound/soc/codecs i2c probes use the
new probe definition.

Changes since v1: two missing files were added.

Stephen Kitt (7):
  ASoC: ak*: use i2c_match_id and simple i2c probe
  ASoC: alc56*: use i2c_match_id and simple i2c probe
  ASoC: max980*: use i2c_match_id and simple i2c probe
  ASoC: pcm186x: use i2c_match_id and simple i2c probe
  ASoC: tas*: use i2c_match_id and simple i2c probe
  ASoC: tlv320*: use i2c_match_id and simple i2c probe
  ASoC: tpa6130: use i2c_match_id and simple i2c probe

 sound/soc/codecs/ak4613.c            | 10 +++++----
 sound/soc/codecs/ak4642.c            |  8 ++++---
 sound/soc/codecs/alc5623.c           | 24 +++++++++++----------
 sound/soc/codecs/alc5632.c           | 20 +++++++++--------
 sound/soc/codecs/max98088.c          | 21 +++++++++---------
 sound/soc/codecs/max98090.c          | 23 ++++++++++----------
 sound/soc/codecs/max98095.c          | 19 +++++++++--------
 sound/soc/codecs/pcm186x-i2c.c       | 24 ++++++++++-----------
 sound/soc/codecs/tas2562.c           | 25 +++++++++++-----------
 sound/soc/codecs/tas571x.c           | 11 ++++++----
 sound/soc/codecs/tas5720.c           | 21 +++++++++---------
 sound/soc/codecs/tlv320adc3xxx.c     | 21 +++++++++---------
 sound/soc/codecs/tlv320aic31xx.c     | 32 ++++++++++++++--------------
 sound/soc/codecs/tlv320aic32x4-i2c.c | 11 ++++++----
 sound/soc/codecs/tlv320aic3x-i2c.c   | 25 +++++++++++-----------
 sound/soc/codecs/tpa6130a2.c         | 19 +++++++++--------
 16 files changed, 168 insertions(+), 146 deletions(-)

base-commit: 5d763a740e5b24e4a2ca04317255e7e941876338
--
2.27.0
parents 85780eb5 988e6870
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -876,8 +876,7 @@ static void ak4613_parse_of(struct ak4613_priv *priv,
	AK4613_CONFIG_SDTI_set(priv, sdti_num);
}

static int ak4613_i2c_probe(struct i2c_client *i2c,
			    const struct i2c_device_id *id)
static int ak4613_i2c_probe(struct i2c_client *i2c)
{
	struct device *dev = &i2c->dev;
	struct device_node *np = dev->of_node;
@@ -888,8 +887,11 @@ static int ak4613_i2c_probe(struct i2c_client *i2c,
	regmap_cfg = NULL;
	if (np)
		regmap_cfg = of_device_get_match_data(dev);
	else
	else {
		const struct i2c_device_id *id =
			i2c_match_id(ak4613_i2c_id, i2c);
		regmap_cfg = (const struct regmap_config *)id->driver_data;
	}

	if (!regmap_cfg)
		return -EINVAL;
@@ -927,7 +929,7 @@ static struct i2c_driver ak4613_i2c_driver = {
		.name = "ak4613-codec",
		.of_match_table = ak4613_of_match,
	},
	.probe		= ak4613_i2c_probe,
	.probe_new	= ak4613_i2c_probe,
	.remove		= ak4613_i2c_remove,
	.id_table	= ak4613_i2c_id,
};
+5 −3
Original line number Diff line number Diff line
@@ -630,8 +630,8 @@ static struct clk *ak4642_of_parse_mcko(struct device *dev)
#endif

static const struct of_device_id ak4642_of_match[];
static int ak4642_i2c_probe(struct i2c_client *i2c,
			    const struct i2c_device_id *id)
static const struct i2c_device_id ak4642_i2c_id[];
static int ak4642_i2c_probe(struct i2c_client *i2c)
{
	struct device *dev = &i2c->dev;
	struct device_node *np = dev->of_node;
@@ -651,6 +651,8 @@ static int ak4642_i2c_probe(struct i2c_client *i2c,
		if (of_id)
			drvdata = of_id->data;
	} else {
		const struct i2c_device_id *id =
			i2c_match_id(ak4642_i2c_id, i2c);
		drvdata = (const struct ak4642_drvdata *)id->driver_data;
	}

@@ -697,7 +699,7 @@ static struct i2c_driver ak4642_i2c_driver = {
		.name = "ak4642-codec",
		.of_match_table = ak4642_of_match,
	},
	.probe		= ak4642_i2c_probe,
	.probe_new	= ak4642_i2c_probe,
	.id_table	= ak4642_i2c_id,
};

+13 −11
Original line number Diff line number Diff line
@@ -968,14 +968,21 @@ static const struct regmap_config alc5623_regmap = {
	.cache_type = REGCACHE_RBTREE,
};

static const struct i2c_device_id alc5623_i2c_table[] = {
	{"alc5621", 0x21},
	{"alc5622", 0x22},
	{"alc5623", 0x23},
	{}
};
MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table);

/*
 * ALC5623 2 wire address is determined by A1 pin
 * state during powerup.
 *    low  = 0x1a
 *    high = 0x1b
 */
static int alc5623_i2c_probe(struct i2c_client *client,
			     const struct i2c_device_id *id)
static int alc5623_i2c_probe(struct i2c_client *client)
{
	struct alc5623_platform_data *pdata;
	struct alc5623_priv *alc5623;
@@ -983,6 +990,7 @@ static int alc5623_i2c_probe(struct i2c_client *client,
	unsigned int vid1, vid2;
	int ret;
	u32 val32;
	const struct i2c_device_id *id;

	alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv),
			       GFP_KERNEL);
@@ -1009,6 +1017,8 @@ static int alc5623_i2c_probe(struct i2c_client *client,
	}
	vid2 >>= 8;

	id = i2c_match_id(alc5623_i2c_table, client);

	if ((vid1 != 0x10ec) || (vid2 != id->driver_data)) {
		dev_err(&client->dev, "unknown or wrong codec\n");
		dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n",
@@ -1060,14 +1070,6 @@ static int alc5623_i2c_probe(struct i2c_client *client,
	return ret;
}

static const struct i2c_device_id alc5623_i2c_table[] = {
	{"alc5621", 0x21},
	{"alc5622", 0x22},
	{"alc5623", 0x23},
	{}
};
MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table);

#ifdef CONFIG_OF
static const struct of_device_id alc5623_of_match[] = {
	{ .compatible = "realtek,alc5623", },
@@ -1082,7 +1084,7 @@ static struct i2c_driver alc5623_i2c_driver = {
		.name = "alc562x-codec",
		.of_match_table = of_match_ptr(alc5623_of_match),
	},
	.probe = alc5623_i2c_probe,
	.probe_new = alc5623_i2c_probe,
	.id_table = alc5623_i2c_table,
};

+11 −9
Original line number Diff line number Diff line
@@ -1092,18 +1092,24 @@ static const struct regmap_config alc5632_regmap = {
	.cache_type = REGCACHE_RBTREE,
};

static const struct i2c_device_id alc5632_i2c_table[] = {
	{"alc5632", 0x5c},
	{}
};
MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);

/*
 * alc5632 2 wire address is determined by A1 pin
 * state during powerup.
 *    low  = 0x1a
 *    high = 0x1b
 */
static int alc5632_i2c_probe(struct i2c_client *client,
			     const struct i2c_device_id *id)
static int alc5632_i2c_probe(struct i2c_client *client)
{
	struct alc5632_priv *alc5632;
	int ret, ret1, ret2;
	unsigned int vid1, vid2;
	const struct i2c_device_id *id;

	alc5632 = devm_kzalloc(&client->dev,
			 sizeof(struct alc5632_priv), GFP_KERNEL);
@@ -1129,6 +1135,8 @@ static int alc5632_i2c_probe(struct i2c_client *client,

	vid2 >>= 8;

	id = i2c_match_id(alc5632_i2c_table, client);

	if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) {
		dev_err(&client->dev,
		"Device is not a ALC5632: VID1=0x%x, VID2=0x%x\n", vid1, vid2);
@@ -1161,12 +1169,6 @@ static int alc5632_i2c_probe(struct i2c_client *client,
	return ret;
}

static const struct i2c_device_id alc5632_i2c_table[] = {
	{"alc5632", 0x5c},
	{}
};
MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);

#ifdef CONFIG_OF
static const struct of_device_id alc5632_of_match[] = {
	{ .compatible = "realtek,alc5632", },
@@ -1181,7 +1183,7 @@ static struct i2c_driver alc5632_i2c_driver = {
		.name = "alc5632",
		.of_match_table = of_match_ptr(alc5632_of_match),
	},
	.probe = alc5632_i2c_probe,
	.probe_new = alc5632_i2c_probe,
	.id_table = alc5632_i2c_table,
};

+11 −10
Original line number Diff line number Diff line
@@ -1737,11 +1737,18 @@ static const struct snd_soc_component_driver soc_component_dev_max98088 = {
	.non_legacy_dai_naming	= 1,
};

static int max98088_i2c_probe(struct i2c_client *i2c,
			      const struct i2c_device_id *id)
static const struct i2c_device_id max98088_i2c_id[] = {
       { "max98088", MAX98088 },
       { "max98089", MAX98089 },
       { }
};
MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);

static int max98088_i2c_probe(struct i2c_client *i2c)
{
       struct max98088_priv *max98088;
       int ret;
       const struct i2c_device_id *id;

       max98088 = devm_kzalloc(&i2c->dev, sizeof(struct max98088_priv),
			       GFP_KERNEL);
@@ -1757,6 +1764,7 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
		if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER)
			return PTR_ERR(max98088->mclk);

	id = i2c_match_id(max98088_i2c_id, i2c);
       max98088->devtype = id->driver_data;

       i2c_set_clientdata(i2c, max98088);
@@ -1767,13 +1775,6 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
       return ret;
}

static const struct i2c_device_id max98088_i2c_id[] = {
       { "max98088", MAX98088 },
       { "max98089", MAX98089 },
       { }
};
MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);

#if defined(CONFIG_OF)
static const struct of_device_id max98088_of_match[] = {
	{ .compatible = "maxim,max98088" },
@@ -1788,7 +1789,7 @@ static struct i2c_driver max98088_i2c_driver = {
		.name = "max98088",
		.of_match_table = of_match_ptr(max98088_of_match),
	},
	.probe  = max98088_i2c_probe,
	.probe_new = max98088_i2c_probe,
	.id_table = max98088_i2c_id,
};

Loading