Skip to content

Commit b100274

Browse files
committed
Merge tag 'pinctrl-v5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "There is an ACPI stubs fix which is ACKed by the ACPI maintainer for merging through my tree. One item stand out and that is that I delete the <linux/sdb.h> header that is used by nothing. I deleted this subsystem (through the GPIO tree) a while back so I feel responsible for tidying up the floor. Other than that it is the usual mistakes, a bit noisy around build issue and Kconfig then driver fixes. Specifics: - Fix some stubs causing compile issues for ACPI. - Fix some wakeups on AMD IRQs shared between GPIO and SCI. - Fix a build warning in the Tegra driver. - Fix a Kconfig issue in the Qualcomm driver. - Add a missing include the RALink driver. - Return a valid type for the Apple pinctrl IRQs. - Implement some Qualcomm SDM845 dual-edge errata. - Remove the unused <linux/sdb.h> header. (The subsystem was once deleted by the pinctrl maintainer...) - Fix a duplicate initialized in the Tegra driver. - Fix register offsets for UFS and SDC in the Qualcomm SM8350 driver" * tag 'pinctrl-v5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: qcom: sm8350: Correct UFS and SDC offsets pinctrl: tegra194: remove duplicate initializer again Remove unused header <linux/sdb.h> pinctrl: qcom: sdm845: Enable dual edge errata pinctrl: apple: Always return valid type in apple_gpio_irq_type pinctrl: ralink: include 'ralink_regs.h' in 'pinctrl-mt7620.c' pinctrl: qcom: fix unmet dependencies on GPIOLIB for GPIOLIB_IRQCHIP pinctrl: tegra: Return const pointer from tegra_pinctrl_get_group() pinctrl: amd: Fix wakeups when IRQ is shared with SCI ACPI: Add stubs for wakeup handler functions
2 parents 6b38e2f + 62209e8 commit b100274

File tree

10 files changed

+51
-176
lines changed

10 files changed

+51
-176
lines changed

drivers/pinctrl/pinctrl-amd.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,14 +598,14 @@ static struct irq_chip amd_gpio_irqchip = {
598598

599599
#define PIN_IRQ_PENDING (BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF))
600600

601-
static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
601+
static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
602602
{
603603
struct amd_gpio *gpio_dev = dev_id;
604604
struct gpio_chip *gc = &gpio_dev->gc;
605-
irqreturn_t ret = IRQ_NONE;
606605
unsigned int i, irqnr;
607606
unsigned long flags;
608607
u32 __iomem *regs;
608+
bool ret = false;
609609
u32 regval;
610610
u64 status, mask;
611611

@@ -627,6 +627,14 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
627627
/* Each status bit covers four pins */
628628
for (i = 0; i < 4; i++) {
629629
regval = readl(regs + i);
630+
/* caused wake on resume context for shared IRQ */
631+
if (irq < 0 && (regval & BIT(WAKE_STS_OFF))) {
632+
dev_dbg(&gpio_dev->pdev->dev,
633+
"Waking due to GPIO %d: 0x%x",
634+
irqnr + i, regval);
635+
return true;
636+
}
637+
630638
if (!(regval & PIN_IRQ_PENDING) ||
631639
!(regval & BIT(INTERRUPT_MASK_OFF)))
632640
continue;
@@ -650,9 +658,12 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
650658
}
651659
writel(regval, regs + i);
652660
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
653-
ret = IRQ_HANDLED;
661+
ret = true;
654662
}
655663
}
664+
/* did not cause wake on resume context for shared IRQ */
665+
if (irq < 0)
666+
return false;
656667

657668
/* Signal EOI to the GPIO unit */
658669
raw_spin_lock_irqsave(&gpio_dev->lock, flags);
@@ -664,6 +675,16 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
664675
return ret;
665676
}
666677

