• Home
  • Raw
  • Download

Lines Matching refs:ac97_ctrl

61 ac97_codec_find(struct ac97_controller *ac97_ctrl, unsigned int codec_num)  in ac97_codec_find()  argument
66 return ac97_ctrl->codecs[codec_num]; in ac97_codec_find()
70 ac97_of_get_child_device(struct ac97_controller *ac97_ctrl, int idx, in ac97_of_get_child_device() argument
80 for_each_child_of_node(ac97_ctrl->parent->of_node, node) { in ac97_of_get_child_device()
93 struct ac97_controller *ac97_ctrl; in ac97_codec_release() local
96 ac97_ctrl = adev->ac97_ctrl; in ac97_codec_release()
97 ac97_ctrl->codecs[adev->num] = NULL; in ac97_codec_release()
102 static int ac97_codec_add(struct ac97_controller *ac97_ctrl, int idx, in ac97_codec_add() argument
111 ac97_ctrl->codecs[idx] = codec; in ac97_codec_add()
115 codec->dev.parent = &ac97_ctrl->adap; in ac97_codec_add()
117 codec->ac97_ctrl = ac97_ctrl; in ac97_codec_add()
120 dev_set_name(&codec->dev, "%s:%u", dev_name(ac97_ctrl->parent), idx); in ac97_codec_add()
121 codec->dev.of_node = ac97_of_get_child_device(ac97_ctrl, idx, in ac97_codec_add()
154 static int ac97_bus_scan(struct ac97_controller *ac97_ctrl) in ac97_bus_scan() argument
160 if (ac97_codec_find(ac97_ctrl, i)) in ac97_bus_scan()
162 if (!(ac97_ctrl->slots_available & BIT(i))) in ac97_bus_scan()
164 vendor_id = snd_ac97_bus_scan_one(ac97_ctrl, i); in ac97_bus_scan()
168 ret = ac97_codec_add(ac97_ctrl, i, vendor_id); in ac97_bus_scan()
175 static int ac97_bus_reset(struct ac97_controller *ac97_ctrl) in ac97_bus_reset() argument
177 ac97_ctrl->ops->reset(ac97_ctrl); in ac97_bus_reset()
222 struct ac97_controller *ac97_ctrl = adev->ac97_ctrl; in snd_ac97_codec_get_platdata() local
224 return ac97_ctrl->codecs_pdata[adev->num]; in snd_ac97_codec_get_platdata()
228 static void ac97_ctrl_codecs_unregister(struct ac97_controller *ac97_ctrl) in ac97_ctrl_codecs_unregister() argument
233 if (ac97_ctrl->codecs[i]) { in ac97_ctrl_codecs_unregister()
234 ac97_ctrl->codecs[i]->ac97_ctrl = &ac97_unbound_ctrl; in ac97_ctrl_codecs_unregister()
235 device_unregister(&ac97_ctrl->codecs[i]->dev); in ac97_ctrl_codecs_unregister()
243 struct ac97_controller *ac97_ctrl; in cold_reset_store() local
246 ac97_ctrl = to_ac97_controller(dev); in cold_reset_store()
247 ac97_ctrl->ops->reset(ac97_ctrl); in cold_reset_store()
257 struct ac97_controller *ac97_ctrl; in warm_reset_store() local
263 ac97_ctrl = to_ac97_controller(dev); in warm_reset_store()
264 ac97_ctrl->ops->warm_reset(ac97_ctrl); in warm_reset_store()
286 static void ac97_del_adapter(struct ac97_controller *ac97_ctrl) in ac97_del_adapter() argument
289 ac97_ctrl_codecs_unregister(ac97_ctrl); in ac97_del_adapter()
290 list_del(&ac97_ctrl->controllers); in ac97_del_adapter()
293 device_unregister(&ac97_ctrl->adap); in ac97_del_adapter()
298 struct ac97_controller *ac97_ctrl; in ac97_adapter_release() local
300 ac97_ctrl = to_ac97_controller(dev); in ac97_adapter_release()
301 idr_remove(&ac97_adapter_idr, ac97_ctrl->nr); in ac97_adapter_release()
302 dev_dbg(&ac97_ctrl->adap, "adapter unregistered by %s\n", in ac97_adapter_release()
303 dev_name(ac97_ctrl->parent)); in ac97_adapter_release()
311 static int ac97_add_adapter(struct ac97_controller *ac97_ctrl) in ac97_add_adapter() argument
316 ret = idr_alloc(&ac97_adapter_idr, ac97_ctrl, 0, 0, GFP_KERNEL); in ac97_add_adapter()
317 ac97_ctrl->nr = ret; in ac97_add_adapter()
319 dev_set_name(&ac97_ctrl->adap, "ac97-%d", ret); in ac97_add_adapter()
320 ac97_ctrl->adap.type = &ac97_adapter_type; in ac97_add_adapter()
321 ac97_ctrl->adap.parent = ac97_ctrl->parent; in ac97_add_adapter()
322 ret = device_register(&ac97_ctrl->adap); in ac97_add_adapter()
324 put_device(&ac97_ctrl->adap); in ac97_add_adapter()
327 list_add(&ac97_ctrl->controllers, &ac97_controllers); in ac97_add_adapter()
331 dev_dbg(&ac97_ctrl->adap, "adapter registered by %s\n", in ac97_add_adapter()
332 dev_name(ac97_ctrl->parent)); in ac97_add_adapter()
352 struct ac97_controller *ac97_ctrl; in snd_ac97_controller_register() local
355 ac97_ctrl = kzalloc(sizeof(*ac97_ctrl), GFP_KERNEL); in snd_ac97_controller_register()
356 if (!ac97_ctrl) in snd_ac97_controller_register()
360 ac97_ctrl->codecs_pdata[i] = codecs_pdata[i]; in snd_ac97_controller_register()
362 ac97_ctrl->ops = ops; in snd_ac97_controller_register()
363 ac97_ctrl->slots_available = slots_available; in snd_ac97_controller_register()
364 ac97_ctrl->parent = dev; in snd_ac97_controller_register()
365 ret = ac97_add_adapter(ac97_ctrl); in snd_ac97_controller_register()
369 ac97_bus_reset(ac97_ctrl); in snd_ac97_controller_register()
370 ac97_bus_scan(ac97_ctrl); in snd_ac97_controller_register()
372 return ac97_ctrl; in snd_ac97_controller_register()
374 kfree(ac97_ctrl); in snd_ac97_controller_register()
384 void snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl) in snd_ac97_controller_unregister() argument
386 ac97_del_adapter(ac97_ctrl); in snd_ac97_controller_unregister()