25 #define SOURCEFILE_NAME "hpicmn.c"
80 if (adapters.adapter[pao->
index].type) {
83 if (!adapters.adapter[a].type) {
85 "ASI%X duplicate index %d moved to %d\n",
96 adapters.adapter[pao->
index] = *pao;
98 adapters.gw_num_adapters++;
113 if (adapters.adapter[pao->
index].type)
114 adapters.gw_num_adapters--;
115 memset(&adapters.adapter[pao->
index], 0,
sizeof(adapters.adapter[0]));
134 pao = &adapters.adapter[adapter_index];
135 if (pao->
type != 0) {
155 static void wipe_adapter_list(
void)
157 memset(&adapters, 0,
sizeof(adapters));
160 static void subsys_get_adapter(
struct hpi_message *phm,
168 if (adapters.adapter[index].type) {
175 if (index < HPI_MAX_ADAPTERS) {
176 phr->
u.
s.adapter_index = adapters.adapter[
index].index;
177 phr->
u.
s.adapter_type = adapters.adapter[
index].type;
179 phr->
u.
s.adapter_index = 0;
180 phr->
u.
s.adapter_type = 0;
199 char *p_master_cache;
200 unsigned int byte_count = 0;
202 p_master_cache = (
char *)pC->
p_cache;
208 &p_master_cache[byte_count];
213 "adap %d cache not ready?\n",
222 "adap %d zero size cache entry %d\n",
237 "cached %d, pinfo %p index %d type %d size %d\n",
255 "adap %d bytecount %d != cache size %d\n",
260 "adap %d cache good, bytecount == cache size = %d\n",
273 if (!control_cache_alloc_check(p_cache)) {
275 "control_cache_alloc_check() failed %d\n",
287 (*pI)->control_type);
293 #define HPICMN_PAD_OFS_AND_SIZE(m) {\
294 offsetof(struct hpi_control_cache_pad, m), \
295 sizeof(((struct hpi_control_cache_pad *)(NULL))->m) }
318 size_t response_size;
319 if (!find_control(phm->
obj_index, p_cache, &pI)) {
321 "HPICMN find_control() failed for adap %d\n",
333 sizeof(struct hpi_control_res);
344 phr->
u.
c.an_log_value[0] = pC->u.meter.an_log_peak[0];
345 phr->
u.
c.an_log_value[1] = pC->u.meter.an_log_peak[1];
347 if (pC->u.meter.an_logRMS[0] ==
354 phr->
u.
c.an_log_value[0] =
355 pC->u.meter.an_logRMS[0];
356 phr->
u.
c.an_log_value[1] =
357 pC->u.meter.an_logRMS[1];
364 phr->
u.
c.an_log_value[0] = pC->u.vol.an_log[0];
365 phr->
u.
c.an_log_value[1] = pC->u.vol.an_log[1];
384 phr->
u.
c.param1 = pC->u.mux.source_node_type;
385 phr->
u.
c.param2 = pC->u.mux.source_node_index;
392 phr->
u.
c.param1 = pC->u.mode.mode;
398 phr->
u.
c.an_log_value[0] = pC->u.level.an_log[0];
399 phr->
u.
c.an_log_value[1] = pC->u.level.an_log[1];
405 phr->
u.
c.param1 = pC->u.tuner.freq_ink_hz;
407 phr->
u.
c.param1 = pC->u.tuner.band;
409 if (pC->u.tuner.s_level_avg ==
416 pC->u.tuner.s_level_avg;
422 phr->
u.
c.param1 = pC->u.aes3rx.error_status;
424 phr->
u.
c.param1 = pC->u.aes3rx.format;
430 phr->
u.
c.param1 = pC->u.aes3tx.format;
436 phr->
u.
c.param1 = pC->u.tone.state;
442 phr->
u.
c.param1 = pC->u.silence.state;
448 phr->
u.
c.param1 = pC->u.microphone.phantom_state;
454 phr->
u.
c.param1 = pC->u.clk.source;
456 if (pC->u.clk.source_index ==
462 phr->
u.
c.param1 = pC->u.clk.source_index;
464 phr->
u.
c.param1 = pC->u.clk.sample_rate;
481 phr->
u.
c.param1 = p_pad->
pI;
483 phr->
u.
c.param1 = p_pad->
pTY;
488 unsigned int offset = phm->
u.
c.param1;
489 unsigned int pad_string_len, field_size;
504 pad_string[field_size - 1] = 0;
506 pad_string_len =
strlen(pad_string) + 1;
508 if (offset > pad_string_len) {
514 tocopy = pad_string_len -
offset;
515 if (tocopy >
sizeof(phr->
u.
cu.
chars8.sz_data))
520 &pad_string[offset], tocopy);
523 pad_string_len - offset - tocopy;
537 phr->
size = (
u16)response_size;
561 if (!find_control(phm->
obj_index, p_cache, &pI)) {
563 "HPICMN find_control() failed for adap %d\n",
576 pC->
u.
vol.an_log[0] = phr->
u.
c.an_log_value[0];
577 pC->
u.
vol.an_log[1] = phr->
u.
c.an_log_value[1];
588 pC->
u.
mux.source_node_type = (
u16)phm->
u.
c.param1;
589 pC->
u.
mux.source_node_index = (
u16)phm->
u.
c.param2;
599 pC->
u.
vol.an_log[0] = phr->
u.
c.an_log_value[0];
600 pC->
u.
vol.an_log[1] = phr->
u.
c.an_log_value[1];
619 pC->
u.
clk.source_index = (
u16)phm->
u.
c.param1;
621 pC->
u.
clk.sample_rate = phm->
u.
c.param1;
633 const u32 size_in_bytes,
u8 *p_dsp_control_buffer)
640 p_cache->
p_info = kcalloc(control_count,
sizeof(*p_cache->
p_info),
648 p_cache->
p_cache = p_dsp_control_buffer;
675 subsys_get_adapter(phm, phr);
678 phr->
u.
s.num_adapters = adapters.gw_num_adapters;
694 subsys_message(phm, phr);