Discussion:
[Intel-gfx] [PATCH v2 1/3] ACPI / PMIC: Add support for executing PMIC MIPI sequence elements
Hans de Goede
2018-12-06 13:47:03 UTC
Permalink
DSI LCD panels describe an initialization sequence in the Video BIOS
Tables using so called MIPI sequences. One possible element in these
sequences is a PMIC specific element of 15 bytes.

Although this is not really an ACPI opregion, the ACPI opregion code is the
closest thing we have. We need to have support for these PMIC specific MIPI
sequence elements somwhere. Since we already instantiate a special platform
device for Intel PMICs for the ACPI PMIC OpRegion handler to bind to,
with PMIC specific implementations of the OpRegion, the handling of MIPI
sequence PMIC elements fits very well in the ACPI PMIC OpRegion code.

This commit adds a new intel_soc_pmic_exec_mipi_pmic_seq_element()
function, which is to be backed by a PMIC specific
exec_mipi_pmic_seq_element callback. This function will be called by the
i915 code to execture MIPI sequence PMIC elements.

Signed-off-by: Hans de Goede <***@redhat.com>
---
drivers/acpi/pmic/intel_pmic.c | 25 +++++++++++++++++++++++++
drivers/acpi/pmic/intel_pmic.h | 1 +
include/linux/mfd/intel_soc_pmic.h | 2 ++
3 files changed, 28 insertions(+)

diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
index ca18e0d23df9..0d96ca08bb79 100644
--- a/drivers/acpi/pmic/intel_pmic.c
+++ b/drivers/acpi/pmic/intel_pmic.c
@@ -15,6 +15,7 @@

#include <linux/export.h>
#include <linux/acpi.h>
+#include <linux/mfd/intel_soc_pmic.h>
#include <linux/regmap.h>
#include <acpi/acpi_lpat.h>
#include "intel_pmic.h"
@@ -36,6 +37,8 @@ struct intel_pmic_opregion {
struct intel_pmic_regs_handler_ctx ctx;
};

+static struct intel_pmic_opregion *intel_pmic_opregion;
+
static int pmic_get_reg_bit(int address, struct pmic_table *table,
int count, int *reg, int *bit)
{
@@ -304,6 +307,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
}

opregion->data = d;
+ intel_pmic_opregion = opregion;
return 0;

