ASoC: AQT1000: Add support for MBHC hardware in AQT1000 codec

AQT1000 codec supports MBHC(Multi Button Headset controller)
functionality. Add driver support for MBHC hardware in AQT1000 codec.

Change-Id: Ia21a5bda304d42b2aedcf54f6df92ed29dd23a41
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
Sudheer Papothi
2017-12-29 02:23:54 +05:30
committed by Gerrit - the friendly Code Review server
parent 8c9bd0f7d0
commit 40270c4787
4 changed files with 316 additions and 344 deletions

View File

@@ -1,5 +1,4 @@
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, 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
@@ -10,45 +9,32 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __AQT_MBHC_H__
#define __AQT_MBHC_H__
#ifndef __AQT1000_MBHC_H__
#define __AQT1000_MBHC_H__
#include "../wcd-mbhc-v2.h"
enum aqt_on_demand_supply_name {
AQT_ON_DEMAND_MICBIAS = 0,
AQT_ON_DEMAND_SUPPLIES_MAX,
};
struct aqt_on_demand_supply {
struct regulator *supply;
int ondemand_supply_count;
};
struct aqt_mbhc {
struct aqt1000_mbhc {
struct wcd_mbhc wcd_mbhc;
struct blocking_notifier_head notifier;
struct aqt_on_demand_supply on_demand_list[
AQT_ON_DEMAND_SUPPLIES_MAX];
struct aqt1000 *aqt;
struct fw_info *fw_data;
bool mbhc_started;
bool is_hph_recover;
};
#if IS_ENABLED(CONFIG_SND_SOC_AQT_MBHC)
extern int aqt_mbhc_init(struct aqt_mbhc **mbhc,
#if IS_ENABLED(CONFIG_SND_SOC_AQT1000)
extern int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
struct snd_soc_codec *codec,
struct fw_info *fw_data);
extern void aqt_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
extern int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
struct wcd_mbhc_config *mbhc_cfg);
extern void aqt_mbhc_deinit(struct snd_soc_codec *codec);
extern int aqt_mbhc_post_ssr_init(struct aqt_mbhc *mbhc,
extern int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
struct snd_soc_codec *codec);
extern int aqt_mbhc_get_impedance(struct aqt_mbhc *aqt_mbhc,
extern int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
uint32_t *zl, uint32_t *zr);
#else
static inline int aqt_mbhc_init(struct aqt_mbhc **mbhc,
static inline int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
struct snd_soc_codec *codec,
struct fw_info *fw_data)
{
@@ -65,12 +51,13 @@ static inline int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
static inline void aqt_mbhc_deinit(struct snd_soc_codec *codec)
{
}
static inline int aqt_mbhc_post_ssr_init(struct aqt_mbhc *mbhc,
static inline int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
struct snd_soc_codec *codec)
{
return 0;
}
static inline int aqt_mbhc_get_impedance(struct aqt_mbhc *aqt_mbhc,
static inline int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
uint32_t *zl, uint32_t *zr)
{
if (zl)
@@ -81,4 +68,4 @@ static inline int aqt_mbhc_get_impedance(struct aqt_mbhc *aqt_mbhc,
}
#endif
#endif /* __AQT_MBHC_H__ */
#endif /* __AQT1000_MBHC_H__ */