Skip to content

Commit f096737

Browse files
author
Bartosz Golaszewski
committed
Merge tag 'intel-gpio-v6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-next
intel-gpio for v6.4-2 * Fixed suspend issue on Clevo NL5xNU * Split a new Intel Tangier (library) driver for current and new platforms * Introduced a new driver for Intel Elkhart Lake PSE GPIO (see also above) * Contained a few fixes for the previous of_gpio.h cleanup * Miscellaneous cleanups here and there The following is an automated git shortlog grouped by driver: elkhartlake: - Introduce Intel Elkhart Lake PSE GPIO gpiolib: - acpi: Add a ignore wakeup quirk for Clevo NL5xNU - acpi: Move ACPI device NULL check to acpi_get_driver_gpio_data() - acpi: use the fwnode in acpi_gpiochip_find() ich: - Use devm_gpiochip_add_data() to simplify remove path merrifield: - Utilise temporary variable for struct device - Use dev_err_probe() - Adapt to Intel Tangier GPIO driver mips: - ar7: include linux/gpio/driver.h mm-lantiq: - Fix typo in the newly added header filename powerpc/40x: - Add missing select OF_GPIO_MM_GPIOCHIP sh: - mach-x3proto: Add missing #include <linux/gpio/driver.h> tangier: - Introduce Intel Tangier GPIO driver
2 parents 7b59bdb + 782eea0 commit f096737

13 files changed

Lines changed: 825 additions & 442 deletions

File tree

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10281,12 +10281,14 @@ M: Andy Shevchenko <andy@kernel.org>
1028110281
L: linux-gpio@vger.kernel.org
1028210282
S: Supported
1028310283
T: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
10284+
F: drivers/gpio/gpio-elkhartlake.c
1028410285
F: drivers/gpio/gpio-ich.c
1028510286
F: drivers/gpio/gpio-merrifield.c
1028610287
F: drivers/gpio/gpio-ml-ioh.c
1028710288
F: drivers/gpio/gpio-pch.c
1028810289
F: drivers/gpio/gpio-sch.c
1028910290
F: drivers/gpio/gpio-sodaville.c
10291+
F: drivers/gpio/gpio-tangier.c
1029010292

1029110293
INTEL GVT-g DRIVERS (Intel GPU Virtualization)
1029210294
M: Zhenyu Wang <zhenyuw@linux.intel.com>

arch/mips/ar7/gpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <linux/init.h>
99
#include <linux/export.h>
10-
#include <linux/gpio.h>
10+
#include <linux/gpio/driver.h>
1111

1212
#include <asm/mach-ar7/ar7.h>
1313

arch/powerpc/platforms/40x/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ config PPC4xx_GPIO
6565
bool "PPC4xx GPIO support"
6666
depends on 40x
6767
select GPIOLIB
68+
select OF_GPIO_MM_GPIOCHIP
6869
help
6970
Enable gpiolib support for ppc40x based boards
7071

arch/sh/boards/mach-x3proto/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/input.h>
1717
#include <linux/usb/r8a66597.h>
1818
#include <linux/usb/m66592.h>
19-
#include <linux/gpio.h>
19+
#include <linux/gpio/driver.h>
2020
#include <linux/gpio_keys.h>
2121
#include <mach/ilsel.h>
2222
#include <mach/hardware.h>

drivers/gpio/Kconfig

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,17 @@ config GPIO_SYSCON
623623
help
624624
Say yes here to support GPIO functionality though SYSCON driver.
625625

626+
config GPIO_TANGIER
627+
tristate
628+
select GPIOLIB_IRQCHIP
629+
help
630+
GPIO support for Intel Tangier and compatible platforms.
631+
Currently supported:
632+
- Elkhart Lake
633+
- Merrifield
634+
635+
If built as a module its name will be gpio-tangier.
636+
626637
config GPIO_TB10X
627638
bool
628639
select GPIO_GENERIC
@@ -1252,6 +1263,17 @@ config HTC_EGPIO
12521263
several HTC phones. It provides basic support for input
12531264
pins, output pins, and IRQs.
12541265

1266+
config GPIO_ELKHARTLAKE
1267+
tristate "Intel Elkhart Lake PSE GPIO support"
1268+
depends on X86 || COMPILE_TEST
1269+
select GPIO_TANGIER
1270+
help
1271+
Select this option to enable GPIO support for Intel Elkhart Lake
1272+
PSE GPIO IP.
1273+
1274+
To compile this driver as a module, choose M here: the module will
1275+
be called gpio-elkhartlake.
1276+
12551277
config GPIO_JANZ_TTL
12561278
tristate "Janz VMOD-TTL Digital IO Module"
12571279
depends on MFD_JANZ_CMODIO
@@ -1530,7 +1552,7 @@ config GPIO_BT8XX
15301552
config GPIO_MERRIFIELD
15311553
tristate "Intel Merrifield GPIO support"
15321554
depends on X86_INTEL_MID
1533-
select GPIOLIB_IRQCHIP
1555+
select GPIO_TANGIER
15341556
help
15351557
Say Y here to support Intel Merrifield GPIO.
15361558

