From: Hans de Goede <hdegoede@redhat.com>
To: "Mario Limonciello" <mario.limonciello@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: markgross@kernel.org, basavaraj.natikar@amd.com,
jikos@kernel.org, benjamin.tissoires@redhat.com,
alexander.deucher@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
daniel@ffwll.ch, Patil.Reddy@amd.com,
platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 13/17] platform/x86/amd/pmf: Add PMF-AMDGPU get interface
Date: Wed, 18 Oct 2023 21:08:15 +0200 [thread overview]
Message-ID: <e143bbe2-212c-cfc8-131f-8ec9c0bff56d@redhat.com> (raw)
In-Reply-To: <238f915f-b95f-4d85-ad67-66781f53e75d@amd.com>
Hi,
I was not following this at first, so my apologies for
jumping in in the middle of the thread:
<snip>
>>>>> +static int amd_pmf_gpu_get_cur_state(struct thermal_cooling_device *cooling_dev,
>>>>> + unsigned long *state)
>>>>> +{
>>>>> + struct backlight_device *bd;
>>>>> +
>>>>> + if (!acpi_video_backlight_use_native())
>>>>> + return -ENODEV;
>>>>> +
>>>>> + bd = backlight_device_get_by_type(BACKLIGHT_RAW);
>>>>> + if (!bd)
>>>>> + return -ENODEV;
>>>>> +
>>>>> + *state = backlight_get_brightness(bd);
>>>>> +
>>>>> + return 0;
>>>>> +}
>>>>> +
>>>>> +static int amd_pmf_gpu_get_max_state(struct thermal_cooling_device *cooling_dev,
>>>>> + unsigned long *state)
>>>>> +{
>>>>> + struct backlight_device *bd;
>>>>> +
>>>>> + if (!acpi_video_backlight_use_native())
>>>>> + return -ENODEV;
>>>>> +
>>>>> + bd = backlight_device_get_by_type(BACKLIGHT_RAW);
>>>>> + if (!bd)
>>>>> + return -ENODEV;
>>>>> +
>>>>> + if (backlight_is_blank(bd))
>>>>> + *state = 0;
>>>>> + else
>>>>> + *state = bd->props.max_brightness;
>>>>> +
>>>>> + return 0;
>>>>> +}
>>>>> +
>>>>> +static const struct thermal_cooling_device_ops bd_cooling_ops = {
>>>>> + .get_max_state = amd_pmf_gpu_get_max_state,
>>>>> + .get_cur_state = amd_pmf_gpu_get_cur_state,
>>>>> +};
So first of all, good to see that this is using the
thermal_cooling_device APIs now, that is great thank you.
But the whole idea behind using the thermal_cooling_device APIs
is that amdgpu exports the cooling_device itself, rather then have
the AMD PMF code export it. Now the AMD PMF code is still poking
at the backlight_device itself, while the idea was to delegate
this to the GPU driver.
Actually seeing all the acpi_video_backlight_use_native()
checks here, I wonder why only have this work with native backlight
control. One step better would be to add thermal_cooling_device
support to the backlight core in:
drivers/video/backlight/backlight.c
Then it will work with any backlight control provider!
Last but not least this code MUST not call
acpi_video_backlight_use_native()
No code other then native GPU drivers must ever call
acpi_video_backlight_use_native(). This special function
not only checks if the native backlight control is the
one which the detection code in drivers/acpi/video_detect.c
has selected, it also signals to video_detect.c that
native GPU backlight control is available.
So by calling this in the AMD PMF code you are now
telling video_detect.c that native GPU backlight control
is available on all systems where AMD PMF runs.
As I already said I really believe the whole cooling
device should be registered somewhere else. But if you
do end up sticking with this then you MUST replace
the acpi_video_backlight_use_native() calls with:
if (acpi_video_get_backlight_type() == acpi_backlight_native) {...}
Regards,
Hans
next prev parent reply other threads:[~2023-10-18 19:09 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 7:02 [PATCH v4 00/17] Introduce PMF Smart PC Solution Builder Feature Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 01/17] platform/x86/amd/pmf: Add PMF TEE interface Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 02/17] platform/x86/amd/pmf: Add support for PMF-TA interaction Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 03/17] platform/x86/amd/pmf: Change return type of amd_pmf_set_dram_addr() Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 04/17] platform/x86/amd/pmf: Add support for PMF Policy Binary Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 05/17] platform/x86/amd/pmf: change amd_pmf_init_features() call sequence Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 06/17] platform/x86/amd/pmf: Add support to get inputs from other subsystems Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 07/17] platform/x86/amd/pmf: Add support update p3t limit Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 08/17] platform/x86/amd/pmf: Add support to update system state Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 09/17] platform/x86/amd/pmf: Make source_as_str() as non-static Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 10/17] platform/x86/amd/pmf: Add facility to dump TA inputs Shyam Sundar S K
2023-10-18 9:00 ` Ilpo Järvinen
2023-11-17 7:46 ` Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 11/17] platform/x86/amd/pmf: Add capability to sideload of policy binary Shyam Sundar S K
2023-10-18 10:21 ` Ilpo Järvinen
2023-10-18 7:02 ` [PATCH v4 12/17] platform/x86/amd/pmf: dump policy binary data Shyam Sundar S K
2023-10-18 10:09 ` Ilpo Järvinen
2023-10-18 7:02 ` [PATCH v4 13/17] platform/x86/amd/pmf: Add PMF-AMDGPU get interface Shyam Sundar S K
2023-10-18 9:20 ` Ilpo Järvinen
2023-10-18 9:28 ` Shyam Sundar S K
2023-10-18 9:37 ` Ilpo Järvinen
2023-10-18 13:40 ` Christian König
2023-10-18 15:47 ` Mario Limonciello
2023-10-18 16:07 ` Christian König
2023-10-18 17:05 ` Shyam Sundar S K
2023-10-19 9:01 ` Christian König
2023-11-17 8:00 ` Shyam Sundar S K
2023-10-18 19:08 ` Hans de Goede [this message]
2023-11-17 8:04 ` Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 14/17] platform/x86/amd/pmf: Add PMF-AMDGPU set interface Shyam Sundar S K
2023-10-18 7:02 ` [PATCH v4 15/17] HID: amd_sfh: rename float_to_int() to amd_sfh_float_to_int() Shyam Sundar S K
2023-10-18 8:15 ` Ilpo Järvinen
2023-10-18 7:02 ` [PATCH v4 16/17] platform/x86/amd/pmf: Add PMF-AMDSFH interface for HPD Shyam Sundar S K
2023-10-18 8:29 ` Ilpo Järvinen
2023-10-18 7:02 ` [PATCH v4 17/17] platform/x86/amd/pmf: Add PMF-AMDSFH interface for ALS Shyam Sundar S K
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e143bbe2-212c-cfc8-131f-8ec9c0bff56d@redhat.com \
--to=hdegoede@redhat.com \
--cc=Patil.Reddy@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=basavaraj.natikar@amd.com \
--cc=benjamin.tissoires@redhat.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox