mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
ALSA: hda/tegra: get clock handles early in probe
Moved devm_clk_get() API calls to a separate function and the same can be called early in the probe. This is done before runtime PM for the device is enabled. The runtime resume/suspend callbacks can later enable/disable clocks respectively(the support would be added in subsequent patches). Clock handles should be available by the time runtime suspend/resume calls can happen. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3f7e94e6d6
commit
65af2122e8
@ -306,22 +306,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
|
|||||||
struct resource *res;
|
struct resource *res;
|
||||||
int err;
|
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);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
hda->regs = devm_ioremap_resource(dev, res);
|
hda->regs = devm_ioremap_resource(dev, res);
|
||||||
if (IS_ERR(hda->regs))
|
if (IS_ERR(hda->regs))
|
||||||
@ -341,6 +325,29 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
|
|||||||
return 0;
|
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)
|
static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct hdac_bus *bus = azx_bus(chip);
|
struct hdac_bus *bus = azx_bus(chip);
|
||||||
@ -507,6 +514,10 @@ static int hda_tegra_probe(struct platform_device *pdev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = hda_tegra_init_clk(hda);
|
||||||
|
if (err < 0)
|
||||||
|
goto out_free;
|
||||||
|
|
||||||
err = hda_tegra_create(card, driver_flags, hda);
|
err = hda_tegra_create(card, driver_flags, hda);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
Loading…
Reference in New Issue
Block a user