Lines Matching +full:device +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0-or-later
12 #include <linux/device.h>
17 * snd_ac97_check_id() - Reads and checks the vendor ID of the device
18 * @ac97: The AC97 device to check
19 * @id: The ID to compare to
20 * @id_mask: Mask that is applied to the device ID before comparing to @id
22 * If @id is 0 this function returns true if the read device vendor ID is
23 * a valid ID. If @id is non 0 this functions returns true if @id
24 * matches the read vendor ID. Otherwise the function returns false.
26 static bool snd_ac97_check_id(struct snd_ac97 *ac97, unsigned int id, in snd_ac97_check_id() argument
29 ac97->id = ac97->bus->ops->read(ac97, AC97_VENDOR_ID1) << 16; in snd_ac97_check_id()
30 ac97->id |= ac97->bus->ops->read(ac97, AC97_VENDOR_ID2); in snd_ac97_check_id()
32 if (ac97->id == 0x0 || ac97->id == 0xffffffff) in snd_ac97_check_id()
35 if (id != 0 && id != (ac97->id & id_mask)) in snd_ac97_check_id()
42 * snd_ac97_reset() - Reset AC'97 device
43 * @ac97: The AC'97 device to reset
45 * @id: Expected device vendor ID
46 * @id_mask: Mask that is applied to the device ID before comparing to @id
48 * This function resets the AC'97 device. If @try_warm is true the function
52 * otherwise a negative error code. If @id is 0 any valid device ID will be
53 * accepted, otherwise only the ID that matches @id and @id_mask is accepted.
55 int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id, in snd_ac97_reset() argument
58 const struct snd_ac97_bus_ops *ops = ac97->bus->ops; in snd_ac97_reset()
60 if (try_warm && ops->warm_reset) { in snd_ac97_reset()
61 ops->warm_reset(ac97); in snd_ac97_reset()
62 if (snd_ac97_check_id(ac97, id, id_mask)) in snd_ac97_reset()
66 if (ops->reset) in snd_ac97_reset()
67 ops->reset(ac97); in snd_ac97_reset()
68 if (ops->warm_reset) in snd_ac97_reset()
69 ops->warm_reset(ac97); in snd_ac97_reset()
71 if (snd_ac97_check_id(ac97, id, id_mask)) in snd_ac97_reset()
74 return -ENODEV; in snd_ac97_reset()
81 * structure and may decide based on the id field amongst other things.
83 static int ac97_bus_match(struct device *dev, struct device_driver *drv) in ac97_bus_match()