Lines Matching defs:stk
53 static int stk_panel_init(struct stk_panel *stk)
55 struct mipi_dsi_device *dsi = stk->dsi;
56 struct device *dev = &stk->dsi->dev;
95 ret = mipi_dsi_dcs_set_column_address(dsi, 0, stk->mode->hdisplay - 1);
101 ret = mipi_dsi_dcs_set_page_address(dsi, 0, stk->mode->vdisplay - 1);
110 static int stk_panel_on(struct stk_panel *stk)
112 struct mipi_dsi_device *dsi = stk->dsi;
113 struct device *dev = &stk->dsi->dev;
125 static void stk_panel_off(struct stk_panel *stk)
127 struct mipi_dsi_device *dsi = stk->dsi;
128 struct device *dev = &stk->dsi->dev;
146 struct stk_panel *stk = to_stk_panel(panel);
148 if (!stk->prepared)
151 stk_panel_off(stk);
152 regulator_bulk_disable(ARRAY_SIZE(stk->supplies), stk->supplies);
153 gpiod_set_value(stk->reset_gpio, 0);
154 gpiod_set_value(stk->enable_gpio, 1);
156 stk->prepared = false;
163 struct stk_panel *stk = to_stk_panel(panel);
164 struct device *dev = &stk->dsi->dev;
167 if (stk->prepared)
170 gpiod_set_value(stk->reset_gpio, 0);
171 gpiod_set_value(stk->enable_gpio, 0);
172 ret = regulator_enable(stk->supplies[IOVCC].consumer);
177 ret = regulator_enable(stk->supplies[POWER].consumer);
182 gpiod_set_value(stk->enable_gpio, 1);
184 gpiod_set_value(stk->reset_gpio, 1);
186 ret = stk_panel_init(stk);
192 ret = stk_panel_on(stk);
198 stk->prepared = true;
203 regulator_disable(stk->supplies[POWER].consumer);
205 regulator_disable(stk->supplies[IOVCC].consumer);
206 gpiod_set_value(stk->reset_gpio, 0);
207 gpiod_set_value(stk->enable_gpio, 0);
309 static int stk_panel_add(struct stk_panel *stk)
311 struct device *dev = &stk->dsi->dev;
314 stk->mode = &default_mode;
316 stk->supplies[IOVCC].supply = "iovcc";
317 stk->supplies[POWER].supply = "power";
318 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(stk->supplies), stk->supplies);
324 stk->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
325 if (IS_ERR(stk->reset_gpio)) {
326 ret = PTR_ERR(stk->reset_gpio);
331 stk->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
332 if (IS_ERR(stk->enable_gpio)) {
333 ret = PTR_ERR(stk->enable_gpio);
338 stk->backlight = drm_panel_create_dsi_backlight(stk->dsi);
339 if (IS_ERR(stk->backlight)) {
340 ret = PTR_ERR(stk->backlight);
345 drm_panel_init(&stk->base, &stk->dsi->dev, &stk_panel_funcs,
348 drm_panel_add(&stk->base);
355 struct stk_panel *stk;
362 stk = devm_kzalloc(&dsi->dev, sizeof(*stk), GFP_KERNEL);
363 if (!stk)
366 mipi_dsi_set_drvdata(dsi, stk);
368 stk->dsi = dsi;
370 ret = stk_panel_add(stk);
376 drm_panel_remove(&stk->base);
383 struct stk_panel *stk = mipi_dsi_get_drvdata(dsi);
391 drm_panel_remove(&stk->base);