Lines Matching refs:bus

27 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,  in snd_hdac_bus_init()  argument
31 memset(bus, 0, sizeof(*bus)); in snd_hdac_bus_init()
32 bus->dev = dev; in snd_hdac_bus_init()
34 bus->ops = ops; in snd_hdac_bus_init()
36 bus->ops = &default_ops; in snd_hdac_bus_init()
37 bus->io_ops = io_ops; in snd_hdac_bus_init()
38 INIT_LIST_HEAD(&bus->stream_list); in snd_hdac_bus_init()
39 INIT_LIST_HEAD(&bus->codec_list); in snd_hdac_bus_init()
40 INIT_WORK(&bus->unsol_work, process_unsol_events); in snd_hdac_bus_init()
41 spin_lock_init(&bus->reg_lock); in snd_hdac_bus_init()
42 mutex_init(&bus->cmd_mutex); in snd_hdac_bus_init()
43 bus->irq = -1; in snd_hdac_bus_init()
52 void snd_hdac_bus_exit(struct hdac_bus *bus) in snd_hdac_bus_exit() argument
54 WARN_ON(!list_empty(&bus->stream_list)); in snd_hdac_bus_exit()
55 WARN_ON(!list_empty(&bus->codec_list)); in snd_hdac_bus_exit()
56 cancel_work_sync(&bus->unsol_work); in snd_hdac_bus_exit()
68 int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, in snd_hdac_bus_exec_verb() argument
73 mutex_lock(&bus->cmd_mutex); in snd_hdac_bus_exec_verb()
74 err = snd_hdac_bus_exec_verb_unlocked(bus, addr, cmd, res); in snd_hdac_bus_exec_verb()
75 mutex_unlock(&bus->cmd_mutex); in snd_hdac_bus_exec_verb()
88 int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr, in snd_hdac_bus_exec_verb_unlocked() argument
99 else if (bus->sync_write) in snd_hdac_bus_exec_verb_unlocked()
102 trace_hda_send_cmd(bus, cmd); in snd_hdac_bus_exec_verb_unlocked()
103 err = bus->ops->command(bus, cmd); in snd_hdac_bus_exec_verb_unlocked()
107 err = bus->ops->get_response(bus, addr, &tmp); in snd_hdac_bus_exec_verb_unlocked()
112 err = bus->ops->get_response(bus, addr, res); in snd_hdac_bus_exec_verb_unlocked()
113 trace_hda_get_response(bus, addr, *res); in snd_hdac_bus_exec_verb_unlocked()
129 void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex) in snd_hdac_bus_queue_event() argument
133 if (!bus) in snd_hdac_bus_queue_event()
136 trace_hda_unsol_event(bus, res, res_ex); in snd_hdac_bus_queue_event()
137 wp = (bus->unsol_wp + 1) % HDA_UNSOL_QUEUE_SIZE; in snd_hdac_bus_queue_event()
138 bus->unsol_wp = wp; in snd_hdac_bus_queue_event()
141 bus->unsol_queue[wp] = res; in snd_hdac_bus_queue_event()
142 bus->unsol_queue[wp + 1] = res_ex; in snd_hdac_bus_queue_event()
144 schedule_work(&bus->unsol_work); in snd_hdac_bus_queue_event()
153 struct hdac_bus *bus = container_of(work, struct hdac_bus, unsol_work); in process_unsol_events() local
158 while (bus->unsol_rp != bus->unsol_wp) { in process_unsol_events()
159 rp = (bus->unsol_rp + 1) % HDA_UNSOL_QUEUE_SIZE; in process_unsol_events()
160 bus->unsol_rp = rp; in process_unsol_events()
162 res = bus->unsol_queue[rp]; in process_unsol_events()
163 caddr = bus->unsol_queue[rp + 1]; in process_unsol_events()
166 codec = bus->caddr_tbl[caddr & 0x0f]; in process_unsol_events()
184 int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec) in snd_hdac_bus_add_device() argument
186 if (bus->caddr_tbl[codec->addr]) { in snd_hdac_bus_add_device()
187 dev_err(bus->dev, "address 0x%x is already occupied\n", in snd_hdac_bus_add_device()
192 list_add_tail(&codec->list, &bus->codec_list); in snd_hdac_bus_add_device()
193 bus->caddr_tbl[codec->addr] = codec; in snd_hdac_bus_add_device()
194 set_bit(codec->addr, &bus->codec_powered); in snd_hdac_bus_add_device()
195 bus->num_codecs++; in snd_hdac_bus_add_device()
205 void snd_hdac_bus_remove_device(struct hdac_bus *bus, in snd_hdac_bus_remove_device() argument
208 WARN_ON(bus != codec->bus); in snd_hdac_bus_remove_device()
212 bus->caddr_tbl[codec->addr] = NULL; in snd_hdac_bus_remove_device()
213 clear_bit(codec->addr, &bus->codec_powered); in snd_hdac_bus_remove_device()
214 bus->num_codecs--; in snd_hdac_bus_remove_device()