Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce4c464b authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'topic/crc-pmic-2015-07-23' of git://anongit.freedesktop.org/drm-intel into drm-next

crystalcove pmic support from Shobhit. Patch series has all acks/r-bs from
other mainainers so ok to pull into drm-next. But I'm cc'ing all other
maintainers as fyi and in case they want to pull it into their trees too
to avoid conflicts.

* tag 'topic/crc-pmic-2015-07-23' of git://anongit.freedesktop.org/drm-intel:
  mfd: Add GPIOLIB dependency if INTEL_SOC_PMIC is to be enabled
  drm/i915: Backlight control using CRC PMIC based PWM driver
  drm/i915: Use the CRC gpio for panel enable/disable
  pwm: crc: Add Crystalcove (CRC) PWM driver
  mfd: intel_soc_pmic_core: ADD PWM lookup table for CRC PMIC based PWM
  mfd: intel_soc_pmic_crc: Add PWM cell device for Crystalcove PMIC
  mfd: intel_soc_pmic_core: Add lookup table for Panel Control as GPIO signal
  gpiolib: Add support for removing registered consumer lookup table
parents f60de976 04cbfe68
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1672,6 +1672,19 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table)
	mutex_unlock(&gpio_lookup_lock);
}

/**
 * gpiod_remove_lookup_table() - unregister GPIO device consumers
 * @table: table of consumers to unregister
 */
void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
{
	mutex_lock(&gpio_lookup_lock);

	list_del(&table->list);

	mutex_unlock(&gpio_lookup_lock);
}

static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
				      unsigned int idx,
				      enum gpio_lookup_flags *flags)
+7 −0
Original line number Diff line number Diff line
@@ -778,6 +778,13 @@ int intel_parse_bios(struct drm_device *dev);
#define MIPI_DSI_UNDEFINED_PANEL_ID	0
#define MIPI_DSI_GENERIC_PANEL_ID	1

/*
 * PMIC vs SoC Backlight support specified in pwm_blc
 * field in mipi_config block below.
*/
#define PPS_BLC_PMIC   0
#define PPS_BLC_SOC    1

struct mipi_config {
	u16 panel_id;

+4 −0
Original line number Diff line number Diff line
@@ -177,6 +177,10 @@ struct intel_panel {
		bool enabled;
		bool combination_mode;	/* gen 2/4 only */
		bool active_low_pwm;

		/* PWM chip */
		struct pwm_device *pwm;

		struct backlight_device *device;
	} backlight;

+35 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <drm/drm_panel.h>
#include <drm/drm_mipi_dsi.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.h>
#include "i915_drv.h"
#include "intel_drv.h"
#include "intel_dsi.h"
@@ -396,6 +397,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)

		intel_dsi_port_enable(encoder);
	}

	intel_panel_enable_backlight(intel_dsi->attached_connector);
}

static void intel_dsi_pre_enable(struct intel_encoder *encoder)
@@ -410,6 +413,12 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)

	DRM_DEBUG_KMS("\n");

	/* Panel Enable over CRC PMIC */
	if (intel_dsi->gpio_panel)
		gpiod_set_value_cansleep(intel_dsi->gpio_panel, 1);

	msleep(intel_dsi->panel_on_delay);

	/* Disable DPOunit clock gating, can stall pipe
	 * and we need DPLL REFA always enabled */
	tmp = I915_READ(DPLL(pipe));
@@ -427,8 +436,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
	/* put device in ready state */
	intel_dsi_device_ready(encoder);

	msleep(intel_dsi->panel_on_delay);

	drm_panel_prepare(intel_dsi->panel);

	for_each_dsi_port(port, intel_dsi->ports)
@@ -456,6 +463,8 @@ static void intel_dsi_pre_disable(struct intel_encoder *encoder)

	DRM_DEBUG_KMS("\n");

	intel_panel_disable_backlight(intel_dsi->attached_connector);

	if (is_vid_mode(intel_dsi)) {
		/* Send Shutdown command to the panel in LP mode */
		for_each_dsi_port(port, intel_dsi->ports)
@@ -571,6 +580,10 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)

	msleep(intel_dsi->panel_off_delay);
	msleep(intel_dsi->panel_pwr_cycle_delay);

	/* Panel Disable over CRC PMIC */
	if (intel_dsi->gpio_panel)
		gpiod_set_value_cansleep(intel_dsi->gpio_panel, 0);
}

static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
@@ -950,6 +963,11 @@ static void intel_dsi_encoder_destroy(struct drm_encoder *encoder)
		/* XXX: Logically this call belongs in the panel driver. */
		drm_panel_remove(intel_dsi->panel);
	}

	/* dispose of the gpios */
	if (intel_dsi->gpio_panel)
		gpiod_put(intel_dsi->gpio_panel);

	intel_encoder_destroy(encoder);
}

@@ -1065,6 +1083,20 @@ void intel_dsi_init(struct drm_device *dev)
		goto err;
	}

	/*
	 * In case of BYT with CRC PMIC, we need to use GPIO for
	 * Panel control.
	 */
	if (dev_priv->vbt.dsi.config->pwm_blc == PPS_BLC_PMIC) {
		intel_dsi->gpio_panel =
			gpiod_get(dev->dev, "panel", GPIOD_OUT_HIGH);

		if (IS_ERR(intel_dsi->gpio_panel)) {
			DRM_ERROR("Failed to own gpio for panel control\n");
			intel_dsi->gpio_panel = NULL;
		}
	}

	intel_encoder->type = INTEL_OUTPUT_DSI;
	intel_encoder->cloneable = 0;
	drm_connector_init(dev, connector, &intel_dsi_connector_funcs,
@@ -1098,6 +1130,7 @@ void intel_dsi_init(struct drm_device *dev)
	}

	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
	intel_panel_setup_backlight(connector, INVALID_PIPE);

	return;

+3 −0
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ struct intel_dsi {
	struct drm_panel *panel;
	struct intel_dsi_host *dsi_hosts[I915_MAX_PORTS];

	/* GPIO Desc for CRC based Panel control */
	struct gpio_desc *gpio_panel;

	struct intel_connector *attached_connector;

	/* bit mask of ports being driven */
Loading