lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ff85bb4675f1adf01f48cdcf89ef314ba4170ddb.camel@mediatek.com>
Date: Tue, 9 Jan 2024 10:46:28 +0000
From: Zhi Mao (毛智) <zhi.mao@...iatek.com>
To: "mchehab@...nel.org" <mchehab@...nel.org>,
	"krzysztof.kozlowski@...aro.org" <krzysztof.kozlowski@...aro.org>,
	"robh+dt@...nel.org" <robh+dt@...nel.org>,
	"krzysztof.kozlowski+dt@...aro.org" <krzysztof.kozlowski+dt@...aro.org>
CC: "heiko@...ech.de" <heiko@...ech.de>, "gerald.loacker@...fvision.net"
	<gerald.loacker@...fvision.net>, "tomi.valkeinen@...asonboard.com"
	<tomi.valkeinen@...asonboard.com>, "yunkec@...omium.org"
	<yunkec@...omium.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "dan.scally@...asonboard.com"
	<dan.scally@...asonboard.com>, "linux-media@...r.kernel.org"
	<linux-media@...r.kernel.org>,
	Shengnan Wang (王圣男)
	<shengnan.wang@...iatek.com>, "hdegoede@...hat.com" <hdegoede@...hat.com>,
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
	"andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
	Yaya Chang (張雅清) <Yaya.Chang@...iatek.com>,
	"bingbu.cao@...el.com" <bingbu.cao@...el.com>,
	"jacopo.mondi@...asonboard.com" <jacopo.mondi@...asonboard.com>,
	"jernej.skrabec@...il.com" <jernej.skrabec@...il.com>,
	"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@...iatek.com>, "conor+dt@...nel.org"
	<conor+dt@...nel.org>, "10572168@...com" <10572168@...com>,
	"sakari.ailus@...ux.intel.com" <sakari.ailus@...ux.intel.com>,
	"hverkuil-cisco@...all.nl" <hverkuil-cisco@...all.nl>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "matthias.bgg@...il.com"
	<matthias.bgg@...il.com>, "laurent.pinchart@...asonboard.com"
	<laurent.pinchart@...asonboard.com>,
	"angelogioacchino.delregno@...labora.com"
	<angelogioacchino.delregno@...labora.com>, "macromorgan@...mail.com"
	<macromorgan@...mail.com>
Subject: Re: [PATCH 1/2] media: i2c: Add GC08A3 image sensor driver

