]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
gpio: qcom_pmic: drop pon GPIO driver
authorCaleb Connolly <caleb.connolly@linaro.org>
Tue, 5 Dec 2023 13:46:49 +0000 (13:46 +0000)
committerCaleb Connolly <caleb.connolly@linaro.org>
Tue, 16 Jan 2024 12:26:53 +0000 (12:26 +0000)
Remove the (now unused) GPIO driver for the power and resin buttons on
the PMIC.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
drivers/gpio/Kconfig
drivers/gpio/qcom_pmic_gpio.c

index 63e62e1acd29a4f97ca7856ae563a9b17249a480..27df5d88d40e9eac334fe56c572a492a07bc3b59 100644 (file)
@@ -318,12 +318,11 @@ config CMD_PCA953X
 config QCOM_PMIC_GPIO
        bool "Qualcomm generic PMIC GPIO/keypad driver"
        depends on DM_GPIO && PMIC_QCOM
+       select BUTTON
        help
          Support for GPIO pins and power/reset buttons found on
          Qualcomm SoCs PMIC.
-         Default name for GPIO bank is "pm8916".
-         Power and reset buttons are placed in "pwkey_qcom" bank and
-          have gpio numbers 0 and 1 respectively.
+         The GPIO bank is called "pmic"
 
 config PCF8575_GPIO
        bool "PCF8575 I2C GPIO Expander driver"
index e5841f5029530f672a977c21cf94b9da08eda5ee..7b83c67fa464d0220abd8c8b8bf83f2e0cac1795 100644 (file)
@@ -275,107 +275,3 @@ U_BOOT_DRIVER(qcom_pmic_gpio) = {
        .priv_auto      = sizeof(struct qcom_gpio_bank),
 };
 
-
-/* Add pmic buttons as GPIO as well - there is no generic way for now */
-#define PON_INT_RT_STS                        0x10
-#define KPDPWR_ON_INT_BIT                     0
-#define RESIN_ON_INT_BIT                      1
-
-static int qcom_pwrkey_get_function(struct udevice *dev, unsigned offset)
-{
-       return GPIOF_INPUT;
-}
-
-static int qcom_pwrkey_get_value(struct udevice *dev, unsigned offset)
-{
-       struct qcom_gpio_bank *priv = dev_get_priv(dev);
-
-       int reg = pmic_reg_read(dev->parent, priv->pid + PON_INT_RT_STS);
-
-       if (reg < 0)
-               return 0;
-
-       switch (offset) {
-       case 0: /* Power button */
-               return (reg & BIT(KPDPWR_ON_INT_BIT)) != 0;
-               break;
-       case 1: /* Reset button */
-       default:
-               return (reg & BIT(RESIN_ON_INT_BIT)) != 0;
-               break;
-       }
-}
-
-/*
- * Since pmic buttons modelled as GPIO, we need empty direction functions
- * to trick u-boot button driver
- */
-static int qcom_pwrkey_direction_input(struct udevice *dev, unsigned int offset)
-{
-       return 0;
-}
-
-static int qcom_pwrkey_direction_output(struct udevice *dev, unsigned int offset, int value)
-{
-       return -EOPNOTSUPP;
-}
-
-static const struct dm_gpio_ops qcom_pwrkey_ops = {
-       .get_value              = qcom_pwrkey_get_value,
-       .get_function           = qcom_pwrkey_get_function,
-       .direction_input        = qcom_pwrkey_direction_input,
-       .direction_output       = qcom_pwrkey_direction_output,
-};
-
-static int qcom_pwrkey_probe(struct udevice *dev)
-{
-       struct qcom_gpio_bank *priv = dev_get_priv(dev);
-       int reg;
-       u64 pid;
-
-       pid = dev_read_addr(dev);
-       if (pid == FDT_ADDR_T_NONE)
-               return log_msg_ret("bad address", -EINVAL);
-
-       priv->pid = pid;
-
-       /* Do a sanity check */
-       reg = pmic_reg_read(dev->parent, priv->pid + REG_TYPE);
-       if (reg != 0x1)
-               return log_msg_ret("bad type", -ENXIO);
-
-       reg = pmic_reg_read(dev->parent, priv->pid + REG_SUBTYPE);
-       if ((reg & 0x5) == 0)
-               return log_msg_ret("bad subtype", -ENXIO);
-
-       return 0;
-}
-
-static int qcom_pwrkey_of_to_plat(struct udevice *dev)
-{
-       struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
-
-       uc_priv->gpio_count = 2;
-       uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
-       if (uc_priv->bank_name == NULL)
-               uc_priv->bank_name = "pwkey_qcom";
-
-       return 0;
-}
-
-static const struct udevice_id qcom_pwrkey_ids[] = {
-       { .compatible = "qcom,pm8916-pwrkey" },
-       { .compatible = "qcom,pm8994-pwrkey" },
-       { .compatible = "qcom,pm8998-pwrkey" },
-       { }
-};
-
-U_BOOT_DRIVER(pwrkey_qcom) = {
-       .name   = "pwrkey_qcom",
-       .id     = UCLASS_GPIO,
-       .of_match = qcom_pwrkey_ids,
-       .of_to_plat = qcom_pwrkey_of_to_plat,
-       .probe  = qcom_pwrkey_probe,
-       .ops    = &qcom_pwrkey_ops,
-       .priv_auto      = sizeof(struct qcom_gpio_bank),
-};