2 internal functions for TFA layer (not shared with SRV and HAL layer!)
5 #ifndef __TFA_INTERNAL_H__
6 #define __TFA_INTERNAL_H__
8 #include "tfa_dsp_fw.h"
9 #include "tfa_service.h"
13 #define TFA_INTERNAL __attribute__ ((visibility ("hidden")))
19 #define TFA98XX_GENERIC_SLAVE_ADDRESS 0x1C
22 supportNotSet, /* the default is not set yet, so = 0 */
27 typedef enum featureSupport featureSupport_t;
30 * tfa98xx control structure gathers data related to a single control
31 * (a 'control' can be related to an interface file)
32 * Some operations can be flagged as deferrable, meaning that they can be
33 * scheduled for later execution. This can be used for operations that
34 * require the i2s clock to run, and if it is not available while applying
36 * The Some operations can as well be cache-able (supposedly they are the same
37 * operations as the deferrable). Cache-able means that the status or
38 * register value may not be accesable while accessing the control. Caching
39 * allows to get the last programmed value.
43 * true: means the action or register accces can be run later (for example
44 * when an active i2s clock will be available).
45 * false: meams the operation can be applied immediately
46 * triggered: true if the deferred operation was triggered and is scheduled
48 * wr_value: the value to write in the deferred action (if applicable)
49 * rd_value: the cached value to report on a cached read (if applicable)
50 * rd_valid: true if the rd_value was initialized (and can be reported)
53 struct tfa98xx_control {
61 struct tfa98xx_controls {
62 struct tfa98xx_control otc;
63 struct tfa98xx_control mtpex;
64 struct tfa98xx_control calib;
67 struct tfa_device_ops {
68 enum Tfa98xx_Error (*tfa_init)(Tfa98xx_handle_t dev_idx);
69 enum Tfa98xx_Error (*tfa_dsp_reset)(Tfa98xx_handle_t dev_idx, int state);
70 enum Tfa98xx_Error (*tfa_dsp_system_stable)(Tfa98xx_handle_t handle, int *ready);
71 enum Tfa98xx_Error (*tfa_dsp_write_tables)(Tfa98xx_handle_t dev_idx, int sample_rate);
72 struct tfa98xx_controls controls;
75 struct Tfa98xx_handle_private {
78 unsigned char slave_address;
80 unsigned char tfa_family; /* tfa1/tfa2 */
81 enum featureSupport supportDrc;
82 enum featureSupport supportFramework;
83 enum featureSupport support_saam;
84 int sw_feature_bits[2]; /* cached feature bits data */
85 int hw_feature_bits; /* cached feature bits data */
86 int profile; /* cached active profile */
87 int vstep[2]; /* cached active vsteps */
88 unsigned char spkr_count;
89 unsigned char spkr_select;
90 unsigned char support_tcoef;
91 enum Tfa98xx_DAI daimap;
92 int mohm[3]; /* > speaker calibration values in milli ohms -1 is error */
93 struct tfa_device_ops dev_ops;
94 uint16_t interrupt_enable[3];
95 uint16_t interrupt_status[3];
99 extern TFA_INTERNAL struct Tfa98xx_handle_private handles_local[];
100 TFA_INTERNAL int tfa98xx_handle_is_open(Tfa98xx_handle_t h);
101 TFA_INTERNAL enum Tfa98xx_Error tfa98xx_check_rpc_status(Tfa98xx_handle_t handle, int *pRpcStatus);
102 TFA_INTERNAL enum Tfa98xx_Error tfa98xx_wait_result(Tfa98xx_handle_t handle, int waitRetryCount);
103 TFA_INTERNAL void tfa98xx_apply_deferred_calibration(Tfa98xx_handle_t handle);
104 TFA_INTERNAL void tfa98xx_deferred_calibration_status(Tfa98xx_handle_t handle, int calibrateDone);
105 TFA_INTERNAL int print_calibration(Tfa98xx_handle_t handle, char *str, size_t size);
107 #endif /* __TFA_INTERNAL_H__ */