Understandig screen configuration in BSPs

Screwface
Hi,

I would like to be able to use my mini2440 T35 screen with my mini210s. Of
course, this screen is not registered in mini210s BSP. I tried to add it
myself, but I don't understand where does the values contained in the BSP
file come from.
So as W35 screen is common to mini2440 and mini210s, I tried to compare
both FriendlyARM BSPs, but the mentionned values are not the same. I also
looked at pengutronix BSP, but the values are also different.

So how should I proceed to determine the correct values from the screen
datasheet?

Can anyone guide me?

Thanks

Screwface
Nobody to explain me?

dezso
I don't have Mini210 but this if from the option.h of the BSP, T/X/W35
looks like supported.

"
// Supported Display List
#define  LCD_BAD          0
#define  LCD_N43          1
#define  LCD_A70          2
#define  LCD_S70          3
#define  LCD_W50          4
#define LCD_L80          5
#define LCD_T35          6
#define LCD_X35          7
#define  LCD_W35          8
#define LCD_VGA1024X768      9
#define LCD_VGA800X600      10 
#define LCD_VGA640X480      11
#define LCD_G10          13
#define LCD_H43          14
#define LCD_W101        15
#define LCD_U80          17
#define LCD_EZVGA1024X768    65
#define LCD_EZVGA1024X600    66
#define LCD_EZVGA800X600    67
#define HDMI1080P60             128
#define HDMI1080P30             129
#define HDMI1080I60             130
#define HDMI720P60              131
#define HDMI576P16X9            132
#define HDMI576P4X3             133
#define HDMI480P16X9            134
#define HDMI480P4X3             135
#define HDMI1080P60D            136
#define HDMI1080P30D            137
#define HDMI1080I60D            138
#define HDMI720P60D             139
#define HDMI576P16X9D           140
#define HDMI576P4X3D            161
#define HDMI480P16X9D           142
"

Reggie
in your -CommandLine= option in superboot, put lcd=T35, if it doesn't work,
compile your own kernel.  Or tell us which kernel you're using :)

Screwface
Hi

@dezso : could you indicate where is this file located in the kernel tree?

@Reggie : I have not tried to put lcd=T35 in the command line, but I'm
pretty sure it won't work. I looked at mini210-lcds.c file in the BSP
(FriendlyARM 3.0.8 kernel) and only W35 is mentionned.
So I know I have to compile my own patched kernel. My problem is more "how
to find the correct values to put in s3cfb_lcd structure to match the T35
timings and so on.
I wanted to report FriendlyARM 2.6.32.2 T35 values, so I analyzed the W35
case which is common to several BSPs (Pengutronix, mini2440 FriendlyARM
kernel and mini210 FriendlyARM kernel) but none of them use the same values
so I'm a bit confused

Thanks for your help

dezso
""""Forum: Linux""""
Sorry, this was for WINCE6 and not Linux...
Cant help you with Linux

Reggie
Screwface, you're probably going to have to write your own 'struct' for the
screens that you want to add in the source code.

If you look in arch/arm/mach-s5pv210/mini210-lcds.c, you can see the
structs that are there already.  You will have to make your own struct and
fill in the missing XX values, here's an example of what you're going to
need to add into mini210-lcds.c:

static struct s3cfb_lcd wvga_t35 = {
  .width= XX,
  .height = XX,
  .p_width = XX,
  .p_height = XX,
  .bpp = XX,
  .freq = XX,

  .timing = {
    .h_fp = XX,
    .h_bp = XX,
    .h_sw = XX,
    .v_fp = XX,
    .v_fpe = XX,
    .v_bp = XX,
    .v_bpe = XX,
    .v_sw = XX,
  },
  .polarity = {
    .rise_vclk = X,
    .inv_hsync = X,
    .inv_vsync = X,
    .inv_vden = X,
  },
};


I would add that code between the last LCD and the HDMI structs (if you're
looking at the 2.6.35 source code, that would be at line 260!!).

You're then going to need to add your struct and a memorable name to the
mini210_lcd_config struct at around line 319.

static struct {
  char *name;
  struct s3cfb_lcd *lcd;
  int ctp;
} mini210_lcd_config[] = {
  { "W50",  &wvga_w50,  0 },
  { "A70",  &wvga_a70,  0 },
  { "S70",  &wvga_s70,  1 },
  { "H43",  &wvga_h43,  1 },
  { "A97",  &wvga_a97,  0 },
  { "L80",  &wvga_l80,  0 },
  { "G10",  &wvga_g10,  0 },
  { "A56",  &wvga_a56,  0 },
  { "W101", &wvga_w101, 0 },
  { "T35",  &wvga_t35,  0 }, // THIS IS THE LINE YOU NEED TO ADD!!
  { "HDM",  &hdmi_def,  0 },  /* Pls keep it at last */
};

