1 // SPDX-License-Identifier: GPL-2.0-only
3 * tas2552.c - ALSA SoC Texas Instruments TAS2552 Mono Audio Amplifier
5 * Copyright (C) 2014 - 2024 Texas Instruments Incorporated -
11 #include <linux/module.h>
12 #include <linux/errno.h>
13 #include <linux/device.h>
14 #include <linux/i2c.h>
15 #include <linux/pm_runtime.h>
16 #include <linux/regmap.h>
17 #include <linux/slab.h>
19 #include <linux/gpio/consumer.h>
20 #include <linux/regulator/consumer.h>
22 #include <sound/pcm.h>
23 #include <sound/pcm_params.h>
24 #include <sound/soc.h>
25 #include <sound/soc-dapm.h>
26 #include <sound/tlv.h>
27 #include <sound/tas2552-plat.h>
28 #include <dt-bindings/sound/tas2552.h>
32 static const struct reg_default tas2552_reg_defs[] = {
33 {TAS2552_CFG_1, 0x22},
34 {TAS2552_CFG_3, 0x80},
36 {TAS2552_OUTPUT_DATA, 0xc0},
37 {TAS2552_PDM_CFG, 0x01},
38 {TAS2552_PGA_GAIN, 0x00},
39 {TAS2552_BOOST_APT_CTRL, 0x0f},
40 {TAS2552_RESERVED_0D, 0xbe},
41 {TAS2552_LIMIT_RATE_HYS, 0x08},
42 {TAS2552_CFG_2, 0xef},
43 {TAS2552_SER_CTRL_1, 0x00},
44 {TAS2552_SER_CTRL_2, 0x00},
45 {TAS2552_PLL_CTRL_1, 0x10},
46 {TAS2552_PLL_CTRL_2, 0x00},
47 {TAS2552_PLL_CTRL_3, 0x00},
49 {TAS2552_BTS_CTRL, 0x80},
50 {TAS2552_LIMIT_RELEASE, 0x04},
51 {TAS2552_LIMIT_INT_COUNT, 0x00},
52 {TAS2552_EDGE_RATE_CTRL, 0x40},
53 {TAS2552_VBAT_DATA, 0x00},
56 #define TAS2552_NUM_SUPPLIES 3
57 static const char *tas2552_supply_names[TAS2552_NUM_SUPPLIES] = {
58 "vbat", /* vbat voltage */
59 "iovdd", /* I/O Voltage */
60 "avdd", /* Analog DAC Voltage */
64 struct snd_soc_component *component;
65 struct regmap *regmap;
66 struct i2c_client *tas2552_client;
67 struct regulator_bulk_data supplies[TAS2552_NUM_SUPPLIES];
68 struct gpio_desc *enable_gpio;
69 unsigned char regs[TAS2552_VBAT_DATA];
70 unsigned int pll_clkin;
76 unsigned int tdm_delay;
79 static int tas2552_post_event(struct snd_soc_dapm_widget *w,
80 struct snd_kcontrol *kcontrol, int event)
82 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
85 case SND_SOC_DAPM_POST_PMU:
86 snd_soc_component_write(component, TAS2552_RESERVED_0D, 0xc0);
87 snd_soc_component_update_bits(component, TAS2552_LIMIT_RATE_HYS, (1 << 5),
89 snd_soc_component_update_bits(component, TAS2552_CFG_2, 1, 0);
90 snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_SWS, 0);
92 case SND_SOC_DAPM_POST_PMD:
93 snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_SWS,
95 snd_soc_component_update_bits(component, TAS2552_CFG_2, 1, 1);
96 snd_soc_component_update_bits(component, TAS2552_LIMIT_RATE_HYS, (1 << 5), 0);
97 snd_soc_component_write(component, TAS2552_RESERVED_0D, 0xbe);
103 /* Input mux controls */
104 static const char * const tas2552_input_texts[] = {
105 "Digital", "Analog" };
106 static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
107 tas2552_input_texts);
109 static const struct snd_kcontrol_new tas2552_input_mux_control =
110 SOC_DAPM_ENUM("Route", tas2552_input_mux_enum);
112 static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
114 SND_SOC_DAPM_INPUT("IN"),
117 SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
118 &tas2552_input_mux_control),
120 SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
121 SND_SOC_DAPM_AIF_OUT("ASI OUT", "DAC Capture", 0, SND_SOC_NOPM, 0, 0),
122 SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
123 SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
124 SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
125 SND_SOC_DAPM_POST("Post Event", tas2552_post_event),
127 SND_SOC_DAPM_OUTPUT("OUT"),
128 SND_SOC_DAPM_INPUT("DMIC")
131 static const struct snd_soc_dapm_route tas2552_audio_map[] = {
132 {"DAC", NULL, "DAC IN"},
133 {"Input selection", "Digital", "DAC"},
134 {"Input selection", "Analog", "IN"},
135 {"ClassD", NULL, "Input selection"},
136 {"OUT", NULL, "ClassD"},
137 {"ClassD", NULL, "PLL"},
138 {"ASI OUT", NULL, "DMIC"}
142 static void tas2552_sw_shutdown(struct tas2552_data *tas2552, int sw_shutdown)
146 if (!tas2552->component)
150 cfg1_reg = TAS2552_SWS;
152 snd_soc_component_update_bits(tas2552->component, TAS2552_CFG_1, TAS2552_SWS,
157 static int tas2552_setup_pll(struct snd_soc_component *component,
158 struct snd_pcm_hw_params *params)
160 struct tas2552_data *tas2552 = dev_get_drvdata(component->dev);
161 bool bypass_pll = false;
162 unsigned int pll_clk = params_rate(params) * 512;
163 unsigned int pll_clkin = tas2552->pll_clkin;
167 if (tas2552->pll_clk_id != TAS2552_PLL_CLKIN_BCLK)
170 pll_clkin = snd_soc_params_to_bclk(params);
171 pll_clkin += tas2552->tdm_delay;
174 pll_enable = snd_soc_component_read(component, TAS2552_CFG_2) & TAS2552_PLL_ENABLE;
175 snd_soc_component_update_bits(component, TAS2552_CFG_2, TAS2552_PLL_ENABLE, 0);
177 if (pll_clkin == pll_clk)
181 /* By pass the PLL configuration */
182 snd_soc_component_update_bits(component, TAS2552_PLL_CTRL_2,
183 TAS2552_PLL_BYPASS, TAS2552_PLL_BYPASS);
185 /* Fill in the PLL control registers for J & D
186 * pll_clk = (.5 * pll_clkin * J.D) / 2^p
187 * Need to fill in J and D here based on incoming freq
189 unsigned int d, q, t;
191 u8 pll_sel = (tas2552->pll_clk_id << 3) & TAS2552_PLL_SRC_MASK;
192 u8 p = snd_soc_component_read(component, TAS2552_PLL_CTRL_1);
197 t = (pll_clk * 2) << p;
200 t = pll_clkin / 10000;
202 d = q + ((9999 - pll_clkin % 10000) * (d / t - q)) / 10000;
204 if (d && (pll_clkin < 512000 || pll_clkin > 9200000)) {
205 if (tas2552->pll_clk_id == TAS2552_PLL_CLKIN_BCLK) {
207 pll_sel = (TAS2552_PLL_CLKIN_1_8_FIXED << 3) &
208 TAS2552_PLL_SRC_MASK;
210 pll_clkin = snd_soc_params_to_bclk(params);
211 pll_clkin += tas2552->tdm_delay;
212 pll_sel = (TAS2552_PLL_CLKIN_BCLK << 3) &
213 TAS2552_PLL_SRC_MASK;
218 snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_PLL_SRC_MASK,
221 snd_soc_component_update_bits(component, TAS2552_PLL_CTRL_1,
222 TAS2552_PLL_J_MASK, j);
223 /* Will clear the PLL_BYPASS bit */
224 snd_soc_component_write(component, TAS2552_PLL_CTRL_2,
225 TAS2552_PLL_D_UPPER(d));
226 snd_soc_component_write(component, TAS2552_PLL_CTRL_3,
227 TAS2552_PLL_D_LOWER(d));
230 /* Restore PLL status */
231 snd_soc_component_update_bits(component, TAS2552_CFG_2, TAS2552_PLL_ENABLE,
237 static int tas2552_hw_params(struct snd_pcm_substream *substream,
238 struct snd_pcm_hw_params *params,
239 struct snd_soc_dai *dai)
241 struct snd_soc_component *component = dai->component;
242 struct tas2552_data *tas2552 = dev_get_drvdata(component->dev);
244 u8 ser_ctrl1_reg, wclk_rate;
246 switch (params_width(params)) {
248 ser_ctrl1_reg = TAS2552_WORDLENGTH_16BIT;
249 cpf = 32 + tas2552->tdm_delay;
252 ser_ctrl1_reg = TAS2552_WORDLENGTH_20BIT;
253 cpf = 64 + tas2552->tdm_delay;
256 ser_ctrl1_reg = TAS2552_WORDLENGTH_24BIT;
257 cpf = 64 + tas2552->tdm_delay;
260 ser_ctrl1_reg = TAS2552_WORDLENGTH_32BIT;
261 cpf = 64 + tas2552->tdm_delay;
264 dev_err(component->dev, "Not supported sample size: %d\n",
265 params_width(params));
270 ser_ctrl1_reg |= TAS2552_CLKSPERFRAME_32;
272 ser_ctrl1_reg |= TAS2552_CLKSPERFRAME_64;
274 ser_ctrl1_reg |= TAS2552_CLKSPERFRAME_128;
276 ser_ctrl1_reg |= TAS2552_CLKSPERFRAME_256;
278 snd_soc_component_update_bits(component, TAS2552_SER_CTRL_1,
279 TAS2552_WORDLENGTH_MASK | TAS2552_CLKSPERFRAME_MASK,
282 switch (params_rate(params)) {
284 wclk_rate = TAS2552_WCLK_FREQ_8KHZ;
288 wclk_rate = TAS2552_WCLK_FREQ_11_12KHZ;
291 wclk_rate = TAS2552_WCLK_FREQ_16KHZ;
295 wclk_rate = TAS2552_WCLK_FREQ_22_24KHZ;
298 wclk_rate = TAS2552_WCLK_FREQ_32KHZ;
302 wclk_rate = TAS2552_WCLK_FREQ_44_48KHZ;
306 wclk_rate = TAS2552_WCLK_FREQ_88_96KHZ;
310 wclk_rate = TAS2552_WCLK_FREQ_176_192KHZ;
313 dev_err(component->dev, "Not supported sample rate: %d\n",
314 params_rate(params));
318 snd_soc_component_update_bits(component, TAS2552_CFG_3, TAS2552_WCLK_FREQ_MASK,
321 return tas2552_setup_pll(component, params);
324 #define TAS2552_DAI_FMT_MASK (TAS2552_BCLKDIR | \
326 TAS2552_DATAFORMAT_MASK)
327 static int tas2552_prepare(struct snd_pcm_substream *substream,
328 struct snd_soc_dai *dai)
330 struct snd_soc_component *component = dai->component;
331 struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);
334 /* TDM slot selection only valid in DSP_A/_B mode */
335 if (tas2552->dai_fmt == SND_SOC_DAIFMT_DSP_A)
336 delay += (tas2552->tdm_delay + 1);
337 else if (tas2552->dai_fmt == SND_SOC_DAIFMT_DSP_B)
338 delay += tas2552->tdm_delay;
340 /* Configure data delay */
341 snd_soc_component_write(component, TAS2552_SER_CTRL_2, delay);
346 static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
348 struct snd_soc_component *component = dai->component;
349 struct tas2552_data *tas2552 = dev_get_drvdata(component->dev);
352 switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
353 case SND_SOC_DAIFMT_CBC_CFC:
354 serial_format = 0x00;
356 case SND_SOC_DAIFMT_CBC_CFP:
357 serial_format = TAS2552_WCLKDIR;
359 case SND_SOC_DAIFMT_CBP_CFC:
360 serial_format = TAS2552_BCLKDIR;
362 case SND_SOC_DAIFMT_CBP_CFP:
363 serial_format = (TAS2552_BCLKDIR | TAS2552_WCLKDIR);
366 dev_vdbg(component->dev, "DAI Format master is not found\n");
370 switch (fmt & (SND_SOC_DAIFMT_FORMAT_MASK |
371 SND_SOC_DAIFMT_INV_MASK)) {
372 case (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF):
374 case (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF):
375 case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF):
376 serial_format |= TAS2552_DATAFORMAT_DSP;
378 case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF):
379 serial_format |= TAS2552_DATAFORMAT_RIGHT_J;
381 case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF):
382 serial_format |= TAS2552_DATAFORMAT_LEFT_J;
385 dev_vdbg(component->dev, "DAI Format is not found\n");
388 tas2552->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
390 snd_soc_component_update_bits(component, TAS2552_SER_CTRL_1, TAS2552_DAI_FMT_MASK,
395 static int tas2552_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
396 unsigned int freq, int dir)
398 struct snd_soc_component *component = dai->component;
399 struct tas2552_data *tas2552 = dev_get_drvdata(component->dev);
403 case TAS2552_PLL_CLKIN_MCLK:
404 case TAS2552_PLL_CLKIN_IVCLKIN:
405 if (freq < 512000 || freq > 24576000) {
406 /* out of range PLL_CLKIN, fall back to use BCLK */
407 dev_warn(component->dev, "Out of range PLL_CLKIN: %u\n",
409 clk_id = TAS2552_PLL_CLKIN_BCLK;
413 case TAS2552_PLL_CLKIN_BCLK:
414 case TAS2552_PLL_CLKIN_1_8_FIXED:
415 mask = TAS2552_PLL_SRC_MASK;
416 val = (clk_id << 3) & mask; /* bit 4:5 in the register */
418 tas2552->pll_clk_id = clk_id;
419 tas2552->pll_clkin = freq;
421 case TAS2552_PDM_CLK_PLL:
422 case TAS2552_PDM_CLK_IVCLKIN:
423 case TAS2552_PDM_CLK_BCLK:
424 case TAS2552_PDM_CLK_MCLK:
425 mask = TAS2552_PDM_CLK_SEL_MASK;
426 val = (clk_id >> 1) & mask; /* bit 0:1 in the register */
427 reg = TAS2552_PDM_CFG;
428 tas2552->pdm_clk_id = clk_id;
429 tas2552->pdm_clk = freq;
432 dev_err(component->dev, "Invalid clk id: %d\n", clk_id);
436 snd_soc_component_update_bits(component, reg, mask, val);
441 static int tas2552_set_dai_tdm_slot(struct snd_soc_dai *dai,
442 unsigned int tx_mask, unsigned int rx_mask,
443 int slots, int slot_width)
445 struct snd_soc_component *component = dai->component;
446 struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);
449 if (unlikely(!tx_mask)) {
450 dev_err(component->dev, "tx masks need to be non 0\n");
454 /* TDM based on DSP mode requires slots to be adjacent */
455 lsb = __ffs(tx_mask);
456 if ((lsb + 1) != __fls(tx_mask)) {
457 dev_err(component->dev, "Invalid mask, slots must be adjacent\n");
461 tas2552->tdm_delay = lsb * slot_width;
463 /* DOUT in high-impedance on inactive bit clocks */
464 snd_soc_component_update_bits(component, TAS2552_DOUT,
465 TAS2552_SDOUT_TRISTATE, TAS2552_SDOUT_TRISTATE);
470 static int tas2552_mute(struct snd_soc_dai *dai, int mute, int direction)
473 struct snd_soc_component *component = dai->component;
476 cfg1_reg |= TAS2552_MUTE;
478 snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_MUTE, cfg1_reg);
484 static int tas2552_runtime_suspend(struct device *dev)
486 struct tas2552_data *tas2552 = dev_get_drvdata(dev);
488 tas2552_sw_shutdown(tas2552, 1);
490 regcache_cache_only(tas2552->regmap, true);
491 regcache_mark_dirty(tas2552->regmap);
493 gpiod_set_value(tas2552->enable_gpio, 0);
498 static int tas2552_runtime_resume(struct device *dev)
500 struct tas2552_data *tas2552 = dev_get_drvdata(dev);
502 gpiod_set_value(tas2552->enable_gpio, 1);
504 tas2552_sw_shutdown(tas2552, 0);
506 regcache_cache_only(tas2552->regmap, false);
507 regcache_sync(tas2552->regmap);
513 static const struct dev_pm_ops tas2552_pm = {
514 SET_RUNTIME_PM_OPS(tas2552_runtime_suspend, tas2552_runtime_resume,
518 static const struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
519 .hw_params = tas2552_hw_params,
520 .prepare = tas2552_prepare,
521 .set_sysclk = tas2552_set_dai_sysclk,
522 .set_fmt = tas2552_set_dai_fmt,
523 .set_tdm_slot = tas2552_set_dai_tdm_slot,
524 .mute_stream = tas2552_mute,
525 .no_capture_mute = 1,
528 /* Formats supported by TAS2552 driver. */
529 #define TAS2552_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
530 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
532 /* TAS2552 dai structure. */
533 static struct snd_soc_dai_driver tas2552_dai[] = {
535 .name = "tas2552-amplifier",
537 .stream_name = "Playback",
540 .rates = SNDRV_PCM_RATE_8000_192000,
541 .formats = TAS2552_FORMATS,
544 .stream_name = "Capture",
547 .rates = SNDRV_PCM_RATE_8000_192000,
548 .formats = TAS2552_FORMATS,
550 .ops = &tas2552_speaker_dai_ops,
555 * DAC digital volumes. From -7 to 24 dB in 1 dB steps
557 static DECLARE_TLV_DB_SCALE(dac_tlv, -700, 100, 0);
559 static const char * const tas2552_din_source_select[] = {
563 "Left + Right average",
565 static SOC_ENUM_SINGLE_DECL(tas2552_din_source_enum,
567 tas2552_din_source_select);
569 static const struct snd_kcontrol_new tas2552_snd_controls[] = {
570 SOC_SINGLE_TLV("Speaker Driver Playback Volume",
571 TAS2552_PGA_GAIN, 0, 0x1f, 0, dac_tlv),
572 SOC_ENUM("DIN source", tas2552_din_source_enum),
575 static int tas2552_component_probe(struct snd_soc_component *component)
577 struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);
580 tas2552->component = component;
582 ret = regulator_bulk_enable(ARRAY_SIZE(tas2552->supplies),
586 dev_err(component->dev, "Failed to enable supplies: %d\n",
591 gpiod_set_value(tas2552->enable_gpio, 1);
593 ret = pm_runtime_resume_and_get(component->dev);
595 dev_err(component->dev, "Enabling device failed: %d\n",
600 snd_soc_component_update_bits(component, TAS2552_CFG_1, TAS2552_MUTE, TAS2552_MUTE);
601 snd_soc_component_write(component, TAS2552_CFG_3, TAS2552_I2S_OUT_SEL |
602 TAS2552_DIN_SRC_SEL_AVG_L_R);
603 snd_soc_component_write(component, TAS2552_OUTPUT_DATA,
604 TAS2552_PDM_DATA_SEL_V_I |
605 TAS2552_R_DATA_OUT(TAS2552_DATA_OUT_V_DATA));
606 snd_soc_component_write(component, TAS2552_BOOST_APT_CTRL, TAS2552_APT_DELAY_200 |
607 TAS2552_APT_THRESH_20_17);
609 snd_soc_component_write(component, TAS2552_CFG_2, TAS2552_BOOST_EN | TAS2552_APT_EN |
615 pm_runtime_put_noidle(component->dev);
616 gpiod_set_value(tas2552->enable_gpio, 0);
618 regulator_bulk_disable(ARRAY_SIZE(tas2552->supplies),
623 static void tas2552_component_remove(struct snd_soc_component *component)
625 struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);
627 pm_runtime_put(component->dev);
629 gpiod_set_value(tas2552->enable_gpio, 0);
633 static int tas2552_suspend(struct snd_soc_component *component)
635 struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);
638 ret = regulator_bulk_disable(ARRAY_SIZE(tas2552->supplies),
642 dev_err(component->dev, "Failed to disable supplies: %d\n",
647 static int tas2552_resume(struct snd_soc_component *component)
649 struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);
652 ret = regulator_bulk_enable(ARRAY_SIZE(tas2552->supplies),
656 dev_err(component->dev, "Failed to enable supplies: %d\n",
663 #define tas2552_suspend NULL
664 #define tas2552_resume NULL
667 static const struct snd_soc_component_driver soc_component_dev_tas2552 = {
668 .probe = tas2552_component_probe,
669 .remove = tas2552_component_remove,
670 .suspend = tas2552_suspend,
671 .resume = tas2552_resume,
672 .controls = tas2552_snd_controls,
673 .num_controls = ARRAY_SIZE(tas2552_snd_controls),
674 .dapm_widgets = tas2552_dapm_widgets,
675 .num_dapm_widgets = ARRAY_SIZE(tas2552_dapm_widgets),
676 .dapm_routes = tas2552_audio_map,
677 .num_dapm_routes = ARRAY_SIZE(tas2552_audio_map),
682 static const struct regmap_config tas2552_regmap_config = {
686 .max_register = TAS2552_MAX_REG,
687 .reg_defaults = tas2552_reg_defs,
688 .num_reg_defaults = ARRAY_SIZE(tas2552_reg_defs),
689 .cache_type = REGCACHE_RBTREE,
692 static int tas2552_probe(struct i2c_client *client)
695 struct tas2552_data *data;
700 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
704 data->enable_gpio = devm_gpiod_get_optional(dev, "enable",
706 if (IS_ERR(data->enable_gpio))
707 return PTR_ERR(data->enable_gpio);
709 data->tas2552_client = client;
710 data->regmap = devm_regmap_init_i2c(client, &tas2552_regmap_config);
711 if (IS_ERR(data->regmap)) {
712 ret = PTR_ERR(data->regmap);
713 dev_err(&client->dev, "Failed to allocate register map: %d\n",
718 for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
719 data->supplies[i].supply = tas2552_supply_names[i];
721 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->supplies),
724 dev_err(dev, "Failed to request supplies: %d\n", ret);
728 pm_runtime_set_active(&client->dev);
729 pm_runtime_set_autosuspend_delay(&client->dev, 1000);
730 pm_runtime_use_autosuspend(&client->dev);
731 pm_runtime_enable(&client->dev);
732 pm_runtime_mark_last_busy(&client->dev);
733 pm_runtime_put_sync_autosuspend(&client->dev);
735 dev_set_drvdata(&client->dev, data);
737 ret = devm_snd_soc_register_component(&client->dev,
738 &soc_component_dev_tas2552,
739 tas2552_dai, ARRAY_SIZE(tas2552_dai));
741 dev_err(&client->dev, "Failed to register component: %d\n", ret);
742 pm_runtime_get_noresume(&client->dev);
748 static void tas2552_i2c_remove(struct i2c_client *client)
750 pm_runtime_disable(&client->dev);
753 static const struct i2c_device_id tas2552_id[] = {
757 MODULE_DEVICE_TABLE(i2c, tas2552_id);
759 #if IS_ENABLED(CONFIG_OF)
760 static const struct of_device_id tas2552_of_match[] = {
761 { .compatible = "ti,tas2552", },
764 MODULE_DEVICE_TABLE(of, tas2552_of_match);
767 static struct i2c_driver tas2552_i2c_driver = {
770 .of_match_table = of_match_ptr(tas2552_of_match),
773 .probe = tas2552_probe,
774 .remove = tas2552_i2c_remove,
775 .id_table = tas2552_id,
778 module_i2c_driver(tas2552_i2c_driver);
781 MODULE_DESCRIPTION("TAS2552 Audio amplifier driver");
782 MODULE_LICENSE("GPL");