out_remove_thermal_handler:
@@ -319,3 +323,24 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
return ret;
}
EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler);
+
+void intel_soc_pmic_exec_mipi_pmic_seq_element(const u8 *data)
+{
+ struct intel_pmic_opregion_data *d;
+
+ if (!intel_pmic_opregion) {
+ pr_warn("%s: No PMIC registered\n", __func__);
+ return;
+ }
+
+ d = intel_pmic_opregion->data;
+ if (!d->exec_mipi_pmic_seq_element) {
+ pr_warn("%s: Not implemented\n", __func__);
+ return;
+ }
+
+ mutex_lock(&intel_pmic_opregion->lock);
+ d->exec_mipi_pmic_seq_element(intel_pmic_opregion->regmap, data);
+ mutex_unlock(&intel_pmic_opregion->lock);
+}
+EXPORT_SYMBOL_GPL(intel_soc_pmic_exec_mipi_pmic_seq_element);
diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h
index 095afc96952e..5a7bb33d046a 100644
--- a/drivers/acpi/pmic/intel_pmic.h
+++ b/drivers/acpi/pmic/intel_pmic.h
@@ -15,6 +15,7 @@ struct intel_pmic_opregion_data {
int (*update_aux)(struct regmap *r, int reg, int raw_temp);
int (*get_policy)(struct regmap *r, int reg, int bit, u64 *value);
int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
+ void (*exec_mipi_pmic_seq_element)(struct regmap *r, const u8 *data);
struct pmic_table *power_table;
int power_table_count;
struct pmic_table *thermal_table;
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
index ed1dfba5e5f9..ce04ad7d4b6c 100644
--- a/include/linux/mfd/intel_soc_pmic.h
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -26,4 +26,6 @@ struct intel_soc_pmic {
struct device *dev;
};

+void intel_soc_pmic_exec_mipi_pmic_seq_element(const u8 *data);
+
#endif /* __INTEL_SOC_PMIC_H__ */
--
2.19.2
Hans de Goede
2018-12-06 13:47:04 UTC
Permalink
Implement the exec_mipi_pmic_seq_element callback for the CHT Whiskey Cove
PMIC.

On some CHT devices this fixes the LCD panel not lighting up when it was
not initialized by the GOP, because an external monitor was plugged in and
the GOP initialized only the external monitor.

Signed-off-by: Hans de Goede <***@redhat.com>
---
Changes in v2:
-Interpret data passed to the PMIC MIPI elements according to the docs
instead of my own reverse engineered interpretation
---
drivers/acpi/pmic/intel_pmic_chtwc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/drivers/acpi/pmic/intel_pmic_chtwc.c b/drivers/acpi/pmic/intel_pmic_chtwc.c
index 078b0448f30a..049c0cf3b9ed 100644
--- a/drivers/acpi/pmic/intel_pmic_chtwc.c
+++ b/drivers/acpi/pmic/intel_pmic_chtwc.c
@@ -12,6 +12,7 @@
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
+#include <asm/unaligned.h>
#include "intel_pmic.h"

#define CHT_WC_V1P05A_CTRL 0x6e3b
@@ -231,6 +232,28 @@ static int intel_cht_wc_pmic_update_power(struct regmap *regmap, int reg,
return regmap_update_bits(regmap, reg, bitmask, on ? 1 : 0);
}

+static void intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap,
+ const u8 *data)
+{
+ u32 value, mask, reg_address, address;
+ u16 i2c_client_address;
+
+ /* byte 0 aka PMIC Flag is reserved */
+ i2c_client_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);
+
+ if (i2c_client_address > 255 || reg_address > 255) {
+ pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n",
+ __func__, i2c_client_address, reg_address);
+ return;
+ }
+
+ address = (i2c_client_address << 8) | reg_address;
+ regmap_update_bits(regmap, address, mask, value);
+}
+
/*
* The thermal table and ops are empty, we do not support the Thermal opregion
* (DPTF) due to lacking documentation.
@@ -238,6 +261,7 @@ static int intel_cht_wc_pmic_update_power(struct regmap *regmap, int reg,
static struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = {
.get_power = intel_cht_wc_pmic_get_power,
.update_power = intel_cht_wc_pmic_update_power,
+ .exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element,
.power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table),
};
--
2.19.2
Mika Westerberg
2018-12-07 11:40:59 UTC
Permalink
Post by Hans de Goede
Implement the exec_mipi_pmic_seq_element callback for the CHT Whiskey Cove
PMIC.
On some CHT devices this fixes the LCD panel not lighting up when it was
not initialized by the GOP, because an external monitor was plugged in and
the GOP initialized only the external monitor.
---
-Interpret data passed to the PMIC MIPI elements according to the docs
instead of my own reverse engineered interpretation
---
drivers/acpi/pmic/intel_pmic_chtwc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/acpi/pmic/intel_pmic_chtwc.c b/drivers/acpi/pmic/intel_pmic_chtwc.c
index 078b0448f30a..049c0cf3b9ed 100644
--- a/drivers/acpi/pmic/intel_pmic_chtwc.c
+++ b/drivers/acpi/pmic/intel_pmic_chtwc.c
@@ -12,6 +12,7 @@
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
+#include <asm/unaligned.h>
#include "intel_pmic.h"
#define CHT_WC_V1P05A_CTRL 0x6e3b
@@ -231,6 +232,28 @@ static int intel_cht_wc_pmic_update_power(struct regmap *regmap, int reg,
return regmap_update_bits(regmap, reg, bitmask, on ? 1 : 0);
}
+static void intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap,
+ const u8 *data)
+{
+ u32 value, mask, reg_address, address;
+ u16 i2c_client_address;
+
+ /* byte 0 aka PMIC Flag is reserved */
+ i2c_client_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);
+
+ if (i2c_client_address > 255 || reg_address > 255) {
+ pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n",
+ __func__, i2c_client_address, reg_address);
+ return;
Here also return an error code instead.
Post by Hans de Goede
+ }
+
+ address = (i2c_client_address << 8) | reg_address;
+ regmap_update_bits(regmap, address, mask, value);
+}
+
/*
* The thermal table and ops are empty, we do not support the Thermal opregion
* (DPTF) due to lacking documentation.
@@ -238,6 +261,7 @@ static int intel_cht_wc_pmic_update_power(struct regmap *regmap, int reg,
static struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = {
.get_power = intel_cht_wc_pmic_get_power,
.update_power = intel_cht_wc_pmic_update_power,
+ .exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element,
.power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table),
};
--
2.19.2
Hans de Goede
2018-12-06 13:47:05 UTC
Permalink
Add support for PMIC mipi sequences using the new
intel_soc_pmic_exec_mipi_pmic_seq_element function.

Signed-off-by: Hans de Goede <***@redhat.com>
---
drivers/gpu/drm/i915/intel_dsi_vbt.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
index f27af47c6e49..6a2ed1ca72e0 100644
--- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
@@ -29,6 +29,7 @@
#include <drm/drm_edid.h>
#include <drm/i915_drm.h>
#include <linux/gpio/consumer.h>
+#include <linux/mfd/intel_soc_pmic.h>
#include <linux/slab.h>
#include <video/mipi_display.h>
#include <asm/intel-mid.h>
@@ -371,7 +372,11 @@ static const u8 *mipi_exec_spi(struct intel_dsi *intel_dsi, const u8 *data)

static const u8 *mipi_exec_pmic(struct intel_dsi *intel_dsi, const u8 *data)
{
+#ifdef CONFIG_PMIC_OPREGION
+ intel_soc_pmic_exec_mipi_pmic_seq_element(data);
+#else
DRM_DEBUG_KMS("Skipping PMIC element execution\n");
+#endif

return data + 15;
}
--
2.19.2
Ville Syrjälä
2018-12-07 17:17:28 UTC
Permalink
Post by Hans de Goede
Add support for PMIC mipi sequences using the new
intel_soc_pmic_exec_mipi_pmic_seq_element function.
Please document somewhere which machines you've found to need
this (commit msg should be sufficient I suppose). Can make it
much easier to respond to bug reports like "my machine X with
DSI doesn't work".
Post by Hans de Goede
---
drivers/gpu/drm/i915/intel_dsi_vbt.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
index f27af47c6e49..6a2ed1ca72e0 100644
--- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
@@ -29,6 +29,7 @@
#include <drm/drm_edid.h>
#include <drm/i915_drm.h>
#include <linux/gpio/consumer.h>
+#include <linux/mfd/intel_soc_pmic.h>
#include <linux/slab.h>
#include <video/mipi_display.h>
#include <asm/intel-mid.h>
@@ -371,7 +372,11 @@ static const u8 *mipi_exec_spi(struct intel_dsi *intel_dsi, const u8 *data)
static const u8 *mipi_exec_pmic(struct intel_dsi *intel_dsi, const u8 *data)
{
+#ifdef CONFIG_PMIC_OPREGION
+ intel_soc_pmic_exec_mipi_pmic_seq_element(data);
+#else
DRM_DEBUG_KMS("Skipping PMIC element execution\n");
+#endif
return data + 15;
}
--
2.19.2
--
Ville Syrjälä
Intel
Patchwork
2018-12-06 14:35:47 UTC
Permalink
== Series Details ==

Series: series starting with [v2,1/3] ACPI / PMIC: Add support for executing PMIC MIPI sequence elements
URL : https://patchwork.freedesktop.org/series/53662/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5275 -> Patchwork_11035
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/53662/revisions/1/mbox/

Known issues
------------

Here are the changes found in Patchwork_11035 that come from known issues:

### IGT changes ###

#### Issues hit ####

* ***@gem_mmap_gtt@basic-read:
- fi-glk-dsi: PASS -> INCOMPLETE [fdo#103359] / [k.org#198133]

* ***@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]


[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (48 -> 44)
------------------------------

Missing (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u


Build changes
-------------

* Linux: CI_DRM_5275 -> Patchwork_11035

CI_DRM_5275: 95dba5a17f86524f31cdc13af7d3238351db9a9c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4743: edb2db2cf2b6665d7ba3fa9117263302f6307a4f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11035: 7d47b33cf34569f5768f221174c90ff218af8d2b @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

7d47b33cf345 drm/i915/intel_dsi_vbt: Add support for PMIC mipi sequences
fab666073ace ACPI / PMIC: Implement exec_mipi_pmic_seq_element for CHT Whiskey Cove PMIC
8a78de6f985d ACPI / PMIC: Add support for executing PMIC MIPI sequence elements

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11035/
Patchwork
2018-12-07 08:01:22 UTC
Permalink
== Series Details ==

Series: series starting with [v2,1/3] ACPI / PMIC: Add support for executing PMIC MIPI sequence elements
URL : https://patchwork.freedesktop.org/series/53662/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5275_full -> Patchwork_11035_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with Patchwork_11035_full need to be verified
manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_11035_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.



Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_11035_full:

### IGT changes ###

#### Warnings ####

* ***@tools_test@tools_test:
- shard-glk: SKIP -> PASS


Known issues
------------

Here are the changes found in Patchwork_11035_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* ***@gem_exec_schedule@pi-ringfull-vebox:
- shard-skl: NOTRUN -> FAIL [fdo#103158]

* ***@i915_suspend@fence-restore-tiled2untiled:
- {shard-iclb}: PASS -> INCOMPLETE [fdo#107713]

* ***@kms_available_modes_crc@available_mode_test_crc:
- shard-skl: NOTRUN -> FAIL [fdo#106641]

* ***@kms_color@pipe-b-degamma:
- shard-skl: PASS -> FAIL [fdo#104782]

* ***@kms_cursor_crc@cursor-256x256-dpms:
- shard-glk: PASS -> FAIL [fdo#103232]

* ***@kms_cursor_crc@cursor-256x85-random:
- {shard-iclb}: NOTRUN -> FAIL [fdo#103232]

* ***@kms_cursor_legacy@long-nonblocking-modeset-vs-cursor-atomic:
- shard-hsw: PASS -> DMESG-WARN [fdo#102614]

* ***@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
- shard-apl: PASS -> FAIL [fdo#103167]
- shard-glk: PASS -> FAIL [fdo#103167] +1

* ***@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-move:
- {shard-iclb}: PASS -> FAIL [fdo#103167] +2

* ***@kms_panel_fitting@legacy:
- shard-skl: NOTRUN -> FAIL [fdo#105456]

* {***@kms_plane@pixel-format-pipe-c-planes-source-clamping}:
- shard-apl: PASS -> FAIL [fdo#108948]

* ***@kms_plane_multiple@atomic-pipe-a-tiling-y:
- {shard-iclb}: PASS -> FAIL [fdo#103166]

* ***@kms_plane_multiple@atomic-pipe-a-tiling-yf:
- shard-apl: PASS -> FAIL [fdo#103166]

* ***@kms_plane_multiple@atomic-pipe-b-tiling-y:
- shard-glk: PASS -> FAIL [fdo#103166] +1

* ***@kms_plane_scaling@pipe-a-scaler-with-rotation:
- {shard-iclb}: NOTRUN -> DMESG-WARN [fdo#107724]

* ***@kms_setmode@basic:
- shard-skl: NOTRUN -> FAIL [fdo#99912]

* ***@pm_rpm@gem-mmap-cpu:
- shard-skl: NOTRUN -> INCOMPLETE [fdo#107807]

* ***@pm_rpm@gem-mmap-gtt:
- shard-skl: PASS -> INCOMPLETE [fdo#107807]

* ***@pm_rpm@legacy-planes:
- shard-skl: PASS -> INCOMPLETE [fdo#105959] / [fdo#107807]


#### Possible fixes ####

* ***@kms_busy@extended-modeset-hang-newfb-render-c:
- {shard-iclb}: DMESG-WARN [fdo#107724] / [fdo#107956] -> PASS

* ***@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-glk: FAIL [fdo#108145] -> PASS

* ***@kms_color@pipe-c-legacy-gamma:
- shard-apl: FAIL [fdo#104782] -> PASS

* ***@kms_draw_crc@draw-method-rgb565-mmap-wc-ytiled:
- shard-skl: FAIL [fdo#103184] -> PASS

* ***@kms_draw_crc@draw-method-xrgb8888-pwrite-untiled:
- shard-skl: FAIL [fdo#108472] -> PASS

* ***@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-draw-render:
- shard-glk: FAIL [fdo#103167] -> PASS

* ***@kms_frontbuffer_tracking@fbc-rgb101010-draw-pwrite:
- shard-skl: FAIL [fdo#103167] / [fdo#105682] -> PASS

* ***@kms_frontbuffer_tracking@fbcpsr-1p-indfb-fliptrack:
- {shard-iclb}: DMESG-FAIL [fdo#107724] -> PASS +2

* ***@kms_frontbuffer_tracking@psr-1p-offscren-pri-indfb-draw-render:
- shard-skl: FAIL [fdo#103167] -> PASS +2

* ***@kms_frontbuffer_tracking@psr-1p-primscrn-pri-shrfb-draw-mmap-gtt:
- {shard-iclb}: DMESG-WARN [fdo#107724] / [fdo#108336] -> PASS +4

* ***@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-move:
- {shard-iclb}: FAIL [fdo#103167] -> PASS +4

* ***@kms_frontbuffer_tracking@psr-suspend:
- shard-skl: INCOMPLETE [fdo#104108] / [fdo#106978] -> PASS

* ***@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-apl: FAIL [fdo#108145] -> PASS

* ***@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: FAIL [fdo#107815] / [fdo#108145] -> PASS

* ***@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-apl: FAIL [fdo#103166] -> PASS +1

* ***@kms_plane_multiple@atomic-pipe-a-tiling-yf:
- {shard-iclb}: FAIL [fdo#103166] -> PASS

* ***@kms_plane_multiple@atomic-pipe-c-tiling-y:
- shard-glk: FAIL [fdo#103166] -> PASS

* {***@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-glk: DMESG-WARN [fdo#105763] / [fdo#106538] -> PASS

* ***@kms_vblank@pipe-a-ts-continuation-idle:
- {shard-iclb}: DMESG-WARN [fdo#107724] -> PASS +20

* ***@perf@blocking:
- shard-hsw: FAIL [fdo#102252] -> PASS

* ***@pm_rpm@i2c:
- shard-skl: INCOMPLETE [fdo#107807] -> PASS


#### Warnings ####

* ***@kms_ccs@pipe-a-crc-primary-rotation-180:
- {shard-iclb}: DMESG-WARN [fdo#107724] / [fdo#108336] -> FAIL [fdo#107725]

* ***@kms_cursor_crc@cursor-64x21-random:
- {shard-iclb}: DMESG-WARN [fdo#107724] / [fdo#108336] -> FAIL [fdo#103232]

* {***@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-kbl: DMESG-FAIL [fdo#108950] -> DMESG-WARN [fdo#105604]


{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102252]: https://bugs.freedesktop.org/show_bug.cgi?id=102252
[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#103158]: https://bugs.freedesktop.org/show_bug.cgi?id=103158
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105456]: https://bugs.freedesktop.org/show_bug.cgi?id=105456
[fdo#105604]: https://bugs.freedesktop.org/show_bug.cgi?id=105604
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#105959]: https://bugs.freedesktop.org/show_bug.cgi?id=105959
[fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#106978]: https://bugs.freedesktop.org/show_bug.cgi?id=106978
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107725]: https://bugs.freedesktop.org/show_bug.cgi?id=107725
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108336]: https://bugs.freedesktop.org/show_bug.cgi?id=108336
[fdo#108472]: https://bugs.freedesktop.org/show_bug.cgi?id=108472
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts


Build changes
-------------

* Linux: CI_DRM_5275 -> Patchwork_11035

CI_DRM_5275: 95dba5a17f86524f31cdc13af7d3238351db9a9c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4743: edb2db2cf2b6665d7ba3fa9117263302f6307a4f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11035: 7d47b33cf34569f5768f221174c90ff218af8d2b @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11035/
Mika Westerberg
2018-12-07 11:39:45 UTC
Permalink
Post by Hans de Goede
DSI LCD panels describe an initialization sequence in the Video BIOS
Tables using so called MIPI sequences. One possible element in these
sequences is a PMIC specific element of 15 bytes.
Although this is not really an ACPI opregion, the ACPI opregion code is the
closest thing we have. We need to have support for these PMIC specific MIPI
sequence elements somwhere. Since we already instantiate a special platform
device for Intel PMICs for the ACPI PMIC OpRegion handler to bind to,
with PMIC specific implementations of the OpRegion, the handling of MIPI
sequence PMIC elements fits very well in the ACPI PMIC OpRegion code.
This commit adds a new intel_soc_pmic_exec_mipi_pmic_seq_element()
function, which is to be backed by a PMIC specific
exec_mipi_pmic_seq_element callback. This function will be called by the
i915 code to execture MIPI sequence PMIC elements.
---
drivers/acpi/pmic/intel_pmic.c | 25 +++++++++++++++++++++++++
drivers/acpi/pmic/intel_pmic.h | 1 +
include/linux/mfd/intel_soc_pmic.h | 2 ++
3 files changed, 28 insertions(+)
diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
index ca18e0d23df9..0d96ca08bb79 100644
--- a/drivers/acpi/pmic/intel_pmic.c
+++ b/drivers/acpi/pmic/intel_pmic.c
@@ -15,6 +15,7 @@
#include <linux/export.h>
#include <linux/acpi.h>
+#include <linux/mfd/intel_soc_pmic.h>
#include <linux/regmap.h>
#include <acpi/acpi_lpat.h>
#include "intel_pmic.h"
@@ -36,6 +37,8 @@ struct intel_pmic_opregion {
struct intel_pmic_regs_handler_ctx ctx;
};
+static struct intel_pmic_opregion *intel_pmic_opregion;
+
static int pmic_get_reg_bit(int address, struct pmic_table *table,
int count, int *reg, int *bit)
{
@@ -304,6 +307,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
}
opregion->data = d;
+ intel_pmic_opregion = opregion;
return 0;
@@ -319,3 +323,24 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
return ret;
}
EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler);
+
Since this is exported, please add kernel-doc here.
Post by Hans de Goede
+void intel_soc_pmic_exec_mipi_pmic_seq_element(const u8 *data)
+{
+ struct intel_pmic_opregion_data *d;
+
+ if (!intel_pmic_opregion) {
+ pr_warn("%s: No PMIC registered\n", __func__);
+ return;
Why not return error codes instead?

Other ops in struct intel_pmic_opregion_data seem to do so.
Post by Hans de Goede
+ }
+
+ d = intel_pmic_opregion->data;
+ if (!d->exec_mipi_pmic_seq_element) {
+ pr_warn("%s: Not implemented\n", __func__);
+ return;
Ditto.
Post by Hans de Goede
+ }
+
+ mutex_lock(&intel_pmic_opregion->lock);
+ d->exec_mipi_pmic_seq_element(intel_pmic_opregion->regmap, data);
+ mutex_unlock(&intel_pmic_opregion->lock);
+}
+EXPORT_SYMBOL_GPL(intel_soc_pmic_exec_mipi_pmic_seq_element);
diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h
index 095afc96952e..5a7bb33d046a 100644
--- a/drivers/acpi/pmic/intel_pmic.h
+++ b/drivers/acpi/pmic/intel_pmic.h
@@ -15,6 +15,7 @@ struct intel_pmic_opregion_data {
int (*update_aux)(struct regmap *r, int reg, int raw_temp);
int (*get_policy)(struct regmap *r, int reg, int bit, u64 *value);
int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
+ void (*exec_mipi_pmic_seq_element)(struct regmap *r, const u8 *data);
struct pmic_table *power_table;
int power_table_count;
struct pmic_table *thermal_table;
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
index ed1dfba5e5f9..ce04ad7d4b6c 100644
--- a/include/linux/mfd/intel_soc_pmic.h
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -26,4 +26,6 @@ struct intel_soc_pmic {
struct device *dev;
};
+void intel_soc_pmic_exec_mipi_pmic_seq_element(const u8 *data);
+
#endif /* __INTEL_SOC_PMIC_H__ */
--
2.19.2
Andy Shevchenko
2018-12-07 14:18:05 UTC
Permalink
Post by Hans de Goede
Implement the exec_mipi_pmic_seq_element callback for the CHT Whiskey Cove
PMIC.
On some CHT devices this fixes the LCD panel not lighting up when it was
not initialized by the GOP, because an external monitor was plugged in and
the GOP initialized only the external monitor.
+ /* byte 0 aka PMIC Flag is reserved */
+ i2c_client_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);
+
+ if (i2c_client_address > 255 || reg_address > 255) {
Hmm... I would rather like to see hexadecimal for addresses and decimal for
something like countable value for data.
Post by Hans de Goede
+ pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n",
+ __func__, i2c_client_address, reg_address);
+ return;
+ }
+
+ address = (i2c_client_address << 8) | reg_address;
+ regmap_update_bits(regmap, address, mask, value);
+}
--
With Best Regards,
Andy Shevchenko
Hans de Goede
2018-12-09 14:34:22 UTC
Permalink
Hi,
Post by Andy Shevchenko
Post by Hans de Goede
Implement the exec_mipi_pmic_seq_element callback for the CHT Whiskey Cove
PMIC.
On some CHT devices this fixes the LCD panel not lighting up when it was
not initialized by the GOP, because an external monitor was plugged in and
the GOP initialized only the external monitor.
+ /* byte 0 aka PMIC Flag is reserved */
+ i2c_client_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);
+
+ if (i2c_client_address > 255 || reg_address > 255) {
Hmm... I would rather like to see hexadecimal for addresses and decimal for
something like countable value for data.
Ok, fixed for v3.

Regards,

Hans
Post by Andy Shevchenko
Post by Hans de Goede
+ pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n",
+ __func__, i2c_client_address, reg_address);
+ return;
+ }
+
+ address = (i2c_client_address << 8) | reg_address;
+ regmap_update_bits(regmap, address, mask, value);
+}
Loading...