On Thu, 2023-12-07 at 09:18 +0100, Krzysztof Kozlowski wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 07/12/2023 06:20, Zhi Mao wrote:
> > Add a V4L2 sub-device driver for Galaxycore GC08A3 image sensor.
> > 
> > Reviewed-By: yunkec@...omium.org
> 
> I don't see review given here:
> 
> 
https://lore.kernel.org/linux-media/20231123115104.32094-1-zhi.mao@mediatek.com/
> 
> This does not look like real review. Where was it performed? How
> thorough was it? How many review iterations did it include?  Why
> there
> is no name but anonymous review?
> 
[mtk]: Sorry, I removed this "Reviewed-By:" messge. please review
patch:v3 
> 
> 
> > Signed-off-by: Zhi Mao <zhi.mao@...iatek.com>
> > ---
> >  drivers/media/i2c/Kconfig  |   14 +
> >  drivers/media/i2c/Makefile |    1 +
> >  drivers/media/i2c/gc08a3.c | 1888
> ++++++++++++++++++++++++++++++++++++
> >  3 files changed, 1903 insertions(+)
> >  create mode 100644 drivers/media/i2c/gc08a3.c
> > 
> 
> ...
> 
> > +static inline struct gc08a3 *to_gc08a3(struct v4l2_subdev *sd)
> > +{
> > +return container_of(sd, struct gc08a3, sd);
> > +}
> > +
> > +static int gc08a3_power_on(struct device *dev)
> > +{
> > +struct i2c_client *client = to_i2c_client(dev);
> > +struct v4l2_subdev *sd = i2c_get_clientdata(client);
> > +struct gc08a3 *gc08a3 = to_gc08a3(sd);
> > +int ret;
> > +
> > +gpiod_set_value_cansleep(gc08a3->enable_gpio, 0);
> 
> Why do you put make enable GPIO low? That's not how enable GPIO is
> supposed to work...
> 
[mtk]: fixed in patch:v3

> > +usleep_range(GC08A3_MIN_SLEEP_US, GC08A3_MAX_SLEEP_US);
> > +
> > +ret = regulator_bulk_enable(GC08A3_NUM_SUPPLIES, gc08a3-
> >supplies);
> > +if (ret < 0) {
> > +dev_err(gc08a3->dev, "failed to enable regulators: %d\n", ret);
> > +return ret;
> > +}
> > +
> > +ret = clk_prepare_enable(gc08a3->xclk);
> > +if (ret < 0) {
> > +regulator_bulk_disable(GC08A3_NUM_SUPPLIES, gc08a3->supplies);
> > +dev_err(gc08a3->dev, "clk prepare enable failed\n");
> > +return ret;
> > +}
> > +
> > +usleep_range(GC08A3_MIN_SLEEP_US, GC08A3_MAX_SLEEP_US);
> > +
> > +gpiod_set_value_cansleep(gc08a3->enable_gpio, 1);
> > +usleep_range(GC08A3_MIN_SLEEP_US, GC08A3_MAX_SLEEP_US);
> > +
> > +return 0;
> > +}
> > +
> > +static int gc08a3_power_off(struct device *dev)
> > +{
> > +struct i2c_client *client = to_i2c_client(dev);
> > +struct v4l2_subdev *sd = i2c_get_clientdata(client);
> > +struct gc08a3 *gc08a3 = to_gc08a3(sd);
> > +
> > +gpiod_set_value_cansleep(gc08a3->enable_gpio, 0);
> 
> How making enable GPIO low is related to power off? Enable means you
> turn on some feature, not shutdown. Look at common GPIO consumer
> bindings in the kernel.
> 
[mtk]:Here, we rename it to "reset-pin", according to sensor power off
sequence in sepc, we should pull low this pin.
> 
> ...
> 
> > +static int gc08a3_probe(struct i2c_client *client)
> > +{
> > +struct device *dev = &client->dev;
> > +struct gc08a3 *gc08a3;
> > +int ret;
> > +
> > +ret = gc08a3_parse_fwnode(dev);
> > +if (ret)
> > +return ret;
> > +
> > +gc08a3 = devm_kzalloc(dev, sizeof(*gc08a3), GFP_KERNEL);
> > +if (!gc08a3)
> > +return -ENOMEM;
> > +
> > +gc08a3->dev = dev;
> > +
> > +gc08a3->xclk = devm_clk_get(dev, NULL);
> > +if (IS_ERR(gc08a3->xclk))
> > +return dev_err_probe(dev, PTR_ERR(gc08a3->xclk),
> > + "failed to get xclk\n");
> 
> Misaligned indentation
> 
[mtk]: fixed in patch:v3

> > +
> > +ret = clk_set_rate(gc08a3->xclk, GC08A3_DEFAULT_CLK_FREQ);
> > +if (ret)
> > +return dev_err_probe(dev, ret,
> > + "failed to set xclk frequency\n");
> 
> Misaligned indentation
[mtk]: fixed in patch:v3

> 
> > +
> > +ret = gc08a3_get_regulators(dev, gc08a3);
> > +if (ret < 0)
> > +return dev_err_probe(dev, ret,
> > + "failed to get regulators\n");
> 
> Misaligned indentation
> 
[mtk]: fixed in patch:v3

> > +
> > +gc08a3->enable_gpio = devm_gpiod_get(dev, "enable",
> GPIOD_OUT_LOW);
> > +if (IS_ERR(gc08a3->enable_gpio))
> > +return dev_err_probe(dev, PTR_ERR(gc08a3->enable_gpio),
> > + "failed to get gpio\n");
> 
> Misaligned indentation... probably entire code is misaligned.
> 
[mtk]: fixed in patch:v3

> 
> Best regards,
> Krzysztof
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