Skip to contentSkip to conversation

drivers/fsi: Set I/O to standby values on unbind

PATCH Applied Christopher Bostic 2 participants 2 messages Mar 3, 2017 – Mar 7, 2017 FSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/fsi: Set I/O to standby values on unbind

On unbind send a break command to reset any connected slave and put bus in a good state. Next set each FSI pin to standby state, '0' except for SDA (data) which is negative active so set it to a '1'.

---
 drivers/fsi/fsi-master-gpio.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/fsi/fsi-master-gpio.c +13 -3
index 49f3399..c923846 100644
@@ -557,14 +557,24 @@ static int fsi_master_gpio_remove(struct platform_device *pdev)
 {
 	struct fsi_master_gpio *master = platform_get_drvdata(pdev);
 
+	fsi_master_gpio_break(&master->master, 0);
+
+	gpiod_set_value(master->gpio_clk, 0);
 	devm_gpiod_put(&pdev->dev, master->gpio_clk);
+	gpiod_set_value(master->gpio_data, 1);
 	devm_gpiod_put(&pdev->dev, master->gpio_data);
-	if (master->gpio_trans)
+	if (master->gpio_trans) {
+		gpiod_set_value(master->gpio_trans, 0);
 		devm_gpiod_put(&pdev->dev, master->gpio_trans);
-	if (master->gpio_enable)
+	}
+	if (master->gpio_enable) {
+		gpiod_set_value(master->gpio_enable, 0);
 		devm_gpiod_put(&pdev->dev, master->gpio_enable);
-	if (master->gpio_mux)
+	}
+	if (master->gpio_mux) {
+		gpiod_set_value(master->gpio_mux, 0);
 		devm_gpiod_put(&pdev->dev, master->gpio_mux);
+	}
 	fsi_master_unregister(&master->master);
 
 	return 0;
Signature · 1 line
1.8.2.2
Applied
#1 lore raw
Quoted 4 lines · Christopher Bostic

On unbind send a break command to reset any connected slave and put bus in a good state. Next set each FSI pin to standby state, '0' except for SDA (data) which is negative active so set it to a '1'.

I recommend you investigate fixing the device tree node so the data line is configured as active-low.

I've applied this as-is to dev-4.7.

Cheers,

Joel

Quoted 41 lines
---
 drivers/fsi/fsi-master-gpio.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/fsi/fsi-master-gpio.c +13 -4
index 49f3399..c923846 100644
@@ -557,14 +557,24 @@ static int fsi_master_gpio_remove(struct platform_device *pdev)
 {
        struct fsi_master_gpio *master = platform_get_drvdata(pdev);
 
+       fsi_master_gpio_break(&master->master, 0);
+
+       gpiod_set_value(master->gpio_clk, 0);
        devm_gpiod_put(&pdev->dev, master->gpio_clk);
+       gpiod_set_value(master->gpio_data, 1);
        devm_gpiod_put(&pdev->dev, master->gpio_data);
-       if (master->gpio_trans)
+       if (master->gpio_trans) {
+               gpiod_set_value(master->gpio_trans, 0);
                devm_gpiod_put(&pdev->dev, master->gpio_trans);
-       if (master->gpio_enable)
+       }
+       if (master->gpio_enable) {
+               gpiod_set_value(master->gpio_enable, 0);
                devm_gpiod_put(&pdev->dev, master->gpio_enable);
-       if (master->gpio_mux)
+       }
+       if (master->gpio_mux) {
+               gpiod_set_value(master->gpio_mux, 0);
                devm_gpiod_put(&pdev->dev, master->gpio_mux);
+       }
        fsi_master_unregister(&master->master);
 
        return 0;
--

1.8.2.2