summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/pinctrl-cy8c95x0.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-18 16:59:09 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-18 16:59:09 -0700
commitfaeab166167f5787719eb8683661fd41a3bb1514 (patch)
tree4483bcfbe6a67b555360e421860b0f6ef16aa575 /drivers/pinctrl/pinctrl-cy8c95x0.c
parent401b0e0bc96543881924d623388a9472b3331b3f (diff)
parent90700e10d2ad61c13a5117cfa5e08d9f2e497dcc (diff)
Merge tag 'pinctrl-v7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrlHEADmaster
Pull pin control updates from Linus Walleij: "Core changes: - Perform basic checks on pin config properties so as not to allow directly contradictory settings such as setting a pin to more than one bias or drive mode - Handle input-threshold-voltage-microvolt property - Introduce pinctrl_gpio_get_config() handling in the core for SCMI GPIO using pin control New drivers: - GPIO-by-pin control driver (also appearing in the GPIO pull request) fulfilling a promise on a comment from Grant Likely many years ago: "can't GPIO just be a front-end for pin control?" it turns out it can, if and only if you design something new from scratch, such as SCMI - Broadcom BCM7038 as a pinctrl-single delegate - Mobileye EyeQ6Lplus OLB pin controller - Qualcomm Eliza and Hawi families TLMM pin controllers - Qualcomm SDM670 and Milos family LPASS LPI pin controllers - Qualcomm IPQ5210 pin controller - Realtek RTD1625 pin controller support - Rockchip RV1103B pin controller support - Texas Instruments AM62L as a pinctrl-single delegate Improvements: - Set config implementation for the Spacemit K1 pin controller" * tag 'pinctrl-v7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (84 commits) pinctrl: qcom: Add Hawi pinctrl driver dt-bindings: pinctrl: qcom: Describe Hawi TLMM block dt-bindings: pinctrl: pinctrl-max77620: convert to DT schema pinctrl: single: Add bcm7038-padconf compatible matching dt-bindings: pinctrl: pinctrl-single: Add brcm,bcm7038-padconf dt-bindings: pinctrl: apple,pinctrl: Add t8122 compatible pinctrl: qcom: sdm670-lpass-lpi: label variables as static pinctrl: sophgo: pinctrl-sg2044: Fix wrong module description pinctrl: sophgo: pinctrl-sg2042: Fix wrong module description pinctrl: qcom: add sdm670 lpi tlmm dt-bindings: pinctrl: qcom: Add SDM670 LPASS LPI pinctrl dt-bindings: qcom: lpass-lpi-common: add reserved GPIOs property pinctrl: qcom: Introduce IPQ5210 TLMM driver dt-bindings: pinctrl: qcom: add IPQ5210 pinctrl pinctrl: qcom: Drop redundant intr_target_reg on modern SoCs pinctrl: qcom: eliza: Fix interrupt target bit pinctrl: core: Don't use "proxy" headers pinctrl: amd: Support new ACPI ID AMDI0033 pinctrl: renesas: rzg2l: Drop superfluous blank line pinctrl: renesas: rzg2l: Fix save/restore of {IOLH,IEN,PUPD,SMT} registers ...
Diffstat (limited to 'drivers/pinctrl/pinctrl-cy8c95x0.c')
-rw-r--r--drivers/pinctrl/pinctrl-cy8c95x0.c93
1 files changed, 38 insertions, 55 deletions
diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index 5c055d344ac9d..ace0be5ec6791 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -72,24 +72,6 @@
#define CY8C95X0_MUX_REGMAP_TO_OFFSET(x, p) \
(CY8C95X0_VIRTUAL + (x) - CY8C95X0_PORTSEL + (p) * MUXED_STRIDE)
-static const struct i2c_device_id cy8c95x0_id[] = {
- { "cy8c9520", 20, },
- { "cy8c9540", 40, },
- { "cy8c9560", 60, },
- { }
-};
-MODULE_DEVICE_TABLE(i2c, cy8c95x0_id);
-
-#define OF_CY8C95X(__nrgpio) ((void *)(__nrgpio))
-
-static const struct of_device_id cy8c95x0_dt_ids[] = {
- { .compatible = "cypress,cy8c9520", .data = OF_CY8C95X(20), },
- { .compatible = "cypress,cy8c9540", .data = OF_CY8C95X(40), },
- { .compatible = "cypress,cy8c9560", .data = OF_CY8C95X(60), },
- { }
-};
-MODULE_DEVICE_TABLE(of, cy8c95x0_dt_ids);
-
static const struct acpi_gpio_params cy8c95x0_irq_gpios = { 0, 0, true };
static const struct acpi_gpio_mapping cy8c95x0_acpi_irq_gpios[] = {
@@ -144,11 +126,9 @@ static const struct dmi_system_id cy8c95x0_dmi_acpi_irq_info[] = {
* @map: Mask used to compensate for Gport2 width
* @nport: Number of Gports in this chip
* @gpio_chip: gpiolib chip
- * @driver_data: private driver data
* @dev: struct device
* @pctldev: pin controller device
* @pinctrl_desc: pin controller description
- * @name: Chip controller name
* @tpin: Total number of pins
* @gpio_reset: GPIO line handler that can reset the IC
*/
@@ -165,11 +145,9 @@ struct cy8c95x0_pinctrl {
DECLARE_BITMAP(map, MAX_LINE);
unsigned int nport;
struct gpio_chip gpio_chip;
- unsigned long driver_data;
struct device *dev;
struct pinctrl_dev *pctldev;
struct pinctrl_desc pinctrl_desc;
- char name[32];
unsigned int tpin;
struct gpio_desc *gpio_reset;
};
@@ -1310,18 +1288,19 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)
{
struct gpio_irq_chip *girq = &chip->gpio_chip.irq;
DECLARE_BITMAP(pending_irqs, MAX_LINE);
+ struct device *dev = chip->dev;
int ret;
- mutex_init(&chip->irq_lock);
+ ret = devm_mutex_init(chip->dev, &chip->irq_lock);
+ if (ret)
+ return ret;
bitmap_zero(pending_irqs, MAX_LINE);
/* Read IRQ status register to clear all pending interrupts */
ret = cy8c95x0_irq_pending(chip, pending_irqs);
- if (ret) {
- dev_err(chip->dev, "failed to clear irq status register\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, -EBUSY, "failed to clear irq status register\n");
/* Mask all interrupts */
bitmap_fill(chip->irq_mask, MAX_LINE);
@@ -1336,17 +1315,9 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)
girq->handler = handle_simple_irq;
girq->threaded = true;
- ret = devm_request_threaded_irq(chip->dev, irq,
- NULL, cy8c95x0_irq_handler,
- IRQF_ONESHOT | IRQF_SHARED,
- dev_name(chip->dev), chip);
- if (ret) {
- dev_err(chip->dev, "failed to request irq %d\n", irq);
- return ret;
- }
- dev_info(chip->dev, "Registered threaded IRQ\n");
-
- return 0;
+ return devm_request_threaded_irq(dev, irq, NULL, cy8c95x0_irq_handler,
+ IRQF_ONESHOT | IRQF_SHARED,
+ dev_name(chip->dev), chip);
}
static int cy8c95x0_setup_pinctrl(struct cy8c95x0_pinctrl *chip)
@@ -1362,11 +1333,7 @@ static int cy8c95x0_setup_pinctrl(struct cy8c95x0_pinctrl *chip)
pd->owner = THIS_MODULE;
chip->pctldev = devm_pinctrl_register(chip->dev, pd, chip);
- if (IS_ERR(chip->pctldev))
- return dev_err_probe(chip->dev, PTR_ERR(chip->pctldev),
- "can't register controller\n");
-
- return 0;
+ return PTR_ERR_OR_ZERO(chip->pctldev);
}
static int cy8c95x0_detect(struct i2c_client *client,
@@ -1384,13 +1351,13 @@ static int cy8c95x0_detect(struct i2c_client *client,
return ret;
switch (ret & GENMASK(7, 4)) {
case 0x20:
- name = cy8c95x0_id[0].name;
+ name = "cy8c9520";
break;
case 0x40:
- name = cy8c95x0_id[1].name;
+ name = "cy8c9540";
break;
case 0x60:
- name = cy8c95x0_id[2].name;
+ name = "cy8c9560";
break;
default:
return -ENODEV;
@@ -1408,6 +1375,7 @@ static int cy8c95x0_probe(struct i2c_client *client)
struct cy8c95x0_pinctrl *chip;
struct regmap_config regmap_conf;
struct regmap_range_cfg regmap_range_conf;
+ unsigned long driver_data;
int ret;
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
@@ -1417,26 +1385,21 @@ static int cy8c95x0_probe(struct i2c_client *client)
chip->dev = dev;
/* Set the device type */
- chip->driver_data = (uintptr_t)i2c_get_match_data(client);
- if (!chip->driver_data)
- return -ENODEV;
+ driver_data = (unsigned long)i2c_get_match_data(client);
- chip->tpin = chip->driver_data & CY8C95X0_GPIO_MASK;
+ chip->tpin = driver_data & CY8C95X0_GPIO_MASK;
chip->nport = DIV_ROUND_UP(CY8C95X0_PIN_TO_OFFSET(chip->tpin), BANK_SZ);
memcpy(&regmap_range_conf, &cy8c95x0_ranges[0], sizeof(regmap_range_conf));
switch (chip->tpin) {
case 20:
- strscpy(chip->name, cy8c95x0_id[0].name);
regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 3 * MUXED_STRIDE - 1;
break;
case 40:
- strscpy(chip->name, cy8c95x0_id[1].name);
regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 6 * MUXED_STRIDE - 1;
break;
case 60:
- strscpy(chip->name, cy8c95x0_id[2].name);
regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 8 * MUXED_STRIDE - 1;
break;
default:
@@ -1474,7 +1437,9 @@ static int cy8c95x0_probe(struct i2c_client *client)
bitmap_fill(chip->map, MAX_LINE);
bitmap_clear(chip->map, 20, 4);
- mutex_init(&chip->i2c_lock);
+ ret = devm_mutex_init(dev, &chip->i2c_lock);
+ if (ret)
+ return ret;
if (dmi_first_match(cy8c95x0_dmi_acpi_irq_info)) {
ret = cy8c95x0_acpi_get_irq(&client->dev);
@@ -1495,8 +1460,26 @@ static int cy8c95x0_probe(struct i2c_client *client)
return cy8c95x0_setup_gpiochip(chip);
}
+static const struct i2c_device_id cy8c95x0_id[] = {
+ { "cy8c9520", 20 },
+ { "cy8c9540", 40 },
+ { "cy8c9560", 60 },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, cy8c95x0_id);
+
+#define OF_CY8C95X(__nrgpio) ((void *)(__nrgpio))
+
+static const struct of_device_id cy8c95x0_dt_ids[] = {
+ { .compatible = "cypress,cy8c9520", .data = OF_CY8C95X(20) },
+ { .compatible = "cypress,cy8c9540", .data = OF_CY8C95X(40) },
+ { .compatible = "cypress,cy8c9560", .data = OF_CY8C95X(60) },
+ { }
+};
+MODULE_DEVICE_TABLE(of, cy8c95x0_dt_ids);
+
static const struct acpi_device_id cy8c95x0_acpi_ids[] = {
- { "INT3490", 40, },
+ { "INT3490", 40 },
{ }
};
MODULE_DEVICE_TABLE(acpi, cy8c95x0_acpi_ids);