]> git.baikalelectronics.ru Git - uboot.git/commitdiff
gpio: qcom: add direction functions for pwrkey
authorDzmitry Sankouski <dsankouski@gmail.com>
Sun, 22 Jan 2023 15:21:21 +0000 (18:21 +0300)
committerTom Rini <trini@konsulko.com>
Fri, 10 Feb 2023 17:50:00 +0000 (12:50 -0500)
GPIO button driver requires direction functions to probe
button gpio. Those functions are blank, since pwrkey is not
really gpio, and don't support direction settings.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
drivers/gpio/qcom_pmic_gpio.c

index 3be1be8692c31ed2df584e37cc2a7560d3ccfb74..65feb453ebc3802a2d10252496929cd430e60731 100644 (file)
@@ -303,9 +303,25 @@ static int qcom_pwrkey_get_value(struct udevice *dev, unsigned offset)
        }
 }
 
+/*
+ * 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)