drivers/gpio/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ obj-$(CONFIG_GPIO_DAVINCI) += gpio-davinci.o
5454
obj-$(CONFIG_GPIO_DLN2) += gpio-dln2.o
5555
obj-$(CONFIG_GPIO_DWAPB) += gpio-dwapb.o
5656
obj-$(CONFIG_GPIO_EIC_SPRD) += gpio-eic-sprd.o
57+
obj-$(CONFIG_GPIO_ELKHARTLAKE) += gpio-elkhartlake.o
5758
obj-$(CONFIG_GPIO_EM) += gpio-em.o
5859
obj-$(CONFIG_GPIO_EN7523) += gpio-en7523.o
5960
obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o
@@ -147,6 +148,7 @@ obj-$(CONFIG_GPIO_SPRD) += gpio-sprd.o
147148
obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
148149
obj-$(CONFIG_GPIO_STP_XWAY) += gpio-stp-xway.o
149150
obj-$(CONFIG_GPIO_SYSCON) += gpio-syscon.o
151+
obj-$(CONFIG_GPIO_TANGIER) += gpio-tangier.o
150152
obj-$(CONFIG_GPIO_TB10X) += gpio-tb10x.o
151153
obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o
152154
obj-$(CONFIG_GPIO_TEGRA186) += gpio-tegra186.o

drivers/gpio/gpio-elkhartlake.c

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Intel Elkhart Lake PSE GPIO driver
4+
*
5+
* Copyright (c) 2023 Intel Corporation.
6+
*
7+
* Authors: Pandith N <pandith.n@intel.com>
8+
* Raag Jadav <raag.jadav@intel.com>
9+
*/
10+
11+
#include <linux/device.h>
12+
#include <linux/err.h>
13+
#include <linux/module.h>
14+
#include <linux/platform_device.h>
15+
#include <linux/pm.h>
16+
17+
#include "gpio-tangier.h"
18+
19+
/* Each Intel EHL PSE GPIO Controller has 30 GPIO pins */
20+
#define EHL_PSE_NGPIO 30
21+
22+
static int ehl_gpio_probe(struct platform_device *pdev)
23+
{
24+
struct device *dev = &pdev->dev;
25+
struct tng_gpio *priv;
26+
int irq, ret;
27+
28+
irq = platform_get_irq(pdev, 0);
29+
if (irq < 0)
30+
return irq;
31+
32+
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
33+
if (!priv)
34+
return -ENOMEM;
35+
36+
priv->reg_base = devm_platform_ioremap_resource(pdev, 0);
37+
if (IS_ERR(priv->reg_base))
38+
return PTR_ERR(priv->reg_base);
39+
40+
priv->dev = dev;
41+
priv->irq = irq;
42+
43+
priv->info.base = -1;
44+
priv->info.ngpio = EHL_PSE_NGPIO;
45+
46+
priv->wake_regs.gwmr = GWMR_EHL;
47+
priv->wake_regs.gwsr = GWSR_EHL;
48+
priv->wake_regs.gsir = GSIR_EHL;
49+
50+
ret = devm_tng_gpio_probe(dev, priv);
51+
if (ret)
52+
return dev_err_probe(dev, ret, "tng_gpio_probe error\n");
53+
54+
platform_set_drvdata(pdev, priv);
55+
return 0;
56+
}
57+
58+
static int ehl_gpio_suspend(struct device *dev)
59+
{
60+
return tng_gpio_suspend(dev);
61+
}
62+
63+
static int ehl_gpio_resume(struct device *dev)
64+
{
65+
return tng_gpio_resume(dev);
66+
}
67+
68+
static DEFINE_SIMPLE_DEV_PM_OPS(ehl_gpio_pm_ops, ehl_gpio_suspend, ehl_gpio_resume);
69+
70+
static const struct platform_device_id ehl_gpio_ids[] = {
71+
{ "gpio-elkhartlake" },
72+
{ }
73+
};
74+
MODULE_DEVICE_TABLE(platform, ehl_gpio_ids);
75+
76+
static struct platform_driver ehl_gpio_driver = {
77+
.driver = {
78+
.name = "gpio-elkhartlake",
79+
.pm = pm_sleep_ptr(&ehl_gpio_pm_ops),
80+
},
81+
.probe = ehl_gpio_probe,
82+
.id_table = ehl_gpio_ids,
83+
};
84+
module_platform_driver(ehl_gpio_driver);
85+
86+
MODULE_AUTHOR("Pandith N <pandith.n@intel.com>");
87+
MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>");
88+
MODULE_DESCRIPTION("Intel Elkhart Lake PSE GPIO driver");
89+
MODULE_LICENSE("GPL");
90+
MODULE_IMPORT_NS(GPIO_TANGIER);

drivers/gpio/gpio-ich.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static int ichx_gpio_probe(struct platform_device *pdev)
457457

458458
init:
459459
ichx_gpiolib_setup(&ichx_priv.chip);
460-
err = gpiochip_add_data(&ichx_priv.chip, NULL);
460+
err = devm_gpiochip_add_data(dev, &ichx_priv.chip, NULL);
461461
if (err) {
462462
dev_err(dev, "Failed to register GPIOs\n");
463463
return err;
@@ -469,19 +469,11 @@ static int ichx_gpio_probe(struct platform_device *pdev)
469469
return 0;
470470
}
471471

472-
static int ichx_gpio_remove(struct platform_device *pdev)
473-
{
474-
gpiochip_remove(&ichx_priv.chip);
475-
476-
return 0;
477-
}
478-
479472
static struct platform_driver ichx_gpio_driver = {
480473
.driver = {
481474
.name = DRV_NAME,
482475
},
483476
.probe = ichx_gpio_probe,
484-
.remove = ichx_gpio_remove,
485477
};
486478

487479
module_platform_driver(ichx_gpio_driver);

0 commit comments

Comments
 (0)