Message ID | 20210816115953.72533-1-andriy.shevchenko@linux.intel.com |
---|---|
Headers | show |
Series | gpio: mlxbf2: Introduce proper interrupt handling | expand |
On Mon, Aug 16, 2021 at 3:01 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > This is just a WIP / TODO series based on the discussion [1]. > I hope nVidia will finish it and fix the initial problem sooner than later. > > Bart, Linus, First 4 patches may be directly applied to the tree (they are > at least compile-tested, but I believe they won't change any functionality. > > Patch 5 is some stubs that should have been done in the driver. > Patch 6 is follow up removal of custom GPIO IRQ handling from > Mellanox GBE driver. Both of them are quite far from finishing, > but it's a start for nVidia to develop and test proper solution. > > In any case, I will probably sent end this week the ACPI IRQ abuse > part from the GBE driver (I won't touch OF path). > > ARs for nVidia: > 0) review this series; > 1) properly develop GPIO driver; > 2) replace custom code with correct one; > 3) send the work for review to GPIO and ACPI maintainers (basically list > of this series). > > On my side I will help you if you have any questions regarding to GPIO > and ACPI. Missed link [1]: https://x-lore.kernel.org/linux-acpi/YRUskkALrPLa2cSf@smile.fi.intel.com/T/#u > Andy Shevchenko (6): > gpio: mlxbf2: Convert to device PM ops > gpio: mlxbf2: Drop wrong use of ACPI_PTR() > gpio: mlxbf2: Use devm_platform_ioremap_resource() > gpio: mlxbf2: Use DEFINE_RES_MEM_NAMED() helper macro > TODO: gpio: mlxbf2: Introduce IRQ support > TODO: net: mellanox: mlxbf_gige: Replace non-standard interrupt > handling > > drivers/gpio/gpio-mlxbf2.c | 151 ++++++++++--- > .../mellanox/mlxbf_gige/mlxbf_gige_gpio.c | 212 ------------------ > 2 files changed, 120 insertions(+), 243 deletions(-) > delete mode 100644 drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_gpio.c > > -- > 2.30.2 >
Acked-by: Asmaa Mnebhi <asmaa@nvidia.com> -----Original Message----- From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Sent: Monday, August 16, 2021 8:00 AM To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>; David Thompson <davthompson@nvidia.com>; linux-kernel@vger.kernel.org; linux-gpio@vger.kernel.org; netdev@vger.kernel.org; linux-acpi@vger.kernel.org Cc: Linus Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski <bgolaszewski@baylibre.com>; David S. Miller <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Rafael J. Wysocki <rjw@rjwysocki.net>; Asmaa Mnebhi <asmaa@nvidia.com>; Liming Sun <limings@nvidia.com> Subject: [PATCH v1 1/6] gpio: mlxbf2: Convert to device PM ops Importance: High Convert driver to use modern device PM ops interface. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/gpio/gpio-mlxbf2.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c index befa5e109943..68c471c10fa4 100644 --- a/drivers/gpio/gpio-mlxbf2.c +++ b/drivers/gpio/gpio-mlxbf2.c @@ -47,12 +47,10 @@ #define YU_GPIO_MODE0_SET 0x54 #define YU_GPIO_MODE0_CLEAR 0x58 -#ifdef CONFIG_PM struct mlxbf2_gpio_context_save_regs { u32 gpio_mode0; u32 gpio_mode1; }; -#endif /* BlueField-2 gpio block context structure. */ struct mlxbf2_gpio_context { @@ -61,9 +59,7 @@ struct mlxbf2_gpio_context { /* YU GPIO blocks address */ void __iomem *gpio_io; -#ifdef CONFIG_PM struct mlxbf2_gpio_context_save_regs *csave_regs; -#endif }; /* BlueField-2 gpio shared structure. */ @@ -284,11 +280,9 @@ mlxbf2_gpio_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM -static int mlxbf2_gpio_suspend(struct platform_device *pdev, - pm_message_t state) +static int __maybe_unused mlxbf2_gpio_suspend(struct device *dev) { - struct mlxbf2_gpio_context *gs = platform_get_drvdata(pdev); + struct mlxbf2_gpio_context *gs = dev_get_drvdata(dev); gs->csave_regs->gpio_mode0 = readl(gs->gpio_io + YU_GPIO_MODE0); @@ -298,9 +292,9 @@ static int mlxbf2_gpio_suspend(struct platform_device *pdev, return 0; } -static int mlxbf2_gpio_resume(struct platform_device *pdev) +static int __maybe_unused mlxbf2_gpio_resume(struct device *dev) { - struct mlxbf2_gpio_context *gs = platform_get_drvdata(pdev); + struct mlxbf2_gpio_context *gs = dev_get_drvdata(dev); writel(gs->csave_regs->gpio_mode0, gs->gpio_io + YU_GPIO_MODE0); @@ -309,7 +303,7 @@ static int mlxbf2_gpio_resume(struct platform_device *pdev) return 0; } -#endif +static SIMPLE_DEV_PM_OPS(mlxbf2_pm_ops, mlxbf2_gpio_suspend, +mlxbf2_gpio_resume); static const struct acpi_device_id __maybe_unused mlxbf2_gpio_acpi_match[] = { { "MLNXBF22", 0 }, @@ -321,12 +315,9 @@ static struct platform_driver mlxbf2_gpio_driver = { .driver = { .name = "mlxbf2_gpio", .acpi_match_table = ACPI_PTR(mlxbf2_gpio_acpi_match), + .pm = &mlxbf2_pm_ops, }, .probe = mlxbf2_gpio_probe, -#ifdef CONFIG_PM - .suspend = mlxbf2_gpio_suspend, - .resume = mlxbf2_gpio_resume, -#endif }; module_platform_driver(mlxbf2_gpio_driver); -- 2.30.2
On Mon, Aug 16, 2021 at 2:00 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > This is just a WIP / TODO series based on the discussion [1]. > I hope nVidia will finish it and fix the initial problem sooner than later. > > Bart, Linus, First 4 patches may be directly applied to the tree (they are > at least compile-tested, but I believe they won't change any functionality. > > Patch 5 is some stubs that should have been done in the driver. > Patch 6 is follow up removal of custom GPIO IRQ handling from > Mellanox GBE driver. Both of them are quite far from finishing, > but it's a start for nVidia to develop and test proper solution. > > In any case, I will probably sent end this week the ACPI IRQ abuse > part from the GBE driver (I won't touch OF path). > > ARs for nVidia: > 0) review this series; > 1) properly develop GPIO driver; > 2) replace custom code with correct one; > 3) send the work for review to GPIO and ACPI maintainers (basically list > of this series). > > On my side I will help you if you have any questions regarding to GPIO > and ACPI. > > Andy Shevchenko (6): > gpio: mlxbf2: Convert to device PM ops > gpio: mlxbf2: Drop wrong use of ACPI_PTR() > gpio: mlxbf2: Use devm_platform_ioremap_resource() > gpio: mlxbf2: Use DEFINE_RES_MEM_NAMED() helper macro > TODO: gpio: mlxbf2: Introduce IRQ support > TODO: net: mellanox: mlxbf_gige: Replace non-standard interrupt > handling > > drivers/gpio/gpio-mlxbf2.c | 151 ++++++++++--- > .../mellanox/mlxbf_gige/mlxbf_gige_gpio.c | 212 ------------------ > 2 files changed, 120 insertions(+), 243 deletions(-) > delete mode 100644 drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_gpio.c > > -- > 2.30.2 > Applied first four patches. Bart