drm/i915: Baytrail MIPI DSI support Updated
Subsystems (2)
v3 cover drm/i915: Baytrail MIPI DSI support Updated
Hi All -
These patches enhance the current support for MIPI DSI for Baytrail. They continue on the sub-encoder design and adds few more dev_ops to handle sequence correctly. Major changes are -
1. DSI Clock calculation based on pixel clock
2. Add new dev_ops for better sequencing the enable/disable path
3. Parameterized the hardcoded DSI parameters. These also forms building block for the generic MIPI driver to come in future based on enhancements in VBT. All these parameters are initialized or computed in the sub-encoder driver. Some of them might look unneccesary for now.
I am also aware of the drm_bridge support now comming in and will in future migrate from sub-encoder design to drm_bridge.
This DSI sequence has been validated with couple of test panels and is working now. Still no sub-encoder driver is included and this support will be mostly be disabled untill a panel sub-encoder driver is added. Proper detection or VBT is still pending.
v2: Mostly changes from review comments from Jani Nikula and Ville Syrjala
- Split the parameters into new patch
- Split the dsi_clk computation and m-n-p modification in separate patches
- The DSI sequence refactoring has been splitted into multiple patches and also few code changes are not needed after reworking/relooking at them and have been removed
- Backlight enabling has been removed as that depends on platform PMIC driver which is not yet there in upstream kernel. Will be added later.
- Other general code cleanup as suggested
- drm/i915: Use FLISDSI interface for band gap reset - has no changes and is included for completeness of the patch set
v3: Next round of changes resulting from Jani's review
- Removed the I915_WRITE_BITS as it was found that we need not do read/modify/write and can just write the value
- Moved the sub-encoder hook in dsi_pre_enable and dsi_post_enable
- Minor coding tidbits are fixed
Regards
Shobhit
Shobhit Kumar (7):
drm/i915: Add more dev ops for MIPI sub encoder drm/i915: Use FLISDSI interface for band gap reset drm/i915: Compute dsi_clk from pixel clock
drm/i915: Try harder to get best m,n,p values with minimal error drm/i915: Reorganize the DSI enable/disable sequence drm/i915: Remove redundant DSI PLL enabling
drm/i915: Parametrize the dphy and other spec specific parameters
drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_dsi.c | 188 ++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_dsi.h | 21 ++++ drivers/gpu/drm/i915/intel_dsi_pll.c | 119 +++++++++------------ drivers/gpu/drm/i915/intel_sideband.c | 14 +++ 6 files changed, 191 insertions(+), 154 deletions(-)
Signature · 1 line
1.8.3.2
PATCH v3 1/7 drm/i915: Add more dev ops for MIPI sub encoder
Some panels require one time programming if they do not contain their own eeprom for basic register initialization. The sequence is
Panel Reset --> Send OTP --> Enable Pixel Stream --> Enable the panel
v2: Based on review comments from Jani and Ville
- Updated the commit message with more details
- Move the new parameters out of this patch
--- drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++- drivers/gpu/drm/i915/intel_dsi.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +8 -1
@@ -147,6 +147,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +if (intel_dsi->dev.dev_ops->panel_reset) + intel_dsi->dev.dev_ops->panel_reset (&intel_dsi->dev); + temp =I915_READ (MIPI_DEVICE_READY (pipe));if ((temp &DEVICE_READY ) ==0 ) { temp &= ~ULPS_STATE_MASK ;
@@ -162,6 +165,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)I915_WRITE (MIPI_DEVICE_READY (pipe), temp); } +if (intel_dsi->dev.dev_ops->send_otp_cmds) + intel_dsi->dev.dev_ops->send_otp_cmds (&intel_dsi->dev); +if (is_cmd_mode (intel_dsi))I915_WRITE (MIPI_MAX_RETURN_PKT_SIZE (pipe),8 *4 );
@@ -176,7 +182,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)POSTING_READ (MIPI_PORT_CTRL (pipe)); } - intel_dsi->dev.dev_ops->enable (&intel_dsi->dev); +if (intel_dsi->dev.dev_ops->enable) + intel_dsi->dev.dev_ops->enable (&intel_dsi->dev); }static void intel_dsi_disable (struct intel_encoder *encoder)
drivers/gpu/drm/i915/intel_dsi.h +5 -0
@@ -39,6 +39,11 @@ struct intel_dsi_device {struct intel_dsi_dev_ops {bool (*init)(struct intel_dsi_device *dsi); +void (*panel_reset)(struct intel_dsi_device *dsi); + +/* one time programmable commands if needed */ +void (*send_otp_cmds)(struct intel_dsi_device *dsi); +/* This callback must be able to assume DSI commands can be sent */ void (*enable)(struct intel_dsi_device *dsi);
Signature · 1 line
1.8.3.2
Re: [PATCH v3 1/7] drm/i915: Add more dev ops for MIPI sub encoder
Quoted 9 lines · Shobhit Kumar
Some panels require one time programming if they do not contain their own eeprom for basic register initialization. The sequence is
Panel Reset --> Send OTP --> Enable Pixel Stream --> Enable the panel
v2: Based on review comments from Jani and Ville
- Updated the commit message with more details
- Move the new parameters out of this patch
Quoted 60 lines
Signed-off-by Yogesh Mohan Marimuthu <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++- drivers/gpu/drm/i915/intel_dsi.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_dsi.c +8
-1@@ -147,6 +147,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +if (intel_dsi->dev.dev_ops->panel_reset) + intel_dsi->dev.dev_ops->panel_reset (&intel_dsi->dev); + temp =I915_READ (MIPI_DEVICE_READY (pipe));if ((temp &DEVICE_READY ) ==0 ) { temp &= ~ULPS_STATE_MASK ;@@ -162,6 +165,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)I915_WRITE (MIPI_DEVICE_READY (pipe), temp); } +if (intel_dsi->dev.dev_ops->send_otp_cmds) + intel_dsi->dev.dev_ops->send_otp_cmds (&intel_dsi->dev); +if (is_cmd_mode (intel_dsi))I915_WRITE (MIPI_MAX_RETURN_PKT_SIZE (pipe),8 *4 );@@ -176,7 +182,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)POSTING_READ (MIPI_PORT_CTRL (pipe)); } - intel_dsi->dev.dev_ops->enable (&intel_dsi->dev); +if (intel_dsi->dev.dev_ops->enable) + intel_dsi->dev.dev_ops->enable (&intel_dsi->dev); }static void intel_dsi_disable (struct intel_encoder *encoder)drivers/gpu/drm/i915/intel_dsi.h +5
-0@@ -39,6 +39,11 @@ struct intel_dsi_device {struct intel_dsi_dev_ops {bool (*init)(struct intel_dsi_device *dsi); +void (*panel_reset)(struct intel_dsi_device *dsi); + +/* one time programmable commands if needed */ +void (*send_otp_cmds)(struct intel_dsi_device *dsi); +/* This callback must be able to assume DSI commands can be sent */ void (*enable)(struct intel_dsi_device *dsi);Signature · 1 line
1.8.3.2
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
PATCH v3 2/7 drm/i915: Use FLISDSI interface for band gap reset
In reply to Shobhit Kumarv2: Rebased on latest code
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_dsi.c | 47 ++++++----------------------------- drivers/gpu/drm/i915/intel_sideband.c | 14 +++++++++++ 4 files changed, 25 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2467,6 +2467,8 @@ u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg, enum intel_sbi_destination destination);void intel_sbi_write (struct drm_i915_private *dev_priv,u16 reg,u32 value,enum intel_sbi_destination destination); +u32 vlv_flisdsi_read (struct drm_i915_private *dev_priv,u32 reg); +void vlv_flisdsi_write (struct drm_i915_private *dev_priv,u32 reg,u32 val);int vlv_gpu_freq (struct drm_i915_private *dev_priv,int val);int vlv_freq_opcode (struct drm_i915_private *dev_priv,int val);
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -362,6 +362,7 @@#define IOSF_PORT_CCK 0x14#define IOSF_PORT_CCU 0xA9#define IOSF_PORT_GPS_CORE 0x48 +#define IOSF_PORT_FLISDSI 0x1B#define VLV_IOSF_DATA (VLV_DISPLAY_BASE + 0x2104)#define VLV_IOSF_ADDR (VLV_DISPLAY_BASE + 0x2108)
drivers/gpu/drm/i915/intel_dsi.c +8 -39
64 lines not on this page · raw message
drivers/gpu/drm/i915/intel_sideband.c +14 -0
@@ -249,3 +249,17 @@ void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,return ; } } + +u32 vlv_flisdsi_read (struct drm_i915_private *dev_priv,u32 reg) +{ +u32 val =0 ; +vlv_sideband_rw (dev_priv,DPIO_DEVFN ,IOSF_PORT_FLISDSI , +DPIO_OPCODE_REG_READ , reg, &val); +return val; +} + +void vlv_flisdsi_write (struct drm_i915_private *dev_priv,u32 reg,u32 val) +{ +vlv_sideband_rw (dev_priv,DPIO_DEVFN ,IOSF_PORT_FLISDSI , +DPIO_OPCODE_REG_WRITE , reg, &val); +}
Signature · 1 line
1.8.3.2
PATCH v3 3/7 drm/i915: Compute dsi_clk from pixel clock
In reply to Shobhit KumarPixel clock based calculation is recommended in the MIPI host controller documentation
v2: Based on review comments from Jani and Ville
- Use dsi_clk in KHz rather than converting in Hz and back to MHz
- RR formula is retained though not used but return dsi_clk in KHz now
- Moved the m-n-p changes into a separate patch
- Removed the parameter check for intel_dsi->dsi_clock_freq. This will be bought back in if needed when appropriate panel drivers are done
v3: Removed the unused mnp calculation from static table
--- drivers/gpu/drm/i915/intel_dsi_pll.c | 89 +++++++++++++----------------------- 1 file changed, 31 insertions(+), 58 deletions(-)
drivers/gpu/drm/i915/intel_dsi_pll.c +31 -58
@@ -50,6 +50,8 @@ static const u32 lfsr_converts[] = { 71, 35 /* 91 - 92 */ }; +#ifdef DSI_CLK_FROM_RR +static u32 dsi_rr_formula (const struct drm_display_mode *mode,int pixel_format,int video_mode_format,int lane_count,bool eotp)
@@ -121,7 +123,7 @@ static u32 dsi_rr_formula(const struct drm_display_mode *mode,/* the dsi clock is divided by 2 in the hardware to get dsi ddr clock */ dsi_bit_clock_hz = bytes_per_x_frames_x_lanes *8 ; - dsi_clk = dsi_bit_clock_hz / (1000 *1000 ); + dsi_clk = dsi_bit_clock_hz /1000 ;if (eotp && video_mode_format ==VIDEO_MODE_BURST ) dsi_clk *=2 ;
@@ -129,64 +131,37 @@ static u32 dsi_rr_formula(const struct drm_display_mode *mode, return dsi_clk; } -#ifdef MNP_FROM_TABLE - -struct dsi_clock_table { -u32 freq; -u8 m; -u8 p; -}; - -static const struct dsi_clock_table dsi_clk_tbl[] = { - {300 ,72 ,6 }, {313 ,75 ,6 }, {323 ,78 ,6 }, {333 ,80 ,6 }, - {343 ,82 ,6 }, {353 ,85 ,6 }, {363 ,87 ,6 }, {373 ,90 ,6 }, - {383 ,92 ,6 }, {390 ,78 ,5 }, {393 ,79 ,5 }, {400 ,80 ,5 }, - {401 ,80 ,5 }, {402 ,80 ,5 }, {403 ,81 ,5 }, {404 ,81 ,5 }, - {405 ,81 ,5 }, {406 ,81 ,5 }, {407 ,81 ,5 }, {408 ,82 ,5 }, - {409 ,82 ,5 }, {410 ,82 ,5 }, {411 ,82 ,5 }, {412 ,82 ,5 }, - {413 ,83 ,5 }, {414 ,83 ,5 }, {415 ,83 ,5 }, {416 ,83 ,5 }, - {417 ,83 ,5 }, {418 ,84 ,5 }, {419 ,84 ,5 }, {420 ,84 ,5 }, - {430 ,86 ,5 }, {440 ,88 ,5 }, {450 ,90 ,5 }, {460 ,92 ,5 }, - {470 ,75 ,4 }, {480 ,77 ,4 }, {490 ,78 ,4 }, {500 ,80 ,4 }, - {510 ,82 ,4 }, {520 ,83 ,4 }, {530 ,85 ,4 }, {540 ,86 ,4 }, - {550 ,88 ,4 }, {560 ,90 ,4 }, {570 ,91 ,4 }, {580 ,70 ,3 }, - {590 ,71 ,3 }, {600 ,72 ,3 }, {610 ,73 ,3 }, {620 ,74 ,3 }, - {630 ,76 ,3 }, {640 ,77 ,3 }, {650 ,78 ,3 }, {660 ,79 ,3 }, - {670 ,80 ,3 }, {680 ,82 ,3 }, {690 ,83 ,3 }, {700 ,84 ,3 }, - {710 ,85 ,3 }, {720 ,86 ,3 }, {730 ,88 ,3 }, {740 ,89 ,3 }, - {750 ,90 ,3 }, {760 ,91 ,3 }, {770 ,92 ,3 }, {780 ,62 ,2 }, - {790 ,63 ,2 }, {800 ,64 ,2 }, {880 ,70 ,2 }, {900 ,72 ,2 }, - {1000 ,80 ,2 },/* dsi clock frequency in Mhz*/ -}; +#else -static int dsi_calc_mnp (u32 dsi_clk,struct dsi_mnp *dsi_mnp) +/* Get DSI clock from pixel clock */ +static u32 dsi_clk_from_pclk (const struct drm_display_mode *mode, +int pixel_format,int lane_count) { -unsigned int i; -u8 m; -u8 n; -u8 p; -u32 m_seed; - -if (dsi_clk <300 || dsi_clk >1000 ) -return -ECHRNG ; +u32 dsi_clk_khz; +u32 bpp; -for (i =0 ; i <=ARRAY_SIZE (dsi_clk_tbl); i++) { -if (dsi_clk_tbl[i].freq > dsi_clk) -break ; +switch (pixel_format) { +default : +case VID_MODE_FORMAT_RGB888 : +case VID_MODE_FORMAT_RGB666_LOOSE : + bpp =24 ; +break ; +case VID_MODE_FORMAT_RGB666 : + bpp =18 ; +break ; +case VID_MODE_FORMAT_RGB565 : + bpp =16 ; +break ; } - m = dsi_clk_tbl[i].m; - p = dsi_clk_tbl[i].p; - m_seed = lfsr_converts[m -62 ]; - n =1 ; - dsi_mnp->dsi_pll_ctrl =1 << (DSI_PLL_P1_POST_DIV_SHIFT + p -2 ); - dsi_mnp->dsi_pll_div = (n -1 ) <<DSI_PLL_N1_DIV_SHIFT | - m_seed <<DSI_PLL_M1_DIV_SHIFT ; +/* DSI data rate = pixel clock * bits per pixel / lane count +pixel clock is converted from KHz to Hz */ + dsi_clk_khz =DIV_ROUND_CLOSEST (mode->clock * bpp, lane_count); -return 0 ; +return dsi_clk_khz; } -#else +#endif static int dsi_calc_mnp (u32 dsi_clk,struct dsi_mnp *dsi_mnp) {
@@ -200,13 +175,14 @@ static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp)u32 calc_p;u32 m_seed; -if (dsi_clk <300 || dsi_clk >1150 ) { +/* dsi_clk is expected in KHZ */ +if (dsi_clk <300000 || dsi_clk >1150000 ) {DRM_ERROR ("DSI CLK Out of Range\n" );return -ECHRNG ; } ref_clk =25000 ; - target_dsi_clk = dsi_clk *1000 ; + target_dsi_clk = dsi_clk; error =0xFFFFFFFF ; calc_m =0 ; calc_p =0 ;
@@ -235,8 +211,6 @@ static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp)return 0 ; } -#endif -/* * XXX: The muxing and gating is hard coded for now. Need to add support for * sharing PLLs with two DSI outputs.
@@ -251,9 +225,8 @@ static void vlv_configure_dsi_pll(struct intel_encoder *encoder)struct dsi_mnp dsi_mnp;u32 dsi_clk; - dsi_clk =dsi_rr_formula (mode, intel_dsi->pixel_format, - intel_dsi->video_mode_format, - intel_dsi->lane_count, !intel_dsi->eot_disable); + dsi_clk =dsi_clk_from_pclk (mode, intel_dsi->pixel_format, + intel_dsi->lane_count); ret =dsi_calc_mnp (dsi_clk, &dsi_mnp);if (ret) {
Signature · 1 line
1.8.3.2
PATCH v3 4/7 drm/i915: Try harder to get best m, n, p values with minimal error
In reply to Shobhit KumarBasically check for both +ive and -ive deviation from target clock and pick the one with minimal error. If we get a direct match, break from loop to acheive some optimization.
v2: Use signed variable for target and calculated dsi clock values
--- drivers/gpu/drm/i915/intel_dsi_pll.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_dsi_pll.c +20 -10
@@ -169,8 +169,8 @@ static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp)u32 ref_clk;u32 error;u32 tmp_error; -u32 target_dsi_clk; -u32 calc_dsi_clk; +int target_dsi_clk; +int calc_dsi_clk;u32 calc_m;u32 calc_p;u32 m_seed;
@@ -184,22 +184,32 @@ static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp) ref_clk =25000 ; target_dsi_clk = dsi_clk; error =0xFFFFFFFF ; + tmp_error =0xFFFFFFFF ; calc_m =0 ; calc_p =0 ;for (m =62 ; m <=92 ; m++) {for (p =2 ; p <=6 ; p++) { - +/* Find the optimal m and p divisors +with minimal error +/- the required clock */ calc_dsi_clk = (m * ref_clk) / p; -if (calc_dsi_clk >= target_dsi_clk) { - tmp_error = calc_dsi_clk - target_dsi_clk; -if (tmp_error < error) { - error = tmp_error; - calc_m = m; - calc_p = p; - } +if (calc_dsi_clk == target_dsi_clk) { + calc_m = m; + calc_p = p; + error =0 ; +break ; + }else + tmp_error =abs (target_dsi_clk - calc_dsi_clk); + +if (tmp_error < error) { + error = tmp_error; + calc_m = m; + calc_p = p; } } + +if (error ==0 ) +break ; } m_seed = lfsr_converts[calc_m -62 ];
Signature · 1 line
1.8.3.2
Re: [PATCH v3 4/7] drm/i915: Try harder to get best m, n, p values with minimal error
Quoted 6 lines · Shobhit Kumar
Basically check for both +ive and -ive deviation from target clock and pick the one with minimal error. If we get a direct match, break from loop to acheive some optimization.
v2: Use signed variable for target and calculated dsi clock values
I think this could be simplified still, but that's bikeshedding...
Quoted 65 lines
Signed-off-by Vijayakumar Balakrishnan <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_dsi_pll.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)drivers/gpu/drm/i915/intel_dsi_pll.c +20
-10@@ -169,8 +169,8 @@ static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp)u32 ref_clk;u32 error;u32 tmp_error; -u32 target_dsi_clk; -u32 calc_dsi_clk; +int target_dsi_clk; +int calc_dsi_clk;u32 calc_m;u32 calc_p;u32 m_seed;@@ -184,22 +184,32 @@ static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp) ref_clk =25000 ; target_dsi_clk = dsi_clk; error =0xFFFFFFFF ; + tmp_error =0xFFFFFFFF ; calc_m =0 ; calc_p =0 ;for (m =62 ; m <=92 ; m++) {for (p =2 ; p <=6 ; p++) { - +/* Find the optimal m and p divisors +with minimal error +/- the required clock */ calc_dsi_clk = (m * ref_clk) / p; -if (calc_dsi_clk >= target_dsi_clk) { - tmp_error = calc_dsi_clk - target_dsi_clk; -if (tmp_error < error) { - error = tmp_error; - calc_m = m; - calc_p = p; - } +if (calc_dsi_clk == target_dsi_clk) { + calc_m = m; + calc_p = p; + error =0 ; +break ; + }else + tmp_error =abs (target_dsi_clk - calc_dsi_clk); + +if (tmp_error < error) { + error = tmp_error; + calc_m = m; + calc_p = p; } } + +if (error ==0 ) +break ; } m_seed = lfsr_converts[calc_m -62 ];Signature · 1 line
1.8.3.2
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
PATCH v3 5/7 drm/i915: Reorganize the DSI enable/disable sequence
In reply to Shobhit KumarBasically ULPS handling during enable/disable has been moved to pre_enable and post_disable phases. PLL and panel power disable also has been moved to post_disable phase. The ULPS entry/exit sequneces as suggested by HW team is as follows -
During enable time -
set DEVICE_READY --> Clear DEVICE_READY --> set DEVICE_READY
And during disable time to flush all FIFOs -
set ENTER_SLEEP --> EXIT_SLEEP --> ENTER_SLEEP
Also during disbale sequnece sub-encoder disable is moved to the end after port is disabled.
v2: Based on comments from Ville
- Detailed epxlaination in the commit messgae
- Moved parameter changes out into another patch
- Backlight enabling will be a new patch
v3: Updated as per Jani's comments
- Removed the I915_WRITE_BITS as it is not needed
- Moved panel_reset and send_otp_cmds hooks to dsi_pre_enable
- Moved disable_panel_power hook to dsi_post_disable
- Replace hardcoding with AFE_LATCHOUT
--- drivers/gpu/drm/i915/intel_dsi.c | 110 +++++++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_dsi.h | 2 + 2 files changed, 79 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +77 -33
@@ -101,46 +101,57 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)vlv_enable_dsi_pll (encoder); } -static void intel_dsi_pre_enable (struct intel_encoder *encoder) +void intel_dsi_device_ready (struct intel_encoder *encoder) { +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int pipe = intel_crtc->pipe; +u32 val; +DRM_DEBUG_KMS ("\n" ); -} -static void intel_dsi_enable (struct intel_encoder *encoder) + val =I915_READ (MIPI_PORT_CTRL (pipe)); +I915_WRITE (MIPI_PORT_CTRL (pipe), val |LP_OUTPUT_HOLD ); +usleep_range (1000 ,1500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY |ULPS_STATE_EXIT ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),0x00 ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY ); +usleep_range (2000 ,2500 ); +} +static void intel_dsi_pre_enable (struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); -int pipe = intel_crtc->pipe; -u32 temp;DRM_DEBUG_KMS ("\n" );if (intel_dsi->dev.dev_ops->panel_reset) intel_dsi->dev.dev_ops->panel_reset (&intel_dsi->dev); - temp =I915_READ (MIPI_DEVICE_READY (pipe)); -if ((temp &DEVICE_READY ) ==0 ) { - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp |DEVICE_READY ); - }else if (temp &ULPS_STATE_MASK ) { - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp |ULPS_STATE_EXIT ); -/* -* We need to ensure that there is a minimum of 1 ms time -* available before clearing the UPLS exit state. -*/ -msleep (2 ); -I915_WRITE (MIPI_DEVICE_READY (pipe), temp); - } +/* put device in ready state */ +intel_dsi_device_ready (encoder);if (intel_dsi->dev.dev_ops->send_otp_cmds) intel_dsi->dev.dev_ops->send_otp_cmds (&intel_dsi->dev); +} + +static void intel_dsi_enable (struct intel_encoder *encoder) +{ +struct drm_device *dev = encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); +int pipe = intel_crtc->pipe; +u32 temp; + +DRM_DEBUG_KMS ("\n" );if (is_cmd_mode (intel_dsi))I915_WRITE (MIPI_MAX_RETURN_PKT_SIZE (pipe),8 *4 ); - -if (is_vid_mode (intel_dsi)) { +else {msleep (20 );/* XXX */ dpi_send_cmd (intel_dsi,TURN_ON );msleep (100 );
@@ -157,7 +168,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)static void intel_dsi_disable (struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct drm_device *dev = encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base);int pipe = intel_crtc->pipe;
@@ -165,8 +177,6 @@ static void intel_dsi_disable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); - intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); -if (is_vid_mode (intel_dsi)) {dpi_send_cmd (intel_dsi,SHUTDOWN );msleep (10 );
@@ -179,20 +189,54 @@ static void intel_dsi_disable(struct intel_encoder *encoder)msleep (2 ); } - temp =I915_READ (MIPI_DEVICE_READY (pipe)); -if (temp &DEVICE_READY ) { - temp &= ~DEVICE_READY ; - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp); - } +/* if disable packets are sent before sending shutdown packet then in +* some next enable sequence send turn on packet error is observed */ +if (intel_dsi->dev.dev_ops->disable) + intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); } -static void intel_dsi_post_disable (struct intel_encoder *encoder) +void intel_dsi_clear_device_ready (struct intel_encoder *encoder) { +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int pipe = intel_crtc->pipe; +u32 val; +DRM_DEBUG_KMS ("\n" ); +I915_WRITE (MIPI_DEVICE_READY (pipe),ULPS_STATE_ENTER ); +usleep_range (2000 ,2500 ); + +I915_WRITE (MIPI_DEVICE_READY (pipe),ULPS_STATE_EXIT ); +usleep_range (2000 ,2500 ); + +I915_WRITE (MIPI_DEVICE_READY (pipe),ULPS_STATE_ENTER ); +usleep_range (2000 ,2500 ); + + val =I915_READ (MIPI_PORT_CTRL (pipe)); +I915_WRITE (MIPI_PORT_CTRL (pipe), val & ~LP_OUTPUT_HOLD ); +usleep_range (1000 ,1500 ); + +if (wait_for (((I915_READ (MIPI_PORT_CTRL (pipe)) &AFE_LATCHOUT ) + ==0x00000 ),30 )) +DRM_ERROR ("DSI LP not going Low\n" ); + +I915_WRITE (MIPI_DEVICE_READY (pipe),0x00 ); +usleep_range (2000 ,2500 ); +vlv_disable_dsi_pll (encoder); } +static void intel_dsi_post_disable (struct intel_encoder *encoder) +{ +struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); + +DRM_DEBUG_KMS ("\n" ); + +intel_dsi_clear_device_ready (encoder); + +if (intel_dsi->dev.dev_ops->disable_panel_power) + intel_dsi->dev.dev_ops->disable_panel_power (&intel_dsi->dev); +}static bool intel_dsi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe)
drivers/gpu/drm/i915/intel_dsi.h +2 -0
@@ -41,6 +41,8 @@ struct intel_dsi_dev_ops {void (*panel_reset)(struct intel_dsi_device *dsi); +void (*disable_panel_power)(struct intel_dsi_device *dsi); +/* one time programmable commands if needed */ void (*send_otp_cmds)(struct intel_dsi_device *dsi);
Signature · 1 line
1.8.3.2
Re: [PATCH v3 5/7] drm/i915: Reorganize the DSI enable/disable sequence
Quoted 37 lines · Shobhit Kumar
Basically ULPS handling during enable/disable has been moved to
pre_enableandpost_disablephases. PLL and panel power disable also has been moved topost_disablephase. The ULPS entry/exit sequneces as suggested by HW team is as follows -During enable time -
setDEVICE_READY--> ClearDEVICE_READY--> setDEVICE_READYAnd during disable time to flush all FIFOs -
setENTER_SLEEP-->EXIT_SLEEP-->ENTER_SLEEPAlso during disbale sequnece sub-encoder disable is moved to the end after port is disabled.
v2: Based on comments from Ville
- Detailed epxlaination in the commit messgae
- Moved parameter changes out into another patch
- Backlight enabling will be a new patchv3: Updated as per Jani's comments
- Removed theI915_WRITE_BITSas it is not needed
- Movedpanel_resetandsend_otp_cmdshooks todsi_pre_enable
- Moveddisable_panel_powerhook todsi_post_disable
- Replace hardcoding withAFE_LATCHOUTSigned-off-by Yogesh Mohan Marimuthu <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_dsi.c | 110 +++++++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_dsi.h | 2 + 2 files changed, 79 insertions(+), 33 deletions(-)drivers/gpu/drm/i915/intel_dsi.c +0
-0
drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder) · line 104
Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +1
-1@@ -101,46 +101,57 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)vlv_enable_dsi_pll (encoder); } -static void intel_dsi_pre_enable (struct intel_encoder *encoder) +void intel_dsi_device_ready (struct intel_encoder *encoder)
Should be static.
Quoted 102 lines
drivers/gpu/drm/i915/intel_dsi.c +35
-29{ +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int pipe = intel_crtc->pipe; +u32 val; +DRM_DEBUG_KMS ("\n" ); -} -static void intel_dsi_enable (struct intel_encoder *encoder) + val =I915_READ (MIPI_PORT_CTRL (pipe)); +I915_WRITE (MIPI_PORT_CTRL (pipe), val |LP_OUTPUT_HOLD ); +usleep_range (1000 ,1500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY |ULPS_STATE_EXIT ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),0x00 ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY ); +usleep_range (2000 ,2500 ); +} +static void intel_dsi_pre_enable (struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); -int pipe = intel_crtc->pipe; -u32 temp;DRM_DEBUG_KMS ("\n" );if (intel_dsi->dev.dev_ops->panel_reset) intel_dsi->dev.dev_ops->panel_reset (&intel_dsi->dev); - temp =I915_READ (MIPI_DEVICE_READY (pipe)); -if ((temp &DEVICE_READY ) ==0 ) { - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp |DEVICE_READY ); - }else if (temp &ULPS_STATE_MASK ) { - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp |ULPS_STATE_EXIT ); -/* -* We need to ensure that there is a minimum of 1 ms time -* available before clearing the UPLS exit state. -*/ -msleep (2 ); -I915_WRITE (MIPI_DEVICE_READY (pipe), temp); - } +/* put device in ready state */ +intel_dsi_device_ready (encoder);if (intel_dsi->dev.dev_ops->send_otp_cmds) intel_dsi->dev.dev_ops->send_otp_cmds (&intel_dsi->dev); +} + +static void intel_dsi_enable (struct intel_encoder *encoder) +{ +struct drm_device *dev = encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); +int pipe = intel_crtc->pipe; +u32 temp; + +DRM_DEBUG_KMS ("\n" );if (is_cmd_mode (intel_dsi))I915_WRITE (MIPI_MAX_RETURN_PKT_SIZE (pipe),8 *4 ); - -if (is_vid_mode (intel_dsi)) { +else {msleep (20 );/* XXX */ dpi_send_cmd (intel_dsi,TURN_ON );msleep (100 );@@ -157,7 +168,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)static void intel_dsi_disable (struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct drm_device *dev = encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base);int pipe = intel_crtc->pipe;@@ -165,8 +177,6 @@ static void intel_dsi_disable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); - intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); -if (is_vid_mode (intel_dsi)) {dpi_send_cmd (intel_dsi,SHUTDOWN );msleep (10 );@@ -179,20 +189,54 @@ static void intel_dsi_disable(struct intel_encoder *encoder)msleep (2 ); } - temp =I915_READ (MIPI_DEVICE_READY (pipe)); -if (temp &DEVICE_READY ) { - temp &= ~DEVICE_READY ; - temp &= ~ULPS_STATE_MASK ;
drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_disable(struct intel_encoder *encoder) · line 198
Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.c +5
-3-I915_WRITE (MIPI_DEVICE_READY (pipe), temp); - } +/* if disable packets are sent before sending shutdown packet then in +* some next enable sequence send turn on packet error is observed */ +if (intel_dsi->dev.dev_ops->disable) + intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); } -static void intel_dsi_post_disable (struct intel_encoder *encoder) +void intel_dsi_clear_device_ready (struct intel_encoder *encoder)
Should be static.
With these fixed,
Quoted 60 lines
drivers/gpu/drm/i915/intel_dsi.c +36
-0{ +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int pipe = intel_crtc->pipe; +u32 val; +DRM_DEBUG_KMS ("\n" ); +I915_WRITE (MIPI_DEVICE_READY (pipe),ULPS_STATE_ENTER ); +usleep_range (2000 ,2500 ); + +I915_WRITE (MIPI_DEVICE_READY (pipe),ULPS_STATE_EXIT ); +usleep_range (2000 ,2500 ); + +I915_WRITE (MIPI_DEVICE_READY (pipe),ULPS_STATE_ENTER ); +usleep_range (2000 ,2500 ); + + val =I915_READ (MIPI_PORT_CTRL (pipe)); +I915_WRITE (MIPI_PORT_CTRL (pipe), val & ~LP_OUTPUT_HOLD ); +usleep_range (1000 ,1500 ); + +if (wait_for (((I915_READ (MIPI_PORT_CTRL (pipe)) &AFE_LATCHOUT ) + ==0x00000 ),30 )) +DRM_ERROR ("DSI LP not going Low\n" ); + +I915_WRITE (MIPI_DEVICE_READY (pipe),0x00 ); +usleep_range (2000 ,2500 ); +vlv_disable_dsi_pll (encoder); } +static void intel_dsi_post_disable (struct intel_encoder *encoder) +{ +struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); + +DRM_DEBUG_KMS ("\n" ); + +intel_dsi_clear_device_ready (encoder); + +if (intel_dsi->dev.dev_ops->disable_panel_power) + intel_dsi->dev.dev_ops->disable_panel_power (&intel_dsi->dev); +}static bool intel_dsi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe)drivers/gpu/drm/i915/intel_dsi.h +2
-0@@ -41,6 +41,8 @@ struct intel_dsi_dev_ops {void (*panel_reset)(struct intel_dsi_device *dsi); +void (*disable_panel_power)(struct intel_dsi_device *dsi); +/* one time programmable commands if needed */ void (*send_otp_cmds)(struct intel_dsi_device *dsi);Signature · 1 line
1.8.3.2
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH v3 5/7] drm/i915: Reorganize the DSI enable/disable sequence
Quoted 156 lines · Jani Nikula
Quoted 37 lines · Shobhit Kumar
Basically ULPS handling during enable/disable has been moved to
pre_enableandpost_disablephases. PLL and panel power disable also has been moved topost_disablephase. The ULPS entry/exit sequneces as suggested by HW team is as follows -During enable time -
setDEVICE_READY--> ClearDEVICE_READY--> setDEVICE_READYAnd during disable time to flush all FIFOs -
setENTER_SLEEP-->EXIT_SLEEP-->ENTER_SLEEPAlso during disbale sequnece sub-encoder disable is moved to the end after port is disabled.
v2: Based on comments from Ville
- Detailed epxlaination in the commit messgae
- Moved parameter changes out into another patch
- Backlight enabling will be a new patchv3: Updated as per Jani's comments
- Removed theI915_WRITE_BITSas it is not needed
- Movedpanel_resetandsend_otp_cmdshooks todsi_pre_enable
- Moveddisable_panel_powerhook todsi_post_disable
- Replace hardcoding withAFE_LATCHOUTSigned-off-by Yogesh Mohan Marimuthu <[email protected]>Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_dsi.c | 110 +++++++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_dsi.h | 2 + 2 files changed, 79 insertions(+), 33 deletions(-)drivers/gpu/drm/i915/intel_dsi.c +0
-0drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder) · line 104
Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +1
-1@@ -101,46 +101,57 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)vlv_enable_dsi_pll (encoder); } -static void intel_dsi_pre_enable (struct intel_encoder *encoder) +void intel_dsi_device_ready (struct intel_encoder *encoder)Should be static.
Quoted 110 lines
drivers/gpu/drm/i915/intel_dsi.c +39
-31{ +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int pipe = intel_crtc->pipe; +u32 val; +DRM_DEBUG_KMS ("\n" ); -} -static void intel_dsi_enable (struct intel_encoder *encoder) + val =I915_READ (MIPI_PORT_CTRL (pipe)); +I915_WRITE (MIPI_PORT_CTRL (pipe), val |LP_OUTPUT_HOLD ); +usleep_range (1000 ,1500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY |ULPS_STATE_EXIT ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),0x00 ); +usleep_range (2000 ,2500 ); +I915_WRITE (MIPI_DEVICE_READY (pipe),DEVICE_READY ); +usleep_range (2000 ,2500 ); +} +static void intel_dsi_pre_enable (struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); -int pipe = intel_crtc->pipe; -u32 temp;DRM_DEBUG_KMS ("\n" );if (intel_dsi->dev.dev_ops->panel_reset) intel_dsi->dev.dev_ops->panel_reset (&intel_dsi->dev); - temp =I915_READ (MIPI_DEVICE_READY (pipe)); -if ((temp &DEVICE_READY ) ==0 ) { - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp |DEVICE_READY ); - }else if (temp &ULPS_STATE_MASK ) { - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp |ULPS_STATE_EXIT ); -/* -* We need to ensure that there is a minimum of 1 ms time -* available before clearing the UPLS exit state. -*/ -msleep (2 ); -I915_WRITE (MIPI_DEVICE_READY (pipe), temp); - } +/* put device in ready state */ +intel_dsi_device_ready (encoder);if (intel_dsi->dev.dev_ops->send_otp_cmds) intel_dsi->dev.dev_ops->send_otp_cmds (&intel_dsi->dev); +} + +static void intel_dsi_enable (struct intel_encoder *encoder) +{ +struct drm_device *dev = encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); +int pipe = intel_crtc->pipe; +u32 temp; + +DRM_DEBUG_KMS ("\n" );if (is_cmd_mode (intel_dsi))I915_WRITE (MIPI_MAX_RETURN_PKT_SIZE (pipe),8 *4 ); - -if (is_vid_mode (intel_dsi)) { +else {msleep (20 );/* XXX */ dpi_send_cmd (intel_dsi,TURN_ON );msleep (100 );@@ -157,7 +168,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)static void intel_dsi_disable (struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; +struct drm_device *dev = encoder->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base);int pipe = intel_crtc->pipe;@@ -165,8 +177,6 @@ static void intel_dsi_disable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); - intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); -if (is_vid_mode (intel_dsi)) {dpi_send_cmd (intel_dsi,SHUTDOWN );msleep (10 );@@ -179,20 +189,54 @@ static void intel_dsi_disable(struct intel_encoder *encoder)msleep (2 ); } - temp =I915_READ (MIPI_DEVICE_READY (pipe)); -if (temp &DEVICE_READY ) { - temp &= ~DEVICE_READY ; - temp &= ~ULPS_STATE_MASK ; -I915_WRITE (MIPI_DEVICE_READY (pipe), temp); - } +/* if disable packets are sent before sending shutdown packet then in +* some next enable sequence send turn on packet error is observed */ +if (intel_dsi->dev.dev_ops->disable) + intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); }
Quoted 7 lines
drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_disable(struct intel_encoder *encoder) · line 198
Quoted 2 lines
drivers/gpu/drm/i915/intel_dsi.c +1
-1-static void intel_dsi_post_disable (struct intel_encoder *encoder) +void intel_dsi_clear_device_ready (struct intel_encoder *encoder)Should be static.
With these fixed,
Reviewed-by Jani Nikula <[email protected]>
Yeah sending the updated patch
Regards
Shobhit
PATCH v3 6/7 drm/i915: Remove redundant DSI PLL enabling
In reply to Shobhit KumarDSI PLL will get configured during crtc_enable using ->pre_pll_enable and no need to do in ->mode_set
--- drivers/gpu/drm/i915/intel_dsi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -3
@@ -373,9 +373,6 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)DRM_DEBUG_KMS ("pipe %c\n" ,pipe_name (pipe)); -/* Update the DSI PLL */ -vlv_enable_dsi_pll (intel_encoder); -/* XXX: Location of the call */ band_gap_reset (dev_priv);
Signature · 1 line
1.8.3.2
PATCH v3 7/7 drm/i915: Parametrize the dphy and other spec specific parameters
In reply to Shobhit KumarThe values of these parameters will be different for differnet panel based on dsi rate, lane count, etc. Remove the hardcodings and make these as parameters whch will be initialized in panel specific sub-encoder implementaion.
This will also form groundwork for planned generic panel sub-encoder implemntation based on VBT design enhancments to support multiple panels
v2: Mask away the port_bits before use
--- drivers/gpu/drm/i915/intel_dsi.c | 29 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_dsi.h | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +14 -15
@@ -157,7 +157,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)msleep (100 );/* assert ip_tg_enable signal */ - temp =I915_READ (MIPI_PORT_CTRL (pipe)); + temp =I915_READ (MIPI_PORT_CTRL (pipe)) & ~LANE_CONFIGURATION_MASK ; + temp = temp | intel_dsi->port_bits;I915_WRITE (MIPI_PORT_CTRL (pipe), temp |DPI_ENABLE );POSTING_READ (MIPI_PORT_CTRL (pipe)); }
@@ -391,11 +392,7 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)I915_WRITE (MIPI_INTR_STAT (pipe),0xffffffff );I915_WRITE (MIPI_INTR_EN (pipe),0xffffffff ); -I915_WRITE (MIPI_DPHY_PARAM (pipe), -0x3c <<EXIT_ZERO_COUNT_SHIFT | -0x1f <<TRAIL_COUNT_SHIFT | -0xc5 <<CLK_ZERO_COUNT_SHIFT | -0x1f <<PREPARE_COUNT_SHIFT ); +I915_WRITE (MIPI_DPHY_PARAM (pipe), intel_dsi->dphy_reg); I915_WRITE(MIPI_DPI_RESOLUTION(pipe), adjusted_mode->vdisplay << VERTICAL_ADDRESS_SHIFT |
@@ -443,9 +440,9 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder) adjusted_mode->htotal, bpp, intel_dsi->lane_count) + 1); } -I915_WRITE (MIPI_LP_RX_TIMEOUT (pipe),8309 );/* max */ -I915_WRITE (MIPI_TURN_AROUND_TIMEOUT (pipe),0x14 );/* max */ -I915_WRITE (MIPI_DEVICE_RESET_TIMER (pipe),0xffff );/* max */ +I915_WRITE (MIPI_LP_RX_TIMEOUT (pipe), intel_dsi->lp_rx_timeout); +I915_WRITE (MIPI_TURN_AROUND_TIMEOUT (pipe), intel_dsi->turn_arnd_val); +I915_WRITE (MIPI_DEVICE_RESET_TIMER (pipe), intel_dsi->rst_timer_val);/* dphy stuff */
@@ -460,29 +457,31 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)* * XXX: write MIPI_STOP_STATE_STALL? */ -I915_WRITE (MIPI_HIGH_LOW_SWITCH_COUNT (pipe),0x46 ); +I915_WRITE (MIPI_HIGH_LOW_SWITCH_COUNT (pipe), + intel_dsi->hs_to_lp_count);/* XXX: low power clock equivalence in terms of byte clock. the number * of byte clocks occupied in one low power clock. based on txbyteclkhs * and txclkesc. txclkesc time / txbyteclk time * (105 + * MIPI_STOP_STATE_STALL) / 105.??? */ -I915_WRITE (MIPI_LP_BYTECLK (pipe),4 ); +I915_WRITE (MIPI_LP_BYTECLK (pipe), intel_dsi->lp_byte_clk);/* the bw essential for transmitting 16 long packets containing 252 * bytes meant for dcs write memory command is programmed in this * register in terms of byte clocks. based on dsi transfer rate and the * number of lanes configured the time taken to transmit 16 long packets * in a dsi stream varies. */ -I915_WRITE (MIPI_DBI_BW_CTRL (pipe),0x820 ); +I915_WRITE (MIPI_DBI_BW_CTRL (pipe), intel_dsi->bw_timer);I915_WRITE (MIPI_CLK_LANE_SWITCH_TIME_CNT (pipe), -0xa <<LP_HS_SSW_CNT_SHIFT | -0x14 <<HS_LP_PWR_SW_CNT_SHIFT ); + intel_dsi->clk_lp_to_hs_count <<LP_HS_SSW_CNT_SHIFT | + intel_dsi->clk_hs_to_lp_count <<HS_LP_PWR_SW_CNT_SHIFT );if (is_vid_mode (intel_dsi))I915_WRITE (MIPI_VIDEO_MODE_FORMAT (pipe), - intel_dsi->video_mode_format); + intel_dsi->video_frmt_cfg_bits | + intel_dsi->video_mode_format); } static enum drm_connector_status
drivers/gpu/drm/i915/intel_dsi.h +14 -0
@@ -96,6 +96,20 @@ struct intel_dsi {/* eot for MIPI_EOT_DISABLE register */ u32 eot_disable; + +u32 port_bits; +u32 bw_timer; +u32 dphy_reg; +u32 video_frmt_cfg_bits; +u16 lp_byte_clk; + +/* timeouts in byte clocks */ +u16 lp_rx_timeout; +u16 turn_arnd_val; +u16 rst_timer_val; +u16 hs_to_lp_count; +u16 clk_lp_to_hs_count; +u16 clk_hs_to_lp_count; };static inline struct intel_dsi *enc_to_intel_dsi (struct drm_encoder *encoder)
Signature · 1 line
1.8.3.2