Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bae55be authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dsp: add LDAC encoder support"

parents 68b1ed3d 0a087aff
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ enum {
	ENC_FMT_APTX = ASM_MEDIA_FMT_APTX,
	ENC_FMT_APTX_HD = ASM_MEDIA_FMT_APTX_HD,
	ENC_FMT_CELT = ASM_MEDIA_FMT_CELT,
	ENC_FMT_LDAC = ASM_MEDIA_FMT_LDAC,
};

enum {
@@ -2263,6 +2264,11 @@ static int msm_dai_q6_afe_enc_cfg_get(struct snd_kcontrol *kcontrol,
				&dai_data->enc_config.data,
				sizeof(struct asm_celt_enc_cfg_t));
			break;
		case ENC_FMT_LDAC:
			memcpy(ucontrol->value.bytes.data + format_size,
				&dai_data->enc_config.data,
				sizeof(struct asm_ldac_enc_cfg_t));
			break;
		default:
			pr_debug("%s: unknown format = %d\n",
				 __func__, dai_data->enc_config.format);
@@ -2316,6 +2322,11 @@ static int msm_dai_q6_afe_enc_cfg_put(struct snd_kcontrol *kcontrol,
				ucontrol->value.bytes.data + format_size,
				sizeof(struct asm_celt_enc_cfg_t));
			break;
		case ENC_FMT_LDAC:
			memcpy(&dai_data->enc_config.data,
				ucontrol->value.bytes.data + format_size,
				sizeof(struct asm_ldac_enc_cfg_t));
			break;
		default:
			pr_debug("%s: Ignore enc config for unknown format = %d\n",
				 __func__, dai_data->enc_config.format);
+10 −2
Original line number Diff line number Diff line
@@ -2973,7 +2973,7 @@ static int q6afe_send_enc_config(u16 port_id,
	pr_debug("%s:update DSP for enc format = %d\n", __func__, format);
	if (format != ASM_MEDIA_FMT_SBC && format != ASM_MEDIA_FMT_AAC_V2 &&
	    format != ASM_MEDIA_FMT_APTX && format != ASM_MEDIA_FMT_APTX_HD &&
	    format != ASM_MEDIA_FMT_CELT) {
	    format != ASM_MEDIA_FMT_CELT && format != ASM_MEDIA_FMT_LDAC) {
		pr_err("%s:Unsuppported format Ignore AFE config\n", __func__);
		return 0;
	}
@@ -3081,7 +3081,15 @@ static int q6afe_send_enc_config(u16 port_id,
	config.pdata.module_id = AFE_MODULE_PORT;
	config.pdata.param_id = AFE_PARAM_ID_PORT_MEDIA_TYPE;
	config.port.media_type.minor_version = AFE_API_VERSION_PORT_MEDIA_TYPE;
	config.port.media_type.sample_rate = afe_config.slim_sch.sample_rate;
	if (format == ASM_MEDIA_FMT_LDAC) {
		config.port.media_type.sample_rate =
			config.port.enc_blk_param.enc_blk_config.ldac_config.
				custom_config.sample_rate;
	} else {
		config.port.media_type.sample_rate =
			afe_config.slim_sch.sample_rate;
	}

	if (afe_in_bit_width)
		config.port.media_type.bit_width = afe_in_bit_width;
	else
+45 −0
Original line number Diff line number Diff line
@@ -3383,6 +3383,50 @@ struct asm_celt_enc_cfg_t {
	struct asm_celt_specific_enc_cfg_t  celt_specific_config;
} __packed;

#define ASM_MEDIA_FMT_LDAC 0x00013224
struct asm_ldac_specific_enc_cfg_t {
	/*
	 * This is used to calculate the encoder output
	 * bytes per frame (i.e. bytes per packet).
	 * Bit rate also configures the EQMID.
	 * The min bit rate 303000 bps is calculated for
	 * 44.1 kHz and 88.2 KHz sampling frequencies with
	 * Mobile use Quality.
	 * The max bit rate of 990000 bps is calculated for
	 * 96kHz and 48 KHz with High Quality
	 * @Range(in bits per second)
	 * 303000 for Mobile use Quality
	 * 606000 for standard Quality
	 * 909000 for High Quality
	 */
	uint32_t                     bit_rate;
	/*
	 * The channel setting information for LDAC specification
	 * of Bluetooth A2DP which is determined by SRC and SNK
	 * devices in Bluetooth transmission.
	 * @Range:
	 * 0 for native mode
	 * 4 for mono
	 * 2 for dual channel
	 * 1 for stereo
	 */
	uint16_t                     channel_mode;
	/*
	 * Maximum Transmission Unit (MTU).
	 * The minimum MTU that a L2CAP implementation for LDAC shall
	 * support is 679 bytes, because LDAC is optimized with 2-DH5
	 * packet as its target.
	 * @Range : 679
	 * @Default: 679 for LDACBT_MTU_2DH5
	 */
	uint16_t                     mtu;
} __packed;

struct asm_ldac_enc_cfg_t {
	struct asm_custom_enc_cfg_t  custom_config;
	struct asm_ldac_specific_enc_cfg_t  ldac_specific_config;
} __packed;

struct afe_enc_fmt_id_param_t {
	/*
	 * Supported values:
@@ -3453,6 +3497,7 @@ union afe_enc_config_data {
	struct asm_custom_enc_cfg_t  custom_config;
	struct asm_celt_enc_cfg_t  celt_config;
	struct asm_aptx_enc_cfg_t  aptx_config;
	struct asm_ldac_enc_cfg_t  ldac_config;
};

struct afe_enc_config {