^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) AudioScience HPI driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Copyright (C) 1997-2014 AudioScience Inc. <support@audioscience.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct hpi_adapter_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* a function that takes an adapter obj and returns an int */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) typedef int adapter_int_func(struct hpi_adapter_obj *pao, u32 message);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define HPI_IRQ_NONE (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define HPI_IRQ_MESSAGE (1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define HPI_IRQ_MIXER (2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct hpi_adapter_obj {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) u16 type; /* 0x6644 == ASI6644 etc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) u16 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct hpios_spinlock dsp_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) u16 dsp_crashed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u16 has_control_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) adapter_int_func *irq_query_and_clear;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct hpi_hostbuffer_status *instream_host_buffer_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct hpi_hostbuffer_status *outstream_host_buffer_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct hpi_control_cache {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /** indicates whether the structures are initialized */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u16 init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u16 adap_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u32 control_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u32 cache_size_in_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /** pointer to allocated memory of lookup pointers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct hpi_control_cache_info **p_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /** pointer to DSP's control cache. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) u8 *p_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) u16 hpi_add_adapter(struct hpi_adapter_obj *pao);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void hpi_delete_adapter(struct hpi_adapter_obj *pao);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) short hpi_check_control_cache(struct hpi_control_cache *pC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct hpi_message *phm, struct hpi_response *phr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) short hpi_check_control_cache_single(struct hpi_control_cache_single *pC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct hpi_message *phm, struct hpi_response *phr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct hpi_control_cache *hpi_alloc_control_cache(const u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) number_of_controls, const u32 size_in_bytes, u8 *pDSP_control_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void hpi_free_control_cache(struct hpi_control_cache *p_cache);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) void hpi_cmn_control_cache_sync_to_msg(struct hpi_control_cache *pC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) struct hpi_message *phm, struct hpi_response *phr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void hpi_cmn_control_cache_sync_to_msg_single(struct hpi_control_cache_single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) *pC, struct hpi_message *phm, struct hpi_response *phr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) hpi_handler_func HPI_COMMON;