678+
static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
679+
{
680+
return IRQ_RETVAL(do_amd_gpio_irq_handler(irq, dev_id));
681+
}
682+
683+
static bool __maybe_unused amd_gpio_check_wake(void *dev_id)
684+
{
685+
return do_amd_gpio_irq_handler(-1, dev_id);
686+
}
687+
667688
static int amd_get_groups_count(struct pinctrl_dev *pctldev)
668689
{
669690
struct amd_gpio *gpio_dev = pinctrl_dev_get_drvdata(pctldev);
@@ -1033,6 +1054,7 @@ static int amd_gpio_probe(struct platform_device *pdev)
10331054
goto out2;
10341055

10351056
platform_set_drvdata(pdev, gpio_dev);
1057+
acpi_register_wakeup_handler(gpio_dev->irq, amd_gpio_check_wake, gpio_dev);
10361058

10371059
dev_dbg(&pdev->dev, "amd gpio driver loaded\n");
10381060
return ret;
@@ -1050,6 +1072,7 @@ static int amd_gpio_remove(struct platform_device *pdev)
10501072
gpio_dev = platform_get_drvdata(pdev);
10511073

10521074
gpiochip_remove(&gpio_dev->gc);
1075+
acpi_unregister_wakeup_handler(amd_gpio_check_wake, gpio_dev);
10531076

10541077
return 0;
10551078
}

drivers/pinctrl/pinctrl-apple-gpio.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static void apple_gpio_irq_ack(struct irq_data *data)
258258
pctl->base + REG_IRQ(irqgrp, data->hwirq));
259259
}
260260

261-
static int apple_gpio_irq_type(unsigned int type)
261+
static unsigned int apple_gpio_irq_type(unsigned int type)
262262
{
263263
switch (type & IRQ_TYPE_SENSE_MASK) {
264264
case IRQ_TYPE_EDGE_RISING:
@@ -272,7 +272,7 @@ static int apple_gpio_irq_type(unsigned int type)
272272
case IRQ_TYPE_LEVEL_LOW:
273273
return REG_GPIOx_IN_IRQ_LO;
274274
default:
275-
return -EINVAL;
275+
return REG_GPIOx_IN_IRQ_OFF;
276276
}
277277
}
278278

