[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG3jFytP9=pL=9Qh64BKqQchs7J7E45USfirK_SnGn3NMeCdcg@mail.gmail.com>
Date: Thu, 30 Apr 2020 18:11:14 +0200
From: Robert Foss <robert.foss@...aro.org>
To: Marco Felsch <m.felsch@...gutronix.de>
Cc: Sakari Ailus <sakari.ailus@....fi>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Maxime Ripard <maxime@...no.tech>,
linux-media <linux-media@...r.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>,
Dongchun Zhu <dongchun.zhu@...iatek.com>,
Fabio Estevam <festevam@...il.com>,
Tomasz Figa <tfiga@...omium.org>
Subject: Re: [PATCH v6 2/3] media: ov8856: Add devicetree support
Hey Marco,
On Thu, 30 Apr 2020 at 14:07, Marco Felsch <m.felsch@...gutronix.de> wrote:
>
> On 20-04-30 13:20, Sakari Ailus wrote:
> > On Thu, Apr 30, 2020 at 12:11:57PM +0200, Marco Felsch wrote:
> > > 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?
> >
> > Correct. That's why it bails out early. It could be yet earlier though,
> > without doing anything.
>
> Yes I see. For easier and error less prone handling I would prefer:
>
> if (is_acpi_node())
> return 0;
>
> as first instruction for __power_off/on().
__ov8856_power_on() does make a check like that, albeit only after
having run clk_prepare_enable() which won't do anything due to
ov8856->xvclk==NULL. So this should be fixed and be moved to after the
ACPI check.
__ov8856_power_off() has no ACPI check, but all of the calls it makes
are going to do nothing due to v8856->reset_gpio / v8856->reset_gpio /
ov8856->xvclk all being NULL or dummies. For the sake of clarity an
early ACPI check+return could be added, but if clarity is the goal a
comment would work too.
>
> Also I would refactor the ov8856_check_hwcfg() so the common part can be
> used by this function and by a ov8856_parse_of() function. But thats
> only my opinion.
I'm trying to grok the above paragraph. You'd like to see something in
the style of tc358743_probe_of()?
>
> Regards,
> Marco
Powered by blists - more mailing lists