stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] drm/i915/dsi: Use a fuzzy check for burst mode clock check
       [not found] <20190524174028.21659-1-hdegoede@redhat.com>
@ 2019-05-24 17:40 ` Hans de Goede
  2019-06-04 17:29   ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2019-05-24 17:40 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, Joonas Lahtinen,
	Ville Syrjälä, Rodrigo Vivi
  Cc: Hans de Goede, intel-gfx, dri-devel, stable

Prior to this commit we fail to init the DSI panel on the GPD MicroPC:
https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/

The problem is intel_dsi_vbt_init() failing with the following error:
*ERROR* Burst mode freq is less than computed

The pclk in the VBT panel modeline is 70000, together with 24 bpp and
4 lines this results in a bitrate value of 70000 * 24 / 4 = 420000.
But the target_burst_mode_freq in the VBT is 418000.

This commit works around this problem by adding an intel_fuzzy_clock_check
when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to
bitrate when that checks succeeds, fixing the panel not working.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
index 022bf59418df..a2a9b9d0eeaa 100644
--- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
@@ -895,6 +895,17 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 		if (mipi_config->target_burst_mode_freq) {
 			u32 bitrate = intel_dsi_bitrate(intel_dsi);
 
+			/*
+			 * Sometimes the VBT contains a slightly lower clock,
+			 * then the bitrate we have calculated, in this case
+			 * just replace it with the calculated bitrate.
+			 */
+			if (mipi_config->target_burst_mode_freq < bitrate &&
+			    intel_fuzzy_clock_check(
+					mipi_config->target_burst_mode_freq,
+					bitrate))
+				mipi_config->target_burst_mode_freq = bitrate;
+
 			if (mipi_config->target_burst_mode_freq < bitrate) {
 				DRM_ERROR("Burst mode freq is less than computed\n");
 				return false;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] drm/i915/dsi: Use a fuzzy check for burst mode clock check
  2019-05-24 17:40 ` [PATCH 2/2] drm/i915/dsi: Use a fuzzy check for burst mode clock check Hans de Goede
@ 2019-06-04 17:29   ` Ville Syrjälä
  2019-06-05 16:28     ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2019-06-04 17:29 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	intel-gfx, dri-devel, stable

On Fri, May 24, 2019 at 07:40:28PM +0200, Hans de Goede wrote:
> Prior to this commit we fail to init the DSI panel on the GPD MicroPC:
> https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/
> 
> The problem is intel_dsi_vbt_init() failing with the following error:
> *ERROR* Burst mode freq is less than computed
> 
> The pclk in the VBT panel modeline is 70000, together with 24 bpp and
> 4 lines this results in a bitrate value of 70000 * 24 / 4 = 420000.
> But the target_burst_mode_freq in the VBT is 418000.
> 
> This commit works around this problem by adding an intel_fuzzy_clock_check
> when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to
> bitrate when that checks succeeds, fixing the panel not working.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
> index 022bf59418df..a2a9b9d0eeaa 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
> @@ -895,6 +895,17 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
>  		if (mipi_config->target_burst_mode_freq) {
>  			u32 bitrate = intel_dsi_bitrate(intel_dsi);
>  
> +			/*
> +			 * Sometimes the VBT contains a slightly lower clock,
> +			 * then the bitrate we have calculated, in this case
> +			 * just replace it with the calculated bitrate.
> +			 */
> +			if (mipi_config->target_burst_mode_freq < bitrate &&
> +			    intel_fuzzy_clock_check(
> +					mipi_config->target_burst_mode_freq,
> +					bitrate))
> +				mipi_config->target_burst_mode_freq = bitrate;

Maybe should squash these patches together to make the stable
backport less painful?

Anyways, seems OK to me.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +
>  			if (mipi_config->target_burst_mode_freq < bitrate) {
>  				DRM_ERROR("Burst mode freq is less than computed\n");
>  				return false;
> -- 
> 2.21.0

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] drm/i915/dsi: Use a fuzzy check for burst mode clock check
  2019-06-04 17:29   ` Ville Syrjälä
@ 2019-06-05 16:28     ` Hans de Goede
  0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2019-06-05 16:28 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Daniel Vetter, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	intel-gfx, dri-devel, stable

Hi,

Thank you for the reviews.

On 04-06-19 19:29, Ville Syrjälä wrote:
> On Fri, May 24, 2019 at 07:40:28PM +0200, Hans de Goede wrote:
>> Prior to this commit we fail to init the DSI panel on the GPD MicroPC:
>> https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/
>>
>> The problem is intel_dsi_vbt_init() failing with the following error:
>> *ERROR* Burst mode freq is less than computed
>>
>> The pclk in the VBT panel modeline is 70000, together with 24 bpp and
>> 4 lines this results in a bitrate value of 70000 * 24 / 4 = 420000.
>> But the target_burst_mode_freq in the VBT is 418000.
>>
>> This commit works around this problem by adding an intel_fuzzy_clock_check
>> when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to
>> bitrate when that checks succeeds, fixing the panel not working.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
>> index 022bf59418df..a2a9b9d0eeaa 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
>> +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
>> @@ -895,6 +895,17 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
>>   		if (mipi_config->target_burst_mode_freq) {
>>   			u32 bitrate = intel_dsi_bitrate(intel_dsi);
>>   
>> +			/*
>> +			 * Sometimes the VBT contains a slightly lower clock,
>> +			 * then the bitrate we have calculated, in this case
>> +			 * just replace it with the calculated bitrate.
>> +			 */
>> +			if (mipi_config->target_burst_mode_freq < bitrate &&
>> +			    intel_fuzzy_clock_check(
>> +					mipi_config->target_burst_mode_freq,
>> +					bitrate))
>> +				mipi_config->target_burst_mode_freq = bitrate;
> 
> Maybe should squash these patches together to make the stable
> backport less painful?

Good idea, done.

> Anyways, seems OK to me.
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

And pushed with your Reviewed-by.

Regards,

Hans

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-05 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190524174028.21659-1-hdegoede@redhat.com>
2019-05-24 17:40 ` [PATCH 2/2] drm/i915/dsi: Use a fuzzy check for burst mode clock check Hans de Goede
2019-06-04 17:29   ` Ville Syrjälä
2019-06-05 16:28     ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).