Lines Matching +full:ac97 +full:- +full:controller

1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <sound/ac97/codec.h>
9 #include <sound/ac97/compat.h>
10 #include <sound/ac97/controller.h>
20 static void compat_ac97_reset(struct snd_ac97 *ac97) in compat_ac97_reset() argument
22 struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); in compat_ac97_reset()
23 struct ac97_controller *actrl = adev->ac97_ctrl; in compat_ac97_reset()
25 if (actrl->ops->reset) in compat_ac97_reset()
26 actrl->ops->reset(actrl); in compat_ac97_reset()
29 static void compat_ac97_warm_reset(struct snd_ac97 *ac97) in compat_ac97_warm_reset() argument
31 struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); in compat_ac97_warm_reset()
32 struct ac97_controller *actrl = adev->ac97_ctrl; in compat_ac97_warm_reset()
34 if (actrl->ops->warm_reset) in compat_ac97_warm_reset()
35 actrl->ops->warm_reset(actrl); in compat_ac97_warm_reset()
38 static void compat_ac97_write(struct snd_ac97 *ac97, unsigned short reg, in compat_ac97_write() argument
41 struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); in compat_ac97_write()
42 struct ac97_controller *actrl = adev->ac97_ctrl; in compat_ac97_write()
44 actrl->ops->write(actrl, ac97->num, reg, val); in compat_ac97_write()
47 static unsigned short compat_ac97_read(struct snd_ac97 *ac97, in compat_ac97_read() argument
50 struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); in compat_ac97_read()
51 struct ac97_controller *actrl = adev->ac97_ctrl; in compat_ac97_read()
53 return actrl->ops->read(actrl, ac97->num, reg); in compat_ac97_read()
69 struct snd_ac97 *ac97; in snd_ac97_compat_alloc() local
72 ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); in snd_ac97_compat_alloc()
73 if (ac97 == NULL) in snd_ac97_compat_alloc()
74 return ERR_PTR(-ENOMEM); in snd_ac97_compat_alloc()
76 ac97->private_data = adev; in snd_ac97_compat_alloc()
77 ac97->bus = &compat_soc_ac97_bus; in snd_ac97_compat_alloc()
79 ac97->dev.parent = &adev->dev; in snd_ac97_compat_alloc()
80 ac97->dev.release = compat_ac97_release; in snd_ac97_compat_alloc()
81 dev_set_name(&ac97->dev, "%s-compat", dev_name(&adev->dev)); in snd_ac97_compat_alloc()
82 ret = device_register(&ac97->dev); in snd_ac97_compat_alloc()
84 put_device(&ac97->dev); in snd_ac97_compat_alloc()
88 return ac97; in snd_ac97_compat_alloc()
92 void snd_ac97_compat_release(struct snd_ac97 *ac97) in snd_ac97_compat_release() argument
94 device_unregister(&ac97->dev); in snd_ac97_compat_release()
98 int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id, in snd_ac97_reset() argument
101 struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); in snd_ac97_reset()
102 struct ac97_controller *actrl = adev->ac97_ctrl; in snd_ac97_reset()
106 compat_ac97_warm_reset(ac97); in snd_ac97_reset()
107 scanned = snd_ac97_bus_scan_one(actrl, adev->num); in snd_ac97_reset()
108 if (ac97_ids_match(scanned, adev->vendor_id, id_mask)) in snd_ac97_reset()
112 compat_ac97_reset(ac97); in snd_ac97_reset()
113 compat_ac97_warm_reset(ac97); in snd_ac97_reset()
114 scanned = snd_ac97_bus_scan_one(actrl, adev->num); in snd_ac97_reset()
115 if (ac97_ids_match(scanned, adev->vendor_id, id_mask)) in snd_ac97_reset()
118 return -ENODEV; in snd_ac97_reset()