Lines Matching +full:asi +full:- +full:format

1 // SPDX-License-Identifier: GPL-2.0-only
5 Copyright (C) 1997-2014 AudioScience Inc. <support@audioscience.com>
12 (C) Copyright AudioScience Inc. 1998-2003
31 * hpi_validate_response - Given an HPI Message that was sent out and
39 if (phr->type != HPI_TYPE_RESPONSE) { in hpi_validate_response()
40 HPI_DEBUG_LOG(ERROR, "header type %d invalid\n", phr->type); in hpi_validate_response()
44 if (phr->object != phm->object) { in hpi_validate_response()
46 phr->object); in hpi_validate_response()
50 if (phr->function != phm->function) { in hpi_validate_response()
52 phr->function); in hpi_validate_response()
62 /*HPI_ASSERT(pao->type); */ in hpi_add_adapter()
66 if (pao->index >= HPI_MAX_ADAPTERS) { in hpi_add_adapter()
71 if (adapters.adapter[pao->index].type) { in hpi_add_adapter()
73 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { in hpi_add_adapter()
76 "ASI%X duplicate index %d moved to %d\n", in hpi_add_adapter()
77 pao->type, pao->index, a); in hpi_add_adapter()
78 pao->index = a; in hpi_add_adapter()
87 adapters.adapter[pao->index] = *pao; in hpi_add_adapter()
88 hpios_dsplock_init(&adapters.adapter[pao->index]); in hpi_add_adapter()
98 if (!pao->type) { in hpi_delete_adapter()
104 if (adapters.adapter[pao->index].type) in hpi_delete_adapter()
105 adapters.gw_num_adapters--; in hpi_delete_adapter()
106 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0])); in hpi_delete_adapter()
111 * hpi_find_adapter - FindAdapter returns a pointer to the struct
127 if (pao->type != 0) { in hpi_find_adapter()
143 * wipe_adapter_list - wipe an HPI_ADAPTERS_LIST structure.
154 int count = phm->obj_index; in subsys_get_adapter()
162 count--; in subsys_get_adapter()
167 phr->u.s.adapter_index = adapters.adapter[index].index; in subsys_get_adapter()
168 phr->u.s.adapter_type = adapters.adapter[index].type; in subsys_get_adapter()
170 phr->u.s.adapter_index = 0; in subsys_get_adapter()
171 phr->u.s.adapter_type = 0; in subsys_get_adapter()
172 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; in subsys_get_adapter()
183 if (pC->init) in control_cache_alloc_check()
184 return pC->init; in control_cache_alloc_check()
186 if (!pC->p_cache) in control_cache_alloc_check()
189 if (pC->control_count && pC->cache_size_in_bytes) { in control_cache_alloc_check()
193 p_master_cache = (char *)pC->p_cache; in control_cache_alloc_check()
195 pC->control_count); in control_cache_alloc_check()
196 for (i = 0; i < pC->control_count; i++) { in control_cache_alloc_check()
200 u16 control_index = info->control_index; in control_cache_alloc_check()
202 if (control_index >= pC->control_count) { in control_cache_alloc_check()
205 pC->adap_idx, control_index); in control_cache_alloc_check()
209 if (!info->size_in32bit_words) { in control_cache_alloc_check()
213 pC->adap_idx); in control_cache_alloc_check()
222 pC->adap_idx, i); in control_cache_alloc_check()
226 if (info->control_type) { in control_cache_alloc_check()
227 pC->p_info[control_index] = info; in control_cache_alloc_check()
230 pC->p_info[control_index] = NULL; in control_cache_alloc_check()
233 byte_count += info->size_in32bit_words * 4; in control_cache_alloc_check()
237 cached, pC->p_info[info->control_index], in control_cache_alloc_check()
238 info->control_index, info->control_type, in control_cache_alloc_check()
239 info->size_in32bit_words); in control_cache_alloc_check()
245 if (byte_count >= pC->cache_size_in_bytes) in control_cache_alloc_check()
248 if (info->control_index == pC->control_count - 1) in control_cache_alloc_check()
252 if (byte_count != pC->cache_size_in_bytes) in control_cache_alloc_check()
255 pC->adap_idx, byte_count, in control_cache_alloc_check()
256 pC->cache_size_in_bytes); in control_cache_alloc_check()
260 pC->adap_idx, byte_count); in control_cache_alloc_check()
262 pC->init = (u16)cached; in control_cache_alloc_check()
264 return pC->init; in control_cache_alloc_check()
279 *pI = p_cache->p_info[control_index]; in find_control()
286 (*pI)->control_type); in find_control()
294 sizeof(((struct hpi_control_cache_pad *)(NULL))->m) }
322 switch (pC->u.i.control_type) { in hpi_check_control_cache_single()
325 if (phm->u.c.attribute == HPI_METER_PEAK) { in hpi_check_control_cache_single()
326 phr->u.c.an_log_value[0] = pC->u.meter.an_log_peak[0]; in hpi_check_control_cache_single()
327 phr->u.c.an_log_value[1] = pC->u.meter.an_log_peak[1]; in hpi_check_control_cache_single()
328 } else if (phm->u.c.attribute == HPI_METER_RMS) { in hpi_check_control_cache_single()
329 if (pC->u.meter.an_logRMS[0] == in hpi_check_control_cache_single()
331 phr->error = in hpi_check_control_cache_single()
333 phr->u.c.an_log_value[0] = HPI_METER_MINIMUM; in hpi_check_control_cache_single()
334 phr->u.c.an_log_value[1] = HPI_METER_MINIMUM; in hpi_check_control_cache_single()
336 phr->u.c.an_log_value[0] = in hpi_check_control_cache_single()
337 pC->u.meter.an_logRMS[0]; in hpi_check_control_cache_single()
338 phr->u.c.an_log_value[1] = in hpi_check_control_cache_single()
339 pC->u.meter.an_logRMS[1]; in hpi_check_control_cache_single()
345 if (phm->u.c.attribute == HPI_VOLUME_GAIN) { in hpi_check_control_cache_single()
346 phr->u.c.an_log_value[0] = pC->u.vol.an_log[0]; in hpi_check_control_cache_single()
347 phr->u.c.an_log_value[1] = pC->u.vol.an_log[1]; in hpi_check_control_cache_single()
348 } else if (phm->u.c.attribute == HPI_VOLUME_MUTE) { in hpi_check_control_cache_single()
349 if (pC->u.vol.flags & HPI_VOLUME_FLAG_HAS_MUTE) { in hpi_check_control_cache_single()
350 if (pC->u.vol.flags & HPI_VOLUME_FLAG_MUTED) in hpi_check_control_cache_single()
351 phr->u.c.param1 = in hpi_check_control_cache_single()
354 phr->u.c.param1 = 0; in hpi_check_control_cache_single()
356 phr->error = in hpi_check_control_cache_single()
358 phr->u.c.param1 = 0; in hpi_check_control_cache_single()
365 if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) { in hpi_check_control_cache_single()
366 phr->u.c.param1 = pC->u.mux.source_node_type; in hpi_check_control_cache_single()
367 phr->u.c.param2 = pC->u.mux.source_node_index; in hpi_check_control_cache_single()
373 if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE) in hpi_check_control_cache_single()
374 phr->u.c.param1 = pC->u.mode.mode; in hpi_check_control_cache_single()
379 if (phm->u.c.attribute == HPI_LEVEL_GAIN) { in hpi_check_control_cache_single()
380 phr->u.c.an_log_value[0] = pC->u.level.an_log[0]; in hpi_check_control_cache_single()
381 phr->u.c.an_log_value[1] = pC->u.level.an_log[1]; in hpi_check_control_cache_single()
386 if (phm->u.c.attribute == HPI_TUNER_FREQ) in hpi_check_control_cache_single()
387 phr->u.c.param1 = pC->u.tuner.freq_ink_hz; in hpi_check_control_cache_single()
388 else if (phm->u.c.attribute == HPI_TUNER_BAND) in hpi_check_control_cache_single()
389 phr->u.c.param1 = pC->u.tuner.band; in hpi_check_control_cache_single()
390 else if (phm->u.c.attribute == HPI_TUNER_LEVEL_AVG) in hpi_check_control_cache_single()
391 if (pC->u.tuner.s_level_avg == in hpi_check_control_cache_single()
393 phr->u.cu.tuner.s_level = 0; in hpi_check_control_cache_single()
394 phr->error = in hpi_check_control_cache_single()
397 phr->u.cu.tuner.s_level = in hpi_check_control_cache_single()
398 pC->u.tuner.s_level_avg; in hpi_check_control_cache_single()
403 if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS) in hpi_check_control_cache_single()
404 phr->u.c.param1 = pC->u.aes3rx.error_status; in hpi_check_control_cache_single()
405 else if (phm->u.c.attribute == HPI_AESEBURX_FORMAT) in hpi_check_control_cache_single()
406 phr->u.c.param1 = pC->u.aes3rx.format; in hpi_check_control_cache_single()
411 if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT) in hpi_check_control_cache_single()
412 phr->u.c.param1 = pC->u.aes3tx.format; in hpi_check_control_cache_single()
417 if (phm->u.c.attribute == HPI_TONEDETECTOR_STATE) in hpi_check_control_cache_single()
418 phr->u.c.param1 = pC->u.tone.state; in hpi_check_control_cache_single()
423 if (phm->u.c.attribute == HPI_SILENCEDETECTOR_STATE) { in hpi_check_control_cache_single()
424 phr->u.c.param1 = pC->u.silence.state; in hpi_check_control_cache_single()
429 if (phm->u.c.attribute == HPI_MICROPHONE_PHANTOM_POWER) in hpi_check_control_cache_single()
430 phr->u.c.param1 = pC->u.microphone.phantom_state; in hpi_check_control_cache_single()
435 if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE) in hpi_check_control_cache_single()
436 phr->u.c.param1 = pC->u.clk.source; in hpi_check_control_cache_single()
437 else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX) { in hpi_check_control_cache_single()
438 if (pC->u.clk.source_index == in hpi_check_control_cache_single()
440 phr->u.c.param1 = 0; in hpi_check_control_cache_single()
441 phr->error = in hpi_check_control_cache_single()
444 phr->u.c.param1 = pC->u.clk.source_index; in hpi_check_control_cache_single()
445 } else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SAMPLERATE) in hpi_check_control_cache_single()
446 phr->u.c.param1 = pC->u.clk.sample_rate; in hpi_check_control_cache_single()
454 if (!(p_pad->field_valid_flags & (1 << in hpi_check_control_cache_single()
455 HPI_CTL_ATTR_INDEX(phm->u.c. in hpi_check_control_cache_single()
457 phr->error = in hpi_check_control_cache_single()
462 if (phm->u.c.attribute == HPI_PAD_PROGRAM_ID) in hpi_check_control_cache_single()
463 phr->u.c.param1 = p_pad->pI; in hpi_check_control_cache_single()
464 else if (phm->u.c.attribute == HPI_PAD_PROGRAM_TYPE) in hpi_check_control_cache_single()
465 phr->u.c.param1 = p_pad->pTY; in hpi_check_control_cache_single()
468 HPI_CTL_ATTR_INDEX(phm->u.c. in hpi_check_control_cache_single()
469 attribute) - 1; in hpi_check_control_cache_single()
470 unsigned int offset = phm->u.c.param1; in hpi_check_control_cache_single()
475 if (index > ARRAY_SIZE(pad_desc) - 1) { in hpi_check_control_cache_single()
476 phr->error = in hpi_check_control_cache_single()
486 pad_string[field_size - 1] = 0; in hpi_check_control_cache_single()
491 phr->error = in hpi_check_control_cache_single()
496 tocopy = pad_string_len - offset; in hpi_check_control_cache_single()
497 if (tocopy > sizeof(phr->u.cu.chars8.sz_data)) in hpi_check_control_cache_single()
498 tocopy = sizeof(phr->u.cu.chars8. in hpi_check_control_cache_single()
501 memcpy(phr->u.cu.chars8.sz_data, in hpi_check_control_cache_single()
504 phr->u.cu.chars8.remaining_chars = in hpi_check_control_cache_single()
505 pad_string_len - offset - tocopy; in hpi_check_control_cache_single()
515 found ? "Cached" : "Uncached", phm->adapter_index, in hpi_check_control_cache_single()
516 pC->u.i.control_index, pC->u.i.control_type, in hpi_check_control_cache_single()
517 phm->u.c.attribute); in hpi_check_control_cache_single()
520 phr->size = (u16)response_size; in hpi_check_control_cache_single()
521 phr->type = HPI_TYPE_RESPONSE; in hpi_check_control_cache_single()
522 phr->object = phm->object; in hpi_check_control_cache_single()
523 phr->function = phm->function; in hpi_check_control_cache_single()
534 if (!find_control(phm->obj_index, p_cache, &pI)) { in hpi_check_control_cache()
537 phm->adapter_index); in hpi_check_control_cache()
541 phr->error = 0; in hpi_check_control_cache()
542 phr->specific_error = 0; in hpi_check_control_cache()
543 phr->version = 0; in hpi_check_control_cache()
558 switch (pC->u.i.control_type) { in hpi_cmn_control_cache_sync_to_msg_single()
560 if (phm->u.c.attribute == HPI_VOLUME_GAIN) { in hpi_cmn_control_cache_sync_to_msg_single()
561 pC->u.vol.an_log[0] = phr->u.c.an_log_value[0]; in hpi_cmn_control_cache_sync_to_msg_single()
562 pC->u.vol.an_log[1] = phr->u.c.an_log_value[1]; in hpi_cmn_control_cache_sync_to_msg_single()
563 } else if (phm->u.c.attribute == HPI_VOLUME_MUTE) { in hpi_cmn_control_cache_sync_to_msg_single()
564 if (phm->u.c.param1) in hpi_cmn_control_cache_sync_to_msg_single()
565 pC->u.vol.flags |= HPI_VOLUME_FLAG_MUTED; in hpi_cmn_control_cache_sync_to_msg_single()
567 pC->u.vol.flags &= ~HPI_VOLUME_FLAG_MUTED; in hpi_cmn_control_cache_sync_to_msg_single()
572 if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) { in hpi_cmn_control_cache_sync_to_msg_single()
573 pC->u.mux.source_node_type = (u16)phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
574 pC->u.mux.source_node_index = (u16)phm->u.c.param2; in hpi_cmn_control_cache_sync_to_msg_single()
579 if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE) in hpi_cmn_control_cache_sync_to_msg_single()
580 pC->u.mode.mode = (u16)phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
583 if (phm->u.c.attribute == HPI_LEVEL_GAIN) { in hpi_cmn_control_cache_sync_to_msg_single()
584 pC->u.vol.an_log[0] = phr->u.c.an_log_value[0]; in hpi_cmn_control_cache_sync_to_msg_single()
585 pC->u.vol.an_log[1] = phr->u.c.an_log_value[1]; in hpi_cmn_control_cache_sync_to_msg_single()
589 if (phm->u.c.attribute == HPI_MICROPHONE_PHANTOM_POWER) in hpi_cmn_control_cache_sync_to_msg_single()
590 pC->u.microphone.phantom_state = (u16)phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
593 if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT) in hpi_cmn_control_cache_sync_to_msg_single()
594 pC->u.aes3tx.format = phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
597 if (phm->u.c.attribute == HPI_AESEBURX_FORMAT) in hpi_cmn_control_cache_sync_to_msg_single()
598 pC->u.aes3rx.format = phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
601 if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE) in hpi_cmn_control_cache_sync_to_msg_single()
602 pC->u.clk.source = (u16)phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
603 else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX) in hpi_cmn_control_cache_sync_to_msg_single()
604 pC->u.clk.source_index = (u16)phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
605 else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SAMPLERATE) in hpi_cmn_control_cache_sync_to_msg_single()
606 pC->u.clk.sample_rate = phm->u.c.param1; in hpi_cmn_control_cache_sync_to_msg_single()
619 if (phr->error) in hpi_cmn_control_cache_sync_to_msg()
622 if (!find_control(phm->obj_index, p_cache, &pI)) { in hpi_cmn_control_cache_sync_to_msg()
625 phm->adapter_index); in hpi_cmn_control_cache_sync_to_msg()
649 p_cache->p_info = in hpi_alloc_control_cache()
650 kcalloc(control_count, sizeof(*p_cache->p_info), GFP_KERNEL); in hpi_alloc_control_cache()
651 if (!p_cache->p_info) { in hpi_alloc_control_cache()
656 p_cache->cache_size_in_bytes = size_in_bytes; in hpi_alloc_control_cache()
657 p_cache->control_count = control_count; in hpi_alloc_control_cache()
658 p_cache->p_cache = p_dsp_control_buffer; in hpi_alloc_control_cache()
659 p_cache->init = 0; in hpi_alloc_control_cache()
666 kfree(p_cache->p_info); in hpi_free_control_cache()
673 hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, phm->function, 0); in subsys_message()
675 switch (phm->function) { in subsys_message()
688 phr->u.s.num_adapters = adapters.gw_num_adapters; in subsys_message()
693 phr->error = HPI_ERROR_INVALID_FUNC; in subsys_message()
700 switch (phm->type) { in HPI_COMMON()
702 switch (phm->object) { in HPI_COMMON()
710 phr->error = HPI_ERROR_INVALID_TYPE; in HPI_COMMON()