Loading soc/swr-mstr-ctrl.c +61 −17 Original line number Diff line number Diff line Loading @@ -315,6 +315,11 @@ static void swrm_reg_dump(struct swr_mstr_ctrl *swrm, func, reg[i], val[i]); } static bool is_swr_clk_needed(struct swr_mstr_ctrl *swrm) { return ((swrm->version <= SWRM_VERSION_1_5_1) ? true : false); } static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm, int core_type, bool enable) { Loading Loading @@ -360,6 +365,30 @@ static int swrm_get_ssp_period(struct swr_mstr_ctrl *swrm, return ((swrm->bus_clk * 2) / ((row * col) * frame_sync)); } static int swrm_core_vote_request(struct swr_mstr_ctrl *swrm) { int ret = 0; if (!swrm->handle) return -EINVAL; mutex_lock(&swrm->clklock); if (!swrm->dev_up) { ret = -ENODEV; goto exit; } if (swrm->core_vote) { ret = swrm->core_vote(swrm->handle, true); if (ret) dev_err_ratelimited(swrm->dev, "%s: core vote request failed\n", __func__); } exit: mutex_unlock(&swrm->clklock); return ret; } static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable) { int ret = 0; Loading @@ -373,15 +402,17 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable) ret = -ENODEV; goto exit; } if (is_swr_clk_needed(swrm)) { if (swrm->core_vote) { ret = swrm->core_vote(swrm->handle, true); if (ret) { dev_err_ratelimited(swrm->dev, "%s: clock enable req failed", "%s: core vote request failed\n", __func__); goto exit; } } } swrm->clk_ref_count++; if (swrm->clk_ref_count == 1) { ret = swrm->clk(swrm->handle, true); Loading Loading @@ -416,13 +447,20 @@ static int swrm_ahb_write(struct swr_mstr_ctrl *swrm, if (!swrm->dev_up) goto err; if (is_swr_clk_needed(swrm)) { ret = swrm_clk_request(swrm, TRUE); if (ret) { dev_err_ratelimited(swrm->dev, "%s: clock request failed\n", dev_err_ratelimited(swrm->dev, "%s: clock request failed\n", __func__); goto err; } } else if (swrm_core_vote_request(swrm)) { goto err; } iowrite32(temp, swrm->swrm_dig_base + reg); if (is_swr_clk_needed(swrm)) swrm_clk_request(swrm, FALSE); err: mutex_unlock(&swrm->devlock); Loading @@ -439,14 +477,20 @@ static int swrm_ahb_read(struct swr_mstr_ctrl *swrm, if (!swrm->dev_up) goto err; if (is_swr_clk_needed(swrm)) { ret = swrm_clk_request(swrm, TRUE); if (ret) { dev_err_ratelimited(swrm->dev, "%s: clock request failed\n", __func__); goto err; } } else if (swrm_core_vote_request(swrm)) { goto err; } temp = ioread32(swrm->swrm_dig_base + reg); *value = temp; if (is_swr_clk_needed(swrm)) swrm_clk_request(swrm, FALSE); err: mutex_unlock(&swrm->devlock); Loading Loading
soc/swr-mstr-ctrl.c +61 −17 Original line number Diff line number Diff line Loading @@ -315,6 +315,11 @@ static void swrm_reg_dump(struct swr_mstr_ctrl *swrm, func, reg[i], val[i]); } static bool is_swr_clk_needed(struct swr_mstr_ctrl *swrm) { return ((swrm->version <= SWRM_VERSION_1_5_1) ? true : false); } static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm, int core_type, bool enable) { Loading Loading @@ -360,6 +365,30 @@ static int swrm_get_ssp_period(struct swr_mstr_ctrl *swrm, return ((swrm->bus_clk * 2) / ((row * col) * frame_sync)); } static int swrm_core_vote_request(struct swr_mstr_ctrl *swrm) { int ret = 0; if (!swrm->handle) return -EINVAL; mutex_lock(&swrm->clklock); if (!swrm->dev_up) { ret = -ENODEV; goto exit; } if (swrm->core_vote) { ret = swrm->core_vote(swrm->handle, true); if (ret) dev_err_ratelimited(swrm->dev, "%s: core vote request failed\n", __func__); } exit: mutex_unlock(&swrm->clklock); return ret; } static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable) { int ret = 0; Loading @@ -373,15 +402,17 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable) ret = -ENODEV; goto exit; } if (is_swr_clk_needed(swrm)) { if (swrm->core_vote) { ret = swrm->core_vote(swrm->handle, true); if (ret) { dev_err_ratelimited(swrm->dev, "%s: clock enable req failed", "%s: core vote request failed\n", __func__); goto exit; } } } swrm->clk_ref_count++; if (swrm->clk_ref_count == 1) { ret = swrm->clk(swrm->handle, true); Loading Loading @@ -416,13 +447,20 @@ static int swrm_ahb_write(struct swr_mstr_ctrl *swrm, if (!swrm->dev_up) goto err; if (is_swr_clk_needed(swrm)) { ret = swrm_clk_request(swrm, TRUE); if (ret) { dev_err_ratelimited(swrm->dev, "%s: clock request failed\n", dev_err_ratelimited(swrm->dev, "%s: clock request failed\n", __func__); goto err; } } else if (swrm_core_vote_request(swrm)) { goto err; } iowrite32(temp, swrm->swrm_dig_base + reg); if (is_swr_clk_needed(swrm)) swrm_clk_request(swrm, FALSE); err: mutex_unlock(&swrm->devlock); Loading @@ -439,14 +477,20 @@ static int swrm_ahb_read(struct swr_mstr_ctrl *swrm, if (!swrm->dev_up) goto err; if (is_swr_clk_needed(swrm)) { ret = swrm_clk_request(swrm, TRUE); if (ret) { dev_err_ratelimited(swrm->dev, "%s: clock request failed\n", __func__); goto err; } } else if (swrm_core_vote_request(swrm)) { goto err; } temp = ioread32(swrm->swrm_dig_base + reg); *value = temp; if (is_swr_clk_needed(swrm)) swrm_clk_request(swrm, FALSE); err: mutex_unlock(&swrm->devlock); Loading