Merge remote-tracking branch 'qcom_sm8250/lineage-20' into lineage-22.2

Change-Id: I41d3b2e791439f1ef1d34ced81a40912461bb3b0
This commit is contained in:
Sebastiano Barezzi
2025-04-02 13:37:55 +02:00
201 changed files with 6939 additions and 4071 deletions

View File

@@ -76,8 +76,6 @@ static int audio_ext_clk_prepare(struct clk_hw *hw)
if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX)) {
clk_priv->clk_cfg.enable = 1;
trace_printk("%s: vote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
if (ret < 0) {
pr_err_ratelimited("%s afe_set_digital_codec_core_clock failed\n",
@@ -120,8 +118,6 @@ static void audio_ext_clk_unprepare(struct clk_hw *hw)
if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX)) {
clk_priv->clk_cfg.enable = 0;
trace_printk("%s: unvote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
if (ret < 0)
pr_err_ratelimited("%s: afe_set_lpass_clk_cfg failed, ret = %d\n",
@@ -156,7 +152,7 @@ static int lpass_hw_vote_prepare(struct clk_hw *hw)
int ret;
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_CORE_HW_VOTE) {
trace_printk("%s: vote for %d clock\n",
pr_debug("%s: vote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_vote_lpass_core_hw(AFE_LPASS_CORE_HW_MACRO_BLOCK,
"LPASS_HW_MACRO",
@@ -169,7 +165,7 @@ static int lpass_hw_vote_prepare(struct clk_hw *hw)
}
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_AUDIO_HW_VOTE) {
trace_printk("%s: vote for %d clock\n",
pr_debug("%s: vote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_vote_lpass_core_hw(AFE_LPASS_CORE_HW_DCODEC_BLOCK,
"LPASS_HW_DCODEC",
@@ -190,7 +186,7 @@ static void lpass_hw_vote_unprepare(struct clk_hw *hw)
int ret = 0;
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_CORE_HW_VOTE) {
trace_printk("%s: unvote for %d clock\n",
pr_debug("%s: unvote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_unvote_lpass_core_hw(
AFE_LPASS_CORE_HW_MACRO_BLOCK,
@@ -202,7 +198,7 @@ static void lpass_hw_vote_unprepare(struct clk_hw *hw)
}
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_AUDIO_HW_VOTE) {
trace_printk("%s: unvote for %d clock\n",
pr_debug("%s: unvote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_unvote_lpass_core_hw(
AFE_LPASS_CORE_HW_DCODEC_BLOCK,

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/of_platform.h>
@@ -879,7 +880,7 @@ 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__);
pr_debug("%s: clk count reset\n", __func__);
if (priv->rsc_clk_cb)
priv->rsc_clk_cb(priv->clk_dev, BOLERO_MACRO_EVT_SSR_GFMUX_UP);
@@ -902,7 +903,6 @@ static int bolero_ssr_enable(struct device *dev, void *data)
/* Add a 100usec sleep to ensure last register write is done */
usleep_range(100,110);
bolero_clk_rsc_enable_all_clocks(priv->clk_dev, false);
trace_printk("%s: regcache_sync done\n", __func__);
/* call ssr event for supported macros */
for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) {
if (!priv->macro_params[macro_idx].event_handler)
@@ -911,7 +911,6 @@ static int bolero_ssr_enable(struct device *dev, void *data)
priv->component,
BOLERO_MACRO_EVT_SSR_UP, 0x0);
}
trace_printk("%s: SSR up events processed by all macros\n", __func__);
bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_UP);
return 0;
}
@@ -1441,8 +1440,6 @@ int bolero_runtime_resume(struct device *dev)
}
}
priv->core_hw_vote_count++;
trace_printk("%s: hw vote count %d\n",
__func__, priv->core_hw_vote_count);
audio_vote:
if (priv->lpass_audio_hw_vote == NULL) {
@@ -1459,8 +1456,6 @@ int bolero_runtime_resume(struct device *dev)
}
}
priv->core_audio_vote_count++;
trace_printk("%s: audio vote count %d\n",
__func__, priv->core_audio_vote_count);
done:
mutex_unlock(&priv->vote_lock);
@@ -1484,8 +1479,6 @@ int bolero_runtime_suspend(struct device *dev)
dev_dbg(dev, "%s: Invalid lpass core hw node\n",
__func__);
}
trace_printk("%s: hw vote count %d\n",
__func__, priv->core_hw_vote_count);
if (priv->lpass_audio_hw_vote != NULL) {
if (--priv->core_audio_vote_count == 0)
@@ -1497,8 +1490,6 @@ int bolero_runtime_suspend(struct device *dev)
dev_dbg(dev, "%s: Invalid lpass audio hw node\n",
__func__);
}
trace_printk("%s: audio vote count %d\n",
__func__, priv->core_audio_vote_count);
mutex_unlock(&priv->vote_lock);
return 0;

View File

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/of_platform.h>
@@ -135,7 +136,6 @@ int bolero_rsc_clk_reset(struct device *dev, int clk_id)
dev_dbg(priv->dev,
"%s: clock reset after ssr, count %d\n", __func__, count);
trace_printk("%s: clock reset after ssr, count %d\n", __func__, count);
while (count--) {
clk_prepare_enable(priv->clk[clk_id]);
clk_prepare_enable(priv->clk[clk_id + NPL_CLK_OFFSET]);
@@ -290,8 +290,6 @@ static int bolero_clk_rsc_mux1_clk_request(struct bolero_clk_rsc *priv,
if (priv->dev_up_gfmux) {
iowrite32(0x1, clk_muxsel);
muxsel = ioread32(clk_muxsel);
trace_printk("%s: muxsel value after enable: %d\n",
__func__, muxsel);
}
bolero_clk_rsc_mux0_clk_request(priv,
default_clk_id,
@@ -323,8 +321,6 @@ static int bolero_clk_rsc_mux1_clk_request(struct bolero_clk_rsc *priv,
if (priv->dev_up_gfmux) {
iowrite32(0x0, clk_muxsel);
muxsel = ioread32(clk_muxsel);
trace_printk("%s: muxsel value after disable: %d\n",
__func__, muxsel);
}
}
}
@@ -547,7 +543,6 @@ int bolero_clk_rsc_request_clock(struct device *dev,
if (!priv->dev_up && enable) {
dev_err_ratelimited(priv->dev, "%s: SSR is in progress..\n",
__func__);
trace_printk("%s: SSR is in progress..\n", __func__);
ret = -EINVAL;
goto err;
}
@@ -577,9 +572,6 @@ int bolero_clk_rsc_request_clock(struct device *dev,
dev_dbg(priv->dev, "%s: clk_cnt: %d for requested clk: %d, enable: %d\n",
__func__, priv->clk_cnt[clk_id_req], clk_id_req,
enable);
trace_printk("%s: clk_cnt: %d for requested clk: %d, enable: %d\n",
__func__, priv->clk_cnt[clk_id_req], clk_id_req,
enable);
mutex_unlock(&priv->rsc_clk_lock);

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -1291,7 +1292,7 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
}
}
exit:
trace_printk("%s: mclk_enable = %u, dapm = %d clk_users= %d\n",
dev_dbg(rx_priv->dev, "%s: mclk_enable = %u, dapm = %d clk_users= %d\n",
__func__, mclk_enable, dapm, rx_priv->rx_mclk_users);
mutex_unlock(&rx_priv->mclk_lock);
return ret;
@@ -1378,7 +1379,6 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
rx_macro_wcd_clsh_imped_config(component, data, false);
break;
case BOLERO_MACRO_EVT_SSR_DOWN:
trace_printk("%s, enter SSR down\n", __func__);
rx_priv->dev_up = false;
if (rx_priv->swr_ctrl_data) {
swrm_wcd_notify(
@@ -1410,7 +1410,6 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
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;
@@ -3705,8 +3704,6 @@ static int rx_swrm_clock(void *handle, bool enable)
mutex_lock(&rx_priv->swr_clk_lock);
trace_printk("%s: swrm clock %s\n",
__func__, (enable ? "enable" : "disable"));
dev_dbg(rx_priv->dev, "%s: swrm clock %s\n",
__func__, (enable ? "enable" : "disable"));
if (enable) {
@@ -3773,8 +3770,6 @@ static int rx_swrm_clock(void *handle, bool enable)
}
}
}
trace_printk("%s: swrm clock users %d\n",
__func__, rx_priv->swr_clk_users);
dev_dbg(rx_priv->dev, "%s: swrm clock users %d\n",
__func__, rx_priv->swr_clk_users);
exit:

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -383,7 +384,6 @@ static int tx_macro_event_handler(struct snd_soc_component *component,
switch (event) {
case BOLERO_MACRO_EVT_SSR_DOWN:
trace_printk("%s, enter SSR down\n", __func__);
if (tx_priv->swr_ctrl_data) {
swrm_wcd_notify(
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
@@ -400,7 +400,6 @@ static int tx_macro_event_handler(struct snd_soc_component *component,
}
break;
case BOLERO_MACRO_EVT_SSR_UP:
trace_printk("%s, enter SSR up\n", __func__);
/* reset swr after ssr/pdr */
tx_priv->reset_swr = true;
if (tx_priv->swr_ctrl_data)
@@ -2524,9 +2523,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
{
int ret = 0, clk_tx_ret = 0;
trace_printk("%s: clock type %s, enable: %s tx_mclk_users: %d\n",
__func__, (clk_type ? "VA_MCLK" : "TX_MCLK"),
(enable ? "enable" : "disable"), tx_priv->tx_mclk_users);
dev_dbg(tx_priv->dev,
"%s: clock type %s, enable: %s tx_mclk_users: %d\n",
__func__, (clk_type ? "VA_MCLK" : "TX_MCLK"),
@@ -2534,7 +2530,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
if (enable) {
if (tx_priv->swr_clk_users == 0) {
trace_printk("%s: tx swr clk users 0\n", __func__);
ret = msm_cdc_pinctrl_select_active_state(
tx_priv->tx_swr_gpio_p);
if (ret < 0) {
@@ -2550,7 +2545,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
TX_CORE_CLK,
true);
if (clk_type == TX_MCLK) {
trace_printk("%s: requesting TX_MCLK\n", __func__);
ret = tx_macro_mclk_enable(tx_priv, 1);
if (ret < 0) {
if (tx_priv->swr_clk_users == 0)
@@ -2563,7 +2557,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
}
}
if (clk_type == VA_MCLK) {
trace_printk("%s: requesting VA_MCLK\n", __func__);
ret = bolero_clk_rsc_request_clock(tx_priv->dev,
TX_CORE_CLK,
VA_CORE_CLK,
@@ -2595,8 +2588,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
if (tx_priv->swr_clk_users == 0) {
dev_dbg(tx_priv->dev, "%s: reset_swr: %d\n",
__func__, tx_priv->reset_swr);
trace_printk("%s: reset_swr: %d\n",
__func__, tx_priv->reset_swr);
if (tx_priv->reset_swr)
regmap_update_bits(regmap,
BOLERO_CDC_TX_CLK_RST_CTRL_SWR_CONTROL,
@@ -2690,7 +2681,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
TX_CORE_CLK,
false);
exit:
trace_printk("%s: exit\n", __func__);
return ret;
}
@@ -2767,10 +2757,6 @@ static int tx_macro_swrm_clock(void *handle, bool enable)
}
mutex_lock(&tx_priv->swr_clk_lock);
trace_printk("%s: swrm clock %s tx_swr_clk_cnt: %d va_swr_clk_cnt: %d\n",
__func__,
(enable ? "enable" : "disable"),
tx_priv->tx_swr_clk_cnt, tx_priv->va_swr_clk_cnt);
dev_dbg(tx_priv->dev,
"%s: swrm clock %s tx_swr_clk_cnt: %d va_swr_clk_cnt: %d\n",
__func__, (enable ? "enable" : "disable"),
@@ -2833,9 +2819,6 @@ static int tx_macro_swrm_clock(void *handle, bool enable)
}
}
trace_printk("%s: swrm clock users %d tx_clk_sts_cnt: %d va_clk_sts_cnt: %d\n",
__func__, tx_priv->swr_clk_users, tx_priv->tx_clk_status,
tx_priv->va_clk_status);
dev_dbg(tx_priv->dev,
"%s: swrm clock users %d tx_clk_sts_cnt: %d va_clk_sts_cnt: %d\n",
__func__, tx_priv->swr_clk_users, tx_priv->tx_clk_status,

View File

@@ -314,7 +314,6 @@ static int va_macro_event_handler(struct snd_soc_component *component,
VA_CORE_CLK, false);
break;
case BOLERO_MACRO_EVT_SSR_UP:
trace_printk("%s, enter SSR up\n", __func__);
/* reset swr after ssr/pdr */
va_priv->reset_swr = true;
if (va_priv->swr_ctrl_data)

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -1007,7 +1008,6 @@ static int wsa_macro_event_handler(struct snd_soc_component *component,
switch (event) {
case BOLERO_MACRO_EVT_SSR_DOWN:
trace_printk("%s, enter SSR down\n", __func__);
if (wsa_priv->swr_ctrl_data) {
swrm_wcd_notify(
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
@@ -1038,7 +1038,6 @@ static int wsa_macro_event_handler(struct snd_soc_component *component,
WSA_CORE_CLK, false);
break;
case BOLERO_MACRO_EVT_SSR_UP:
trace_printk("%s, enter SSR up\n", __func__);
/* reset swr after ssr/pdr */
wsa_priv->reset_swr = true;
if (wsa_priv->swr_ctrl_data)
@@ -2861,9 +2860,6 @@ static int wsa_swrm_clock(void *handle, bool enable)
mutex_lock(&wsa_priv->swr_clk_lock);
trace_printk("%s: %s swrm clock %s\n",
dev_name(wsa_priv->dev), __func__,
(enable ? "enable" : "disable"));
dev_dbg(wsa_priv->dev, "%s: swrm clock %s\n",
__func__, (enable ? "enable" : "disable"));
if (enable) {
@@ -2929,9 +2925,6 @@ static int wsa_swrm_clock(void *handle, bool enable)
}
}
}
trace_printk("%s: %s swrm clock users: %d\n",
dev_name(wsa_priv->dev), __func__,
wsa_priv->swr_clk_users);
dev_dbg(wsa_priv->dev, "%s: swrm clock users %d\n",
__func__, wsa_priv->swr_clk_users);
exit:

View File

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -223,6 +224,10 @@ static int rouleur_parse_port_mapping(struct device *dev,
for (i = 0; i < map_length; i++) {
port_num = dt_array[NUM_SWRS_DT_PARAMS * i];
if (port_num >= MAX_PORT || ch_iter >= MAX_CH_PER_PORT) {
dev_err(dev, "%s: Invalid port or channel number\n", __func__);
goto err_pdata_fail;
}
slave_port_type = dt_array[NUM_SWRS_DT_PARAMS * i + 1];
ch_mask = dt_array[NUM_SWRS_DT_PARAMS * i + 2];
ch_rate = dt_array[NUM_SWRS_DT_PARAMS * i + 3];

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2023,2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -279,6 +279,10 @@ static int wcd937x_parse_port_mapping(struct device *dev,
for (i = 0; i < map_length; i++) {
port_num = dt_array[NUM_SWRS_DT_PARAMS * i];
if (port_num >= MAX_PORT || ch_iter >= MAX_CH_PER_PORT) {
dev_err(dev, "%s: Invalid port or channel number\n", __func__);
goto err_pdata_fail;
}
slave_port_type = dt_array[NUM_SWRS_DT_PARAMS * i + 1];
ch_mask = dt_array[NUM_SWRS_DT_PARAMS * i + 2];
ch_rate = dt_array[NUM_SWRS_DT_PARAMS * i + 3];

View File

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -377,6 +378,12 @@ static int wcd938x_parse_port_mapping(struct device *dev,
for (i = 0; i < map_length; i++) {
port_num = dt_array[NUM_SWRS_DT_PARAMS * i];
if (port_num >= MAX_PORT || ch_iter >= MAX_CH_PER_PORT) {
dev_err(dev, "%s: Invalid port or channel number\n", __func__);
goto err_pdata_fail;
}
slave_port_type = dt_array[NUM_SWRS_DT_PARAMS * i + 1];
ch_mask = dt_array[NUM_SWRS_DT_PARAMS * i + 2];
ch_rate = dt_array[NUM_SWRS_DT_PARAMS * i + 3];

View File

@@ -1295,7 +1295,6 @@ static int msm_dai_q6_island_mode_put(struct snd_kcontrol *kcontrol,
u16 port_id = (u16)kcontrol->private_value;
pr_debug("%s: island mode = %d\n", __func__, value);
trace_printk("%s: island mode = %d\n", __func__, value);
afe_set_island_mode_cfg(port_id, value);
return 0;

View File

@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@@ -33,7 +34,6 @@ int digital_cdc_rsc_mgr_hw_vote_enable(struct clk* vote_handle)
mutex_unlock(&hw_vote_lock);
pr_debug("%s: return %d\n", __func__, ret);
trace_printk("%s: return %d\n", __func__, ret);
return ret;
}
EXPORT_SYMBOL(digital_cdc_rsc_mgr_hw_vote_enable);
@@ -55,7 +55,7 @@ void digital_cdc_rsc_mgr_hw_vote_disable(struct clk* vote_handle)
mutex_lock(&hw_vote_lock);
clk_disable_unprepare(vote_handle);
mutex_unlock(&hw_vote_lock);
trace_printk("%s\n", __func__);
pr_debug("%s\n", __func__);
}
EXPORT_SYMBOL(digital_cdc_rsc_mgr_hw_vote_disable);
@@ -79,7 +79,6 @@ void digital_cdc_rsc_mgr_hw_vote_reset(struct clk* vote_handle)
count++;
}
pr_debug("%s: Vote count after SSR: %d\n", __func__, count);
trace_printk("%s: Vote count after SSR: %d\n", __func__, count);
while (count--)
clk_prepare_enable(vote_handle);

View File

@@ -1646,8 +1646,6 @@ static int afe_apr_send_pkt(void *data, wait_queue_head_t *wait)
pr_err_ratelimited("%s: request timedout\n",
__func__);
ret = -ETIMEDOUT;
trace_printk("%s: wait for ADSP response timed out\n",
__func__);
#ifdef AUDIO_FORCE_RESTART_ADSP
apr_err_count++;
if (apr_err_count >= ADSP_TO_LIMITED_COUNT) {
@@ -3488,8 +3486,6 @@ int afe_send_port_island_mode(u16 port_id)
}
pr_debug("%s: AFE set island mode 0x%x enable for port 0x%x ret %d\n",
__func__, island_mode, port_id, ret);
trace_printk("%s: AFE set island mode 0x%x enable for port 0x%x ret %d\n",
__func__, island_mode, port_id, ret);
return ret;
}
EXPORT_SYMBOL(afe_send_port_island_mode);
@@ -4812,8 +4808,6 @@ void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag)
port_index = afe_get_port_index(port_id);
this_afe.island_mode[port_index] = enable_flag;
trace_printk("%s: set island mode cfg 0x%x for port 0x%x\n",
__func__, this_afe.island_mode[port_index], port_id);
}
EXPORT_SYMBOL(afe_set_island_mode_cfg);
@@ -9020,15 +9014,6 @@ int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg)
cfg->clk_root, cfg->clk_set_mode,
cfg->reserved, q6audio_get_port_id(port_id));
trace_printk("%s: Minor version =0x%x clk val1 = %d\n"
"clk val2 = %d, clk src = 0x%x\n"
"clk root = 0x%x clk mode = 0x%x resrv = 0x%x\n"
"port id = 0x%x\n",
__func__, cfg->i2s_cfg_minor_version,
cfg->clk_val1, cfg->clk_val2, cfg->clk_src,
cfg->clk_root, cfg->clk_set_mode,
cfg->reserved, q6audio_get_port_id(port_id));
ret = q6afe_pack_and_set_param_in_band(port_id,
q6audio_get_port_index(port_id),
param_hdr, (u8 *) &clk_cfg);
@@ -9363,20 +9348,11 @@ int afe_set_lpass_clk_cfg(int index, struct afe_clk_set *cfg)
cfg->clk_id, cfg->clk_freq_in_hz, cfg->clk_attri,
cfg->clk_root, cfg->enable);
trace_printk("%s: Minor version =0x%x clk id = %d\n"
"clk freq (Hz) = %d, clk attri = 0x%x\n"
"clk root = 0x%x clk enable = 0x%x\n",
__func__, cfg->clk_set_minor_version,
cfg->clk_id, cfg->clk_freq_in_hz, cfg->clk_attri,
cfg->clk_root, cfg->enable);
ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr,
(u8 *) cfg);
if (ret < 0) {
pr_err_ratelimited("%s: AFE clk cfg failed with ret %d\n",
__func__, ret);
trace_printk("%s: AFE clk cfg failed with ret %d\n",
__func__, ret);
}
mutex_unlock(&this_afe.afe_clk_lock);
return ret;
@@ -11655,8 +11631,6 @@ int afe_vote_lpass_core_hw(uint32_t hw_block_id, char *client_name,
pr_debug("%s: lpass core hw vote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
trace_printk("%s: lpass core hw vote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
*client_handle = 0;
ret = afe_apr_send_clk_pkt((uint32_t *)cmd_ptr,
@@ -11696,7 +11670,6 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
if (!this_afe.lpass_hw_core_client_hdl[hw_block_id]) {
pr_debug("%s: SSR in progress, return\n", __func__);
trace_printk("%s: SSR in progress, return\n", __func__);
goto done;
}
@@ -11716,9 +11689,6 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
pr_debug("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
trace_printk("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
if (cmd_ptr->client_handle <= 0) {
pr_err("%s: invalid client handle\n", __func__);
ret = -EINVAL;

View File

@@ -3221,6 +3221,13 @@ static int voice_send_cvp_register_cal_cmd(struct voice_data *v)
voc_get_session_name(v->session_id), v->dev_tx.dev_id,
v->dev_rx.dev_id);
if (col_data->cal_data.size >= MAX_COL_INFO_SIZE) {
pr_err("%s: Invalid cal data size %ld!\n",
__func__, col_data->cal_data.size);
ret = -EINVAL;
goto unlock;
}
memcpy(&cvp_reg_cal_cmd.cvp_cal_data.column_info[0],
(void *) &((struct audio_cal_info_voc_col *)
col_data->cal_info)->data,
@@ -3381,6 +3388,13 @@ static int voice_send_cvp_register_vol_cal_cmd(struct voice_data *v)
goto unlock;
}
if (col_data->cal_data.size >= MAX_COL_INFO_SIZE) {
pr_err("%s: Invalid cal data size %ld!\n",
__func__, col_data->cal_data.size);
ret = -EINVAL;
goto unlock;
}
memcpy(&cvp_reg_vol_cal_cmd.cvp_vol_cal_data.column_info[0],
(void *) &((struct audio_cal_info_voc_col *)
col_data->cal_info)->data,

View File

@@ -516,7 +516,6 @@ int lpi_pinctrl_suspend(struct device *dev)
{
int ret = 0;
trace_printk("%s: system suspend\n", __func__);
dev_dbg(dev, "%s: system suspend\n", __func__);
if ((!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev))) {
@@ -553,7 +552,6 @@ static struct notifier_block service_nb = {
static void lpi_pinctrl_ssr_disable(struct device *dev, void *data)
{
trace_printk("%s: enter\n", __func__);
lpi_dev_up = false;
lpi_pinctrl_suspend(dev);
}
@@ -878,7 +876,6 @@ int lpi_pinctrl_runtime_resume(struct device *dev)
int ret = 0;
struct clk *hw_vote = state->lpass_core_hw_vote;
trace_printk("%s: enter\n", __func__);
if (state->lpass_core_hw_vote == NULL) {
dev_dbg(dev, "%s: Invalid core hw node\n", __func__);
if (state->lpass_audio_hw_vote == NULL) {
@@ -904,7 +901,6 @@ int lpi_pinctrl_runtime_resume(struct device *dev)
exit:
mutex_unlock(&state->core_hw_vote_lock);
trace_printk("%s: exit\n", __func__);
return 0;
}
@@ -913,7 +909,6 @@ int lpi_pinctrl_runtime_suspend(struct device *dev)
struct lpi_gpio_state *state = dev_get_drvdata(dev);
struct clk *hw_vote = state->lpass_core_hw_vote;
trace_printk("%s: enter\n", __func__);
if (state->lpass_core_hw_vote == NULL) {
dev_dbg(dev, "%s: Invalid core hw node\n", __func__);
if (state->lpass_audio_hw_vote == NULL) {
@@ -929,7 +924,6 @@ int lpi_pinctrl_runtime_suspend(struct device *dev)
state->core_hw_vote_status = false;
}
mutex_unlock(&state->core_hw_vote_lock);
trace_printk("%s: exit\n", __func__);
return 0;
}

View File

@@ -381,8 +381,6 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
if (!swrm->dev_up) {
dev_dbg(swrm->dev, "%s: device is down or SSR state\n",
__func__);
trace_printk("%s: device is down or SSR state\n",
__func__);
mutex_unlock(&swrm->devlock);
return -ENODEV;
}
@@ -413,8 +411,6 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
if (!swrm->dev_up) {
dev_dbg(swrm->dev, "%s: device is down or SSR state\n",
__func__);
trace_printk("%s: device is down or SSR state\n",
__func__);
mutex_unlock(&swrm->devlock);
return -ENODEV;
}
@@ -443,8 +439,6 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
mutex_unlock(&swrm->devlock);
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
return ret;
}
@@ -508,8 +502,6 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
}
swrm->clk_ref_count++;
if (swrm->clk_ref_count == 1) {
trace_printk("%s: clock enable count %d",
__func__, swrm->clk_ref_count);
ret = swrm->clk(swrm->handle, true);
if (ret) {
dev_err_ratelimited(swrm->dev,
@@ -519,8 +511,6 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
}
}
} else if (--swrm->clk_ref_count == 0) {
trace_printk("%s: clock disable count %d",
__func__, swrm->clk_ref_count);
swrm->clk(swrm->handle, false);
complete(&swrm->clk_off_complete);
}
@@ -1814,7 +1804,6 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
struct swr_device *swr_dev;
struct swr_master *mstr = &swrm->master;
trace_printk("%s enter\n", __func__);
if (unlikely(swrm_lock_sleep(swrm) == false)) {
dev_err(swrm->dev, "%s Failed to hold suspend\n", __func__);
return IRQ_NONE;
@@ -1832,7 +1821,6 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
intr_sts = swr_master_read(swrm, SWRM_INTERRUPT_STATUS);
intr_sts_masked = intr_sts & swrm->intr_mask;
trace_printk("%s: status: 0x%x \n", __func__, intr_sts_masked);
handle_irq:
for (i = 0; i < SWRM_INTERRUPT_MAX; i++) {
value = intr_sts_masked & (1 << i);
@@ -1977,7 +1965,6 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
mutex_unlock(&swrm->reslock);
exit:
swrm_unlock_sleep(swrm);
trace_printk("%s exit\n", __func__);
return ret;
}
@@ -1992,7 +1979,6 @@ static irqreturn_t swr_mstr_interrupt_v2(int irq, void *dev)
struct swr_device *swr_dev;
struct swr_master *mstr = &swrm->master;
trace_printk("%s enter\n", __func__);
if (unlikely(swrm_lock_sleep(swrm) == false)) {
dev_err(swrm->dev, "%s Failed to hold suspend\n", __func__);
return IRQ_NONE;
@@ -2019,7 +2005,6 @@ static irqreturn_t swr_mstr_interrupt_v2(int irq, void *dev)
intr_sts_masked = intr_sts & swrm->intr_mask;
dev_dbg(swrm->dev, "%s: status: 0x%x \n", __func__, intr_sts_masked);
trace_printk("%s: status: 0x%x \n", __func__, intr_sts_masked);
handle_irq:
for (i = 0; i < SWRM_INTERRUPT_MAX; i++) {
value = intr_sts_masked & (1 << i);
@@ -2230,7 +2215,6 @@ static irqreturn_t swr_mstr_interrupt_v2(int irq, void *dev)
exit:
mutex_unlock(&swrm->reslock);
swrm_unlock_sleep(swrm);
trace_printk("%s exit\n", __func__);
return ret;
}
@@ -2244,7 +2228,6 @@ static irqreturn_t swrm_wakeup_interrupt(int irq, void *dev)
return IRQ_NONE;
}
trace_printk("%s enter\n", __func__);
mutex_lock(&swrm->devlock);
if (!swrm->dev_up) {
if (swrm->wake_irq > 0) {
@@ -2283,7 +2266,6 @@ static irqreturn_t swrm_wakeup_interrupt(int irq, void *dev)
pm_runtime_put_autosuspend(swrm->dev);
swrm_unlock_sleep(swrm);
exit:
trace_printk("%s exit\n", __func__);
return ret;
}
@@ -2298,7 +2280,6 @@ static void swrm_wakeup_work(struct work_struct *work)
return;
}
trace_printk("%s enter\n", __func__);
mutex_lock(&swrm->devlock);
if (!swrm->dev_up) {
mutex_unlock(&swrm->devlock);
@@ -2314,7 +2295,6 @@ static void swrm_wakeup_work(struct work_struct *work)
pm_runtime_put_autosuspend(swrm->dev);
swrm_unlock_sleep(swrm);
exit:
trace_printk("%s exit\n", __func__);
pm_relax(swrm->dev);
}
@@ -3015,8 +2995,6 @@ static int swrm_runtime_resume(struct device *dev)
dev_dbg(dev, "%s: pm_runtime: resume, state:%d\n",
__func__, swrm->state);
trace_printk("%s: pm_runtime: resume, state:%d\n",
__func__, swrm->state);
mutex_lock(&swrm->reslock);
if (swrm_request_hw_vote(swrm, LPASS_HW_CORE, true)) {
@@ -3065,9 +3043,6 @@ static int swrm_runtime_resume(struct device *dev)
dev_dbg(dev,
"%s slave device up not implemented\n",
__func__);
trace_printk(
"%s slave device up not implemented\n",
__func__);
ret = 0;
} else if (ret) {
dev_err(dev,
@@ -3123,8 +3098,6 @@ static int swrm_runtime_resume(struct device *dev)
swrm->req_clk_switch = false;
mutex_unlock(&swrm->reslock);
trace_printk("%s: pm_runtime: resume done, state:%d\n",
__func__, swrm->state);
return ret;
}
@@ -3139,8 +3112,6 @@ static int swrm_runtime_suspend(struct device *dev)
int current_state = 0;
struct irq_data *irq_data = NULL;
trace_printk("%s: pm_runtime: suspend state: %d\n",
__func__, swrm->state);
dev_dbg(dev, "%s: pm_runtime: suspend state: %d\n",
__func__, swrm->state);
mutex_lock(&swrm->reslock);
@@ -3160,7 +3131,6 @@ static int swrm_runtime_suspend(struct device *dev)
if ((current_state != SWR_MSTR_SSR) &&
swrm_is_port_en(&swrm->master)) {
dev_dbg(dev, "%s ports are enabled\n", __func__);
trace_printk("%s ports are enabled\n", __func__);
ret = -EBUSY;
goto exit;
}
@@ -3194,22 +3164,14 @@ static int swrm_runtime_suspend(struct device *dev)
dev_dbg_ratelimited(dev,
"%s slave device down not implemented\n",
__func__);
trace_printk(
"%s slave device down not implemented\n",
__func__);
ret = 0;
} else if (ret) {
dev_err(dev,
"%s: failed to shutdown swr dev %d\n",
__func__, swr_dev->dev_num);
trace_printk(
"%s: failed to shutdown swr dev %d\n",
__func__, swr_dev->dev_num);
goto exit;
}
}
trace_printk("%s: clk stop mode not supported or SSR exit\n",
__func__);
} else {
/* Mask bus clash interrupt */
swrm->intr_mask &= ~((u32)0x08);
@@ -3259,8 +3221,6 @@ static int swrm_runtime_suspend(struct device *dev)
if (!hw_core_err)
swrm_request_hw_vote(swrm, LPASS_HW_CORE, false);
mutex_unlock(&swrm->reslock);
trace_printk("%s: pm_runtime: suspend done state: %d\n",
__func__, swrm->state);
return ret;
}
#endif /* CONFIG_PM */
@@ -3272,7 +3232,6 @@ static int swrm_device_suspend(struct device *dev)
int ret = 0;
dev_dbg(dev, "%s: swrm state: %d\n", __func__, swrm->state);
trace_printk("%s: swrm state: %d\n", __func__, swrm->state);
if (!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev)) {
ret = swrm_runtime_suspend(dev);
if (!ret) {
@@ -3291,7 +3250,6 @@ static int swrm_device_down(struct device *dev)
struct swr_mstr_ctrl *swrm = platform_get_drvdata(pdev);
dev_dbg(dev, "%s: swrm state: %d\n", __func__, swrm->state);
trace_printk("%s: swrm state: %d\n", __func__, swrm->state);
mutex_lock(&swrm->force_down_lock);
swrm->state = SWR_MSTR_SSR;
@@ -3469,7 +3427,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
}
break;
case SWR_DEVICE_SSR_DOWN:
trace_printk("%s: swr device down called\n", __func__);
mutex_lock(&swrm->mlock);
if (swrm->state == SWR_MSTR_DOWN)
dev_dbg(swrm->dev, "%s:SWR master is already Down:%d\n",
@@ -3488,7 +3445,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
break;
case SWR_DEVICE_SSR_UP:
/* wait for clk voting to be zero */
trace_printk("%s: swr device up called\n", __func__);
reinit_completion(&swrm->clk_off_complete);
if (swrm->clk_ref_count &&
!wait_for_completion_timeout(&swrm->clk_off_complete,
@@ -3502,7 +3458,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
break;
case SWR_DEVICE_DOWN:
dev_dbg(swrm->dev, "%s: swr master down called\n", __func__);
trace_printk("%s: swr master down called\n", __func__);
mutex_lock(&swrm->mlock);
if (swrm->state == SWR_MSTR_DOWN)
dev_dbg(swrm->dev, "%s:SWR master is already Down:%d\n",
@@ -3513,7 +3468,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
break;
case SWR_DEVICE_UP:
dev_dbg(swrm->dev, "%s: swr master up called\n", __func__);
trace_printk("%s: swr master up called\n", __func__);
mutex_lock(&swrm->devlock);
if (!swrm->dev_up) {
dev_dbg(swrm->dev, "SSR not complete yet\n");

View File

@@ -656,13 +656,14 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
{
int rc = 0, pkt_opcode = 0;
struct cam_control *cmd = (struct cam_control *)arg;
struct cam_sensor_power_ctrl_t *power_info =
&s_ctrl->sensordata->power_info;
struct cam_sensor_power_ctrl_t *power_info = NULL;
if (!s_ctrl || !arg) {
CAM_ERR(CAM_SENSOR, "s_ctrl is NULL");
return -EINVAL;
}
power_info = &s_ctrl->sensordata->power_info;
if (cmd->op_code != CAM_SENSOR_PROBE_CMD) {
if (cmd->handle_type != CAM_HANDLE_USER_POINTER) {
CAM_ERR(CAM_SENSOR, "Invalid handle type: %d",

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/slab.h>
@@ -5663,7 +5663,9 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
break;
case CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG: {
struct cam_isp_bw_config *bw_config;
struct cam_isp_bw_config *bw_config_u;
struct cam_isp_prepare_hw_update_data *prepare_hw_data;
size_t bw_config_size;
CAM_WARN_RATE_LIMIT_CUSTOM(CAM_PERF, 300, 1,
"Deprecated Blob TYPE_BW_CONFIG");
@@ -5672,11 +5674,26 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
return -EINVAL;
}
bw_config = (struct cam_isp_bw_config *)blob_data;
bw_config_u = (struct cam_isp_bw_config *)blob_data;
if (bw_config->num_rdi > CAM_IFE_RDI_NUM_MAX) {
CAM_ERR(CAM_ISP, "Invalid num_rdi %u in bw config",
if (bw_config_u->num_rdi > CAM_IFE_RDI_NUM_MAX || !bw_config_u->num_rdi) {
CAM_ERR(CAM_ISP, "Invalid num_rdi %u in bw config, ctx_idx: %u",
bw_config_u->num_rdi, ife_mgr_ctx->ctx_index);
return -EINVAL;
}
bw_config_size = sizeof(struct cam_isp_bw_config) + ((bw_config_u->num_rdi-1)*
sizeof(struct cam_isp_bw_vote));
rc = cam_common_mem_kdup((void **)&bw_config, bw_config_u, bw_config_size);
if (rc) {
CAM_ERR(CAM_ISP, "Alloc and copy request bw_config failed");
return rc;
}
if (bw_config_u->num_rdi != bw_config->num_rdi) {
CAM_ERR(CAM_ISP, "num_rdi changed,userspace:%d, kernel:%d", bw_config_u->num_rdi,
bw_config->num_rdi);
cam_common_mem_free(bw_config);
return -EINVAL;
}
@@ -5689,6 +5706,7 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
"Max size exceeded in bw config num_rdi:%u size per port:%lu",
bw_config->num_rdi,
sizeof(struct cam_isp_bw_vote));
cam_common_mem_free(bw_config);
return -EINVAL;
}
}
@@ -5701,12 +5719,14 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
blob_size, sizeof(struct cam_isp_bw_config) +
(bw_config->num_rdi - 1) *
sizeof(struct cam_isp_bw_vote));
cam_common_mem_free(bw_config);
return -EINVAL;
}
if (!prepare || !prepare->priv ||
(bw_config->usage_type >= CAM_IFE_HW_NUM_MAX)) {
CAM_ERR(CAM_ISP, "Invalid inputs");
cam_common_mem_free(bw_config);
return -EINVAL;
}
@@ -5717,11 +5737,13 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
bw_config, sizeof(prepare_hw_data->bw_config[0]));
prepare_hw_data->bw_config_version = CAM_ISP_BW_CONFIG_V1;
prepare_hw_data->bw_config_valid[bw_config->usage_type] = true;
cam_common_mem_free(bw_config);
}
break;
case CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2: {
size_t bw_config_size = 0;
struct cam_isp_bw_config_v2 *bw_config;
struct cam_isp_bw_config_v2 *bw_config_u;
struct cam_isp_prepare_hw_update_data *prepare_hw_data;
if (blob_size < sizeof(struct cam_isp_bw_config_v2)) {
@@ -5729,12 +5751,28 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
return -EINVAL;
}
bw_config = (struct cam_isp_bw_config_v2 *)blob_data;
bw_config_u = (struct cam_isp_bw_config_v2 *)blob_data;
if ((bw_config->num_paths > CAM_ISP_MAX_PER_PATH_VOTES) ||
!bw_config->num_paths) {
CAM_ERR(CAM_ISP, "Invalid num paths %d",
bw_config->num_paths);
if (bw_config_u->num_paths > CAM_ISP_MAX_PER_PATH_VOTES ||
!bw_config_u->num_paths) {
CAM_ERR(CAM_ISP, "Invalid num paths %d ctx_idx: %u",
bw_config_u->num_paths, ife_mgr_ctx->ctx_index);
return -EINVAL;
}
bw_config_size = sizeof(struct cam_isp_bw_config_v2) + ((bw_config_u->num_paths-1)*
sizeof(struct cam_axi_per_path_bw_vote));
rc = cam_common_mem_kdup((void **)&bw_config, bw_config_u, bw_config_size);
if (rc) {
CAM_ERR(CAM_ISP, "Alloc and copy request bw_config failed");
return rc;
}
if (bw_config_u->num_paths != bw_config->num_paths) {
CAM_ERR(CAM_ISP, "num_paths changed,userspace:%d, kernel:%d", bw_config_u->num_paths,
bw_config->num_paths);
cam_common_mem_free(bw_config);
return -EINVAL;
}
@@ -5749,6 +5787,7 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
bw_config->num_paths - 1,
sizeof(
struct cam_axi_per_path_bw_vote));
cam_common_mem_free(bw_config);
return -EINVAL;
}
}
@@ -5762,12 +5801,14 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
blob_size, bw_config->num_paths,
sizeof(struct cam_isp_bw_config_v2),
sizeof(struct cam_axi_per_path_bw_vote));
cam_common_mem_free(bw_config);
return -EINVAL;
}
if (!prepare || !prepare->priv ||
(bw_config->usage_type >= CAM_IFE_HW_NUM_MAX)) {
CAM_ERR(CAM_ISP, "Invalid inputs");
cam_common_mem_free(bw_config);
return -EINVAL;
}
@@ -5785,6 +5826,7 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
prepare_hw_data->bw_config_version = CAM_ISP_BW_CONFIG_V2;
prepare_hw_data->bw_config_valid[bw_config->usage_type] = true;
cam_common_mem_free(bw_config);
}
break;
case CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG: {

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -785,13 +785,14 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
{
int rc = 0, pkt_opcode = 0;
struct cam_control *cmd = (struct cam_control *)arg;
struct cam_sensor_power_ctrl_t *power_info =
&s_ctrl->sensordata->power_info;
struct cam_sensor_power_ctrl_t *power_info = NULL;
if (!s_ctrl || !arg) {
CAM_ERR(CAM_SENSOR, "s_ctrl is NULL");
return -EINVAL;
}
power_info = &s_ctrl->sensordata->power_info;
if (cmd->op_code != CAM_SENSOR_PROBE_CMD) {
if (cmd->handle_type != CAM_HANDLE_USER_POINTER) {
CAM_ERR(CAM_SENSOR, "Invalid handle type: %d",

View File

@@ -1,11 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/string.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include "cam_common_util.h"
#include "cam_debug_util.h"
@@ -48,3 +50,36 @@ uint32_t cam_common_util_remove_duplicate_arr(int32_t *arr, uint32_t num)
return wr_idx;
}
int cam_common_mem_kdup(void **dst,
void *src, size_t size)
{
gfp_t flag = GFP_KERNEL;
if (!src || !dst || !size) {
CAM_ERR(CAM_UTIL, "Invalid params src: %pK dst: %pK size: %u",
src, dst, size);
return -EINVAL;
}
if (!in_task())
flag = GFP_ATOMIC;
*dst = kvzalloc(size, flag);
if (!*dst) {
CAM_ERR(CAM_UTIL, "Failed to allocate memory with size: %u", size);
return -ENOMEM;
}
memcpy(*dst, src, size);
CAM_DBG(CAM_UTIL, "Allocate and copy memory with size: %u", size);
return 0;
}
EXPORT_SYMBOL(cam_common_mem_kdup);
void cam_common_mem_free(void *memory)
{
kvfree(memory);
}
EXPORT_SYMBOL(cam_common_mem_free);

View File

@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _CAM_COMMON_UTIL_H_
@@ -64,4 +65,22 @@ int cam_common_util_get_string_index(const char **strings,
uint32_t cam_common_util_remove_duplicate_arr(int32_t *array,
uint32_t num);
/**
* @brief: Memory alloc and copy
*
* @dst: Address of destination address of memory
* @src: Source address of memory
* @size: Length of memory
*
* @return 0 if success in register non-zero if failes
*/
int cam_common_mem_kdup(void **dst, void *src, size_t size);
/**
* @brief: Free the memory
*
* @memory: Address of memory
*/
void cam_common_mem_free(void *memory);
#endif /* _CAM_COMMON_UTIL_H_ */

View File

@@ -5604,6 +5604,10 @@ int dsi_display_dev_remove(struct platform_device *pdev)
}
display = platform_get_drvdata(pdev);
if (!display || !display->panel_node) {
DSI_ERR("invalid display\n");
return -EINVAL;
}
/* decrement ref count */
of_node_put(display->panel_node);