asoc: Add support for rouleur codec in machine driver
Add rouleur codec support in bengal machine driver to create codec entry and invoke mbhc hs detect functions for respective codecs. Correct the logic for headset detection pull up current and volatile registers for digital part of rouleur codec. Change-Id: I22545dc796c215c1501e883796546c97d8ca8698 Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
29eea04338
commit
ee6367c560
@@ -31,8 +31,10 @@
|
|||||||
#include "asoc/msm-cdc-pinctrl.h"
|
#include "asoc/msm-cdc-pinctrl.h"
|
||||||
#include "asoc/wcd-mbhc-v2.h"
|
#include "asoc/wcd-mbhc-v2.h"
|
||||||
#include "codecs/wcd937x/wcd937x-mbhc.h"
|
#include "codecs/wcd937x/wcd937x-mbhc.h"
|
||||||
|
#include "codecs/rouleur/rouleur-mbhc.h"
|
||||||
#include "codecs/wsa881x-analog.h"
|
#include "codecs/wsa881x-analog.h"
|
||||||
#include "codecs/wcd937x/wcd937x.h"
|
#include "codecs/wcd937x/wcd937x.h"
|
||||||
|
#include "codecs/rouleur/rouleur.h"
|
||||||
#include "codecs/bolero/bolero-cdc.h"
|
#include "codecs/bolero/bolero-cdc.h"
|
||||||
#include <dt-bindings/sound/audio-codec-port-types.h>
|
#include <dt-bindings/sound/audio-codec-port-types.h>
|
||||||
#include "bengal-port-config.h"
|
#include "bengal-port-config.h"
|
||||||
@@ -6054,9 +6056,13 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
|
|||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
struct snd_card *card = component->card->snd_card;
|
struct snd_card *card = component->card->snd_card;
|
||||||
struct msm_asoc_mach_data *pdata;
|
struct msm_asoc_mach_data *pdata;
|
||||||
|
struct platform_device *pdev = NULL;
|
||||||
|
char *data = NULL;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "EAR");
|
snd_soc_dapm_ignore_suspend(dapm, "EAR");
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "AUX");
|
snd_soc_dapm_ignore_suspend(dapm, "AUX");
|
||||||
|
snd_soc_dapm_ignore_suspend(dapm, "LO");
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "HPHL");
|
snd_soc_dapm_ignore_suspend(dapm, "HPHL");
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "HPHR");
|
snd_soc_dapm_ignore_suspend(dapm, "HPHR");
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "AMIC1");
|
snd_soc_dapm_ignore_suspend(dapm, "AMIC1");
|
||||||
@@ -6077,14 +6083,49 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
|
|||||||
}
|
}
|
||||||
pdata->codec_root = entry;
|
pdata->codec_root = entry;
|
||||||
}
|
}
|
||||||
wcd937x_info_create_codec_entry(pdata->codec_root, component);
|
|
||||||
|
for (i = 0; i < component->card->num_aux_devs; i++)
|
||||||
|
{
|
||||||
|
if (msm_aux_dev[i].name != NULL ) {
|
||||||
|
if (strstr(msm_aux_dev[i].name, "wsa"))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msm_aux_dev[i].codec_of_node) {
|
||||||
|
pdev = of_find_device_by_node(
|
||||||
|
msm_aux_dev[i].codec_of_node);
|
||||||
|
if (pdev)
|
||||||
|
data = (char*) of_device_get_match_data(
|
||||||
|
&pdev->dev);
|
||||||
|
|
||||||
|
if (data != NULL) {
|
||||||
|
if (!strncmp(data, "wcd937x",
|
||||||
|
sizeof("wcd937x"))) {
|
||||||
|
wcd937x_info_create_codec_entry(
|
||||||
|
pdata->codec_root, component);
|
||||||
|
break;
|
||||||
|
} else if (!strncmp(data, "rouleur",
|
||||||
|
sizeof("rouleur"))) {
|
||||||
|
rouleur_info_create_codec_entry(
|
||||||
|
pdata->codec_root, component);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mbhc_cfg_cal:
|
mbhc_cfg_cal:
|
||||||
mbhc_calibration = def_wcd_mbhc_cal();
|
mbhc_calibration = def_wcd_mbhc_cal();
|
||||||
if (!mbhc_calibration)
|
if (!mbhc_calibration)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
wcd_mbhc_cfg.calibration = mbhc_calibration;
|
wcd_mbhc_cfg.calibration = mbhc_calibration;
|
||||||
ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
|
if (data != NULL) {
|
||||||
|
if (!strncmp(data, "wcd937x", sizeof("wcd937x")))
|
||||||
|
ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
|
||||||
|
else if (!strncmp( data, "rouleur", sizeof("rouleur")))
|
||||||
|
ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n",
|
dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
|
@@ -291,14 +291,14 @@ static void rouleur_mbhc_hph_l_pull_up_control(
|
|||||||
/* Default pull up current to 2uA */
|
/* Default pull up current to 2uA */
|
||||||
if (pull_up_cur < I_OFF || pull_up_cur > I_3P0_UA ||
|
if (pull_up_cur < I_OFF || pull_up_cur > I_3P0_UA ||
|
||||||
pull_up_cur == I_DEFAULT)
|
pull_up_cur == I_DEFAULT)
|
||||||
pull_up_cur = I_2P0_UA;
|
pull_up_cur = I_3P0_UA;
|
||||||
|
|
||||||
dev_dbg(component->dev, "%s: HS pull up current:%d\n",
|
dev_dbg(component->dev, "%s: HS pull up current:%d\n",
|
||||||
__func__, pull_up_cur);
|
__func__, pull_up_cur);
|
||||||
|
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
ROULEUR_ANA_MBHC_PLUG_DETECT_CTL,
|
ROULEUR_ANA_MBHC_PLUG_DETECT_CTL,
|
||||||
0xC0, pull_up_cur);
|
0xC0, pull_up_cur << 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rouleur_mbhc_request_micbias(struct snd_soc_component *component,
|
static int rouleur_mbhc_request_micbias(struct snd_soc_component *component,
|
||||||
|
@@ -134,13 +134,11 @@ static bool rouleur_volatile_register(struct device *dev, unsigned int reg)
|
|||||||
if ((rouleur_reg_access_analog[ROULEUR_REG(reg)] & RD_REG)
|
if ((rouleur_reg_access_analog[ROULEUR_REG(reg)] & RD_REG)
|
||||||
&& !(rouleur_reg_access_analog[ROULEUR_REG(reg)] & WR_REG))
|
&& !(rouleur_reg_access_analog[ROULEUR_REG(reg)] & WR_REG))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
|
||||||
if (reg > ROULEUR_DIG_BASE_ADDR && reg <
|
if (reg > ROULEUR_DIG_BASE_ADDR && reg <
|
||||||
ROULEUR_DIGITAL_REGISTERS_MAX_SIZE)
|
ROULEUR_DIGITAL_REGISTERS_MAX_SIZE)
|
||||||
if ((rouleur_reg_access_digital[ROULEUR_REG(reg)] & RD_REG)
|
if ((rouleur_reg_access_digital[ROULEUR_REG(reg)] & RD_REG)
|
||||||
&& !(rouleur_reg_access_digital[ROULEUR_REG(reg)] & WR_REG))
|
&& !(rouleur_reg_access_digital[ROULEUR_REG(reg)] & WR_REG))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2392,7 +2392,7 @@ static void rouleur_unbind(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id rouleur_dt_match[] = {
|
static const struct of_device_id rouleur_dt_match[] = {
|
||||||
{ .compatible = "qcom,rouleur-codec" },
|
{ .compatible = "qcom,rouleur-codec" , .data = "rouleur" },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -3132,7 +3132,7 @@ static void wcd937x_unbind(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id wcd937x_dt_match[] = {
|
static const struct of_device_id wcd937x_dt_match[] = {
|
||||||
{ .compatible = "qcom,wcd937x-codec" },
|
{ .compatible = "qcom,wcd937x-codec" , .data = "wcd937x" },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user