1 // SPDX-License-Identifier: GPL-2.0
3 // ALSA SoC Texas Instruments TAS2770 20-W Digital Input Mono Class-D
4 // Audio Amplifier with Speaker I/V Sense
6 // Copyright (C) 2016-2017 Texas Instruments Incorporated - https://www.ti.com/
7 // Author: Tracy Yi <tracy-yi@ti.com>
8 // Frank Shi <shifu0704@thundersoft.com>
10 #include <linux/module.h>
11 #include <linux/moduleparam.h>
12 #include <linux/err.h>
13 #include <linux/init.h>
14 #include <linux/delay.h>
16 #include <linux/i2c.h>
17 #include <linux/gpio.h>
18 #include <linux/gpio/consumer.h>
19 #include <linux/regulator/consumer.h>
20 #include <linux/firmware.h>
21 #include <linux/regmap.h>
23 #include <linux/of_gpio.h>
24 #include <linux/slab.h>
25 #include <sound/soc.h>
26 #include <sound/pcm.h>
27 #include <sound/pcm_params.h>
28 #include <sound/initval.h>
29 #include <sound/tlv.h>
33 #define TAS2770_MDELAY 0xFFFFFFFE
35 static void tas2770_reset(struct tas2770_priv *tas2770)
37 if (tas2770->reset_gpio) {
38 gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
40 gpiod_set_value_cansleep(tas2770->reset_gpio, 1);
41 usleep_range(1000, 2000);
44 snd_soc_component_write(tas2770->component, TAS2770_SW_RST,
46 usleep_range(1000, 2000);
49 static int tas2770_set_bias_level(struct snd_soc_component *component,
50 enum snd_soc_bias_level level)
52 struct tas2770_priv *tas2770 =
53 snd_soc_component_get_drvdata(component);
57 snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
58 TAS2770_PWR_CTRL_MASK,
59 TAS2770_PWR_CTRL_ACTIVE);
61 case SND_SOC_BIAS_STANDBY:
62 case SND_SOC_BIAS_PREPARE:
63 snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
64 TAS2770_PWR_CTRL_MASK,
65 TAS2770_PWR_CTRL_MUTE);
67 case SND_SOC_BIAS_OFF:
68 snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
69 TAS2770_PWR_CTRL_MASK,
70 TAS2770_PWR_CTRL_SHUTDOWN);
74 dev_err(tas2770->dev, "wrong power level setting %d\n", level);
82 static int tas2770_codec_suspend(struct snd_soc_component *component)
84 struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
87 regcache_cache_only(tas2770->regmap, true);
88 regcache_mark_dirty(tas2770->regmap);
90 if (tas2770->sdz_gpio) {
91 gpiod_set_value_cansleep(tas2770->sdz_gpio, 0);
93 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
94 TAS2770_PWR_CTRL_MASK,
95 TAS2770_PWR_CTRL_SHUTDOWN);
97 regcache_cache_only(tas2770->regmap, false);
98 regcache_sync(tas2770->regmap);
108 static int tas2770_codec_resume(struct snd_soc_component *component)
110 struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
113 if (tas2770->sdz_gpio) {
114 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
115 usleep_range(1000, 2000);
117 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
118 TAS2770_PWR_CTRL_MASK,
119 TAS2770_PWR_CTRL_ACTIVE);
124 regcache_cache_only(tas2770->regmap, false);
126 return regcache_sync(tas2770->regmap);
129 #define tas2770_codec_suspend NULL
130 #define tas2770_codec_resume NULL
133 static const char * const tas2770_ASI1_src[] = {
134 "I2C offset", "Left", "Right", "LeftRightDiv2",
137 static SOC_ENUM_SINGLE_DECL(
138 tas2770_ASI1_src_enum, TAS2770_TDM_CFG_REG2,
139 4, tas2770_ASI1_src);
141 static const struct snd_kcontrol_new tas2770_asi1_mux =
142 SOC_DAPM_ENUM("ASI1 Source", tas2770_ASI1_src_enum);
144 static int tas2770_dac_event(struct snd_soc_dapm_widget *w,
145 struct snd_kcontrol *kcontrol, int event)
147 struct snd_soc_component *component =
148 snd_soc_dapm_to_component(w->dapm);
149 struct tas2770_priv *tas2770 =
150 snd_soc_component_get_drvdata(component);
154 case SND_SOC_DAPM_POST_PMU:
155 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
156 TAS2770_PWR_CTRL_MASK,
157 TAS2770_PWR_CTRL_MUTE);
159 case SND_SOC_DAPM_PRE_PMD:
160 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
161 TAS2770_PWR_CTRL_MASK,
162 TAS2770_PWR_CTRL_SHUTDOWN);
165 dev_err(tas2770->dev, "Not supported evevt\n");
175 static const struct snd_kcontrol_new isense_switch =
176 SOC_DAPM_SINGLE("Switch", TAS2770_PWR_CTRL, 3, 1, 1);
177 static const struct snd_kcontrol_new vsense_switch =
178 SOC_DAPM_SINGLE("Switch", TAS2770_PWR_CTRL, 2, 1, 1);
180 static const struct snd_soc_dapm_widget tas2770_dapm_widgets[] = {
181 SND_SOC_DAPM_AIF_IN("ASI1", "ASI1 Playback", 0, SND_SOC_NOPM, 0, 0),
182 SND_SOC_DAPM_MUX("ASI1 Sel", SND_SOC_NOPM, 0, 0, &tas2770_asi1_mux),
183 SND_SOC_DAPM_SWITCH("ISENSE", TAS2770_PWR_CTRL, 3, 1, &isense_switch),
184 SND_SOC_DAPM_SWITCH("VSENSE", TAS2770_PWR_CTRL, 2, 1, &vsense_switch),
185 SND_SOC_DAPM_DAC_E("DAC", NULL, SND_SOC_NOPM, 0, 0, tas2770_dac_event,
186 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
187 SND_SOC_DAPM_OUTPUT("OUT"),
188 SND_SOC_DAPM_SIGGEN("VMON"),
189 SND_SOC_DAPM_SIGGEN("IMON")
192 static const struct snd_soc_dapm_route tas2770_audio_map[] = {
193 {"ASI1 Sel", "I2C offset", "ASI1"},
194 {"ASI1 Sel", "Left", "ASI1"},
195 {"ASI1 Sel", "Right", "ASI1"},
196 {"ASI1 Sel", "LeftRightDiv2", "ASI1"},
197 {"DAC", NULL, "ASI1 Sel"},
198 {"OUT", NULL, "DAC"},
199 {"ISENSE", "Switch", "IMON"},
200 {"VSENSE", "Switch", "VMON"},
203 static int tas2770_mute(struct snd_soc_dai *dai, int mute, int direction)
205 struct snd_soc_component *component = dai->component;
209 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
210 TAS2770_PWR_CTRL_MASK,
211 TAS2770_PWR_CTRL_MUTE);
213 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
214 TAS2770_PWR_CTRL_MASK,
215 TAS2770_PWR_CTRL_ACTIVE);
223 static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth)
226 struct snd_soc_component *component = tas2770->component;
229 case SNDRV_PCM_FORMAT_S16_LE:
230 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
231 TAS2770_TDM_CFG_REG2_RXW_MASK,
232 TAS2770_TDM_CFG_REG2_RXW_16BITS);
233 tas2770->v_sense_slot = tas2770->i_sense_slot + 2;
235 case SNDRV_PCM_FORMAT_S24_LE:
236 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
237 TAS2770_TDM_CFG_REG2_RXW_MASK,
238 TAS2770_TDM_CFG_REG2_RXW_24BITS);
239 tas2770->v_sense_slot = tas2770->i_sense_slot + 4;
241 case SNDRV_PCM_FORMAT_S32_LE:
242 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
243 TAS2770_TDM_CFG_REG2_RXW_MASK,
244 TAS2770_TDM_CFG_REG2_RXW_32BITS);
245 tas2770->v_sense_slot = tas2770->i_sense_slot + 4;
255 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG5,
256 TAS2770_TDM_CFG_REG5_VSNS_MASK |
257 TAS2770_TDM_CFG_REG5_50_MASK,
258 TAS2770_TDM_CFG_REG5_VSNS_ENABLE |
259 tas2770->v_sense_slot);
263 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG6,
264 TAS2770_TDM_CFG_REG6_ISNS_MASK |
265 TAS2770_TDM_CFG_REG6_50_MASK,
266 TAS2770_TDM_CFG_REG6_ISNS_ENABLE |
267 tas2770->i_sense_slot);
274 static int tas2770_set_samplerate(struct tas2770_priv *tas2770, int samplerate)
276 struct snd_soc_component *component = tas2770->component;
280 switch (samplerate) {
282 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_48KHZ |
283 TAS2770_TDM_CFG_REG0_31_44_1_48KHZ;
286 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ |
287 TAS2770_TDM_CFG_REG0_31_44_1_48KHZ;
290 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_48KHZ |
291 TAS2770_TDM_CFG_REG0_31_88_2_96KHZ;
294 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ |
295 TAS2770_TDM_CFG_REG0_31_88_2_96KHZ;
298 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_48KHZ |
299 TAS2770_TDM_CFG_REG0_31_176_4_192KHZ;
302 ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ |
303 TAS2770_TDM_CFG_REG0_31_176_4_192KHZ;
309 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG0,
310 TAS2770_TDM_CFG_REG0_SMP_MASK |
311 TAS2770_TDM_CFG_REG0_31_MASK,
319 static int tas2770_hw_params(struct snd_pcm_substream *substream,
320 struct snd_pcm_hw_params *params,
321 struct snd_soc_dai *dai)
323 struct snd_soc_component *component = dai->component;
324 struct tas2770_priv *tas2770 =
325 snd_soc_component_get_drvdata(component);
328 ret = tas2770_set_bitwidth(tas2770, params_format(params));
332 return tas2770_set_samplerate(tas2770, params_rate(params));
335 static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
337 struct snd_soc_component *component = dai->component;
338 struct tas2770_priv *tas2770 =
339 snd_soc_component_get_drvdata(component);
340 u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0;
343 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
344 case SND_SOC_DAIFMT_CBS_CFS:
347 dev_err(tas2770->dev, "ASI format master is not found\n");
351 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
352 case SND_SOC_DAIFMT_NB_IF:
355 case SND_SOC_DAIFMT_NB_NF:
356 asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_RSING;
358 case SND_SOC_DAIFMT_IB_IF:
361 case SND_SOC_DAIFMT_IB_NF:
362 asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_FALING;
365 dev_err(tas2770->dev, "ASI format Inverse is not found\n");
369 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG1,
370 TAS2770_TDM_CFG_REG1_RX_MASK,
375 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
376 case SND_SOC_DAIFMT_I2S:
377 tdm_rx_start_slot = 1;
380 case SND_SOC_DAIFMT_DSP_A:
381 tdm_rx_start_slot = 0;
384 case SND_SOC_DAIFMT_DSP_B:
385 tdm_rx_start_slot = 1;
388 case SND_SOC_DAIFMT_LEFT_J:
389 tdm_rx_start_slot = 0;
393 dev_err(tas2770->dev,
394 "DAI Format is not found, fmt=0x%x\n", fmt);
398 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG1,
399 TAS2770_TDM_CFG_REG1_MASK,
400 (tdm_rx_start_slot << TAS2770_TDM_CFG_REG1_51_SHIFT));
404 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG0,
405 TAS2770_TDM_CFG_REG0_FPOL_MASK,
406 (fpol_preinv ^ invert_fpol)
407 ? TAS2770_TDM_CFG_REG0_FPOL_RSING
408 : TAS2770_TDM_CFG_REG0_FPOL_FALING);
415 static int tas2770_set_dai_tdm_slot(struct snd_soc_dai *dai,
416 unsigned int tx_mask,
417 unsigned int rx_mask,
418 int slots, int slot_width)
420 struct snd_soc_component *component = dai->component;
421 int left_slot, right_slot;
424 if (tx_mask == 0 || rx_mask != 0)
434 left_slot = __ffs(tx_mask);
435 tx_mask &= ~(1 << left_slot);
437 right_slot = left_slot;
439 right_slot = __ffs(tx_mask);
440 tx_mask &= ~(1 << right_slot);
444 if (tx_mask != 0 || left_slot >= slots || right_slot >= slots)
447 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG3,
448 TAS2770_TDM_CFG_REG3_30_MASK,
449 (left_slot << TAS2770_TDM_CFG_REG3_30_SHIFT));
452 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG3,
453 TAS2770_TDM_CFG_REG3_RXS_MASK,
454 (right_slot << TAS2770_TDM_CFG_REG3_RXS_SHIFT));
458 switch (slot_width) {
460 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
461 TAS2770_TDM_CFG_REG2_RXS_MASK,
462 TAS2770_TDM_CFG_REG2_RXS_16BITS);
465 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
466 TAS2770_TDM_CFG_REG2_RXS_MASK,
467 TAS2770_TDM_CFG_REG2_RXS_24BITS);
470 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
471 TAS2770_TDM_CFG_REG2_RXS_MASK,
472 TAS2770_TDM_CFG_REG2_RXS_32BITS);
475 /* Do not change slot width */
488 static const struct snd_soc_dai_ops tas2770_dai_ops = {
489 .mute_stream = tas2770_mute,
490 .hw_params = tas2770_hw_params,
491 .set_fmt = tas2770_set_fmt,
492 .set_tdm_slot = tas2770_set_dai_tdm_slot,
493 .no_capture_mute = 1,
496 #define TAS2770_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
497 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
499 #define TAS2770_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
500 SNDRV_PCM_RATE_96000 |\
501 SNDRV_PCM_RATE_192000\
504 static struct snd_soc_dai_driver tas2770_dai_driver[] = {
506 .name = "tas2770 ASI1",
509 .stream_name = "ASI1 Playback",
512 .rates = TAS2770_RATES,
513 .formats = TAS2770_FORMATS,
516 .stream_name = "ASI1 Capture",
519 .rates = TAS2770_RATES,
520 .formats = TAS2770_FORMATS,
522 .ops = &tas2770_dai_ops,
527 static int tas2770_codec_probe(struct snd_soc_component *component)
529 struct tas2770_priv *tas2770 =
530 snd_soc_component_get_drvdata(component);
532 tas2770->component = component;
534 if (tas2770->sdz_gpio) {
535 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
536 usleep_range(1000, 2000);
539 tas2770_reset(tas2770);
544 static DECLARE_TLV_DB_SCALE(tas2770_digital_tlv, 1100, 50, 0);
545 static DECLARE_TLV_DB_SCALE(tas2770_playback_volume, -12750, 50, 0);
547 static const struct snd_kcontrol_new tas2770_snd_controls[] = {
548 SOC_SINGLE_TLV("Speaker Playback Volume", TAS2770_PLAY_CFG_REG2,
549 0, TAS2770_PLAY_CFG_REG2_VMAX, 1, tas2770_playback_volume),
550 SOC_SINGLE_TLV("Amp Gain Volume", TAS2770_PLAY_CFG_REG0, 0, 0x14, 0,
551 tas2770_digital_tlv),
554 static const struct snd_soc_component_driver soc_component_driver_tas2770 = {
555 .probe = tas2770_codec_probe,
556 .suspend = tas2770_codec_suspend,
557 .resume = tas2770_codec_resume,
558 .set_bias_level = tas2770_set_bias_level,
559 .controls = tas2770_snd_controls,
560 .num_controls = ARRAY_SIZE(tas2770_snd_controls),
561 .dapm_widgets = tas2770_dapm_widgets,
562 .num_dapm_widgets = ARRAY_SIZE(tas2770_dapm_widgets),
563 .dapm_routes = tas2770_audio_map,
564 .num_dapm_routes = ARRAY_SIZE(tas2770_audio_map),
567 .non_legacy_dai_naming = 1,
570 static int tas2770_register_codec(struct tas2770_priv *tas2770)
572 return devm_snd_soc_register_component(tas2770->dev,
573 &soc_component_driver_tas2770,
574 tas2770_dai_driver, ARRAY_SIZE(tas2770_dai_driver));
577 static const struct reg_default tas2770_reg_defaults[] = {
578 { TAS2770_PAGE, 0x00 },
579 { TAS2770_SW_RST, 0x00 },
580 { TAS2770_PWR_CTRL, 0x0e },
581 { TAS2770_PLAY_CFG_REG0, 0x10 },
582 { TAS2770_PLAY_CFG_REG1, 0x01 },
583 { TAS2770_PLAY_CFG_REG2, 0x00 },
584 { TAS2770_MSC_CFG_REG0, 0x07 },
585 { TAS2770_TDM_CFG_REG1, 0x02 },
586 { TAS2770_TDM_CFG_REG2, 0x0a },
587 { TAS2770_TDM_CFG_REG3, 0x10 },
588 { TAS2770_INT_MASK_REG0, 0xfc },
589 { TAS2770_INT_MASK_REG1, 0xb1 },
590 { TAS2770_INT_CFG, 0x05 },
591 { TAS2770_MISC_IRQ, 0x81 },
592 { TAS2770_CLK_CGF, 0x0c },
596 static bool tas2770_volatile(struct device *dev, unsigned int reg)
599 case TAS2770_PAGE: /* regmap implementation requires this */
600 case TAS2770_SW_RST: /* always clears after write */
601 case TAS2770_BO_PRV_REG0:/* has a self clearing bit */
602 case TAS2770_LVE_INT_REG0:
603 case TAS2770_LVE_INT_REG1:
604 case TAS2770_LAT_INT_REG0:/* Sticky interrupt flags */
605 case TAS2770_LAT_INT_REG1:/* Sticky interrupt flags */
606 case TAS2770_VBAT_MSB:
607 case TAS2770_VBAT_LSB:
608 case TAS2770_TEMP_MSB:
609 case TAS2770_TEMP_LSB:
616 static bool tas2770_writeable(struct device *dev, unsigned int reg)
619 case TAS2770_LVE_INT_REG0:
620 case TAS2770_LVE_INT_REG1:
621 case TAS2770_LAT_INT_REG0:
622 case TAS2770_LAT_INT_REG1:
623 case TAS2770_VBAT_MSB:
624 case TAS2770_VBAT_LSB:
625 case TAS2770_TEMP_MSB:
626 case TAS2770_TEMP_LSB:
627 case TAS2770_TDM_CLK_DETC:
628 case TAS2770_REV_AND_GPID:
635 static const struct regmap_range_cfg tas2770_regmap_ranges[] = {
638 .range_max = 1 * 128,
639 .selector_reg = TAS2770_PAGE,
640 .selector_mask = 0xff,
647 static const struct regmap_config tas2770_i2c_regmap = {
650 .writeable_reg = tas2770_writeable,
651 .volatile_reg = tas2770_volatile,
652 .reg_defaults = tas2770_reg_defaults,
653 .num_reg_defaults = ARRAY_SIZE(tas2770_reg_defaults),
654 .cache_type = REGCACHE_RBTREE,
655 .ranges = tas2770_regmap_ranges,
656 .num_ranges = ARRAY_SIZE(tas2770_regmap_ranges),
657 .max_register = 1 * 128,
660 static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770)
664 rc = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no",
665 &tas2770->i_sense_slot);
667 dev_info(tas2770->dev, "Property %s is missing setting default slot\n",
670 tas2770->i_sense_slot = 0;
673 rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no",
674 &tas2770->v_sense_slot);
676 dev_info(tas2770->dev, "Property %s is missing setting default slot\n",
679 tas2770->v_sense_slot = 2;
682 tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH);
683 if (IS_ERR(tas2770->sdz_gpio)) {
684 if (PTR_ERR(tas2770->sdz_gpio) == -EPROBE_DEFER)
685 return -EPROBE_DEFER;
687 tas2770->sdz_gpio = NULL;
693 static int tas2770_i2c_probe(struct i2c_client *client,
694 const struct i2c_device_id *id)
696 struct tas2770_priv *tas2770;
699 tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv),
704 tas2770->dev = &client->dev;
705 i2c_set_clientdata(client, tas2770);
706 dev_set_drvdata(&client->dev, tas2770);
708 tas2770->regmap = devm_regmap_init_i2c(client, &tas2770_i2c_regmap);
709 if (IS_ERR(tas2770->regmap)) {
710 result = PTR_ERR(tas2770->regmap);
711 dev_err(&client->dev, "Failed to allocate register map: %d\n",
716 if (client->dev.of_node) {
717 result = tas2770_parse_dt(&client->dev, tas2770);
719 dev_err(tas2770->dev, "%s: Failed to parse devicetree\n",
725 tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset",
727 if (IS_ERR(tas2770->reset_gpio)) {
728 if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) {
729 tas2770->reset_gpio = NULL;
730 return -EPROBE_DEFER;
734 result = tas2770_register_codec(tas2770);
736 dev_err(tas2770->dev, "Register codec failed.\n");
741 static const struct i2c_device_id tas2770_i2c_id[] = {
745 MODULE_DEVICE_TABLE(i2c, tas2770_i2c_id);
747 #if defined(CONFIG_OF)
748 static const struct of_device_id tas2770_of_match[] = {
749 { .compatible = "ti,tas2770" },
752 MODULE_DEVICE_TABLE(of, tas2770_of_match);
755 static struct i2c_driver tas2770_i2c_driver = {
758 .of_match_table = of_match_ptr(tas2770_of_match),
760 .probe = tas2770_i2c_probe,
761 .id_table = tas2770_i2c_id,
763 module_i2c_driver(tas2770_i2c_driver);
765 MODULE_AUTHOR("Shi Fu <shifu0704@thundersoft.com>");
766 MODULE_DESCRIPTION("TAS2770 I2C Smart Amplifier driver");
767 MODULE_LICENSE("GPL v2");