From: Andi Shyti <andi.shyti@kernel.org>
To: Hans Hu <hanshu-oc@zhaoxin.com>
Cc: krzk@kernel.org, linux-i2c@vger.kernel.org, cobechen@zhaoxin.com,
TonyWWang@zhaoxin.com
Subject: Re: [PATCH v5] i2c: add support for Zhaoxin I2C controller
Date: Wed, 14 Jun 2023 10:21:46 +0200 [thread overview]
Message-ID: <20230614082146.ogcgsxsqdzgfhnur@intel.intel> (raw)
In-Reply-To: <20230614073433.280501-1-hanshu-oc@zhaoxin.com>
Hi Hans,
On Wed, Jun 14, 2023 at 03:34:33PM +0800, Hans Hu wrote:
> Add Zhaoxin I2C controller driver. It provides the access to the i2c
> busses, which connects to the touchpad, eeprom, etc.
>
> Zhaoxin I2C controller has two separate busses, so may accommodate up
> to two I2C adapters. Those adapters are listed in the ACPI namespace
> with the "IIC1D17" HID, and probed by a platform driver.
>
> The driver works with IRQ mode, and supports basic I2C features. Flags
> I2C_AQ_NO_ZERO_LEN and I2C_AQ_COMB_WRITE_THEN_READ are used to limit
> the unsupported access.
>
> Change since v4:
> * delete platform check in probe()
> * move config interface under ACPI in Kconfig file
> * add irq disable when access error
> * fix some trivial issues
> Link: https://lore.kernel.org/all/20230609031625.6928-1-hanshu-oc@zhaoxin.com/
Looks very good, almost ready for r-b, I have few little nitpicks
though, that are more a matter of style.
[...]
> +static const u32 zxi2c_speed_params_table[][3] = {
> + /* speed, ZXI2C_TCR, ZXI2C_FSTP, ZXI2C_CS, ZXI2C_SCLTP */
> + {I2C_MAX_STANDARD_MODE_FREQ, 0, ZXI2C_GOLDEN_FSTP_100K},
> + {I2C_MAX_FAST_MODE_FREQ, ZXI2C_FAST_SEL, ZXI2C_GOLDEN_FSTP_400K},
> + {I2C_MAX_FAST_MODE_PLUS_FREQ, ZXI2C_FAST_SEL, ZXI2C_GOLDEN_FSTP_1M},
> + {I2C_MAX_HIGH_SPEED_MODE_FREQ, ZXI2C_HS_SEL, ZXI2C_GOLDEN_FSTP_3400K},
can you leave a space here between brackets:
{ I2C_MAX_FAST_MODE_PLUS_FREQ, ZXI2C_FAST_SEL, ZXI2C_GOLDEN_FSTP_1M },
> +};
> +
> +static void zxi2c_set_bus_speed(struct zxi2c *i2c)
> +{
> + u8 i, count;
> + const u32 *params = NULL;
> +
> + count = ARRAY_SIZE(zxi2c_speed_params_table);
> + for (i = 0; i < count; i++) {
> + if (zxi2c_speed_params_table[i][0] == i2c->speed) {
> + params = zxi2c_speed_params_table[i];
> + break;
> + }
> + }
the brackets around the for() are not necessary
> + iowrite8(params[1], i2c->regs + ZXI2C_TCR);
> + if (abs(i2c->fstp - params[2]) > 0x10) {
> + /* if BIOS setting value far from golden value,
> + * use golden value and warn user
> + */
the comment should be
/*
* if BIOS setting value far from golden value,
* use golden value and warn user
*/
> + dev_warn_once(i2c->dev, "speed:%d, fstp:0x%x, golden:0x%x\n",
> + i2c->speed, i2c->fstp, params[2]);
> + iowrite8(params[2], i2c->regs + ZXI2C_FSTP);
> + } else {
> + iowrite8(i2c->fstp, i2c->regs + ZXI2C_FSTP);
> + }
[...]
> + if (num == 1 && msgs->len <= ZXI2C_FIFO_SIZE && msgs->len >= 3)
> + err = zxi2c_fifo_xfer(i2c, msgs);
> + else
> + err = zxi2c_byte_xfer(i2c, msgs, num);
> +
> + zxi2c_enable_irq(i2c->regs, ZXI2C_EN_FIFOEND | ZXI2C_EN_BYTEEND, false);
can you add a comment here to explain that interrupts have been
enabled inside the xfer functions? Otherwise someone might wonder
why this line.
> + return err;
> +}
[...]
> +static const struct acpi_device_id zxi2c_acpi_match[] = {
> + {"IIC1D17", 0},
> + {},
the comma is not needed and please leave a space
{ "IIC1D17", 0 },
{ }
With the little things above, you can add:
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Thank you!
Andi
> +};
> +MODULE_DEVICE_TABLE(acpi, zxi2c_acpi_match);
next prev parent reply other threads:[~2023-06-14 8:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 3:16 [PATCH v4] i2c: add support for Zhaoxin I2C controller Hans Hu
2023-06-09 9:33 ` Krzysztof Kozlowski
2023-06-12 3:31 ` Hans Hu
2023-06-09 12:24 ` Andi Shyti
2023-06-09 13:11 ` Krzysztof Kozlowski
2023-06-12 8:24 ` Hans Hu
2023-06-09 12:47 ` Andi Shyti
2023-06-14 7:34 ` [PATCH v5] " Hans Hu
2023-06-14 8:21 ` Andi Shyti [this message]
2023-06-14 9:48 ` [PATCH v6] " Hans Hu
2023-06-23 8:47 ` Wolfram Sang
2023-06-25 10:57 ` Hans Hu
2023-06-30 8:01 ` Andi Shyti
[not found] ` <6f3479fb79944d5a8b4a562d67c82a4b@zhaoxin.com>
[not found] ` <1abb34e5cbe74514911598a5a522045b@zhaoxin.com>
2023-07-06 7:25 ` Hans Hu
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=20230614082146.ogcgsxsqdzgfhnur@intel.intel \
--to=andi.shyti@kernel.org \
--cc=TonyWWang@zhaoxin.com \
--cc=cobechen@zhaoxin.com \
--cc=hanshu-oc@zhaoxin.com \
--cc=krzk@kernel.org \
--cc=linux-i2c@vger.kernel.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.