Lines Matching defs:aic31xx

157 	struct aic31xx_priv *aic31xx;
360 static int aic31xx_wait_bits(struct aic31xx_priv *aic31xx, unsigned int reg,
366 int ret = regmap_read(aic31xx->regmap, reg, &bits);
370 ret = regmap_read(aic31xx->regmap, reg, &bits);
374 dev_err(aic31xx->dev,
389 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
429 return aic31xx_wait_bits(aic31xx, reg, mask, mask,
432 return aic31xx_wait_bits(aic31xx, reg, mask, 0,
492 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
499 aic31xx->micbias_vg <<
755 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
757 if (!(aic31xx->codec_type & DAC31XX_BIT))
764 if (aic31xx->codec_type & AIC31XX_STEREO_CLASS_D_BIT)
779 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
782 if (aic31xx->codec_type & DAC31XX_BIT) {
806 if (aic31xx->codec_type & AIC31XX_STEREO_CLASS_D_BIT) {
836 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
843 if (!aic31xx->sysclk || !aic31xx->p_div) {
847 mclk_p = aic31xx->sysclk / aic31xx->p_div;
891 (aic31xx->p_div << 4) | 0x01);
920 aic31xx->rate_div_line = i;
926 aic31xx->p_div,
999 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1004 aic31xx->master_dapm_route_applied) {
1011 if (!ret && !(aic31xx->codec_type & DAC31XX_BIT))
1019 aic31xx->master_dapm_route_applied = false;
1021 !aic31xx->master_dapm_route_applied) {
1028 if (!ret && !(aic31xx->codec_type & DAC31XX_BIT))
1036 aic31xx->master_dapm_route_applied = true;
1130 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1140 dev_err(aic31xx->dev, "%s: Too high mclk frequency %u\n",
1144 aic31xx->p_div = i;
1147 if (aic31xx_divs[i].mclk_p == freq / aic31xx->p_div)
1150 dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
1159 aic31xx->sysclk = freq;
1169 struct aic31xx_priv *aic31xx = disable_nb->aic31xx;
1176 if (aic31xx->gpio_reset)
1177 gpiod_set_value(aic31xx->gpio_reset, 1);
1179 regcache_mark_dirty(aic31xx->regmap);
1180 dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__);
1186 static int aic31xx_reset(struct aic31xx_priv *aic31xx)
1190 if (aic31xx->gpio_reset) {
1191 gpiod_set_value(aic31xx->gpio_reset, 1);
1193 gpiod_set_value(aic31xx->gpio_reset, 0);
1195 ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
1204 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1209 aic31xx_divs[aic31xx->rate_div_line].rate);
1214 if (aic31xx_divs[aic31xx->rate_div_line].nadc)
1216 if (aic31xx_divs[aic31xx->rate_div_line].madc)
1237 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1240 ret = regulator_bulk_enable(ARRAY_SIZE(aic31xx->supplies),
1241 aic31xx->supplies);
1245 regcache_cache_only(aic31xx->regmap, false);
1248 ret = aic31xx_reset(aic31xx);
1250 dev_err(aic31xx->dev, "Could not reset device: %d\n", ret);
1252 ret = regcache_sync(aic31xx->regmap);
1256 regcache_cache_only(aic31xx->regmap, true);
1257 regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
1258 aic31xx->supplies);
1267 aic31xx_set_jack(component, aic31xx->jack, NULL);
1274 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1276 regcache_cache_only(aic31xx->regmap, true);
1277 regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
1278 aic31xx->supplies);
1318 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1320 aic31xx->jack = jack;
1323 regmap_write(aic31xx->regmap, AIC31XX_HSDETECT,
1331 struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component);
1334 dev_dbg(aic31xx->dev, "## %s\n", __func__);
1336 aic31xx->component = component;
1338 for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) {
1339 aic31xx->disable_nb[i].nb.notifier_call =
1341 aic31xx->disable_nb[i].aic31xx = aic31xx;
1343 aic31xx->supplies[i].consumer,
1344 &aic31xx->disable_nb[i].nb);
1353 regcache_cache_only(aic31xx->regmap, true);
1354 regcache_mark_dirty(aic31xx->regmap);
1367 aic31xx->ocmv << AIC31XX_HPD_OCMV_SHIFT);
1459 struct aic31xx_priv *aic31xx = data;
1460 struct device *dev = aic31xx->dev;
1465 ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG, &value);
1484 ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG2,
1495 ret = regmap_read(aic31xx->regmap, AIC31XX_HSDETECT, &val);
1513 if (aic31xx->jack)
1514 snd_soc_jack_report(aic31xx->jack, status,
1524 ret = regmap_read(aic31xx->regmap, AIC31XX_OFFLAG, &value);
1599 struct aic31xx_priv *aic31xx;
1606 aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
1607 if (!aic31xx)
1610 aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
1611 if (IS_ERR(aic31xx->regmap)) {
1612 ret = PTR_ERR(aic31xx->regmap);
1617 aic31xx->dev = &i2c->dev;
1618 aic31xx->irq = i2c->irq;
1620 aic31xx->codec_type = id->driver_data;
1622 dev_set_drvdata(aic31xx->dev, aic31xx);
1624 fwnode_property_read_u32(aic31xx->dev->fwnode, "ai31xx-micbias-vg",
1630 aic31xx->micbias_vg = micbias_value;
1633 dev_err(aic31xx->dev, "Bad ai31xx-micbias-vg value %d\n",
1635 aic31xx->micbias_vg = MICBIAS_2_0V;
1638 if (dev_get_platdata(aic31xx->dev)) {
1639 memcpy(&aic31xx->pdata, dev_get_platdata(aic31xx->dev), sizeof(aic31xx->pdata));
1640 aic31xx->codec_type = aic31xx->pdata.codec_type;
1641 aic31xx->micbias_vg = aic31xx->pdata.micbias_vg;
1644 aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
1646 if (IS_ERR(aic31xx->gpio_reset)) {
1647 if (PTR_ERR(aic31xx->gpio_reset) != -EPROBE_DEFER)
1648 dev_err(aic31xx->dev, "not able to acquire gpio\n");
1649 return PTR_ERR(aic31xx->gpio_reset);
1652 for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
1653 aic31xx->supplies[i].supply = aic31xx_supply_names[i];
1655 ret = devm_regulator_bulk_get(aic31xx->dev,
1656 ARRAY_SIZE(aic31xx->supplies),
1657 aic31xx->supplies);
1660 dev_err(aic31xx->dev,
1665 aic31xx_configure_ocmv(aic31xx);
1667 if (aic31xx->irq > 0) {
1668 regmap_update_bits(aic31xx->regmap, AIC31XX_GPIO1,
1673 regmap_write(aic31xx->regmap, AIC31XX_INT1CTRL,
1679 ret = devm_request_threaded_irq(aic31xx->dev, aic31xx->irq,
1681 IRQF_ONESHOT, "aic31xx-irq",
1682 aic31xx);
1684 dev_err(aic31xx->dev, "Unable to request IRQ\n");
1689 if (aic31xx->codec_type & DAC31XX_BIT)