• Home
  • Raw
  • Download

Lines Matching refs:ctx

131 static int s6e63m0_clear_error(struct s6e63m0 *ctx)  in s6e63m0_clear_error()  argument
133 int ret = ctx->error; in s6e63m0_clear_error()
135 ctx->error = 0; in s6e63m0_clear_error()
139 static int s6e63m0_spi_write_word(struct s6e63m0 *ctx, u16 data) in s6e63m0_spi_write_word() argument
141 struct spi_device *spi = to_spi_device(ctx->dev); in s6e63m0_spi_write_word()
154 static void s6e63m0_dcs_write(struct s6e63m0 *ctx, const u8 *data, size_t len) in s6e63m0_dcs_write() argument
158 if (ctx->error < 0 || len == 0) in s6e63m0_dcs_write()
161 DRM_DEV_DEBUG(ctx->dev, "writing dcs seq: %*ph\n", (int)len, data); in s6e63m0_dcs_write()
162 ret = s6e63m0_spi_write_word(ctx, *data); in s6e63m0_dcs_write()
166 ret = s6e63m0_spi_write_word(ctx, *data | DATA_MASK); in s6e63m0_dcs_write()
170 DRM_DEV_ERROR(ctx->dev, "error %d writing dcs seq: %*ph\n", ret, in s6e63m0_dcs_write()
172 ctx->error = ret; in s6e63m0_dcs_write()
178 #define s6e63m0_dcs_write_seq_static(ctx, seq ...) \ argument
181 s6e63m0_dcs_write(ctx, d, ARRAY_SIZE(d)); \
184 static void s6e63m0_init(struct s6e63m0 *ctx) in s6e63m0_init() argument
186 s6e63m0_dcs_write_seq_static(ctx, MCS_PANELCTL, in s6e63m0_init()
190 s6e63m0_dcs_write_seq_static(ctx, MCS_DISCTL, in s6e63m0_init()
192 s6e63m0_dcs_write_seq_static(ctx, MCS_IFCTL, in s6e63m0_init()
195 s6e63m0_dcs_write_seq_static(ctx, MCS_PGAMMACTL, in s6e63m0_init()
200 s6e63m0_dcs_write_seq_static(ctx, MCS_PGAMMACTL, in s6e63m0_init()
203 s6e63m0_dcs_write_seq_static(ctx, MCS_SRCCTL, in s6e63m0_init()
205 s6e63m0_dcs_write_seq_static(ctx, 0xb3, in s6e63m0_init()
208 s6e63m0_dcs_write_seq_static(ctx, 0xb5, in s6e63m0_init()
215 s6e63m0_dcs_write_seq_static(ctx, 0xb6, in s6e63m0_init()
220 s6e63m0_dcs_write_seq_static(ctx, 0xb7, in s6e63m0_init()
229 s6e63m0_dcs_write_seq_static(ctx, 0xb9, in s6e63m0_init()
236 s6e63m0_dcs_write_seq_static(ctx, 0xba, in s6e63m0_init()
241 s6e63m0_dcs_write_seq_static(ctx, MCS_BCMODE, in s6e63m0_init()
247 s6e63m0_dcs_write_seq_static(ctx, 0xb2, in s6e63m0_init()
250 s6e63m0_dcs_write_seq_static(ctx, MCS_MIECTL1, in s6e63m0_init()
253 s6e63m0_dcs_write_seq_static(ctx, MCS_ELVSS_ON, in s6e63m0_init()
256 s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_EXIT_SLEEP_MODE); in s6e63m0_init()
259 static int s6e63m0_power_on(struct s6e63m0 *ctx) in s6e63m0_power_on() argument
263 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_on()
269 gpiod_set_value(ctx->reset_gpio, 0); in s6e63m0_power_on()
275 static int s6e63m0_power_off(struct s6e63m0 *ctx) in s6e63m0_power_off() argument
279 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_off()
282 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_off()
291 struct s6e63m0 *ctx = panel_to_s6e63m0(panel); in s6e63m0_disable() local
293 if (!ctx->enabled) in s6e63m0_disable()
296 backlight_disable(ctx->bl_dev); in s6e63m0_disable()
298 s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE); in s6e63m0_disable()
301 ctx->enabled = false; in s6e63m0_disable()
308 struct s6e63m0 *ctx = panel_to_s6e63m0(panel); in s6e63m0_unprepare() local
311 if (!ctx->prepared) in s6e63m0_unprepare()
314 s6e63m0_clear_error(ctx); in s6e63m0_unprepare()
316 ret = s6e63m0_power_off(ctx); in s6e63m0_unprepare()
320 ctx->prepared = false; in s6e63m0_unprepare()
327 struct s6e63m0 *ctx = panel_to_s6e63m0(panel); in s6e63m0_prepare() local
330 if (ctx->prepared) in s6e63m0_prepare()
333 ret = s6e63m0_power_on(ctx); in s6e63m0_prepare()
337 s6e63m0_init(ctx); in s6e63m0_prepare()
339 ret = s6e63m0_clear_error(ctx); in s6e63m0_prepare()
344 ctx->prepared = true; in s6e63m0_prepare()
351 struct s6e63m0 *ctx = panel_to_s6e63m0(panel); in s6e63m0_enable() local
353 if (ctx->enabled) in s6e63m0_enable()
356 s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON); in s6e63m0_enable()
358 backlight_enable(ctx->bl_dev); in s6e63m0_enable()
360 ctx->enabled = true; in s6e63m0_enable()
396 struct s6e63m0 *ctx = bl_get_data(bd); in s6e63m0_set_brightness() local
401 s6e63m0_dcs_write(ctx, s6e63m0_gamma_22[brightness], in s6e63m0_set_brightness()
405 s6e63m0_dcs_write_seq_static(ctx, MCS_PGAMMACTL, 0x01); in s6e63m0_set_brightness()
407 return s6e63m0_clear_error(ctx); in s6e63m0_set_brightness()
414 static int s6e63m0_backlight_register(struct s6e63m0 *ctx) in s6e63m0_backlight_register() argument
421 struct device *dev = ctx->dev; in s6e63m0_backlight_register()
424 ctx->bl_dev = devm_backlight_device_register(dev, "panel", dev, ctx, in s6e63m0_backlight_register()
427 if (IS_ERR(ctx->bl_dev)) { in s6e63m0_backlight_register()
428 ret = PTR_ERR(ctx->bl_dev); in s6e63m0_backlight_register()
439 struct s6e63m0 *ctx; in s6e63m0_probe() local
442 ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL); in s6e63m0_probe()
443 if (!ctx) in s6e63m0_probe()
446 spi_set_drvdata(spi, ctx); in s6e63m0_probe()
448 ctx->dev = dev; in s6e63m0_probe()
449 ctx->enabled = false; in s6e63m0_probe()
450 ctx->prepared = false; in s6e63m0_probe()
452 ctx->supplies[0].supply = "vdd3"; in s6e63m0_probe()
453 ctx->supplies[1].supply = "vci"; in s6e63m0_probe()
454 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in s6e63m0_probe()
455 ctx->supplies); in s6e63m0_probe()
461 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in s6e63m0_probe()
462 if (IS_ERR(ctx->reset_gpio)) { in s6e63m0_probe()
464 PTR_ERR(ctx->reset_gpio)); in s6e63m0_probe()
465 return PTR_ERR(ctx->reset_gpio); in s6e63m0_probe()
476 drm_panel_init(&ctx->panel); in s6e63m0_probe()
477 ctx->panel.dev = dev; in s6e63m0_probe()
478 ctx->panel.funcs = &s6e63m0_drm_funcs; in s6e63m0_probe()
480 ret = s6e63m0_backlight_register(ctx); in s6e63m0_probe()
484 return drm_panel_add(&ctx->panel); in s6e63m0_probe()
489 struct s6e63m0 *ctx = spi_get_drvdata(spi); in s6e63m0_remove() local
491 drm_panel_remove(&ctx->panel); in s6e63m0_remove()