Skip to content

Commit b34a068

Browse files
committed
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: 5d763a7 -- 2.27.0
2 parents 85780eb + 988e687 commit b34a068

15 files changed

Lines changed: 158 additions & 137 deletions

sound/soc/codecs/ak4613.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,7 @@ static void ak4613_parse_of(struct ak4613_priv *priv,
876876
AK4613_CONFIG_SDTI_set(priv, sdti_num);
877877
}
878878

879-
static int ak4613_i2c_probe(struct i2c_client *i2c,
880-
const struct i2c_device_id *id)
879+
static int ak4613_i2c_probe(struct i2c_client *i2c)
881880
{
882881
struct device *dev = &i2c->dev;
883882
struct device_node *np = dev->of_node;
@@ -888,8 +887,11 @@ static int ak4613_i2c_probe(struct i2c_client *i2c,
888887
regmap_cfg = NULL;
889888
if (np)
890889
regmap_cfg = of_device_get_match_data(dev);
891-
else
890+
else {
891+
const struct i2c_device_id *id =
892+
i2c_match_id(ak4613_i2c_id, i2c);
892893
regmap_cfg = (const struct regmap_config *)id->driver_data;
894+
}
893895

894896
if (!regmap_cfg)
895897
return -EINVAL;
@@ -927,7 +929,7 @@ static struct i2c_driver ak4613_i2c_driver = {
927929
.name = "ak4613-codec",
928930
.of_match_table = ak4613_of_match,
929931
},
930-
.probe = ak4613_i2c_probe,
932+
.probe_new = ak4613_i2c_probe,
931933
.remove = ak4613_i2c_remove,
932934
.id_table = ak4613_i2c_id,
933935
};

sound/soc/codecs/ak4642.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ static struct clk *ak4642_of_parse_mcko(struct device *dev)
630630
#endif
631631

632632
static const struct of_device_id ak4642_of_match[];
633-
static int ak4642_i2c_probe(struct i2c_client *i2c,
634-
const struct i2c_device_id *id)
633+
static const struct i2c_device_id ak4642_i2c_id[];
634+
static int ak4642_i2c_probe(struct i2c_client *i2c)
635635
{
636636
struct device *dev = &i2c->dev;
637637
struct device_node *np = dev->of_node;
@@ -651,6 +651,8 @@ static int ak4642_i2c_probe(struct i2c_client *i2c,
651651
if (of_id)
652652
drvdata = of_id->data;
653653
} else {
654+
const struct i2c_device_id *id =
655+
i2c_match_id(ak4642_i2c_id, i2c);
654656
drvdata = (const struct ak4642_drvdata *)id->driver_data;
655657
}
656658

@@ -697,7 +699,7 @@ static struct i2c_driver ak4642_i2c_driver = {
697699
.name = "ak4642-codec",
698700
.of_match_table = ak4642_of_match,
699701
},
700-
.probe = ak4642_i2c_probe,
702+
.probe_new = ak4642_i2c_probe,
701703
.id_table = ak4642_i2c_id,
702704
};
703705

sound/soc/codecs/alc5623.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -968,21 +968,29 @@ static const struct regmap_config alc5623_regmap = {
968968
.cache_type = REGCACHE_RBTREE,
969969
};
970970

971+
static const struct i2c_device_id alc5623_i2c_table[] = {
972+
{"alc5621", 0x21},
973+
{"alc5622", 0x22},
974+
{"alc5623", 0x23},
975+
{}
976+
};
977+
MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table);
978+
971979
/*
972980
* ALC5623 2 wire address is determined by A1 pin
973981
* state during powerup.
974982
* low = 0x1a
975983
* high = 0x1b
976984
*/
977-
static int alc5623_i2c_probe(struct i2c_client *client,
978-
const struct i2c_device_id *id)
985+
static int alc5623_i2c_probe(struct i2c_client *client)
979986
{
980987
struct alc5623_platform_data *pdata;
981988
struct alc5623_priv *alc5623;
982989
struct device_node *np;
983990
unsigned int vid1, vid2;
984991
int ret;
985992
u32 val32;
993+
const struct i2c_device_id *id;
986994

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

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

1063-
static const struct i2c_device_id alc5623_i2c_table[] = {
1064-
{"alc5621", 0x21},
1065-
{"alc5622", 0x22},
1066-
{"alc5623", 0x23},
1067-
{}
1068-
};
1069-
MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table);
1070-
10711073
#ifdef CONFIG_OF
10721074
static const struct of_device_id alc5623_of_match[] = {
10731075
{ .compatible = "realtek,alc5623", },
@@ -1082,7 +1084,7 @@ static struct i2c_driver alc5623_i2c_driver = {
10821084
.name = "alc562x-codec",
10831085
.of_match_table = of_match_ptr(alc5623_of_match),
10841086
},
1085-
.probe = alc5623_i2c_probe,
1087+
.probe_new = alc5623_i2c_probe,
10861088
.id_table = alc5623_i2c_table,
10871089
};
10881090

