summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/mxc
diff options
context:
space:
mode:
authorLiu Ying <victor.liu@nxp.com>2017-04-20 11:08:32 +0800
committerAnson Huang <Anson.Huang@nxp.com>2017-06-09 22:19:29 +0800
commitf0c1acdfdefbc1d46ae034cae56c17fbf24bb268 (patch)
tree33062601a4863d063b11cf3b5d2f6e3c6c4b5590 /drivers/video/fbdev/mxc
parent7bf12c98cc834f9e2ab7350c94af6ff91c9e0f03 (diff)
MLK-14665 video: fbdev: mxc: mipi dsi: Customize gpio reset function
The mxc display driver framework doesn't support deferral probe. The following initialization process may cause the mipi dsi driver deferral probe, however. pinctrl-imx6 - arch_initcall gpio-mxc - subsys_initcall gpio-reset - arch_initcall This patch customizes gpio reset function so that we can remove the code to use the reset logic provided by the gpio-reset driver. Also, the gpio-reset driver is not in the upstreaming kernel, so it would be good not to use it if possible. Signed-off-by: Liu Ying <victor.liu@nxp.com>
Diffstat (limited to 'drivers/video/fbdev/mxc')
-rw-r--r--drivers/video/fbdev/mxc/mipi_dsi.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/drivers/video/fbdev/mxc/mipi_dsi.c b/drivers/video/fbdev/mxc/mipi_dsi.c
index d17d19a86a35..4e189cdbc77e 100644
--- a/drivers/video/fbdev/mxc/mipi_dsi.c
+++ b/drivers/video/fbdev/mxc/mipi_dsi.c
@@ -26,8 +26,8 @@
#include <linux/mxcfb.h>
#include <linux/backlight.h>
#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/regulator/consumer.h>
-#include <linux/reset.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <video/mipi_display.h>
@@ -728,6 +728,52 @@ static struct mxc_dispdrv_driver mipi_dsi_drv = {
.setup = mipi_dsi_setup,
};
+static int device_reset(struct device *dev)
+{
+ struct device_node *np = dev->of_node;
+ enum of_gpio_flags flags;
+ unsigned long gpio_flags;
+ unsigned int gpio;
+ bool initially_in_reset;
+ bool active_low;
+ s32 delay_us;
+ int ret;
+
+ gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags);
+ if (gpio == -EPROBE_DEFER) {
+ return gpio;
+ } else if (!gpio_is_valid(gpio)) {
+ dev_err(dev, "invalid reset gpio: %d\n", gpio);
+ return gpio;
+ }
+
+ active_low = flags & OF_GPIO_ACTIVE_LOW;
+
+ ret = of_property_read_u32(np, "reset-delay-us", &delay_us);
+ if (ret < 0 || delay_us < 0) {
+ dev_err(dev, "invalid reset delay\n");
+ return -EINVAL;
+ }
+
+ initially_in_reset = of_property_read_bool(np, "initially-in-reset");
+ if (active_low ^ initially_in_reset)
+ gpio_flags = GPIOF_OUT_INIT_HIGH;
+ else
+ gpio_flags = GPIOF_OUT_INIT_LOW;
+
+ ret = devm_gpio_request_one(dev, gpio, gpio_flags, NULL);
+ if (ret < 0) {
+ dev_err(dev, "failed to request gpio %d: %d\n", gpio, ret);
+ return ret;
+ }
+
+ gpio_set_value_cansleep(gpio, active_low ? 0 : 1);
+ udelay(delay_us);
+ gpio_set_value_cansleep(gpio, active_low ? 1 : 0);
+
+ return 0;
+}
+
static int imx6q_mipi_dsi_get_mux(int dev_id, int disp_id)
{
if (dev_id > 1 || disp_id > 1)