Lines Matching +full:dclk +full:- +full:div

1 // SPDX-License-Identifier: GPL-2.0-only
245 return regmap_bulk_write(ssd130x->regmap, SSD13XX_DATA, values, count); in ssd130x_write_data()
267 ret = regmap_write(ssd130x->regmap, SSD13XX_COMMAND, value); in ssd130x_write_cmd()
270 } while (--count); in ssd130x_write_cmd()
282 u8 col_end = col_start + cols - 1; in ssd130x_set_col_range()
285 if (col_start == ssd130x->col_start && col_end == ssd130x->col_end) in ssd130x_set_col_range()
292 ssd130x->col_start = col_start; in ssd130x_set_col_range()
293 ssd130x->col_end = col_end; in ssd130x_set_col_range()
300 u8 page_end = page_start + pages - 1; in ssd130x_set_page_range()
303 if (page_start == ssd130x->page_start && page_end == ssd130x->page_end) in ssd130x_set_page_range()
310 ssd130x->page_start = page_start; in ssd130x_set_page_range()
311 ssd130x->page_end = page_end; in ssd130x_set_page_range()
337 struct device *dev = ssd130x->dev; in ssd130x_pwm_enable()
340 ssd130x->pwm = pwm_get(dev, NULL); in ssd130x_pwm_enable()
341 if (IS_ERR(ssd130x->pwm)) { in ssd130x_pwm_enable()
343 return PTR_ERR(ssd130x->pwm); in ssd130x_pwm_enable()
346 pwm_init_state(ssd130x->pwm, &pwmstate); in ssd130x_pwm_enable()
348 pwm_apply_might_sleep(ssd130x->pwm, &pwmstate); in ssd130x_pwm_enable()
351 pwm_enable(ssd130x->pwm); in ssd130x_pwm_enable()
354 ssd130x->pwm->label, pwm_get_period(ssd130x->pwm)); in ssd130x_pwm_enable()
361 if (!ssd130x->reset) in ssd130x_reset()
365 gpiod_set_value_cansleep(ssd130x->reset, 1); in ssd130x_reset()
367 gpiod_set_value_cansleep(ssd130x->reset, 0); in ssd130x_reset()
373 struct device *dev = ssd130x->dev; in ssd130x_power_on()
378 ret = regulator_enable(ssd130x->vcc_reg); in ssd130x_power_on()
384 if (ssd130x->device_info->need_pwm) { in ssd130x_power_on()
388 regulator_disable(ssd130x->vcc_reg); in ssd130x_power_on()
398 pwm_disable(ssd130x->pwm); in ssd130x_power_off()
399 pwm_put(ssd130x->pwm); in ssd130x_power_off()
401 regulator_disable(ssd130x->vcc_reg); in ssd130x_power_off()
406 u32 precharge, dclk, com_invdir, compins, chargepump, seg_remap; in ssd130x_init() local
411 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_CONTRAST, ssd130x->contrast); in ssd130x_init()
415 /* Set segment re-map */ in ssd130x_init()
417 SSD13XX_SET_SEG_REMAP_SET(ssd130x->seg_remap)); in ssd130x_init()
424 SSD130X_SET_COM_SCAN_DIR_SET(ssd130x->com_invdir)); in ssd130x_init()
430 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_SET_MULTIPLEX_RATIO, ssd130x->height - 1); in ssd130x_init()
435 ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_DISPLAY_OFFSET, ssd130x->com_offset); in ssd130x_init()
440 dclk = (SSD130X_SET_CLOCK_DIV_SET(ssd130x->dclk_div - 1) | in ssd130x_init()
441 SSD130X_SET_CLOCK_FREQ_SET(ssd130x->dclk_frq)); in ssd130x_init()
442 ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_CLOCK_FREQ, dclk); in ssd130x_init()
447 if (ssd130x->area_color_enable || ssd130x->low_power) { in ssd130x_init()
450 if (ssd130x->area_color_enable) in ssd130x_init()
453 if (ssd130x->low_power) in ssd130x_init()
462 precharge = (SSD130X_SET_PRECHARGE_PERIOD1_SET(ssd130x->prechargep1) | in ssd130x_init()
463 SSD130X_SET_PRECHARGE_PERIOD2_SET(ssd130x->prechargep2)); in ssd130x_init()
472 * property "solomon,com-seq". The value 0b means scan from COM0 to in ssd130x_init()
473 * COM[N - 1] while 1b means scan from COM[N - 1] to COM0. in ssd130x_init()
475 scan_mode = !ssd130x->com_seq; in ssd130x_init()
477 SSD130X_SET_COM_PINS_CONFIG2_SET(ssd130x->com_lrremap)); in ssd130x_init()
483 ret = ssd130x_write_cmd(ssd130x, 2, SSD130X_SET_VCOMH, ssd130x->vcomh); in ssd130x_init()
487 /* Turn on the DC-DC Charge Pump */ in ssd130x_init()
490 if (ssd130x->device_info->need_chargepump) in ssd130x_init()
498 if (ssd130x->lookup_table_set) { in ssd130x_init()
505 for (i = 0; i < ARRAY_SIZE(ssd130x->lookup_table); i++) { in ssd130x_init()
506 u8 val = ssd130x->lookup_table[i]; in ssd130x_init()
509 dev_warn(ssd130x->dev, in ssd130x_init()
519 if (ssd130x->page_address_mode) in ssd130x_init()
539 ssd130x->width / SSD132X_SEGMENT_WIDTH - 1); in ssd132x_init()
544 ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, 0x00, ssd130x->height - 1); in ssd132x_init()
549 * Re-map for Column Address, Nibble and COM in ssd132x_init()
571 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_SET_MULTIPLEX_RATIO, ssd130x->height - 1); in ssd132x_init()
595 /* Set pre-charge period */ in ssd132x_init()
600 /* Set pre-charge voltage */ in ssd132x_init()
610 /* Enable second pre-charge and internal VSL */ in ssd132x_init()
643 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_COL_RANGE, 0x00, ssd130x->width - 1); in ssd133x_init()
648 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_ROW_RANGE, 0x00, ssd130x->height - 1); in ssd133x_init()
677 ret = ssd130x_write_cmd(ssd130x, 2, SSD13XX_SET_MULTIPLEX_RATIO, ssd130x->height - 1); in ssd133x_init()
701 /* Set pre-charge A */ in ssd133x_init()
706 /* Set pre-charge B */ in ssd133x_init()
711 /* Set pre-charge C */ in ssd133x_init()
716 /* Set pre-charge level */ in ssd133x_init()
733 unsigned int x = rect->x1; in ssd130x_update_rect()
734 unsigned int y = rect->y1; in ssd130x_update_rect()
740 struct drm_device *drm = &ssd130x->drm; in ssd130x_update_rect()
755 * wide. Each letter-number combination is a bit that controls in ssd130x_update_rect()
775 if (!ssd130x->page_address_mode) { in ssd130x_update_rect()
779 ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset + x, width); in ssd130x_update_rect()
783 page_start = ssd130x->page_offset + y / page_height; in ssd130x_update_rect()
793 if (page_height * (y / page_height + i + 1) > ssd130x->height) in ssd130x_update_rect()
794 m = ssd130x->height % page_height; in ssd130x_update_rect()
813 if (ssd130x->page_address_mode) { in ssd130x_update_rect()
815 ssd130x->page_offset + i, in ssd130x_update_rect()
816 ssd130x->col_offset + x); in ssd130x_update_rect()
829 if (!ssd130x->page_address_mode) in ssd130x_update_rect()
839 unsigned int x = rect->x1; in ssd132x_update_rect()
840 unsigned int y = rect->y1; in ssd132x_update_rect()
846 struct drm_device *drm = &ssd130x->drm; in ssd132x_update_rect()
855 * COM0 to COM[N - 1] are the rows and SEG0 to SEG[M - 1] are in ssd132x_update_rect()
858 * Each Segment has a 4-bit pixel and each Common output has a in ssd132x_update_rect()
868 ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_COL_RANGE, x / segment_width, columns - 1); in ssd132x_update_rect()
873 ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, y, rows - 1); in ssd132x_update_rect()
897 unsigned int x = rect->x1; in ssd133x_update_rect()
898 unsigned int y = rect->y1; in ssd133x_update_rect()
905 * COM0 to COM[N - 1] are the rows and SEG0 to SEG[M - 1] are in ssd133x_update_rect()
908 * Each Segment has a 8-bit pixel and each Common output has a in ssd133x_update_rect()
914 * sub-pixels for color A, B and C. These have 3 bit, 3 bit and in ssd133x_update_rect()
919 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_COL_RANGE, x, columns - 1); in ssd133x_update_rect()
924 ret = ssd130x_write_cmd(ssd130x, 3, SSD133X_SET_ROW_RANGE, y, rows - 1); in ssd133x_update_rect()
936 unsigned int pages = DIV_ROUND_UP(ssd130x->height, SSD130X_PAGE_HEIGHT); in ssd130x_clear_screen()
937 unsigned int width = ssd130x->width; in ssd130x_clear_screen()
940 if (!ssd130x->page_address_mode) { in ssd130x_clear_screen()
944 ret = ssd130x_set_col_range(ssd130x, ssd130x->col_offset, width); in ssd130x_clear_screen()
948 ret = ssd130x_set_page_range(ssd130x, ssd130x->page_offset, pages); in ssd130x_clear_screen()
963 ssd130x->page_offset + i, in ssd130x_clear_screen()
964 ssd130x->col_offset); in ssd130x_clear_screen()
977 unsigned int columns = DIV_ROUND_UP(ssd130x->height, SSD132X_SEGMENT_WIDTH); in ssd132x_clear_screen()
978 unsigned int height = ssd130x->height; in ssd132x_clear_screen()
994 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd133x_clear_screen()
996 memset(data_array, 0, pitch * ssd130x->height); in ssd133x_clear_screen()
999 ssd130x_write_data(ssd130x, data_array, pitch * ssd130x->height); in ssd133x_clear_screen()
1008 struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev); in ssd130x_fb_blit_rect()
1014 rect->y1 = round_down(rect->y1, SSD130X_PAGE_HEIGHT); in ssd130x_fb_blit_rect()
1015 rect->y2 = min_t(unsigned int, round_up(rect->y2, SSD130X_PAGE_HEIGHT), ssd130x->height); in ssd130x_fb_blit_rect()
1039 struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev); in ssd132x_fb_blit_rect()
1045 rect->x1 = round_down(rect->x1, SSD132X_SEGMENT_WIDTH); in ssd132x_fb_blit_rect()
1046 rect->x2 = min_t(unsigned int, round_up(rect->x2, SSD132X_SEGMENT_WIDTH), in ssd132x_fb_blit_rect()
1047 ssd130x->width); in ssd132x_fb_blit_rect()
1068 struct ssd130x_device *ssd130x = drm_to_ssd130x(fb->dev); in ssd133x_fb_blit_rect()
1075 return -EINVAL; in ssd133x_fb_blit_rect()
1096 struct drm_device *drm = plane->dev; in ssd130x_primary_plane_atomic_check()
1100 struct drm_shadow_plane_state *shadow_plane_state = &ssd130x_state->base; in ssd130x_primary_plane_atomic_check()
1101 struct drm_crtc *crtc = plane_state->crtc; in ssd130x_primary_plane_atomic_check()
1116 else if (!plane_state->visible) in ssd130x_primary_plane_atomic_check()
1121 return -EINVAL; in ssd130x_primary_plane_atomic_check()
1123 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd130x_primary_plane_atomic_check()
1125 if (plane_state->fb->format != fi) { in ssd130x_primary_plane_atomic_check()
1129 buf = drm_format_conv_state_reserve(&shadow_plane_state->fmtcnv_state, in ssd130x_primary_plane_atomic_check()
1132 return -ENOMEM; in ssd130x_primary_plane_atomic_check()
1135 ssd130x_state->buffer = kcalloc(pitch, ssd130x->height, GFP_KERNEL); in ssd130x_primary_plane_atomic_check()
1136 if (!ssd130x_state->buffer) in ssd130x_primary_plane_atomic_check()
1137 return -ENOMEM; in ssd130x_primary_plane_atomic_check()
1145 struct drm_device *drm = plane->dev; in ssd132x_primary_plane_atomic_check()
1149 struct drm_shadow_plane_state *shadow_plane_state = &ssd130x_state->base; in ssd132x_primary_plane_atomic_check()
1150 struct drm_crtc *crtc = plane_state->crtc; in ssd132x_primary_plane_atomic_check()
1165 else if (!plane_state->visible) in ssd132x_primary_plane_atomic_check()
1170 return -EINVAL; in ssd132x_primary_plane_atomic_check()
1172 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd132x_primary_plane_atomic_check()
1174 if (plane_state->fb->format != fi) { in ssd132x_primary_plane_atomic_check()
1178 buf = drm_format_conv_state_reserve(&shadow_plane_state->fmtcnv_state, in ssd132x_primary_plane_atomic_check()
1181 return -ENOMEM; in ssd132x_primary_plane_atomic_check()
1184 ssd130x_state->buffer = kcalloc(pitch, ssd130x->height, GFP_KERNEL); in ssd132x_primary_plane_atomic_check()
1185 if (!ssd130x_state->buffer) in ssd132x_primary_plane_atomic_check()
1186 return -ENOMEM; in ssd132x_primary_plane_atomic_check()
1195 struct drm_crtc *crtc = plane_state->crtc; in ssd133x_primary_plane_atomic_check()
1208 else if (!plane_state->visible) in ssd133x_primary_plane_atomic_check()
1220 struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd130x_primary_plane_atomic_update()
1223 struct drm_framebuffer *fb = plane_state->fb; in ssd130x_primary_plane_atomic_update()
1225 struct drm_device *drm = plane->dev; in ssd130x_primary_plane_atomic_update()
1235 dst_clip = plane_state->dst; in ssd130x_primary_plane_atomic_update()
1240 ssd130x_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip, in ssd130x_primary_plane_atomic_update()
1241 ssd130x_plane_state->buffer, in ssd130x_primary_plane_atomic_update()
1242 ssd130x_crtc_state->data_array, in ssd130x_primary_plane_atomic_update()
1243 &shadow_plane_state->fmtcnv_state); in ssd130x_primary_plane_atomic_update()
1255 struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd132x_primary_plane_atomic_update()
1258 struct drm_framebuffer *fb = plane_state->fb; in ssd132x_primary_plane_atomic_update()
1260 struct drm_device *drm = plane->dev; in ssd132x_primary_plane_atomic_update()
1270 dst_clip = plane_state->dst; in ssd132x_primary_plane_atomic_update()
1275 ssd132x_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip, in ssd132x_primary_plane_atomic_update()
1276 ssd130x_plane_state->buffer, in ssd132x_primary_plane_atomic_update()
1277 ssd130x_crtc_state->data_array, in ssd132x_primary_plane_atomic_update()
1278 &shadow_plane_state->fmtcnv_state); in ssd132x_primary_plane_atomic_update()
1290 struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd133x_primary_plane_atomic_update()
1292 struct drm_framebuffer *fb = plane_state->fb; in ssd133x_primary_plane_atomic_update()
1294 struct drm_device *drm = plane->dev; in ssd133x_primary_plane_atomic_update()
1304 dst_clip = plane_state->dst; in ssd133x_primary_plane_atomic_update()
1309 ssd133x_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip, in ssd133x_primary_plane_atomic_update()
1310 ssd130x_crtc_state->data_array, in ssd133x_primary_plane_atomic_update()
1311 &shadow_plane_state->fmtcnv_state); in ssd133x_primary_plane_atomic_update()
1320 struct drm_device *drm = plane->dev; in ssd130x_primary_plane_atomic_disable()
1327 if (!plane_state->crtc) in ssd130x_primary_plane_atomic_disable()
1330 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd130x_primary_plane_atomic_disable()
1336 ssd130x_clear_screen(ssd130x, ssd130x_crtc_state->data_array); in ssd130x_primary_plane_atomic_disable()
1344 struct drm_device *drm = plane->dev; in ssd132x_primary_plane_atomic_disable()
1351 if (!plane_state->crtc) in ssd132x_primary_plane_atomic_disable()
1354 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd132x_primary_plane_atomic_disable()
1360 ssd132x_clear_screen(ssd130x, ssd130x_crtc_state->data_array); in ssd132x_primary_plane_atomic_disable()
1368 struct drm_device *drm = plane->dev; in ssd133x_primary_plane_atomic_disable()
1375 if (!plane_state->crtc) in ssd133x_primary_plane_atomic_disable()
1378 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in ssd133x_primary_plane_atomic_disable()
1384 ssd133x_clear_screen(ssd130x, ssd130x_crtc_state->data_array); in ssd133x_primary_plane_atomic_disable()
1394 WARN_ON(plane->state); in ssd130x_primary_plane_reset()
1400 __drm_gem_reset_shadow_plane(plane, &ssd130x_state->base); in ssd130x_primary_plane_reset()
1409 if (WARN_ON(!plane->state)) in ssd130x_primary_plane_duplicate_state()
1412 old_ssd130x_state = to_ssd130x_plane_state(plane->state); in ssd130x_primary_plane_duplicate_state()
1418 ssd130x_state->buffer = NULL; in ssd130x_primary_plane_duplicate_state()
1420 new_shadow_plane_state = &ssd130x_state->base; in ssd130x_primary_plane_duplicate_state()
1424 return &new_shadow_plane_state->base; in ssd130x_primary_plane_duplicate_state()
1432 kfree(ssd130x_state->buffer); in ssd130x_primary_plane_destroy_state()
1434 __drm_gem_destroy_shadow_plane_state(&ssd130x_state->base); in ssd130x_primary_plane_destroy_state()
1472 struct ssd130x_device *ssd130x = drm_to_ssd130x(crtc->dev); in ssd130x_crtc_mode_valid()
1474 if (mode->hdisplay != ssd130x->mode.hdisplay && in ssd130x_crtc_mode_valid()
1475 mode->vdisplay != ssd130x->mode.vdisplay) in ssd130x_crtc_mode_valid()
1477 else if (mode->hdisplay != ssd130x->mode.hdisplay) in ssd130x_crtc_mode_valid()
1479 else if (mode->vdisplay != ssd130x->mode.vdisplay) in ssd130x_crtc_mode_valid()
1488 struct drm_device *drm = crtc->dev; in ssd130x_crtc_atomic_check()
1492 unsigned int pages = DIV_ROUND_UP(ssd130x->height, SSD130X_PAGE_HEIGHT); in ssd130x_crtc_atomic_check()
1499 ssd130x_state->data_array = kmalloc(ssd130x->width * pages, GFP_KERNEL); in ssd130x_crtc_atomic_check()
1500 if (!ssd130x_state->data_array) in ssd130x_crtc_atomic_check()
1501 return -ENOMEM; in ssd130x_crtc_atomic_check()
1509 struct drm_device *drm = crtc->dev; in ssd132x_crtc_atomic_check()
1513 unsigned int columns = DIV_ROUND_UP(ssd130x->width, SSD132X_SEGMENT_WIDTH); in ssd132x_crtc_atomic_check()
1520 ssd130x_state->data_array = kmalloc(columns * ssd130x->height, GFP_KERNEL); in ssd132x_crtc_atomic_check()
1521 if (!ssd130x_state->data_array) in ssd132x_crtc_atomic_check()
1522 return -ENOMEM; in ssd132x_crtc_atomic_check()
1530 struct drm_device *drm = crtc->dev; in ssd133x_crtc_atomic_check()
1539 return -EINVAL; in ssd133x_crtc_atomic_check()
1545 pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); in ssd133x_crtc_atomic_check()
1547 ssd130x_state->data_array = kmalloc(pitch * ssd130x->height, GFP_KERNEL); in ssd133x_crtc_atomic_check()
1548 if (!ssd130x_state->data_array) in ssd133x_crtc_atomic_check()
1549 return -ENOMEM; in ssd133x_crtc_atomic_check()
1559 WARN_ON(crtc->state); in ssd130x_crtc_reset()
1565 __drm_atomic_helper_crtc_reset(crtc, &ssd130x_state->base); in ssd130x_crtc_reset()
1573 if (WARN_ON(!crtc->state)) in ssd130x_crtc_duplicate_state()
1576 old_ssd130x_state = to_ssd130x_crtc_state(crtc->state); in ssd130x_crtc_duplicate_state()
1582 ssd130x_state->data_array = NULL; in ssd130x_crtc_duplicate_state()
1584 __drm_atomic_helper_crtc_duplicate_state(crtc, &ssd130x_state->base); in ssd130x_crtc_duplicate_state()
1586 return &ssd130x_state->base; in ssd130x_crtc_duplicate_state()
1594 kfree(ssd130x_state->data_array); in ssd130x_crtc_destroy_state()
1633 struct drm_device *drm = encoder->dev; in ssd130x_encoder_atomic_enable()
1647 backlight_enable(ssd130x->bl_dev); in ssd130x_encoder_atomic_enable()
1659 struct drm_device *drm = encoder->dev; in ssd132x_encoder_atomic_enable()
1673 backlight_enable(ssd130x->bl_dev); in ssd132x_encoder_atomic_enable()
1684 struct drm_device *drm = encoder->dev; in ssd133x_encoder_atomic_enable()
1698 backlight_enable(ssd130x->bl_dev); in ssd133x_encoder_atomic_enable()
1709 struct drm_device *drm = encoder->dev; in ssd130x_encoder_atomic_disable()
1712 backlight_disable(ssd130x->bl_dev); in ssd130x_encoder_atomic_disable()
1740 struct ssd130x_device *ssd130x = drm_to_ssd130x(connector->dev); in ssd130x_connector_get_modes()
1742 struct device *dev = ssd130x->dev; in ssd130x_connector_get_modes()
1744 mode = drm_mode_duplicate(connector->dev, &ssd130x->mode); in ssd130x_connector_get_modes()
1751 drm_set_preferred_mode(connector, mode->hdisplay, mode->vdisplay); in ssd130x_connector_get_modes()
1798 ssd130x->contrast = brightness; in ssd130x_update_bl()
1804 ret = ssd130x_write_cmd(ssd130x, 1, ssd130x->contrast); in ssd130x_update_bl()
1817 struct device *dev = ssd130x->dev; in ssd130x_parse_properties()
1819 if (device_property_read_u32(dev, "solomon,width", &ssd130x->width)) in ssd130x_parse_properties()
1820 ssd130x->width = ssd130x->device_info->default_width; in ssd130x_parse_properties()
1822 if (device_property_read_u32(dev, "solomon,height", &ssd130x->height)) in ssd130x_parse_properties()
1823 ssd130x->height = ssd130x->device_info->default_height; in ssd130x_parse_properties()
1825 if (device_property_read_u32(dev, "solomon,page-offset", &ssd130x->page_offset)) in ssd130x_parse_properties()
1826 ssd130x->page_offset = 1; in ssd130x_parse_properties()
1828 if (device_property_read_u32(dev, "solomon,col-offset", &ssd130x->col_offset)) in ssd130x_parse_properties()
1829 ssd130x->col_offset = 0; in ssd130x_parse_properties()
1831 if (device_property_read_u32(dev, "solomon,com-offset", &ssd130x->com_offset)) in ssd130x_parse_properties()
1832 ssd130x->com_offset = 0; in ssd130x_parse_properties()
1834 if (device_property_read_u32(dev, "solomon,prechargep1", &ssd130x->prechargep1)) in ssd130x_parse_properties()
1835 ssd130x->prechargep1 = 2; in ssd130x_parse_properties()
1837 if (device_property_read_u32(dev, "solomon,prechargep2", &ssd130x->prechargep2)) in ssd130x_parse_properties()
1838 ssd130x->prechargep2 = 2; in ssd130x_parse_properties()
1840 if (!device_property_read_u8_array(dev, "solomon,lookup-table", in ssd130x_parse_properties()
1841 ssd130x->lookup_table, in ssd130x_parse_properties()
1842 ARRAY_SIZE(ssd130x->lookup_table))) in ssd130x_parse_properties()
1843 ssd130x->lookup_table_set = 1; in ssd130x_parse_properties()
1845 ssd130x->seg_remap = !device_property_read_bool(dev, "solomon,segment-no-remap"); in ssd130x_parse_properties()
1846 ssd130x->com_seq = device_property_read_bool(dev, "solomon,com-seq"); in ssd130x_parse_properties()
1847 ssd130x->com_lrremap = device_property_read_bool(dev, "solomon,com-lrremap"); in ssd130x_parse_properties()
1848 ssd130x->com_invdir = device_property_read_bool(dev, "solomon,com-invdir"); in ssd130x_parse_properties()
1849 ssd130x->area_color_enable = in ssd130x_parse_properties()
1850 device_property_read_bool(dev, "solomon,area-color-enable"); in ssd130x_parse_properties()
1851 ssd130x->low_power = device_property_read_bool(dev, "solomon,low-power"); in ssd130x_parse_properties()
1853 ssd130x->contrast = 127; in ssd130x_parse_properties()
1854 ssd130x->vcomh = ssd130x->device_info->default_vcomh; in ssd130x_parse_properties()
1857 if (device_property_read_u32(dev, "solomon,dclk-div", &ssd130x->dclk_div)) in ssd130x_parse_properties()
1858 ssd130x->dclk_div = ssd130x->device_info->default_dclk_div; in ssd130x_parse_properties()
1859 if (device_property_read_u32(dev, "solomon,dclk-frq", &ssd130x->dclk_frq)) in ssd130x_parse_properties()
1860 ssd130x->dclk_frq = ssd130x->device_info->default_dclk_frq; in ssd130x_parse_properties()
1865 enum ssd130x_family_ids family_id = ssd130x->device_info->family_id; in ssd130x_init_modeset()
1866 struct drm_display_mode *mode = &ssd130x->mode; in ssd130x_init_modeset()
1867 struct device *dev = ssd130x->dev; in ssd130x_init_modeset()
1868 struct drm_device *drm = &ssd130x->drm; in ssd130x_init_modeset()
1886 mode->type = DRM_MODE_TYPE_DRIVER; in ssd130x_init_modeset()
1887 mode->clock = 1; in ssd130x_init_modeset()
1888 mode->hdisplay = mode->htotal = ssd130x->width; in ssd130x_init_modeset()
1889 mode->hsync_start = mode->hsync_end = ssd130x->width; in ssd130x_init_modeset()
1890 mode->vdisplay = mode->vtotal = ssd130x->height; in ssd130x_init_modeset()
1891 mode->vsync_start = mode->vsync_end = ssd130x->height; in ssd130x_init_modeset()
1892 mode->width_mm = 27; in ssd130x_init_modeset()
1893 mode->height_mm = 27; in ssd130x_init_modeset()
1895 max_width = max_t(unsigned long, mode->hdisplay, DRM_SHADOW_PLANE_MAX_WIDTH); in ssd130x_init_modeset()
1896 max_height = max_t(unsigned long, mode->vdisplay, DRM_SHADOW_PLANE_MAX_HEIGHT); in ssd130x_init_modeset()
1898 drm->mode_config.min_width = mode->hdisplay; in ssd130x_init_modeset()
1899 drm->mode_config.max_width = max_width; in ssd130x_init_modeset()
1900 drm->mode_config.min_height = mode->vdisplay; in ssd130x_init_modeset()
1901 drm->mode_config.max_height = max_height; in ssd130x_init_modeset()
1902 drm->mode_config.preferred_depth = 24; in ssd130x_init_modeset()
1903 drm->mode_config.funcs = &ssd130x_mode_config_funcs; in ssd130x_init_modeset()
1907 primary_plane = &ssd130x->primary_plane; in ssd130x_init_modeset()
1922 crtc = &ssd130x->crtc; in ssd130x_init_modeset()
1934 encoder = &ssd130x->encoder; in ssd130x_init_modeset()
1944 encoder->possible_crtcs = drm_crtc_mask(crtc); in ssd130x_init_modeset()
1948 connector = &ssd130x->connector; in ssd130x_init_modeset()
1971 struct device *dev = ssd130x->dev; in ssd130x_get_resources()
1973 ssd130x->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in ssd130x_get_resources()
1974 if (IS_ERR(ssd130x->reset)) in ssd130x_get_resources()
1975 return dev_err_probe(dev, PTR_ERR(ssd130x->reset), in ssd130x_get_resources()
1978 ssd130x->vcc_reg = devm_regulator_get(dev, "vcc"); in ssd130x_get_resources()
1979 if (IS_ERR(ssd130x->vcc_reg)) in ssd130x_get_resources()
1980 return dev_err_probe(dev, PTR_ERR(ssd130x->vcc_reg), in ssd130x_get_resources()
1999 drm = &ssd130x->drm; in ssd130x_probe()
2001 ssd130x->dev = dev; in ssd130x_probe()
2002 ssd130x->regmap = regmap; in ssd130x_probe()
2003 ssd130x->device_info = device_get_match_data(dev); in ssd130x_probe()
2005 if (ssd130x->device_info->page_mode_only) in ssd130x_probe()
2006 ssd130x->page_address_mode = 1; in ssd130x_probe()
2020 bl->props.brightness = ssd130x->contrast; in ssd130x_probe()
2021 bl->props.max_brightness = MAX_CONTRAST; in ssd130x_probe()
2022 ssd130x->bl_dev = bl; in ssd130x_probe()
2040 drm_dev_unplug(&ssd130x->drm); in ssd130x_remove()
2041 drm_atomic_helper_shutdown(&ssd130x->drm); in ssd130x_remove()
2047 drm_atomic_helper_shutdown(&ssd130x->drm); in ssd130x_shutdown()