All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Daniel Dadap <ddadap@nvidia.com>
Cc: platform-driver-x86@vger.kernel.org, andy.shevchenko@gmail.com,
	hdegoede@redhat.com, mario.limonciello@outlook.com,
	pobrn@protonmail.com, dvhart@infradead.org,
	Aaron Plattner <aplattner@nvidia.com>
Subject: Re: [PATCH v4] platform/x86: Add driver for ACPI WMAA EC-based backlight control
Date: Thu, 2 Sep 2021 12:19:41 +0200	[thread overview]
Message-ID: <cac5ceb8-86d3-4f67-bbac-fbaf191d5973@t-8ch.de> (raw)
In-Reply-To: <ce05cf8a-9b1f-e3a5-33bb-4f997bc2bcec@nvidia.com>

On Mi, 2021-09-01T21:12-0500, Daniel Dadap wrote:
> Thanks, Thomas:
> 
> On 9/1/21 4:25 AM, Thomas Weißschuh wrote:
> > Hi Daniel,
> > 
> > a few minor comments, not sure if they should be reason for a reroll.
> 
> 
> I don't mind rerolling until I get an ACK from the maintainer. :)
> 
> 
> > 
> > Thomas
> > 
> > Reviewed-By: Thomas Weißschuh <linux@weissschuh.net>
> > 
> > On Di, 2021-08-31T17:49-0500, Daniel Dadap wrote:
> > > v2: Convert to WMI subsystem driver, suggested by Mario Limonciello
> > >       <mario.limonciello@outlook.com>; various cleanups suggested by
> > >       Barnab??s P??cze <pobrn@protonmail.com>
> > > v3: Address assorted style nits raised by Andy Shevchenko
> > >       <andy.shevchenko@gmail.com> in response to a related patch; remove
> > >       additional behavior change to WMI subsystem from patch series as
> > >       recommended by Hans de Goede <hdegoede@redhat.com>
> > > v4: Use MODULE_DEVICE_TABLE() (Thomas Wei??schuh <thomas@t-8ch.de>)
> > >      Fix scope of internal driver state; various style fixes (Barnab??s
> > >      P??cze, Andy Shevchenko)
> > >      Use devm_backlight_device_register() (Barnab??s P??cze)
> > >      Add kerneldoc comments for enums and structs (Andy Shevchenko)
> > It seems your Mailsetup breaks Unicode.
> 
> 
> Strange. I've just been sending the patches via git email-patch. These
> characters are appearing correctly with my MUA (Thunderbird) in the copy of
> the message I received, so I don't know where in the pipeline they're
> getting corrupted. I'll ignore this problem unless anybody has some specific
> tips on fixing it, since the non-ASCII characters aren't going to actually
> be part of the git history of the patch.

It seems that the encoding of the mail has been set as plain ASCII while it is
actually UTF-8.
Thunderbird is probly correctly inferring the actual encoding.
Normally git-format-patch would detect the Unicode characters and add a
matching content-type header to the patch.
But as these Unicode characters are added after format-patch has run it is now
git-send-emails task to add those headers again.

In my version of git I get the following message from git-send-email:

  The following files are 8bit, but do not declare a Content-Transfer-Encoding.
      0001-....patch
  Which 8bit encoding should I declare [UTF-8]?

