adau1977          224 sound/soc/codecs/adau1977.c static int adau1977_reset(struct adau1977 *adau1977)
adau1977          234 sound/soc/codecs/adau1977.c 	regcache_cache_bypass(adau1977->regmap, true);
adau1977          235 sound/soc/codecs/adau1977.c 	ret = regmap_write(adau1977->regmap, ADAU1977_REG_POWER,
adau1977          237 sound/soc/codecs/adau1977.c 	regcache_cache_bypass(adau1977->regmap, false);
adau1977          264 sound/soc/codecs/adau1977.c static int adau1977_lookup_mcs(struct adau1977 *adau1977, unsigned int rate,
adau1977          277 sound/soc/codecs/adau1977.c 	if (adau1977->sysclk % rate != 0)
adau1977          280 sound/soc/codecs/adau1977.c 	mcs = adau1977->sysclk / rate;
adau1977          297 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
adau1977          309 sound/soc/codecs/adau1977.c 	if (adau1977->sysclk_src == ADAU1977_SYSCLK_SRC_MCLK) {
adau1977          310 sound/soc/codecs/adau1977.c 		mcs = adau1977_lookup_mcs(adau1977, rate, fs);
adau1977          320 sound/soc/codecs/adau1977.c 	if (adau1977->right_j) {
adau1977          334 sound/soc/codecs/adau1977.c 	if (adau1977->master) {
adau1977          350 sound/soc/codecs/adau1977.c 		if (adau1977->slot_width)
adau1977          351 sound/soc/codecs/adau1977.c 			slot_width = adau1977->slot_width;
adau1977          358 sound/soc/codecs/adau1977.c 		ret = regmap_update_bits(adau1977->regmap,
adau1977          367 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_CTRL0,
adau1977          372 sound/soc/codecs/adau1977.c 	return regmap_update_bits(adau1977->regmap, ADAU1977_REG_PLL,
adau1977          376 sound/soc/codecs/adau1977.c static int adau1977_power_disable(struct adau1977 *adau1977)
adau1977          380 sound/soc/codecs/adau1977.c 	if (!adau1977->enabled)
adau1977          383 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_POWER,
adau1977          388 sound/soc/codecs/adau1977.c 	regcache_mark_dirty(adau1977->regmap);
adau1977          390 sound/soc/codecs/adau1977.c 	gpiod_set_value_cansleep(adau1977->reset_gpio, 0);
adau1977          392 sound/soc/codecs/adau1977.c 	regcache_cache_only(adau1977->regmap, true);
adau1977          394 sound/soc/codecs/adau1977.c 	regulator_disable(adau1977->avdd_reg);
adau1977          395 sound/soc/codecs/adau1977.c 	if (adau1977->dvdd_reg)
adau1977          396 sound/soc/codecs/adau1977.c 		regulator_disable(adau1977->dvdd_reg);
adau1977          398 sound/soc/codecs/adau1977.c 	adau1977->enabled = false;
adau1977          403 sound/soc/codecs/adau1977.c static int adau1977_power_enable(struct adau1977 *adau1977)
adau1977          408 sound/soc/codecs/adau1977.c 	if (adau1977->enabled)
adau1977          411 sound/soc/codecs/adau1977.c 	ret = regulator_enable(adau1977->avdd_reg);
adau1977          415 sound/soc/codecs/adau1977.c 	if (adau1977->dvdd_reg) {
adau1977          416 sound/soc/codecs/adau1977.c 		ret = regulator_enable(adau1977->dvdd_reg);
adau1977          421 sound/soc/codecs/adau1977.c 	gpiod_set_value_cansleep(adau1977->reset_gpio, 1);
adau1977          423 sound/soc/codecs/adau1977.c 	regcache_cache_only(adau1977->regmap, false);
adau1977          425 sound/soc/codecs/adau1977.c 	if (adau1977->switch_mode)
adau1977          426 sound/soc/codecs/adau1977.c 		adau1977->switch_mode(adau1977->dev);
adau1977          428 sound/soc/codecs/adau1977.c 	ret = adau1977_reset(adau1977);
adau1977          432 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_POWER,
adau1977          437 sound/soc/codecs/adau1977.c 	ret = regcache_sync(adau1977->regmap);
adau1977          448 sound/soc/codecs/adau1977.c 	ret = regmap_read(adau1977->regmap, ADAU1977_REG_PLL, &val);
adau1977          453 sound/soc/codecs/adau1977.c 		regcache_cache_bypass(adau1977->regmap, true);
adau1977          454 sound/soc/codecs/adau1977.c 		ret = regmap_write(adau1977->regmap, ADAU1977_REG_PLL,
adau1977          458 sound/soc/codecs/adau1977.c 		regcache_cache_bypass(adau1977->regmap, false);
adau1977          461 sound/soc/codecs/adau1977.c 	adau1977->enabled = true;
adau1977          466 sound/soc/codecs/adau1977.c 	if (adau1977->dvdd_reg)
adau1977          467 sound/soc/codecs/adau1977.c 		regulator_disable(adau1977->dvdd_reg);
adau1977          469 sound/soc/codecs/adau1977.c 		regulator_disable(adau1977->avdd_reg);
adau1977          476 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
adau1977          486 sound/soc/codecs/adau1977.c 			ret = adau1977_power_enable(adau1977);
adau1977          489 sound/soc/codecs/adau1977.c 		ret = adau1977_power_disable(adau1977);
adau1977          499 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
adau1977          507 sound/soc/codecs/adau1977.c 		adau1977->slot_width = 0;
adau1977          508 sound/soc/codecs/adau1977.c 		adau1977->max_master_fs = 192000;
adau1977          509 sound/soc/codecs/adau1977.c 		return regmap_update_bits(adau1977->regmap,
adau1977          537 sound/soc/codecs/adau1977.c 		if (adau1977->master)
adau1977          565 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_OVERTEMP,
adau1977          573 sound/soc/codecs/adau1977.c 	ret = regmap_write(adau1977->regmap, ADAU1977_REG_CMAP12,
adau1977          579 sound/soc/codecs/adau1977.c 	ret = regmap_write(adau1977->regmap, ADAU1977_REG_CMAP34,
adau1977          585 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_CTRL0,
adau1977          590 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_CTRL1,
adau1977          595 sound/soc/codecs/adau1977.c 	adau1977->slot_width = width;
adau1977          598 sound/soc/codecs/adau1977.c 	adau1977->max_master_fs = min(192000, 24576000 / width / slots);
adau1977          605 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
adau1977          613 sound/soc/codecs/adau1977.c 	return regmap_update_bits(adau1977->regmap, ADAU1977_REG_MISC_CONTROL,
adau1977          619 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
adau1977          626 sound/soc/codecs/adau1977.c 		adau1977->master = false;
adau1977          630 sound/soc/codecs/adau1977.c 		adau1977->master = true;
adau1977          655 sound/soc/codecs/adau1977.c 	adau1977->right_j = false;
adau1977          666 sound/soc/codecs/adau1977.c 		adau1977->right_j = true;
adau1977          686 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_BLOCK_POWER_SAI,
adau1977          692 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_CTRL0,
adau1977          698 sound/soc/codecs/adau1977.c 	return regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_CTRL1,
adau1977          706 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
adau1977          709 sound/soc/codecs/adau1977.c 	if (adau1977->slot_width == 16)
adau1977          711 sound/soc/codecs/adau1977.c 	else if (adau1977->right_j || adau1977->slot_width == 24)
adau1977          716 sound/soc/codecs/adau1977.c 		SNDRV_PCM_HW_PARAM_RATE, &adau1977->constraints);
adau1977          718 sound/soc/codecs/adau1977.c 	if (adau1977->master)
adau1977          720 sound/soc/codecs/adau1977.c 			SNDRV_PCM_HW_PARAM_RATE, 8000, adau1977->max_master_fs);
adau1977          731 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
adau1977          739 sound/soc/codecs/adau1977.c 	return regmap_update_bits(adau1977->regmap, ADAU1977_REG_SAI_OVERTEMP,
adau1977          795 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
adau1977          834 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_PLL,
adau1977          839 sound/soc/codecs/adau1977.c 	adau1977->constraints.mask = mask;
adau1977          840 sound/soc/codecs/adau1977.c 	adau1977->sysclk_src = source;
adau1977          841 sound/soc/codecs/adau1977.c 	adau1977->sysclk = freq;
adau1977          849 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
adau1977          852 sound/soc/codecs/adau1977.c 	switch (adau1977->type) {
adau1977          882 sound/soc/codecs/adau1977.c static int adau1977_setup_micbias(struct adau1977 *adau1977)
adau1977          884 sound/soc/codecs/adau1977.c 	struct adau1977_platform_data *pdata = adau1977->dev->platform_data;
adau1977          889 sound/soc/codecs/adau1977.c 	else if (device_property_read_u32(adau1977->dev, "adi,micbias",
adau1977          894 sound/soc/codecs/adau1977.c 		dev_err(adau1977->dev, "Invalid value for 'adi,micbias'\n");
adau1977          898 sound/soc/codecs/adau1977.c 	return regmap_update_bits(adau1977->regmap, ADAU1977_REG_MICBIAS,
adau1977          907 sound/soc/codecs/adau1977.c 	struct adau1977 *adau1977;
adau1977          913 sound/soc/codecs/adau1977.c 	adau1977 = devm_kzalloc(dev, sizeof(*adau1977), GFP_KERNEL);
adau1977          914 sound/soc/codecs/adau1977.c 	if (adau1977 == NULL)
adau1977          917 sound/soc/codecs/adau1977.c 	adau1977->dev = dev;
adau1977          918 sound/soc/codecs/adau1977.c 	adau1977->type = type;
adau1977          919 sound/soc/codecs/adau1977.c 	adau1977->regmap = regmap;
adau1977          920 sound/soc/codecs/adau1977.c 	adau1977->switch_mode = switch_mode;
adau1977          921 sound/soc/codecs/adau1977.c 	adau1977->max_master_fs = 192000;
adau1977          923 sound/soc/codecs/adau1977.c 	adau1977->constraints.list = adau1977_rates;
adau1977          924 sound/soc/codecs/adau1977.c 	adau1977->constraints.count = ARRAY_SIZE(adau1977_rates);
adau1977          926 sound/soc/codecs/adau1977.c 	adau1977->avdd_reg = devm_regulator_get(dev, "AVDD");
adau1977          927 sound/soc/codecs/adau1977.c 	if (IS_ERR(adau1977->avdd_reg))
adau1977          928 sound/soc/codecs/adau1977.c 		return PTR_ERR(adau1977->avdd_reg);
adau1977          930 sound/soc/codecs/adau1977.c 	adau1977->dvdd_reg = devm_regulator_get_optional(dev, "DVDD");
adau1977          931 sound/soc/codecs/adau1977.c 	if (IS_ERR(adau1977->dvdd_reg)) {
adau1977          932 sound/soc/codecs/adau1977.c 		if (PTR_ERR(adau1977->dvdd_reg) != -ENODEV)
adau1977          933 sound/soc/codecs/adau1977.c 			return PTR_ERR(adau1977->dvdd_reg);
adau1977          934 sound/soc/codecs/adau1977.c 		adau1977->dvdd_reg = NULL;
adau1977          937 sound/soc/codecs/adau1977.c 	adau1977->reset_gpio = devm_gpiod_get_optional(dev, "reset",
adau1977          939 sound/soc/codecs/adau1977.c 	if (IS_ERR(adau1977->reset_gpio))
adau1977          940 sound/soc/codecs/adau1977.c 		return PTR_ERR(adau1977->reset_gpio);
adau1977          942 sound/soc/codecs/adau1977.c 	dev_set_drvdata(dev, adau1977);
adau1977          944 sound/soc/codecs/adau1977.c 	if (adau1977->reset_gpio)
adau1977          947 sound/soc/codecs/adau1977.c 	ret = adau1977_power_enable(adau1977);
adau1977          952 sound/soc/codecs/adau1977.c 		ret = adau1977_setup_micbias(adau1977);
adau1977          957 sound/soc/codecs/adau1977.c 	if (adau1977->dvdd_reg)
adau1977          962 sound/soc/codecs/adau1977.c 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_BLOCK_POWER_SAI,
adau1977          967 sound/soc/codecs/adau1977.c 	ret = adau1977_power_disable(adau1977);
adau1977          975 sound/soc/codecs/adau1977.c 	adau1977_power_disable(adau1977);