--- zzzz-none-000/linux-4.4.60/drivers/clk/qcom/clk-regmap-mux.c 2017-04-08 07:53:53.000000000 +0000 +++ scorpion-1750e-727/linux-4.4.60/drivers/clk/qcom/clk-regmap-mux.c 2021-02-04 17:41:59.000000000 +0000 @@ -27,14 +27,21 @@ { struct clk_regmap_mux *mux = to_clk_regmap_mux(hw); struct clk_regmap *clkr = to_clk_regmap(hw); + int num_parents = clk_hw_get_num_parents(hw); unsigned int mask = GENMASK(mux->width - 1, 0); - unsigned int val; + unsigned int val, i; regmap_read(clkr->regmap, mux->reg, &val); val >>= mux->shift; val &= mask; + if (mux->parent_map) { + for (i = 0; i < num_parents; i++) + if (val == mux->parent_map[i].cfg) + return i; + } + return val; } @@ -45,6 +52,9 @@ unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift); unsigned int val; + if (mux->parent_map) + index = mux->parent_map[index].cfg; + val = index; val <<= mux->shift;