The potentially difficult part will be filling in the wvga_t35 values, the
screens are obviously supported by the mini2440 but the mini2440 lcd setup
code is different, the struct values don't really appear to match, so I
don't think they're much use, you might have more luck looking at the
mini6410 code, hopefully the code is more up to date with what the mini210
expects, otherwise you'll have to work it out from the datasheet for the
LCD.

Screwface
Thank you for your answers.
The question is still: how to find the "XX" and "X" values. This is where I
am stuck. I read the screen datasheet, but it is not so clear for me. I
don't see how to find/calculate these values from the datasheet.
I'll have a look at mini6410 code.

Reggie
.width= XX,
  .height = XX,
  .p_width = XX,
  .p_height = XX,
  .bpp = XX,
  .freq = XX,

That lot should be simple to work out, I Think the p_width/p_height is the
screen width in mm looking for the header that contains the struct for
's3cfb_lcd' will probably help you in your quest.

dezso
I got this from CE6 BSP, it might help


        LCD_T35,
        240,
        320,
        0x01,
        0x01,
        0x04,
        0x01,
        0x04,
        0x1E,
        IVCLK_FALL_EDGE,
        IHSYNC_LOW_ACTIVE,
        IVSYNC_LOW_ACTIVE,
        IVDEN_HIGH_ACTIVE,
        65,
        L"T35",
        HDMI_1080P_60,
        0,

dezso
And this is the W35, hpe you can compare and find your values.
LCD_W35,
        320,
        240,
        0x0c,
        0x04,
        0x01,
        0x46,
        0x04,
        0x01,
        IVCLK_FALL_EDGE,
        IHSYNC_LOW_ACTIVE,
        IVSYNC_LOW_ACTIVE,
        IVDEN_HIGH_ACTIVE,
        65,
        L"W35",
        HDMI_1080P_60,

dezso
Here is the structure...

struct t_lcd_param {
  unsigned
  _LCD_NUMBER,
  _LCD_WIDTH,
  _LCD_HEIGHT,
  _LCD_VBPD_VALUE,
  _LCD_VFPD_VALUE,
  _LCD_VSPW_VALUE,
  _LCD_HBPD_VALUE,
  _LCD_HFPD_VALUE,
  _LCD_HSPW_VALUE,
  _LCD_VCLK_POLARITY,
  _LCD_HSYNC_POLARITY,
  _LCD_VSYNC_POLARITY,
  _LCD_VDEN_POLARITY,
  _LCD_TFT_FRAME_RATE;
  wchar_t _LCD_NAME[30];
  unsigned _HDMI_SUGGEST_MODE, _HDMI_DOUBLE_SIZE;

Screwface
Thank you for your advices.
 
I found mainly all the information needed in the mini6410 BSP. The only
missing information is about freq parameter which is different between
mini6410 and mini210, mainly because clocks are different between those two
boards.
I understood how it works for mini6410: the formula is CLKVAL=HCLK/VCLK - 1
with
HCLK=bus speed (133MHz in case of mini6410)
VCLK= screen frequency, found in screen datasheet
freq=CLKVAL
 
so for H43 on mini6410
133/9 -1 = 13,77
in mini6410-lcd.c, we found .freq=13 for H43 screen.
 
So all this is clear.
 
Now, I need to understand how it is done on mini210, and the troubles begin
here.
The S5PV210 datasheet mentions the same formula to determine CLKVAL (page
1201), but I don't know what is the bus frequency corresponding to HCLK.
So I tried to see how it was configured in VIDCON0 register (as mentionned
on page 1229) more particularly CLKVAL_F, CLKDIR and CLKSEL_F.
But I don't find where are those values set.
 
Do you have an idea on how should I do to find the correct bus speed
corresponding to mini210 LCD ?
I hope this is not set in the bootloader as we don't have the source
code...
 
Thanks for your help!

TheRegnirps
Hi Screwface.

By the way, the touch screen is not going to work. The T35 was made for the
Mini2440 and used the built in Samsung ADCs for touch. The Mini210S uses
the FriendlyARM 1-wire method and expects a little microprocessor on the
LCD to send touch events. The T35 predates the 1-wire designs and there are
no jumpers to select 1-wire, etc. as on the H43 and A70.

Screwface
Hi TheRegnirps,

Thank you for you answer. I know this difference, but S5PV210 soc should be
able to handl resistive screens directly, without 1-wire. It should be
"just" a kernel configuration. Another goal for me is knowledge, I'm new to
kernel tweaking and BSP. So by this exercise, I try to understand how
things work.