Lines Matching refs:sta350

305 	struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);  in sta350_coefficient_get()  local
311 mutex_lock(&sta350->coeff_lock); in sta350_coefficient_get()
314 regmap_read(sta350->regmap, STA350_CFUD, &cfud); in sta350_coefficient_get()
320 regmap_write(sta350->regmap, STA350_CFUD, cfud); in sta350_coefficient_get()
322 regmap_write(sta350->regmap, STA350_CFADDR2, index); in sta350_coefficient_get()
324 regmap_write(sta350->regmap, STA350_CFUD, cfud | 0x04); in sta350_coefficient_get()
326 regmap_write(sta350->regmap, STA350_CFUD, cfud | 0x08); in sta350_coefficient_get()
333 regmap_read(sta350->regmap, STA350_B1CF1 + i, &val); in sta350_coefficient_get()
338 mutex_unlock(&sta350->coeff_lock); in sta350_coefficient_get()
347 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_coefficient_put() local
354 regmap_read(sta350->regmap, STA350_CFUD, &cfud); in sta350_coefficient_put()
360 regmap_write(sta350->regmap, STA350_CFUD, cfud); in sta350_coefficient_put()
362 regmap_write(sta350->regmap, STA350_CFADDR2, index); in sta350_coefficient_put()
364 sta350->coef_shadow[index + i] = in sta350_coefficient_put()
369 regmap_write(sta350->regmap, STA350_B1CF1 + i, in sta350_coefficient_put()
372 regmap_write(sta350->regmap, STA350_CFUD, cfud | 0x01); in sta350_coefficient_put()
374 regmap_write(sta350->regmap, STA350_CFUD, cfud | 0x02); in sta350_coefficient_put()
383 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_sync_coef_shadow() local
388 regmap_read(sta350->regmap, STA350_CFUD, &cfud); in sta350_sync_coef_shadow()
392 regmap_write(sta350->regmap, STA350_CFADDR2, i); in sta350_sync_coef_shadow()
393 regmap_write(sta350->regmap, STA350_B1CF1, in sta350_sync_coef_shadow()
394 (sta350->coef_shadow[i] >> 16) & 0xff); in sta350_sync_coef_shadow()
395 regmap_write(sta350->regmap, STA350_B1CF2, in sta350_sync_coef_shadow()
396 (sta350->coef_shadow[i] >> 8) & 0xff); in sta350_sync_coef_shadow()
397 regmap_write(sta350->regmap, STA350_B1CF3, in sta350_sync_coef_shadow()
398 (sta350->coef_shadow[i]) & 0xff); in sta350_sync_coef_shadow()
403 regmap_write(sta350->regmap, STA350_CFUD, cfud); in sta350_sync_coef_shadow()
404 regmap_write(sta350->regmap, STA350_CFUD, cfud | 0x01); in sta350_sync_coef_shadow()
411 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_cache_sync() local
416 regmap_read(sta350->regmap, STA350_CFUD, &mute); in sta350_cache_sync()
417 regmap_write(sta350->regmap, STA350_MMUTE, mute | STA350_MMUTE_MMUTE); in sta350_cache_sync()
419 rc = regcache_sync(sta350->regmap); in sta350_cache_sync()
420 regmap_write(sta350->regmap, STA350_MMUTE, mute); in sta350_cache_sync()
609 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_set_dai_sysclk() local
612 sta350->mclk = freq; in sta350_set_dai_sysclk()
629 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_set_dai_fmt() local
643 sta350->format = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in sta350_set_dai_fmt()
660 return regmap_update_bits(sta350->regmap, STA350_CONFB, in sta350_set_dai_fmt()
678 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_hw_params() local
684 if (!sta350->mclk) { in sta350_hw_params()
691 ratio = sta350->mclk / rate; in sta350_hw_params()
728 switch (sta350->format) { in sta350_hw_params()
743 switch (sta350->format) { in sta350_hw_params()
758 switch (sta350->format) { in sta350_hw_params()
773 switch (sta350->format) { in sta350_hw_params()
790 ret = regmap_update_bits(sta350->regmap, STA350_CONFA, in sta350_hw_params()
796 ret = regmap_update_bits(sta350->regmap, STA350_CONFB, in sta350_hw_params()
805 static int sta350_startup_sequence(struct sta350_priv *sta350) in sta350_startup_sequence() argument
807 if (sta350->gpiod_power_down) in sta350_startup_sequence()
808 gpiod_set_value(sta350->gpiod_power_down, 1); in sta350_startup_sequence()
810 if (sta350->gpiod_nreset) { in sta350_startup_sequence()
811 gpiod_set_value(sta350->gpiod_nreset, 0); in sta350_startup_sequence()
813 gpiod_set_value(sta350->gpiod_nreset, 1); in sta350_startup_sequence()
832 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_set_bias_level() local
842 regmap_update_bits(sta350->regmap, STA350_CONFF, in sta350_set_bias_level()
850 ARRAY_SIZE(sta350->supplies), in sta350_set_bias_level()
851 sta350->supplies); in sta350_set_bias_level()
858 sta350_startup_sequence(sta350); in sta350_set_bias_level()
863 regmap_update_bits(sta350->regmap, STA350_CONFF, in sta350_set_bias_level()
871 regmap_update_bits(sta350->regmap, STA350_CONFF, in sta350_set_bias_level()
875 if (sta350->gpiod_power_down) in sta350_set_bias_level()
876 gpiod_set_value(sta350->gpiod_power_down, 0); in sta350_set_bias_level()
878 if (sta350->gpiod_nreset) in sta350_set_bias_level()
879 gpiod_set_value(sta350->gpiod_nreset, 0); in sta350_set_bias_level()
881 regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), in sta350_set_bias_level()
882 sta350->supplies); in sta350_set_bias_level()
908 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_probe() local
909 struct sta350_platform_data *pdata = sta350->pdata; in sta350_probe()
912 ret = regulator_bulk_enable(ARRAY_SIZE(sta350->supplies), in sta350_probe()
913 sta350->supplies); in sta350_probe()
919 ret = sta350_startup_sequence(sta350); in sta350_probe()
932 regmap_update_bits(sta350->regmap, STA350_CONFA, in sta350_probe()
938 regmap_update_bits(sta350->regmap, STA350_CONFC, in sta350_probe()
942 regmap_update_bits(sta350->regmap, STA350_CONFC, in sta350_probe()
946 regmap_update_bits(sta350->regmap, in sta350_probe()
953 regmap_update_bits(sta350->regmap, STA350_CONFE, in sta350_probe()
957 regmap_update_bits(sta350->regmap, STA350_CONFE, in sta350_probe()
961 regmap_update_bits(sta350->regmap, STA350_CONFE, in sta350_probe()
965 regmap_update_bits(sta350->regmap, STA350_CONFE, in sta350_probe()
969 regmap_update_bits(sta350->regmap, STA350_CONFE, in sta350_probe()
974 regmap_update_bits(sta350->regmap, STA350_CONFF, in sta350_probe()
978 regmap_update_bits(sta350->regmap, STA350_CONFF, in sta350_probe()
984 regmap_update_bits(sta350->regmap, STA350_C1CFG, in sta350_probe()
988 regmap_update_bits(sta350->regmap, STA350_C2CFG, in sta350_probe()
992 regmap_update_bits(sta350->regmap, STA350_C3CFG, in sta350_probe()
998 regmap_update_bits(sta350->regmap, STA350_MISC1, in sta350_probe()
1002 regmap_update_bits(sta350->regmap, STA350_MISC1, in sta350_probe()
1006 regmap_update_bits(sta350->regmap, STA350_MISC1, in sta350_probe()
1010 regmap_update_bits(sta350->regmap, STA350_MISC1, in sta350_probe()
1015 regmap_update_bits(sta350->regmap, STA350_MISC2, in sta350_probe()
1022 sta350->coef_shadow[i] = 0x400000; in sta350_probe()
1024 sta350->coef_shadow[i] = 0x7fffff; in sta350_probe()
1025 sta350->coef_shadow[55] = 0x5a9df7; in sta350_probe()
1026 sta350->coef_shadow[56] = 0x7fffff; in sta350_probe()
1027 sta350->coef_shadow[59] = 0x7fffff; in sta350_probe()
1028 sta350->coef_shadow[60] = 0x400000; in sta350_probe()
1029 sta350->coef_shadow[61] = 0x400000; in sta350_probe()
1033 regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies); in sta350_probe()
1040 struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component); in sta350_remove() local
1042 regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies); in sta350_remove()
1087 static int sta350_probe_dt(struct device *dev, struct sta350_priv *sta350) in sta350_probe_dt() argument
1172 sta350->pdata = pdata; in sta350_probe_dt()
1181 struct sta350_priv *sta350; in sta350_i2c_probe() local
1184 sta350 = devm_kzalloc(dev, sizeof(struct sta350_priv), GFP_KERNEL); in sta350_i2c_probe()
1185 if (!sta350) in sta350_i2c_probe()
1188 mutex_init(&sta350->coeff_lock); in sta350_i2c_probe()
1189 sta350->pdata = dev_get_platdata(dev); in sta350_i2c_probe()
1193 ret = sta350_probe_dt(dev, sta350); in sta350_i2c_probe()
1200 sta350->gpiod_nreset = devm_gpiod_get_optional(dev, "reset", in sta350_i2c_probe()
1202 if (IS_ERR(sta350->gpiod_nreset)) in sta350_i2c_probe()
1203 return PTR_ERR(sta350->gpiod_nreset); in sta350_i2c_probe()
1205 sta350->gpiod_power_down = devm_gpiod_get_optional(dev, "power-down", in sta350_i2c_probe()
1207 if (IS_ERR(sta350->gpiod_power_down)) in sta350_i2c_probe()
1208 return PTR_ERR(sta350->gpiod_power_down); in sta350_i2c_probe()
1211 for (i = 0; i < ARRAY_SIZE(sta350->supplies); i++) in sta350_i2c_probe()
1212 sta350->supplies[i].supply = sta350_supply_names[i]; in sta350_i2c_probe()
1214 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sta350->supplies), in sta350_i2c_probe()
1215 sta350->supplies); in sta350_i2c_probe()
1221 sta350->regmap = devm_regmap_init_i2c(i2c, &sta350_regmap); in sta350_i2c_probe()
1222 if (IS_ERR(sta350->regmap)) { in sta350_i2c_probe()
1223 ret = PTR_ERR(sta350->regmap); in sta350_i2c_probe()
1228 i2c_set_clientdata(i2c, sta350); in sta350_i2c_probe()