Lines Matching +full:dclk +full:- +full:div
1 // SPDX-License-Identifier: GPL-2.0-only
246 return regmap_bulk_write(ssd130x->regmap, SSD13XX_DATA, values, count); in ssd130x_write_data()
268 ret = regmap_write(ssd130x->regmap, SSD13XX_COMMAND, value); in ssd130x_write_cmd()
271 } while (--count); in ssd130x_write_cmd()
283 u8 col_end = col_start + cols - 1; in ssd130x_set_col_range()
286 if (col_start == ssd130x->col_start && col_end == ssd130x->col_end) in ssd130x_set_col_range()
293 ssd130x->col_start = col_start; in ssd130x_set_col_range()
294 ssd130x->col_end = col_end; in ssd130x_set_col_range()
301 u8 page_end = page_start + pages - 1; in ssd130x_set_page_range()
304 if (page_start == ssd130x->page_start && page_end == ssd130x->page_end) in ssd130x_set_page_range()
311 ssd130x->page_start = page_start; in ssd130x_set_page_range()
312 ssd130x->page_end = page_end; in ssd130x_set_page_range()
338 struct device *dev = ssd130x->dev; in ssd130x_pwm_enable()
341 ssd130x->pwm = pwm_get(dev, NULL); in ssd130x_pwm_enable()
342 if (IS_ERR(ssd130x->pwm)) { in ssd130x_pwm_enable()
344 return PTR_ERR(ssd130x->pwm); in ssd130x_pwm_enable()
347 pwm_init_state(ssd130x->pwm, &pwmstate); in ssd130x_pwm_enable()
349 pwm_apply_might_sleep(ssd130x->pwm, &pwmstate); in ssd130x_pwm_enable()
352 pwm_enable(ssd130x->pwm); in ssd130x_pwm_enable()
355 ssd130x->pwm->label, pwm_get_period(ssd130x->pwm)); in ssd130x_pwm_enable()
362 if (!ssd130x->reset) in ssd130x_reset()
366 gpiod_set_value_cansleep(ssd130x->reset, 1); in ssd130x_reset()
368 gpiod_set_value_cansleep(ssd130x->reset, 0); in ssd130x_reset()
374 struct device *dev = ssd130x->dev; in ssd130x_power_on()
379 ret = regulator_enable(ssd130x->vcc_reg); in ssd130x_power_on()
385 if (ssd130x->device_info->need_pwm) { in ssd130x_power_on()
389 regulator_disable(ssd130x->vcc_reg); in ssd130x_power_on()
399 pwm_disable(ssd130x->pwm); in ssd130x_power_off()
400 pwm_put(ssd130x->pwm); in ssd130x_power_off()
402 regulator_disable(ssd130x->vcc_reg); in ssd130x_power_off()
407 u32 precharge, dclk, com_invdir, compins, chargepump, seg_remap; in ssd130x_init() local
412 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_CONTRAST, ssd130x->contrast); in ssd130x_init()
416 /* Set segment re-map */ in ssd130x_init()
418 SSD13XX_SET_SEG_REMAP_SET(ssd130x->seg_remap)); in ssd130x_init()
425 SSD130X_SET_COM_SCAN_DIR_SET(ssd130x->com_invdir)); in ssd130x_init()
431 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_SET_MULTIPLEX_RATIO, ssd130x->height - 1); in ssd130x_init()
436 ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_DISPLAY_OFFSET, ssd130x->com_offset); in ssd130x_init()
441 dclk = (SSD130X_SET_CLOCK_DIV_SET(ssd130x->dclk_div - 1) | in ssd130x_init()
442 SSD130X_SET_CLOCK_FREQ_SET(ssd130x->dclk_frq)); in ssd130x_init()
443 ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_CLOCK_FREQ, dclk); in ssd130x_init()
448 if (ssd130x->area_color_enable || ssd130x->low_power) { in ssd130x_init()
451 if (ssd130x->area_color_enable) in ssd130x_init()
454 if (ssd130x->low_power) in ssd130x_init()
463 precharge = (SSD130X_SET_PRECHARGE_PERIOD1_SET(ssd130x->prechargep1) | in ssd130x_init()
464 SSD130X_SET_PRECHARGE_PERIOD2_SET(ssd130x->prechargep2)); in ssd130x_init()
473 * property "solomon,com-seq". The value 0b means scan from COM0 to in ssd130x_init()
474 * COM[N - 1] while 1b means scan from COM[N - 1] to COM0. in ssd130x_init()
476 scan_mode = !ssd130x->com_seq; in ssd130x_init()
478 SSD130X_SET_COM_PINS_CONFIG2_SET(ssd130x->com_lrremap)); in ssd130x_init()
484 ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_VCOMH, ssd130x->vcomh); in ssd130x_init()
488 /* Turn on the DC-DC Charge Pump */ in ssd130x_init()
491 if (ssd130x->device_info->need_chargepump) in ssd130x_init()
499 if (ssd130x->lookup_table_set) { in ssd130x_init()
506 for (i = 0; i < ARRAY_SIZE(ssd130x->lookup_table); i++) { in ssd130x_init()
507 u8 val = ssd130x->lookup_table[i]; in ssd130x_init()
510 dev_warn(ssd130x->dev, in ssd130x_init()
520 if (ssd130x->page_address_mode) in ssd130x_init()
540 ssd130x->width / SSD132X_SEGMENT_WIDTH - 1); in ssd132x_init()
545 ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, 0x00, ssd130x->height - 1); in ssd132x_init()
550 * Re-map for Column Address, Nibble and COM in ssd132x_init()
572 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_SET_MULTIPLEX_RATIO, ssd130x->height - 1); in ssd132x_init()
596 /* Set pre-charge period */ in ssd132x_init()
601 /* Set pre-charge voltage */ in ssd132x_init()
611 /* Enable second pre-charge and internal VSL */ in ssd132x_init()
644 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_COL_RANGE, 0x00, ssd130x->width - 1); in ssd133x_init()
649 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_ROW_RANGE, 0x00, ssd130x->height - 1); in ssd133x_init()
678 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_SET_MULTIPLEX_RATIO, ssd130x->height - 1); in ssd133x_init()
702 /* Set pre-charge A */ in ssd133x_init()
707 /* Set pre-charge B */ in ssd133x_init()
712 /* Set pre-charge C */ in ssd133x_init()
717 /* Set pre-charge level */ in ssd133x_init()
734 unsigned int x = rect->x1; in ssd130x_update_rect()
735 unsigned int y = rect->y1; in ssd130x_update_rect()
741 struct drm_device *drm = &ssd130x->drm; in ssd130x_update_rect()
756 * wide. Each letter-number combination is a bit that controls in ssd130x_update_rect()
776 if (!ssd130x->page_address_mode) { in ssd130x_update_rect()
780 ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset + x, width); in ssd130x_update_rect()
784 page_start = ssd130x->page_offset + y / page_height; in ssd130x_update_rect()
794 if (page_height * (y / page_height + i + 1) > ssd130x->height) in ssd130x_update_rect()
795 m = ssd130x->height % page_height; in ssd130x_update_rect()
814 if (ssd130x->page_address_mode) { in ssd130x_update_rect()
816 ssd130x->page_offset + i, in ssd130x_update_rect()
817 ssd130x->col_offset + x); in ssd130x_update_rect()
830 if (!ssd130x->page_address_mode) in ssd130x_update_rect()
840 unsigned int x = rect->x1; in ssd132x_update_rect()
841 unsigned int y = rect->y1; in ssd132x_update_rect()
847 struct drm_device *drm = &ssd130x->drm; in ssd132x_update_rect()
856 * COM0 to COM[N - 1] are the rows and SEG0 to SEG[M - 1] are in ssd132x_update_rect()
859 * Each Segment has a 4-bit pixel and each Common output has a in ssd132x_update_rect()
869 ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_COL_RANGE, x / segment_width, columns - 1); in ssd132x_update_rect()
874 ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, y, rows - 1); in ssd132x_update_rect()
898 unsigned int x = rect->x1; in ssd133x_update_rect()
899 unsigned int y = rect->y1; in ssd133x_update_rect()
906 * COM0 to COM[N - 1] are the rows and SEG0 to SEG[M - 1] are in ssd133x_update_rect()
909 * Each Segment has a 8-bit pixel and each Common output has a in ssd133x_update_rect()
915 * sub-pixels for color A, B and C. These have 3 bit, 3 bit and in ssd133x_update_rect()
920 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_COL_RANGE, x, columns - 1); in ssd133x_update_rect()
925 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_ROW_RANGE, y, rows - 1); in ssd133x_update_rect()
937 unsigned int pages = DIV_ROUND_UP(ssd130x->height, SSD130X_PAGE_HEIGHT); in ssd130x_clear_screen()
938 unsigned int width = ssd130x->width; in ssd130x_clear_screen()
941 if (!ssd130x->page_address_mode) { in ssd130x_clear_screen()
945 ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset, width); in ssd130x_clear_screen()
949 ret = ssd130x_set_page_range(ssd130x, ssd130x->page_offset, pages); in ssd130x_clear_screen()
964 ssd130x->page_offset + i, in ssd130x_clear_screen()
965 ssd130x->col_offset); in ssd130x_clear_screen()
978 unsigned int columns = DIV_ROUND_UP(ssd130x->height, SSD132X_SEGMENT_WIDTH); in ssd132x_clear_screen()
979 unsigned int height = ssd130x->height; in ssd132x_clear_screen()
995 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd133x_clear_screen()
997 memset(data_array, 0, pitch * ssd130x->height); in ssd133x_clear_screen()
1000 ssd130x_write_data(ssd130x, data_array, pitch * ssd130x->height); in ssd133x_clear_screen()
1009 struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev); in ssd130x_fb_blit_rect()
1015 rect->y1 = round_down(rect->y1, SSD130X_PAGE_HEIGHT); in ssd130x_fb_blit_rect()
1016 rect->y2 = min_t(unsigned int, round_up(rect->y2, SSD130X_PAGE_HEIGHT), ssd130x->height); in ssd130x_fb_blit_rect()
1040 struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev); in ssd132x_fb_blit_rect()
1046 rect->x1 = round_down(rect->x1, SSD132X_SEGMENT_WIDTH); in ssd132x_fb_blit_rect()
1047 rect->x2 = min_t(unsigned int, round_up(rect->x2, SSD132X_SEGMENT_WIDTH), in ssd132x_fb_blit_rect()
1048 ssd130x->width); in ssd132x_fb_blit_rect()
1069 struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev); in ssd133x_fb_blit_rect()
1076 return -EINVAL; in ssd133x_fb_blit_rect()
1097 struct drm_device *drm = plane->dev; in ssd130x_primary_plane_atomic_check()
1101 struct drm_shadow_plane_state *shadow_plane_state = &ssd130x_state->base; in ssd130x_primary_plane_atomic_check()
1102 struct drm_crtc *crtc = plane_state->crtc; in ssd130x_primary_plane_atomic_check()
1117 else if (!plane_state->visible) in ssd130x_primary_plane_atomic_check()
1122 return -EINVAL; in ssd130x_primary_plane_atomic_check()
1124 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd130x_primary_plane_atomic_check()
1126 if (plane_state->fb->format != fi) { in ssd130x_primary_plane_atomic_check()
1130 buf = drm_format_conv_state_reserve(&shadow_plane_state->fmtcnv_state, in ssd130x_primary_plane_atomic_check()
1133 return -ENOMEM; in ssd130x_primary_plane_atomic_check()
1136 ssd130x_state->buffer = kcalloc(pitch, ssd130x->height, GFP_KERNEL); in ssd130x_primary_plane_atomic_check()
1137 if (!ssd130x_state->buffer) in ssd130x_primary_plane_atomic_check()
1138 return -ENOMEM; in ssd130x_primary_plane_atomic_check()
1146 struct drm_device *drm = plane->dev; in ssd132x_primary_plane_atomic_check()
1150 struct drm_shadow_plane_state *shadow_plane_state = &ssd130x_state->base; in ssd132x_primary_plane_atomic_check()
1151 struct drm_crtc *crtc = plane_state->crtc; in ssd132x_primary_plane_atomic_check()
1166 else if (!plane_state->visible) in ssd132x_primary_plane_atomic_check()
1171 return -EINVAL; in ssd132x_primary_plane_atomic_check()
1173 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd132x_primary_plane_atomic_check()
1175 if (plane_state->fb->format != fi) { in ssd132x_primary_plane_atomic_check()
1179 buf = drm_format_conv_state_reserve(&shadow_plane_state->fmtcnv_state, in ssd132x_primary_plane_atomic_check()
1182 return -ENOMEM; in ssd132x_primary_plane_atomic_check()
1185 ssd130x_state->buffer = kcalloc(pitch, ssd130x->height, GFP_KERNEL); in ssd132x_primary_plane_atomic_check()
1186 if (!ssd130x_state->buffer) in ssd132x_primary_plane_atomic_check()
1187 return -ENOMEM; in ssd132x_primary_plane_atomic_check()
1196 struct drm_crtc *crtc = plane_state->crtc; in ssd133x_primary_plane_atomic_check()
1209 else if (!plane_state->visible) in ssd133x_primary_plane_atomic_check()
1221 struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd130x_primary_plane_atomic_update()
1224 struct drm_framebuffer *fb = plane_state->fb; in ssd130x_primary_plane_atomic_update()
1226 struct drm_device *drm = plane->dev; in ssd130x_primary_plane_atomic_update()
1236 dst_clip = plane_state->dst; in ssd130x_primary_plane_atomic_update()
1241 ssd130x_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip, in ssd130x_primary_plane_atomic_update()
1242 ssd130x_plane_state->buffer, in ssd130x_primary_plane_atomic_update()
1243 ssd130x_crtc_state->data_array, in ssd130x_primary_plane_atomic_update()
1244 &shadow_plane_state->fmtcnv_state); in ssd130x_primary_plane_atomic_update()
1256 struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd132x_primary_plane_atomic_update()
1259 struct drm_framebuffer *fb = plane_state->fb; in ssd132x_primary_plane_atomic_update()
1261 struct drm_device *drm = plane->dev; in ssd132x_primary_plane_atomic_update()
1271 dst_clip = plane_state->dst; in ssd132x_primary_plane_atomic_update()
1276 ssd132x_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip, in ssd132x_primary_plane_atomic_update()
1277 ssd130x_plane_state->buffer, in ssd132x_primary_plane_atomic_update()
1278 ssd130x_crtc_state->data_array, in ssd132x_primary_plane_atomic_update()
1279 &shadow_plane_state->fmtcnv_state); in ssd132x_primary_plane_atomic_update()
1291 struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd133x_primary_plane_atomic_update()
1293 struct drm_framebuffer *fb = plane_state->fb; in ssd133x_primary_plane_atomic_update()
1295 struct drm_device *drm = plane->dev; in ssd133x_primary_plane_atomic_update()
1305 dst_clip = plane_state->dst; in ssd133x_primary_plane_atomic_update()
1310 ssd133x_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip, in ssd133x_primary_plane_atomic_update()
1311 ssd130x_crtc_state->data_array, in ssd133x_primary_plane_atomic_update()
1312 &shadow_plane_state->fmtcnv_state); in ssd133x_primary_plane_atomic_update()
1321 struct drm_device *drm = plane->dev; in ssd130x_primary_plane_atomic_disable()
1328 if (!plane_state->crtc) in ssd130x_primary_plane_atomic_disable()
1331 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd130x_primary_plane_atomic_disable()
1337 ssd130x_clear_screen(ssd130x, ssd130x_crtc_state->data_array); in ssd130x_primary_plane_atomic_disable()
1345 struct drm_device *drm = plane->dev; in ssd132x_primary_plane_atomic_disable()
1352 if (!plane_state->crtc) in ssd132x_primary_plane_atomic_disable()
1355 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd132x_primary_plane_atomic_disable()
1361 ssd132x_clear_screen(ssd130x, ssd130x_crtc_state->data_array); in ssd132x_primary_plane_atomic_disable()
1369 struct drm_device *drm = plane->dev; in ssd133x_primary_plane_atomic_disable()
1376 if (!plane_state->crtc) in ssd133x_primary_plane_atomic_disable()
1379 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd133x_primary_plane_atomic_disable()
1385 ssd133x_clear_screen(ssd130x, ssd130x_crtc_state->data_array); in ssd133x_primary_plane_atomic_disable()
1395 WARN_ON(plane->state); in ssd130x_primary_plane_reset()
1401 __drm_gem_reset_shadow_plane(plane, &ssd130x_state->base); in ssd130x_primary_plane_reset()
1410 if (WARN_ON(!plane->state)) in ssd130x_primary_plane_duplicate_state()
1413 old_ssd130x_state = to_ssd130x_plane_state(plane->state); in ssd130x_primary_plane_duplicate_state()
1419 ssd130x_state->buffer = NULL; in ssd130x_primary_plane_duplicate_state()
1421 new_shadow_plane_state = &ssd130x_state->base; in ssd130x_primary_plane_duplicate_state()
1425 return &new_shadow_plane_state->base; in ssd130x_primary_plane_duplicate_state()
1433 kfree(ssd130x_state->buffer); in ssd130x_primary_plane_destroy_state()
1435 __drm_gem_destroy_shadow_plane_state(&ssd130x_state->base); in ssd130x_primary_plane_destroy_state()
1473 struct ssd130x_device *ssd130x = drm_to_ssd130x(crtc->dev); in ssd130x_crtc_mode_valid()
1475 if (mode->hdisplay != ssd130x->mode.hdisplay && in ssd130x_crtc_mode_valid()
1476 mode->vdisplay != ssd130x->mode.vdisplay) in ssd130x_crtc_mode_valid()
1478 else if (mode->hdisplay != ssd130x->mode.hdisplay) in ssd130x_crtc_mode_valid()
1480 else if (mode->vdisplay != ssd130x->mode.vdisplay) in ssd130x_crtc_mode_valid()
1489 struct drm_device *drm = crtc->dev; in ssd130x_crtc_atomic_check()
1493 unsigned int pages = DIV_ROUND_UP(ssd130x->height, SSD130X_PAGE_HEIGHT); in ssd130x_crtc_atomic_check()
1500 ssd130x_state->data_array = kmalloc(ssd130x->width * pages, GFP_KERNEL); in ssd130x_crtc_atomic_check()
1501 if (!ssd130x_state->data_array) in ssd130x_crtc_atomic_check()
1502 return -ENOMEM; in ssd130x_crtc_atomic_check()
1510 struct drm_device *drm = crtc->dev; in ssd132x_crtc_atomic_check()
1514 unsigned int columns = DIV_ROUND_UP(ssd130x->width, SSD132X_SEGMENT_WIDTH); in ssd132x_crtc_atomic_check()
1521 ssd130x_state->data_array = kmalloc(columns * ssd130x->height, GFP_KERNEL); in ssd132x_crtc_atomic_check()
1522 if (!ssd130x_state->data_array) in ssd132x_crtc_atomic_check()
1523 return -ENOMEM; in ssd132x_crtc_atomic_check()
1531 struct drm_device *drm = crtc->dev; in ssd133x_crtc_atomic_check()
1540 return -EINVAL; in ssd133x_crtc_atomic_check()
1546 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd133x_crtc_atomic_check()
1548 ssd130x_state->data_array = kmalloc(pitch * ssd130x->height, GFP_KERNEL); in ssd133x_crtc_atomic_check()
1549 if (!ssd130x_state->data_array) in ssd133x_crtc_atomic_check()
1550 return -ENOMEM; in ssd133x_crtc_atomic_check()
1560 WARN_ON(crtc->state); in ssd130x_crtc_reset()
1566 __drm_atomic_helper_crtc_reset(crtc, &ssd130x_state->base); in ssd130x_crtc_reset()
1574 if (WARN_ON(!crtc->state)) in ssd130x_crtc_duplicate_state()
1577 old_ssd130x_state = to_ssd130x_crtc_state(crtc->state); in ssd130x_crtc_duplicate_state()
1583 ssd130x_state->data_array = NULL; in ssd130x_crtc_duplicate_state()
1585 __drm_atomic_helper_crtc_duplicate_state(crtc, &ssd130x_state->base); in ssd130x_crtc_duplicate_state()
1587 return &ssd130x_state->base; in ssd130x_crtc_duplicate_state()
1595 kfree(ssd130x_state->data_array); in ssd130x_crtc_destroy_state()
1634 struct drm_device *drm = encoder->dev; in ssd130x_encoder_atomic_enable()
1648 backlight_enable(ssd130x->bl_dev); in ssd130x_encoder_atomic_enable()
1660 struct drm_device *drm = encoder->dev; in ssd132x_encoder_atomic_enable()
1674 backlight_enable(ssd130x->bl_dev); in ssd132x_encoder_atomic_enable()
1685 struct drm_device *drm = encoder->dev; in ssd133x_encoder_atomic_enable()
1699 backlight_enable(ssd130x->bl_dev); in ssd133x_encoder_atomic_enable()
1710 struct drm_device *drm = encoder->dev; in ssd130x_encoder_atomic_disable()
1713 backlight_disable(ssd130x->bl_dev); in ssd130x_encoder_atomic_disable()
1741 struct ssd130x_device *ssd130x = drm_to_ssd130x(connector->dev); in ssd130x_connector_get_modes()
1743 struct device *dev = ssd130x->dev; in ssd130x_connector_get_modes()
1745 mode = drm_mode_duplicate(connector->dev, &ssd130x->mode); in ssd130x_connector_get_modes()
1752 drm_set_preferred_mode(connector, mode->hdisplay, mode->vdisplay); in ssd130x_connector_get_modes()
1800 ssd130x->contrast = brightness; in ssd130x_update_bl()
1806 ret = ssd130x_write_cmd(ssd130x, 1, ssd130x->contrast); in ssd130x_update_bl()
1819 struct device *dev = ssd130x->dev; in ssd130x_parse_properties()
1821 if (device_property_read_u32(dev, "solomon,width", &ssd130x->width)) in ssd130x_parse_properties()
1822 ssd130x->width = ssd130x->device_info->default_width; in ssd130x_parse_properties()
1824 if (device_property_read_u32(dev, "solomon,height", &ssd130x->height)) in ssd130x_parse_properties()
1825 ssd130x->height = ssd130x->device_info->default_height; in ssd130x_parse_properties()
1827 if (device_property_read_u32(dev, "solomon,page-offset", &ssd130x->page_offset)) in ssd130x_parse_properties()
1828 ssd130x->page_offset = 1; in ssd130x_parse_properties()
1830 if (device_property_read_u32(dev, "solomon,col-offset", &ssd130x->col_offset)) in ssd130x_parse_properties()
1831 ssd130x->col_offset = 0; in ssd130x_parse_properties()
1833 if (device_property_read_u32(dev, "solomon,com-offset", &ssd130x->com_offset)) in ssd130x_parse_properties()
1834 ssd130x->com_offset = 0; in ssd130x_parse_properties()
1836 if (device_property_read_u32(dev, "solomon,prechargep1", &ssd130x->prechargep1)) in ssd130x_parse_properties()
1837 ssd130x->prechargep1 = 2; in ssd130x_parse_properties()
1839 if (device_property_read_u32(dev, "solomon,prechargep2", &ssd130x->prechargep2)) in ssd130x_parse_properties()
1840 ssd130x->prechargep2 = 2; in ssd130x_parse_properties()
1842 if (!device_property_read_u8_array(dev, "solomon,lookup-table", in ssd130x_parse_properties()
1843 ssd130x->lookup_table, in ssd130x_parse_properties()
1844 ARRAY_SIZE(ssd130x->lookup_table))) in ssd130x_parse_properties()
1845 ssd130x->lookup_table_set = 1; in ssd130x_parse_properties()
1847 ssd130x->seg_remap = !device_property_read_bool(dev, "solomon,segment-no-remap"); in ssd130x_parse_properties()
1848 ssd130x->com_seq = device_property_read_bool(dev, "solomon,com-seq"); in ssd130x_parse_properties()
1849 ssd130x->com_lrremap = device_property_read_bool(dev, "solomon,com-lrremap"); in ssd130x_parse_properties()
1850 ssd130x->com_invdir = device_property_read_bool(dev, "solomon,com-invdir"); in ssd130x_parse_properties()
1851 ssd130x->area_color_enable = in ssd130x_parse_properties()
1852 device_property_read_bool(dev, "solomon,area-color-enable"); in ssd130x_parse_properties()
1853 ssd130x->low_power = device_property_read_bool(dev, "solomon,low-power"); in ssd130x_parse_properties()
1855 ssd130x->contrast = 127; in ssd130x_parse_properties()
1856 ssd130x->vcomh = ssd130x->device_info->default_vcomh; in ssd130x_parse_properties()
1859 if (device_property_read_u32(dev, "solomon,dclk-div", &ssd130x->dclk_div)) in ssd130x_parse_properties()
1860 ssd130x->dclk_div = ssd130x->device_info->default_dclk_div; in ssd130x_parse_properties()
1861 if (device_property_read_u32(dev, "solomon,dclk-frq", &ssd130x->dclk_frq)) in ssd130x_parse_properties()
1862 ssd130x->dclk_frq = ssd130x->device_info->default_dclk_frq; in ssd130x_parse_properties()
1867 enum ssd130x_family_ids family_id = ssd130x->device_info->family_id; in ssd130x_init_modeset()
1868 struct drm_display_mode *mode = &ssd130x->mode; in ssd130x_init_modeset()
1869 struct device *dev = ssd130x->dev; in ssd130x_init_modeset()
1870 struct drm_device *drm = &ssd130x->drm; in ssd130x_init_modeset()
1888 mode->type = DRM_MODE_TYPE_DRIVER; in ssd130x_init_modeset()
1889 mode->clock = 1; in ssd130x_init_modeset()
1890 mode->hdisplay = mode->htotal = ssd130x->width; in ssd130x_init_modeset()
1891 mode->hsync_start = mode->hsync_end = ssd130x->width; in ssd130x_init_modeset()
1892 mode->vdisplay = mode->vtotal = ssd130x->height; in ssd130x_init_modeset()
1893 mode->vsync_start = mode->vsync_end = ssd130x->height; in ssd130x_init_modeset()
1894 mode->width_mm = 27; in ssd130x_init_modeset()
1895 mode->height_mm = 27; in ssd130x_init_modeset()
1897 max_width = max_t(unsigned long, mode->hdisplay, DRM_SHADOW_PLANE_MAX_WIDTH); in ssd130x_init_modeset()
1898 max_height = max_t(unsigned long, mode->vdisplay, DRM_SHADOW_PLANE_MAX_HEIGHT); in ssd130x_init_modeset()
1900 drm->mode_config.min_width = mode->hdisplay; in ssd130x_init_modeset()
1901 drm->mode_config.max_width = max_width; in ssd130x_init_modeset()
1902 drm->mode_config.min_height = mode->vdisplay; in ssd130x_init_modeset()
1903 drm->mode_config.max_height = max_height; in ssd130x_init_modeset()
1904 drm->mode_config.preferred_depth = 24; in ssd130x_init_modeset()
1905 drm->mode_config.funcs = &ssd130x_mode_config_funcs; in ssd130x_init_modeset()
1909 primary_plane = &ssd130x->primary_plane; in ssd130x_init_modeset()
1924 crtc = &ssd130x->crtc; in ssd130x_init_modeset()
1936 encoder = &ssd130x->encoder; in ssd130x_init_modeset()
1946 encoder->possible_crtcs = drm_crtc_mask(crtc); in ssd130x_init_modeset()
1950 connector = &ssd130x->connector; in ssd130x_init_modeset()
1973 struct device *dev = ssd130x->dev; in ssd130x_get_resources()
1975 ssd130x->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in ssd130x_get_resources()
1976 if (IS_ERR(ssd130x->reset)) in ssd130x_get_resources()
1977 return dev_err_probe(dev, PTR_ERR(ssd130x->reset), in ssd130x_get_resources()
1980 ssd130x->vcc_reg = devm_regulator_get(dev, "vcc"); in ssd130x_get_resources()
1981 if (IS_ERR(ssd130x->vcc_reg)) in ssd130x_get_resources()
1982 return dev_err_probe(dev, PTR_ERR(ssd130x->vcc_reg), in ssd130x_get_resources()
2001 drm = &ssd130x->drm; in ssd130x_probe()
2003 ssd130x->dev = dev; in ssd130x_probe()
2004 ssd130x->regmap = regmap; in ssd130x_probe()
2005 ssd130x->device_info = device_get_match_data(dev); in ssd130x_probe()
2007 if (ssd130x->device_info->page_mode_only) in ssd130x_probe()
2008 ssd130x->page_address_mode = 1; in ssd130x_probe()
2022 bl->props.brightness = ssd130x->contrast; in ssd130x_probe()
2023 bl->props.max_brightness = MAX_CONTRAST; in ssd130x_probe()
2024 ssd130x->bl_dev = bl; in ssd130x_probe()
2042 drm_dev_unplug(&ssd130x->drm); in ssd130x_remove()
2043 drm_atomic_helper_shutdown(&ssd130x->drm); in ssd130x_remove()
2049 drm_atomic_helper_shutdown(&ssd130x->drm); in ssd130x_shutdown()