asoc: wcd938x: update wcd938x driver

Update wcd938x driver to fix compile error.

Change-Id: Ifc939a46d7e09852b147289dd9e69d2f56a67751
Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
Meng Wang
2018-12-17 18:55:51 +08:00
parent d0dd6a6284
commit 64e8c2b2af
2 changed files with 36 additions and 25 deletions

View File

@@ -8,6 +8,7 @@
#include <asoc/wcd-mbhc-v2.h> #include <asoc/wcd-mbhc-v2.h>
#include <asoc/wcd-irq.h> #include <asoc/wcd-irq.h>
#include <asoc/wcd-clsh.h>
#include "wcd938x-mbhc.h" #include "wcd938x-mbhc.h"
#define WCD938X_MAX_MICBIAS 4 #define WCD938X_MAX_MICBIAS 4

View File

@@ -87,7 +87,6 @@ static struct regmap_irq_chip wcd938x_regmap_irq_chip = {
.type_base = WCD938X_DIGITAL_INTR_LEVEL_0, .type_base = WCD938X_DIGITAL_INTR_LEVEL_0,
.ack_base = WCD938X_DIGITAL_INTR_CLEAR_0, .ack_base = WCD938X_DIGITAL_INTR_CLEAR_0,
.use_ack = 1, .use_ack = 1,
.clear_ack = 1,
.runtime_pm = true, .runtime_pm = true,
.handle_post_irq = wcd938x_handle_post_irq, .handle_post_irq = wcd938x_handle_post_irq,
.irq_drv_data = NULL, .irq_drv_data = NULL,
@@ -161,7 +160,7 @@ static int wcd938x_set_port_params(struct snd_soc_component *component,
for (i = 0; i <= num_ports; i++) { for (i = 0; i <= num_ports; i++) {
for (j = 0; j < MAX_CH_PER_PORT; j++) { for (j = 0; j < MAX_CH_PER_PORT; j++) {
if ((*map)[i][j].port_type == slv_prt_type) if ((*map)[i][j].slave_port_type == slv_prt_type)
goto found; goto found;
} }
} }
@@ -236,7 +235,7 @@ static int wcd938x_parse_port_mapping(struct device *dev,
if (port_num != old_port_num) if (port_num != old_port_num)
ch_iter = 0; ch_iter = 0;
(*map)[port_num][ch_iter].port_type = slave_port_type; (*map)[port_num][ch_iter].slave_port_type = slave_port_type;
(*map)[port_num][ch_iter].ch_mask = ch_mask; (*map)[port_num][ch_iter].ch_mask = ch_mask;
(*map)[port_num][ch_iter].master_port_type = master_port_type; (*map)[port_num][ch_iter].master_port_type = master_port_type;
(*map)[port_num][ch_iter].num_ch = __sw_hweight8(ch_mask); (*map)[port_num][ch_iter].num_ch = __sw_hweight8(ch_mask);
@@ -405,7 +404,7 @@ static int wcd938x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
WCD938X_DIGITAL_CDC_COMP_CTL_0, 0x02, 0x02); WCD938X_DIGITAL_CDC_COMP_CTL_0, 0x02, 0x02);
/* 5msec compander delay as per HW requirement */ /* 5msec compander delay as per HW requirement */
if (!wcd938x->comp2_enable || if (!wcd938x->comp2_enable ||
(snd_soc_component_read(component, (snd_soc_component_read32(component,
WCD938X_DIGITAL_CDC_COMP_CTL_0) & 0x01)) WCD938X_DIGITAL_CDC_COMP_CTL_0) & 0x01))
usleep_range(5000, 5010); usleep_range(5000, 5010);
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
@@ -457,7 +456,7 @@ static int wcd938x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
WCD938X_DIGITAL_CDC_COMP_CTL_0, 0x01, 0x01); WCD938X_DIGITAL_CDC_COMP_CTL_0, 0x01, 0x01);
/* 5msec compander delay as per HW requirement */ /* 5msec compander delay as per HW requirement */
if (!wcd938x->comp1_enable || if (!wcd938x->comp1_enable ||
(snd_soc_component_read(component, (snd_soc_component_read32(component,
WCD938X_DIGITAL_CDC_COMP_CTL_0) & 0x02)) WCD938X_DIGITAL_CDC_COMP_CTL_0) & 0x02))
usleep_range(5000, 5010); usleep_range(5000, 5010);
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
@@ -615,7 +614,7 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
&wcd938x->mbhc->wcd_mbhc); &wcd938x->mbhc->wcd_mbhc);
snd_soc_component_update_bits(component, WCD938X_ANA_HPH, snd_soc_component_update_bits(component, WCD938X_ANA_HPH,
0x10, 0x00); 0x10, 0x00);
wcd_cls_h_fsm(component, &wcd93x->clsh_info, wcd_cls_h_fsm(component, &wcd938x->clsh_info,
WCD_CLSH_EVENT_POST_PA, WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_HPHR, WCD_CLSH_STATE_HPHR,
hph_mode); hph_mode);
@@ -1342,7 +1341,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
if (amic == 0x1 || amic == 0x2) if (amic == 0x1 || amic == 0x2)
reg = WCD938X_ANA_TX_CH2; reg = WCD938X_ANA_TX_CH2;
else if (amic == 0x3) else if (amic == 0x3)
reg = WCD938X_ANA_TX_CH3_HPF; reg = WCD938X_ANA_TX_CH4;
else else
return 0; return 0;
if (amic == 0x2) if (amic == 0x2)
@@ -1377,7 +1376,8 @@ static int wcd938x_event_notify(struct notifier_block *block,
} }
break; break;
case BOLERO_WCD_EVT_CLK_NOTIFY: case BOLERO_WCD_EVT_CLK_NOTIFY:
snd_soc_update_bits(codec, WCD938X_DIGITAL_TOP_CLK_CFG, 0x06, snd_soc_component_update_bits(component,
WCD938X_DIGITAL_TOP_CLK_CFG, 0x06,
((val >> 0x10) << 0x01)); ((val >> 0x10) << 0x01));
break; break;
default: default:
@@ -1547,7 +1547,7 @@ static int wcd938x_codec_enable_vdd_buck(struct snd_soc_dapm_widget *w,
pdata->num_supplies, pdata->num_supplies,
"cdc-vdd-buck"); "cdc-vdd-buck");
if (ret == -EINVAL) { if (ret == -EINVAL) {
dev_err(dev, "%s: vdd buck is not disabled\n", dev_err(component->dev, "%s: vdd buck is not disabled\n",
__func__); __func__);
return 0; return 0;
} }
@@ -2149,6 +2149,8 @@ EXPORT_SYMBOL(wcd938x_info_create_codec_entry);
static int wcd938x_soc_codec_probe(struct snd_soc_component *component) static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
{ {
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_context *dapm =
snd_soc_component_get_dapm(component);
int variant; int variant;
int ret = -EINVAL; int ret = -EINVAL;
@@ -2602,44 +2604,52 @@ static int wcd938x_probe(struct platform_device *pdev)
struct component_match *match = NULL; struct component_match *match = NULL;
struct wcd938x_priv *wcd938x = NULL; struct wcd938x_priv *wcd938x = NULL;
struct wcd938x_pdata *pdata = NULL; struct wcd938x_pdata *pdata = NULL;
struct wcd_ctrl_platform_data *plat_data = NULL;
struct device *dev = &pdev->dev;
int ret; int ret;
wcd938x = devm_kzalloc(&pdev->dev, sizeof(struct wcd938x_priv), wcd938x = devm_kzalloc(dev, sizeof(struct wcd938x_priv),
GFP_KERNEL); GFP_KERNEL);
if (!wcd938x) if (!wcd938x)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(&pdev->dev, wcd938x); dev_set_drvdata(dev, wcd938x);
pdata = wcd938x_populate_dt_data(&pdev->dev); pdata = wcd938x_populate_dt_data(dev);
if (!pdata) { if (!pdata) {
dev_err(&pdev->dev, "%s: Fail to obtain platform data\n", __func__); dev_err(dev, "%s: Fail to obtain platform data\n", __func__);
return -EINVAL; return -EINVAL;
} }
dev->platform_data = pdata; dev->platform_data = pdata;
wcd938x->rst_np = pdata->rst_np; wcd938x->rst_np = pdata->rst_np;
ret = msm_cdc_init_supplies(&pdev->dev, &wcd938x->supplies, ret = msm_cdc_init_supplies(dev, &wcd938x->supplies,
pdata->regulator, pdata->num_supplies); pdata->regulator, pdata->num_supplies);
if (!wcd938x->supplies) { if (!wcd938x->supplies) {
dev_err(&pdev->dev, "%s: Cannot init wcd supplies\n", dev_err(dev, "%s: Cannot init wcd supplies\n",
__func__); __func__);
return ret; return ret;
} }
wcd938x->handle = (void *)pdata->handle; plat_data = dev_get_platdata(dev->parent);
if (!plat_data) {
dev_err(dev, "%s: platform data from parent is NULL\n",
__func__);
return -EINVAL;
}
wcd938x->handle = (void *)plat_data->handle;
if (!wcd938x->handle) { if (!wcd938x->handle) {
dev_err(dev, "%s: handle is NULL\n", __func__); dev_err(dev, "%s: handle is NULL\n", __func__);
return -EINVAL; return -EINVAL;
} }
wcd938x->update_wcd_event = pdata->update_wcd_event; wcd938x->update_wcd_event = plat_data->update_wcd_event;
if (!wcd938x->update_wcd_event) { if (!wcd938x->update_wcd_event) {
dev_err(dev, "%s: update_wcd_event api is null!\n", dev_err(dev, "%s: update_wcd_event api is null!\n",
__func__); __func__);
return -EINVAL; return -EINVAL;
} }
wcd938x->register_notifier = pdata->register_notifier; wcd938x->register_notifier = plat_data->register_notifier;
if (!wcd938x->register_notifier) { if (!wcd938x->register_notifier) {
dev_err(dev, "%s: register_notifier api is null!\n", dev_err(dev, "%s: register_notifier api is null!\n",
__func__); __func__);
@@ -2650,22 +2660,22 @@ static int wcd938x_probe(struct platform_device *pdev)
pdata->regulator, pdata->regulator,
pdata->num_supplies); pdata->num_supplies);
if (ret) { if (ret) {
dev_err(&pdev->dev, "%s: wcd static supply enable failed!\n", dev_err(dev, "%s: wcd static supply enable failed!\n",
__func__); __func__);
return ret; return ret;
} }
ret = wcd938x_parse_port_mapping(&pdev->dev, "qcom,rx_swr_ch_map", ret = wcd938x_parse_port_mapping(dev, "qcom,rx_swr_ch_map",
CODEC_RX); CODEC_RX);
ret |= wcd938x_parse_port_mapping(&pdev->dev, "qcom,tx_swr_ch_map", ret |= wcd938x_parse_port_mapping(dev, "qcom,tx_swr_ch_map",
CODEC_TX); CODEC_TX);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to read port mapping\n"); dev_err(dev, "Failed to read port mapping\n");
goto err; goto err;
} }
ret = wcd938x_add_slave_components(&pdev->dev, &match); ret = wcd938x_add_slave_components(dev, &match);
if (ret) if (ret)
goto err; goto err;
@@ -2673,7 +2683,7 @@ static int wcd938x_probe(struct platform_device *pdev)
wcd938x->wakeup = wcd938x_wakeup; wcd938x->wakeup = wcd938x_wakeup;
return component_master_add_with_match(&pdev->dev, return component_master_add_with_match(dev,
&wcd938x_comp_ops, match); &wcd938x_comp_ops, match);
err: err: