firmware/br-ext-chip-allwinner/board/v83x/kernel/patches/00000-drivers_i2c_busses_i2...

39 lines
1.2 KiB
Diff

diff -drupN a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
--- a/drivers/i2c/busses/i2c-gpio.c 2018-08-06 17:23:04.000000000 +0300
+++ b/drivers/i2c/busses/i2c-gpio.c 2022-06-12 05:28:14.000000000 +0300
@@ -88,11 +88,13 @@ static int i2c_gpio_getscl(void *data)
static int of_i2c_gpio_get_pins(struct device_node *np,
unsigned int *sda_pin, unsigned int *scl_pin)
{
- if (of_gpio_count(np) < 2)
- return -ENODEV;
-
- *sda_pin = of_get_gpio(np, 0);
- *scl_pin = of_get_gpio(np, 1);
+ if (of_gpio_count(np) < 2) {
+ *sda_pin = of_get_named_gpio_flags(np, "i2c-gpio,sda", 0, NULL);
+ *scl_pin = of_get_named_gpio_flags(np, "i2c-gpio,scl", 0, NULL);
+ } else {
+ *sda_pin = of_get_gpio(np, 0);
+ *scl_pin = of_get_gpio(np, 1);
+ }
if (*sda_pin == -EPROBE_DEFER || *scl_pin == -EPROBE_DEFER)
return -EPROBE_DEFER;
@@ -225,6 +227,7 @@ static int i2c_gpio_probe(struct platfor
if (ret)
return ret;
+
platform_set_drvdata(pdev, priv);
dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
@@ -269,7 +272,6 @@ static struct platform_driver i2c_gpio_d
static int __init i2c_gpio_init(void)
{
int ret;
-
ret = platform_driver_register(&i2c_gpio_driver);
if (ret)
printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);