Lines Matching full:ac97
3 // soc-ac97.c -- ALSA SoC Audio Layer AC97 support
125 static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97, in snd_soc_ac97_init_gpio() argument
134 ac97->gpio_priv = gpio_priv; in snd_soc_ac97_init_gpio()
147 static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97) in snd_soc_ac97_free_gpio() argument
149 gpiochip_remove(&ac97->gpio_priv->gpio_chip); in snd_soc_ac97_free_gpio()
152 static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97, in snd_soc_ac97_init_gpio() argument
158 static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97) in snd_soc_ac97_free_gpio() argument
168 * it. The caller is responsible to either call device_add(&ac97->dev) to
169 * register the device, or to call put_device(&ac97->dev) to free the device.
175 struct snd_ac97 *ac97; in snd_soc_alloc_ac97_component() local
177 ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); in snd_soc_alloc_ac97_component()
178 if (ac97 == NULL) in snd_soc_alloc_ac97_component()
181 ac97->bus = &soc_ac97_bus; in snd_soc_alloc_ac97_component()
182 ac97->num = 0; in snd_soc_alloc_ac97_component()
184 ac97->dev.bus = &ac97_bus_type; in snd_soc_alloc_ac97_component()
185 ac97->dev.parent = component->card->dev; in snd_soc_alloc_ac97_component()
186 ac97->dev.release = soc_ac97_device_release; in snd_soc_alloc_ac97_component()
188 dev_set_name(&ac97->dev, "%d-%d:%s", in snd_soc_alloc_ac97_component()
192 device_initialize(&ac97->dev); in snd_soc_alloc_ac97_component()
194 return ac97; in snd_soc_alloc_ac97_component()
199 * snd_soc_new_ac97_component - initailise AC97 device
204 * Initialises AC97 component resources for use by ad-hoc devices only.
215 struct snd_ac97 *ac97; in snd_soc_new_ac97_component() local
218 ac97 = snd_soc_alloc_ac97_component(component); in snd_soc_new_ac97_component()
219 if (IS_ERR(ac97)) in snd_soc_new_ac97_component()
220 return ac97; in snd_soc_new_ac97_component()
223 ret = snd_ac97_reset(ac97, false, id, id_mask); in snd_soc_new_ac97_component()
225 dev_err(component->dev, "Failed to reset AC97 device: %d\n", in snd_soc_new_ac97_component()
231 ret = device_add(&ac97->dev); in snd_soc_new_ac97_component()
235 ret = snd_soc_ac97_init_gpio(ac97, component); in snd_soc_new_ac97_component()
239 return ac97; in snd_soc_new_ac97_component()
242 put_device(&ac97->dev); in snd_soc_new_ac97_component()
248 * snd_soc_free_ac97_component - free AC97 component device
249 * @ac97: snd_ac97 device to be freed
251 * Frees AC97 component device resources.
253 void snd_soc_free_ac97_component(struct snd_ac97 *ac97) in snd_soc_free_ac97_component() argument
255 snd_soc_ac97_free_gpio(ac97); in snd_soc_free_ac97_component()
256 device_del(&ac97->dev); in snd_soc_free_ac97_component()
257 ac97->bus = NULL; in snd_soc_free_ac97_component()
258 put_device(&ac97->dev); in snd_soc_free_ac97_component()
264 static void snd_soc_ac97_warm_reset(struct snd_ac97 *ac97) in snd_soc_ac97_warm_reset() argument
280 static void snd_soc_ac97_reset(struct snd_ac97 *ac97) in snd_soc_ac97_reset() argument
311 state = pinctrl_lookup_state(p, "ac97-reset"); in snd_soc_ac97_parse_pinctl()
313 dev_err(dev, "Can't find pinctrl state ac97-reset\n"); in snd_soc_ac97_parse_pinctl()
318 state = pinctrl_lookup_state(p, "ac97-warm-reset"); in snd_soc_ac97_parse_pinctl()
320 dev_err(dev, "Can't find pinctrl state ac97-warm-reset\n"); in snd_soc_ac97_parse_pinctl()
325 state = pinctrl_lookup_state(p, "ac97-running"); in snd_soc_ac97_parse_pinctl()
327 dev_err(dev, "Can't find pinctrl state ac97-running\n"); in snd_soc_ac97_parse_pinctl()
332 cfg->sync_gpio = devm_gpiod_get_index(dev, "ac97", 0, GPIOD_ASIS); in snd_soc_ac97_parse_pinctl()
334 return dev_err_probe(dev, PTR_ERR(cfg->sync_gpio), "Can't find ac97-sync gpio\n"); in snd_soc_ac97_parse_pinctl()
335 gpiod_set_consumer_name(cfg->sync_gpio, "AC97 link sync"); in snd_soc_ac97_parse_pinctl()
337 cfg->sdata_gpio = devm_gpiod_get_index(dev, "ac97", 1, GPIOD_ASIS); in snd_soc_ac97_parse_pinctl()
339 return dev_err_probe(dev, PTR_ERR(cfg->sdata_gpio), "Can't find ac97-sdata gpio\n"); in snd_soc_ac97_parse_pinctl()
340 gpiod_set_consumer_name(cfg->sdata_gpio, "AC97 link sdata"); in snd_soc_ac97_parse_pinctl()
342 cfg->reset_gpio = devm_gpiod_get_index(dev, "ac97", 2, GPIOD_ASIS); in snd_soc_ac97_parse_pinctl()
344 return dev_err_probe(dev, PTR_ERR(cfg->reset_gpio), "Can't find ac97-reset gpio\n"); in snd_soc_ac97_parse_pinctl()
345 gpiod_set_consumer_name(cfg->reset_gpio, "AC97 link reset"); in snd_soc_ac97_parse_pinctl()
369 * snd_soc_set_ac97_ops_of_reset - Set ac97 ops with generic ac97 reset functions