i2c: i2c-msm-geni: Skip BW vote for PMIC used I2C SE node

This change is a workaround change to fix the PMIC race condition
with the clock enablement. In case of PMIC txfer over i2c, I2C driver
resumes and votes for BW and clocks. The BW vote goes to RPM and that
in turn waiting for the global PMIC mutex causing race condition in
rare cases.

Hence as a workaroun, do not vote for the BW vote only for PMIC used
I2C SE instance.

Change-Id: I94c57427200a71dd2792533b1af249940b0bf03f
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
This commit is contained in:
Mukesh Kumar Savaliya 2021-08-12 02:19:12 +05:30 • committed by Gerrit - the friendly Code Review server
commit 417537107c
3 changed files with 11 additions and 0 deletions

View file

@ -1237,6 +1237,9 @@ static int geni_i2c_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "LE-VM usecase\n");
}
if (of_property_read_bool(pdev->dev.of_node, "qcom,leica-used-i2c"))
gi2c->i2c_rsc.skip_bw_vote = true;
gi2c->i2c_rsc.wrapper_dev = &wrapper_pdev->dev;
gi2c->i2c_rsc.ctrl_dev = gi2c->dev;

View file

@ -715,6 +715,9 @@ static int geni_se_rmv_ab_ib(struct geni_se_device *geni_se_dev,
if (geni_se_dev->vectors == NULL)
return 0;
if (rsc->skip_bw_vote)
return 0;
if (unlikely(list_empty(&rsc->ab_list) || list_empty(&rsc->ib_list)))
return -EINVAL;
@ -862,6 +865,9 @@ static int geni_se_add_ab_ib(struct geni_se_device *geni_se_dev,
if (geni_se_dev->vectors == NULL)
return 0;
if (rsc->skip_bw_vote)
return 0;
mutex_lock(&geni_se_dev->geni_dev_lock);
list_add(&rsc->ab_list, &geni_se_dev->ab_list_head);

View file

@ -51,6 +51,7 @@ enum se_protocol_types {
* @geni_gpi_sleep: Handle to the sleep pinctrl state.
* @num_clk_levels: Number of valid clock levels in clk_perf_tbl.
* @clk_perf_tbl: Table of clock frequency input to Serial Engine clock.
* @skip_bw_vote: Used for PMIC over i2c use case to skip the BW vote.
*/
struct se_geni_rsc {
struct device *ctrl_dev;
@ -73,6 +74,7 @@ struct se_geni_rsc {
int clk_freq_out;
unsigned int num_clk_levels;
unsigned long *clk_perf_tbl;
bool skip_bw_vote;
};
#define PINCTRL_DEFAULT "default"