Skip to content

Commit

Permalink
iio: adc: ad9361: make sure clkin is disabled
Browse files Browse the repository at this point in the history
Use devm_add_action_or_reset() to make sure clkin is properly disabled
on the unbind path.

Fixes: 216fa74 ("drivers/iio/adc/ad9361: Explicit enable refclk")
Signed-off-by: Nuno Sa <[email protected]>
  • Loading branch information
nunojsa committed May 3, 2023
1 parent 5d8ee95 commit 4257782
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/iio/adc/ad9361.c
Original file line number Diff line number Diff line change
Expand Up @@ -4939,6 +4939,11 @@ static unsigned long ad9361_ref_div_sel(unsigned long refin_Hz, unsigned long ma
return 0;
}

static void ad9361_clk_disable(void *clk)
{
clk_disable_unprepare(clk);
}

static int ad9361_setup(struct ad9361_rf_phy *phy)
{
struct ad9361_rf_phy_state *st = phy->state;
Expand Down Expand Up @@ -5005,6 +5010,10 @@ static int ad9361_setup(struct ad9361_rf_phy *phy)
if (ret < 0)
return ret;

ret = devm_add_action_or_reset(dev, ad9361_clk_disable, phy->clk_refin);
if (ret)
return ret;

ret = clk_set_rate(phy->clks[BB_REFCLK], ref_freq);
if (ret < 0) {
dev_err(dev, "Failed to set BB ref clock rate (%d)\n",
Expand Down

0 comments on commit 4257782

Please sign in to comment.