Lines Matching +full:reset +full:- +full:n +full:- +full:io
1 // SPDX-License-Identifier: GPL-2.0-only
3 * l4f00242t03.c -- support for Epson L4F00242T03 LCD
5 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
29 struct gpio_desc *reset; member
35 pr_debug("l4f00242t03_reset.\n"); in l4f00242t03_reset()
52 dev_dbg(&spi->dev, "initializing LCD\n"); in l4f00242t03_lcd_init()
54 ret = regulator_set_voltage(priv->io_reg, 1800000, 1800000); in l4f00242t03_lcd_init()
56 dev_err(&spi->dev, "failed to set the IO regulator voltage.\n"); in l4f00242t03_lcd_init()
59 ret = regulator_enable(priv->io_reg); in l4f00242t03_lcd_init()
61 dev_err(&spi->dev, "failed to enable the IO regulator.\n"); in l4f00242t03_lcd_init()
65 ret = regulator_set_voltage(priv->core_reg, 2800000, 2800000); in l4f00242t03_lcd_init()
67 dev_err(&spi->dev, "failed to set the core regulator voltage.\n"); in l4f00242t03_lcd_init()
68 regulator_disable(priv->io_reg); in l4f00242t03_lcd_init()
71 ret = regulator_enable(priv->core_reg); in l4f00242t03_lcd_init()
73 dev_err(&spi->dev, "failed to enable the core regulator.\n"); in l4f00242t03_lcd_init()
74 regulator_disable(priv->io_reg); in l4f00242t03_lcd_init()
78 l4f00242t03_reset(priv->reset); in l4f00242t03_lcd_init()
80 gpiod_set_value(priv->enable, 1); in l4f00242t03_lcd_init()
89 dev_dbg(&spi->dev, "Powering down LCD\n"); in l4f00242t03_lcd_powerdown()
91 gpiod_set_value(priv->enable, 0); in l4f00242t03_lcd_powerdown()
93 regulator_disable(priv->io_reg); in l4f00242t03_lcd_powerdown()
94 regulator_disable(priv->core_reg); in l4f00242t03_lcd_powerdown()
101 return priv->lcd_state; in l4f00242t03_lcd_power_get()
107 struct spi_device *spi = priv->spi; in l4f00242t03_lcd_power_set()
116 if (priv->lcd_state <= FB_BLANK_NORMAL) { in l4f00242t03_lcd_power_set()
118 } else if (priv->lcd_state < FB_BLANK_POWERDOWN) { in l4f00242t03_lcd_power_set()
119 dev_dbg(&spi->dev, "Resuming LCD\n"); in l4f00242t03_lcd_power_set()
125 /* priv->lcd_state == FB_BLANK_POWERDOWN */ in l4f00242t03_lcd_power_set()
127 priv->lcd_state = FB_BLANK_VSYNC_SUSPEND; in l4f00242t03_lcd_power_set()
128 l4f00242t03_lcd_power_set(priv->ld, power); in l4f00242t03_lcd_power_set()
131 if (priv->lcd_state <= FB_BLANK_NORMAL) { in l4f00242t03_lcd_power_set()
133 dev_dbg(&spi->dev, "Standby the LCD\n"); in l4f00242t03_lcd_power_set()
138 } else if (priv->lcd_state < FB_BLANK_POWERDOWN) { in l4f00242t03_lcd_power_set()
141 /* priv->lcd_state == FB_BLANK_POWERDOWN */ in l4f00242t03_lcd_power_set()
143 priv->lcd_state = FB_BLANK_UNBLANK; in l4f00242t03_lcd_power_set()
148 if (priv->lcd_state != FB_BLANK_POWERDOWN) { in l4f00242t03_lcd_power_set()
156 priv->lcd_state = power; in l4f00242t03_lcd_power_set()
170 priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv), in l4f00242t03_probe()
173 return -ENOMEM; in l4f00242t03_probe()
176 spi->bits_per_word = 9; in l4f00242t03_probe()
179 priv->spi = spi; in l4f00242t03_probe()
181 priv->reset = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH); in l4f00242t03_probe()
182 if (IS_ERR(priv->reset)) { in l4f00242t03_probe()
183 dev_err(&spi->dev, in l4f00242t03_probe()
184 "Unable to get the lcd l4f00242t03 reset gpio.\n"); in l4f00242t03_probe()
185 return PTR_ERR(priv->reset); in l4f00242t03_probe()
187 gpiod_set_consumer_name(priv->reset, "lcd l4f00242t03 reset"); in l4f00242t03_probe()
189 priv->enable = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW); in l4f00242t03_probe()
190 if (IS_ERR(priv->enable)) { in l4f00242t03_probe()
191 dev_err(&spi->dev, in l4f00242t03_probe()
192 "Unable to get the lcd l4f00242t03 data en gpio.\n"); in l4f00242t03_probe()
193 return PTR_ERR(priv->enable); in l4f00242t03_probe()
195 gpiod_set_consumer_name(priv->enable, "lcd l4f00242t03 data enable"); in l4f00242t03_probe()
197 priv->io_reg = devm_regulator_get(&spi->dev, "vdd"); in l4f00242t03_probe()
198 if (IS_ERR(priv->io_reg)) { in l4f00242t03_probe()
199 dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", in l4f00242t03_probe()
201 return PTR_ERR(priv->io_reg); in l4f00242t03_probe()
204 priv->core_reg = devm_regulator_get(&spi->dev, "vcore"); in l4f00242t03_probe()
205 if (IS_ERR(priv->core_reg)) { in l4f00242t03_probe()
206 dev_err(&spi->dev, "%s: Unable to get the core regulator\n", in l4f00242t03_probe()
208 return PTR_ERR(priv->core_reg); in l4f00242t03_probe()
211 priv->ld = devm_lcd_device_register(&spi->dev, "l4f00242t03", &spi->dev, in l4f00242t03_probe()
213 if (IS_ERR(priv->ld)) in l4f00242t03_probe()
214 return PTR_ERR(priv->ld); in l4f00242t03_probe()
218 priv->lcd_state = FB_BLANK_VSYNC_SUSPEND; in l4f00242t03_probe()
219 l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_UNBLANK); in l4f00242t03_probe()
221 dev_info(&spi->dev, "Epson l4f00242t03 lcd probed.\n"); in l4f00242t03_probe()
230 l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); in l4f00242t03_remove()
238 l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); in l4f00242t03_shutdown()