Lines Matching refs:ws

104 static void ws2401_read_mtp_id(struct ws2401 *ws)  in ws2401_read_mtp_id()  argument
106 struct mipi_dbi *dbi = &ws->dbi; in ws2401_read_mtp_id()
112 dev_err(ws->dev, "unable to read MTP ID 1\n"); in ws2401_read_mtp_id()
117 dev_err(ws->dev, "unable to read MTP ID 2\n"); in ws2401_read_mtp_id()
122 dev_err(ws->dev, "unable to read MTP ID 3\n"); in ws2401_read_mtp_id()
125 dev_info(ws->dev, "MTP ID: %02x %02x %02x\n", id1, id2, id3); in ws2401_read_mtp_id()
128 static int ws2401_power_on(struct ws2401 *ws) in ws2401_power_on() argument
130 struct mipi_dbi *dbi = &ws->dbi; in ws2401_power_on()
134 ret = regulator_bulk_enable(ARRAY_SIZE(ws->regulators), in ws2401_power_on()
135 ws->regulators); in ws2401_power_on()
137 dev_err(ws->dev, "failed to enable regulators: %d\n", ret); in ws2401_power_on()
143 gpiod_set_value_cansleep(ws->reset, 1); in ws2401_power_on()
146 gpiod_set_value_cansleep(ws->reset, 0); in ws2401_power_on()
149 dev_dbg(ws->dev, "de-asserted RESET\n"); in ws2401_power_on()
208 if (ws->internal_bl) { in ws2401_power_on()
223 static int ws2401_power_off(struct ws2401 *ws) in ws2401_power_off() argument
226 gpiod_set_value_cansleep(ws->reset, 1); in ws2401_power_off()
227 return regulator_bulk_disable(ARRAY_SIZE(ws->regulators), in ws2401_power_off()
228 ws->regulators); in ws2401_power_off()
233 struct ws2401 *ws = to_ws2401(panel); in ws2401_unprepare() local
234 struct mipi_dbi *dbi = &ws->dbi; in ws2401_unprepare()
237 if (ws->internal_bl) in ws2401_unprepare()
246 struct ws2401 *ws = to_ws2401(panel); in ws2401_disable() local
247 struct mipi_dbi *dbi = &ws->dbi; in ws2401_disable()
262 struct ws2401 *ws = to_ws2401(panel); in ws2401_enable() local
263 struct mipi_dbi *dbi = &ws->dbi; in ws2401_enable()
278 struct ws2401 *ws = to_ws2401(panel); in ws2401_get_modes() local
290 dev_err(ws->dev, "failed to add mode\n"); in ws2401_get_modes()
320 struct ws2401 *ws = bl_get_data(bl); in ws2401_set_brightness() local
321 struct mipi_dbi *dbi = &ws->dbi; in ws2401_set_brightness()
347 struct ws2401 *ws; in ws2401_probe() local
350 ws = devm_kzalloc(dev, sizeof(*ws), GFP_KERNEL); in ws2401_probe()
351 if (!ws) in ws2401_probe()
353 ws->dev = dev; in ws2401_probe()
359 ws->regulators[0].supply = "vci"; in ws2401_probe()
360 ws->regulators[1].supply = "vccio"; in ws2401_probe()
362 ARRAY_SIZE(ws->regulators), in ws2401_probe()
363 ws->regulators); in ws2401_probe()
367 ws->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in ws2401_probe()
368 if (IS_ERR(ws->reset)) { in ws2401_probe()
369 ret = PTR_ERR(ws->reset); in ws2401_probe()
373 ret = mipi_dbi_spi_init(spi, &ws->dbi, NULL); in ws2401_probe()
376 ws->dbi.read_commands = ws2401_dbi_read_commands; in ws2401_probe()
378 ws2401_power_on(ws); in ws2401_probe()
379 ws2401_read_mtp_id(ws); in ws2401_probe()
380 ws2401_power_off(ws); in ws2401_probe()
382 drm_panel_init(&ws->panel, dev, &ws2401_drm_funcs, in ws2401_probe()
385 ret = drm_panel_of_backlight(&ws->panel); in ws2401_probe()
390 if (!ws->panel.backlight) { in ws2401_probe()
392 ws->panel.backlight = in ws2401_probe()
393 devm_backlight_device_register(dev, "ws2401", dev, ws, in ws2401_probe()
395 if (IS_ERR(ws->panel.backlight)) in ws2401_probe()
396 return dev_err_probe(dev, PTR_ERR(ws->panel.backlight), in ws2401_probe()
402 spi_set_drvdata(spi, ws); in ws2401_probe()
404 drm_panel_add(&ws->panel); in ws2401_probe()
412 struct ws2401 *ws = spi_get_drvdata(spi); in ws2401_remove() local
414 drm_panel_remove(&ws->panel); in ws2401_remove()