gpio_set_value(gpio, 0);
}
+/* Export gpio's to user space */
+static void export_gpios(struct arche_apb_ctrl_drvdata *apb)
+{
+ gpio_export(apb->resetn_gpio, false);
+}
+
+static void unexport_gpios(struct arche_apb_ctrl_drvdata *apb)
+{
+ gpio_unexport(apb->resetn_gpio);
+}
+
static irqreturn_t apb_ctrl_wake_detect_irq(int irq, void *devid)
{
struct arche_apb_ctrl_drvdata *apb = devid;
assert_gpio(apb->resetn_gpio);
+ export_gpios(apb);
+
dev_info(&pdev->dev, "Device registered successfully\n");
return 0;
apb_ctrl_cleanup(apb);
platform_set_drvdata(pdev, NULL);
+ unexport_gpios(apb);
return 0;
}
gpio_set_value(gpio, onoff);
}
+/* Export gpio's to user space */
+static void export_gpios(struct arche_platform_drvdata *arche_pdata)
+{
+ gpio_export(arche_pdata->svc_reset_gpio, false);
+ gpio_export(arche_pdata->svc_sysboot_gpio, false);
+}
+
+static void unexport_gpios(struct arche_platform_drvdata *arche_pdata)
+{
+ gpio_unexport(arche_pdata->svc_reset_gpio);
+ gpio_unexport(arche_pdata->svc_sysboot_gpio);
+}
+
static void arche_platform_cleanup(struct arche_platform_drvdata *arche_pdata)
{
/* As part of exit, put APB back in reset state */
arche_pdata->num_apbs = of_get_child_count(np);
dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
+ export_gpios(arche_pdata);
+
/* probe all childs here */
ret = of_platform_populate(np, NULL, NULL, dev);
if (ret)
arche_platform_cleanup(arche_pdata);
platform_set_drvdata(pdev, NULL);
+ unexport_gpios(arche_pdata);
return 0;
}