mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-01 04:53:09 -04:00
drm/i915/dsi: Remove GPIO lookup table at the end of intel_dsi_vbt_gpio_init()
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. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231103201831.1037416-10-andriy.shevchenko@linux.intel.com
This commit is contained in:
committed by
Jani Nikula
parent
246bcae104
commit
e2a97a08ce
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user