Linux Power Management development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Pavel Machek" <pavel@kernel.org>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Ion Agorria" <ion@agorria.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Florian Krischer" <florian.krischer@fkr.dev>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org, mfd@lists.linux.dev,
	linux-leds@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v12 2/7] mfd: Add driver for ASUS Transformer embedded controller
Date: Wed, 4 Nov 2026 08:29:51 +0000	[thread overview]
Message-ID: <20261104082951.GE792264@google.com> (raw)
In-Reply-To: <CAPVz0n0kKRpOsUNxvUKiTPSY7bF3h+ruV05B+9jSvs9NOxthkg@mail.gmail.com>

On Tue, 03 Nov 2026, Svyatoslav Ryhel wrote:

> вт, 3 лист. 2026 р. о 13:43 Lee Jones <lee@kernel.org> пише:
> >
> > --- checkpatch.pl (4 issues) ---
> > Line 607: WARNING: DT compatible string "asus,sl101-ec-dock" appears un-documented -- check ./Documentation/devicetree/bindings/
> > Line 610: WARNING: DT compatible string "asus,tf101-ec-dock" appears un-documented -- check ./Documentation/devicetree/bindings/
> > Line 613: WARNING: DT compatible string "asus,tf201-ec-pad" appears un-documented -- check ./Documentation/devicetree/bindings/
> > Line 616: WARNING: DT compatible string "asus,tf600t-ec-pad" appears un-documented -- check ./Documentation/devicetree/bindings/
> > ----------------------------------
> >
> > On Mon, 19 Oct 2026, Svyatoslav Ryhel wrote:
> > > From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> > >
> > > Support Nuvoton NPCE795-based ECs as used in Asus Transformer TF201,
> > > TF300T, TF300TG, TF300TL and TF700T pad and dock, as well as TF101 dock
> > > and TF600T, P1801-T and TF701T pad. This is a glue driver handling
> > > detection and common operations for EC's functions.
> > >
> > > Co-developed-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > ---
> > >  drivers/mfd/Kconfig                     |  16 +
> > >  drivers/mfd/Makefile                    |   1 +
> > >  drivers/mfd/asus-transformer-ec.c       | 569 ++++++++++++++++++++++++
> > >  include/linux/mfd/asus-transformer-ec.h | 100 +++++
> > >  4 files changed, 686 insertions(+)
> > >  create mode 100644 drivers/mfd/asus-transformer-ec.c
> > >  create mode 100644 include/linux/mfd/asus-transformer-ec.h
> >
> > [...]
> >
> > > +static int asus_ec_reset(struct asus_ec_data *ddata)
> > > +{
> > > +     int retry, ret;
> > > +
> > > +     guard(mutex)(&ddata->ecreq_lock);
> > > +
> > > +     for (retry = 0; retry < ASUSEC_RETRY_MAX; retry++) {
> >
> > As mentioned on v8, 'for (int retry = 0; ...)' is generally preferred for
> > throw-away loop variables.
> >
> 
> I must have overlooked this, appologies.
> 
> > > +             ret = i2c_smbus_write_word_data(ddata->client, ASUSEC_WRITE_BUF,
> > > +                                             ASUSEC_RESET);
> > > +             if (!ret)
> > > +                     return 0;
> > > +
> > > +             msleep(ASUSEC_ACCESS_TIMEOUT);
> > > +     }
> > > +
> > > +     return ret;
> > > +}
> >
> > [...]
> >
> > > +static int asus_ec_probe(struct i2c_client *client)
> > > +{
> > > +     struct device *dev = &client->dev;
> > > +     struct asus_ec_data *ddata;
> > > +     const struct mfd_cell *cells;
> > > +     unsigned int num_cells;
> > > +     unsigned long irqflags;
> > > +     int ret;
> > > +
> > > +     if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
> > > +             return dev_err_probe(dev, -ENXIO,
> > > +                     "I2C bus is missing required SMBus block mode support\n");
> > > +
> > > +     ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
> > > +     if (!ddata)
> > > +             return -ENOMEM;
> > > +
> > > +     ddata->info = device_get_match_data(dev);
> > > +     if (!ddata->info)
> > > +             return -ENODEV;
> > > +
> > > +     switch (ddata->info->variant) {
> > > +     case ASUSEC_SL101_DOCK:
> > > +             cells = asus_ec_sl101_dock_mfd_devices;
> > > +             num_cells = ARRAY_SIZE(asus_ec_sl101_dock_mfd_devices);
> > > +             break;
> > > +     case ASUSEC_TF101_DOCK:
> > > +             cells = asus_ec_tf101_dock_mfd_devices;
> > > +             num_cells = ARRAY_SIZE(asus_ec_tf101_dock_mfd_devices);
> > > +             break;
> > > +     case ASUSEC_TF201_PAD:
> > > +             cells = asus_ec_tf201_pad_mfd_devices;
> > > +             num_cells = ARRAY_SIZE(asus_ec_tf201_pad_mfd_devices);
> > > +             break;
> > > +     case ASUSEC_TF600T_PAD:
> > > +             cells = asus_ec_tf600t_pad_mfd_devices;
> > > +             num_cells = ARRAY_SIZE(asus_ec_tf600t_pad_mfd_devices);
> > > +             break;
> > > +     default:
> > > +             return dev_err_probe(dev, -EINVAL,
> > > +                                  "unknown device variant %d\n",
> > > +                                  ddata->info->variant);
> > > +     }
> > > +
> > > +     i2c_set_clientdata(client, ddata);
> > > +     ddata->client = client;
> > > +
> > > +     ddata->ec.dockram = devm_asus_dockram_get(dev);
> > > +     if (IS_ERR(ddata->ec.dockram))
> > > +             return dev_err_probe(dev, PTR_ERR(ddata->ec.dockram),
> > > +                                  "failed to get dockram\n");
> > > +
> > > +     ddata->ecreq_gpio = devm_gpiod_get(dev, "request", GPIOD_OUT_LOW);
> > > +     if (IS_ERR(ddata->ecreq_gpio))
> > > +             return dev_err_probe(dev, PTR_ERR(ddata->ecreq_gpio),
> > > +                                  "failed to get EC request GPIO\n");
> > > +
> > > +     BLOCKING_INIT_NOTIFIER_HEAD(&ddata->ec.notify_list);
> > > +     mutex_init(&ddata->ecreq_lock);
> > > +
> > > +     asus_ec_signal_request(ddata);
> > > +
> > > +     ret = asus_ec_detect(ddata);
> > > +     if (ret)
> > > +             return dev_err_probe(dev, ret, "failed to detect EC version\n");
> > > +
> > > +     ret = asus_ec_init(ddata);
> > > +     if (ret)
> > > +             return dev_err_probe(dev, ret, "failed to init EC\n");
> > > +
> > > +     /*
> > > +      * Systems using device tree should set up interrupt via DTS,
> > > +      * the rest will use the default low interrupt.
> > > +      */
> > > +     irqflags = dev->of_node ? 0 : IRQF_TRIGGER_LOW;
> > > +
> > > +     ret = devm_request_threaded_irq(dev, client->irq, NULL,
> > > +                                     &asus_ec_interrupt,
> > > +                                     IRQF_ONESHOT | irqflags,
> > > +                                     client->name, ddata);
> > > +     if (ret)
> > > +             return dev_err_probe(dev, ret, "failed to register IRQ\n");
> > > +
> > > +     /* Parent I2C controller uses DMA, ASUS EC and child devices do not */
> > > +     client->dev.coherent_dma_mask = 0;
> > > +     client->dev.dma_mask = &client->dev.coherent_dma_mask;
> > > +
> > > +     return devm_mfd_add_devices(dev, 0, cells, num_cells, NULL, 0, NULL);
> >
> > Why not use 'PLATFORM_DEVID_NONE' or 'PLATFORM_DEVID_AUTO' here instead of a raw
> > '0' and hard-coded cell IDs in 'asus_ec_tf101_dock_mfd_devices'?
> >
> 
> There can be more then 1 EC in the tablet. PLATFORM_DEVID_NONE will
> not work in this case and PLATFORM_DEVID_AUTO should work, but one of
> EC is detachable (dock one) so devices there may need a fixed id. I
> can test if PLATFORM_DEVID_AUTO works, but may this be sent as a
> followup?

Sure.

-- 
Lee Jones

  reply	other threads:[~2026-11-04  8:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 10:03 [PATCH v12 0/7] mfd: Add support for Asus Transformer embedded controller Svyatoslav Ryhel
2026-10-19 10:04 ` [PATCH v12 1/7] dt-bindings: embedded-controller: document ASUS Transformer EC Svyatoslav Ryhel
2026-10-19 10:04 ` [PATCH v12 2/7] mfd: Add driver for ASUS Transformer embedded controller Svyatoslav Ryhel
2026-11-03 11:43   ` Lee Jones
2026-11-03 11:54     ` Svyatoslav Ryhel
2026-11-04  8:29       ` Lee Jones [this message]
2026-10-19 10:04 ` [PATCH v12 3/7] input: serio: Add driver for ASUS Transformer dock keyboard and touchpad Svyatoslav Ryhel
2026-10-20 12:37   ` Svyatoslav Ryhel
2026-10-20 19:04   ` Dmitry Torokhov
2026-10-21  6:46     ` Svyatoslav Ryhel
2026-10-19 10:04 ` [PATCH v12 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys Svyatoslav Ryhel
2026-10-20 18:54   ` Dmitry Torokhov
2026-10-19 10:04 ` [PATCH v12 5/7] leds: Add driver for ASUS Transformer LEDs Svyatoslav Ryhel
2026-11-03 14:03   ` Lee Jones
2026-11-03 14:47     ` Svyatoslav Ryhel
2026-11-04  8:28       ` Lee Jones
2026-11-04  9:19         ` Svyatoslav Ryhel
2026-11-04 11:02           ` Lee Jones
2026-10-19 10:04 ` [PATCH v12 6/7] power: supply: Add driver for ASUS Transformer battery Svyatoslav Ryhel
2026-10-20 13:55   ` Markus Elfring
2026-10-19 10:04 ` [PATCH v12 7/7] power: supply: Add charger driver for Asus Transformers Svyatoslav Ryhel
2026-10-20  0:57 ` [PATCH v12 0/7] mfd: Add support for Asus Transformer embedded controller Florian Krischer
2026-10-20  7:27   ` Svyatoslav Ryhel
2026-10-21  6:31 ` Svyatoslav Ryhel

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=20261104082951.GE792264@google.com \
    --to=lee@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=florian.krischer@fkr.dev \
    --cc=ion@agorria.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=pavel@kernel.org \
    --cc=robh@kernel.org \
    --cc=sre@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