Loading asoc/bengal.c +66 −30 Original line number Diff line number Diff line Loading @@ -5979,6 +5979,62 @@ static const struct of_device_id bengal_asoc_machine_of_match[] = { {}, }; static int msm_snd_card_bengal_late_probe(struct snd_soc_card *card) { struct snd_soc_component *component; struct platform_device *pdev = NULL; char *data = NULL; int ret = 0, i = 0; void *mbhc_calibration; for (i = 0; i < 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); component = soc_find_component( msm_aux_dev[i].codec_of_node, NULL); } } } if (data != NULL && component != NULL) { if (!strncmp(data, "wcd937x", sizeof("wcd937x"))) { mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) goto err_mbhc_cal; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); } else if (!strncmp( data, "rouleur", sizeof("rouleur"))) { mbhc_calibration = def_rouleur_mbhc_cal(); if (!mbhc_calibration) goto err_mbhc_cal; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg); } } if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); goto err_hs_detect; } return 0; err_hs_detect: kfree(mbhc_calibration); err_mbhc_cal: return ret; } static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) { struct snd_soc_card *card = NULL; Loading Loading @@ -6137,6 +6193,7 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) if (card) { card->dai_link = dailink; card->num_links = total_links; card->late_probe = msm_snd_card_bengal_late_probe; } return card; Loading @@ -6147,7 +6204,6 @@ static int msm_aux_codec_init(struct snd_soc_component *component) struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); int ret = 0; void *mbhc_calibration; struct snd_info_entry *entry; struct snd_card *card = component->card->snd_card; struct msm_asoc_mach_data *pdata; Loading @@ -6174,7 +6230,7 @@ static int msm_aux_codec_init(struct snd_soc_component *component) dev_dbg(component->dev, "%s: Cannot create codecs module entry\n", __func__); ret = 0; goto mbhc_cfg_cal; goto err; } pdata->codec_root = entry; } Loading Loading @@ -6208,33 +6264,7 @@ static int msm_aux_codec_init(struct snd_soc_component *component) } } } mbhc_cfg_cal: if (data != NULL) { if (!strncmp(data, "wcd937x", sizeof("wcd937x"))) { mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); } else if (!strncmp( data, "rouleur", sizeof("rouleur"))) { mbhc_calibration = def_rouleur_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg); } } if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); goto err_hs_detect; } return 0; err_hs_detect: kfree(mbhc_calibration); err: return ret; } Loading Loading @@ -6814,10 +6844,16 @@ static int msm_asoc_machine_probe(struct platform_device *pdev) } buf = nvmem_cell_read(cell, &len); nvmem_cell_put(cell); if (IS_ERR_OR_NULL(buf) || len <= 0 || len > sizeof(32)) { if (IS_ERR_OR_NULL(buf)) { dev_dbg(&pdev->dev, "%s: FAILED to read nvmem cell \n", __func__); goto ret; } if (len <= 0 || len > sizeof(u32)) { dev_dbg(&pdev->dev, "%s: nvmem cell length out of range: %d\n", __func__, len); kfree(buf); goto ret; } memcpy(&adsp_var_idx, buf, len); kfree(buf); pdata->va_disable = adsp_var_idx; Loading asoc/codecs/bolero/bolero-cdc.c +16 −4 Original line number Diff line number Diff line Loading @@ -735,7 +735,7 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id) } EXPORT_SYMBOL(bolero_unregister_macro); void bolero_wsa_pa_on(struct device *dev) void bolero_wsa_pa_on(struct device *dev, bool adie_lb) { struct bolero_priv *priv; Loading @@ -753,8 +753,12 @@ void bolero_wsa_pa_on(struct device *dev) dev_err(dev, "%s: priv is null\n", __func__); return; } bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK); if (adie_lb) bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB); else bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK); } EXPORT_SYMBOL(bolero_wsa_pa_on); Loading Loading @@ -835,11 +839,19 @@ static int bolero_ssr_enable(struct device *dev, void *data) priv->component, BOLERO_MACRO_EVT_CLK_RESET, 0x0); } trace_printk("%s: clk count reset\n", __func__); if (priv->rsc_clk_cb) priv->rsc_clk_cb(priv->clk_dev, BOLERO_MACRO_EVT_SSR_GFMUX_UP); trace_printk("%s: clk count reset\n", __func__); for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) { if (!priv->macro_params[macro_idx].event_handler) continue; priv->macro_params[macro_idx].event_handler( priv->component, BOLERO_MACRO_EVT_PRE_SSR_UP, 0x0); } regcache_cache_only(priv->regmap, false); mutex_lock(&priv->clk_lock); priv->dev_up = true; Loading asoc/codecs/bolero/bolero-cdc.h +3 −2 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ enum { BOLERO_MACRO_EVT_RX_COMPANDER_SOFT_RST, BOLERO_MACRO_EVT_BCS_CLK_OFF, BOLERO_MACRO_EVT_SSR_GFMUX_UP, BOLERO_MACRO_EVT_PRE_SSR_UP, }; enum { Loading Loading @@ -117,7 +118,7 @@ int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *dat int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src); int bolero_register_event_listener(struct snd_soc_component *component, bool enable, bool is_dmic_sva); void bolero_wsa_pa_on(struct device *dev); void bolero_wsa_pa_on(struct device *dev, bool adie_lb); bool bolero_check_core_votes(struct device *dev); int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable); int bolero_get_version(struct device *dev); Loading Loading @@ -195,7 +196,7 @@ static inline int bolero_register_event_listener( return 0; } static void bolero_wsa_pa_on(struct device *dev) static void bolero_wsa_pa_on(struct device *dev, bool adie_lb) { } Loading asoc/codecs/bolero/internal.h +2 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _BOLERO_INTERNAL_H Loading @@ -16,6 +16,7 @@ enum { BOLERO_WCD_EVT_SSR_DOWN, BOLERO_WCD_EVT_SSR_UP, BOLERO_WCD_EVT_PA_ON_POST_FSCLK, BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB, }; enum { Loading asoc/codecs/bolero/rx-macro.c +7 −5 Original line number Diff line number Diff line Loading @@ -1389,11 +1389,7 @@ static int rx_macro_event_handler(struct snd_soc_component *component, } } break; case BOLERO_MACRO_EVT_SSR_UP: trace_printk("%s, enter SSR up\n", __func__); rx_priv->dev_up = true; /* reset swr after ssr/pdr */ rx_priv->reset_swr = true; case BOLERO_MACRO_EVT_PRE_SSR_UP: /* enable&disable RX_CORE_CLK to reset GFMUX reg */ ret = bolero_clk_rsc_request_clock(rx_priv->dev, rx_priv->default_clk_id, Loading @@ -1406,6 +1402,12 @@ static int rx_macro_event_handler(struct snd_soc_component *component, bolero_clk_rsc_request_clock(rx_priv->dev, rx_priv->default_clk_id, RX_CORE_CLK, false); break; case BOLERO_MACRO_EVT_SSR_UP: trace_printk("%s, enter SSR up\n", __func__); rx_priv->dev_up = true; /* reset swr after ssr/pdr */ rx_priv->reset_swr = true; if (rx_priv->swr_ctrl_data) swrm_wcd_notify( Loading Loading
asoc/bengal.c +66 −30 Original line number Diff line number Diff line Loading @@ -5979,6 +5979,62 @@ static const struct of_device_id bengal_asoc_machine_of_match[] = { {}, }; static int msm_snd_card_bengal_late_probe(struct snd_soc_card *card) { struct snd_soc_component *component; struct platform_device *pdev = NULL; char *data = NULL; int ret = 0, i = 0; void *mbhc_calibration; for (i = 0; i < 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); component = soc_find_component( msm_aux_dev[i].codec_of_node, NULL); } } } if (data != NULL && component != NULL) { if (!strncmp(data, "wcd937x", sizeof("wcd937x"))) { mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) goto err_mbhc_cal; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); } else if (!strncmp( data, "rouleur", sizeof("rouleur"))) { mbhc_calibration = def_rouleur_mbhc_cal(); if (!mbhc_calibration) goto err_mbhc_cal; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg); } } if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); goto err_hs_detect; } return 0; err_hs_detect: kfree(mbhc_calibration); err_mbhc_cal: return ret; } static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) { struct snd_soc_card *card = NULL; Loading Loading @@ -6137,6 +6193,7 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev) if (card) { card->dai_link = dailink; card->num_links = total_links; card->late_probe = msm_snd_card_bengal_late_probe; } return card; Loading @@ -6147,7 +6204,6 @@ static int msm_aux_codec_init(struct snd_soc_component *component) struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); int ret = 0; void *mbhc_calibration; struct snd_info_entry *entry; struct snd_card *card = component->card->snd_card; struct msm_asoc_mach_data *pdata; Loading @@ -6174,7 +6230,7 @@ static int msm_aux_codec_init(struct snd_soc_component *component) dev_dbg(component->dev, "%s: Cannot create codecs module entry\n", __func__); ret = 0; goto mbhc_cfg_cal; goto err; } pdata->codec_root = entry; } Loading Loading @@ -6208,33 +6264,7 @@ static int msm_aux_codec_init(struct snd_soc_component *component) } } } mbhc_cfg_cal: if (data != NULL) { if (!strncmp(data, "wcd937x", sizeof("wcd937x"))) { mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); } else if (!strncmp( data, "rouleur", sizeof("rouleur"))) { mbhc_calibration = def_rouleur_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg); } } if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); goto err_hs_detect; } return 0; err_hs_detect: kfree(mbhc_calibration); err: return ret; } Loading Loading @@ -6814,10 +6844,16 @@ static int msm_asoc_machine_probe(struct platform_device *pdev) } buf = nvmem_cell_read(cell, &len); nvmem_cell_put(cell); if (IS_ERR_OR_NULL(buf) || len <= 0 || len > sizeof(32)) { if (IS_ERR_OR_NULL(buf)) { dev_dbg(&pdev->dev, "%s: FAILED to read nvmem cell \n", __func__); goto ret; } if (len <= 0 || len > sizeof(u32)) { dev_dbg(&pdev->dev, "%s: nvmem cell length out of range: %d\n", __func__, len); kfree(buf); goto ret; } memcpy(&adsp_var_idx, buf, len); kfree(buf); pdata->va_disable = adsp_var_idx; Loading
asoc/codecs/bolero/bolero-cdc.c +16 −4 Original line number Diff line number Diff line Loading @@ -735,7 +735,7 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id) } EXPORT_SYMBOL(bolero_unregister_macro); void bolero_wsa_pa_on(struct device *dev) void bolero_wsa_pa_on(struct device *dev, bool adie_lb) { struct bolero_priv *priv; Loading @@ -753,8 +753,12 @@ void bolero_wsa_pa_on(struct device *dev) dev_err(dev, "%s: priv is null\n", __func__); return; } bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK); if (adie_lb) bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB); else bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK); } EXPORT_SYMBOL(bolero_wsa_pa_on); Loading Loading @@ -835,11 +839,19 @@ static int bolero_ssr_enable(struct device *dev, void *data) priv->component, BOLERO_MACRO_EVT_CLK_RESET, 0x0); } trace_printk("%s: clk count reset\n", __func__); if (priv->rsc_clk_cb) priv->rsc_clk_cb(priv->clk_dev, BOLERO_MACRO_EVT_SSR_GFMUX_UP); trace_printk("%s: clk count reset\n", __func__); for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) { if (!priv->macro_params[macro_idx].event_handler) continue; priv->macro_params[macro_idx].event_handler( priv->component, BOLERO_MACRO_EVT_PRE_SSR_UP, 0x0); } regcache_cache_only(priv->regmap, false); mutex_lock(&priv->clk_lock); priv->dev_up = true; Loading
asoc/codecs/bolero/bolero-cdc.h +3 −2 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ enum { BOLERO_MACRO_EVT_RX_COMPANDER_SOFT_RST, BOLERO_MACRO_EVT_BCS_CLK_OFF, BOLERO_MACRO_EVT_SSR_GFMUX_UP, BOLERO_MACRO_EVT_PRE_SSR_UP, }; enum { Loading Loading @@ -117,7 +118,7 @@ int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *dat int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src); int bolero_register_event_listener(struct snd_soc_component *component, bool enable, bool is_dmic_sva); void bolero_wsa_pa_on(struct device *dev); void bolero_wsa_pa_on(struct device *dev, bool adie_lb); bool bolero_check_core_votes(struct device *dev); int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable); int bolero_get_version(struct device *dev); Loading Loading @@ -195,7 +196,7 @@ static inline int bolero_register_event_listener( return 0; } static void bolero_wsa_pa_on(struct device *dev) static void bolero_wsa_pa_on(struct device *dev, bool adie_lb) { } Loading
asoc/codecs/bolero/internal.h +2 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _BOLERO_INTERNAL_H Loading @@ -16,6 +16,7 @@ enum { BOLERO_WCD_EVT_SSR_DOWN, BOLERO_WCD_EVT_SSR_UP, BOLERO_WCD_EVT_PA_ON_POST_FSCLK, BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB, }; enum { Loading
asoc/codecs/bolero/rx-macro.c +7 −5 Original line number Diff line number Diff line Loading @@ -1389,11 +1389,7 @@ static int rx_macro_event_handler(struct snd_soc_component *component, } } break; case BOLERO_MACRO_EVT_SSR_UP: trace_printk("%s, enter SSR up\n", __func__); rx_priv->dev_up = true; /* reset swr after ssr/pdr */ rx_priv->reset_swr = true; case BOLERO_MACRO_EVT_PRE_SSR_UP: /* enable&disable RX_CORE_CLK to reset GFMUX reg */ ret = bolero_clk_rsc_request_clock(rx_priv->dev, rx_priv->default_clk_id, Loading @@ -1406,6 +1402,12 @@ static int rx_macro_event_handler(struct snd_soc_component *component, bolero_clk_rsc_request_clock(rx_priv->dev, rx_priv->default_clk_id, RX_CORE_CLK, false); break; case BOLERO_MACRO_EVT_SSR_UP: trace_printk("%s, enter SSR up\n", __func__); rx_priv->dev_up = true; /* reset swr after ssr/pdr */ rx_priv->reset_swr = true; if (rx_priv->swr_ctrl_data) swrm_wcd_notify( Loading