MLK-17309-1: uapi: mxc_hifi4: provide new interface for user space
authorWeiguang Kong <weiguang.kong@nxp.com>
Tue, 26 Dec 2017 10:57:10 +0000 (18:57 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:52:22 +0000 (14:52 -0500)
In order to avoid license problem of Cadence header files, these
license files has been wrappered into a library and new interface
has been abstracted to replace the interface of Cadence header
files.

So update the mxc_hifi4.h file to provide new interface for
user space to use.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
include/uapi/linux/mxc_hifi4.h

index 27a3c4f..e22f7f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 NXP
+ * Copyright 2018 NXP
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -35,6 +35,8 @@
 #define HIFI4_GET_PCM_PROP             _IOW(HIFI4_IOC_MAGIC, 6, unsigned int)
 #define HIFI4_SET_CONFIG               _IOW(HIFI4_IOC_MAGIC, 7, unsigned int)
 #define HIFI4_RESET_CODEC              _IOW(HIFI4_IOC_MAGIC, 8, unsigned int)
+#define HIFI4_CLIENT_REGISTER          _IOW(HIFI4_IOC_MAGIC, 9, unsigned int)
+#define HIFI4_CLIENT_UNREGISTER                _IOW(HIFI4_IOC_MAGIC, 10, unsigned int)
 
 #define CODEC_MP3_DEC          1
 #define CODEC_AAC_DEC          2
 #define CODEC_SBC_ENC          8
 #define CODEC_DEMO_DEC         9
 
+enum HIFI_ERROR_TYPE {
+       XA_SUCCESS = 0,
+
+       XA_ERROR_STREAM,
+       XA_PARA_ERROR,
+       XA_INSUFFICIENT_MEM,
+       XA_ERR_UNKNOWN,
+       XA_PROFILE_NOT_SUPPORT,
+       XA_INIT_ERR,
+       XA_NO_OUTPUT,
+
+       XA_NOT_ENOUGH_DATA = 0x100,
+       XA_CAPIBILITY_CHANGE = 0x200,
+       XA_END_OF_STREAM = 0x300, /* no output */
+};
+
+/* Parameter type to Set /Get */
+enum HIFI_ParaType {
+/* Set parmameters */
+/* common  */
+       XA_SAMPLERATE = 0,
+       XA_CHANNEL,
+       XA_FRAMED,        /* one whole frame input */
+       XA_DEPTH,
+       XA_CODEC_DATA,
+       XA_BITRATE,
+       XA_DOWNMIX_STEREO,
+       XA_STREAM_TYPE,
+       XA_CHAN_MAP_TABLE,
+       //UNIA_CHANNEL_MASK,
+       XA_TO_STEREO,
+
+/* dedicate for mp3 dec */
+       XA_MP3_DEC_CRC_CHECK = 0x120,
+       XA_MP3_DEC_MCH_ENABLE,
+       XA_MP3_DEC_NONSTD_STRM_SUPPORT,
+
+/* dedicate for bsac dec */
+       XA_BSAC_DEC_DECODELAYERS = 0x130,
+
+/* dedicate for aacplus dec */
+       XA_AACPLUS_DEC_BDOWNSAMPLE = 0x140,
+       XA_AACPLUS_DEC_BBITSTREAMDOWNMIX,
+       XA_AACPLUS_DEC_CHANROUTING,
+
+/* dedicate for dabplus dec */
+       XA_DABPLUS_DEC_BDOWNSAMPLE = 0x150,
+       XA_DABPLUS_DEC_BBITSTREAMDOWNMIX,
+       XA_DABPLUS_DEC_CHANROUTING,
+
+/* dedicate for sbc enc */
+       XA_SBC_ENC_SUBBANDS = 0x160,
+       XA_SBC_ENC_BLOCKS,
+       XA_SBC_ENC_SNR,
+       XA_SBC_ENC_BITPOOL,
+       XA_SBC_ENC_CHMODE,
+
+};
+
+#define HIFI_STREAM_DABPLUS_BASE  0x30
+enum HIFI_StreamType {
+    /* AAC/AACPLUS file format */
+       XA_STREAM_UNKNOWN = 0,
+       XA_STREAM_ADTS,
+       XA_STREAM_ADIF,
+       XA_STREAM_RAW,
+
+       XA_STREAM_LATM,
+       XA_STREAM_LATM_OUTOFBAND_CONFIG,
+       XA_STREAM_LOAS,
+
+    /* DABPLUS file format */
+       XA_STREAM_DABPLUS_RAW_SIDEINFO = HIFI_STREAM_DABPLUS_BASE,
+       XA_STREAM_DABPLUS,
+
+    /* BSAC file raw format */
+       XA_STREAM_BSAC_RAW,
+
+};
+
+/* sbc_enc-specific channel modes */
+enum HIFI_SbcEncChmode {
+       XA_CHMODE_MONO =   0,
+       XA_CHMODE_DUAL =   1,
+       XA_CHMODE_STEREO = 2,
+       XA_CHMODE_JOINT =  3,
+};
+
+enum lib_type {
+       HIFI_CODEC_LIB = 1,
+       HIFI_CODEC_WRAP_LIB,
+};
+
 struct decode_info {
        void *in_buf_addr;
        int   in_buf_size;
@@ -53,7 +148,6 @@ struct decode_info {
        void *out_buf_addr;
        int   out_buf_size;
        int   out_buf_off;
-       unsigned int cycles;
        unsigned int input_over;
        unsigned int process_id;
 };
@@ -63,14 +157,7 @@ struct prop_info {
        int   channels;
        int   bits;
        unsigned int consumed_bytes;
-
-       /* dedicate for drm dec */
-       int   frame_size;
-
-       /* dedicate for bsac, aacplus and dabplus dec */
-       int   aac_samplerate;
-       int   sbr_type;
-       int   mpeg_surr_present;
+       unsigned int cycles;
 
        unsigned int process_id;
 };
@@ -79,6 +166,7 @@ struct binary_info {
        int type;
        char *file;
        unsigned int process_id;
+       unsigned int lib_type;
 };
 
 struct prop_config {