As this feature seems to be really old already it should be available.
Is your "git email-patch" using "git send-email"?
Do you have "sendemail.assume8bitEncoding" set in your git config?
(It should either not be set or to UTF-8.

> > > diff --git a/drivers/platform/x86/wmaa-backlight-wmi.c b/drivers/platform/x86/wmaa-backlight-wmi.c
> > > new file mode 100644
> > > index 000000000000..cb1a973803b1
> > > --- /dev/null
> > > +++ b/drivers/platform/x86/wmaa-backlight-wmi.c
> > > @@ -0,0 +1,185 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +/*
> > > + * Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.
> > Also 2021?
> 
> 
> The code was originally written in 2020. I'm not certain it's changed
> substantially enough to warrant updating the copyright date. Certainly
> there's no need to change the copyright date every time the file is touched.
> I suppose it wouldn't be wrong to have it read 2020-2021 or the like for the
> initial commit, but I personally prefer just having the initial date unless
> there's stronger guidance to do otherwise.

Ok.

> > 
> > > + */
> > > +
> > > +#include <linux/backlight.h>
> > > +#include <linux/module.h>
> > > +#include <linux/wmi.h>
> > > +
> > > +/**
> > > + * enum wmaa_method - WMI method IDs for ACPI WMAA
> > > + *
> > > + * @WMAA_LEVEL:  Get or set the brightness level,
> > > + *               or get the maximum brightness level.
> > > + * @WMAA_SOURCE: Get the source for backlight control.
> > > + */
> > > +enum wmaa_method {
> > > +	WMAA_LEVEL = 1,
> > > +	WMAA_SOURCE = 2,
> > > +};
> > Nitpick: No need for explicit values here.
> 
> 
> I think at least the 1 is required, but in any case I prefer to be explicit
> here to make it clear that these are the exact values required by the ACPI
> WMAA interface.

As this enum is part of the ABI to the firmware, the values should indeed have
explicit values.  Sorry for the noise.

> > > +
> > > +	if (ret)
> > > +		dev_err(&bd->dev, "ACPI WMAA failed to get backlight level.\n");
> > Would it make sense to log the actual error?
> 
> 
> I think the underlying ACPI error is already logged by wmi_call_wmaa().

Good point, disregard that comment then.

> > Also while the backlight core does not seem to actually handle it, other
> > drivers return a negative errno on failure.
> 
> 
> Thanks, I was aware that the backlight core doesn't seem to handle errors at
> all for .get_brightness, but I didn't think to check for precedent on
> backlight drivers returning error codes anyway. Returning negative errno
> does seem somewhat common amongst backlight drivers, so I'll go ahead and do
> that in case the backlight core is updated to handle them in the future.

FYI I plan on sending a patch that adds the missing errorhandling next week.

> > > +	props.type = BACKLIGHT_PLATFORM;
> > Is this WMI method a standard interface?
> > If so, BACKLIGHT_FIRMWARE might actually fit better and still fulfill the
> > requirements.
> > The actual maintainers would know better than me, though.
> 
> 
> I'm not certain what you mean by standard. It's defined as part of system
> design guidelines that NVIDIA shares with OEMs, but I'm not sure if it's
> part of the ACPI spec. It is implemented by multiple notebook system
> vendors, hence naming the driver after the ACPI method rather than a
> particular vendor. Reading the documentation on the backlight driver types,
> it does seem that this may fall more under the purview of BACKLIGHT_FIRMWARE
> than BACKLIGHT_PLATFORM. I'll go ahead and retest with the driver registered
> as BACKLIGHT_FIRMWARE, but I'm sure it'll still work after inspecting the
> code for at least gnome-settings-daemon, which implements the policy
> recommended by Documentation/ABI/stable/sysfs-class-backlight.

I only went by the comment about "standard firmware interface" from
backlight.h.
This was mostly a pointer for you (and the pdx86 maintainers) to take a look
and decide.

Thomas

  reply	other threads:[~2021-09-02 10:19 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM6PR19MB2636AB267CD321DE40EF324AFA730@DM6PR19MB2636.namprd19.prod.outlook.com>
     [not found] ` <20200731202154.11382-1-ddadap@nvidia.com>
     [not found]   ` <20200731202154.11382-2-ddadap@nvidia.com>
2020-11-10  9:34     ` [PATCH v2 2/2] platform/x86: wmi: fail wmi_driver_register when no GUID is found Hans de Goede
2020-11-12 18:54       ` Daniel Dadap
2021-08-24 22:04       ` [PATCH v3] platform/x86: Add driver for ACPI WMAA EC-based backlight control Daniel Dadap
2021-08-24 22:47         ` Barnabás Pőcze
2021-08-25 16:36           ` Daniel Dadap
2021-08-25 22:26           ` Daniel Dadap
2021-08-27 16:47             ` Daniel Dadap
2021-08-27 17:12               ` Daniel Dadap
2021-08-25  9:05         ` Andy Shevchenko
2021-08-25 16:47           ` Daniel Dadap
2021-08-25 22:06             ` Thomas Weißschuh
2021-08-25 22:28               ` Daniel Dadap
2021-08-26 13:35             ` Andy Shevchenko
2021-08-26 15:39               ` Daniel Dadap
2021-08-31 22:49                 ` [PATCH v4] " Daniel Dadap
2021-09-01  9:25                   ` Thomas Weißschuh
2021-09-02  2:12                     ` Daniel Dadap
2021-09-02 10:19                       ` Thomas Weißschuh [this message]
2021-09-02 20:15                         ` Daniel Dadap
2021-09-02 20:31                           ` Hans de Goede
2021-09-02 21:47                             ` [PATCH v5] " Daniel Dadap
2021-09-02 23:20                               ` Thomas Weißschuh
2021-09-03  0:22                                 ` Daniel Dadap
2021-09-03  8:14                                   ` Andy Shevchenko
2021-09-03 17:55                                     ` Daniel Dadap
2021-09-03  0:38                                 ` [PATCH v6] " Daniel Dadap
2021-09-13  9:01                                   ` Hans de Goede
2021-09-20 13:29                                     ` Pali Rohár
2021-09-20 13:33                                       ` Hans de Goede
2021-09-20 13:51                                         ` Pali Rohár
2021-09-20 17:34                                           ` Daniel Dadap
2021-09-20 17:55                                             ` Pali Rohár
2021-09-20 19:38                                               ` Daniel Dadap
2021-09-20 19:52                                                 ` Pali Rohár
2021-09-21 13:53                                           ` Hans de Goede
2021-09-21 14:02                                             ` Pali Rohár
2021-09-21 14:29                                             ` Daniel Dadap
2021-09-21 14:58                                               ` Hans de Goede
2021-09-27 20:23                                                 ` [PATCH 1/2] platform/x86: Remove "WMAA" from identifier names in wmaa-backlight-wmi.c Daniel Dadap
2021-09-27 20:23                                                   ` [PATCH 2/2] platform/x86: Rename wmaa-backlight-wmi to nvidia-wmi-ec-backlight Daniel Dadap
2021-10-11 13:00                                                   ` [PATCH 1/2] platform/x86: Remove "WMAA" from identifier names in wmaa-backlight-wmi.c Hans de Goede
2021-09-27 22:52                                                 ` [PATCH v6] platform/x86: Add driver for ACPI WMAA EC-based backlight control Daniel Dadap
2021-09-02  9:28                     ` [PATCH v4] " Andy Shevchenko
2021-09-02  9:33                       ` Thomas Weißschuh
2021-09-02  9:36                         ` Andy Shevchenko
2021-09-01 15:57                   ` Andy Shevchenko
2021-09-01 23:12                     ` Aaron Plattner
2021-09-02  2:37                     ` Daniel Dadap
2021-09-02  9:35                       ` Andy Shevchenko
2021-09-02 20:15                         ` Daniel Dadap
2021-09-03  8:10                           ` Andy Shevchenko
2021-09-02 15:38                   ` Hans de Goede

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=cac5ceb8-86d3-4f67-bbac-fbaf191d5973@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=andy.shevchenko@gmail.com \
    --cc=aplattner@nvidia.com \
    --cc=ddadap@nvidia.com \
    --cc=dvhart@infradead.org \
    --cc=hdegoede@redhat.com \
    --cc=mario.limonciello@outlook.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    /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.