* GNU General Public License for more details.
*/
+#include <linux/clk.h>
#include <linux/firmware.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
struct qcom_smem_state *state;
unsigned stop_bit;
+ struct clk *xo;
+
struct regulator *cx_supply;
struct completion start_done;
struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
int ret;
- ret = regulator_enable(adsp->cx_supply);
+ ret = clk_prepare_enable(adsp->xo);
if (ret)
return ret;
+ ret = regulator_enable(adsp->cx_supply);
+ if (ret)
+ goto disable_clocks;
+
ret = qcom_scm_pas_auth_and_reset(ADSP_PAS_ID);
if (ret) {
dev_err(adsp->dev,
disable_regulators:
regulator_disable(adsp->cx_supply);
+disable_clocks:
+ clk_disable_unprepare(adsp->xo);
return ret;
}
return IRQ_HANDLED;
}
+static int adsp_init_clock(struct qcom_adsp *adsp)
+{
+ int ret;
+
+ adsp->xo = devm_clk_get(adsp->dev, "xo");
+ if (IS_ERR(adsp->xo)) {
+ ret = PTR_ERR(adsp->xo);
+ if (ret != -EPROBE_DEFER)
+ dev_err(adsp->dev, "failed to get xo clock");
+ return ret;
+ }
+
+ return 0;
+}
+
static int adsp_init_regulator(struct qcom_adsp *adsp)
{
adsp->cx_supply = devm_regulator_get(adsp->dev, "cx");
if (ret)
goto free_rproc;
+ ret = adsp_init_clock(adsp);
+ if (ret)
+ goto free_rproc;
+
ret = adsp_init_regulator(adsp);
if (ret)
goto free_rproc;