propagate ospl module from bomr1-8998 kernel branch

copy base from bomr1-8998: f2668732ab262c40c81286418aec9e8122aa690f

Change-Id: I25b4097dee29afce11121ef1211c7460c3980c1e
Signed-off-by: huangys <huangys@motorola.com>
Reviewed-on: https://gerrit.mot.com/1166270
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
huangys 2018-04-20 20:08:14 +08:00 • committed by Yuesheng Huang
commit eb96306f27
5 changed files with 1505 additions and 1 deletions

View file

@ -0,0 +1,30 @@
Motorola interface driver for Opalum Speaker Protection
This device supports interfacing between the module in DSP and the client in AP.
Required properties:
- compatible : "mmi,ospl2xx";
- mmi,ospl-afe-port-id : module rx port id and module tx port id
- mmi,ospl-left-feedback and/or mmi,ospl-right-feedback : at least one of feedback
channel at module tx port should be specified.
Optional properties:
- mmi,ospl-tune-index : indexes for the tuning table in Qualcomm DSP, if not
specified, default tuning tables located at first index will be used.
- mmi,ospl-volume-control : OSPL in DSP supports volume control
- mmi,ospl-passive-f0 : OSPL in DSP reports f0 and ref_diff once it's calculation
is done, kernel doesn't need to send get_param call to get it.
Examples:
ospl {
compatible = "mmi,ospl2xx";
status = "ok";
mmi,ospl-tune-index = <4 5 6 7>;
mmi,ospl-afe-port-id = <16384 16387>;
mmi,ospl-left-feedback;
mmi,ospl-volume-control;
mmi,ospl-passive-f0;
};

123
include/sound/ospl2xx.h Normal file
View file

@ -0,0 +1,123 @@
/* Copyright (c) 2015-2017, Motorola Mobility, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __OSPL2XX_H__
#define __OSPL2XX_H__
#include <dsp/apr_audio-v2.h>
#include <sound/soc.h>
/* module IDs */
#define AFE_CUSTOM_OPALUM_RX_MODULE 0x00A1AF00
#define AFE_CUSTOM_OPALUM_TX_MODULE 0x00A1BF00
/* RX module parameter IDs */
/* Get Module status */
#define PARAM_ID_OPALUM_RX_ENABLE 0x00A1AF01
/* Switch between internal config strings */
#define PARAM_ID_OPALUM_RX_SET_USE_CASE 0x00A1AF02
/* Run production line test */
#define PARAM_ID_OPALUM_RX_RUN_CALIBRATION 0x00A1AF03
/* Initialize parameters from external config string */
#define PARAM_ID_OPALUM_RX_SET_EXTERNAL_CONFIG 0x00A1AF05
/* Get the currently set excursion model */
#define PARAM_ID_OPALUM_RX_EXC_MODEL 0x00A1AF06
/* Get current temperature */
#define PARAM_ID_OPLAUM_RX_TEMPERATURE 0x00A1AF07
/* Set temperature calibration values */
#define PARAM_ID_OPALUM_RX_TEMP_CAL_DATA 0x00A1AF08
/* Get the array index of the parameter set currently in use.
* Will return -1 when an external string is used
*/
#define PARAM_ID_OPALUM_RX_CURRENT_PARAM_SET 0x00A1AF11
/* Set volume control attenuation */
#define PARAM_ID_OPALUM_RX_VOLUME_CONTROL 0x00A1AF12
/* TX module parameter IDs */
/* Get Module status */
#define PARAM_ID_OPALUM_TX_ENABLE 0x00A1BF01
/* Switch between internal config strings */
#define PARAM_ID_OPALUM_TX_SET_USE_CASE 0x00A1BF02
/* Run production line test */
#define PARAM_ID_OPALUM_TX_RUN_CALIBRATION 0x00A1BF03
/* Get f0 calibration values */
#define PARAM_ID_OPALUM_TX_F0_CALIBRATION_VALUE 0x00A1BF05
/* Get impedance calibration values */
#define PARAM_ID_OPALUM_TX_TEMP_MEASUREMENT_VALUE 0x00A1BF06
/* Get f0 curve */
#define PARAM_ID_OPALUM_TX_F0_CURVE 0x00A1BF07
/* Initialize parameters from external config string */
#define PARAM_ID_OPALUM_TX_SET_EXTERNAL_CONFIG 0x00A1BF08
/* Get the array index of the parameter set currently in use.
* Will return -1 when an external string is used
*/
#define PARAM_ID_OPALUM_TX_CURRENT_PARAM_SET 0x00A1BF11
#define F0_CURVE_POINTS 90
#if defined(CONFIG_MSM_QDSP6_APRV2_GLINK) || \
defined(CONFIG_MSM_QDSP6_APRV3_GLINK)
#define MAX_APR_STRING 400
#else
#define MAX_APR_STRING 4000
#endif
struct afe_custom_opalum_set_config_t {
struct apr_hdr hdr;
struct afe_port_cmd_set_param_v2 param;
struct afe_port_param_data_v2 data;
} __packed;
struct afe_custom_opalum_get_config_t {
struct apr_hdr hdr;
struct afe_port_cmd_get_param_v2 param;
struct afe_port_param_data_v2 data;
} __packed;
struct opalum_single_data_ctrl_t {
int32_t value;
};
struct opalum_dual_data_ctrl_t {
int32_t data1;
int32_t data2;
};
struct opalum_f0_calib_data_t {
int f0;
int ref_diff;
};
struct opalum_f0_curve_t {
int32_t curve[F0_CURVE_POINTS];
};
struct opalum_temp_calib_data_t {
int acc;
int count;
};
struct opalum_tri_data_ctrl_t {
int32_t data1;
int32_t data2;
int32_t data3;
};
struct opalum_external_config_t {
uint32_t total_size;
uint32_t chunk_size;
uint32_t done;
const char *config;
};
int ospl2xx_init(struct snd_soc_pcm_runtime *rtd);
#endif /* __OSPL2XX_H__ */

View file

@ -31,6 +31,12 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
include $(CLEAR_VARS)
LOCAL_MODULE := cirrus_ospl.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
include $(CLEAR_VARS)
LOCAL_MODULE := aov_trigger.ko
LOCAL_MODULE_TAGS := optional

View file

@ -1,7 +1,9 @@
# add -Wall to try to catch everything we can.
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include
EXTRA_CFLAGS += -DCONFIG_SND_SOC_AOV_TRIGGER
EXTRA_CFLAGS += -I$(TOP)/vendor/qcom/opensource/audio-kernel/include
EXTRA_CFLAGS += -I$(TOP)/vendor/qcom/opensource/audio-kernel/include/uapi
EXTRA_CFLAGS += -DCONFIG_SND_SOC_AOV_TRIGGER -DCONFIG_SND_SOC_OPALUM
cirrus_madera-objs = madera.o madera-slimbus.o wm_adsp.o
obj-m += cirrus_madera.o
@ -18,4 +20,7 @@ obj-m += cirrus_cs47l35.o
cirrus_cs47l90-objs = cs47l90.o
obj-m += cirrus_cs47l90.o
cirrus_ospl-objs = ospl2xx.o
obj-m += cirrus_ospl.o
obj-m += aov_trigger.o

1340
sound/soc/codecs/ospl2xx.c Normal file

File diff suppressed because it is too large Load diff