[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McwkKNUt4JZWcUVyd9uiAwJBk7SPw1C3X_F0RH_Qa=row@mail.gmail.com>
Date: Fri, 3 Dec 2021 11:15:46 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Richard Hsu <saraon640529@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Richard_Hsu@...edia.com.tw,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Yd_Tseng@...edia.com.tw, Cindy1_Hsu@...edia.com.tw,
Andrew_Su@...edia.com.tw,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH] gpio Add my driver new id
On Fri, Dec 3, 2021 at 10:26 AM Richard Hsu <saraon640529@...il.com> wrote:
>
> drivers/gpio/gpio-amdpt.c | 12 ++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-amdpt.c b/drivers/gpio/gpio-amdpt.c
> index bbf53e289141..4d01d4341a67 100644
> --- a/drivers/gpio/gpio-amdpt.c
> +++ b/drivers/gpio/gpio-amdpt.c
> @@ -14,6 +14,7 @@
> #include <linux/platform_device.h>
>
> #define PT_TOTAL_GPIO 8
> +#define PT_TOTAL_GPIO_EX 24
>
> /* PCI-E MMIO register offsets */
> #define PT_DIRECTION_REG 0x00
> @@ -72,10 +73,12 @@ static void pt_gpio_free(struct gpio_chip *gc, unsigned offset)
> static int pt_gpio_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> + struct acpi_device *acpi_dev;
> + acpi_handle handle = ACPI_HANDLE(dev);
> struct pt_gpio_chip *pt_gpio;
> int ret = 0;
>
> - if (!ACPI_COMPANION(dev)) {
> + if (acpi_bus_get_device(handle, &acpi_dev)) {
> dev_err(dev, "PT GPIO device node not found\n");
> return -ENODEV;
> }
> @@ -100,10 +103,14 @@ static int pt_gpio_probe(struct platform_device *pdev)
> return ret;
> }
>
> + if (!strncmp(acpi_dev_name(acpi_dev), "AMDIF031", 8))
> + pt_gpio->gc.ngpio = PT_TOTAL_GPIO_EX;
> + else
> + pt_gpio->gc.ngpio = PT_TOTAL_GPIO;
> +
> pt_gpio->gc.owner = THIS_MODULE;
> pt_gpio->gc.request = pt_gpio_request;
> pt_gpio->gc.free = pt_gpio_free;
> - pt_gpio->gc.ngpio = PT_TOTAL_GPIO;
> #if defined(CONFIG_OF_GPIO)
> pt_gpio->gc.of_node = dev->of_node;
> #endif
> @@ -135,6 +142,7 @@ static int pt_gpio_remove(struct platform_device *pdev)
> static const struct acpi_device_id pt_gpio_acpi_match[] = {
> { "AMDF030", 0 },
> { "AMDIF030", 0 },
> + { "AMDIF031", 0 },
> { },
> };
> MODULE_DEVICE_TABLE(acpi, pt_gpio_acpi_match);
> --
> 2.30.2
>
Hi Richard,
Please Cc Andy next time on any GPIO stuff related to ACPI. I'll let
him comment on the code. Your commit message must be more descriptive
- the title should say "gpio: <driver name>: <do this and that>".
Please also add a commit message explaining what the code does in
detail.
Bart
Powered by blists - more mailing lists