From: Thomas Richard <thomas.richard@bootlin.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Lee Jones <lee@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-i2c@vger.kernel.org, linux-watchdog@vger.kernel.org,
thomas.petazzoni@bootlin.com, blake.vermeer@keysight.com
Subject: Re: [PATCH 3/5] i2c: Congatec Board Controller i2c bus driver
Date: Fri, 6 Sep 2024 15:29:17 +0200 [thread overview]
Message-ID: <cbbd52bf-8758-42e9-8b35-48750137f2fd@bootlin.com> (raw)
In-Reply-To: <tv6v7g3nkoedbu4olu2xi76qtfueebnfz7c2zx7t2wmpthqdt6@wmbo2lwv5qnf>
On 8/14/24 01:24, Andi Shyti wrote:
> Hi Thomas,
Hi Andi,
Thanks for the review !!
>
> On Fri, Aug 09, 2024 at 04:52:07PM GMT, Thomas Richard wrote:
>> Add i2c support for the Congatec Board Controller.
>> do you mind adding some more description?
I'll mention that there are 2 busses.
>
>> Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
>
> ...
>
>> +config I2C_CGBC
>> + tristate "Congatec I2C Controller"
>> + depends on MFD_CGBC
>> + help
>> + This enables the I2C bus interfaces for the Congatec Board
>
> This what? :-)
Rephrased it for next iteration.
>
>> + Controller.
>> +
>> + This driver can also be built as a module. If so, the module will
>> + be called i2c-cgbc.ko.
>> +
>
> ...
>
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/i2c.h>
>> +#include <linux/iopoll.h>
>
> please sort includes in alphabetical order?
Fixed in the next iteration.
>
>> +#include <linux/mfd/cgbc.h>
>
> ...
>
>> +enum i2c_state {
>> + STATE_DONE = 0,
>> + STATE_INIT,
>> + STATE_START,
>> + STATE_READ,
>> + STATE_WRITE,
>> + STATE_ERROR,
>> +};
>
> can you please use the cgbc prefix for this enum and all the
> members?
Ok, fixed in the next iteration.
>
> ...
>
>> + if (bus_frequency > CGBC_I2C_FREQ_MAX_HZ ||
>> + bus_frequency < CGBC_I2C_FREQ_MIN_HZ) {
>> + dev_warn(i2c->dev, "invalid frequency %u, using default\n", bus_frequency);
>
> should this rather be a dev_info()? (supernit: please start with
> capital leter).
The driver i2c-xlp9xx has a similar message [1] and it uses a dev_warn().
So I don't know.
If you think dev_info() is more relevant in this case, I'll change it.
Supernit will be fixed in next iteration.
[1]
https://elixir.bootlin.com/linux/v6.11-rc6/source/drivers/i2c/busses/i2c-xlp9xx.c#L480
>
>> + bus_frequency = I2C_MAX_STANDARD_MODE_FREQ;
>> + }
>> +
>> + cmd[0] = CGBC_I2C_CMD_SPEED | algo_data->bus_id;
>> + cmd[1] = cgbc_i2c_freq_to_reg(bus_frequency);
>> +
>> + ret = cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL);
>> + if (ret)
>> + return dev_err_probe(i2c->dev, ret,
>> + "Failed to initialize I2C bus %s",
>> + adap->name);
>> +
>> + cmd[1] = 0x00;
>> +
>> + ret = cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL);
>> + if (ret)
>> + return dev_err_probe(i2c->dev, ret,
>> + "Failed to get I2C bus frequency");
>> +
>> + bus_frequency = cgbc_i2c_reg_to_freq(data);
>> +
>> + dev_dbg(i2c->dev, "%s is running at %d Hz\n", adap->name, bus_frequency);
>> +
>> + /*
>> + * The read_maxtime_us is the maximum time to wait during a read to get
>> + * data. At maximum CGBC_I2C_READ_MAX_LEN can be read by command.
>> + * So calculate the max time to size correctly the timeout.
>> + */
>
> this comment is a bit wild, can we rephrase to something like:
>
> /*
> * The read_maxtime_us variable represents the maximum time to wait
> * for data during a read operation. The maximum amount of data that
> * can be read by a command is CGBC_I2C_READ_MAX_LEN.
> * Therefore, calculate the max time to properly size the timeout.
> */
>
> (it's a suggestion, please choose the words you prefer).
thanks for the rephrasing.
Thomas
next prev parent reply other threads:[~2024-09-06 13:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 14:52 [PATCH 0/5] Congatec Board Controller drivers Thomas Richard
2024-08-09 14:52 ` [PATCH 1/5] mfd: add Congatec Board Controller mfd driver Thomas Richard
2024-08-22 10:38 ` Lee Jones
2024-09-10 15:41 ` Thomas Richard
2024-09-12 14:13 ` Lee Jones
2024-09-13 8:30 ` Thomas Richard
2024-09-17 8:09 ` Lee Jones
2024-08-09 14:52 ` [PATCH 2/5] gpio: Congatec Board Controller gpio driver Thomas Richard
2024-08-14 9:16 ` Bartosz Golaszewski
2024-08-19 16:11 ` Thomas Richard
2024-08-09 14:52 ` [PATCH 3/5] i2c: Congatec Board Controller i2c bus driver Thomas Richard
2024-08-13 23:24 ` Andi Shyti
2024-09-06 13:29 ` Thomas Richard [this message]
2024-09-09 19:29 ` Andi Shyti
2024-08-09 14:52 ` [PATCH 4/5] watchdog: Congatec Board Controller watchdog timer driver Thomas Richard
2024-08-09 16:27 ` Guenter Roeck
2024-09-02 13:38 ` Thomas Richard
2024-08-09 14:52 ` [PATCH 5/5] MAINTAINERS: Add entry for Congatec Board Controller Thomas Richard
2024-08-13 23:26 ` Andi Shyti
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=cbbd52bf-8758-42e9-8b35-48750137f2fd@bootlin.com \
--to=thomas.richard@bootlin.com \
--cc=andi.shyti@kernel.org \
--cc=blake.vermeer@keysight.com \
--cc=brgl@bgdev.pl \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=thomas.petazzoni@bootlin.com \
--cc=wim@linux-watchdog.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: link
Be 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.