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

Commit 5608ece5 authored by Banajit Goswami's avatar Banajit Goswami
Browse files

ASoC: wcd9335: Add support to enable vbat feature



Add support to enable vbat monitor feature on tasha codec.
Vbat module monitors the battery voltage and updates the
gain on rx path if battery voltage falls below certain
threshold value. This module can prevent brown-out
scenarios on the mobile devices when the loads are heavy
on the battery and it can also prolong battery life.

Change-Id: I66bacf3b861618fc44f50a8e22ca3f2f0fc7763b
Signed-off-by: default avatarVenkata Narendra Kumar Gutta <vgutta@codeaurora.org>
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
parent c67eb195
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -19,6 +19,7 @@ enum wcd_cal_type {
	WCD9XXX_ANC_CAL = WCD9XXX_MIN_CAL,
	WCD9XXX_MAD_CAL,
	WCD9XXX_MBHC_CAL,
	WCD9XXX_VBAT_CAL,
	WCD9XXX_MAX_CAL,
};

+412 −0

File changed.

Preview size limit exceeded, changes collapsed.

+10 −5
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#define WCD_CLSH_EVENT_PRE_DAC 0x01
#define WCD_CLSH_EVENT_POST_PA 0x02

#define MAX_VBAT_MONITOR_WRITES 17
/*
 * Basic states for Class H state machine.
 * represented as a bit mask within a u8 data type
@@ -130,6 +130,11 @@ struct wcd9xxx_anc_header {
	u32 num_anc_slots;
};

struct vbat_monitor_reg {
	u32 size;
	u32 writes[MAX_VBAT_MONITOR_WRITES];
} __packed;

extern void wcd_clsh_fsm(struct snd_soc_codec *codec,
		struct wcd_clsh_cdc_data *cdc_clsh_d,
		u8 clsh_event, u8 req_state,
@@ -155,22 +160,22 @@ enum {
	MAD_ULT_INT_DEST_SELECT_REG,
	MAD_BEACON_INT_DEST_SELECT_REG,
	MAD_CLIP_INT_DEST_SELECT_REG,
	MAD_VBAT_INT_DEST_SELECT_REG,
	VBAT_INT_DEST_SELECT_REG,
	MAD_AUDIO_INT_MASK_REG,
	MAD_ULT_INT_MASK_REG,
	MAD_BEACON_INT_MASK_REG,
	MAD_CLIP_INT_MASK_REG,
	MAD_VBAT_INT_MASK_REG,
	VBAT_INT_MASK_REG,
	MAD_AUDIO_INT_STATUS_REG,
	MAD_ULT_INT_STATUS_REG,
	MAD_BEACON_INT_STATUS_REG,
	MAD_CLIP_INT_STATUS_REG,
	MAD_VBAT_INT_STATUS_REG,
	VBAT_INT_STATUS_REG,
	MAD_AUDIO_INT_CLEAR_REG,
	MAD_ULT_INT_CLEAR_REG,
	MAD_BEACON_INT_CLEAR_REG,
	MAD_CLIP_INT_CLEAR_REG,
	MAD_VBAT_INT_CLEAR_REG,
	VBAT_INT_CLEAR_REG,
	SB_PGD_PORT_TX_WATERMARK_N,
	SB_PGD_PORT_TX_ENABLE_N,
	SB_PGD_PORT_RX_WATERMARK_N,
+2 −0
Original line number Diff line number Diff line
@@ -23,12 +23,14 @@ const int cal_size_info[WCD9XXX_MAX_CAL] = {
	[WCD9XXX_ANC_CAL] = 16384,
	[WCD9XXX_MBHC_CAL] = 4096,
	[WCD9XXX_MAD_CAL] = 4096,
	[WCD9XXX_VBAT_CAL] = 72,
};

const char *cal_name_info[WCD9XXX_MAX_CAL] = {
	[WCD9XXX_ANC_CAL] = "anc",
	[WCD9XXX_MBHC_CAL] = "mbhc",
	[WCD9XXX_MAD_CAL] = "mad",
	[WCD9XXX_VBAT_CAL] = "vbat",
};

struct firmware_cal *wcdcal_get_fw_cal(struct fw_info *fw_data,