1 // SPDX-License-Identifier: GPL-2.0-only 2 // 3 // aw87390.c -- AW87390 ALSA SoC Audio driver 4 // 5 // Copyright (c) 2023 awinic Technology CO., LTD 6 // 7 // Author: Weidong Wang <wangweidong.a@awinic.com> 8 // 9 10 #include <linux/i2c.h> 11 #include <linux/firmware.h> 12 #include <linux/regmap.h> 13 #include <sound/soc.h> 14 #include "aw87390.h" 15 #include "aw88395/aw88395_data_type.h" 16 #include "aw88395/aw88395_device.h" 17 18 static const struct regmap_config aw87390_remap_config = { 19 .val_bits = 8, 20 .reg_bits = 8, 21 .max_register = AW87390_REG_MAX, 22 .reg_format_endian = REGMAP_ENDIAN_LITTLE, 23 .val_format_endian = REGMAP_ENDIAN_BIG, 24 }; 25 26 static int aw87390_dev_reg_update(struct aw_device *aw_dev, 27 unsigned char *data, unsigned int len) 28 { 29 int i, ret; 30 31 if (!data) { 32 dev_err(aw_dev->dev, "data is NULL\n"); 33 return -EINVAL; 34 } 35 36 for (i = 0; i < len-1; i += 2) { 37 if (data[i] == AW87390_DELAY_REG_ADDR) { 38 usleep_range(data[i + 1] * AW87390_REG_DELAY_TIME, 39 data[i + 1] * AW87390_REG_DELAY_TIME + 10); 40 continue; 41 } 42 ret = regmap_write(aw_dev->regmap, data[i], data[i + 1]); 43 if (ret) 44 return ret; 45 } 46 47 return 0; 48 } 49 50 static int aw87390_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name) 51 { 52 struct aw_prof_info *prof_info = &aw_dev->prof_info; 53 struct aw_prof_desc *prof_desc; 54 55 if ((index >= aw_dev->prof_info.count) || (index < 0)) { 56 dev_err(aw_dev->dev, "index[%d] overflow count[%d]\n", 57 index, aw_dev->prof_info.count); 58 return -EINVAL; 59 } 60 61 prof_desc = &aw_dev->prof_info.prof_desc[index]; 62 63 *prof_name = prof_info->prof_name_list[prof_desc->id]; 64 65 return 0; 66 } 67 68 static int aw87390_dev_get_prof_data(struct aw_device *aw_dev, int index, 69 struct aw_prof_desc **prof_desc) 70 { 71 if ((index >= aw_dev->prof_info.count) || (index < 0)) { 72 dev_err(aw_dev->dev, "%s: index[%d] overflow count[%d]\n", 73 __func__, index, aw_dev->prof_info.count); 74 return -EINVAL; 75 } 76 77 *prof_desc = &aw_dev->prof_info.prof_desc[index]; 78 79 return 0; 80 } 81 82 static int aw87390_dev_fw_update(struct aw_device *aw_dev) 83 { 84 struct aw_prof_desc *prof_index_desc; 85 struct aw_sec_data_desc *sec_desc; 86 char *prof_name; 87 int ret; 88 89 ret = aw87390_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name); 90 if (ret) { 91 dev_err(aw_dev->dev, "get prof name failed\n"); 92 return -EINVAL; 93 } 94 95 dev_dbg(aw_dev->dev, "start update %s", prof_name); 96 97 ret = aw87390_dev_get_prof_data(aw_dev, aw_dev->prof_index, &prof_index_desc); 98 if (ret) { 99 dev_err(aw_dev->dev, "aw87390_dev_get_prof_data failed\n"); 100 return ret; 101 } 102 103 /* update reg */ 104 sec_desc = prof_index_desc->sec_desc; 105 ret = aw87390_dev_reg_update(aw_dev, sec_desc[AW88395_DATA_TYPE_REG].data, 106 sec_desc[AW88395_DATA_TYPE_REG].len); 107 if (ret) { 108 dev_err(aw_dev->dev, "update reg failed\n"); 109 return ret; 110 } 111 112 aw_dev->prof_cur = aw_dev->prof_index; 113 114 return 0; 115 } 116 117 static int aw87390_power_off(struct aw_device *aw_dev) 118 { 119 int ret; 120 121 if (aw_dev->status == AW87390_DEV_PW_OFF) { 122 dev_dbg(aw_dev->dev, "already power off\n"); 123 return 0; 124 } 125 126 ret = regmap_write(aw_dev->regmap, AW87390_SYSCTRL_REG, AW87390_POWER_DOWN_VALUE); 127 if (ret) 128 return ret; 129 aw_dev->status = AW87390_DEV_PW_OFF; 130 131 return 0; 132 } 133 134 static int aw87390_power_on(struct aw_device *aw_dev) 135 { 136 int ret; 137 138 if (aw_dev->status == AW87390_DEV_PW_ON) { 139 dev_dbg(aw_dev->dev, "already power on\n"); 140 return 0; 141 } 142 143 if (!aw_dev->fw_status) { 144 dev_err(aw_dev->dev, "fw not load\n"); 145 return -EINVAL; 146 } 147 148 ret = regmap_write(aw_dev->regmap, AW87390_SYSCTRL_REG, AW87390_POWER_DOWN_VALUE); 149 if (ret) 150 return ret; 151 152 ret = aw87390_dev_fw_update(aw_dev); 153 if (ret) { 154 dev_err(aw_dev->dev, "%s load profile failed\n", __func__); 155 return ret; 156 } 157 aw_dev->status = AW87390_DEV_PW_ON; 158 159 return 0; 160 } 161 162 static int aw87390_dev_set_profile_index(struct aw_device *aw_dev, int index) 163 { 164 if ((index >= aw_dev->prof_info.count) || (index < 0)) 165 return -EINVAL; 166 167 if (aw_dev->prof_index == index) 168 return -EPERM; 169 170 aw_dev->prof_index = index; 171 172 return 0; 173 } 174 175 static int aw87390_profile_info(struct snd_kcontrol *kcontrol, 176 struct snd_ctl_elem_info *uinfo) 177 { 178 struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); 179 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); 180 char *prof_name; 181 int count, ret; 182 183 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 184 uinfo->count = 1; 185 186 count = aw87390->aw_pa->prof_info.count; 187 if (count <= 0) { 188 uinfo->value.enumerated.items = 0; 189 return 0; 190 } 191 192 uinfo->value.enumerated.items = count; 193 194 if (uinfo->value.enumerated.item >= count) 195 uinfo->value.enumerated.item = count - 1; 196 197 count = uinfo->value.enumerated.item; 198 199 ret = aw87390_dev_get_prof_name(aw87390->aw_pa, count, &prof_name); 200 if (ret) { 201 strscpy(uinfo->value.enumerated.name, "null"); 202 return 0; 203 } 204 205 strscpy(uinfo->value.enumerated.name, prof_name); 206 207 return 0; 208 } 209 210 static int aw87390_profile_get(struct snd_kcontrol *kcontrol, 211 struct snd_ctl_elem_value *ucontrol) 212 { 213 struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); 214 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); 215 216 ucontrol->value.integer.value[0] = aw87390->aw_pa->prof_index; 217 218 return 0; 219 } 220 221 static int aw87390_profile_set(struct snd_kcontrol *kcontrol, 222 struct snd_ctl_elem_value *ucontrol) 223 { 224 struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); 225 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); 226 int ret; 227 228 mutex_lock(&aw87390->lock); 229 ret = aw87390_dev_set_profile_index(aw87390->aw_pa, ucontrol->value.integer.value[0]); 230 if (ret) { 231 dev_dbg(codec->dev, "profile index does not change\n"); 232 mutex_unlock(&aw87390->lock); 233 return 0; 234 } 235 236 if (aw87390->aw_pa->status == AW87390_DEV_PW_ON) { 237 aw87390_power_off(aw87390->aw_pa); 238 aw87390_power_on(aw87390->aw_pa); 239 } 240 241 mutex_unlock(&aw87390->lock); 242 243 return 1; 244 } 245 246 static const struct snd_kcontrol_new aw87390_controls[] = { 247 AW87390_PROFILE_EXT("AW87390 Profile Set", aw87390_profile_info, 248 aw87390_profile_get, aw87390_profile_set), 249 }; 250 251 static int aw87390_request_firmware_file(struct aw87390 *aw87390) 252 { 253 const struct firmware *cont = NULL; 254 int ret; 255 256 aw87390->aw_pa->fw_status = AW87390_DEV_FW_FAILED; 257 258 ret = request_firmware(&cont, AW87390_ACF_FILE, aw87390->aw_pa->dev); 259 if (ret) 260 return dev_err_probe(aw87390->aw_pa->dev, ret, 261 "load [%s] failed!\n", AW87390_ACF_FILE); 262 263 dev_dbg(aw87390->aw_pa->dev, "loaded %s - size: %zu\n", 264 AW87390_ACF_FILE, cont ? cont->size : 0); 265 266 aw87390->aw_cfg = devm_kzalloc(aw87390->aw_pa->dev, 267 struct_size(aw87390->aw_cfg, data, cont->size), GFP_KERNEL); 268 if (!aw87390->aw_cfg) { 269 release_firmware(cont); 270 return -ENOMEM; 271 } 272 273 aw87390->aw_cfg->len = cont->size; 274 memcpy(aw87390->aw_cfg->data, cont->data, cont->size); 275 release_firmware(cont); 276 277 ret = aw88395_dev_load_acf_check(aw87390->aw_pa, aw87390->aw_cfg); 278 if (ret) { 279 dev_err(aw87390->aw_pa->dev, "load [%s] failed!\n", AW87390_ACF_FILE); 280 return ret; 281 } 282 283 mutex_lock(&aw87390->lock); 284 285 ret = aw88395_dev_cfg_load(aw87390->aw_pa, aw87390->aw_cfg); 286 if (ret) 287 dev_err(aw87390->aw_pa->dev, "aw_dev acf parse failed\n"); 288 289 mutex_unlock(&aw87390->lock); 290 291 return ret; 292 } 293 294 static int aw87390_drv_event(struct snd_soc_dapm_widget *w, 295 struct snd_kcontrol *kcontrol, int event) 296 { 297 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 298 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(component); 299 struct aw_device *aw_dev = aw87390->aw_pa; 300 int ret; 301 302 switch (event) { 303 case SND_SOC_DAPM_PRE_PMU: 304 ret = aw87390_power_on(aw_dev); 305 break; 306 case SND_SOC_DAPM_POST_PMD: 307 ret = aw87390_power_off(aw_dev); 308 break; 309 default: 310 dev_err(aw_dev->dev, "%s: invalid event %d\n", __func__, event); 311 ret = -EINVAL; 312 } 313 314 return ret; 315 } 316 317 static int aw87391_rgds_drv_event(struct snd_soc_dapm_widget *w, 318 struct snd_kcontrol *kcontrol, int event) 319 { 320 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 321 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(component); 322 struct aw_device *aw_dev = aw87390->aw_pa; 323 324 switch (event) { 325 case SND_SOC_DAPM_PRE_PMU: 326 if (!IS_ERR(aw87390->vdd_reg)) { 327 if (regulator_enable(aw87390->vdd_reg)) 328 dev_warn(aw_dev->dev, "Failed to enable vdd\n"); 329 } 330 break; 331 case SND_SOC_DAPM_POST_PMU: 332 regmap_write(aw_dev->regmap, AW87391_SYSCTRL_REG, 333 AW87391_REG_VER_SEL_LOW | AW87391_REG_EN_ADAP | 334 AW87391_REG_EN_2X | AW87391_EN_SPK | 335 AW87391_EN_PA | AW87391_REG_EN_CP | 336 AW87391_EN_SW); 337 break; 338 case SND_SOC_DAPM_PRE_PMD: 339 regmap_write(aw_dev->regmap, AW87390_SYSCTRL_REG, 340 AW87390_POWER_DOWN_VALUE); 341 break; 342 case SND_SOC_DAPM_POST_PMD: 343 if (!IS_ERR(aw87390->vdd_reg)) { 344 if (regulator_disable(aw87390->vdd_reg)) 345 dev_warn(aw_dev->dev, "Failed to disable vdd\n"); 346 } 347 break; 348 default: 349 dev_err(aw_dev->dev, "%s: invalid event %d\n", __func__, event); 350 return -EINVAL; 351 } 352 353 return 0; 354 } 355 356 static const struct snd_soc_dapm_widget aw87390_dapm_widgets[] = { 357 SND_SOC_DAPM_INPUT("IN"), 358 SND_SOC_DAPM_PGA_E("SPK PA", SND_SOC_NOPM, 0, 0, NULL, 0, aw87390_drv_event, 359 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 360 SND_SOC_DAPM_OUTPUT("OUT"), 361 }; 362 363 static const struct snd_soc_dapm_widget aw87391_rgds_dapm_widgets[] = { 364 SND_SOC_DAPM_INPUT("IN"), 365 SND_SOC_DAPM_PGA_E("SPK PA", SND_SOC_NOPM, 0, 0, NULL, 0, aw87391_rgds_drv_event, 366 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 367 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD), 368 SND_SOC_DAPM_OUTPUT("OUT"), 369 }; 370 371 static const struct snd_soc_dapm_route aw87390_dapm_routes[] = { 372 { "SPK PA", NULL, "IN" }, 373 { "OUT", NULL, "SPK PA" }, 374 }; 375 376 static int aw87390_codec_probe(struct snd_soc_component *component) 377 { 378 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(component); 379 int ret; 380 381 ret = aw87390_request_firmware_file(aw87390); 382 if (ret) 383 return dev_err_probe(aw87390->aw_pa->dev, ret, 384 "aw87390_request_firmware_file failed\n"); 385 386 return 0; 387 } 388 389 /* 390 * Firmware typically is used to load the sequence of init commands, 391 * however for the Anbernic RG-DS we don't have a firmware file just 392 * a list of registers and values. Most of these values are undocumented 393 * in the AW87391 datasheet. 394 */ 395 static void aw87391_rgds_codec_init(struct aw87390 *aw87390) 396 { 397 struct aw_device *aw_dev = aw87390->aw_pa; 398 399 /* Undocumented command per datasheet. */ 400 regmap_write(aw_dev->regmap, 0x64, 0x3a); 401 402 /* Bits 7:4 are undocumented but provided by manufacturer. */ 403 regmap_write(aw_dev->regmap, AW87391_CP_REG, 404 (5 << 4) | AW87391_REG_CP_OVP_8_50V); 405 406 regmap_write(aw_dev->regmap, AW87391_AGCPO_REG, 407 AW87391_AK1_S_016 | AW87391_AGC2PO_MW(500)); 408 409 regmap_write(aw_dev->regmap, AW87391_AGC2PA_REG, 410 AW87391_RK_S_20_48 | AW87391_AK2_S_41 | AW87391_AK2F_S_41); 411 412 /* Undocumented commands per datasheet. */ 413 regmap_write(aw_dev->regmap, 0x5d, 0x00); 414 regmap_write(aw_dev->regmap, 0x5e, 0xb4); 415 regmap_write(aw_dev->regmap, 0x5f, 0x30); 416 regmap_write(aw_dev->regmap, 0x60, 0x39); 417 regmap_write(aw_dev->regmap, 0x61, 0x10); 418 regmap_write(aw_dev->regmap, 0x62, 0x03); 419 regmap_write(aw_dev->regmap, 0x63, 0x7d); 420 regmap_write(aw_dev->regmap, 0x65, 0xa0); 421 regmap_write(aw_dev->regmap, 0x66, 0x21); 422 regmap_write(aw_dev->regmap, 0x67, 0x41); 423 regmap_write(aw_dev->regmap, 0x68, 0x3b); 424 regmap_write(aw_dev->regmap, 0x6e, 0x00); 425 regmap_write(aw_dev->regmap, 0x6f, 0x00); 426 regmap_write(aw_dev->regmap, 0x70, 0x00); 427 regmap_write(aw_dev->regmap, 0x71, 0x00); 428 regmap_write(aw_dev->regmap, 0x72, 0x34); 429 regmap_write(aw_dev->regmap, 0x73, 0x06); 430 regmap_write(aw_dev->regmap, 0x74, 0x10); 431 regmap_write(aw_dev->regmap, 0x75, 0x00); 432 regmap_write(aw_dev->regmap, 0x7a, 0x00); 433 regmap_write(aw_dev->regmap, 0x7b, 0x00); 434 regmap_write(aw_dev->regmap, 0x7c, 0x00); 435 regmap_write(aw_dev->regmap, 0x7d, 0x00); 436 437 regmap_write(aw_dev->regmap, AW87391_PAG_REG, AW87391_GAIN_12DB); 438 regmap_write(aw_dev->regmap, AW87391_SYSCTRL_REG, 439 AW87391_EN_PA | AW87391_REG_EN_CP | AW87391_EN_SW); 440 regmap_write(aw_dev->regmap, AW87391_SYSCTRL_REG, 441 AW87391_REG_VER_SEL_LOW | AW87391_REG_EN_ADAP | 442 AW87391_REG_EN_2X | AW87391_EN_SPK | AW87391_EN_PA | 443 AW87391_REG_EN_CP | AW87391_EN_SW); 444 regmap_write(aw_dev->regmap, AW87391_PAG_REG, AW87391_GAIN_15DB); 445 } 446 447 static int aw87391_rgds_codec_probe(struct snd_soc_component *component) 448 { 449 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(component); 450 451 aw87390->vdd_reg = devm_regulator_get_optional(aw87390->aw_pa->dev, 452 "vdd"); 453 if (IS_ERR(aw87390->vdd_reg) && PTR_ERR(aw87390->vdd_reg) != -ENODEV) 454 return dev_err_probe(aw87390->aw_pa->dev, 455 PTR_ERR(aw87390->vdd_reg), 456 "Could not get vdd regulator\n"); 457 458 aw87391_rgds_codec_init(aw87390); 459 460 return 0; 461 } 462 463 static const struct snd_soc_component_driver soc_codec_dev_aw87390 = { 464 .probe = aw87390_codec_probe, 465 .dapm_widgets = aw87390_dapm_widgets, 466 .num_dapm_widgets = ARRAY_SIZE(aw87390_dapm_widgets), 467 .dapm_routes = aw87390_dapm_routes, 468 .num_dapm_routes = ARRAY_SIZE(aw87390_dapm_routes), 469 .controls = aw87390_controls, 470 .num_controls = ARRAY_SIZE(aw87390_controls), 471 }; 472 473 static const struct snd_soc_component_driver soc_codec_dev_anbernic_rgds = { 474 .probe = aw87391_rgds_codec_probe, 475 .dapm_widgets = aw87391_rgds_dapm_widgets, 476 .num_dapm_widgets = ARRAY_SIZE(aw87391_rgds_dapm_widgets), 477 .dapm_routes = aw87390_dapm_routes, 478 .num_dapm_routes = ARRAY_SIZE(aw87390_dapm_routes), 479 }; 480 481 static void aw87390_parse_channel_dt(struct aw87390 *aw87390) 482 { 483 struct aw_device *aw_dev = aw87390->aw_pa; 484 struct device_node *np = aw_dev->dev->of_node; 485 u32 channel_value = AW87390_DEV_DEFAULT_CH; 486 487 of_property_read_u32(np, "awinic,audio-channel", &channel_value); 488 489 aw_dev->channel = channel_value; 490 } 491 492 static int aw87390_init(struct aw87390 *aw87390, struct i2c_client *i2c, struct regmap *regmap) 493 { 494 struct aw_device *aw_dev; 495 unsigned int chip_id; 496 int ret; 497 498 aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); 499 if (!aw_dev) 500 return -ENOMEM; 501 502 /* read chip id */ 503 ret = regmap_read(regmap, AW87390_ID_REG, &chip_id); 504 if (ret) { 505 dev_err(&i2c->dev, "%s read chipid error. ret = %d\n", __func__, ret); 506 return ret; 507 } 508 509 switch (chip_id) { 510 case AW87390_CHIP_ID: 511 aw_dev->chip_id = AW87390_CHIP_ID; 512 break; 513 case AW87391_CHIP_ID: 514 aw_dev->chip_id = AW87391_CHIP_ID; 515 break; 516 default: 517 dev_err(&i2c->dev, "unsupported device\n"); 518 return -ENXIO; 519 } 520 521 dev_dbg(&i2c->dev, "chip id = 0x%x\n", chip_id); 522 523 aw87390->aw_pa = aw_dev; 524 aw_dev->i2c = i2c; 525 aw_dev->regmap = regmap; 526 aw_dev->dev = &i2c->dev; 527 aw_dev->acf = NULL; 528 aw_dev->prof_info.prof_desc = NULL; 529 aw_dev->prof_info.count = 0; 530 aw_dev->prof_info.prof_type = AW88395_DEV_NONE_TYPE_ID; 531 aw_dev->channel = AW87390_DEV_DEFAULT_CH; 532 aw_dev->fw_status = AW87390_DEV_FW_FAILED; 533 aw_dev->prof_index = AW87390_INIT_PROFILE; 534 aw_dev->status = AW87390_DEV_PW_OFF; 535 536 aw87390_parse_channel_dt(aw87390); 537 538 return 0; 539 } 540 541 static int aw87390_i2c_probe(struct i2c_client *i2c) 542 { 543 struct aw87390 *aw87390; 544 const struct snd_soc_component_driver *priv; 545 int ret; 546 547 ret = i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C); 548 if (!ret) 549 return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed\n"); 550 551 aw87390 = devm_kzalloc(&i2c->dev, sizeof(*aw87390), GFP_KERNEL); 552 if (!aw87390) 553 return -ENOMEM; 554 555 mutex_init(&aw87390->lock); 556 557 i2c_set_clientdata(i2c, aw87390); 558 559 aw87390->regmap = devm_regmap_init_i2c(i2c, &aw87390_remap_config); 560 if (IS_ERR(aw87390->regmap)) 561 return dev_err_probe(&i2c->dev, PTR_ERR(aw87390->regmap), 562 "failed to init regmap\n"); 563 564 /* aw pa init */ 565 ret = aw87390_init(aw87390, i2c, aw87390->regmap); 566 if (ret) 567 return ret; 568 569 ret = regmap_write(aw87390->regmap, AW87390_ID_REG, AW87390_SOFT_RESET_VALUE); 570 if (ret) 571 return ret; 572 573 switch (aw87390->aw_pa->chip_id) { 574 case AW87390_CHIP_ID: 575 ret = devm_snd_soc_register_component(&i2c->dev, 576 &soc_codec_dev_aw87390, NULL, 0); 577 break; 578 case AW87391_CHIP_ID: 579 priv = of_device_get_match_data(&i2c->dev); 580 if (!priv) 581 return dev_err_probe(&i2c->dev, -EINVAL, 582 "aw87391 not currently supported\n"); 583 ret = devm_snd_soc_register_component(&i2c->dev, priv, NULL, 0); 584 break; 585 default: 586 return -ENXIO; 587 } 588 589 if (ret) 590 dev_err(&i2c->dev, "failed to register aw87390: %d\n", ret); 591 592 return ret; 593 } 594 595 static const struct of_device_id aw87390_of_match[] = { 596 { .compatible = "awinic,aw87390" }, 597 { .compatible = "anbernic,rgds-amp", .data = &soc_codec_dev_anbernic_rgds }, 598 {}, 599 }; 600 MODULE_DEVICE_TABLE(of, aw87390_of_match); 601 602 static const struct i2c_device_id aw87390_i2c_id[] = { 603 { AW87390_I2C_NAME }, 604 { AW87391_I2C_NAME }, 605 { } 606 }; 607 MODULE_DEVICE_TABLE(i2c, aw87390_i2c_id); 608 609 static struct i2c_driver aw87390_i2c_driver = { 610 .driver = { 611 .name = AW87390_I2C_NAME, 612 .of_match_table = of_match_ptr(aw87390_of_match), 613 }, 614 .probe = aw87390_i2c_probe, 615 .id_table = aw87390_i2c_id, 616 }; 617 module_i2c_driver(aw87390_i2c_driver); 618 619 MODULE_DESCRIPTION("ASoC AW87390 PA Driver"); 620 MODULE_LICENSE("GPL v2"); 621