Re: [PATCH v6 2/3] media: ov8856: Add devicetree support

From: Marco Felsch
Date: Thu Apr 30 2020 - 06:12:09 EST


On 20-04-30 12:59, Sakari Ailus wrote:
> Hi Marco,
>
> On Thu, Apr 30, 2020 at 11:53:32AM +0200, Marco Felsch wrote:
> > Hi Sakari,
> >
> > On 20-04-30 12:45, Sakari Ailus wrote:
> > > Hi Marco,
> > >
> > > On Thu, Apr 30, 2020 at 11:35:24AM +0200, Marco Felsch wrote:

...

> > > > > - if (mclk != OV8856_MCLK) {
> > > > > - dev_err(dev, "external clock %d is not supported", mclk);
> > > > > - return -EINVAL;
> > > > > + if (!is_acpi_node(fwnode)) {
> > > > > + ov8856->xvclk = devm_clk_get(dev, "xvclk");
> > > > > + if (IS_ERR(ov8856->xvclk)) {
> > > > > + dev_err(dev, "could not get xvclk clock (%pe)\n",
> > > > > + ov8856->xvclk);
> > > > > + return PTR_ERR(ov8856->xvclk);
> > > > > + }
> > > > > +
> > > > > + clk_set_rate(ov8856->xvclk, xvclk_rate);
> > > > > + xvclk_rate = clk_get_rate(ov8856->xvclk);
> > > > > }
> > > >
> > > > Why do we handle the clock only in DT case? Is there a problem with the
> > > > clock handling and ACPI?
> > >
> > > Not really, it's just that ACPI does not provide an interface to the clocks
> > > as such.
> >
> > But you will get a clk by devm_clk_get()?
>
> No, because ACPI does not expose one to drivers. Effectively the entire
> power sequences are implemented in ACPI, not in the driver.
>

Ah okay, thanks for the explanation. I'm really not into the ACPI
stuff.. So this means the __power_off / power_on should only be done if
we are using DT's?

Regards,
Marco