Commit bd079b19 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jani Nikula

drm/i915/dsi: Prepare soc_gpio_set_value() to distinguish GPIO communities

Currently 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.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Tested-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231103201831.1037416-14-andriy.shevchenko@linux.intel.com
parent 8241b55f
...@@ -206,8 +206,8 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data) ...@@ -206,8 +206,8 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)
return data; return data;
} }
static void soc_gpio_set_value(struct intel_connector *connector, const char *con_id, static void soc_gpio_set_value(struct intel_connector *connector, u8 gpio_index,
u8 gpio_index, bool value) const char *con_id, u8 idx, bool value)
{ {
struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
/* XXX: this table is a quick ugly hack. */ /* XXX: this table is a quick ugly hack. */
...@@ -217,8 +217,7 @@ static void soc_gpio_set_value(struct intel_connector *connector, const char *co ...@@ -217,8 +217,7 @@ static void soc_gpio_set_value(struct intel_connector *connector, const char *co
if (gpio_desc) { if (gpio_desc) {
gpiod_set_value(gpio_desc, value); gpiod_set_value(gpio_desc, value);
} else { } else {
gpio_desc = devm_gpiod_get_index(dev_priv->drm.dev, gpio_desc = devm_gpiod_get_index(dev_priv->drm.dev, con_id, idx,
con_id, gpio_index,
value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW); value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW);
if (IS_ERR(gpio_desc)) { if (IS_ERR(gpio_desc)) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
...@@ -232,8 +231,8 @@ static void soc_gpio_set_value(struct intel_connector *connector, const char *co ...@@ -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, static void soc_opaque_gpio_set_value(struct intel_connector *connector,
const char *chip, const char *con_id, u8 gpio_index, const char *chip,
u8 gpio_index, bool value) const char *con_id, u8 idx, bool value)
{ {
struct gpiod_lookup_table *lookup; struct gpiod_lookup_table *lookup;
...@@ -243,11 +242,11 @@ static void soc_opaque_gpio_set_value(struct intel_connector *connector, ...@@ -243,11 +242,11 @@ static void soc_opaque_gpio_set_value(struct intel_connector *connector,
lookup->dev_id = "0000:00:02.0"; lookup->dev_id = "0000:00:02.0";
lookup->table[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); 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); gpiod_remove_lookup_table(lookup);
kfree(lookup); kfree(lookup);
...@@ -271,7 +270,8 @@ static void vlv_gpio_set_value(struct intel_connector *connector, ...@@ -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, static void chv_gpio_set_value(struct intel_connector *connector,
...@@ -331,7 +331,7 @@ 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, static void bxt_gpio_set_value(struct intel_connector *connector,
u8 gpio_index, bool value) 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 { enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment