[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdaLJzG3_M7fNC-MHOdQ6HMsqHqVccK7XkvL=PvJnycCHQ@mail.gmail.com>
Date: Tue, 2 Mar 2021 10:00:05 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Vincent Knecht <vincent.knecht@...loo.org>
Cc: phone-devel@...r.kernel.org, ~postmarketos/upstreaming@...ts.sr.ht,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Henrik Rydberg <rydberg@...math.org>,
Michael Srba <Michael.Srba@...nam.cz>,
Linux Input <linux-input@...r.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 2/2] Input: add MStar MSG2638 touchscreen driver
Hi Vincent,
thanks for your patch!
On Tue, Feb 16, 2021 at 5:38 PM Vincent Knecht
<vincent.knecht@...loo.org> wrote:
> Add support for the msg2638 touchscreen IC from MStar.
> This driver reuses zinitix.c structure, while the checksum and irq handler
> functions are based on out-of-tree driver for Alcatel Idol 3 (4.7").
>
> Signed-off-by: Vincent Knecht <vincent.knecht@...loo.org>
> ---
> Changed in v5:
> - use gpiod_set_value_cansleep() (Stephan G)
> - use msleep/usleep_range() rathen than mdelay() (Stephan G)
(...)
> +#include <linux/delay.h>
> +#include <linux/gpio.h>
Please only include
#include <linux/gpio/consumer.h>
> +#define CHIP_ON_DELAY 15 // ms
> +#define FIRMWARE_ON_DELAY 50 // ms
> +#define RESET_DELAY_MIN 10000 // µs
> +#define RESET_DELAY_MAX 11000 // µs
Rename the defines with _MS and _US suffixes so you don't
need the comments, CHIP_ON_DELAY_MS etc.
> +static int msg2638_init_regulators(struct msg2638_ts_data *msg2638)
> +{
> + struct i2c_client *client = msg2638->client;
> + int error;
I usually prefer a short name like "err" (cognitive load) but your choice.
> +static u8 msg2638_checksum(u8 *data, u32 length)
> +{
> + s32 sum = 0;
> + u32 i;
> +
> + for (i = 0; i < length; i++)
> + sum += data[i];
> +
> + return (u8)((-sum) & 0xFF);
> +}
Interesting checksum algoritm.
> +static int msg2638_start(struct msg2638_ts_data *msg2638)
> +{
> + int error;
> +
> + error = regulator_bulk_enable(ARRAY_SIZE(msg2638->supplies),
> + msg2638->supplies);
> + if (error) {
> + dev_err(&msg2638->client->dev, "Failed to enable regulators: %d\n", error);
> + return error;
> + }
> +
> + msleep(CHIP_ON_DELAY);
> +
> + msg2638_power_on(msg2638);
Maybe move enable_irq() here from power on to mirror
the stop() function below?
> +#ifdef CONFIG_OF
> +static const struct of_device_id msg2638_of_match[] = {
> + { .compatible = "mstar,msg2638" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, msg2638_of_match);
> +#endif
I think these #ifdefs are not needed anymore. We just have struct of_device_id
available at all times.
Yours,
Linus Walleij
Powered by blists - more mailing lists