From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Robert Foss <robert.foss@linaro.org> Cc: Dongchun Zhu <dongchun.zhu@mediatek.com>, Fabio Estevam <festevam@gmail.com>, Sakari Ailus <sakari.ailus@iki.fi>, Tomasz Figa <tfiga@chromium.org>, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [v2 2/3] media: ov8856: Add devicetree support Date: Fri, 13 Mar 2020 14:28:06 +0200 [thread overview] Message-ID: <20200313122806.GT1922688@smile.fi.intel.com> (raw) In-Reply-To: <20200313110350.10864-3-robert.foss@linaro.org> On Fri, Mar 13, 2020 at 12:03:49PM +0100, Robert Foss wrote: > Add devicetree match table, and enable ov8856_probe() > to initialize power, clocks and reset pins. Thanks for an update. My comments below. ... > + ov8856->xvclk = devm_clk_get(&client->dev, "xvclk"); In many frameworks we have '_optional' variants of API. Please use it instead of open coded approach. > + if (PTR_ERR(ov8856->xvclk) == -ENOENT) { > + dev_info(&client->dev, "xvclk clock not defined, continuing...\n"); > + ov8856->xvclk = NULL; > + } else if (IS_ERR(ov8856->xvclk)) { > + dev_err(&client->dev, "could not get xvclk clock (%ld)\n", > + PTR_ERR(ov8856->xvclk)); > + return PTR_ERR(ov8856->xvclk); > + } > + > + ret = clk_set_rate(ov8856->xvclk, OV8856_XVCLK_24); > + if (ret < 0) { > + dev_err(&client->dev, "failed to set xvclk rate (24MHz)\n"); > + return ret; > + } > + > + ov8856->reset_gpio = devm_gpiod_get(&client->dev, "reset", > + GPIOD_OUT_HIGH); Same here. > + if (IS_ERR(ov8856->reset_gpio)) { > + dev_err(&client->dev, "failed to get reset-gpios\n"); > + return PTR_ERR(ov8856->reset_gpio); > + } > + > + for (i = 0; i < ARRAY_SIZE(ov8856_supply_names); i++) > + ov8856->supplies[i].supply = ov8856_supply_names[i]; > + > + ret = devm_regulator_bulk_get(&client->dev, > + ARRAY_SIZE(ov8856_supply_names), > + ov8856->supplies); Luckily regulator framework will create dummy ones if there is none found. > + if (ret) { > + dev_warn(&client->dev, "failed to get regulators\n"); > + return ret; > + } -- With Best Regards, Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Robert Foss <robert.foss@linaro.org> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Tomasz Figa <tfiga@chromium.org>, Sakari Ailus <sakari.ailus@iki.fi>, Dongchun Zhu <dongchun.zhu@mediatek.com>, Fabio Estevam <festevam@gmail.com>, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: Re: [v2 2/3] media: ov8856: Add devicetree support Date: Fri, 13 Mar 2020 14:28:06 +0200 [thread overview] Message-ID: <20200313122806.GT1922688@smile.fi.intel.com> (raw) In-Reply-To: <20200313110350.10864-3-robert.foss@linaro.org> On Fri, Mar 13, 2020 at 12:03:49PM +0100, Robert Foss wrote: > Add devicetree match table, and enable ov8856_probe() > to initialize power, clocks and reset pins. Thanks for an update. My comments below. ... > + ov8856->xvclk = devm_clk_get(&client->dev, "xvclk"); In many frameworks we have '_optional' variants of API. Please use it instead of open coded approach. > + if (PTR_ERR(ov8856->xvclk) == -ENOENT) { > + dev_info(&client->dev, "xvclk clock not defined, continuing...\n"); > + ov8856->xvclk = NULL; > + } else if (IS_ERR(ov8856->xvclk)) { > + dev_err(&client->dev, "could not get xvclk clock (%ld)\n", > + PTR_ERR(ov8856->xvclk)); > + return PTR_ERR(ov8856->xvclk); > + } > + > + ret = clk_set_rate(ov8856->xvclk, OV8856_XVCLK_24); > + if (ret < 0) { > + dev_err(&client->dev, "failed to set xvclk rate (24MHz)\n"); > + return ret; > + } > + > + ov8856->reset_gpio = devm_gpiod_get(&client->dev, "reset", > + GPIOD_OUT_HIGH); Same here. > + if (IS_ERR(ov8856->reset_gpio)) { > + dev_err(&client->dev, "failed to get reset-gpios\n"); > + return PTR_ERR(ov8856->reset_gpio); > + } > + > + for (i = 0; i < ARRAY_SIZE(ov8856_supply_names); i++) > + ov8856->supplies[i].supply = ov8856_supply_names[i]; > + > + ret = devm_regulator_bulk_get(&client->dev, > + ARRAY_SIZE(ov8856_supply_names), > + ov8856->supplies); Luckily regulator framework will create dummy ones if there is none found. > + if (ret) { > + dev_warn(&client->dev, "failed to get regulators\n"); > + return ret; > + } -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-03-13 12:28 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-13 11:03 [v2 0/3] media: ov8856: Add devicetree support Robert Foss 2020-03-13 11:03 ` Robert Foss 2020-03-13 11:03 ` [v2 1/3] media: dt-bindings: ov8856: Document YAML bindings Robert Foss 2020-03-13 11:03 ` Robert Foss 2020-03-13 12:19 ` Sakari Ailus 2020-03-13 12:19 ` Sakari Ailus 2020-03-13 22:00 ` Rob Herring 2020-03-13 22:00 ` Rob Herring 2020-03-13 11:03 ` [v2 2/3] media: ov8856: Add devicetree support Robert Foss 2020-03-13 11:03 ` Robert Foss 2020-03-13 12:17 ` Sakari Ailus 2020-03-13 12:17 ` Sakari Ailus 2020-03-26 11:56 ` Robert Foss 2020-03-26 11:56 ` Robert Foss 2020-03-26 14:47 ` Sakari Ailus 2020-03-26 14:47 ` Sakari Ailus 2020-03-27 10:32 ` Robert Foss 2020-03-27 10:32 ` Robert Foss 2020-03-27 13:37 ` Sakari Ailus 2020-03-27 13:37 ` Sakari Ailus 2020-03-13 12:28 ` Andy Shevchenko [this message] 2020-03-13 12:28 ` Andy Shevchenko 2020-03-13 13:15 ` Fabio Estevam 2020-03-13 13:15 ` Fabio Estevam 2020-03-31 13:37 ` Robert Foss 2020-03-31 13:37 ` Robert Foss 2020-03-31 13:42 ` Fabio Estevam 2020-03-31 13:42 ` Fabio Estevam 2020-03-31 13:53 ` Andy Shevchenko 2020-03-31 13:53 ` Andy Shevchenko 2020-03-13 11:03 ` [v2 3/3] media: ov8856: Implement sensor module revision identification Robert Foss 2020-03-13 11:03 ` Robert Foss 2020-03-13 12:43 ` Sakari Ailus 2020-03-13 12:43 ` Sakari Ailus
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200313122806.GT1922688@smile.fi.intel.com \ --to=andriy.shevchenko@linux.intel.com \ --cc=devicetree@vger.kernel.org \ --cc=dongchun.zhu@mediatek.com \ --cc=festevam@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=robert.foss@linaro.org \ --cc=sakari.ailus@iki.fi \ --cc=tfiga@chromium.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.