sound/soc/codecs/alc5632.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,18 +1092,24 @@ static const struct regmap_config alc5632_regmap = {
10921092
.cache_type = REGCACHE_RBTREE,
10931093
};
10941094

1095+
static const struct i2c_device_id alc5632_i2c_table[] = {
1096+
{"alc5632", 0x5c},
1097+
{}
1098+
};
1099+
MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
1100+
10951101
/*
10961102
* alc5632 2 wire address is determined by A1 pin
10971103
* state during powerup.
10981104
* low = 0x1a
10991105
* high = 0x1b
11001106
*/
1101-
static int alc5632_i2c_probe(struct i2c_client *client,
1102-
const struct i2c_device_id *id)
1107+
static int alc5632_i2c_probe(struct i2c_client *client)
11031108
{
11041109
struct alc5632_priv *alc5632;
11051110
int ret, ret1, ret2;
11061111
unsigned int vid1, vid2;
1112+
const struct i2c_device_id *id;
11071113

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

11301136
vid2 >>= 8;
11311137

1138+
id = i2c_match_id(alc5632_i2c_table, client);
1139+
11321140
if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) {
11331141
dev_err(&client->dev,
11341142
"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,
11611169
return ret;
11621170
}
11631171

1164-
static const struct i2c_device_id alc5632_i2c_table[] = {
1165-
{"alc5632", 0x5c},
1166-
{}
1167-
};
1168-
MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
1169-
11701172
#ifdef CONFIG_OF
11711173
static const struct of_device_id alc5632_of_match[] = {
11721174
{ .compatible = "realtek,alc5632", },
@@ -1181,7 +1183,7 @@ static struct i2c_driver alc5632_i2c_driver = {
11811183
.name = "alc5632",
11821184
.of_match_table = of_match_ptr(alc5632_of_match),
11831185
},
1184-
.probe = alc5632_i2c_probe,
1186+
.probe_new = alc5632_i2c_probe,
11851187
.id_table = alc5632_i2c_table,
11861188
};
11871189

sound/soc/codecs/max98088.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,11 +1737,18 @@ static const struct snd_soc_component_driver soc_component_dev_max98088 = {
17371737
.non_legacy_dai_naming = 1,
17381738
};
17391739

1740-
static int max98088_i2c_probe(struct i2c_client *i2c,
1741-
const struct i2c_device_id *id)
1740+
static const struct i2c_device_id max98088_i2c_id[] = {
1741+
{ "max98088", MAX98088 },
1742+
{ "max98089", MAX98089 },
1743+
{ }
1744+
};
1745+
MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
1746+
1747+
static int max98088_i2c_probe(struct i2c_client *i2c)
17421748
{
17431749
struct max98088_priv *max98088;
17441750
int ret;
1751+
const struct i2c_device_id *id;
17451752

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

1767+
id = i2c_match_id(max98088_i2c_id, i2c);
17601768
max98088->devtype = id->driver_data;
17611769

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

1770-
static const struct i2c_device_id max98088_i2c_id[] = {
1771-
{ "max98088", MAX98088 },
1772-
{ "max98089", MAX98089 },
1773-
{ }
1774-
};
1775-
MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
1776-
17771778
#if defined(CONFIG_OF)
17781779
static const struct of_device_id max98088_of_match[] = {
17791780
{ .compatible = "maxim,max98088" },
@@ -1788,7 +1789,7 @@ static struct i2c_driver max98088_i2c_driver = {
17881789
.name = "max98088",
17891790
.of_match_table = of_match_ptr(max98088_of_match),
17901791
},
1791-
.probe = max98088_i2c_probe,
1792+
.probe_new = max98088_i2c_probe,
17921793
.id_table = max98088_i2c_id,
17931794
};
17941795

sound/soc/codecs/max98090.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,8 +2529,14 @@ static const struct regmap_config max98090_regmap = {
25292529
.cache_type = REGCACHE_RBTREE,
25302530
};
25312531

2532-
static int max98090_i2c_probe(struct i2c_client *i2c,
2533-
const struct i2c_device_id *i2c_id)
2532+
static const struct i2c_device_id max98090_i2c_id[] = {
2533+
{ "max98090", MAX98090 },
2534+
{ "max98091", MAX98091 },
2535+
{ }
2536+
};
2537+
MODULE_DEVICE_TABLE(i2c, max98090_i2c_id);
2538+
2539+
static int max98090_i2c_probe(struct i2c_client *i2c)
25342540
{
25352541
struct max98090_priv *max98090;
25362542
const struct acpi_device_id *acpi_id;
@@ -2552,7 +2558,9 @@ static int max98090_i2c_probe(struct i2c_client *i2c,
25522558
return -EINVAL;
25532559
}
25542560
driver_data = acpi_id->driver_data;
2555-
} else if (i2c_id) {
2561+
} else {
2562+
const struct i2c_device_id *i2c_id =
2563+
i2c_match_id(max98090_i2c_id, i2c);
25562564
driver_data = i2c_id->driver_data;
25572565
}
25582566

@@ -2659,13 +2667,6 @@ static const struct dev_pm_ops max98090_pm = {
26592667
SET_SYSTEM_SLEEP_PM_OPS(NULL, max98090_resume)
26602668
};
26612669

2662-
static const struct i2c_device_id max98090_i2c_id[] = {
2663-
{ "max98090", MAX98090 },
2664-
{ "max98091", MAX98091 },
2665-
{ }
2666-
};
2667-
MODULE_DEVICE_TABLE(i2c, max98090_i2c_id);
2668-
26692670
#ifdef CONFIG_OF
26702671
static const struct of_device_id max98090_of_match[] = {
26712672
{ .compatible = "maxim,max98090", },
@@ -2690,7 +2691,7 @@ static struct i2c_driver max98090_i2c_driver = {
26902691
.of_match_table = of_match_ptr(max98090_of_match),
26912692
.acpi_match_table = ACPI_PTR(max98090_acpi_match),
26922693
},
2693-
.probe = max98090_i2c_probe,
2694+
.probe_new = max98090_i2c_probe,
26942695
.shutdown = max98090_i2c_shutdown,
26952696
.remove = max98090_i2c_remove,
26962697
.id_table = max98090_i2c_id,

sound/soc/codecs/max98095.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,11 +2106,17 @@ static const struct snd_soc_component_driver soc_component_dev_max98095 = {
21062106
.non_legacy_dai_naming = 1,
21072107
};
21082108

2109-
static int max98095_i2c_probe(struct i2c_client *i2c,
2110-
const struct i2c_device_id *id)
2109+
static const struct i2c_device_id max98095_i2c_id[] = {
2110+
{ "max98095", MAX98095 },
2111+
{ }
2112+
};
2113+
MODULE_DEVICE_TABLE(i2c, max98095_i2c_id);
2114+
2115+
static int max98095_i2c_probe(struct i2c_client *i2c)
21112116
{
21122117
struct max98095_priv *max98095;
21132118
int ret;
2119+
const struct i2c_device_id *id;
21142120

21152121
max98095 = devm_kzalloc(&i2c->dev, sizeof(struct max98095_priv),
21162122
GFP_KERNEL);
@@ -2126,6 +2132,7 @@ static int max98095_i2c_probe(struct i2c_client *i2c,
21262132
return ret;
21272133
}
21282134

2135+
id = i2c_match_id(max98095_i2c_id, i2c);
21292136
max98095->devtype = id->driver_data;
21302137
i2c_set_clientdata(i2c, max98095);
21312138
max98095->pdata = i2c->dev.platform_data;
@@ -2136,12 +2143,6 @@ static int max98095_i2c_probe(struct i2c_client *i2c,
21362143
return ret;
21372144
}
21382145

2139-
static const struct i2c_device_id max98095_i2c_id[] = {
2140-
{ "max98095", MAX98095 },
2141-
{ }
2142-
};
2143-
MODULE_DEVICE_TABLE(i2c, max98095_i2c_id);
2144-
21452146
#ifdef CONFIG_OF
21462147
static const struct of_device_id max98095_of_match[] = {
21472148
{ .compatible = "maxim,max98095", },
@@ -2155,7 +2156,7 @@ static struct i2c_driver max98095_i2c_driver = {
21552156
.name = "max98095",
21562157
.of_match_table = of_match_ptr(max98095_of_match),
21572158
},
2158-
.probe = max98095_i2c_probe,
2159+
.probe_new = max98095_i2c_probe,
21592160
.id_table = max98095_i2c_id,
21602161
};
21612162

sound/soc/codecs/pcm186x-i2c.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ static const struct of_device_id pcm186x_of_match[] = {
2222
};
2323
MODULE_DEVICE_TABLE(of, pcm186x_of_match);
2424

25-
static int pcm186x_i2c_probe(struct i2c_client *i2c,
26-
const struct i2c_device_id *id)
25+
static const struct i2c_device_id pcm186x_i2c_id[] = {
26+
{ "pcm1862", PCM1862 },
27+
{ "pcm1863", PCM1863 },
28+
{ "pcm1864", PCM1864 },
29+
{ "pcm1865", PCM1865 },
30+
{ }
31+
};
32+
MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id);
33+
34+
static int pcm186x_i2c_probe(struct i2c_client *i2c)
2735
{
36+
const struct i2c_device_id *id = i2c_match_id(pcm186x_i2c_id, i2c);
2837
const enum pcm186x_type type = (enum pcm186x_type)id->driver_data;
2938
int irq = i2c->irq;
3039
struct regmap *regmap;
@@ -36,17 +45,8 @@ static int pcm186x_i2c_probe(struct i2c_client *i2c,
3645
return pcm186x_probe(&i2c->dev, type, irq, regmap);
3746
}
3847

39-
static const struct i2c_device_id pcm186x_i2c_id[] = {
40-
{ "pcm1862", PCM1862 },
41-
{ "pcm1863", PCM1863 },
42-
{ "pcm1864", PCM1864 },
43-
{ "pcm1865", PCM1865 },
44-
{ }
45-
};
46-
MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id);
47-
4848
static struct i2c_driver pcm186x_i2c_driver = {
49-
.probe = pcm186x_i2c_probe,
49+
.probe_new = pcm186x_i2c_probe,
5050
.id_table = pcm186x_i2c_id,
5151
.driver = {
5252
.name = "pcm186x",

0 commit comments

Comments
 (0)