From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH v4 03/16] drm/i915/dsi: clarify GPIO exec sequence
Date: Fri, 3 Nov 2023 22:18:18 +0200 [thread overview]
Message-ID: <20231103201831.1037416-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20231103201831.1037416-1-andriy.shevchenko@linux.intel.com>
From: Jani Nikula <jani.nikula@intel.com>
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.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 31 +++++++++++---------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
index 8b962f2ac475..11073efe26c0 100644
--- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
@@ -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
--
2.40.0.1.gaa8946217a0b
next prev parent reply other threads:[~2023-11-03 20:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 20:18 [rft, PATCH v4 00/16] drm/i915/dsi: 4th attempt to get rid of IOSF GPIO Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 01/16] drm/i915/dsi: assume BXT gpio works for non-native GPIO Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 02/16] drm/i915/dsi: switch mipi_exec_gpio() from dev_priv to i915 Andy Shevchenko
2023-11-03 20:18 ` Andy Shevchenko [this message]
2023-11-03 20:18 ` [PATCH v4 04/16] drm/i915/dsi: rename platform specific *_exec_gpio() to *_gpio_set_value() Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 05/16] drm/i915/dsi: bxt/icl GPIO set value do not need gpio source Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 06/16] drm/i915/dsi: Replace while(1) with one with clear exit condition Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 07/16] drm/i915/dsi: Get rid of redundant 'else' Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 08/16] drm/i915/dsi: Replace check with a (missing) MIPI sequence name Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 09/16] drm/i915/dsi: Remove GPIO lookup table at the end of intel_dsi_vbt_gpio_init() Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 10/16] drm/i915/dsi: Fix wrong initial value for GPIOs in bxt_gpio_set_value() Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 11/16] drm/i915/dsi: Extract common soc_gpio_set_value() helper Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 12/16] drm/i915/dsi: Replace poking of VLV GPIOs behind the driver's back Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 13/16] drm/i915/dsi: Prepare soc_gpio_set_value() to distinguish GPIO communities Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 14/16] drm/i915/dsi: Replace poking of CHV GPIOs behind the driver's back Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 15/16] drm/i915/dsi: Combine checks in mipi_exec_gpio() Andy Shevchenko
2023-11-03 20:18 ` [PATCH v4 16/16] drm/i915/iosf: Drop unused APIs Andy Shevchenko
2023-11-16 8:58 ` [rft, PATCH v4 00/16] drm/i915/dsi: 4th attempt to get rid of IOSF GPIO Hans de Goede
2023-11-16 10:15 ` Jani Nikula
2023-11-17 21:05 ` Andy Shevchenko
2023-11-21 10:28 ` Jani Nikula
2023-11-17 21:06 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231103201831.1037416-4-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox