From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andy@kernel.org>,
Dan Scally <dan.scally@ideasonboard.com>,
platform-driver-x86@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] platform/x86: int3472: discrete: Log a warning if the pin-numbers don't match
Date: Tue, 13 Jun 2023 11:10:22 +0300 (EEST) [thread overview]
Message-ID: <1b87ee9f-8de8-6923-111d-a9d889451d80@linux.intel.com> (raw)
In-Reply-To: <20230612141632.5232-2-hdegoede@redhat.com>
On Mon, 12 Jun 2023, Hans de Goede wrote:
> The INT3472 discrete code assumes that the ACPI GPIO resources are
> in the same order as the pin-info _DSM entries.
>
> The returned pin-info includes the pin-number in bits 15-8. Add a check
> that this matches with the ACPI GPIO resource pin-number in case
> the assumption is not true with some ACPI tables.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/platform/x86/intel/int3472/discrete.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
> index 4ef60883154d..c1132bbbff41 100644
> --- a/drivers/platform/x86/intel/int3472/discrete.c
> +++ b/drivers/platform/x86/intel/int3472/discrete.c
> @@ -149,8 +149,8 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
> {
> struct int3472_discrete_device *int3472 = data;
> struct acpi_resource_gpio *agpio;
> + u8 active_value, pin, type;
> union acpi_object *obj;
> - u8 active_value, type;
> const char *err_msg;
> const char *func;
> u32 polarity;
> @@ -174,10 +174,18 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
> return 1;
> }
>
> + /* Bits 7-0 contain the type/function of the pin */
> type = obj->integer.value & 0xff;
>
> int3472_get_func_and_polarity(type, &func, &polarity);
>
> + /* Bits 15-8 contain the pin-number on the GPIO chip */
> + pin = (obj->integer.value >> 8) & 0xff;
> + if (pin != agpio->pin_table[0])
> + dev_warn(int3472->dev, "%s %s pin number mismatch _DSM %d resource %d\n",
> + func, agpio->resource_source.string_ptr, pin,
> + agpio->pin_table[0]);
> +
> /* If bits 31-24 of the _DSM entry are all 0 then the signal is inverted */
> active_value = (obj->integer.value >> 24) & 0xff;
> if (!active_value)
>
These changes made me wonder why there aren't defines for the fields?
And then FIELD_GET() used to read the field. Most of those comments
would be documented by the define name itself.
--
i.
next prev parent reply other threads:[~2023-06-13 8:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 14:16 [PATCH 1/2] platform/x86: int3472: discrete: Fix getting active_value Hans de Goede
2023-06-12 14:16 ` [PATCH 2/2] platform/x86: int3472: discrete: Log a warning if the pin-numbers don't match Hans de Goede
2023-06-12 14:20 ` Andy Shevchenko
2023-06-12 14:20 ` Dan Scally
2023-06-12 15:26 ` Hans de Goede
2023-06-12 15:30 ` Dan Scally
2023-06-12 15:36 ` Hans de Goede
2023-06-13 8:10 ` Ilpo Järvinen [this message]
2023-06-13 11:02 ` Hans de Goede
2023-06-12 14:18 ` [PATCH 1/2] platform/x86: int3472: discrete: Fix getting active_value Andy Shevchenko
2023-06-12 15:25 ` Hans de Goede
-- strict thread matches above, loose matches on Subject: below --
2023-06-13 11:08 [PATCH 1/2] platform/x86: int3472: discrete: Use FIELD_GET() on the GPIO _DSM return value Hans de Goede
2023-06-13 11:08 ` [PATCH 2/2] platform/x86: int3472: discrete: Log a warning if the pin-numbers don't match Hans de Goede
2023-06-13 11:17 ` Ilpo Järvinen
2023-06-15 12: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=1b87ee9f-8de8-6923-111d-a9d889451d80@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andy@kernel.org \
--cc=dan.scally@ideasonboard.com \
--cc=hdegoede@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=platform-driver-x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox