Lines Matching refs:bus
20 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, in snd_hdac_bus_init() argument
23 memset(bus, 0, sizeof(*bus)); in snd_hdac_bus_init()
24 bus->dev = dev; in snd_hdac_bus_init()
25 bus->ops = ops; in snd_hdac_bus_init()
26 INIT_LIST_HEAD(&bus->codec_list); in snd_hdac_bus_init()
27 INIT_WORK(&bus->unsol_work, process_unsol_events); in snd_hdac_bus_init()
28 mutex_init(&bus->cmd_mutex); in snd_hdac_bus_init()
37 void snd_hdac_bus_exit(struct hdac_bus *bus) in snd_hdac_bus_exit() argument
39 WARN_ON(!list_empty(&bus->codec_list)); in snd_hdac_bus_exit()
40 cancel_work_sync(&bus->unsol_work); in snd_hdac_bus_exit()
52 int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, in snd_hdac_bus_exec_verb() argument
57 mutex_lock(&bus->cmd_mutex); in snd_hdac_bus_exec_verb()
58 err = snd_hdac_bus_exec_verb_unlocked(bus, addr, cmd, res); in snd_hdac_bus_exec_verb()
59 mutex_unlock(&bus->cmd_mutex); in snd_hdac_bus_exec_verb()
72 int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr, in snd_hdac_bus_exec_verb_unlocked() argument
83 else if (bus->sync_write) in snd_hdac_bus_exec_verb_unlocked()
86 trace_hda_send_cmd(bus, cmd); in snd_hdac_bus_exec_verb_unlocked()
87 err = bus->ops->command(bus, cmd); in snd_hdac_bus_exec_verb_unlocked()
91 err = bus->ops->get_response(bus, addr, &tmp); in snd_hdac_bus_exec_verb_unlocked()
96 err = bus->ops->get_response(bus, addr, res); in snd_hdac_bus_exec_verb_unlocked()
97 trace_hda_get_response(bus, addr, *res); in snd_hdac_bus_exec_verb_unlocked()
113 void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex) in snd_hdac_bus_queue_event() argument
117 if (!bus) in snd_hdac_bus_queue_event()
120 trace_hda_unsol_event(bus, res, res_ex); in snd_hdac_bus_queue_event()
121 wp = (bus->unsol_wp + 1) % HDA_UNSOL_QUEUE_SIZE; in snd_hdac_bus_queue_event()
122 bus->unsol_wp = wp; in snd_hdac_bus_queue_event()
125 bus->unsol_queue[wp] = res; in snd_hdac_bus_queue_event()
126 bus->unsol_queue[wp + 1] = res_ex; in snd_hdac_bus_queue_event()
128 schedule_work(&bus->unsol_work); in snd_hdac_bus_queue_event()
137 struct hdac_bus *bus = container_of(work, struct hdac_bus, unsol_work); in process_unsol_events() local
142 while (bus->unsol_rp != bus->unsol_wp) { in process_unsol_events()
143 rp = (bus->unsol_rp + 1) % HDA_UNSOL_QUEUE_SIZE; in process_unsol_events()
144 bus->unsol_rp = rp; in process_unsol_events()
146 res = bus->unsol_queue[rp]; in process_unsol_events()
147 caddr = bus->unsol_queue[rp + 1]; in process_unsol_events()
150 codec = bus->caddr_tbl[caddr & 0x0f]; in process_unsol_events()
159 int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec) in snd_hdac_bus_add_device() argument
161 if (bus->caddr_tbl[codec->addr]) { in snd_hdac_bus_add_device()
162 dev_err(bus->dev, "address 0x%x is already occupied\n", in snd_hdac_bus_add_device()
167 list_add_tail(&codec->list, &bus->codec_list); in snd_hdac_bus_add_device()
168 bus->caddr_tbl[codec->addr] = codec; in snd_hdac_bus_add_device()
169 set_bit(codec->addr, &bus->codec_powered); in snd_hdac_bus_add_device()
170 bus->num_codecs++; in snd_hdac_bus_add_device()
175 void snd_hdac_bus_remove_device(struct hdac_bus *bus, in snd_hdac_bus_remove_device() argument
178 WARN_ON(bus != codec->bus); in snd_hdac_bus_remove_device()
182 bus->caddr_tbl[codec->addr] = NULL; in snd_hdac_bus_remove_device()
183 clear_bit(codec->addr, &bus->codec_powered); in snd_hdac_bus_remove_device()
184 bus->num_codecs--; in snd_hdac_bus_remove_device()