@@ -288,7 +288,7 @@ static void apple_gpio_irq_unmask(struct irq_data *data)
288288
{
289289
struct apple_gpio_pinctrl *pctl =
290290
gpiochip_get_data(irq_data_get_irq_chip_data(data));
291-
int irqtype = apple_gpio_irq_type(irqd_get_trigger_type(data));
291+
unsigned int irqtype = apple_gpio_irq_type(irqd_get_trigger_type(data));
292292

293293
apple_gpio_set_reg(pctl, data->hwirq, REG_GPIOx_MODE,
294294
FIELD_PREP(REG_GPIOx_MODE, irqtype));
@@ -313,10 +313,10 @@ static int apple_gpio_irq_set_type(struct irq_data *data,
313313
{
314314
struct apple_gpio_pinctrl *pctl =
315315
gpiochip_get_data(irq_data_get_irq_chip_data(data));
316-
int irqtype = apple_gpio_irq_type(type);
316+
unsigned int irqtype = apple_gpio_irq_type(type);
317317

318-
if (irqtype < 0)
319-
return irqtype;
318+
if (irqtype == REG_GPIOx_IN_IRQ_OFF)
319+
return -EINVAL;
320320

321321
apple_gpio_set_reg(pctl, data->hwirq, REG_GPIOx_MODE,
322322
FIELD_PREP(REG_GPIOx_MODE, irqtype));

drivers/pinctrl/qcom/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ config PINCTRL_QCOM_SPMI_PMIC
197197
select PINMUX
198198
select PINCONF
199199
select GENERIC_PINCONF
200+
select GPIOLIB
200201
select GPIOLIB_IRQCHIP
201202
select IRQ_DOMAIN_HIERARCHY
202203
help
@@ -211,6 +212,7 @@ config PINCTRL_QCOM_SSBI_PMIC
211212
select PINMUX
212213
select PINCONF
213214
select GENERIC_PINCONF
215+
select GPIOLIB
214216
select GPIOLIB_IRQCHIP
215217
select IRQ_DOMAIN_HIERARCHY
216218
help

drivers/pinctrl/qcom/pinctrl-sdm845.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = {
13101310
.ngpios = 151,
13111311
.wakeirq_map = sdm845_pdc_map,
13121312
.nwakeirq_map = ARRAY_SIZE(sdm845_pdc_map),
1313+
.wakeirq_dual_edge_errata = true,
13131314
};
13141315

13151316
static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = {

drivers/pinctrl/qcom/pinctrl-sm8350.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,10 +1597,10 @@ static const struct msm_pingroup sm8350_groups[] = {
15971597
[200] = PINGROUP(200, qdss_gpio, _, _, _, _, _, _, _, _),
15981598
[201] = PINGROUP(201, _, _, _, _, _, _, _, _, _),
15991599
[202] = PINGROUP(202, _, _, _, _, _, _, _, _, _),
1600-
[203] = UFS_RESET(ufs_reset, 0x1d8000),
1601-
[204] = SDC_PINGROUP(sdc2_clk, 0x1cf000, 14, 6),
1602-
[205] = SDC_PINGROUP(sdc2_cmd, 0x1cf000, 11, 3),
1603-
[206] = SDC_PINGROUP(sdc2_data, 0x1cf000, 9, 0),
1600+
[203] = UFS_RESET(ufs_reset, 0xd8000),
1601+
[204] = SDC_PINGROUP(sdc2_clk, 0xcf000, 14, 6),
1602+
[205] = SDC_PINGROUP(sdc2_cmd, 0xcf000, 11, 3),
1603+
[206] = SDC_PINGROUP(sdc2_data, 0xcf000, 9, 0),
16041604
};
16051605

16061606
static const struct msm_gpio_wakeirq_map sm8350_pdc_map[] = {

drivers/pinctrl/ralink/pinctrl-mt7620.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22

3+
#include <asm/mach-ralink/ralink_regs.h>
34
#include <asm/mach-ralink/mt7620.h>
45
#include <linux/module.h>
56
#include <linux/platform_device.h>

drivers/pinctrl/tegra/pinctrl-tegra.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int tegra_pinctrl_set_mux(struct pinctrl_dev *pctldev,
275275
return 0;
276276
}
277277

278-
static struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctldev,
278+
static const struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctldev,
279279
unsigned int offset)
280280
{
281281
struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
@@ -289,7 +289,7 @@ static struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctlde
289289
continue;
290290
for (j = 0; j < num_pins; j++) {
291291
if (offset == pins[j])
292-
return (struct tegra_pingroup *)&pmx->soc->groups[group];
292+
return &pmx->soc->groups[group];
293293
}
294294
}
295295

drivers/pinctrl/tegra/pinctrl-tegra194.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,6 @@ static struct tegra_function tegra194_functions[] = {
13871387
.schmitt_bit = schmitt_b, \
13881388
.drvtype_bit = 13, \
13891389
.lpdr_bit = e_lpdr, \
1390-
.drv_reg = -1, \
13911390

13921391
#define drive_touch_clk_pcc4 DRV_PINGROUP_ENTRY_Y(0x2004, 12, 5, 20, 5, -1, -1, -1, -1, 1)
13931392
#define drive_uart3_rx_pcc6 DRV_PINGROUP_ENTRY_Y(0x200c, 12, 5, 20, 5, -1, -1, -1, -1, 1)

include/linux/acpi.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,15 @@ static inline int acpi_get_local_address(acpi_handle handle, u32 *addr)
974974
return -ENODEV;
975975
}
976976

977+
static inline int acpi_register_wakeup_handler(int wake_irq,
978+
bool (*wakeup)(void *context), void *context)
979+
{
980+
return -ENXIO;
981+
}
982+
983+
static inline void acpi_unregister_wakeup_handler(
984+
bool (*wakeup)(void *context), void *context) { }
985+
977986
#endif /* !CONFIG_ACPI */
978987

979988
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC

include/linux/sdb.h

Lines changed: 0 additions & 160 deletions
This file was deleted.

0 commit comments

Comments
 (0)