Эх сурвалжийг харах

uapi: lsm_params: add support for lsm version 3.0

Listen v3.0 adds new algorithm and multichannel support. The
input and output of LSM could have different media format,
especially number of channels. Add required support to obtain
input hardware params from userspace. Existing pcm_hw_params
operations will be used to obtain the lsm output hw params.

Change-Id: I3feca50b4b13ece59ceb39787199e2cec17b3cae
Signed-off-by: Bhalchandra Gajare <[email protected]>
Bhalchandra Gajare 6 жил өмнө
parent
commit
1f6b04af93

+ 31 - 1
include/uapi/sound/lsm_params.h

@@ -7,7 +7,7 @@
 #include <linux/types.h>
 #include <sound/asound.h>
 
-#define SNDRV_LSM_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0)
+#define SNDRV_LSM_VERSION SNDRV_PROTOCOL_VERSION(0, 3, 0)
 
 #define LSM_OUT_FORMAT_PCM (0)
 #define LSM_OUT_FORMAT_ADPCM (1 << 0)
@@ -38,6 +38,18 @@
 #define LSM_DET_EVENT_TYPE_LEGACY (0)
 #define LSM_DET_EVENT_TYPE_GENERIC (1)
 
+/* Valid sample rates for input hw_params */
+#define LSM_INPUT_SAMPLE_RATE_16K 16000
+#define LSM_INPUT_SAMPLE_RATE_48K 48000
+
+/* Valid bit-widths for input hw_params */
+#define LSM_INPUT_BIT_WIDTH_16	16
+#define LSM_INPUT_BIT_WIDTH_24	24
+
+/* Min and Max channels for input hw_params */
+#define LSM_INPUT_NUM_CHANNELS_MIN	1
+#define LSM_INPUT_NUM_CHANNELS_MAX	9
+
 enum lsm_app_id {
 	LSM_VOICE_WAKEUP_APP_ID = 1,
 	LSM_VOICE_WAKEUP_APP_ID_V2 = 2,
@@ -189,6 +201,22 @@ struct snd_lsm_output_format_cfg {
 	__u8 mode;
 };
 
+/*
+ * Data passed to SNDRV_LSM_SET_INPUT_HW_PARAMS ioctl
+ *
+ * @sample_rate: Sample rate of input to lsm.
+ *		 valid values are 16000 and 48000
+ * @bit_width: Bit width of audio samples input to lsm.
+ *	       valid values are 16 and 24
+ * @num_channels: Number of channels input to lsm.
+ *		  valid values are range from 1 to 16
+ */
+struct snd_lsm_input_hw_params {
+	__u32 sample_rate;
+	__u16 bit_width;
+	__u16 num_channels;
+} __packed;
+
 #define SNDRV_LSM_DEREG_SND_MODEL _IOW('U', 0x01, int)
 #define SNDRV_LSM_EVENT_STATUS	_IOW('U', 0x02, struct snd_lsm_event_status)
 #define SNDRV_LSM_ABORT_EVENT	_IOW('U', 0x03, int)
@@ -210,5 +238,7 @@ struct snd_lsm_output_format_cfg {
 #define SNDRV_LSM_EVENT_STATUS_V3	_IOW('U', 0x0F, \
 					struct snd_lsm_event_status_v3)
 #define SNDRV_LSM_GENERIC_DET_EVENT	_IOW('U', 0x10, struct snd_lsm_event_status)
+#define SNDRV_LSM_SET_INPUT_HW_PARAMS	_IOW('U', 0x11,	\
+					     struct snd_lsm_input_hw_params)
 
 #endif