struct resource *res;
int err;
- hda->hda_clk = devm_clk_get(dev, "hda");
- if (IS_ERR(hda->hda_clk)) {
- dev_err(dev, "failed to get hda clock\n");
- return PTR_ERR(hda->hda_clk);
- }
- hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x");
- if (IS_ERR(hda->hda2codec_2x_clk)) {
- dev_err(dev, "failed to get hda2codec_2x clock\n");
- return PTR_ERR(hda->hda2codec_2x_clk);
- }
- hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi");
- if (IS_ERR(hda->hda2hdmi_clk)) {
- dev_err(dev, "failed to get hda2hdmi clock\n");
- return PTR_ERR(hda->hda2hdmi_clk);
- }
-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hda->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(hda->regs))
return 0;
}
+static int hda_tegra_init_clk(struct hda_tegra *hda)
+{
+ struct device *dev = hda->dev;
+
+ hda->hda_clk = devm_clk_get(dev, "hda");
+ if (IS_ERR(hda->hda_clk)) {
+ dev_err(dev, "failed to get hda clock\n");
+ return PTR_ERR(hda->hda_clk);
+ }
+ hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x");
+ if (IS_ERR(hda->hda2codec_2x_clk)) {
+ dev_err(dev, "failed to get hda2codec_2x clock\n");
+ return PTR_ERR(hda->hda2codec_2x_clk);
+ }
+ hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi");
+ if (IS_ERR(hda->hda2hdmi_clk)) {
+ dev_err(dev, "failed to get hda2hdmi clock\n");
+ return PTR_ERR(hda->hda2hdmi_clk);
+ }
+
+ return 0;
+}
+
static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
{
struct hdac_bus *bus = azx_bus(chip);
return err;
}
+ err = hda_tegra_init_clk(hda);
+ if (err < 0)
+ goto out_free;
+
err = hda_tegra_create(card, driver_flags, hda);
if (err < 0)
goto out_free;