drm/i915/dsi: 2nd attempt to get rid of IOSF GPIO
Subsystems (3)
v3 cover drm/i915/dsi: 2nd attempt to get rid of IOSF GPIO
DSI code for VBT has a set of ugly GPIO hacks, one of which is direct talking to GPIO IP behind the actual driver's back. A second attempt to fix that is here.
If I understood correctly, my approach should work in the similar way as the current IOSF GPIO.
Hans, I believe you have some devices that use this piece of code, is it possible to give a test run on (one of) them?
In v3:
- incorporated series by Jani
- incorporated couple of precursor patches by Hans
- added Rb tag for used to be first three patches (Andi)
- rebased on top of the above changes
- fixed indexing for multi-community devices, such as Cherry View
In v2:
- added a few cleanup patches
- reworked to use dynamic GPIO lookup tables
- converted CHV as well
Andy Shevchenko (8):
drm/i915/dsi: Replace while(1) with one with clear exit condition drm/i915/dsi: Get rid of redundant 'else'
drm/i915/dsi: Replace check with a (missing) MIPI sequence name drm/i915/dsi: Extract common soc_gpio_set_value() helper drm/i915/dsi: Replace poking of VLV GPIOs behind the driver's back drm/i915/dsi: Prepare soc_gpio_set_value() to distinguish GPIO
communities
drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back drm/i915/iosf: Drop unused APIs
Hans de Goede (2):
drm/i915/dsi: Remove GPIO lookup table at the end of
intel_dsi_vbt_gpio_init()
drm/i915/dsi: Fix wrong initial value for GPIOs in bxt_exec_gpio()
Jani Nikula (5):
drm/i915/dsi: assume BXT gpio works for non-native GPIO drm/i915/dsi: switch mipi_exec_gpio() from dev_priv to i915 drm/i915/dsi: clarify GPIO exec sequence drm/i915/dsi: rename platform specific *_exec_gpio() to
*_gpio_set_value()
drm/i915/dsi: bxt/icl GPIO set value do not need gpio source
drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 355 +++++++------------ drivers/gpu/drm/i915/vlv_sideband.c | 17 - drivers/gpu/drm/i915/vlv_sideband.h | 3 - 3 files changed, 137 insertions(+), 238 deletions(-)
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 1/15 drm/i915/dsi: assume BXT gpio works for non-native GPIO
From: Jani Nikula <[email protected]>
Purely a guess. Drop the nop function.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +1 -9
@@ -372,14 +372,6 @@ static void bxt_exec_gpio(struct intel_connector *connector,gpiod_set_value (gpio_desc, value); } -static void icl_exec_gpio (struct intel_connector *connector, -u8 gpio_source,u8 gpio_index,bool value) -{ -struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); - -drm_dbg_kms (&dev_priv->drm,"Skipping ICL GPIO element execution\n" ); -} -enum {MIPI_RESET_1 =0 ,MIPI_AVDD_EN_1 ,
@@ -491,7 +483,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)if (native)icl_native_gpio_set_value (dev_priv, gpio_number, value);else if (DISPLAY_VER (dev_priv) >=11 ) -icl_exec_gpio (connector, gpio_source, gpio_index, value); +bxt_exec_gpio (connector, gpio_source, gpio_index, value);else if (IS_VALLEYVIEW (dev_priv))vlv_exec_gpio (connector, gpio_source, gpio_number, value);else if (IS_CHERRYVIEW (dev_priv))
Signature · 1 line
2.40.0.1.gaa8946217a0b
Re: [Intel-gfx] [PATCH v3 01/15] drm/i915/dsi: assume BXT gpio works for non-native GPIO
Quoted 32 lines · Andy Shevchenko
From: Jani Nikula <[email protected]>
Purely a guess. Drop the nop function.
Cc Andy Shevchenko <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Jani Nikula <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/gpu/drm/i915/display/intel_dsi_vbt.c +0
-8@@ -372,14 +372,6 @@ static void bxt_exec_gpio(struct intel_connector *connector,gpiod_set_value (gpio_desc, value); } -static void icl_exec_gpio (struct intel_connector *connector, -u8 gpio_source,u8 gpio_index,bool value) -{ -struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); - -drm_dbg_kms (&dev_priv->drm,"Skipping ICL GPIO element execution\n" ); -} -enum {MIPI_RESET_1 =0 ,MIPI_AVDD_EN_1 ,
drivers/gpu/drm/i915/display/intel_dsi_vbt.c static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data) · line 486
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +1
-1@@ -491,7 +483,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)if (native)icl_native_gpio_set_value (dev_priv, gpio_number, value);else if (DISPLAY_VER (dev_priv) >=11 ) -icl_exec_gpio (connector, gpio_source, gpio_index, value); +bxt_exec_gpio (connector, gpio_source, gpio_index, value);
We could just drop this whole branch since we end up in bxt_exec_gpio() in the end anyway. Or we drop the final else and make this one check for DISPLAY_VER >=9.
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +0
-0else if (IS_VALLEYVIEW (dev_priv))vlv_exec_gpio (connector, gpio_source, gpio_number, value);else if (IS_CHERRYVIEW (dev_priv))Signature · 1 line
2.40.0.1.gaa8946217a0b
Signature · 2 lines
Ville Syrjälä Intel
Re: [Intel-gfx] [PATCH v3 01/15] drm/i915/dsi: assume BXT gpio works for non-native GPIO
Quoted 1 line · Ville Syrjälä
On Thu, Nov 02, 2023 at 05:12:14PM +0200, Andy Shevchenko wrote:
...
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data) · line 486
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +1
-1if (native)icl_native_gpio_set_value (dev_priv, gpio_number, value);else if (DISPLAY_VER (dev_priv) >=11 ) -icl_exec_gpio (connector, gpio_source, gpio_index, value); +bxt_exec_gpio (connector, gpio_source, gpio_index, value);We could just drop this whole branch since we end up in
bxt_exec_gpio()in the end anyway. Or we drop the final else and make this one check forDISPLAY_VER>=9.
Looking at the code, I'm not sure how we can get rid of it, but the second option is feasible.
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +0
-0else if (IS_VALLEYVIEW (dev_priv))vlv_exec_gpio (connector, gpio_source, gpio_number, value);else if (IS_CHERRYVIEW (dev_priv))
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 2/15 drm/i915/dsi: switch mipi_exec_gpio() from dev_priv to i915
In reply to Andy ShevchenkoFrom: Jani Nikula <[email protected]>
Follow the contemporary conventions.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +7 -7
@@ -454,11 +454,11 @@ static void icl_native_gpio_set_value(struct drm_i915_private *dev_priv,static const u8 *mipi_exec_gpio (struct intel_dsi *intel_dsi,const u8 *data) {struct drm_device *dev = intel_dsi->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *i915 =to_i915 (dev);struct intel_connector *connector = intel_dsi->attached_connector;u8 gpio_source, gpio_index =0 , gpio_number;bool value; -bool native =DISPLAY_VER (dev_priv) >=11 ; +bool native =DISPLAY_VER (i915) >=11 ;if (connector->panel.vbt.dsi.seq_version >=3 ) gpio_index = *data++;
@@ -477,16 +477,16 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)/* pull up/down */ value = *data++ &1 ; -drm_dbg_kms (&dev_priv->drm,"GPIO index %u, number %u, source %u, native %s, set to %s\n" , +drm_dbg_kms (&i915->drm,"GPIO index %u, number %u, source %u, native %s, set to %s\n" , gpio_index, gpio_number, gpio_source,str_yes_no (native),str_on_off (value));if (native) -icl_native_gpio_set_value (dev_priv, gpio_number, value); -else if (DISPLAY_VER (dev_priv) >=11 ) +icl_native_gpio_set_value (i915, gpio_number, value); +else if (DISPLAY_VER (i915) >=11 )bxt_exec_gpio (connector, gpio_source, gpio_index, value); -else if (IS_VALLEYVIEW (dev_priv)) +else if (IS_VALLEYVIEW (i915))vlv_exec_gpio (connector, gpio_source, gpio_number, value); -else if (IS_CHERRYVIEW (dev_priv)) +else if (IS_CHERRYVIEW (i915))chv_exec_gpio (connector, gpio_source, gpio_number, value);else bxt_exec_gpio (connector, gpio_source, gpio_index, value);
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 3/15 drm/i915/dsi: clarify GPIO exec sequence
In reply to Andy ShevchenkoFrom: Jani Nikula <[email protected]>
With the various sequence versions and pointer increments interleaved, it's a bit hard to decipher what's going on. Add separate paths for different sequence versions.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 31 +++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +17 -14
@@ -456,26 +456,29 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)struct drm_device *dev = intel_dsi->base.base.dev;struct drm_i915_private *i915 =to_i915 (dev);struct intel_connector *connector = intel_dsi->attached_connector; -u8 gpio_source, gpio_index =0 , gpio_number; +u8 gpio_source =0 , gpio_index =0 , gpio_number;bool value; +int size;bool native =DISPLAY_VER (i915) >=11 ; -if (connector->panel.vbt.dsi.seq_version >=3 ) - gpio_index = *data++; +if (connector->panel.vbt.dsi.seq_version >=3 ) { + size =3 ; - gpio_number = *data++; + gpio_index = data[0 ]; + gpio_number = data[1 ]; + value = data[2 ] &BIT (0 ); -/* gpio source in sequence v2 only */ -if (connector->panel.vbt.dsi.seq_version ==2 ) - gpio_source = (*data >>1 ) &3 ; -else - gpio_source =0 ; +if (connector->panel.vbt.dsi.seq_version >=4 && data[2 ] &BIT (1 )) + native = false; + }else { + size =2 ; -if (connector->panel.vbt.dsi.seq_version >=4 && *data &BIT (1 )) - native = false; + gpio_number = data[0 ]; + value = data[1 ] &BIT (0 ); -/* pull up/down */ - value = *data++ &1 ; +if (connector->panel.vbt.dsi.seq_version ==2 ) + gpio_source = (data[1 ] >>1 ) &3 ; + }drm_dbg_kms (&i915->drm,"GPIO index %u, number %u, source %u, native %s, set to %s\n" , gpio_index, gpio_number, gpio_source,str_yes_no (native),str_on_off (value));
@@ -491,7 +494,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)else bxt_exec_gpio (connector, gpio_source, gpio_index, value); -return data; +return data + size; }#ifdef CONFIG_ACPI
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 4/15 drm/i915/dsi: rename platform specific *_exec_gpio() to *_gpio_set_value()
In reply to Andy ShevchenkoFrom: Jani Nikula <[email protected]>
The lowest level functions are about setting GPIO values, not about executing any sequences anymore.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +10 -10
@@ -243,8 +243,8 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)return data; } -static void vlv_exec_gpio (struct intel_connector *connector, -u8 gpio_source,u8 gpio_index,bool value) +static void vlv_gpio_set_value (struct intel_connector *connector, +u8 gpio_source,u8 gpio_index,bool value) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);struct gpio_map *map;
@@ -291,8 +291,8 @@ static void vlv_exec_gpio(struct intel_connector *connector,vlv_iosf_sb_put (dev_priv,BIT (VLV_IOSF_SB_GPIO )); } -static void chv_exec_gpio (struct intel_connector *connector, -u8 gpio_source,u8 gpio_index,bool value) +static void chv_gpio_set_value (struct intel_connector *connector, +u8 gpio_source,u8 gpio_index,bool value) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);u16 cfg0, cfg1;
@@ -345,8 +345,8 @@ static void chv_exec_gpio(struct intel_connector *connector,vlv_iosf_sb_put (dev_priv,BIT (VLV_IOSF_SB_GPIO )); } -static void bxt_exec_gpio (struct intel_connector *connector, -u8 gpio_source,u8 gpio_index,bool value) +static void bxt_gpio_set_value (struct intel_connector *connector, +u8 gpio_source,u8 gpio_index,bool value) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);/* XXX: this table is a quick ugly hack. */
@@ -486,13 +486,13 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)if (native)icl_native_gpio_set_value (i915, gpio_number, value);else if (DISPLAY_VER (i915) >=11 ) -bxt_exec_gpio (connector, gpio_source, gpio_index, value); +bxt_gpio_set_value (connector, gpio_source, gpio_index, value);else if (IS_VALLEYVIEW (i915)) -vlv_exec_gpio (connector, gpio_source, gpio_number, value); +vlv_gpio_set_value (connector, gpio_source, gpio_number, value);else if (IS_CHERRYVIEW (i915)) -chv_exec_gpio (connector, gpio_source, gpio_number, value); +chv_gpio_set_value (connector, gpio_source, gpio_number, value);else -bxt_exec_gpio (connector, gpio_source, gpio_index, value); +bxt_gpio_set_value (connector, gpio_source, gpio_index, value);return data + size; }
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 5/15 drm/i915/dsi: bxt/icl GPIO set value do not need gpio source
In reply to Andy ShevchenkoFrom: Jani Nikula <[email protected]>
Drop the unused parameter.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +3 -3
@@ -346,7 +346,7 @@ static void chv_gpio_set_value(struct intel_connector *connector, }static void bxt_gpio_set_value (struct intel_connector *connector, -u8 gpio_source,u8 gpio_index,bool value) +u8 gpio_index,bool value) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);/* XXX: this table is a quick ugly hack. */
@@ -486,13 +486,13 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)if (native)icl_native_gpio_set_value (i915, gpio_number, value);else if (DISPLAY_VER (i915) >=11 ) -bxt_gpio_set_value (connector, gpio_source, gpio_index, value); +bxt_gpio_set_value (connector, gpio_index, value);else if (IS_VALLEYVIEW (i915))vlv_gpio_set_value (connector, gpio_source, gpio_number, value);else if (IS_CHERRYVIEW (i915))chv_gpio_set_value (connector, gpio_source, gpio_number, value);else -bxt_gpio_set_value (connector, gpio_source, gpio_index, value); +bxt_gpio_set_value (connector, gpio_index, value);return data + size; }
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 6/15 drm/i915/dsi: Replace while(1) with one with clear exit condition
In reply to Andy ShevchenkoMove existing condition to while(), so it will be clear on what circumstances the loop is successfully finishing.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +1 -4
@@ -702,13 +702,10 @@ static void intel_dsi_vbt_exec(struct intel_dsi *intel_dsi,if (connector->panel.vbt.dsi.seq_version >=3 ) data +=4 ; -while (1 ) { +while (*data !=MIPI_SEQ_ELEM_END ) {u8 operation_byte = *data++;u8 operation_size =0 ; -if (operation_byte ==MIPI_SEQ_ELEM_END ) -break ; -if (operation_byte <ARRAY_SIZE (exec_elem)) mipi_elem_exec = exec_elem[operation_byte];else
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 7/15 drm/i915/dsi: Get rid of redundant 'else'
In reply to Andy ShevchenkoIn the snippets like the following
if (...) return / goto / break / continue ...; else ...
the 'else' is redundant. Get rid of it.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 58 ++++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +28 -30
@@ -142,7 +142,7 @@ static enum port intel_dsi_seq_port_to_port(struct intel_dsi *intel_dsi,if (seq_port) {if (intel_dsi->ports &BIT (PORT_B ))return PORT_B ; -else if (intel_dsi->ports &BIT (PORT_C )) +if (intel_dsi->ports &BIT (PORT_C ))return PORT_C ; }
@@ -670,8 +670,8 @@ static const char *sequence_name(enum mipi_seq seq_id) {if (seq_id <ARRAY_SIZE (seq_name) && seq_name[seq_id])return seq_name[seq_id]; -else -return "(unknown)" ; + +return "(unknown)" ; } static void intel_dsi_vbt_exec(struct intel_dsi *intel_dsi,
@@ -865,36 +865,34 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)* multiply by 100 to preserve remainder */ if (intel_dsi->video_mode ==BURST_MODE ) { -if (mipi_config->target_burst_mode_freq) { -u32 bitrate =intel_dsi_bitrate (intel_dsi); +u32 bitrate; -/* -* 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_err (&dev_priv->drm, -"Burst mode freq is less than computed\n" ); -return false; - } - - burst_mode_ratio =DIV_ROUND_UP ( - mipi_config->target_burst_mode_freq *100 , - bitrate); - - intel_dsi->pclk =DIV_ROUND_UP (intel_dsi->pclk * burst_mode_ratio,100 ); - }else { -drm_err (&dev_priv->drm, -"Burst mode target is not set\n" ); +if (mipi_config->target_burst_mode_freq ==0 ) { +drm_err (&dev_priv->drm,"Burst mode target is not set\n" );return false; } + + 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_err (&dev_priv->drm,"Burst mode freq is less than computed\n" ); +return false; + } + + burst_mode_ratio = +DIV_ROUND_UP (mipi_config->target_burst_mode_freq *100 , bitrate); + + intel_dsi->pclk =DIV_ROUND_UP (intel_dsi->pclk * burst_mode_ratio,100 ); }else burst_mode_ratio =100 ;
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 8/15 drm/i915/dsi: Replace check with a (missing) MIPI sequence name
In reply to Andy ShevchenkoNames of the MIPI sequence steps are sequential and defined, no need to check for the gaps. However in seq_name the MIPI_SEQ_END is missing. Add it there, and drop unneeded NULL check in sequence_name().
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +2 -1
@@ -653,6 +653,7 @@ static const fn_mipi_elem_exec exec_elem[] = {*/ static const char *const seq_name[] = { + [MIPI_SEQ_END ] ="MIPI_SEQ_END" , [MIPI_SEQ_DEASSERT_RESET ] ="MIPI_SEQ_DEASSERT_RESET" , [MIPI_SEQ_INIT_OTP ] ="MIPI_SEQ_INIT_OTP" , [MIPI_SEQ_DISPLAY_ON ] ="MIPI_SEQ_DISPLAY_ON" ,
@@ -668,7 +669,7 @@ static const char * const seq_name[] = {static const char *sequence_name (enum mipi_seq seq_id) { -if (seq_id <ARRAY_SIZE (seq_name) && seq_name[seq_id]) +if (seq_id <ARRAY_SIZE (seq_name))return seq_name[seq_id];return "(unknown)" ;
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 9/15 drm/i915/dsi: Remove GPIO lookup table at the end of intel_dsi_vbt_gpio_init()
In reply to Andy ShevchenkoFrom: Hans de Goede <[email protected]>
To properly deal with GPIOs used in MIPI panel sequences a temporary GPIO lookup will be used. Since there can only be 1 GPIO lookup table for the "0000:00:02.0" device this will not work if the GPIO lookup table used by intel_dsi_vbt_gpio_init() is still registered.
After getting the "backlight" and "panel" GPIOs the lookup table registered by intel_dsi_vbt_gpio_init() is no longer necessary, remove it so that another temporary lookup-table for the "0000:00:02.0" device can be added.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +9 -16
@@ -955,6 +955,7 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on)struct intel_connector *connector = intel_dsi->attached_connector;struct mipi_config *mipi_config = connector->panel.vbt.dsi.config;enum gpiod_flags flags = panel_is_on ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ; +struct gpiod_lookup_table *gpiod_lookup_table =NULL ;bool want_backlight_gpio = false;bool want_panel_gpio = false;struct pinctrl *pinctrl;
@@ -962,12 +963,12 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on)if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && mipi_config->pwm_blc ==PPS_BLC_PMIC ) { -gpiod_add_lookup_table (&pmic_panel_gpio_table); + gpiod_lookup_table = &pmic_panel_gpio_table; want_panel_gpio = true; }if (IS_VALLEYVIEW (dev_priv) && mipi_config->pwm_blc ==PPS_BLC_SOC ) { -gpiod_add_lookup_table (&soc_panel_gpio_table); + gpiod_lookup_table = &soc_panel_gpio_table; want_panel_gpio = true; want_backlight_gpio = true;
@@ -984,6 +985,9 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on) "Failed to set pinmux to PWM\n"); } +if (gpiod_lookup_table) +gpiod_add_lookup_table (gpiod_lookup_table); +if (want_panel_gpio) { intel_dsi->gpio_panel =gpiod_get (dev->dev,"panel" , flags);if (IS_ERR (intel_dsi->gpio_panel)) {
@@ -1002,15 +1006,13 @@ void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on) intel_dsi->gpio_backlight =NULL ; } } + +if (gpiod_lookup_table) +gpiod_remove_lookup_table (gpiod_lookup_table); }void intel_dsi_vbt_gpio_cleanup (struct intel_dsi *intel_dsi) { -struct drm_device *dev = intel_dsi->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_connector *connector = intel_dsi->attached_connector; -struct mipi_config *mipi_config = connector->panel.vbt.dsi.config; -if (intel_dsi->gpio_panel) {gpiod_put (intel_dsi->gpio_panel); intel_dsi->gpio_panel =NULL ;
@@ -1020,13 +1022,4 @@ void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi)gpiod_put (intel_dsi->gpio_backlight); intel_dsi->gpio_backlight =NULL ; } - -if ((IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && - mipi_config->pwm_blc ==PPS_BLC_PMIC ) -gpiod_remove_lookup_table (&pmic_panel_gpio_table); - -if (IS_VALLEYVIEW (dev_priv) && mipi_config->pwm_blc ==PPS_BLC_SOC ) { -pinctrl_unregister_mappings (soc_pwm_pinctrl_map); -gpiod_remove_lookup_table (&soc_panel_gpio_table); - } }
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 10/15 drm/i915/dsi: Fix wrong initial value for GPIOs in bxt_exec_gpio()
In reply to Andy ShevchenkoFrom: Hans de Goede <[email protected]>
Fix wrong initial value for GPIOs in bxt_exec_gpio().
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +1 -3
@@ -356,9 +356,7 @@ static void bxt_gpio_set_value(struct intel_connector *connector,if (!gpio_desc) { gpio_desc =devm_gpiod_get_index (dev_priv->drm.dev,NULL , gpio_index, - value ?GPIOD_OUT_LOW : -GPIOD_OUT_HIGH ); - + value ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW );if (IS_ERR_OR_NULL (gpio_desc)) { drm_err(&dev_priv->drm, "GPIO index %u request failed (%ld)\n",
Signature · 1 line
2.40.0.1.gaa8946217a0b
Re: [PATCH v3 10/15] drm/i915/dsi: Fix wrong initial value for GPIOs in bxt_exec_gpio()
Quoted 3 lines · Andy Shevchenko
From: Hans de Goede <[email protected]>
Fix wrong initial value for GPIOs in
bxt_exec_gpio().
Oh, and forgot to update the function name in this patch.
In any case I would wait for Hans to confirm it works (and probably he may give a formal Tested-by tag) and then will send v4 to be applied for real.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 11/15 drm/i915/dsi: Extract common soc_gpio_set_value() helper
In reply to Andy ShevchenkoExtract a common soc_gpio_set_value() helper that may be used by a few SoCs.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 46 +++++++++++--------- 1 file changed, 26 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +26 -20
@@ -243,6 +243,31 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)return data; } +static void soc_gpio_set_value (struct intel_connector *connector,const char *con_id, +u8 gpio_index,bool value) +{ +struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +/* XXX: this table is a quick ugly hack. */ +static struct gpio_desc *soc_gpio_table[U8_MAX +1 ]; +struct gpio_desc *gpio_desc = soc_gpio_table[gpio_index]; + +if (gpio_desc) { +gpiod_set_value (gpio_desc, value); + }else { + gpio_desc =devm_gpiod_get_index (dev_priv->drm.dev, + con_id, gpio_index, + value ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ); +if (IS_ERR (gpio_desc)) { +drm_err (&dev_priv->drm, +"GPIO index %u request failed (%pe)\n" , + gpio_index, gpio_desc); +return ; + } + + soc_gpio_table[gpio_index] = gpio_desc; + } +} +static void vlv_gpio_set_value (struct intel_connector *connector,u8 gpio_source,u8 gpio_index,bool value) {
@@ -348,26 +373,7 @@ static void chv_gpio_set_value(struct intel_connector *connector,static void bxt_gpio_set_value (struct intel_connector *connector,u8 gpio_index,bool value) { -struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); -/* XXX: this table is a quick ugly hack. */ -static struct gpio_desc *bxt_gpio_table[U8_MAX +1 ]; -struct gpio_desc *gpio_desc = bxt_gpio_table[gpio_index]; - -if (!gpio_desc) { - gpio_desc =devm_gpiod_get_index (dev_priv->drm.dev, -NULL , gpio_index, - value ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ); -if (IS_ERR_OR_NULL (gpio_desc)) { -drm_err (&dev_priv->drm, -"GPIO index %u request failed (%ld)\n" , - gpio_index,PTR_ERR (gpio_desc)); -return ; - } - - bxt_gpio_table[gpio_index] = gpio_desc; - } - -gpiod_set_value (gpio_desc, value); +soc_gpio_set_value (connector,NULL , gpio_index, value); }enum {
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 12/15 drm/i915/dsi: Replace poking of VLV GPIOs behind the driver's back
In reply to Andy ShevchenkoIt's a dirty hack in the driver that pokes GPIO registers behind the driver's back. Moreoever it might be problematic as simultaneous I/O may hang the system, see the commit 40ecab551232 ("pinctrl:
baytrail: Really serialize all register accesses") for the details. Taking all this into consideration replace the hack with proper GPIO APIs being used.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 98 ++++++-------------- 1 file changed, 28 insertions(+), 70 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +28 -70
@@ -55,43 +55,6 @@#define MIPI_VIRTUAL_CHANNEL_SHIFT 1#define MIPI_PORT_SHIFT 3 -/* base offsets for gpio pads */ -#define VLV_GPIO_NC_0_HV_DDI0_HPD 0x4130 -#define VLV_GPIO_NC_1_HV_DDI0_DDC_SDA 0x4120 -#define VLV_GPIO_NC_2_HV_DDI0_DDC_SCL 0x4110 -#define VLV_GPIO_NC_3_PANEL0_VDDEN 0x4140 -#define VLV_GPIO_NC_4_PANEL0_BKLTEN 0x4150 -#define VLV_GPIO_NC_5_PANEL0_BKLTCTL 0x4160 -#define VLV_GPIO_NC_6_HV_DDI1_HPD 0x4180 -#define VLV_GPIO_NC_7_HV_DDI1_DDC_SDA 0x4190 -#define VLV_GPIO_NC_8_HV_DDI1_DDC_SCL 0x4170 -#define VLV_GPIO_NC_9_PANEL1_VDDEN 0x4100 -#define VLV_GPIO_NC_10_PANEL1_BKLTEN 0x40E0 -#define VLV_GPIO_NC_11_PANEL1_BKLTCTL 0x40F0 - -#define VLV_GPIO_PCONF0 (base_offset) (base_offset) -#define VLV_GPIO_PAD_VAL (base_offset) ((base_offset) + 8) - -struct gpio_map { -u16 base_offset; -bool init; -}; - -static struct gpio_map vlv_gpio_table[] = { - {VLV_GPIO_NC_0_HV_DDI0_HPD }, - {VLV_GPIO_NC_1_HV_DDI0_DDC_SDA }, - {VLV_GPIO_NC_2_HV_DDI0_DDC_SCL }, - {VLV_GPIO_NC_3_PANEL0_VDDEN }, - {VLV_GPIO_NC_4_PANEL0_BKLTEN }, - {VLV_GPIO_NC_5_PANEL0_BKLTCTL }, - {VLV_GPIO_NC_6_HV_DDI1_HPD }, - {VLV_GPIO_NC_7_HV_DDI1_DDC_SDA }, - {VLV_GPIO_NC_8_HV_DDI1_DDC_SCL }, - {VLV_GPIO_NC_9_PANEL1_VDDEN }, - {VLV_GPIO_NC_10_PANEL1_BKLTEN }, - {VLV_GPIO_NC_11_PANEL1_BKLTCTL }, -}; -struct i2c_adapter_lookup {u16 slave_addr;struct intel_dsi *intel_dsi;
@@ -268,52 +231,47 @@ static void soc_gpio_set_value(struct intel_connector *connector, const char *co } } +static void soc_opaque_gpio_set_value (struct intel_connector *connector, +const char *chip,const char *con_id, +u8 gpio_index,bool value) +{ +struct gpiod_lookup_table *lookup; + + lookup =kzalloc (struct_size (lookup, table,2 ),GFP_KERNEL ); +if (!lookup) +return ; + + lookup->dev_id ="0000:00:02.0" ; + lookup->table[0 ] = +GPIO_LOOKUP_IDX (chip, gpio_index, con_id, gpio_index,GPIO_ACTIVE_HIGH ); + +gpiod_add_lookup_table (lookup); + +soc_gpio_set_value (connector, con_id, gpio_index, value); + +gpiod_remove_lookup_table (lookup); +kfree (lookup); +} +static void vlv_gpio_set_value (struct intel_connector *connector,u8 gpio_source,u8 gpio_index,bool value) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); -struct gpio_map *map; -u16 pconf0, padval; -u32 tmp; -u8 port; -if (gpio_index >=ARRAY_SIZE (vlv_gpio_table)) { -drm_dbg_kms (&dev_priv->drm,"unknown gpio index %u\n" , - gpio_index); -return ; - } - - map = &vlv_gpio_table[gpio_index]; - -if (connector->panel.vbt.dsi.seq_version >=3 ) { -/* XXX: this assumes vlv_gpio_table only has NC GPIOs. */ - port =IOSF_PORT_GPIO_NC ; - }else { -if (gpio_source ==0 ) { - port =IOSF_PORT_GPIO_NC ; - }else if (gpio_source ==1 ) { +/* XXX: this assumes vlv_gpio_table only has NC GPIOs. */ +if (connector->panel.vbt.dsi.seq_version <3 ) { +if (gpio_source ==1 ) {drm_dbg_kms (&dev_priv->drm,"SC gpio not supported\n" );return ; - }else { + } +if (gpio_source >1 ) {drm_dbg_kms (&dev_priv->drm,"unknown gpio source %u\n" , gpio_source);return ; } } - pconf0 =VLV_GPIO_PCONF0 (map->base_offset); - padval =VLV_GPIO_PAD_VAL (map->base_offset); - -vlv_iosf_sb_get (dev_priv,BIT (VLV_IOSF_SB_GPIO )); -if (!map->init) { -/* FIXME: remove constant below */ -vlv_iosf_sb_write (dev_priv, port, pconf0,0x2000CC00 ); - map->init = true; - } - - tmp =0x4 | value; -vlv_iosf_sb_write (dev_priv, port, padval, tmp); -vlv_iosf_sb_put (dev_priv,BIT (VLV_IOSF_SB_GPIO )); +soc_opaque_gpio_set_value (connector,"INT33FC:01" ,"Panel N" , gpio_index, value); } static void chv_gpio_set_value(struct intel_connector *connector,
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 13/15 drm/i915/dsi: Prepare soc_gpio_set_value() to distinguish GPIO communities
In reply to Andy ShevchenkoCurrently soc_gpio_set_value() supports only a single indexing for GPIO pin. For CHV case, for example, we will need to distinguish community based index from the one that VBT is using. Introduce an additional parameter to soc_gpio_set_value() and its callers.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +10 -10
@@ -206,8 +206,8 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)return data; } -static void soc_gpio_set_value (struct intel_connector *connector,const char *con_id, -u8 gpio_index,bool value) +static void soc_gpio_set_value (struct intel_connector *connector,u8 gpio_index, +const char *con_id,u8 idx,bool value) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);/* XXX: this table is a quick ugly hack. */
@@ -217,8 +217,7 @@ static void soc_gpio_set_value(struct intel_connector *connector, const char *coif (gpio_desc) {gpiod_set_value (gpio_desc, value); }else { - gpio_desc =devm_gpiod_get_index (dev_priv->drm.dev, - con_id, gpio_index, + gpio_desc =devm_gpiod_get_index (dev_priv->drm.dev, con_id, idx, value ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW );if (IS_ERR (gpio_desc)) { drm_err(&dev_priv->drm,
@@ -232,8 +231,8 @@ static void soc_gpio_set_value(struct intel_connector *connector, const char *co }static void soc_opaque_gpio_set_value (struct intel_connector *connector, -const char *chip,const char *con_id, -u8 gpio_index,bool value) +u8 gpio_index,const char *chip, +const char *con_id,u8 idx,bool value) {struct gpiod_lookup_table *lookup;
@@ -243,11 +242,11 @@ static void soc_opaque_gpio_set_value(struct intel_connector *connector, lookup->dev_id ="0000:00:02.0" ; lookup->table[0 ] = -GPIO_LOOKUP_IDX (chip, gpio_index, con_id, gpio_index,GPIO_ACTIVE_HIGH ); +GPIO_LOOKUP_IDX (chip, idx, con_id, idx,GPIO_ACTIVE_HIGH );gpiod_add_lookup_table (lookup); -soc_gpio_set_value (connector, con_id, gpio_index, value); +soc_gpio_set_value (connector, gpio_index, con_id, idx, value);gpiod_remove_lookup_table (lookup);kfree (lookup);
@@ -271,7 +270,8 @@ static void vlv_gpio_set_value(struct intel_connector *connector, } } -soc_opaque_gpio_set_value (connector,"INT33FC:01" ,"Panel N" , gpio_index, value); +soc_opaque_gpio_set_value (connector, gpio_index, +"INT33FC:01" ,"Panel N" , gpio_index, value); } static void chv_gpio_set_value(struct intel_connector *connector,
@@ -331,7 +331,7 @@ static void chv_gpio_set_value(struct intel_connector *connector,static void bxt_gpio_set_value (struct intel_connector *connector,u8 gpio_index,bool value) { -soc_gpio_set_value (connector,NULL , gpio_index, value); +soc_gpio_set_value (connector, gpio_index,NULL , gpio_index, value); }enum {
Signature · 1 line
2.40.0.1.gaa8946217a0b
PATCH v3 14/15 drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back
In reply to Andy ShevchenkoIt's a dirty hack in the driver that pokes GPIO registers behind the driver's back. Moreoever it might be problematic as simultaneous I/O may hang the system, see the commit 0bd50d719b00 ("pinctrl:
cherryview: prevent concurrent access to GPIO controllers") for the details. Taking all this into consideration replace the hack with proper GPIO APIs being used.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 47 +++++--------------- 1 file changed, 10 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +10 -37
@@ -66,19 +66,6 @@ struct i2c_adapter_lookup {#define CHV_GPIO_IDX_START_SW 100#define CHV_GPIO_IDX_START_SE 198 -#define CHV_VBT_MAX_PINS_PER_FMLY 15 - -#define CHV_GPIO_PAD_CFG0 (f, i) (0x4400 + (f) * 0x400 + (i) * 8) -#define CHV_GPIO_GPIOEN (1 << 15) -#define CHV_GPIO_GPIOCFG_GPIO (0 << 8) -#define CHV_GPIO_GPIOCFG_GPO (1 << 8) -#define CHV_GPIO_GPIOCFG_GPI (2 << 8) -#define CHV_GPIO_GPIOCFG_HIZ (3 << 8) -#define CHV_GPIO_GPIOTXSTATE (state) ((!!(state)) << 1) - -#define CHV_GPIO_PAD_CFG1 (f, i) (0x4400 + (f) * 0x400 + (i) * 8 + 4) -#define CHV_GPIO_CFGLOCK (1 << 31) -/* ICL DSI Display GPIO Pins */ #define ICL_GPIO_DDSP_HPD_A 0#define ICL_GPIO_L_VDDEN_1 1
@@ -278,23 +265,21 @@ static void chv_gpio_set_value(struct intel_connector *connector, u8 gpio_source, u8 gpio_index, bool value) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); -u16 cfg0, cfg1; -u16 family_num; -u8 port;if (connector->panel.vbt.dsi.seq_version >=3 ) {if (gpio_index >=CHV_GPIO_IDX_START_SE ) {/* XXX: it's unclear whether 255->57 is part of SE. */ - gpio_index -=CHV_GPIO_IDX_START_SE ; - port =CHV_IOSF_PORT_GPIO_SE ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:03" ,"Panel SE" , + gpio_index -CHV_GPIO_IDX_START_SW , value); }else if (gpio_index >=CHV_GPIO_IDX_START_SW ) { - gpio_index -=CHV_GPIO_IDX_START_SW ; - port =CHV_IOSF_PORT_GPIO_SW ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:00" ,"Panel SW" , + gpio_index -CHV_GPIO_IDX_START_SW , value); }else if (gpio_index >=CHV_GPIO_IDX_START_E ) { - gpio_index -=CHV_GPIO_IDX_START_E ; - port =CHV_IOSF_PORT_GPIO_E ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:02" ,"Panel E" , + gpio_index -CHV_GPIO_IDX_START_E , value); }else { - port =CHV_IOSF_PORT_GPIO_N ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:01" ,"Panel N" , + gpio_index -CHV_GPIO_IDX_START_N , value); } }else {/* XXX: The spec is unclear about CHV GPIO on seq v2 */
@@ -311,21 +296,9 @@ static void chv_gpio_set_value(struct intel_connector *connector,return ; } - port =CHV_IOSF_PORT_GPIO_N ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:01" ,"Panel N" , + gpio_index -CHV_GPIO_IDX_START_N , value); } - - family_num = gpio_index /CHV_VBT_MAX_PINS_PER_FMLY ; - gpio_index = gpio_index %CHV_VBT_MAX_PINS_PER_FMLY ; - - cfg0 =CHV_GPIO_PAD_CFG0 (family_num, gpio_index); - cfg1 =CHV_GPIO_PAD_CFG1 (family_num, gpio_index); - -vlv_iosf_sb_get (dev_priv,BIT (VLV_IOSF_SB_GPIO )); -vlv_iosf_sb_write (dev_priv, port, cfg1,0 ); -vlv_iosf_sb_write (dev_priv, port, cfg0, -CHV_GPIO_GPIOEN |CHV_GPIO_GPIOCFG_GPO | -CHV_GPIO_GPIOTXSTATE (value)); -vlv_iosf_sb_put (dev_priv,BIT (VLV_IOSF_SB_GPIO )); } static void bxt_gpio_set_value(struct intel_connector *connector,
Signature · 1 line
2.40.0.1.gaa8946217a0b
Re: [PATCH v3 14/15] drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back
Hi,
Quoted 41 lines · Andy Shevchenko
It's a dirty hack in the driver that pokes GPIO registers behind the driver's back. Moreoever it might be problematic as simultaneous I/O may hang the system, see the commit
0bd50d719b00("pinctrl:
cherryview: prevent concurrent access to GPIO controllers") for the details. Taking all this into consideration replace the hack with proper GPIO APIs being used.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 47 +++++--------------- 1 file changed, 10 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/display/intel_dsi_vbt.c +0
-14@@ -66,19 +66,6 @@ struct i2c_adapter_lookup {#define CHV_GPIO_IDX_START_SW 100#define CHV_GPIO_IDX_START_SE 198 -#define CHV_VBT_MAX_PINS_PER_FMLY 15 - -#define CHV_GPIO_PAD_CFG0 (f, i) (0x4400 + (f) * 0x400 + (i) * 8) -#define CHV_GPIO_GPIOEN (1 << 15) -#define CHV_GPIO_GPIOCFG_GPIO (0 << 8) -#define CHV_GPIO_GPIOCFG_GPO (1 << 8) -#define CHV_GPIO_GPIOCFG_GPI (2 << 8) -#define CHV_GPIO_GPIOCFG_HIZ (3 << 8) -#define CHV_GPIO_GPIOTXSTATE (state) ((!!(state)) << 1) - -#define CHV_GPIO_PAD_CFG1 (f, i) (0x4400 + (f) * 0x400 + (i) * 8 + 4) -#define CHV_GPIO_CFGLOCK (1 << 31) -/* ICL DSI Display GPIO Pins */ #define ICL_GPIO_DDSP_HPD_A 0#define ICL_GPIO_L_VDDEN_1 1@@ -278,23 +265,21 @@ static void chv_gpio_set_value(struct intel_connector *connector, u8 gpio_source, u8 gpio_index, bool value) { struct drm_i915_private *dev_priv = to_i915(connector->base.dev); -u16 cfg0, cfg1;
drivers/gpu/drm/i915/display/intel_dsi_vbt.c static void chv_gpio_set_value(struct intel_connector *connector, · line 273
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +2
-4-u16 family_num; -u8 port;if (connector->panel.vbt.dsi.seq_version >=3 ) {if (gpio_index >=CHV_GPIO_IDX_START_SE ) {/* XXX: it's unclear whether 255->57 is part of SE. */ - gpio_index -=CHV_GPIO_IDX_START_SE ; - port =CHV_IOSF_PORT_GPIO_SE ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:03" ,"Panel SE" , + gpio_index -CHV_GPIO_IDX_START_SW , value);
The "gpio_index - CHV_GPIO_IDX_START_SW" here needs to be "gpio_index - CHV_GPIO_IDX_START_SE".
Also this patch needs s/soc_exec_opaque_gpio/soc_opaque_gpio_set_value/ to compile ...
Regards,
Hans
Quoted 41 lines
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +8
-19}else if (gpio_index >=CHV_GPIO_IDX_START_SW ) { - gpio_index -=CHV_GPIO_IDX_START_SW ; - port =CHV_IOSF_PORT_GPIO_SW ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:00" ,"Panel SW" , + gpio_index -CHV_GPIO_IDX_START_SW , value); }else if (gpio_index >=CHV_GPIO_IDX_START_E ) { - gpio_index -=CHV_GPIO_IDX_START_E ; - port =CHV_IOSF_PORT_GPIO_E ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:02" ,"Panel E" , + gpio_index -CHV_GPIO_IDX_START_E , value); }else { - port =CHV_IOSF_PORT_GPIO_N ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:01" ,"Panel N" , + gpio_index -CHV_GPIO_IDX_START_N , value); } }else {/* XXX: The spec is unclear about CHV GPIO on seq v2 */ @@ -311,21 +296,9 @@ static void chv_gpio_set_value(struct intel_connector *connector,return ; } - port =CHV_IOSF_PORT_GPIO_N ; +soc_exec_opaque_gpio (connector, gpio_index,"INT33FF:01" ,"Panel N" , + gpio_index -CHV_GPIO_IDX_START_N , value); } - - family_num = gpio_index /CHV_VBT_MAX_PINS_PER_FMLY ; - gpio_index = gpio_index %CHV_VBT_MAX_PINS_PER_FMLY ; - - cfg0 =CHV_GPIO_PAD_CFG0 (family_num, gpio_index); - cfg1 =CHV_GPIO_PAD_CFG1 (family_num, gpio_index); - -vlv_iosf_sb_get (dev_priv,BIT (VLV_IOSF_SB_GPIO )); -vlv_iosf_sb_write (dev_priv, port, cfg1,0 ); -vlv_iosf_sb_write (dev_priv, port, cfg0, -CHV_GPIO_GPIOEN |CHV_GPIO_GPIOCFG_GPO | -CHV_GPIO_GPIOTXSTATE (value)); -vlv_iosf_sb_put (dev_priv,BIT (VLV_IOSF_SB_GPIO )); } static void bxt_gpio_set_value(struct intel_connector *connector,
Re: [PATCH v3 14/15] drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back
Quoted 1 line · Hans de Goede
On 11/2/23 16:12, Andy Shevchenko wrote:
...
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:03", "Panel SE", + gpio_index - CHV_GPIO_IDX_START_SW, value);The "
gpio_index-CHV_GPIO_IDX_START_SW" here needs to be "gpio_index-CHV_GPIO_IDX_START_SE".Also this patch needs s/soc_exec_opaque_gpio/soc_opaque_gpio_set_value/ to compile ...
Ah, indeed. I looks like I run the test build, but forgot to look into the result. :-(
Signature · 2 lines
With Best Regards, Andy Shevchenko
kernel test robot
build botRe: [PATCH v3 14/15] drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back
In reply to Andy Shevchenkokernel test robot noticed the following build errors:
Hi Andy,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-intel/for-linux-next-fixes linus/master v6.6 next-20231103] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/drm-i915-dsi-assume-BXT-gpio-works-for-non-native-GPIO/20231103-064642 base: git://anongit.freedesktop.org/drm-intel for-linux-next patch link: https://lore.kernel.org/r/20231102151228.668842-15-andriy.shevchenko%40linux.intel.com patch subject: [PATCH v3 14/15] drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231104/[email protected]/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231104/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/i915/display/intel_dsi_vbt.c:272:4: error: call to undeclared function 'soc_exec_opaque_gpio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:03", "Panel SE",
^
drivers/gpu/drm/i915/display/intel_dsi_vbt.c:275:4: error: call to undeclared function 'soc_exec_opaque_gpio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:00", "Panel SW",
^
drivers/gpu/drm/i915/display/intel_dsi_vbt.c:278:4: error: call to undeclared function 'soc_exec_opaque_gpio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:02", "Panel E",
^
drivers/gpu/drm/i915/display/intel_dsi_vbt.c:281:4: error: call to undeclared function 'soc_exec_opaque_gpio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:01", "Panel N",
^
drivers/gpu/drm/i915/display/intel_dsi_vbt.c:299:3: error: call to undeclared function 'soc_exec_opaque_gpio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:01", "Panel N",
^5 errors generated.
vim +/soc_exec_opaque_gpio +272 drivers/gpu/drm/i915/display/intel_dsi_vbt.c
263
264 static void chv_gpio_set_value(struct intel_connector *connector,
265 u8 gpio_source, u8 gpio_index, bool value)
266 {
267 struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
268
269 if (connector->panel.vbt.dsi.seq_version >= 3) {
270 if (gpio_index >= CHV_GPIO_IDX_START_SE) {
271 /* XXX: it's unclear whether 255->57 is part of SE. */
> 272 soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:03", "Panel SE",
273 gpio_index - CHV_GPIO_IDX_START_SW, value);
274 } else if (gpio_index >= CHV_GPIO_IDX_START_SW) {
275 soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:00", "Panel SW",
276 gpio_index - CHV_GPIO_IDX_START_SW, value);
277 } else if (gpio_index >= CHV_GPIO_IDX_START_E) {
278 soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:02", "Panel E",
279 gpio_index - CHV_GPIO_IDX_START_E, value);
280 } else {
281 soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:01", "Panel N",
282 gpio_index - CHV_GPIO_IDX_START_N, value);
283 }
284 } else {
285 /* XXX: The spec is unclear about CHV GPIO on seq v2 */
286 if (gpio_source != 0) {
287 drm_dbg_kms(&dev_priv->drm,
288 "unknown gpio source %u\n", gpio_source);
289 return;
290 }
291
292 if (gpio_index >= CHV_GPIO_IDX_START_E) {
293 drm_dbg_kms(&dev_priv->drm,
294 "invalid gpio index %u for GPIO N\n",
295 gpio_index);
296 return;
297 }
298
299 soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:01", "Panel N",
300 gpio_index - CHV_GPIO_IDX_START_N, value);
301 }
302 }
303
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v3 15/15 drm/i915/iosf: Drop unused APIs
In reply to Andy ShevchenkoDrop unused vlv_iosf_sb_read() and vlv_iosf_sb_write().
--- drivers/gpu/drm/i915/vlv_sideband.c | 17 ----------------- drivers/gpu/drm/i915/vlv_sideband.h | 3 --- 2 files changed, 20 deletions(-)
drivers/gpu/drm/i915/vlv_sideband.c +0 -17
@@ -166,23 +166,6 @@ u32 vlv_nc_read(struct drm_i915_private *i915, u8 addr)return val; } -u32 vlv_iosf_sb_read (struct drm_i915_private *i915,u8 port,u32 reg) -{ -u32 val =0 ; - -vlv_sideband_rw (i915,PCI_DEVFN (0 ,0 ), port, -SB_CRRDDA_NP , reg, &val); - -return val; -} - -void vlv_iosf_sb_write (struct drm_i915_private *i915, -u8 port,u32 reg,u32 val) -{ -vlv_sideband_rw (i915,PCI_DEVFN (0 ,0 ), port, -SB_CRWRDA_NP , reg, &val); -} -u32 vlv_cck_read (struct drm_i915_private *i915,u32 reg) {u32 val =0 ;
drivers/gpu/drm/i915/vlv_sideband.h +0 -3
@@ -26,9 +26,6 @@ enum { };void vlv_iosf_sb_get (struct drm_i915_private *i915,unsigned long ports); -u32 vlv_iosf_sb_read (struct drm_i915_private *i915,u8 port,u32 reg); -void vlv_iosf_sb_write (struct drm_i915_private *i915, -u8 port,u32 reg,u32 val);void vlv_iosf_sb_put (struct drm_i915_private *i915,unsigned long ports);static inline void vlv_bunit_get (struct drm_i915_private *i915)
Signature · 1 line
2.40.0.1.gaa8946217a0b
Quoted 9 lines · Andy Shevchenko
DSI code for VBT has a set of ugly GPIO hacks, one of which is direct talking to GPIO IP behind the actual driver's back. A second attempt to fix that is here.
If I understood correctly, my approach should work in the similar way as the current IOSF GPIO.
Hans, I believe you have some devices that use this piece of code, is it possible to give a test run on (one of) them?
Subject should be "3rd attempt ..." :-)
Quoted 11 lines
In v3:
- incorporated series by Jani
- incorporated couple of precursor patches by Hans
- added Rb tag for used to be first three patches (Andi)
- rebased on top of the above changes
- fixed indexing for multi-community devices, such as Cherry ViewIn v2:
- added a few cleanup patches
- reworked to use dynamic GPIO lookup tables
- converted CHV as well
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 33 lines · Andy Shevchenko
DSI code for VBT has a set of ugly GPIO hacks, one of which is direct talking to GPIO IP behind the actual driver's back. A second attempt to fix that is here.
If I understood correctly, my approach should work in the similar way as the current IOSF GPIO.
Hans, I believe you have some devices that use this piece of code, is it possible to give a test run on (one of) them?
In v3:
- incorporated series by Jani
- incorporated couple of precursor patches by Hans
- added Rb tag for used to be first three patches (Andi)
- rebased on top of the above changes
- fixed indexing for multi-community devices, such as Cherry ViewIn v2:
- added a few cleanup patches
- reworked to use dynamic GPIO lookup tables
- converted CHV as wellAndy Shevchenko (8):
drm/i915/dsi: Replace while(1) with one with clear exit condition drm/i915/dsi: Get rid of redundant 'else'
drm/i915/dsi: Replace check with a (missing) MIPI sequence name drm/i915/dsi: Extract commonsoc_gpio_set_value()helper drm/i915/dsi: Replace poking of VLV GPIOs behind the driver's back drm/i915/dsi: Preparesoc_gpio_set_value()to distinguish GPIO
communities
drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back drm/i915/iosf: Drop unused APIs
Quoted 4 lines
Hans de Goede (2):
drm/i915/dsi: Remove GPIO lookup table at the end of
intel_dsi_vbt_gpio_init()
drm/i915/dsi: Fix wrong initial value for GPIOs inbxt_exec_gpio()
Assuming it all still works, and I do trust Hans' testing here quite a bit, the above is
Thanks for doing this!
Quoted 13 lines
Jani Nikula (5):
drm/i915/dsi: assume BXT gpio works for non-native GPIO drm/i915/dsi: switchmipi_exec_gpio()fromdev_privto i915 drm/i915/dsi: clarify GPIO exec sequence drm/i915/dsi: rename platform specific*_exec_gpio()to*_gpio_set_value()drm/i915/dsi: bxt/icl GPIO set value do not need gpio source
drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 355 +++++++------------ drivers/gpu/drm/i915/vlv_sideband.c | 17 - drivers/gpu/drm/i915/vlv_sideband.h | 3 - 3 files changed, 137 insertions(+), 238 deletions(-)
Signature · 1 line
Jani Nikula, Intel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/dsi: 2nd attempt to get rid of IOSF GPIO (rev6)
In reply to Andy Shevchenko== Series Details ==
== Series Details ==
Series: drm/i915/dsi: 2nd attempt to get rid of IOSF GPIO (rev6)
URL : https://patchwork.freedesktop.org/series/125516/
State : failure
== Summary ==
Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] drivers/gpu/drm/i915/display/intel_dsi_vbt.odrivers/gpu/drm/i915/display/intel_dsi_vbt.c: In function ‘chv_gpio_set_value’:drivers/gpu/drm/i915/display/intel_dsi_vbt.c:272:4: error: implicit declaration of function ‘soc_exec_opaque_gpio’ [-Werror=implicit-function-declaration]
272 | soc_exec_opaque_gpio(connector, gpio_index, "INT33FF:03", "Panel SE",
| ^~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:243: drivers/gpu/drm/i915/display/intel_dsi_vbt.o] Error 1 make[5]: *** [scripts/Makefile.build:480: drivers/gpu/drm/i915] Error 2
make[4]: *** [scripts/Makefile.build:480: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:480: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:480: drivers] Error 2
make[1]: *** [/home/kbuild/kernel/Makefile:1913: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
Build failed, no error log produced