.. | .. |
---|
2 | 2 | /* |
---|
3 | 3 | * ALSA SoC TLV320AIC31xx CODEC Driver |
---|
4 | 4 | * |
---|
5 | | - * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/ |
---|
| 5 | + * Copyright (C) 2014-2017 Texas Instruments Incorporated - https://www.ti.com/ |
---|
6 | 6 | * Jyri Sarha <jsarha@ti.com> |
---|
7 | 7 | * |
---|
8 | 8 | * Based on ground work by: Ajit Kulkarni <x0175765@ti.com> |
---|
.. | .. |
---|
25 | 25 | #include <linux/of_gpio.h> |
---|
26 | 26 | #include <linux/slab.h> |
---|
27 | 27 | #include <sound/core.h> |
---|
| 28 | +#include <sound/jack.h> |
---|
28 | 29 | #include <sound/pcm.h> |
---|
29 | 30 | #include <sound/pcm_params.h> |
---|
30 | 31 | #include <sound/soc.h> |
---|
.. | .. |
---|
33 | 34 | #include <dt-bindings/sound/tlv320aic31xx-micbias.h> |
---|
34 | 35 | |
---|
35 | 36 | #include "tlv320aic31xx.h" |
---|
| 37 | + |
---|
| 38 | +static int aic31xx_set_jack(struct snd_soc_component *component, |
---|
| 39 | + struct snd_soc_jack *jack, void *data); |
---|
36 | 40 | |
---|
37 | 41 | static const struct reg_default aic31xx_reg_defaults[] = { |
---|
38 | 42 | { AIC31XX_CLKMUX, 0x00 }, |
---|
.. | .. |
---|
89 | 93 | case AIC31XX_INTRADCFLAG: /* Sticky interrupt flags */ |
---|
90 | 94 | case AIC31XX_INTRDACFLAG2: |
---|
91 | 95 | case AIC31XX_INTRADCFLAG2: |
---|
| 96 | + case AIC31XX_HSDETECT: |
---|
92 | 97 | return true; |
---|
93 | 98 | } |
---|
94 | 99 | return false; |
---|
.. | .. |
---|
163 | 168 | struct aic31xx_pdata pdata; |
---|
164 | 169 | struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES]; |
---|
165 | 170 | struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES]; |
---|
| 171 | + struct snd_soc_jack *jack; |
---|
166 | 172 | unsigned int sysclk; |
---|
167 | 173 | u8 p_div; |
---|
168 | 174 | int rate_div_line; |
---|
169 | 175 | bool master_dapm_route_applied; |
---|
| 176 | + int irq; |
---|
| 177 | + u8 ocmv; /* output common-mode voltage */ |
---|
170 | 178 | }; |
---|
171 | 179 | |
---|
172 | 180 | struct aic31xx_rate_divs { |
---|
.. | .. |
---|
254 | 262 | static SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, |
---|
255 | 263 | mic_select_text); |
---|
256 | 264 | |
---|
257 | | -static SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); |
---|
258 | 265 | static SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, |
---|
259 | 266 | mic_select_text); |
---|
| 267 | + |
---|
| 268 | +static const char * const hp_poweron_time_text[] = { |
---|
| 269 | + "0us", "15.3us", "153us", "1.53ms", "15.3ms", "76.2ms", |
---|
| 270 | + "153ms", "304ms", "610ms", "1.22s", "3.04s", "6.1s" }; |
---|
| 271 | + |
---|
| 272 | +static SOC_ENUM_SINGLE_DECL(hp_poweron_time_enum, AIC31XX_HPPOP, 3, |
---|
| 273 | + hp_poweron_time_text); |
---|
| 274 | + |
---|
| 275 | +static const char * const hp_rampup_step_text[] = { |
---|
| 276 | + "0ms", "0.98ms", "1.95ms", "3.9ms" }; |
---|
| 277 | + |
---|
| 278 | +static SOC_ENUM_SINGLE_DECL(hp_rampup_step_enum, AIC31XX_HPPOP, 1, |
---|
| 279 | + hp_rampup_step_text); |
---|
| 280 | + |
---|
| 281 | +static const char * const vol_soft_step_mode_text[] = { |
---|
| 282 | + "fast", "slow", "disabled" }; |
---|
| 283 | + |
---|
| 284 | +static SOC_ENUM_SINGLE_DECL(vol_soft_step_mode_enum, AIC31XX_DACSETUP, 0, |
---|
| 285 | + vol_soft_step_mode_text); |
---|
260 | 286 | |
---|
261 | 287 | static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0); |
---|
262 | 288 | static const DECLARE_TLV_DB_SCALE(adc_fgain_tlv, 0, 10, 0); |
---|
.. | .. |
---|
281 | 307 | |
---|
282 | 308 | SOC_DOUBLE_R_TLV("HP Analog Playback Volume", AIC31XX_LANALOGHPL, |
---|
283 | 309 | AIC31XX_RANALOGHPR, 0, 0x7F, 1, hp_vol_tlv), |
---|
| 310 | + |
---|
| 311 | + /* HP de-pop control: apply power not immediately but via ramp |
---|
| 312 | + * function with these psarameters. Note that power up sequence |
---|
| 313 | + * has to wait for this to complete; this is implemented by |
---|
| 314 | + * polling HP driver status in aic31xx_dapm_power_event() |
---|
| 315 | + */ |
---|
| 316 | + SOC_ENUM("HP Output Driver Power-On time", hp_poweron_time_enum), |
---|
| 317 | + SOC_ENUM("HP Output Driver Ramp-up step", hp_rampup_step_enum), |
---|
| 318 | + |
---|
| 319 | + SOC_ENUM("Volume Soft Stepping", vol_soft_step_mode_enum), |
---|
284 | 320 | }; |
---|
285 | 321 | |
---|
286 | 322 | static const struct snd_kcontrol_new aic31xx_snd_controls[] = { |
---|
.. | .. |
---|
353 | 389 | struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); |
---|
354 | 390 | unsigned int reg = AIC31XX_DACFLAG1; |
---|
355 | 391 | unsigned int mask; |
---|
| 392 | + unsigned int timeout = 500 * USEC_PER_MSEC; |
---|
356 | 393 | |
---|
357 | 394 | switch (WIDGET_BIT(w->reg, w->shift)) { |
---|
358 | 395 | case WIDGET_BIT(AIC31XX_DACSETUP, 7): |
---|
.. | .. |
---|
363 | 400 | break; |
---|
364 | 401 | case WIDGET_BIT(AIC31XX_HPDRIVER, 7): |
---|
365 | 402 | mask = AIC31XX_HPLDRVPWRSTATUS_MASK; |
---|
| 403 | + if (event == SND_SOC_DAPM_POST_PMU) |
---|
| 404 | + timeout = 7 * USEC_PER_SEC; |
---|
366 | 405 | break; |
---|
367 | 406 | case WIDGET_BIT(AIC31XX_HPDRIVER, 6): |
---|
368 | 407 | mask = AIC31XX_HPRDRVPWRSTATUS_MASK; |
---|
| 408 | + if (event == SND_SOC_DAPM_POST_PMU) |
---|
| 409 | + timeout = 7 * USEC_PER_SEC; |
---|
369 | 410 | break; |
---|
370 | 411 | case WIDGET_BIT(AIC31XX_SPKAMP, 7): |
---|
371 | 412 | mask = AIC31XX_SPLDRVPWRSTATUS_MASK; |
---|
.. | .. |
---|
385 | 426 | |
---|
386 | 427 | switch (event) { |
---|
387 | 428 | case SND_SOC_DAPM_POST_PMU: |
---|
388 | | - return aic31xx_wait_bits(aic31xx, reg, mask, mask, 5000, 100); |
---|
| 429 | + return aic31xx_wait_bits(aic31xx, reg, mask, mask, |
---|
| 430 | + 5000, timeout / 5000); |
---|
389 | 431 | case SND_SOC_DAPM_POST_PMD: |
---|
390 | | - return aic31xx_wait_bits(aic31xx, reg, mask, 0, 5000, 100); |
---|
| 432 | + return aic31xx_wait_bits(aic31xx, reg, mask, 0, |
---|
| 433 | + 5000, timeout / 5000); |
---|
391 | 434 | default: |
---|
392 | 435 | dev_dbg(component->dev, |
---|
393 | 436 | "Unhandled dapm widget event %d from %s\n", |
---|
.. | .. |
---|
837 | 880 | there may be trouble. To fix the issue edit the |
---|
838 | 881 | aic31xx_divs table for your mclk and sample |
---|
839 | 882 | rate. Details can be found from: |
---|
840 | | - http://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf |
---|
| 883 | + https://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf |
---|
841 | 884 | Section: 5.6 CLOCK Generation and PLL |
---|
842 | 885 | */ |
---|
843 | 886 | } |
---|
.. | .. |
---|
932 | 975 | return aic31xx_setup_pll(component, params); |
---|
933 | 976 | } |
---|
934 | 977 | |
---|
935 | | -static int aic31xx_dac_mute(struct snd_soc_dai *codec_dai, int mute) |
---|
| 978 | +static int aic31xx_dac_mute(struct snd_soc_dai *codec_dai, int mute, |
---|
| 979 | + int direction) |
---|
936 | 980 | { |
---|
937 | 981 | struct snd_soc_component *component = codec_dai->component; |
---|
938 | 982 | |
---|
.. | .. |
---|
1040 | 1084 | case SND_SOC_DAIFMT_I2S: |
---|
1041 | 1085 | break; |
---|
1042 | 1086 | case SND_SOC_DAIFMT_DSP_A: |
---|
1043 | | - dsp_a_val = 0x1; /* fall through */ |
---|
| 1087 | + dsp_a_val = 0x1; |
---|
| 1088 | + fallthrough; |
---|
1044 | 1089 | case SND_SOC_DAIFMT_DSP_B: |
---|
1045 | 1090 | /* |
---|
1046 | 1091 | * NOTE: This CODEC samples on the falling edge of BCLK in |
---|
.. | .. |
---|
1094 | 1139 | if (freq/i > 20000000) { |
---|
1095 | 1140 | dev_err(aic31xx->dev, "%s: Too high mclk frequency %u\n", |
---|
1096 | 1141 | __func__, freq); |
---|
1097 | | - return -EINVAL; |
---|
| 1142 | + return -EINVAL; |
---|
1098 | 1143 | } |
---|
1099 | 1144 | aic31xx->p_div = i; |
---|
1100 | 1145 | |
---|
.. | .. |
---|
1214 | 1259 | return ret; |
---|
1215 | 1260 | } |
---|
1216 | 1261 | |
---|
| 1262 | + /* |
---|
| 1263 | + * The jack detection configuration is in the same register |
---|
| 1264 | + * that is used to report jack detect status so is volatile |
---|
| 1265 | + * and not covered by the cache sync, restore it separately. |
---|
| 1266 | + */ |
---|
| 1267 | + aic31xx_set_jack(component, aic31xx->jack, NULL); |
---|
| 1268 | + |
---|
1217 | 1269 | return 0; |
---|
1218 | 1270 | } |
---|
1219 | 1271 | |
---|
.. | .. |
---|
1260 | 1312 | return 0; |
---|
1261 | 1313 | } |
---|
1262 | 1314 | |
---|
| 1315 | +static int aic31xx_set_jack(struct snd_soc_component *component, |
---|
| 1316 | + struct snd_soc_jack *jack, void *data) |
---|
| 1317 | +{ |
---|
| 1318 | + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); |
---|
| 1319 | + |
---|
| 1320 | + aic31xx->jack = jack; |
---|
| 1321 | + |
---|
| 1322 | + /* Enable/Disable jack detection */ |
---|
| 1323 | + regmap_write(aic31xx->regmap, AIC31XX_HSDETECT, |
---|
| 1324 | + jack ? AIC31XX_HSD_ENABLE : 0); |
---|
| 1325 | + |
---|
| 1326 | + return 0; |
---|
| 1327 | +} |
---|
| 1328 | + |
---|
1263 | 1329 | static int aic31xx_codec_probe(struct snd_soc_component *component) |
---|
1264 | 1330 | { |
---|
1265 | 1331 | struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); |
---|
.. | .. |
---|
1273 | 1339 | aic31xx->disable_nb[i].nb.notifier_call = |
---|
1274 | 1340 | aic31xx_regulator_event; |
---|
1275 | 1341 | aic31xx->disable_nb[i].aic31xx = aic31xx; |
---|
1276 | | - ret = regulator_register_notifier(aic31xx->supplies[i].consumer, |
---|
1277 | | - &aic31xx->disable_nb[i].nb); |
---|
| 1342 | + ret = devm_regulator_register_notifier( |
---|
| 1343 | + aic31xx->supplies[i].consumer, |
---|
| 1344 | + &aic31xx->disable_nb[i].nb); |
---|
1278 | 1345 | if (ret) { |
---|
1279 | 1346 | dev_err(component->dev, |
---|
1280 | 1347 | "Failed to request regulator notifier: %d\n", |
---|
.. | .. |
---|
1294 | 1361 | if (ret) |
---|
1295 | 1362 | return ret; |
---|
1296 | 1363 | |
---|
| 1364 | + /* set output common-mode voltage */ |
---|
| 1365 | + snd_soc_component_update_bits(component, AIC31XX_HPDRIVER, |
---|
| 1366 | + AIC31XX_HPD_OCMV_MASK, |
---|
| 1367 | + aic31xx->ocmv << AIC31XX_HPD_OCMV_SHIFT); |
---|
| 1368 | + |
---|
1297 | 1369 | return 0; |
---|
1298 | | -} |
---|
1299 | | - |
---|
1300 | | -static void aic31xx_codec_remove(struct snd_soc_component *component) |
---|
1301 | | -{ |
---|
1302 | | - struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); |
---|
1303 | | - int i; |
---|
1304 | | - |
---|
1305 | | - for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) |
---|
1306 | | - regulator_unregister_notifier(aic31xx->supplies[i].consumer, |
---|
1307 | | - &aic31xx->disable_nb[i].nb); |
---|
1308 | 1370 | } |
---|
1309 | 1371 | |
---|
1310 | 1372 | static const struct snd_soc_component_driver soc_codec_driver_aic31xx = { |
---|
1311 | 1373 | .probe = aic31xx_codec_probe, |
---|
1312 | | - .remove = aic31xx_codec_remove, |
---|
| 1374 | + .set_jack = aic31xx_set_jack, |
---|
1313 | 1375 | .set_bias_level = aic31xx_set_bias_level, |
---|
1314 | 1376 | .controls = common31xx_snd_controls, |
---|
1315 | 1377 | .num_controls = ARRAY_SIZE(common31xx_snd_controls), |
---|
.. | .. |
---|
1328 | 1390 | .hw_params = aic31xx_hw_params, |
---|
1329 | 1391 | .set_sysclk = aic31xx_set_dai_sysclk, |
---|
1330 | 1392 | .set_fmt = aic31xx_set_dai_fmt, |
---|
1331 | | - .digital_mute = aic31xx_dac_mute, |
---|
| 1393 | + .mute_stream = aic31xx_dac_mute, |
---|
| 1394 | + .no_capture_mute = 1, |
---|
1332 | 1395 | }; |
---|
1333 | 1396 | |
---|
1334 | 1397 | static struct snd_soc_dai_driver dac31xx_dai_driver[] = { |
---|
.. | .. |
---|
1391 | 1454 | MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match); |
---|
1392 | 1455 | #endif |
---|
1393 | 1456 | |
---|
| 1457 | +static irqreturn_t aic31xx_irq(int irq, void *data) |
---|
| 1458 | +{ |
---|
| 1459 | + struct aic31xx_priv *aic31xx = data; |
---|
| 1460 | + struct device *dev = aic31xx->dev; |
---|
| 1461 | + unsigned int value; |
---|
| 1462 | + bool handled = false; |
---|
| 1463 | + int ret; |
---|
| 1464 | + |
---|
| 1465 | + ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG, &value); |
---|
| 1466 | + if (ret) { |
---|
| 1467 | + dev_err(dev, "Failed to read interrupt mask: %d\n", ret); |
---|
| 1468 | + goto exit; |
---|
| 1469 | + } |
---|
| 1470 | + |
---|
| 1471 | + if (value) |
---|
| 1472 | + handled = true; |
---|
| 1473 | + else |
---|
| 1474 | + goto read_overflow; |
---|
| 1475 | + |
---|
| 1476 | + if (value & AIC31XX_HPLSCDETECT) |
---|
| 1477 | + dev_err(dev, "Short circuit on Left output is detected\n"); |
---|
| 1478 | + if (value & AIC31XX_HPRSCDETECT) |
---|
| 1479 | + dev_err(dev, "Short circuit on Right output is detected\n"); |
---|
| 1480 | + if (value & (AIC31XX_HSPLUG | AIC31XX_BUTTONPRESS)) { |
---|
| 1481 | + unsigned int val; |
---|
| 1482 | + int status = 0; |
---|
| 1483 | + |
---|
| 1484 | + ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG2, |
---|
| 1485 | + &val); |
---|
| 1486 | + if (ret) { |
---|
| 1487 | + dev_err(dev, "Failed to read interrupt mask: %d\n", |
---|
| 1488 | + ret); |
---|
| 1489 | + goto exit; |
---|
| 1490 | + } |
---|
| 1491 | + |
---|
| 1492 | + if (val & AIC31XX_BUTTONPRESS) |
---|
| 1493 | + status |= SND_JACK_BTN_0; |
---|
| 1494 | + |
---|
| 1495 | + ret = regmap_read(aic31xx->regmap, AIC31XX_HSDETECT, &val); |
---|
| 1496 | + if (ret) { |
---|
| 1497 | + dev_err(dev, "Failed to read headset type: %d\n", ret); |
---|
| 1498 | + goto exit; |
---|
| 1499 | + } |
---|
| 1500 | + |
---|
| 1501 | + switch ((val & AIC31XX_HSD_TYPE_MASK) >> |
---|
| 1502 | + AIC31XX_HSD_TYPE_SHIFT) { |
---|
| 1503 | + case AIC31XX_HSD_HP: |
---|
| 1504 | + status |= SND_JACK_HEADPHONE; |
---|
| 1505 | + break; |
---|
| 1506 | + case AIC31XX_HSD_HS: |
---|
| 1507 | + status |= SND_JACK_HEADSET; |
---|
| 1508 | + break; |
---|
| 1509 | + default: |
---|
| 1510 | + break; |
---|
| 1511 | + } |
---|
| 1512 | + |
---|
| 1513 | + if (aic31xx->jack) |
---|
| 1514 | + snd_soc_jack_report(aic31xx->jack, status, |
---|
| 1515 | + AIC31XX_JACK_MASK); |
---|
| 1516 | + } |
---|
| 1517 | + if (value & ~(AIC31XX_HPLSCDETECT | |
---|
| 1518 | + AIC31XX_HPRSCDETECT | |
---|
| 1519 | + AIC31XX_HSPLUG | |
---|
| 1520 | + AIC31XX_BUTTONPRESS)) |
---|
| 1521 | + dev_err(dev, "Unknown DAC interrupt flags: 0x%08x\n", value); |
---|
| 1522 | + |
---|
| 1523 | +read_overflow: |
---|
| 1524 | + ret = regmap_read(aic31xx->regmap, AIC31XX_OFFLAG, &value); |
---|
| 1525 | + if (ret) { |
---|
| 1526 | + dev_err(dev, "Failed to read overflow flag: %d\n", ret); |
---|
| 1527 | + goto exit; |
---|
| 1528 | + } |
---|
| 1529 | + |
---|
| 1530 | + if (value) |
---|
| 1531 | + handled = true; |
---|
| 1532 | + else |
---|
| 1533 | + goto exit; |
---|
| 1534 | + |
---|
| 1535 | + if (value & AIC31XX_DAC_OF_LEFT) |
---|
| 1536 | + dev_warn(dev, "Left-channel DAC overflow has occurred\n"); |
---|
| 1537 | + if (value & AIC31XX_DAC_OF_RIGHT) |
---|
| 1538 | + dev_warn(dev, "Right-channel DAC overflow has occurred\n"); |
---|
| 1539 | + if (value & AIC31XX_DAC_OF_SHIFTER) |
---|
| 1540 | + dev_warn(dev, "DAC barrel shifter overflow has occurred\n"); |
---|
| 1541 | + if (value & AIC31XX_ADC_OF) |
---|
| 1542 | + dev_warn(dev, "ADC overflow has occurred\n"); |
---|
| 1543 | + if (value & AIC31XX_ADC_OF_SHIFTER) |
---|
| 1544 | + dev_warn(dev, "ADC barrel shifter overflow has occurred\n"); |
---|
| 1545 | + if (value & ~(AIC31XX_DAC_OF_LEFT | |
---|
| 1546 | + AIC31XX_DAC_OF_RIGHT | |
---|
| 1547 | + AIC31XX_DAC_OF_SHIFTER | |
---|
| 1548 | + AIC31XX_ADC_OF | |
---|
| 1549 | + AIC31XX_ADC_OF_SHIFTER)) |
---|
| 1550 | + dev_warn(dev, "Unknown overflow interrupt flags: 0x%08x\n", value); |
---|
| 1551 | + |
---|
| 1552 | +exit: |
---|
| 1553 | + if (handled) |
---|
| 1554 | + return IRQ_HANDLED; |
---|
| 1555 | + else |
---|
| 1556 | + return IRQ_NONE; |
---|
| 1557 | +} |
---|
| 1558 | + |
---|
| 1559 | +static void aic31xx_configure_ocmv(struct aic31xx_priv *priv) |
---|
| 1560 | +{ |
---|
| 1561 | + struct device *dev = priv->dev; |
---|
| 1562 | + int dvdd, avdd; |
---|
| 1563 | + u32 value; |
---|
| 1564 | + |
---|
| 1565 | + if (dev->fwnode && |
---|
| 1566 | + fwnode_property_read_u32(dev->fwnode, "ai31xx-ocmv", &value)) { |
---|
| 1567 | + /* OCMV setting is forced by DT */ |
---|
| 1568 | + if (value <= 3) { |
---|
| 1569 | + priv->ocmv = value; |
---|
| 1570 | + return; |
---|
| 1571 | + } |
---|
| 1572 | + } |
---|
| 1573 | + |
---|
| 1574 | + avdd = regulator_get_voltage(priv->supplies[3].consumer); |
---|
| 1575 | + dvdd = regulator_get_voltage(priv->supplies[5].consumer); |
---|
| 1576 | + |
---|
| 1577 | + if (avdd > 3600000 || dvdd > 1950000) { |
---|
| 1578 | + dev_warn(dev, |
---|
| 1579 | + "Too high supply voltage(s) AVDD: %d, DVDD: %d\n", |
---|
| 1580 | + avdd, dvdd); |
---|
| 1581 | + } else if (avdd == 3600000 && dvdd == 1950000) { |
---|
| 1582 | + priv->ocmv = AIC31XX_HPD_OCMV_1_8V; |
---|
| 1583 | + } else if (avdd >= 3300000 && dvdd >= 1800000) { |
---|
| 1584 | + priv->ocmv = AIC31XX_HPD_OCMV_1_65V; |
---|
| 1585 | + } else if (avdd >= 3000000 && dvdd >= 1650000) { |
---|
| 1586 | + priv->ocmv = AIC31XX_HPD_OCMV_1_5V; |
---|
| 1587 | + } else if (avdd >= 2700000 && dvdd >= 1525000) { |
---|
| 1588 | + priv->ocmv = AIC31XX_HPD_OCMV_1_35V; |
---|
| 1589 | + } else { |
---|
| 1590 | + dev_warn(dev, |
---|
| 1591 | + "Invalid supply voltage(s) AVDD: %d, DVDD: %d\n", |
---|
| 1592 | + avdd, dvdd); |
---|
| 1593 | + } |
---|
| 1594 | +} |
---|
| 1595 | + |
---|
1394 | 1596 | static int aic31xx_i2c_probe(struct i2c_client *i2c, |
---|
1395 | 1597 | const struct i2c_device_id *id) |
---|
1396 | 1598 | { |
---|
.. | .. |
---|
1413 | 1615 | return ret; |
---|
1414 | 1616 | } |
---|
1415 | 1617 | aic31xx->dev = &i2c->dev; |
---|
| 1618 | + aic31xx->irq = i2c->irq; |
---|
1416 | 1619 | |
---|
1417 | 1620 | aic31xx->codec_type = id->driver_data; |
---|
1418 | 1621 | |
---|
.. | .. |
---|
1459 | 1662 | return ret; |
---|
1460 | 1663 | } |
---|
1461 | 1664 | |
---|
| 1665 | + aic31xx_configure_ocmv(aic31xx); |
---|
| 1666 | + |
---|
| 1667 | + if (aic31xx->irq > 0) { |
---|
| 1668 | + regmap_update_bits(aic31xx->regmap, AIC31XX_GPIO1, |
---|
| 1669 | + AIC31XX_GPIO1_FUNC_MASK, |
---|
| 1670 | + AIC31XX_GPIO1_INT1 << |
---|
| 1671 | + AIC31XX_GPIO1_FUNC_SHIFT); |
---|
| 1672 | + |
---|
| 1673 | + regmap_write(aic31xx->regmap, AIC31XX_INT1CTRL, |
---|
| 1674 | + AIC31XX_HSPLUGDET | |
---|
| 1675 | + AIC31XX_BUTTONPRESSDET | |
---|
| 1676 | + AIC31XX_SC | |
---|
| 1677 | + AIC31XX_ENGINE); |
---|
| 1678 | + |
---|
| 1679 | + ret = devm_request_threaded_irq(aic31xx->dev, aic31xx->irq, |
---|
| 1680 | + NULL, aic31xx_irq, |
---|
| 1681 | + IRQF_ONESHOT, "aic31xx-irq", |
---|
| 1682 | + aic31xx); |
---|
| 1683 | + if (ret) { |
---|
| 1684 | + dev_err(aic31xx->dev, "Unable to request IRQ\n"); |
---|
| 1685 | + return ret; |
---|
| 1686 | + } |
---|
| 1687 | + } |
---|
| 1688 | + |
---|
1462 | 1689 | if (aic31xx->codec_type & DAC31XX_BIT) |
---|
1463 | 1690 | return devm_snd_soc_register_component(&i2c->dev, |
---|
1464 | 1691 | &soc_codec_driver_aic31xx, |
---|