2014-05-24 00:05:27 +08:00
|
|
|
/*
|
|
|
|
* Copyright © 2014 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Author: Shobhit Kumar <shobhit.kumar@intel.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-12-05 15:30:34 +08:00
|
|
|
#include <linux/gpio/consumer.h>
|
2019-12-17 04:51:21 +08:00
|
|
|
#include <linux/gpio/machine.h>
|
2019-01-07 19:15:56 +08:00
|
|
|
#include <linux/mfd/intel_soc_pmic.h>
|
2019-12-17 04:51:22 +08:00
|
|
|
#include <linux/pinctrl/consumer.h>
|
|
|
|
#include <linux/pinctrl/machine.h>
|
2014-05-24 00:05:27 +08:00
|
|
|
#include <linux/slab.h>
|
2019-04-26 16:17:22 +08:00
|
|
|
|
2014-05-24 00:05:27 +08:00
|
|
|
#include <asm/intel-mid.h>
|
2019-01-07 19:15:56 +08:00
|
|
|
#include <asm/unaligned.h>
|
2019-04-26 16:17:22 +08:00
|
|
|
|
|
|
|
#include <drm/drm_crtc.h>
|
|
|
|
#include <drm/drm_edid.h>
|
|
|
|
|
|
|
|
#include <video/mipi_display.h>
|
|
|
|
|
2014-05-24 00:05:27 +08:00
|
|
|
#include "i915_drv.h"
|
2019-08-06 19:39:33 +08:00
|
|
|
#include "intel_display_types.h"
|
2014-05-24 00:05:27 +08:00
|
|
|
#include "intel_dsi.h"
|
2019-04-26 16:17:22 +08:00
|
|
|
#include "intel_sideband.h"
|
2014-05-24 00:05:27 +08:00
|
|
|
|
|
|
|
#define MIPI_TRANSFER_MODE_SHIFT 0
|
|
|
|
#define MIPI_VIRTUAL_CHANNEL_SHIFT 1
|
|
|
|
#define MIPI_PORT_SHIFT 3
|
|
|
|
|
2016-04-06 03:30:49 +08:00
|
|
|
/* 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)
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2016-04-07 21:36:54 +08:00
|
|
|
struct gpio_map {
|
2016-04-06 03:30:49 +08:00
|
|
|
u16 base_offset;
|
|
|
|
bool init;
|
2014-05-24 00:05:27 +08:00
|
|
|
};
|
|
|
|
|
2016-04-07 21:36:54 +08:00
|
|
|
static struct gpio_map vlv_gpio_table[] = {
|
2016-04-06 03:30:49 +08:00
|
|
|
{ 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 },
|
2014-05-24 00:05:27 +08:00
|
|
|
};
|
|
|
|
|
2020-01-11 02:11:23 +08:00
|
|
|
struct i2c_adapter_lookup {
|
|
|
|
u16 slave_addr;
|
|
|
|
struct intel_dsi *intel_dsi;
|
|
|
|
acpi_handle dev_handle;
|
|
|
|
};
|
|
|
|
|
2016-04-26 18:27:40 +08:00
|
|
|
#define CHV_GPIO_IDX_START_N 0
|
|
|
|
#define CHV_GPIO_IDX_START_E 73
|
|
|
|
#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)
|
|
|
|
|
2018-11-29 22:12:31 +08:00
|
|
|
/* ICL DSI Display GPIO Pins */
|
|
|
|
#define ICL_GPIO_DDSP_HPD_A 0
|
|
|
|
#define ICL_GPIO_L_VDDEN_1 1
|
|
|
|
#define ICL_GPIO_L_BKLTEN_1 2
|
|
|
|
#define ICL_GPIO_DDPA_CTRLCLK_1 3
|
|
|
|
#define ICL_GPIO_DDPA_CTRLDATA_1 4
|
|
|
|
#define ICL_GPIO_DDSP_HPD_B 5
|
|
|
|
#define ICL_GPIO_L_VDDEN_2 6
|
|
|
|
#define ICL_GPIO_L_BKLTEN_2 7
|
|
|
|
#define ICL_GPIO_DDPA_CTRLCLK_2 8
|
|
|
|
#define ICL_GPIO_DDPA_CTRLDATA_2 9
|
|
|
|
|
2014-12-04 13:28:48 +08:00
|
|
|
static inline enum port intel_dsi_seq_port_to_port(u8 port)
|
|
|
|
{
|
|
|
|
return port ? PORT_C : PORT_A;
|
|
|
|
}
|
|
|
|
|
2015-01-16 20:27:21 +08:00
|
|
|
static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
|
|
|
|
const u8 *data)
|
2014-05-24 00:05:27 +08:00
|
|
|
{
|
2018-10-30 19:56:42 +08:00
|
|
|
struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev);
|
2015-01-16 20:27:24 +08:00
|
|
|
struct mipi_dsi_device *dsi_device;
|
|
|
|
u8 type, flags, seq_port;
|
2014-05-24 00:05:27 +08:00
|
|
|
u16 len;
|
2014-12-04 13:28:48 +08:00
|
|
|
enum port port;
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "\n");
|
2016-09-19 20:02:25 +08:00
|
|
|
|
2015-01-16 20:27:24 +08:00
|
|
|
flags = *data++;
|
|
|
|
type = *data++;
|
|
|
|
|
|
|
|
len = *((u16 *) data);
|
|
|
|
data += 2;
|
|
|
|
|
|
|
|
seq_port = (flags >> MIPI_PORT_SHIFT) & 3;
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2014-12-11 00:37:40 +08:00
|
|
|
/* For DSI single link on Port A & C, the seq_port value which is
|
|
|
|
* parsed from Sequence Block#53 of VBT has been set to 0
|
|
|
|
* Now, read/write of packets for the DSI single link on Port A and
|
|
|
|
* Port C will based on the DVO port from VBT block 2.
|
|
|
|
*/
|
|
|
|
if (intel_dsi->ports == (1 << PORT_C))
|
|
|
|
port = PORT_C;
|
|
|
|
else
|
|
|
|
port = intel_dsi_seq_port_to_port(seq_port);
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2015-01-16 20:27:24 +08:00
|
|
|
dsi_device = intel_dsi->dsi_hosts[port]->device;
|
|
|
|
if (!dsi_device) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "no dsi device for port %c\n",
|
|
|
|
port_name(port));
|
2015-01-16 20:27:24 +08:00
|
|
|
goto out;
|
|
|
|
}
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2015-01-16 20:27:24 +08:00
|
|
|
if ((flags >> MIPI_TRANSFER_MODE_SHIFT) & 1)
|
|
|
|
dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
|
|
|
|
else
|
|
|
|
dsi_device->mode_flags |= MIPI_DSI_MODE_LPM;
|
|
|
|
|
|
|
|
dsi_device->channel = (flags >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 3;
|
2014-05-24 00:05:27 +08:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_generic_write(dsi_device, NULL, 0);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_generic_write(dsi_device, data, 1);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_generic_write(dsi_device, data, 2);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
|
|
|
|
case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
|
|
|
|
case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg(&dev_priv->drm,
|
|
|
|
"Generic Read not yet implemented or used\n");
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_GENERIC_LONG_WRITE:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_generic_write(dsi_device, data, len);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_DCS_SHORT_WRITE:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_dcs_write_buffer(dsi_device, data, 1);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_DCS_READ:
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg(&dev_priv->drm,
|
|
|
|
"DCS Read not yet implemented or used\n");
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
|
|
|
case MIPI_DSI_DCS_LONG_WRITE:
|
2015-01-16 20:27:24 +08:00
|
|
|
mipi_dsi_dcs_write_buffer(dsi_device, data, len);
|
2014-05-24 00:05:27 +08:00
|
|
|
break;
|
2014-05-27 21:53:46 +08:00
|
|
|
}
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2019-03-09 05:42:58 +08:00
|
|
|
if (INTEL_GEN(dev_priv) < 11)
|
2018-10-30 19:56:42 +08:00
|
|
|
vlv_dsi_wait_for_fifo_empty(intel_dsi, port);
|
2017-02-28 17:26:16 +08:00
|
|
|
|
2015-01-16 20:27:24 +08:00
|
|
|
out:
|
2014-05-24 00:05:27 +08:00
|
|
|
data += len;
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2015-01-16 20:27:21 +08:00
|
|
|
static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)
|
2014-05-24 00:05:27 +08:00
|
|
|
{
|
2020-02-06 16:00:11 +08:00
|
|
|
struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev);
|
2015-01-16 20:27:21 +08:00
|
|
|
u32 delay = *((const u32 *) data);
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&i915->drm, "\n");
|
2016-09-19 20:02:25 +08:00
|
|
|
|
2014-05-24 00:05:27 +08:00
|
|
|
usleep_range(delay, delay + 10);
|
|
|
|
data += 4;
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2016-04-06 03:30:50 +08:00
|
|
|
static void vlv_exec_gpio(struct drm_i915_private *dev_priv,
|
|
|
|
u8 gpio_source, u8 gpio_index, bool value)
|
2014-05-24 00:05:27 +08:00
|
|
|
{
|
2016-04-07 21:36:54 +08:00
|
|
|
struct gpio_map *map;
|
2016-04-06 03:30:49 +08:00
|
|
|
u16 pconf0, padval;
|
2016-04-06 03:30:50 +08:00
|
|
|
u32 tmp;
|
|
|
|
u8 port;
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2016-04-06 03:30:49 +08:00
|
|
|
if (gpio_index >= ARRAY_SIZE(vlv_gpio_table)) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "unknown gpio index %u\n",
|
|
|
|
gpio_index);
|
2016-04-06 03:30:50 +08:00
|
|
|
return;
|
2016-02-05 00:52:47 +08:00
|
|
|
}
|
|
|
|
|
2016-04-07 21:36:54 +08:00
|
|
|
map = &vlv_gpio_table[gpio_index];
|
|
|
|
|
2016-02-05 00:52:47 +08:00
|
|
|
if (dev_priv->vbt.dsi.seq_version >= 3) {
|
2016-04-26 18:27:39 +08:00
|
|
|
/* XXX: this assumes vlv_gpio_table only has NC GPIOs. */
|
|
|
|
port = IOSF_PORT_GPIO_NC;
|
2016-03-18 19:11:10 +08:00
|
|
|
} else {
|
|
|
|
if (gpio_source == 0) {
|
|
|
|
port = IOSF_PORT_GPIO_NC;
|
|
|
|
} else if (gpio_source == 1) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "SC gpio not supported\n");
|
2016-04-07 22:26:18 +08:00
|
|
|
return;
|
2016-03-18 19:11:10 +08:00
|
|
|
} else {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm,
|
|
|
|
"unknown gpio source %u\n", gpio_source);
|
2016-04-06 03:30:50 +08:00
|
|
|
return;
|
2016-03-18 19:11:10 +08:00
|
|
|
}
|
2016-02-05 00:52:47 +08:00
|
|
|
}
|
|
|
|
|
2016-04-07 21:36:54 +08:00
|
|
|
pconf0 = VLV_GPIO_PCONF0(map->base_offset);
|
|
|
|
padval = VLV_GPIO_PAD_VAL(map->base_offset);
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2019-04-26 16:17:19 +08:00
|
|
|
vlv_iosf_sb_get(dev_priv, BIT(VLV_IOSF_SB_GPIO));
|
2016-04-07 21:36:54 +08:00
|
|
|
if (!map->init) {
|
2014-05-24 00:05:27 +08:00
|
|
|
/* FIXME: remove constant below */
|
2016-04-06 03:30:49 +08:00
|
|
|
vlv_iosf_sb_write(dev_priv, port, pconf0, 0x2000CC00);
|
2016-04-07 21:36:54 +08:00
|
|
|
map->init = true;
|
2014-05-24 00:05:27 +08:00
|
|
|
}
|
|
|
|
|
2016-04-06 03:30:50 +08:00
|
|
|
tmp = 0x4 | value;
|
|
|
|
vlv_iosf_sb_write(dev_priv, port, padval, tmp);
|
2019-04-26 16:17:19 +08:00
|
|
|
vlv_iosf_sb_put(dev_priv, BIT(VLV_IOSF_SB_GPIO));
|
2016-04-06 03:30:50 +08:00
|
|
|
}
|
|
|
|
|
2016-04-26 18:27:40 +08:00
|
|
|
static void chv_exec_gpio(struct drm_i915_private *dev_priv,
|
|
|
|
u8 gpio_source, u8 gpio_index, bool value)
|
|
|
|
{
|
|
|
|
u16 cfg0, cfg1;
|
|
|
|
u16 family_num;
|
|
|
|
u8 port;
|
|
|
|
|
|
|
|
if (dev_priv->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;
|
|
|
|
} else if (gpio_index >= CHV_GPIO_IDX_START_SW) {
|
|
|
|
gpio_index -= CHV_GPIO_IDX_START_SW;
|
|
|
|
port = CHV_IOSF_PORT_GPIO_SW;
|
|
|
|
} else if (gpio_index >= CHV_GPIO_IDX_START_E) {
|
|
|
|
gpio_index -= CHV_GPIO_IDX_START_E;
|
|
|
|
port = CHV_IOSF_PORT_GPIO_E;
|
|
|
|
} else {
|
|
|
|
port = CHV_IOSF_PORT_GPIO_N;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* XXX: The spec is unclear about CHV GPIO on seq v2 */
|
|
|
|
if (gpio_source != 0) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm,
|
|
|
|
"unknown gpio source %u\n", gpio_source);
|
2016-04-26 18:27:40 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gpio_index >= CHV_GPIO_IDX_START_E) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm,
|
|
|
|
"invalid gpio index %u for GPIO N\n",
|
|
|
|
gpio_index);
|
2016-04-26 18:27:40 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
port = CHV_IOSF_PORT_GPIO_N;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2019-04-26 16:17:19 +08:00
|
|
|
vlv_iosf_sb_get(dev_priv, BIT(VLV_IOSF_SB_GPIO));
|
2016-04-26 18:27:40 +08:00
|
|
|
vlv_iosf_sb_write(dev_priv, port, cfg1, 0);
|
|
|
|
vlv_iosf_sb_write(dev_priv, port, cfg0,
|
2016-12-02 04:29:09 +08:00
|
|
|
CHV_GPIO_GPIOEN | CHV_GPIO_GPIOCFG_GPO |
|
|
|
|
CHV_GPIO_GPIOTXSTATE(value));
|
2019-04-26 16:17:19 +08:00
|
|
|
vlv_iosf_sb_put(dev_priv, BIT(VLV_IOSF_SB_GPIO));
|
2016-04-26 18:27:40 +08:00
|
|
|
}
|
|
|
|
|
2016-12-05 15:30:34 +08:00
|
|
|
static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
|
|
|
|
u8 gpio_source, u8 gpio_index, bool value)
|
|
|
|
{
|
|
|
|
/* 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,
|
drm/i915/bxt: use NULL for GPIO connection ID
The commit 213e08ad60ba
("drm/i915/bxt: add bxt dsi gpio element support")
enables GPIO support for Broxton based platforms.
While using that API we might get into troubles in the future, because
we can't rely on label name in the driver since vendor firmware might
provide any GPIO pin there, e.g. "reset", and even mark it in _DSD (in
which case the request will fail).
To avoid inconsistency and potential issues we have two options:
a) generate GPIO ACPI mapping table and supply it via
acpi_dev_add_driver_gpios(), or
b) just pass NULL as connection ID.
The b) approach is much simpler and would work since the driver relies
on GPIO indices only. Moreover, the _CRS fallback mechanism, when
requesting GPIO, has been made stricter, and supplying non-NULL
connection ID when neither _DSD, nor GPIO ACPI mapping is present, is
making request fail.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101921
Fixes: f10e4bf6632b ("gpio: acpi: Even more tighten up ACPI GPIO lookups")
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Tested-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170817105541.63914-1-andriy.shevchenko@linux.intel.com
2017-08-17 18:55:41 +08:00
|
|
|
NULL, gpio_index,
|
2016-12-05 15:30:34 +08:00
|
|
|
value ? GPIOD_OUT_LOW :
|
|
|
|
GPIOD_OUT_HIGH);
|
|
|
|
|
|
|
|
if (IS_ERR_OR_NULL(gpio_desc)) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"GPIO index %u request failed (%ld)\n",
|
|
|
|
gpio_index, PTR_ERR(gpio_desc));
|
2016-12-05 15:30:34 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bxt_gpio_table[gpio_index] = gpio_desc;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpiod_set_value(gpio_desc, value);
|
|
|
|
}
|
|
|
|
|
2018-11-29 22:12:32 +08:00
|
|
|
static void icl_exec_gpio(struct drm_i915_private *dev_priv,
|
|
|
|
u8 gpio_source, u8 gpio_index, bool value)
|
|
|
|
{
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "Skipping ICL GPIO element execution\n");
|
2018-11-29 22:12:32 +08:00
|
|
|
}
|
|
|
|
|
2016-04-06 03:30:50 +08:00
|
|
|
static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = intel_dsi->base.base.dev;
|
2016-07-04 18:34:36 +08:00
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
2016-12-05 15:30:34 +08:00
|
|
|
u8 gpio_source, gpio_index = 0, gpio_number;
|
2016-04-06 03:30:50 +08:00
|
|
|
bool value;
|
|
|
|
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "\n");
|
2016-09-19 20:02:25 +08:00
|
|
|
|
2016-04-06 03:30:50 +08:00
|
|
|
if (dev_priv->vbt.dsi.seq_version >= 3)
|
2016-12-05 15:30:34 +08:00
|
|
|
gpio_index = *data++;
|
2016-04-06 03:30:50 +08:00
|
|
|
|
2016-12-05 15:30:34 +08:00
|
|
|
gpio_number = *data++;
|
2016-04-06 03:30:50 +08:00
|
|
|
|
|
|
|
/* gpio source in sequence v2 only */
|
|
|
|
if (dev_priv->vbt.dsi.seq_version == 2)
|
|
|
|
gpio_source = (*data >> 1) & 3;
|
|
|
|
else
|
|
|
|
gpio_source = 0;
|
2014-05-24 00:05:27 +08:00
|
|
|
|
|
|
|
/* pull up/down */
|
2016-04-06 03:30:50 +08:00
|
|
|
value = *data++ & 1;
|
|
|
|
|
2019-03-09 05:42:58 +08:00
|
|
|
if (INTEL_GEN(dev_priv) >= 11)
|
2018-11-29 22:12:32 +08:00
|
|
|
icl_exec_gpio(dev_priv, gpio_source, gpio_index, value);
|
|
|
|
else if (IS_VALLEYVIEW(dev_priv))
|
2016-12-05 15:30:34 +08:00
|
|
|
vlv_exec_gpio(dev_priv, gpio_source, gpio_number, value);
|
2016-04-26 18:27:40 +08:00
|
|
|
else if (IS_CHERRYVIEW(dev_priv))
|
2016-12-05 15:30:34 +08:00
|
|
|
chv_exec_gpio(dev_priv, gpio_source, gpio_number, value);
|
2016-04-06 03:30:50 +08:00
|
|
|
else
|
2016-12-05 15:30:34 +08:00
|
|
|
bxt_exec_gpio(dev_priv, gpio_source, gpio_index, value);
|
2014-05-24 00:05:27 +08:00
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2020-01-15 09:23:05 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
2020-01-11 02:11:23 +08:00
|
|
|
static int i2c_adapter_lookup(struct acpi_resource *ares, void *data)
|
|
|
|
{
|
|
|
|
struct i2c_adapter_lookup *lookup = data;
|
|
|
|
struct intel_dsi *intel_dsi = lookup->intel_dsi;
|
|
|
|
struct acpi_resource_i2c_serialbus *sb;
|
|
|
|
struct i2c_adapter *adapter;
|
|
|
|
acpi_handle adapter_handle;
|
|
|
|
acpi_status status;
|
|
|
|
|
2020-01-18 08:58:48 +08:00
|
|
|
if (!i2c_acpi_get_i2c_resource(ares, &sb))
|
2020-01-11 02:11:23 +08:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (lookup->slave_addr != sb->slave_address)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
status = acpi_get_handle(lookup->dev_handle,
|
|
|
|
sb->resource_source.string_ptr,
|
|
|
|
&adapter_handle);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
adapter = i2c_acpi_find_adapter_by_handle(adapter_handle);
|
|
|
|
if (adapter)
|
|
|
|
intel_dsi->i2c_bus_num = adapter->nr;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-01-15 09:23:05 +08:00
|
|
|
static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
|
|
|
|
const u16 slave_addr)
|
2016-01-11 21:29:08 +08:00
|
|
|
{
|
2020-01-11 02:11:23 +08:00
|
|
|
struct drm_device *drm_dev = intel_dsi->base.base.dev;
|
|
|
|
struct device *dev = &drm_dev->pdev->dev;
|
|
|
|
struct acpi_device *acpi_dev;
|
|
|
|
struct list_head resource_list;
|
|
|
|
struct i2c_adapter_lookup lookup;
|
2020-01-15 09:23:05 +08:00
|
|
|
|
|
|
|
acpi_dev = ACPI_COMPANION(dev);
|
|
|
|
if (acpi_dev) {
|
|
|
|
memset(&lookup, 0, sizeof(lookup));
|
|
|
|
lookup.slave_addr = slave_addr;
|
|
|
|
lookup.intel_dsi = intel_dsi;
|
|
|
|
lookup.dev_handle = acpi_device_handle(acpi_dev);
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&resource_list);
|
|
|
|
acpi_dev_get_resources(acpi_dev, &resource_list,
|
|
|
|
i2c_adapter_lookup,
|
|
|
|
&lookup);
|
|
|
|
acpi_dev_free_resource_list(&resource_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
|
|
|
|
const u16 slave_addr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const u8 *mipi_exec_i2c(struct intel_dsi *intel_dsi, const u8 *data)
|
|
|
|
{
|
|
|
|
struct drm_device *drm_dev = intel_dsi->base.base.dev;
|
|
|
|
struct device *dev = &drm_dev->pdev->dev;
|
|
|
|
struct i2c_adapter *adapter;
|
2020-01-11 02:11:23 +08:00
|
|
|
struct i2c_msg msg;
|
|
|
|
int ret;
|
|
|
|
u8 vbt_i2c_bus_num = *(data + 2);
|
|
|
|
u16 slave_addr = *(u16 *)(data + 3);
|
|
|
|
u8 reg_offset = *(data + 5);
|
|
|
|
u8 payload_size = *(data + 6);
|
|
|
|
u8 *payload_data;
|
|
|
|
|
|
|
|
if (intel_dsi->i2c_bus_num < 0) {
|
|
|
|
intel_dsi->i2c_bus_num = vbt_i2c_bus_num;
|
2020-01-15 09:23:05 +08:00
|
|
|
i2c_acpi_find_adapter(intel_dsi, slave_addr);
|
2020-01-11 02:11:23 +08:00
|
|
|
}
|
2016-09-19 20:02:25 +08:00
|
|
|
|
2020-01-11 02:11:23 +08:00
|
|
|
adapter = i2c_get_adapter(intel_dsi->i2c_bus_num);
|
|
|
|
if (!adapter) {
|
|
|
|
DRM_DEV_ERROR(dev, "Cannot find a valid i2c bus for xfer\n");
|
|
|
|
goto err_bus;
|
|
|
|
}
|
|
|
|
|
|
|
|
payload_data = kzalloc(payload_size + 1, GFP_KERNEL);
|
|
|
|
if (!payload_data)
|
|
|
|
goto err_alloc;
|
|
|
|
|
|
|
|
payload_data[0] = reg_offset;
|
|
|
|
memcpy(&payload_data[1], (data + 7), payload_size);
|
|
|
|
|
|
|
|
msg.addr = slave_addr;
|
|
|
|
msg.flags = 0;
|
|
|
|
msg.len = payload_size + 1;
|
|
|
|
msg.buf = payload_data;
|
|
|
|
|
|
|
|
ret = i2c_transfer(adapter, &msg, 1);
|
|
|
|
if (ret < 0)
|
|
|
|
DRM_DEV_ERROR(dev,
|
|
|
|
"Failed to xfer payload of size (%u) to reg (%u)\n",
|
|
|
|
payload_size, reg_offset);
|
|
|
|
|
|
|
|
kfree(payload_data);
|
|
|
|
err_alloc:
|
|
|
|
i2c_put_adapter(adapter);
|
|
|
|
err_bus:
|
|
|
|
return data + payload_size + 7;
|
2016-01-11 21:29:08 +08:00
|
|
|
}
|
|
|
|
|
2016-09-19 20:02:26 +08:00
|
|
|
static const u8 *mipi_exec_spi(struct intel_dsi *intel_dsi, const u8 *data)
|
|
|
|
{
|
2020-02-06 16:00:11 +08:00
|
|
|
struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev);
|
|
|
|
|
|
|
|
drm_dbg_kms(&i915->drm, "Skipping SPI element execution\n");
|
2016-09-19 20:02:26 +08:00
|
|
|
|
|
|
|
return data + *(data + 5) + 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const u8 *mipi_exec_pmic(struct intel_dsi *intel_dsi, const u8 *data)
|
|
|
|
{
|
2020-02-06 16:00:11 +08:00
|
|
|
struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev);
|
2019-01-07 19:15:56 +08:00
|
|
|
#ifdef CONFIG_PMIC_OPREGION
|
|
|
|
u32 value, mask, reg_address;
|
|
|
|
u16 i2c_address;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* byte 0 aka PMIC Flag is reserved */
|
|
|
|
i2c_address = get_unaligned_le16(data + 1);
|
|
|
|
reg_address = get_unaligned_le32(data + 3);
|
|
|
|
value = get_unaligned_le32(data + 7);
|
|
|
|
mask = get_unaligned_le32(data + 11);
|
|
|
|
|
|
|
|
ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_address,
|
|
|
|
reg_address,
|
|
|
|
value, mask);
|
|
|
|
if (ret)
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&i915->drm, "%s failed, error: %d\n", __func__, ret);
|
2019-01-07 19:15:56 +08:00
|
|
|
#else
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&i915->drm,
|
|
|
|
"Your hardware requires CONFIG_PMIC_OPREGION and it is not set\n");
|
2019-01-07 19:15:56 +08:00
|
|
|
#endif
|
2016-09-19 20:02:26 +08:00
|
|
|
|
|
|
|
return data + 15;
|
|
|
|
}
|
|
|
|
|
2015-01-16 20:27:21 +08:00
|
|
|
typedef const u8 * (*fn_mipi_elem_exec)(struct intel_dsi *intel_dsi,
|
|
|
|
const u8 *data);
|
2014-05-24 00:05:27 +08:00
|
|
|
static const fn_mipi_elem_exec exec_elem[] = {
|
2015-12-21 21:10:59 +08:00
|
|
|
[MIPI_SEQ_ELEM_SEND_PKT] = mipi_exec_send_packet,
|
|
|
|
[MIPI_SEQ_ELEM_DELAY] = mipi_exec_delay,
|
|
|
|
[MIPI_SEQ_ELEM_GPIO] = mipi_exec_gpio,
|
2016-09-19 20:02:25 +08:00
|
|
|
[MIPI_SEQ_ELEM_I2C] = mipi_exec_i2c,
|
2016-09-19 20:02:26 +08:00
|
|
|
[MIPI_SEQ_ELEM_SPI] = mipi_exec_spi,
|
|
|
|
[MIPI_SEQ_ELEM_PMIC] = mipi_exec_pmic,
|
2014-05-24 00:05:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MIPI Sequence from VBT #53 parsing logic
|
|
|
|
* We have already separated each seqence during bios parsing
|
|
|
|
* Following is generic execution function for any sequence
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const char * const seq_name[] = {
|
2016-12-02 23:01:28 +08:00
|
|
|
[MIPI_SEQ_DEASSERT_RESET] = "MIPI_SEQ_DEASSERT_RESET",
|
2015-12-21 21:10:58 +08:00
|
|
|
[MIPI_SEQ_INIT_OTP] = "MIPI_SEQ_INIT_OTP",
|
|
|
|
[MIPI_SEQ_DISPLAY_ON] = "MIPI_SEQ_DISPLAY_ON",
|
|
|
|
[MIPI_SEQ_DISPLAY_OFF] = "MIPI_SEQ_DISPLAY_OFF",
|
2016-12-02 23:01:28 +08:00
|
|
|
[MIPI_SEQ_ASSERT_RESET] = "MIPI_SEQ_ASSERT_RESET",
|
2016-01-05 23:08:17 +08:00
|
|
|
[MIPI_SEQ_BACKLIGHT_ON] = "MIPI_SEQ_BACKLIGHT_ON",
|
|
|
|
[MIPI_SEQ_BACKLIGHT_OFF] = "MIPI_SEQ_BACKLIGHT_OFF",
|
|
|
|
[MIPI_SEQ_TEAR_ON] = "MIPI_SEQ_TEAR_ON",
|
|
|
|
[MIPI_SEQ_TEAR_OFF] = "MIPI_SEQ_TEAR_OFF",
|
|
|
|
[MIPI_SEQ_POWER_ON] = "MIPI_SEQ_POWER_ON",
|
|
|
|
[MIPI_SEQ_POWER_OFF] = "MIPI_SEQ_POWER_OFF",
|
2014-05-24 00:05:27 +08:00
|
|
|
};
|
|
|
|
|
2015-12-21 21:10:58 +08:00
|
|
|
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)";
|
|
|
|
}
|
|
|
|
|
2019-12-17 04:51:19 +08:00
|
|
|
static void intel_dsi_vbt_exec(struct intel_dsi *intel_dsi,
|
|
|
|
enum mipi_seq seq_id)
|
2014-05-24 00:05:27 +08:00
|
|
|
{
|
2016-01-11 21:15:02 +08:00
|
|
|
struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev);
|
2015-12-21 21:11:06 +08:00
|
|
|
const u8 *data;
|
2014-05-24 00:05:27 +08:00
|
|
|
fn_mipi_elem_exec mipi_elem_exec;
|
|
|
|
|
drm/i915/display: Make WARN* drm specific where drm_device ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_device or drm_i915_private struct
pointer is readily available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_device *T = ...;
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}
@rule2@
identifier func, T;
@@
func(struct drm_device *T,...) {
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}
@rule3@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule4@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128181603.27767-20-pankaj.laxminarayan.bharadiya@intel.com
2020-01-29 02:16:01 +08:00
|
|
|
if (drm_WARN_ON(&dev_priv->drm,
|
|
|
|
seq_id >= ARRAY_SIZE(dev_priv->vbt.dsi.sequence)))
|
2014-05-24 00:05:27 +08:00
|
|
|
return;
|
|
|
|
|
2015-12-21 21:11:06 +08:00
|
|
|
data = dev_priv->vbt.dsi.sequence[seq_id];
|
2016-09-19 20:02:24 +08:00
|
|
|
if (!data)
|
2015-12-21 21:11:06 +08:00
|
|
|
return;
|
2014-05-24 00:05:27 +08:00
|
|
|
|
drm/i915/display: Make WARN* drm specific where drm_device ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_device or drm_i915_private struct
pointer is readily available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_device *T = ...;
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}
@rule2@
identifier func, T;
@@
func(struct drm_device *T,...) {
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}
@rule3@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule4@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128181603.27767-20-pankaj.laxminarayan.bharadiya@intel.com
2020-01-29 02:16:01 +08:00
|
|
|
drm_WARN_ON(&dev_priv->drm, *data != seq_id);
|
2015-12-21 21:11:06 +08:00
|
|
|
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "Starting MIPI sequence %d - %s\n",
|
|
|
|
seq_id, sequence_name(seq_id));
|
2015-12-21 21:11:06 +08:00
|
|
|
|
|
|
|
/* Skip Sequence Byte. */
|
2014-05-24 00:05:27 +08:00
|
|
|
data++;
|
|
|
|
|
2016-01-11 21:15:02 +08:00
|
|
|
/* Skip Size of Sequence. */
|
|
|
|
if (dev_priv->vbt.dsi.seq_version >= 3)
|
|
|
|
data += 4;
|
|
|
|
|
2014-05-24 00:05:27 +08:00
|
|
|
while (1) {
|
2015-12-21 21:10:59 +08:00
|
|
|
u8 operation_byte = *data++;
|
2016-01-05 23:06:48 +08:00
|
|
|
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
|
|
|
|
mipi_elem_exec = NULL;
|
|
|
|
|
|
|
|
/* Size of Operation. */
|
|
|
|
if (dev_priv->vbt.dsi.seq_version >= 3)
|
|
|
|
operation_size = *data++;
|
|
|
|
|
|
|
|
if (mipi_elem_exec) {
|
2016-09-19 20:02:30 +08:00
|
|
|
const u8 *next = data + operation_size;
|
|
|
|
|
2016-01-05 23:06:48 +08:00
|
|
|
data = mipi_elem_exec(intel_dsi, data);
|
2016-09-19 20:02:30 +08:00
|
|
|
|
|
|
|
/* Consistency check if we have size. */
|
|
|
|
if (operation_size && data != next) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Inconsistent operation size\n");
|
2016-09-19 20:02:30 +08:00
|
|
|
return;
|
|
|
|
}
|
2016-01-05 23:06:48 +08:00
|
|
|
} else if (operation_size) {
|
|
|
|
/* We have size, skip. */
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm,
|
|
|
|
"Unsupported MIPI operation byte %u\n",
|
|
|
|
operation_byte);
|
2016-01-05 23:06:48 +08:00
|
|
|
data += operation_size;
|
|
|
|
} else {
|
|
|
|
/* No size, can't skip without parsing. */
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Unsupported MIPI operation byte %u\n",
|
|
|
|
operation_byte);
|
2014-05-24 00:05:27 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-17 04:51:19 +08:00
|
|
|
void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi,
|
|
|
|
enum mipi_seq seq_id)
|
|
|
|
{
|
|
|
|
if (seq_id == MIPI_SEQ_POWER_ON && intel_dsi->gpio_panel)
|
|
|
|
gpiod_set_value_cansleep(intel_dsi->gpio_panel, 1);
|
2019-12-17 04:51:22 +08:00
|
|
|
if (seq_id == MIPI_SEQ_BACKLIGHT_ON && intel_dsi->gpio_backlight)
|
|
|
|
gpiod_set_value_cansleep(intel_dsi->gpio_backlight, 1);
|
2019-12-17 04:51:19 +08:00
|
|
|
|
|
|
|
intel_dsi_vbt_exec(intel_dsi, seq_id);
|
|
|
|
|
|
|
|
if (seq_id == MIPI_SEQ_POWER_OFF && intel_dsi->gpio_panel)
|
|
|
|
gpiod_set_value_cansleep(intel_dsi->gpio_panel, 0);
|
2019-12-17 04:51:22 +08:00
|
|
|
if (seq_id == MIPI_SEQ_BACKLIGHT_OFF && intel_dsi->gpio_backlight)
|
|
|
|
gpiod_set_value_cansleep(intel_dsi->gpio_backlight, 0);
|
2019-12-17 04:51:19 +08:00
|
|
|
}
|
|
|
|
|
2018-10-15 22:27:53 +08:00
|
|
|
void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec)
|
|
|
|
{
|
|
|
|
struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev);
|
|
|
|
|
|
|
|
/* For v3 VBTs in vid-mode the delays are part of the VBT sequences */
|
|
|
|
if (is_vid_mode(intel_dsi) && dev_priv->vbt.dsi.seq_version >= 3)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msleep(msec);
|
|
|
|
}
|
|
|
|
|
2019-06-06 02:17:34 +08:00
|
|
|
void intel_dsi_log_params(struct intel_dsi *intel_dsi)
|
2019-06-06 02:17:33 +08:00
|
|
|
{
|
2020-02-06 16:00:11 +08:00
|
|
|
struct drm_i915_private *i915 = to_i915(intel_dsi->base.base.dev);
|
|
|
|
|
|
|
|
drm_dbg_kms(&i915->drm, "Pclk %d\n", intel_dsi->pclk);
|
|
|
|
drm_dbg_kms(&i915->drm, "Pixel overlap %d\n",
|
|
|
|
intel_dsi->pixel_overlap);
|
|
|
|
drm_dbg_kms(&i915->drm, "Lane count %d\n", intel_dsi->lane_count);
|
|
|
|
drm_dbg_kms(&i915->drm, "DPHY param reg 0x%x\n", intel_dsi->dphy_reg);
|
|
|
|
drm_dbg_kms(&i915->drm, "Video mode format %s\n",
|
|
|
|
intel_dsi->video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE ?
|
|
|
|
"non-burst with sync pulse" :
|
|
|
|
intel_dsi->video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS ?
|
|
|
|
"non-burst with sync events" :
|
|
|
|
intel_dsi->video_mode_format == VIDEO_MODE_BURST ?
|
|
|
|
"burst" : "<unknown>");
|
|
|
|
drm_dbg_kms(&i915->drm, "Burst mode ratio %d\n",
|
|
|
|
intel_dsi->burst_mode_ratio);
|
|
|
|
drm_dbg_kms(&i915->drm, "Reset timer %d\n", intel_dsi->rst_timer_val);
|
|
|
|
drm_dbg_kms(&i915->drm, "Eot %s\n",
|
|
|
|
enableddisabled(intel_dsi->eotp_pkt));
|
|
|
|
drm_dbg_kms(&i915->drm, "Clockstop %s\n",
|
|
|
|
enableddisabled(!intel_dsi->clock_stop));
|
|
|
|
drm_dbg_kms(&i915->drm, "Mode %s\n",
|
|
|
|
intel_dsi->operation_mode ? "command" : "video");
|
2019-06-06 02:17:33 +08:00
|
|
|
if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK)
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&i915->drm,
|
|
|
|
"Dual link: DSI_DUAL_LINK_FRONT_BACK\n");
|
2019-06-06 02:17:33 +08:00
|
|
|
else if (intel_dsi->dual_link == DSI_DUAL_LINK_PIXEL_ALT)
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&i915->drm,
|
|
|
|
"Dual link: DSI_DUAL_LINK_PIXEL_ALT\n");
|
2019-06-06 02:17:33 +08:00
|
|
|
else
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&i915->drm, "Dual link: NONE\n");
|
|
|
|
drm_dbg_kms(&i915->drm, "Pixel Format %d\n", intel_dsi->pixel_format);
|
|
|
|
drm_dbg_kms(&i915->drm, "TLPX %d\n", intel_dsi->escape_clk_div);
|
|
|
|
drm_dbg_kms(&i915->drm, "LP RX Timeout 0x%x\n",
|
|
|
|
intel_dsi->lp_rx_timeout);
|
|
|
|
drm_dbg_kms(&i915->drm, "Turnaround Timeout 0x%x\n",
|
|
|
|
intel_dsi->turn_arnd_val);
|
|
|
|
drm_dbg_kms(&i915->drm, "Init Count 0x%x\n", intel_dsi->init_count);
|
|
|
|
drm_dbg_kms(&i915->drm, "HS to LP Count 0x%x\n",
|
|
|
|
intel_dsi->hs_to_lp_count);
|
|
|
|
drm_dbg_kms(&i915->drm, "LP Byte Clock %d\n", intel_dsi->lp_byte_clk);
|
|
|
|
drm_dbg_kms(&i915->drm, "DBI BW Timer 0x%x\n", intel_dsi->bw_timer);
|
|
|
|
drm_dbg_kms(&i915->drm, "LP to HS Clock Count 0x%x\n",
|
|
|
|
intel_dsi->clk_lp_to_hs_count);
|
|
|
|
drm_dbg_kms(&i915->drm, "HS to LP Clock Count 0x%x\n",
|
|
|
|
intel_dsi->clk_hs_to_lp_count);
|
|
|
|
drm_dbg_kms(&i915->drm, "BTA %s\n",
|
|
|
|
enableddisabled(!(intel_dsi->video_frmt_cfg_bits & DISABLE_VIDEO_BTA)));
|
2019-06-06 02:17:33 +08:00
|
|
|
}
|
|
|
|
|
2018-10-15 22:27:51 +08:00
|
|
|
bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = intel_dsi->base.base.dev;
|
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
|
struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
|
|
|
|
struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
|
|
|
|
struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
|
|
|
|
u16 burst_mode_ratio;
|
|
|
|
enum port port;
|
|
|
|
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_dbg_kms(&dev_priv->drm, "\n");
|
2018-10-15 22:27:51 +08:00
|
|
|
|
|
|
|
intel_dsi->eotp_pkt = mipi_config->eot_pkt_disabled ? 0 : 1;
|
|
|
|
intel_dsi->clock_stop = mipi_config->enable_clk_stop ? 1 : 0;
|
|
|
|
intel_dsi->lane_count = mipi_config->lane_cnt + 1;
|
|
|
|
intel_dsi->pixel_format =
|
|
|
|
pixel_format_from_register_bits(
|
|
|
|
mipi_config->videomode_color_format << 7);
|
|
|
|
|
|
|
|
intel_dsi->dual_link = mipi_config->dual_link;
|
|
|
|
intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
|
|
|
|
intel_dsi->operation_mode = mipi_config->is_cmd_mode;
|
|
|
|
intel_dsi->video_mode_format = mipi_config->video_transfer_mode;
|
|
|
|
intel_dsi->escape_clk_div = mipi_config->byte_clk_sel;
|
|
|
|
intel_dsi->lp_rx_timeout = mipi_config->lp_rx_timeout;
|
2018-10-30 19:56:22 +08:00
|
|
|
intel_dsi->hs_tx_timeout = mipi_config->hs_tx_timeout;
|
2018-10-15 22:27:51 +08:00
|
|
|
intel_dsi->turn_arnd_val = mipi_config->turn_around_timeout;
|
|
|
|
intel_dsi->rst_timer_val = mipi_config->device_reset_timer;
|
|
|
|
intel_dsi->init_count = mipi_config->master_init_timer;
|
|
|
|
intel_dsi->bw_timer = mipi_config->dbi_bw_timer;
|
|
|
|
intel_dsi->video_frmt_cfg_bits =
|
|
|
|
mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0;
|
2018-10-15 22:27:59 +08:00
|
|
|
intel_dsi->bgr_enabled = mipi_config->rgb_flip;
|
2018-10-15 22:27:51 +08:00
|
|
|
|
|
|
|
/* Starting point, adjusted depending on dual link and burst mode */
|
|
|
|
intel_dsi->pclk = mode->clock;
|
|
|
|
|
|
|
|
/* In dual link mode each port needs half of pixel clock */
|
|
|
|
if (intel_dsi->dual_link) {
|
|
|
|
intel_dsi->pclk /= 2;
|
|
|
|
|
|
|
|
/* we can enable pixel_overlap if needed by panel. In this
|
|
|
|
* case we need to increase the pixelclock for extra pixels
|
|
|
|
*/
|
|
|
|
if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) {
|
|
|
|
intel_dsi->pclk += DIV_ROUND_UP(mode->vtotal * intel_dsi->pixel_overlap * 60, 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Burst Mode Ratio
|
|
|
|
* Target ddr frequency from VBT / non burst ddr freq
|
|
|
|
* multiply by 100 to preserve remainder
|
|
|
|
*/
|
|
|
|
if (intel_dsi->video_mode_format == VIDEO_MODE_BURST) {
|
|
|
|
if (mipi_config->target_burst_mode_freq) {
|
|
|
|
u32 bitrate = intel_dsi_bitrate(intel_dsi);
|
|
|
|
|
2019-05-25 01:40:27 +08:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2018-10-15 22:27:51 +08:00
|
|
|
if (mipi_config->target_burst_mode_freq < bitrate) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Burst mode freq is less than computed\n");
|
2018-10-15 22:27:51 +08:00
|
|
|
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 {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Burst mode target is not set\n");
|
2018-10-15 22:27:51 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
burst_mode_ratio = 100;
|
|
|
|
|
|
|
|
intel_dsi->burst_mode_ratio = burst_mode_ratio;
|
|
|
|
|
2014-05-24 00:05:27 +08:00
|
|
|
/* delays in VBT are in unit of 100us, so need to convert
|
|
|
|
* here in ms
|
|
|
|
* Delay (100us) * 100 /1000 = Delay / 10 (ms) */
|
|
|
|
intel_dsi->backlight_off_delay = pps->bl_disable_delay / 10;
|
|
|
|
intel_dsi->backlight_on_delay = pps->bl_enable_delay / 10;
|
|
|
|
intel_dsi->panel_on_delay = pps->panel_on_delay / 10;
|
|
|
|
intel_dsi->panel_off_delay = pps->panel_off_delay / 10;
|
|
|
|
intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10;
|
|
|
|
|
2020-01-11 02:11:23 +08:00
|
|
|
intel_dsi->i2c_bus_num = -1;
|
|
|
|
|
2015-01-16 20:27:24 +08:00
|
|
|
/* a regular driver would get the device in probe */
|
|
|
|
for_each_dsi_port(port, intel_dsi->ports) {
|
|
|
|
mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device);
|
|
|
|
}
|
|
|
|
|
2017-03-06 22:31:26 +08:00
|
|
|
return true;
|
2014-05-24 00:05:27 +08:00
|
|
|
}
|
2019-12-17 04:51:19 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* On some BYT/CHT devs some sequences are incomplete and we need to manually
|
2019-12-17 04:51:21 +08:00
|
|
|
* control some GPIOs. We need to add a GPIO lookup table before we get these.
|
2019-12-17 04:51:22 +08:00
|
|
|
* If the GOP did not initialize the panel (HDMI inserted) we may need to also
|
|
|
|
* change the pinmux for the SoC's PWM0 pin from GPIO to PWM.
|
2019-12-17 04:51:19 +08:00
|
|
|
*/
|
2019-12-17 04:51:21 +08:00
|
|
|
static struct gpiod_lookup_table pmic_panel_gpio_table = {
|
|
|
|
/* Intel GFX is consumer */
|
|
|
|
.dev_id = "0000:00:02.0",
|
|
|
|
.table = {
|
|
|
|
/* Panel EN/DISABLE */
|
|
|
|
GPIO_LOOKUP("gpio_crystalcove", 94, "panel", GPIO_ACTIVE_HIGH),
|
|
|
|
{ }
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-12-17 04:51:22 +08:00
|
|
|
static struct gpiod_lookup_table soc_panel_gpio_table = {
|
|
|
|
.dev_id = "0000:00:02.0",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("INT33FC:01", 10, "backlight", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("INT33FC:01", 11, "panel", GPIO_ACTIVE_HIGH),
|
|
|
|
{ }
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct pinctrl_map soc_pwm_pinctrl_map[] = {
|
|
|
|
PIN_MAP_MUX_GROUP("0000:00:02.0", "soc_pwm0", "INT33FC:00",
|
|
|
|
"pwm0_grp", "pwm"),
|
|
|
|
};
|
|
|
|
|
2019-12-17 04:51:20 +08:00
|
|
|
void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on)
|
2019-12-17 04:51:19 +08:00
|
|
|
{
|
|
|
|
struct drm_device *dev = intel_dsi->base.base.dev;
|
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
|
struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
|
2019-12-17 04:51:20 +08:00
|
|
|
enum gpiod_flags flags = panel_is_on ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
|
2019-12-17 04:51:22 +08:00
|
|
|
bool want_backlight_gpio = false;
|
|
|
|
bool want_panel_gpio = false;
|
|
|
|
struct pinctrl *pinctrl;
|
|
|
|
int ret;
|
2019-12-17 04:51:19 +08:00
|
|
|
|
|
|
|
if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
|
|
|
|
mipi_config->pwm_blc == PPS_BLC_PMIC) {
|
2019-12-17 04:51:21 +08:00
|
|
|
gpiod_add_lookup_table(&pmic_panel_gpio_table);
|
2019-12-17 04:51:22 +08:00
|
|
|
want_panel_gpio = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IS_VALLEYVIEW(dev_priv) && mipi_config->pwm_blc == PPS_BLC_SOC) {
|
|
|
|
gpiod_add_lookup_table(&soc_panel_gpio_table);
|
|
|
|
want_panel_gpio = true;
|
|
|
|
want_backlight_gpio = true;
|
2019-12-17 04:51:21 +08:00
|
|
|
|
2019-12-17 04:51:22 +08:00
|
|
|
/* Ensure PWM0 pin is muxed as PWM instead of GPIO */
|
|
|
|
ret = pinctrl_register_mappings(soc_pwm_pinctrl_map,
|
|
|
|
ARRAY_SIZE(soc_pwm_pinctrl_map));
|
|
|
|
if (ret)
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Failed to register pwm0 pinmux mapping\n");
|
2019-12-17 04:51:22 +08:00
|
|
|
|
|
|
|
pinctrl = devm_pinctrl_get_select(dev->dev, "soc_pwm0");
|
|
|
|
if (IS_ERR(pinctrl))
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Failed to set pinmux to PWM\n");
|
2019-12-17 04:51:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (want_panel_gpio) {
|
2019-12-17 04:51:20 +08:00
|
|
|
intel_dsi->gpio_panel = gpiod_get(dev->dev, "panel", flags);
|
2019-12-17 04:51:19 +08:00
|
|
|
if (IS_ERR(intel_dsi->gpio_panel)) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Failed to own gpio for panel control\n");
|
2019-12-17 04:51:19 +08:00
|
|
|
intel_dsi->gpio_panel = NULL;
|
|
|
|
}
|
|
|
|
}
|
2019-12-17 04:51:22 +08:00
|
|
|
|
|
|
|
if (want_backlight_gpio) {
|
|
|
|
intel_dsi->gpio_backlight =
|
|
|
|
gpiod_get(dev->dev, "backlight", flags);
|
|
|
|
if (IS_ERR(intel_dsi->gpio_backlight)) {
|
2020-02-06 16:00:11 +08:00
|
|
|
drm_err(&dev_priv->drm,
|
|
|
|
"Failed to own gpio for backlight control\n");
|
2019-12-17 04:51:22 +08:00
|
|
|
intel_dsi->gpio_backlight = NULL;
|
|
|
|
}
|
|
|
|
}
|
2019-12-17 04:51:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi)
|
|
|
|
{
|
2019-12-17 04:51:21 +08:00
|
|
|
struct drm_device *dev = intel_dsi->base.base.dev;
|
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
|
struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
|
|
|
|
|
2019-12-17 04:51:19 +08:00
|
|
|
if (intel_dsi->gpio_panel) {
|
|
|
|
gpiod_put(intel_dsi->gpio_panel);
|
|
|
|
intel_dsi->gpio_panel = NULL;
|
|
|
|
}
|
2019-12-17 04:51:21 +08:00
|
|
|
|
2019-12-17 04:51:22 +08:00
|
|
|
if (intel_dsi->gpio_backlight) {
|
|
|
|
gpiod_put(intel_dsi->gpio_backlight);
|
|
|
|
intel_dsi->gpio_backlight = NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-17 04:51:21 +08:00
|
|
|
if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
|
|
|
|
mipi_config->pwm_blc == PPS_BLC_PMIC)
|
|
|
|
gpiod_remove_lookup_table(&pmic_panel_gpio_table);
|
2019-12-17 04:51:22 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2019-12-17 04:51:19 +08:00
|
|
|
}
|