From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Felix Kaechele <felix@kaechele.ca>,
Job Noorman <job@noorman.info>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] input: himax_hx83112b: add regulator handling
Date: Sat, 4 May 2024 14:37:30 +0200 [thread overview]
Message-ID: <95f8d63a-0343-49c3-90b6-f91efe559841@linaro.org> (raw)
In-Reply-To: <20240504020745.68525-3-felix@kaechele.ca>
On 04/05/2024 04:04, Felix Kaechele wrote:
> Handle regulators used on this chip family, namely AVDD and VDD. These
> definitions are taken from the GPLv2 licensed vendor driver.
>
> Signed-off-by: Felix Kaechele <felix@kaechele.ca>
> Link: https://github.com/HimaxSoftware/HX83112_Android_Driver
> ---
> drivers/input/touchscreen/himax_hx83112b.c | 48 ++++++++++++++++++++--
> 1 file changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/touchscreen/himax_hx83112b.c b/drivers/input/touchscreen/himax_hx83112b.c
> index 4f6609dcdef3..0a797789e548 100644
> --- a/drivers/input/touchscreen/himax_hx83112b.c
> +++ b/drivers/input/touchscreen/himax_hx83112b.c
> @@ -19,10 +19,12 @@
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
>
> #define HIMAX_ID_83112B 0x83112b
>
> #define HIMAX_MAX_POINTS 10
> +#define HIMAX_MAX_SUPPLIES 2
>
> #define HIMAX_REG_CFG_SET_ADDR 0x00
> #define HIMAX_REG_CFG_INIT_READ 0x0c
> @@ -50,6 +52,7 @@ struct himax_event {
> static_assert(sizeof(struct himax_event) == 56);
>
> struct himax_ts_data {
> + struct regulator_bulk_data supplies[HIMAX_MAX_SUPPLIES];
> struct gpio_desc *gpiod_rst;
> struct input_dev *input_dev;
> struct i2c_client *client;
> @@ -63,6 +66,11 @@ static const struct regmap_config himax_regmap_config = {
> .val_format_endian = REGMAP_ENDIAN_LITTLE,
> };
>
> +static const char *const himax_supply_names[] = {
> + "avdd",
> + "vdd",
> +};
> +
That's confusing. Binding said only HX83100A family has regulators, but
you request for everyone.
> static int himax_read_config(struct himax_ts_data *ts, u32 address, u32 *dst)
> {
> int error;
> @@ -267,7 +275,7 @@ static irqreturn_t himax_irq_handler(int irq, void *dev_id)
>
> static int himax_probe(struct i2c_client *client)
> {
> - int error;
> + int error, i;
> struct device *dev = &client->dev;
> struct himax_ts_data *ts;
>
> @@ -290,11 +298,31 @@ static int himax_probe(struct i2c_client *client)
> return error;
> }
>
> + int num_supplies = ARRAY_SIZE(himax_supply_names);
> +
> + for (i = 0; i < num_supplies; i++)
> + ts->supplies[i].supply = himax_supply_names[i];
> +
> + error = devm_regulator_bulk_get(dev,
devm_regulator_bulk_get_enable and drop rest of the code here.
> + num_supplies,
> + ts->supplies);
Wrap it properly at 80, not one argument in one line.
> + if (error) {
> + dev_err(dev, "Failed to get supplies: %d\n", error);
return dev_err_probe()
> + return error;
> + }
> +
> + error = regulator_bulk_enable(num_supplies,
> + ts->supplies);
> + if (error) {
> + dev_err(dev, "Failed to enable supplies: %d\n", error);
> + goto error_out;
> + }
> +
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-05-04 12:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-04 2:04 [PATCH 0/6] input: himax_hx83112b: add support for HX83100A Felix Kaechele
2024-05-04 2:04 ` [PATCH 1/6] dt-bindings: input: touchscreen: himax,hx83112b: add HX83100A Felix Kaechele
2024-05-04 12:34 ` Krzysztof Kozlowski
2024-05-07 18:48 ` Rob Herring
2024-05-04 2:04 ` [PATCH 2/6] input: himax_hx83112b: add regulator handling Felix Kaechele
2024-05-04 12:37 ` Krzysztof Kozlowski [this message]
2024-05-07 14:33 ` Felix Kaechele
2024-05-04 2:04 ` [PATCH 3/6] input: himax_hx83112b: use more descriptive register defines Felix Kaechele
2024-05-04 2:04 ` [PATCH 4/6] input: himax_hx83112b: implement MCU register reading Felix Kaechele
2024-05-04 2:04 ` [PATCH 5/6] input: himax_hx83112b: add himax_chip struct for multi-chip support Felix Kaechele
2024-05-04 2:04 ` [PATCH 6/6] input: himax_hx83112b: add support for HX83100A Felix Kaechele
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=95f8d63a-0343-49c3-90b6-f91efe559841@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=felix@kaechele.ca \
--cc=job@noorman.info \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).