Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions drivers/gpu/drm/apple/dcp-syslog-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ static void dcp_syslog_transition_test(struct kunit *test)
"ready_for_run_mode_change: initiating deferred run mode change: 4 -> 1" },
{ "UPPipeDCP_H17P.cpp:2014",
"ready_for_run_mode_change: initiating deferred run mode change: 2 -> 4" },
{ "itorContext_v4.cpp:1324",
"SMC sensor TAOC is an invalid temp -127.0, using 2DVT fallback values" },
};
char message[128];
int i;
Expand Down Expand Up @@ -46,6 +48,13 @@ static void dcp_syslog_unknown_test(struct kunit *test)
{ "UPPipeDCP_H17P.cpp:2014", "ready_for_run_mode_change: timeout" },
{ "UPPipeDCP_H17P.cpp:2096", "set_run_mode_safe: error -110" },
{ "UPPipeDCP_H17P.cpp:2097", "set_run_mode_safe: deferring: 4 -> 1" },
/* A different sensor, value or verdict is news. */
{ "itorContext_v4.cpp:1324",
"SMC sensor TAOJ is an invalid temp -127.0, using 2DVT fallback values" },
{ "itorContext_v4.cpp:1324",
"SMC sensor TAOC is an invalid temp -40.0, using 2DVT fallback values" },
{ "itorContext_v4.cpp:1324",
"2DVT thermal sensors valid, using computed virtual temperatures" },
};
int i;

Expand Down
11 changes: 11 additions & 0 deletions drivers/gpu/drm/apple/dcp-syslog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ static inline bool dcp_h17p_syslog_is_debug(const char *context, const char *mes
!strcmp(message, "set_run_mode_safe: deferring: 2 -> 4");
if (!strcmp(context, "UPPipeDCP_H17P.cpp:2014"))
return !strcmp(message, deferred_4_1) || !strcmp(message, deferred_2_4);
/*
* The 27.x panel temperature monitor (IOMFBTemperatureMonitorContext_v4)
* reads its sensor keys from the SMC once a second and falls back to the
* default 2D virtual temperature grid while TAOC holds the SMC's -127.0
* "no sample" sentinel (the AOP feeds TAOC/TAOJ/TAOP in macOS; nothing
* does under Linux). Match the exact record so another sensor or value
* stays visible.
*/
if (!strcmp(context, "itorContext_v4.cpp:1324"))
return !strcmp(message, "SMC sensor TAOC is an invalid temp -127.0, "
"using 2DVT fallback values");
return false;
}

Expand Down
11 changes: 6 additions & 5 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1705,18 +1705,19 @@ static void dcp_rtk_shmem_destroy(void *cookie, struct apple_rtkit_shmem *bfr)
dma_free_coherent(dcp->dev, bfr->size, bfr->buffer, bfr->iova);
}

static bool dcp_rtk_syslog_is_debug(void *cookie, const char *context, const char *message)
{
return dcp_h17p_syslog_is_debug(context, message);
}

static struct apple_rtkit_ops rtkit_ops = {
.syslog_is_debug = dcp_rtk_syslog_is_debug,
.crashed = dcp_rtk_crashed,
.recv_message = dcp_recv_msg,
.shmem_setup = dcp_rtk_shmem_setup,
.shmem_destroy = dcp_rtk_shmem_destroy,
};

static bool dcp_rtk_syslog_is_debug(void *cookie, const char *context, const char *message)
{
return dcp_h17p_syslog_is_debug(context, message);
}

static const struct apple_rtkit_ops external_h17p_rtkit_ops = {
.flags = APPLE_RTKIT_COPROC_PLACES_BUFFERS,
.syslog_is_debug = dcp_rtk_syslog_is_debug,
Expand Down
11 changes: 9 additions & 2 deletions drivers/gpu/drm/apple/iomfb_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,15 @@ dcpep_cb_get_uint_prop(struct apple_dcp *dcp, struct dcp_get_uint_prop_req *req)
.value = 0
};

if (dcp->panel.has_mini_led &&
memcmp(req->obj, "SUMP", sizeof(req->obj)) == 0) { /* "PMUS */
/*
* "PMUS"/"Temperature": the battery temperature in 0.1 K. Every
* firmware with a panel asks for it from TableCompensator::
* set_PMU_service(), mini-LED or not: the OLED firmware (27.x on the
* K116s) uses it as the panel's initial temperature guess and logs
* "failed to read PMU temperature property!" when the reply is
* false. The H17P table already answers it unconditionally.
*/
if (memcmp(req->obj, "SUMP", sizeof(req->obj)) == 0) { /* "PMUS */
if (strncmp(req->key, "Temperature", sizeof(req->key)) == 0) {
resp.value = dcp_pmu_temperature(dcp->dev);
resp.ret = true;
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/apple/iomfb_v27.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,12 @@ static const iomfb_cb_handler cb_handlers[IOMFB_MAX_CB] = {
[587] = trampoline_nop,
[588] = trampoline_nop,
[589] = trampoline_swap_info_h17p,
/*
* 27.2 sends this 20-byte notification with no reply after swaps (the
* macOS handler next to swap_info is the buffer-release notification);
* nothing here consumes it.
*/
[590] = trampoline_nop,

[592] = trampoline_nop,
[594] = trampoline_swap_complete,
Expand Down Expand Up @@ -560,6 +566,7 @@ static const struct {
[587] = { 0x0, 0x0 },
[588] = { 0x18, 0x0 },
[589] = { 0xe4, 0xe0 },
[590] = { 0x14, 0x0 },
[592] = { 0x0, 0x0 },
[594] = { 0x730, 0x0 },
[596] = { 0x14, 0x0 },
Expand Down
7 changes: 4 additions & 3 deletions tools/testing/selftests/drivers/gpu/apple-dcp/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ def syslog(root):
dcp = (root / 'drivers/gpu/drm/apple/dcp.c').read_text()
header = (root / 'drivers/gpu/drm/apple/dcp-syslog.h').read_text()
helper = header[header.index('static inline bool'):header.index('\n#endif')]
# The policy belongs only to the external H17P transport. Other RTKit
# clients, including the panel and older DCP firmware, keep info logging.
assert '.syslog_is_debug' not in block(dcp, 'static struct apple_rtkit_ops rtkit_ops =')
# The policy covers both DCP transports, the internal panel's and the
# external H17P one. It demotes only the known records it matches, so other
# records, other firmware and other RTKit clients keep info logging.
assert '.syslog_is_debug = dcp_rtk_syslog_is_debug' in block(dcp, 'static struct apple_rtkit_ops rtkit_ops =')
assert '.syslog_is_debug = dcp_rtk_syslog_is_debug' in block(dcp, 'static const struct apple_rtkit_ops external_h17p_rtkit_ops =')
return r'''
#include <assert.h>
Expand Down
Loading