diff mbox series

[v2,2/4] drm: Add drm_get_acpi_edid() helper

Message ID 20240130192608.11666-3-mario.limonciello@amd.com
State Superseded
Headers show
Series Add support for fetching EDID from ACPI _DDC | expand

Commit Message

Mario Limonciello Jan. 30, 2024, 7:26 p.m. UTC
Some manufacturers have intentionally put an EDID that differs from
the EDID on the internal panel on laptops.  Drivers can call this
helper to attempt to fetch the EDID from the BIOS's ACPI _DDC method.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Split code from previous amdgpu specific helper to generic drm helper.
---
 drivers/gpu/drm/Kconfig    |  4 +++
 drivers/gpu/drm/drm_edid.c | 73 ++++++++++++++++++++++++++++++++++++++
 include/drm/drm_edid.h     |  1 +
 3 files changed, 78 insertions(+)

Comments

kernel test robot Jan. 31, 2024, 7:53 a.m. UTC | #1
Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/acpi-bus linus/master v6.8-rc2 next-20240131]
[cannot apply to drm-misc/drm-misc-next rafael-pm/devprop]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-video-Handle-fetching-EDID-that-is-longer-than-256-bytes/20240131-032909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20240130192608.11666-3-mario.limonciello%40amd.com
patch subject: [PATCH v2 2/4] drm: Add drm_get_acpi_edid() helper
config: i386-buildonly-randconfig-002-20240131 (https://download.01.org/0day-ci/archive/20240131/202401311541.bDe2glWR-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240131/202401311541.bDe2glWR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401311541.bDe2glWR-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/platform/x86/dell/dell-wmi-ddv.c:647:12: error: call to undeclared function 'acpi_device_uid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     647 |         uid_str = acpi_device_uid(acpi_dev);
         |                   ^
>> drivers/platform/x86/dell/dell-wmi-ddv.c:647:10: error: incompatible integer to pointer conversion assigning to 'const char *' from 'int' [-Wint-conversion]
     647 |         uid_str = acpi_device_uid(acpi_dev);
         |                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/platform/x86/dell/dell-wmi-ddv.c:660:35: error: call to undeclared function 'to_acpi_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     660 |         ret = dell_wmi_ddv_battery_index(to_acpi_device(dev->parent), &index);
         |                                          ^
>> drivers/platform/x86/dell/dell-wmi-ddv.c:660:35: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct acpi_device *' [-Wint-conversion]
     660 |         ret = dell_wmi_ddv_battery_index(to_acpi_device(dev->parent), &index);
         |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/x86/dell/dell-wmi-ddv.c:643:59: note: passing argument to parameter 'acpi_dev' here
     643 | static int dell_wmi_ddv_battery_index(struct acpi_device *acpi_dev, u32 *index)
         |                                                           ^
   drivers/platform/x86/dell/dell-wmi-ddv.c:679:35: error: call to undeclared function 'to_acpi_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     679 |         ret = dell_wmi_ddv_battery_index(to_acpi_device(dev->parent), &index);
         |                                          ^
   drivers/platform/x86/dell/dell-wmi-ddv.c:679:35: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct acpi_device *' [-Wint-conversion]
     679 |         ret = dell_wmi_ddv_battery_index(to_acpi_device(dev->parent), &index);
         |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/x86/dell/dell-wmi-ddv.c:643:59: note: passing argument to parameter 'acpi_dev' here
     643 | static int dell_wmi_ddv_battery_index(struct acpi_device *acpi_dev, u32 *index)
         |                                                           ^
   drivers/platform/x86/dell/dell-wmi-ddv.c:705:35: error: call to undeclared function 'to_acpi_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     705 |         ret = dell_wmi_ddv_battery_index(to_acpi_device(battery->dev.parent), &index);
         |                                          ^
   drivers/platform/x86/dell/dell-wmi-ddv.c:705:35: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct acpi_device *' [-Wint-conversion]
     705 |         ret = dell_wmi_ddv_battery_index(to_acpi_device(battery->dev.parent), &index);
         |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/x86/dell/dell-wmi-ddv.c:643:59: note: passing argument to parameter 'acpi_dev' here
     643 | static int dell_wmi_ddv_battery_index(struct acpi_device *acpi_dev, u32 *index)
         |                                                           ^
   8 errors generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for ACPI_WMI
   Depends on [n]: X86_PLATFORM_DEVICES [=y] && ACPI [=n]
   Selected by [m]:
   - DRM [=m] && HAS_IOMEM [=y] && (AGP [=n] || AGP [=n]=n) && !EMULATED_CMPXCHG && HAS_DMA [=y] && X86 [=y]


vim +660 drivers/platform/x86/dell/dell-wmi-ddv.c

3b7eeff93d2912 Armin Wolf 2023-02-09  642  
a77272c1604186 Armin Wolf 2022-09-27  643  static int dell_wmi_ddv_battery_index(struct acpi_device *acpi_dev, u32 *index)
a77272c1604186 Armin Wolf 2022-09-27  644  {
a77272c1604186 Armin Wolf 2022-09-27  645  	const char *uid_str;
a77272c1604186 Armin Wolf 2022-09-27  646  
a77272c1604186 Armin Wolf 2022-09-27 @647  	uid_str = acpi_device_uid(acpi_dev);
a77272c1604186 Armin Wolf 2022-09-27  648  	if (!uid_str)
a77272c1604186 Armin Wolf 2022-09-27  649  		return -ENODEV;
a77272c1604186 Armin Wolf 2022-09-27  650  
a77272c1604186 Armin Wolf 2022-09-27  651  	return kstrtou32(uid_str, 10, index);
a77272c1604186 Armin Wolf 2022-09-27  652  }
a77272c1604186 Armin Wolf 2022-09-27  653  
a77272c1604186 Armin Wolf 2022-09-27  654  static ssize_t temp_show(struct device *dev, struct device_attribute *attr, char *buf)
a77272c1604186 Armin Wolf 2022-09-27  655  {
a77272c1604186 Armin Wolf 2022-09-27  656  	struct dell_wmi_ddv_data *data = container_of(attr, struct dell_wmi_ddv_data, temp_attr);
a77272c1604186 Armin Wolf 2022-09-27  657  	u32 index, value;
a77272c1604186 Armin Wolf 2022-09-27  658  	int ret;
a77272c1604186 Armin Wolf 2022-09-27  659  
a77272c1604186 Armin Wolf 2022-09-27 @660  	ret = dell_wmi_ddv_battery_index(to_acpi_device(dev->parent), &index);
a77272c1604186 Armin Wolf 2022-09-27  661  	if (ret < 0)
a77272c1604186 Armin Wolf 2022-09-27  662  		return ret;
a77272c1604186 Armin Wolf 2022-09-27  663  
a77272c1604186 Armin Wolf 2022-09-27  664  	ret = dell_wmi_ddv_query_integer(data->wdev, DELL_DDV_BATTERY_TEMPERATURE, index, &value);
a77272c1604186 Armin Wolf 2022-09-27  665  	if (ret < 0)
a77272c1604186 Armin Wolf 2022-09-27  666  		return ret;
a77272c1604186 Armin Wolf 2022-09-27  667  
0331b1b0ba6537 Armin Wolf 2023-02-18  668  	/* Use 2731 instead of 2731.5 to avoid unnecessary rounding */
0331b1b0ba6537 Armin Wolf 2023-02-18  669  	return sysfs_emit(buf, "%d\n", value - 2731);
a77272c1604186 Armin Wolf 2022-09-27  670  }
a77272c1604186 Armin Wolf 2022-09-27  671
kernel test robot Jan. 31, 2024, 9:01 a.m. UTC | #2
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/acpi-bus linus/master v6.8-rc2 next-20240131]
[cannot apply to drm-misc/drm-misc-next rafael-pm/devprop]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-video-Handle-fetching-EDID-that-is-longer-than-256-bytes/20240131-032909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20240130192608.11666-3-mario.limonciello%40amd.com
patch subject: [PATCH v2 2/4] drm: Add drm_get_acpi_edid() helper
config: x86_64-kismet-CONFIG_ACPI_PLATFORM_PROFILE-CONFIG_HP_WMI-0-0 (https://download.01.org/0day-ci/archive/20240131/202401311634.FE5CBVwe-lkp@intel.com/config)
reproduce: (https://download.01.org/0day-ci/archive/20240131/202401311634.FE5CBVwe-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401311634.FE5CBVwe-lkp@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for ACPI_PLATFORM_PROFILE when selected by HP_WMI
   .config:101:warning: symbol value 'n' invalid for RADIO_RTRACK2_PORT
   .config:223:warning: symbol value 'n' invalid for AIC79XX_CMDS_PER_DEVICE
   .config:240:warning: symbol value 'n' invalid for SATA_MOBILE_LPM_POLICY
   .config:310:warning: symbol value 'n' invalid for DRM_I915_TIMESLICE_DURATION
   .config:321:warning: symbol value 'n' invalid for PANEL_LCD_PIN_SDA
   .config:345:warning: symbol value 'n' invalid for PSTORE_BLK_MAX_REASON
   .config:457:warning: symbol value 'n' invalid for KFENCE_SAMPLE_INTERVAL
   .config:633:warning: symbol value 'n' invalid for CRYPTO_DEV_QCE_SW_MAX_LEN
   .config:651:warning: symbol value 'n' invalid for DRM_XE_JOB_TIMEOUT_MIN
   .config:674:warning: symbol value 'n' invalid for FB_GBE_MEM
   .config:739:warning: symbol value 'n' invalid for PANEL_LCD_CHARSET
   .config:836:warning: symbol value 'n' invalid for SND_AC97_POWER_SAVE_DEFAULT
   .config:851:warning: symbol value 'n' invalid for MAGIC_SYSRQ_DEFAULT_ENABLE
   .config:871:warning: symbol value 'n' invalid for DRM_I915_MAX_REQUEST_BUSYWAIT
   .config:900:warning: symbol value 'n' invalid for SND_AT73C213_TARGET_BITRATE
   .config:951:warning: symbol value 'n' invalid for DRM_XE_PREEMPT_TIMEOUT_MIN
   .config:961:warning: symbol value 'n' invalid for NET_EMATCH_STACK
   .config:962:warning: symbol value 'n' invalid for VMCP_CMA_SIZE
   .config:1002:warning: symbol value 'n' invalid for SQUASHFS_FRAGMENT_CACHE_SIZE
   .config:1113:warning: symbol value 'n' invalid for FB_OMAP2_NUM_FBS
   .config:1237:warning: symbol value 'n' invalid for MTDRAM_ERASE_SIZE
   .config:1253:warning: symbol value 'n' invalid for CFAG12864B_RATE
   .config:1290:warning: symbol value 'n' invalid for SERIAL_UARTLITE_NR_UARTS
   .config:1468:warning: symbol value 'n' invalid for LEGACY_PTY_COUNT
   .config:1528:warning: symbol value 'n' invalid for RAPIDIO_DISC_TIMEOUT
   .config:1568:warning: symbol value 'n' invalid for FAT_DEFAULT_CODEPAGE
   .config:1608:warning: symbol value 'n' invalid for WATCHDOG_OPEN_TIMEOUT
   .config:1615:warning: symbol value 'n' invalid for AIC7XXX_RESET_DELAY_MS
   .config:1638:warning: symbol value 'n' invalid for KCOV_IRQ_AREA_SIZE
   .config:1850:warning: symbol value 'n' invalid for IBM_EMAC_POLL_WEIGHT
   .config:1903:warning: symbol value 'n' invalid for DRM_I915_STOP_TIMEOUT
   .config:2189:warning: symbol value 'n' invalid for SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM
   .config:2246:warning: symbol value 'n' invalid for SND_HDA_PREALLOC_SIZE
   .config:2358:warning: symbol value 'n' invalid for DRM_XE_TIMESLICE_MAX
   .config:2452:warning: symbol value 'n' invalid for PANEL_LCD_BWIDTH
   .config:2554:warning: symbol value 'n' invalid for PSTORE_BLK_CONSOLE_SIZE
   .config:2701:warning: symbol value 'n' invalid for PANEL_PARPORT
   .config:2763:warning: symbol value 'n' invalid for BOOKE_WDT_DEFAULT_TIMEOUT
   .config:2798:warning: symbol value 'n' invalid for NOUVEAU_DEBUG_DEFAULT
   .config:2996:warning: symbol value 'n' invalid for KCSAN_REPORT_ONCE_IN_MS
   .config:3107:warning: symbol value 'n' invalid for KCSAN_UDELAY_INTERRUPT
   .config:3132:warning: symbol value 'n' invalid for PANEL_LCD_PIN_BL
   .config:3152:warning: symbol value 'n' invalid for DEBUG_OBJECTS_ENABLE_DEFAULT
   .config:3159:warning: symbol value 'n' invalid for INITRAMFS_ROOT_GID
   .config:3236:warning: symbol value 'n' invalid for PANEL_LCD_PIN_E
   .config:3278:warning: symbol value 'n' invalid for ATM_FORE200E_TX_RETRY
   .config:3321:warning: symbol value 'n' invalid for FB_OMAP2_DSS_MIN_FCK_PER_PCK
   .config:3414:warning: symbol value 'n' invalid for STACK_MAX_DEFAULT_SIZE_MB
   .config:3437:warning: symbol value 'n' invalid for KCSAN_UDELAY_TASK
   .config:3468:warning: symbol value 'n' invalid for BLK_DEV_LOOP_MIN_COUNT
   .config:3692:warning: symbol value 'n' invalid for MMC_BLOCK_MINORS
   .config:3695:warning: symbol value 'n' invalid for INET_TABLE_PERTURB_ORDER
   .config:3696:warning: symbol value 'n' invalid for CMA_SIZE_MBYTES
   .config:3739:warning: symbol value 'n' invalid for SCSI_NCR53C8XX_SYNC
   .config:3773:warning: symbol value 'n' invalid for SERIAL_MCF_BAUDRATE
   .config:3870:warning: symbol value 'n' invalid for DE2104X_DSL
   .config:3887:warning: symbol value 'n' invalid for BLK_DEV_RAM_COUNT
   .config:3963:warning: symbol value 'n' invalid for AIC7XXX_DEBUG_MASK
   .config:4102:warning: symbol value 'n' invalid for IP_VS_SH_TAB_BITS
   .config:4257:warning: symbol value 'n' invalid for USBIP_VHCI_HC_PORTS
   .config:4296:warning: symbol value 'n' invalid for AIC79XX_RESET_DELAY_MS
   .config:4599:warning: symbol value 'n' invalid for RIONET_RX_SIZE
   .config:4610:warning: symbol value 'n' invalid for RADIO_TYPHOON_PORT
   .config:4730:warning: symbol value 'n' invalid for SERIAL_TXX9_NR_UARTS
   .config:4819:warning: symbol value 'n' invalid for MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
   .config:4918:warning: symbol value 'n' invalid for IBM_EMAC_TXB
   .config:5343:warning: symbol value 'n' invalid for CRYPTO_DEV_FSL_CAAM_INTC_TIME_THLD
   .config:5415:warning: symbol value 'n' invalid for DRM_I915_FENCE_TIMEOUT
   .config:5437:warning: symbol value 'n' invalid for TTY_PRINTK_LEVEL
   .config:5601:warning: symbol value 'n' invalid for MIPS_EJTAG_FDC_KGDB_CHAN
   .config:5609:warning: symbol value 'n' invalid for PPC_EARLY_DEBUG_EHV_BC_HANDLE
   .config:5700:warning: symbol value 'n' invalid for KDB_DEFAULT_ENABLE
   .config:5718:warning: symbol value 'n' invalid for SERIAL_ALTERA_UART_MAXPORTS
   .config:5871:warning: symbol value 'n' invalid for FTRACE_RECORD_RECURSION_SIZE
   .config:5992:warning: symbol value 'n' invalid for PANEL_LCD_HWIDTH
   .config:6028:warning: symbol value 'n' invalid for LOCKDEP_CHAINS_BITS
   .config:6121:warning: symbol value 'n' invalid for DRM_I915_HEARTBEAT_INTERVAL
   .config:6130:warning: symbol value 'n' invalid for KCSAN_SKIP_WATCH
   .config:6140:warning: symbol value 'n' invalid for EFI_MAX_FAKE_MEM
   .config:6156:warning: symbol value 'n' invalid for PSTORE_BLK_KMSG_SIZE
   .config:6336:warning: symbol value 'n' invalid for KVM_MAX_NR_VCPUS
   .config:6443:warning: symbol value 'n' invalid for SERIAL_SH_SCI_NR_UARTS
   .config:6483:warning: symbol value 'n' invalid for IP_VS_MH_TAB_INDEX
   .config:6485:warning: symbol value 'n' invalid for ARCH_MMAP_RND_COMPAT_BITS
   .config:6661:warning: symbol value 'n' invalid for RADIO_TRUST_PORT
   .config:6684:warning: symbol value 'n' invalid for X86_AMD_PSTATE_DEFAULT_MODE
   .config:6771:warning: symbol value 'n' invalid for ZSMALLOC_CHAIN_SIZE
   .config:6867:warning: symbol value 'n' invalid for PANEL_LCD_PIN_RW
   .config:6978:warning: symbol value 'n' invalid for SCSI_NCR53C8XX_MAX_TAGS
   .config:7002:warning: symbol value 'n' invalid for SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
   .config:7041:warning: symbol value 'n' invalid for SERIAL_ALTERA_UART_BAUDRATE
   .config:7080:warning: symbol value 'n' invalid for CMA_SIZE_PERCENTAGE
   .config:7091:warning: symbol value 'n' invalid for LOCKDEP_BITS
   .config:7236:warning: symbol value 'n' invalid for DRM_XE_TIMESLICE_MIN
   .config:7398:warning: symbol value 'n' invalid for SND_MAX_CARDS
   .config:7400:warning: symbol value 'n' invalid for IBM_EMAC_RXB
   .config:7745:warning: symbol value 'n' invalid for SERIAL_ARC_NR_PORTS
   .config:7808:warning: symbol value 'n' invalid for PANEL_LCD
   .config:7916:warning: symbol value 'n' invalid for DRM_XE_PREEMPT_TIMEOUT_MAX
   .config:7917:warning: symbol value 'n' invalid for SCSI_MPT3SAS_MAX_SGE
kernel test robot Jan. 31, 2024, 9:34 a.m. UTC | #3
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/acpi-bus linus/master v6.8-rc2 next-20240131]
[cannot apply to drm-misc/drm-misc-next rafael-pm/devprop]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-video-Handle-fetching-EDID-that-is-longer-than-256-bytes/20240131-032909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20240130192608.11666-3-mario.limonciello%40amd.com
patch subject: [PATCH v2 2/4] drm: Add drm_get_acpi_edid() helper
config: i386-buildonly-randconfig-001-20240131 (https://download.01.org/0day-ci/archive/20240131/202401311759.htfj4nbl-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240131/202401311759.htfj4nbl-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401311759.htfj4nbl-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/acpi/acpi_video.c:642:44: warning: format specifies type 'long' but the argument has type 'ssize_t' (aka 'int') [-Wformat]
     642 |                                  "Invalid _DDC data for length %ld\n", length);
         |                                                                ~~~     ^~~~~~
         |                                                                %zd
   include/linux/acpi.h:1219:30: note: expanded from macro 'acpi_handle_debug'
    1219 |                            handle, pr_fmt(fmt), ##__VA_ARGS__)
         |                                           ~~~     ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |                                                                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |                                                                        ^~~~~~~~~~~
   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   1 warning generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for ACPI_WMI
   Depends on [n]: X86_PLATFORM_DEVICES [=n] && ACPI [=y]
   Selected by [y]:
   - DRM [=y] && HAS_IOMEM [=y] && (AGP [=n] || AGP [=n]=n) && !EMULATED_CMPXCHG && HAS_DMA [=y] && X86 [=y]


vim +642 drivers/acpi/acpi_video.c

^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  612  
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  613  static int
4be44fcd3bf648 drivers/acpi/video.c      Len Brown         2005-08-05  614  acpi_video_device_EDID(struct acpi_video_device *device,
4be44fcd3bf648 drivers/acpi/video.c      Len Brown         2005-08-05  615  		       union acpi_object **edid, ssize_t length)
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  616  {
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  617  	int status;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  618  	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  619  	union acpi_object *obj;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  620  	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  621  	struct acpi_object_list args = { 1, &arg0 };
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  622  
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  623  
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  624  	*edid = NULL;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  625  
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  626  	if (!device)
d550d98d331737 drivers/acpi/video.c      Patrick Mochel    2006-06-27  627  		return -ENODEV;
25f97b27045655 drivers/acpi/acpi_video.c Mario Limonciello 2024-01-30  628  	if (!length || (length % 128))
d550d98d331737 drivers/acpi/video.c      Patrick Mochel    2006-06-27  629  		return -EINVAL;
25f97b27045655 drivers/acpi/acpi_video.c Mario Limonciello 2024-01-30  630  	arg0.integer.value = length / 128;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  631  
901302688cb85b drivers/acpi/video.c      Patrick Mochel    2006-05-19  632  	status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  633  	if (ACPI_FAILURE(status))
d550d98d331737 drivers/acpi/video.c      Patrick Mochel    2006-06-27  634  		return -ENODEV;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  635  
50dd096973f1d9 drivers/acpi/video.c      Jan Engelhardt    2006-10-01  636  	obj = buffer.pointer;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  637  
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  638  	if (obj && obj->type == ACPI_TYPE_BUFFER)
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  639  		*edid = obj;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  640  	else {
25f97b27045655 drivers/acpi/acpi_video.c Mario Limonciello 2024-01-30  641  		acpi_handle_debug(device->dev->handle,
25f97b27045655 drivers/acpi/acpi_video.c Mario Limonciello 2024-01-30 @642  				 "Invalid _DDC data for length %ld\n", length);
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  643  		status = -EFAULT;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  644  		kfree(obj);
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  645  	}
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  646  
d550d98d331737 drivers/acpi/video.c      Patrick Mochel    2006-06-27  647  	return status;
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  648  }
^1da177e4c3f41 drivers/acpi/video.c      Linus Torvalds    2005-04-16  649
kernel test robot Jan. 31, 2024, 10:37 a.m. UTC | #4
Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/acpi-bus linus/master v6.8-rc2 next-20240131]
[cannot apply to drm-misc/drm-misc-next rafael-pm/devprop]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-video-Handle-fetching-EDID-that-is-longer-than-256-bytes/20240131-032909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20240130192608.11666-3-mario.limonciello%40amd.com
patch subject: [PATCH v2 2/4] drm: Add drm_get_acpi_edid() helper
config: i386-buildonly-randconfig-003-20240131 (https://download.01.org/0day-ci/archive/20240131/202401311847.XFZpEOk4-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240131/202401311847.XFZpEOk4-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401311847.XFZpEOk4-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> drivers/platform/x86/wmi.c:68:2: error: unknown type name 'wmi_notify_handler'; did you mean 'acpi_notify_handler'?
      68 |         wmi_notify_handler handler;
         |         ^~~~~~~~~~~~~~~~~~
         |         acpi_notify_handler
   include/acpi/actypes.h:1061:8: note: 'acpi_notify_handler' declared here
    1061 | void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
         |        ^
>> drivers/platform/x86/wmi.c:163:30: error: incomplete definition of type 'struct acpi_device'
     163 |         handle = wblock->acpi_device->handle;
         |                  ~~~~~~~~~~~~~~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
>> drivers/platform/x86/wmi.c:166:11: error: call to undeclared function 'acpi_execute_simple_method'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     166 |         status = acpi_execute_simple_method(handle, method, enable);
         |                  ^
   drivers/platform/x86/wmi.c:166:11: note: did you mean 'acpi_execute_reg_methods'?
   include/acpi/acpixf.h:662:8: note: 'acpi_execute_reg_methods' declared here
     662 |                             acpi_execute_reg_methods(acpi_handle device,
         |                             ^
   include/acpi/platform/aclinux.h:93:21: note: expanded from macro 'ACPI_EXTERNAL_RETURN_STATUS'
      93 |         static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
         |                            ^
   drivers/platform/x86/wmi.c:210:49: error: incomplete definition of type 'struct acpi_device'
     210 |         return acpi_evaluate_object(wblock->acpi_device->handle, "_WED", &input, out);
         |                                     ~~~~~~~~~~~~~~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
>> drivers/platform/x86/wmi.c:282:5: warning: no previous prototype for function 'wmi_instance_count' [-Wmissing-prototypes]
     282 | int wmi_instance_count(const char *guid_string)
         |     ^
   drivers/platform/x86/wmi.c:282:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     282 | int wmi_instance_count(const char *guid_string)
         | ^
         | static 
>> drivers/platform/x86/wmi.c:326:13: warning: no previous prototype for function 'wmi_evaluate_method' [-Wmissing-prototypes]
     326 | acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, u32 method_id,
         |             ^
   drivers/platform/x86/wmi.c:326:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     326 | acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, u32 method_id,
         | ^
         | static 
   drivers/platform/x86/wmi.c:368:30: error: incomplete definition of type 'struct acpi_device'
     368 |         handle = wblock->acpi_device->handle;
         |                  ~~~~~~~~~~~~~~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
   drivers/platform/x86/wmi.c:412:30: error: incomplete definition of type 'struct acpi_device'
     412 |         handle = wblock->acpi_device->handle;
         |                  ~~~~~~~~~~~~~~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
   drivers/platform/x86/wmi.c:441:15: error: call to undeclared function 'acpi_execute_simple_method'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     441 |                 wc_status = acpi_execute_simple_method(handle, wc_method, 1);
         |                             ^
   drivers/platform/x86/wmi.c:459:3: error: call to undeclared function 'acpi_execute_simple_method'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     459 |                 acpi_execute_simple_method(handle, wc_method, 0);
         |                 ^
>> drivers/platform/x86/wmi.c:475:13: warning: no previous prototype for function 'wmi_query_block' [-Wmissing-prototypes]
     475 | acpi_status wmi_query_block(const char *guid_string, u8 instance,
         |             ^
   drivers/platform/x86/wmi.c:475:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     475 | acpi_status wmi_query_block(const char *guid_string, u8 instance,
         | ^
         | static 
>> drivers/platform/x86/wmi.c:526:13: warning: no previous prototype for function 'wmi_set_block' [-Wmissing-prototypes]
     526 | acpi_status wmi_set_block(const char *guid_string, u8 instance, const struct acpi_buffer *in)
         |             ^
   drivers/platform/x86/wmi.c:526:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     526 | acpi_status wmi_set_block(const char *guid_string, u8 instance, const struct acpi_buffer *in)
         | ^
         | static 
   drivers/platform/x86/wmi.c:555:42: error: incomplete definition of type 'struct acpi_device'
     555 |         acpi_handle handle = wblock->acpi_device->handle;
         |                              ~~~~~~~~~~~~~~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
   drivers/platform/x86/wmi.c:596:12: error: unknown type name 'wmi_notify_handler'; did you mean 'acpi_notify_handler'?
     596 |                                        wmi_notify_handler handler,
         |                                        ^~~~~~~~~~~~~~~~~~
         |                                        acpi_notify_handler
   include/acpi/actypes.h:1061:8: note: 'acpi_notify_handler' declared here
    1061 | void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
         |        ^
>> drivers/platform/x86/wmi.c:595:13: warning: no previous prototype for function 'wmi_install_notify_handler' [-Wmissing-prototypes]
     595 | acpi_status wmi_install_notify_handler(const char *guid,
         |             ^
   drivers/platform/x86/wmi.c:595:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     595 | acpi_status wmi_install_notify_handler(const char *guid,
         | ^
         | static 
>> drivers/platform/x86/wmi.c:637:13: warning: no previous prototype for function 'wmi_remove_notify_handler' [-Wmissing-prototypes]
     637 | acpi_status wmi_remove_notify_handler(const char *guid)
         |             ^
   drivers/platform/x86/wmi.c:637:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     637 | acpi_status wmi_remove_notify_handler(const char *guid)
         | ^
         | static 
>> drivers/platform/x86/wmi.c:679:13: warning: no previous prototype for function 'wmi_get_event_data' [-Wmissing-prototypes]
     679 | acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
         |             ^
   drivers/platform/x86/wmi.c:679:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     679 | acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
         | ^
         | static 
>> drivers/platform/x86/wmi.c:706:6: warning: no previous prototype for function 'wmi_has_guid' [-Wmissing-prototypes]
     706 | bool wmi_has_guid(const char *guid_string)
         |      ^
   drivers/platform/x86/wmi.c:706:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     706 | bool wmi_has_guid(const char *guid_string)
         | ^
         | static 
>> drivers/platform/x86/wmi.c:739:8: error: call to undeclared function 'acpi_device_uid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     739 |         uid = acpi_device_uid(wblock->acpi_device);
         |               ^
>> drivers/platform/x86/wmi.c:739:6: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
     739 |         uid = acpi_device_uid(wblock->acpi_device);
         |             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/platform/x86/wmi.c:728:7: warning: no previous prototype for function 'wmi_get_acpi_device_uid' [-Wmissing-prototypes]
     728 | char *wmi_get_acpi_device_uid(const char *guid_string)
         |       ^
   drivers/platform/x86/wmi.c:728:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     728 | char *wmi_get_acpi_device_uid(const char *guid_string)
         | ^
         | static 
   drivers/platform/x86/wmi.c:1003:33: error: incomplete definition of type 'struct acpi_device'
    1003 |         result = get_subobj_info(device->handle, method, &info);
         |                                  ~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
>> drivers/platform/x86/wmi.c:1030:6: error: call to undeclared function 'acpi_has_method'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1030 |         if (acpi_has_method(device->handle, method))
         |             ^
   drivers/platform/x86/wmi.c:1030:6: note: did you mean 'acpi_has_watchdog'?
   include/linux/acpi.h:1445:20: note: 'acpi_has_watchdog' declared here
    1445 | static inline bool acpi_has_watchdog(void) { return false; }
         |                    ^
   drivers/platform/x86/wmi.c:1030:28: error: incomplete definition of type 'struct acpi_device'
    1030 |         if (acpi_has_method(device->handle, method))
         |                             ~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
   drivers/platform/x86/wmi.c:1087:20: error: incomplete definition of type 'struct acpi_device'
    1087 |                         dev_warn(&device->dev, "duplicate WMI GUID %pUL (first instance was on %s)\n",
         |                                   ~~~~~~^
   include/linux/dev_printk.h:146:49: note: expanded from macro 'dev_warn'
     146 |         dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~
   include/linux/dev_printk.h:110:11: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
   drivers/platform/x86/wmi.c:1088:41: error: incomplete definition of type 'struct acpi_device'
    1088 |                                  guid, dev_name(&wblock->acpi_device->dev));
         |                                                  ~~~~~~~~~~~~~~~~~~~^
   include/linux/dev_printk.h:146:70: note: expanded from macro 'dev_warn'
     146 |         dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                             ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                                     ^~~~~~~~~~~
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
   drivers/platform/x86/wmi.c:1110:38: error: incomplete definition of type 'struct acpi_device'
    1110 |         status = acpi_evaluate_object(device->handle, "_WDG", NULL, &out);
         |                                       ~~~~~~^
   include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device'
     795 | struct acpi_device;
         |        ^
>> drivers/platform/x86/wmi.c:1189:12: error: call to undeclared function 'ec_read'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1189 |                 result = ec_read(address, &temp);
         |                          ^
   drivers/platform/x86/wmi.c:1189:12: note: did you mean 'up_read'?
   include/linux/rwsem.h:198:13: note: 'up_read' declared here
     198 | extern void up_read(struct rw_semaphore *sem);
         |             ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   9 warnings and 20 errors generated.
--
>> drivers/platform/x86/dell/dell-wmi-led.c:71:11: error: call to undeclared function 'wmi_evaluate_method'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      71 |         status = wmi_evaluate_method(DELL_LED_BIOS_GUID, 0, 1, &input, &output);
         |                  ^
>> drivers/platform/x86/dell/dell-wmi-led.c:168:7: error: call to undeclared function 'wmi_has_guid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     168 |         if (!wmi_has_guid(DELL_LED_BIOS_GUID))
         |              ^
   2 errors generated.
--
>> drivers/platform/x86/dell/dell-wmi-aio.c:80:11: error: call to undeclared function 'wmi_get_event_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      80 |         status = wmi_get_event_data(value, &response);
         |                  ^
>> drivers/platform/x86/dell/dell-wmi-aio.c:156:7: error: call to undeclared function 'wmi_has_guid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     156 |                 if (wmi_has_guid(dell_wmi_aio_guids[i]))
         |                     ^
>> drivers/platform/x86/dell/dell-wmi-aio.c:177:8: error: call to undeclared function 'wmi_install_notify_handler'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     177 |         err = wmi_install_notify_handler(guid, dell_wmi_aio_notify, NULL);
         |               ^
   drivers/platform/x86/dell/dell-wmi-aio.c:177:8: note: did you mean 'acpi_install_notify_handler'?
   include/acpi/acpixf.h:635:8: note: 'acpi_install_notify_handler' declared here
     635 |                             acpi_install_notify_handler(acpi_handle device,
         |                             ^
   include/acpi/platform/aclinux.h:93:21: note: expanded from macro 'ACPI_EXTERNAL_RETURN_STATUS'
      93 |         static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
         |                            ^
>> drivers/platform/x86/dell/dell-wmi-aio.c:192:2: error: call to undeclared function 'wmi_remove_notify_handler'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     192 |         wmi_remove_notify_handler(guid);
         |         ^
   drivers/platform/x86/dell/dell-wmi-aio.c:192:2: note: did you mean 'acpi_remove_notify_handler'?
   include/acpi/acpixf.h:641:8: note: 'acpi_remove_notify_handler' declared here
     641 |                             acpi_remove_notify_handler(acpi_handle device,
         |                             ^
   include/acpi/platform/aclinux.h:93:21: note: expanded from macro 'ACPI_EXTERNAL_RETURN_STATUS'
      93 |         static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
         |                            ^
   4 errors generated.
--
>> drivers/platform/x86/dell/dell-wmi-descriptor.c:30:7: error: call to undeclared function 'wmi_has_guid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      30 |         if (!wmi_has_guid(DELL_WMI_DESCRIPTOR_GUID))
         |              ^
   1 error generated.
--
>> drivers/platform/x86/dell/dell-wmi-sysman/sysman.c:295:11: error: call to undeclared function 'wmi_query_block'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     295 |         status = wmi_query_block(guid_string, instance_id, &out);
         |                  ^
>> drivers/platform/x86/dell/dell-wmi-sysman/sysman.c:308:8: error: call to undeclared function 'wmi_instance_count'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     308 |         ret = wmi_instance_count(guid_string);
         |               ^
   2 errors generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for ACPI_WMI
   Depends on [n]: X86_PLATFORM_DEVICES [=y] && ACPI [=n]
   Selected by [y]:
   - DRM [=y] && HAS_IOMEM [=y] && (AGP [=n] || AGP [=n]=n) && !EMULATED_CMPXCHG && HAS_DMA [=y] && X86 [=y]


vim +163 drivers/platform/x86/wmi.c

a90b38c5866714 drivers/platform/x86/wmi.c Hans de Goede     2021-11-28   61  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   62  struct wmi_block {
844af950da946c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-24   63  	struct wmi_device dev;
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   64  	struct list_head list;
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   65  	struct guid_block gblock;
b0e86302973d9e drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-24   66  	struct acpi_device *acpi_device;
29e473f4b51ee5 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03   67  	struct rw_semaphore notify_lock;	/* Protects notify callback add/remove */
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  @68  	wmi_notify_handler handler;
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   69  	void *handler_data;
29e473f4b51ee5 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03   70  	bool driver_ready;
a90b38c5866714 drivers/platform/x86/wmi.c Hans de Goede     2021-11-28   71  	unsigned long flags;
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   72  };
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   73  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   74  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   75  /*
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   76   * If the GUID data block is marked as expensive, we must enable and
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   77   * explicitily disable data collection.
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   78   */
1c95ace78b6e8e drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04   79  #define ACPI_WMI_EXPENSIVE   BIT(0)
1c95ace78b6e8e drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04   80  #define ACPI_WMI_METHOD      BIT(1)	/* GUID is a method */
1c95ace78b6e8e drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04   81  #define ACPI_WMI_STRING      BIT(2)	/* GUID takes & returns a string */
1c95ace78b6e8e drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04   82  #define ACPI_WMI_EVENT       BIT(3)	/* GUID is an event */
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   83  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   84  static const struct acpi_device_id wmi_device_ids[] = {
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   85  	{"PNP0C14", 0},
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   86  	{"pnp0c14", 0},
9bf9ca95a16e0b drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04   87  	{ }
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   88  };
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   89  MODULE_DEVICE_TABLE(acpi, wmi_device_ids);
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05   90  
134038b075cb1d drivers/platform/x86/wmi.c Mario Limonciello 2022-08-29   91  /* allow duplicate GUIDs as these device drivers use struct wmi_driver */
134038b075cb1d drivers/platform/x86/wmi.c Mario Limonciello 2022-08-29   92  static const char * const allow_duplicates[] = {
134038b075cb1d drivers/platform/x86/wmi.c Mario Limonciello 2022-08-29   93  	"05901221-D566-11D1-B2F0-00A0C9062910",	/* wmi-bmof */
a77272c1604186 drivers/platform/x86/wmi.c Armin Wolf        2022-09-27   94  	"8A42EA14-4F2A-FD45-6422-0087F7A7E608",	/* dell-wmi-ddv */
75c487fcb69c98 drivers/platform/x86/wmi.c Armin Wolf        2023-11-03   95  	"44FADEB1-B204-40F2-8581-394BBDC1B651",	/* intel-wmi-sbl-fw-update */
2340f12023efa7 drivers/platform/x86/wmi.c Armin Wolf        2023-11-03   96  	"86CCFD48-205E-4A77-9C48-2021CBEDE341",	/* intel-wmi-thunderbolt */
b7a4706f66e5df drivers/platform/x86/wmi.c Armin Wolf        2023-11-23   97  	"F1DDEE52-063C-4784-A11E-8A06684B9B01",	/* dell-smm-hwmon */
134038b075cb1d drivers/platform/x86/wmi.c Mario Limonciello 2022-08-29   98  	NULL
134038b075cb1d drivers/platform/x86/wmi.c Mario Limonciello 2022-08-29   99  };
134038b075cb1d drivers/platform/x86/wmi.c Mario Limonciello 2022-08-29  100  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  101  #define dev_to_wblock(__dev)	container_of_const(__dev, struct wmi_block, dev.dev)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  102  #define dev_to_wdev(__dev)	container_of_const(__dev, struct wmi_device, dev)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  103  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  104  /*
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  105   * GUID parsing functions
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  106   */
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  107  
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  108  static bool guid_parse_and_compare(const char *string, const guid_t *guid)
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  109  {
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  110  	guid_t guid_input;
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  111  
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  112  	if (guid_parse(string, &guid_input))
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  113  		return false;
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  114  
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  115  	return guid_equal(&guid_input, guid);
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  116  }
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  117  
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  118  static const void *find_guid_context(struct wmi_block *wblock,
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  119  				     struct wmi_driver *wdriver)
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  120  {
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  121  	const struct wmi_device_id *id;
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  122  
6e0bc588a0842d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  123  	id = wdriver->id_table;
6e0bc588a0842d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  124  	if (!id)
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  125  		return NULL;
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  126  
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  127  	while (*id->guid_string) {
028e6e204ace1f drivers/platform/x86/wmi.c Andy Shevchenko   2023-06-21  128  		if (guid_parse_and_compare(id->guid_string, &wblock->gblock.guid))
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  129  			return id->context;
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  130  		id++;
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  131  	}
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  132  	return NULL;
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  133  }
a48e23385fcf39 drivers/platform/x86/wmi.c Mattias Jacobsson 2019-05-27  134  
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  135  static int get_subobj_info(acpi_handle handle, const char *pathname,
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  136  			   struct acpi_device_info **info)
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  137  {
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  138  	acpi_handle subobj_handle;
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  139  	acpi_status status;
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  140  
bd142914f805b8 drivers/platform/x86/wmi.c Armin Wolf        2023-12-18  141  	status = acpi_get_handle(handle, pathname, &subobj_handle);
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  142  	if (status == AE_NOT_FOUND)
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  143  		return -ENOENT;
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  144  
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  145  	if (ACPI_FAILURE(status))
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  146  		return -EIO;
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  147  
bd142914f805b8 drivers/platform/x86/wmi.c Armin Wolf        2023-12-18  148  	status = acpi_get_object_info(subobj_handle, info);
bd142914f805b8 drivers/platform/x86/wmi.c Armin Wolf        2023-12-18  149  	if (ACPI_FAILURE(status))
bd142914f805b8 drivers/platform/x86/wmi.c Armin Wolf        2023-12-18  150  		return -EIO;
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  151  
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  152  	return 0;
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  153  }
d4fc91adfde11c drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-25  154  
285dd01a6cfeb4 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  155  static acpi_status wmi_method_enable(struct wmi_block *wblock, bool enable)
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  156  {
43aacf838ef738 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  157  	struct guid_block *block;
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  158  	char method[5];
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  159  	acpi_status status;
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  160  	acpi_handle handle;
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  161  
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  162  	block = &wblock->gblock;
b0e86302973d9e drivers/platform/x86/wmi.c Andy Lutomirski   2015-11-24 @163  	handle = wblock->acpi_device->handle;
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  164  
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  165  	snprintf(method, 5, "WE%02X", block->notify_id);
8122ab66b12967 drivers/platform/x86/wmi.c Zhang Rui         2013-09-03 @166  	status = acpi_execute_simple_method(handle, method, enable);
736b48aae5e83b drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  167  	if (status == AE_NOT_FOUND)
736b48aae5e83b drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  168  		return AE_OK;
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  169  
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  170  	return status;
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  171  }
a66bfa7a4726e9 drivers/acpi/wmi.c         Matthew Garrett   2008-10-08  172  
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  173  #define WMI_ACPI_METHOD_NAME_SIZE 5
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  174  
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  175  static inline void get_acpi_method_name(const struct wmi_block *wblock,
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  176  					const char method,
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  177  					char buffer[static WMI_ACPI_METHOD_NAME_SIZE])
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  178  {
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  179  	static_assert(ARRAY_SIZE(wblock->gblock.object_id) == 2);
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  180  	static_assert(WMI_ACPI_METHOD_NAME_SIZE >= 5);
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  181  
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  182  	buffer[0] = 'W';
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  183  	buffer[1] = method;
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  184  	buffer[2] = wblock->gblock.object_id[0];
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  185  	buffer[3] = wblock->gblock.object_id[1];
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  186  	buffer[4] = '\0';
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  187  }
57f2ce89211383 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  188  
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  189  static inline acpi_object_type get_param_acpi_type(const struct wmi_block *wblock)
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  190  {
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  191  	if (wblock->gblock.flags & ACPI_WMI_STRING)
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  192  		return ACPI_TYPE_STRING;
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  193  	else
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  194  		return ACPI_TYPE_BUFFER;
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  195  }
51142a0886bd34 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  196  
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  197  static acpi_status get_event_data(const struct wmi_block *wblock, struct acpi_buffer *out)
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  198  {
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  199  	union acpi_object param = {
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  200  		.integer = {
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  201  			.type = ACPI_TYPE_INTEGER,
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  202  			.value = wblock->gblock.notify_id,
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  203  		}
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  204  	};
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  205  	struct acpi_object_list input = {
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  206  		.count = 1,
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  207  		.pointer = &param,
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  208  	};
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  209  
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  210  	return acpi_evaluate_object(wblock->acpi_device->handle, "_WED", &input, out);
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  211  }
25be44f6e2fc9d drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  212  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  213  static int wmidev_match_guid(struct device *dev, const void *data)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  214  {
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  215  	struct wmi_block *wblock = dev_to_wblock(dev);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  216  	const guid_t *guid = data;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  217  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  218  	if (guid_equal(guid, &wblock->gblock.guid))
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  219  		return 1;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  220  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  221  	return 0;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  222  }
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  223  
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  224  static int wmidev_match_notify_id(struct device *dev, const void *data)
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  225  {
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  226  	struct wmi_block *wblock = dev_to_wblock(dev);
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  227  	const u32 *notify_id = data;
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  228  
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  229  	if (wblock->gblock.flags & ACPI_WMI_EVENT && wblock->gblock.notify_id == *notify_id)
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  230  		return 1;
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  231  
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  232  	return 0;
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  233  }
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  234  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  235  static struct bus_type wmi_bus_type;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  236  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  237  static struct wmi_device *wmi_find_device_by_guid(const char *guid_string)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  238  {
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  239  	struct device *dev;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  240  	guid_t guid;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  241  	int ret;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  242  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  243  	ret = guid_parse(guid_string, &guid);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  244  	if (ret < 0)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  245  		return ERR_PTR(ret);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  246  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  247  	dev = bus_find_device(&wmi_bus_type, NULL, &guid, wmidev_match_guid);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  248  	if (!dev)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  249  		return ERR_PTR(-ENODEV);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  250  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  251  	return dev_to_wdev(dev);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  252  }
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  253  
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  254  static struct wmi_device *wmi_find_event_by_notify_id(const u32 notify_id)
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  255  {
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  256  	struct device *dev;
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  257  
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  258  	dev = bus_find_device(&wmi_bus_type, NULL, &notify_id, wmidev_match_notify_id);
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  259  	if (!dev)
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  260  		return ERR_PTR(-ENODEV);
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  261  
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  262  	return to_wmi_device(dev);
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  263  }
3ea7f59af8ffa1 drivers/platform/x86/wmi.c Armin Wolf        2024-01-03  264  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  265  static void wmi_device_put(struct wmi_device *wdev)
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  266  {
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  267  	put_device(&wdev->dev);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  268  }
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  269  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  270  /*
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  271   * Exported WMI functions
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  272   */
44b6b7661132b1 drivers/platform/x86/wmi.c Mario Limonciello 2017-11-01  273  
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  274  /**
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  275   * wmi_instance_count - Get number of WMI object instances
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  276   * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  277   *
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  278   * Get the number of WMI object instances.
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  279   *
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  280   * Returns: Number of WMI object instances or negative error code.
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  281   */
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30 @282  int wmi_instance_count(const char *guid_string)
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  283  {
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  284  	struct wmi_device *wdev;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  285  	int ret;
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  286  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  287  	wdev = wmi_find_device_by_guid(guid_string);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  288  	if (IS_ERR(wdev))
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  289  		return PTR_ERR(wdev);
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  290  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  291  	ret = wmidev_instance_count(wdev);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  292  	wmi_device_put(wdev);
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  293  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  294  	return ret;
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  295  }
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  296  EXPORT_SYMBOL_GPL(wmi_instance_count);
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  297  
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  298  /**
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  299   * wmidev_instance_count - Get number of WMI object instances
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  300   * @wdev: A wmi bus device from a driver
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  301   *
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  302   * Get the number of WMI object instances.
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  303   *
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  304   * Returns: Number of WMI object instances.
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  305   */
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  306  u8 wmidev_instance_count(struct wmi_device *wdev)
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  307  {
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  308  	struct wmi_block *wblock = container_of(wdev, struct wmi_block, dev);
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  309  
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  310  	return wblock->gblock.instance_count;
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  311  }
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  312  EXPORT_SYMBOL_GPL(wmidev_instance_count);
2a2b13ae50cf70 drivers/platform/x86/wmi.c Armin Wolf        2023-04-30  313  
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  314  /**
d54bd4bc7b9ae9 drivers/platform/x86/wmi.c Armin Wolf        2023-04-25  315   * wmi_evaluate_method - Evaluate a WMI method (deprecated)
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  316   * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  317   * @instance: Instance index
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  318   * @method_id: Method ID to call
5a707af10da95a drivers/platform/x86/wmi.c Andy Shevchenko   2017-04-21  319   * @in: Buffer containing input for the method call
5a707af10da95a drivers/platform/x86/wmi.c Andy Shevchenko   2017-04-21  320   * @out: Empty buffer to return the method results
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  321   *
b4cc979588ee94 drivers/platform/x86/wmi.c Armin Wolf        2023-04-25  322   * Call an ACPI-WMI method, the caller must free @out.
b4cc979588ee94 drivers/platform/x86/wmi.c Armin Wolf        2023-04-25  323   *
b4cc979588ee94 drivers/platform/x86/wmi.c Armin Wolf        2023-04-25  324   * Return: acpi_status signaling success or error.
bff431e49ff531 drivers/acpi/wmi.c         Carlos Corbacho   2008-02-05  325   */
bba08f358f7930 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04 @326  acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, u32 method_id,
bba08f358f7930 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  327  				const struct acpi_buffer *in, struct acpi_buffer *out)
722c856d46c6ca drivers/platform/x86/wmi.c Mario Limonciello 2017-11-01  328  {
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  329  	struct wmi_device *wdev;
b0179b805eed10 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  330  	acpi_status status;
b0179b805eed10 drivers/platform/x86/wmi.c Barnabás Pőcze    2021-09-04  331  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  332  	wdev = wmi_find_device_by_guid(guid_string);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  333  	if (IS_ERR(wdev))
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  334  		return AE_ERROR;
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  335  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  336  	status = wmidev_evaluate_method(wdev, instance, method_id, in, out);
722c856d46c6ca drivers/platform/x86/wmi.c Mario Limonciello 2017-11-01  337  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  338  	wmi_device_put(wdev);
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  339  
7444f8347487df drivers/platform/x86/wmi.c Armin Wolf        2023-10-20  340  	return status;
722c856d46c6ca drivers/platform/x86/wmi.c Mario Limonciello 2017-11-01  341  }
722c856d46c6ca drivers/platform/x86/wmi.c Mario Limonciello 2017-11-01  342  EXPORT_SYMBOL_GPL(wmi_evaluate_method);
722c856d46c6ca drivers/platform/x86/wmi.c Mario Limonciello 2017-11-01  343
kernel test robot Jan. 31, 2024, 3 p.m. UTC | #5
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/acpi-bus linus/master v6.8-rc2 next-20240131]
[cannot apply to drm-misc/drm-misc-next rafael-pm/devprop]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-video-Handle-fetching-EDID-that-is-longer-than-256-bytes/20240131-032909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20240130192608.11666-3-mario.limonciello%40amd.com
patch subject: [PATCH v2 2/4] drm: Add drm_get_acpi_edid() helper
config: x86_64-kismet-CONFIG_ACPI_WMI-CONFIG_DRM-0-0 (https://download.01.org/0day-ci/archive/20240131/202401312256.jBAoMFd9-lkp@intel.com/config)
reproduce: (https://download.01.org/0day-ci/archive/20240131/202401312256.jBAoMFd9-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401312256.jBAoMFd9-lkp@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for ACPI_WMI when selected by DRM
   .config:248:warning: symbol value 'n' invalid for AIC79XX_CMDS_PER_DEVICE
   .config:250:warning: symbol value 'n' invalid for SATA_MOBILE_LPM_POLICY
   .config:308:warning: symbol value 'n' invalid for SQUASHFS_FRAGMENT_CACHE_SIZE
   .config:333:warning: symbol value 'n' invalid for PANEL_LCD_PIN_SDA
   .config:356:warning: symbol value 'n' invalid for PSTORE_BLK_MAX_REASON
   .config:414:warning: symbol value 'n' invalid for FB_OMAP2_NUM_FBS
   .config:459:warning: symbol value 'n' invalid for KFENCE_SAMPLE_INTERVAL
   .config:543:warning: symbol value 'n' invalid for CFAG12864B_RATE
   .config:651:warning: symbol value 'n' invalid for CRYPTO_DEV_QCE_SW_MAX_LEN
   .config:665:warning: symbol value 'n' invalid for BLK_DEV_LOOP_MIN_COUNT
   .config:756:warning: symbol value 'n' invalid for PANEL_LCD_CHARSET
   .config:840:warning: symbol value 'n' invalid for SND_AC97_POWER_SAVE_DEFAULT
   .config:855:warning: symbol value 'n' invalid for MAGIC_SYSRQ_DEFAULT_ENABLE
   .config:893:warning: symbol value 'n' invalid for DRM_I915_MAX_REQUEST_BUSYWAIT
   .config:894:warning: symbol value 'n' invalid for RAPIDIO_DISC_TIMEOUT
   .config:917:warning: symbol value 'n' invalid for FAT_DEFAULT_CODEPAGE
   .config:920:warning: symbol value 'n' invalid for SND_AT73C213_TARGET_BITRATE
   .config:966:warning: symbol value 'n' invalid for CMA_SIZE_MBYTES
   .config:967:warning: symbol value 'n' invalid for NET_EMATCH_STACK
   .config:969:warning: symbol value 'n' invalid for VMCP_CMA_SIZE
   .config:1152:warning: symbol value 'n' invalid for NODES_SHIFT
   .config:1247:warning: symbol value 'n' invalid for MTDRAM_ERASE_SIZE
   .config:1307:warning: symbol value 'n' invalid for SERIAL_UARTLITE_NR_UARTS
   .config:1318:warning: symbol value 'n' invalid for AIC7XXX_DEBUG_MASK
   .config:1479:warning: symbol value 'n' invalid for LEGACY_PTY_COUNT
   .config:1645:warning: symbol value 'n' invalid for AIC7XXX_RESET_DELAY_MS
   .config:1682:warning: symbol value 'n' invalid for INPUT_MOUSEDEV_SCREEN_Y
   .config:1861:warning: symbol value 'n' invalid for IBM_EMAC_POLL_WEIGHT
   .config:1936:warning: symbol value 'n' invalid for DRM_I915_STOP_TIMEOUT
   .config:2029:warning: symbol value 'n' invalid for USB_GADGET_STORAGE_NUM_BUFFERS
   .config:2151:warning: symbol value 'n' invalid for SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM
   .config:2259:warning: symbol value 'n' invalid for SND_HDA_PREALLOC_SIZE
   .config:2310:warning: symbol value 'n' invalid for RCU_FANOUT_LEAF
   .config:2467:warning: symbol value 'n' invalid for PANEL_LCD_BWIDTH
   .config:2523:warning: symbol value 'n' invalid for PANEL_LCD_PIN_E
   .config:2542:warning: symbol value 'n' invalid for PSTORE_BLK_CONSOLE_SIZE
   .config:2725:warning: symbol value 'n' invalid for PANEL_PARPORT
   .config:2745:warning: symbol value 'n' invalid for BOOKE_WDT_DEFAULT_TIMEOUT
   .config:2824:warning: symbol value 'n' invalid for NOUVEAU_DEBUG_DEFAULT
   .config:3026:warning: symbol value 'n' invalid for KCSAN_REPORT_ONCE_IN_MS
   .config:3136:warning: symbol value 'n' invalid for KCSAN_UDELAY_INTERRUPT
   .config:3162:warning: symbol value 'n' invalid for PANEL_LCD_PIN_BL
   .config:3190:warning: symbol value 'n' invalid for INITRAMFS_ROOT_GID
   .config:3306:warning: symbol value 'n' invalid for ATM_FORE200E_TX_RETRY
   .config:3347:warning: symbol value 'n' invalid for FB_OMAP2_DSS_MIN_FCK_PER_PCK
   .config:3351:warning: symbol value 'n' invalid for STACK_MAX_DEFAULT_SIZE_MB
   .config:3503:warning: symbol value 'n' invalid for KCSAN_UDELAY_TASK
   .config:3641:warning: symbol value 'n' invalid for AIC79XX_RESET_DELAY_MS
   .config:3722:warning: symbol value 'n' invalid for MMC_BLOCK_MINORS
   .config:3771:warning: symbol value 'n' invalid for SCSI_NCR53C8XX_SYNC
   .config:3855:warning: symbol value 'n' invalid for SERIAL_MCF_BAUDRATE
   .config:3902:warning: symbol value 'n' invalid for UCLAMP_BUCKETS_COUNT
   .config:3944:warning: symbol value 'n' invalid for DE2104X_DSL
   .config:3956:warning: symbol value 'n' invalid for BLK_DEV_RAM_COUNT
   .config:4174:warning: symbol value 'n' invalid for IP_VS_SH_TAB_BITS
   .config:4201:warning: symbol value 'n' invalid for MTD_REDBOOT_DIRECTORY_BLOCK
   .config:4335:warning: symbol value 'n' invalid for USBIP_VHCI_HC_PORTS
   .config:4447:warning: symbol value 'n' invalid for X86_AMD_PSTATE_DEFAULT_MODE
   .config:4458:warning: symbol value 'n' invalid for CMA_AREAS
   .config:4516:warning: symbol value 'n' invalid for INPUT_MOUSEDEV_SCREEN_X
   .config:4640:warning: symbol value 'n' invalid for RIONET_RX_SIZE
   .config:4685:warning: symbol value 'n' invalid for RADIO_TYPHOON_PORT
   .config:4808:warning: symbol value 'n' invalid for SERIAL_TXX9_NR_UARTS
   .config:4865:warning: symbol value 'n' invalid for MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
   .config:4894:warning: symbol value 'n' invalid for SERIAL_ALTERA_UART_BAUDRATE
   .config:4965:warning: symbol value 'n' invalid for IBM_EMAC_TXB
   .config:5032:warning: symbol value 'n' invalid for DUMMY_CONSOLE_ROWS
   .config:5329:warning: symbol value 'n' invalid for FTRACE_RECORD_RECURSION_SIZE
   .config:5423:warning: symbol value 'n' invalid for CRYPTO_DEV_FSL_CAAM_INTC_TIME_THLD
   .config:5473:warning: symbol value 'n' invalid for DRM_I915_FENCE_TIMEOUT
   .config:5496:warning: symbol value 'n' invalid for TTY_PRINTK_LEVEL
   .config:5659:warning: symbol value 'n' invalid for MIPS_EJTAG_FDC_KGDB_CHAN
   .config:5712:warning: symbol value 'n' invalid for PPC_EARLY_DEBUG_EHV_BC_HANDLE
   .config:5757:warning: symbol value 'n' invalid for KDB_DEFAULT_ENABLE
   .config:5775:warning: symbol value 'n' invalid for SERIAL_ALTERA_UART_MAXPORTS
   .config:6033:warning: symbol value 'n' invalid for IP_VS_MH_TAB_INDEX
   .config:6055:warning: symbol value 'n' invalid for PANEL_LCD_HWIDTH
   .config:6189:warning: symbol value 'n' invalid for DRM_I915_HEARTBEAT_INTERVAL
   .config:6195:warning: symbol value 'n' invalid for KCSAN_SKIP_WATCH
   .config:6205:warning: symbol value 'n' invalid for EFI_MAX_FAKE_MEM
   .config:6220:warning: symbol value 'n' invalid for PSTORE_BLK_KMSG_SIZE
   .config:6443:warning: symbol value 'n' invalid for SERIAL_8250_RUNTIME_UARTS
   .config:6463:warning: symbol value 'n' invalid for PANEL_LCD_PIN_RW
   .config:6572:warning: symbol value 'n' invalid for SERIAL_SH_SCI_NR_UARTS
   .config:6726:warning: symbol value 'n' invalid for RADIO_TRUST_PORT
   .config:6937:warning: symbol value 'n' invalid for SND_MAX_CARDS
   .config:6996:warning: symbol value 'n' invalid for ZSMALLOC_CHAIN_SIZE
   .config:7104:warning: symbol value 'n' invalid for DVB_MAX_ADAPTERS
   .config:7111:warning: symbol value 'n' invalid for SCSI_NCR53C8XX_MAX_TAGS
   .config:7124:warning: symbol value 'n' invalid for RCU_BOOST_DELAY
   .config:7130:warning: symbol value 'n' invalid for SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
   .config:7143:warning: symbol value 'n' invalid for CMA_SIZE_PERCENTAGE
   .config:7521:warning: symbol value 'n' invalid for IBM_EMAC_RXB
   .config:7815:warning: symbol value 'n' invalid for SERIAL_ARC_NR_PORTS
   .config:7944:warning: symbol value 'n' invalid for PANEL_LCD
   .config:7994:warning: symbol value 'n' invalid for SCSI_MPT3SAS_MAX_SGE
   .config:8000:warning: symbol value 'n' invalid for SCSI_SYM53C8XX_MAX_TAGS
   .config:8084:warning: symbol value 'n' invalid for MTD_UBI_WL_THRESHOLD
   .config:8117:warning: symbol value 'n' invalid for RIONET_TX_SIZE
   .config:8132:warning: symbol value 'n' invalid for PSTORE_DEFAULT_KMSG_BYTES
diff mbox series

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 2520db0b776e..0065dcb63745 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -21,6 +21,10 @@  menuconfig DRM
 	select KCMP
 	select VIDEO_CMDLINE
 	select VIDEO_NOMODESET
+	select ACPI_VIDEO if ACPI
+	select BACKLIGHT_CLASS_DEVICE if ACPI
+	select INPUT if ACPI
+	select ACPI_WMI if X86
 	help
 	  Kernel-level support for the Direct Rendering Infrastructure (DRI)
 	  introduced in XFree86 4.0. If you say Y here, you need to select
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 69c68804023f..1fbbeaa664b2 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -28,6 +28,7 @@ 
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include <acpi/video.h>
 #include <linux/bitfield.h>
 #include <linux/cec.h>
 #include <linux/hdmi.h>
@@ -2188,6 +2189,47 @@  drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
 	return ret == xfers ? 0 : -1;
 }
 
+/**
+ * drm_do_probe_acpi_edid() - get EDID information via ACPI _DDC
+ * @data: struct drm_device
+ * @buf: EDID data buffer to be filled
+ * @block: 128 byte EDID block to start fetching from
+ * @len: EDID data buffer length to fetch
+ *
+ * Try to fetch EDID information by calling acpi_video_get_edid() function.
+ *
+ * Return: 0 on success or error code on failure.
+ */
+static int
+drm_do_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
+{
+	struct drm_device *ddev = data;
+	struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
+	unsigned char start = block * EDID_LENGTH;
+	void *edid;
+	int r;
+
+	if (!acpidev)
+		return -ENODEV;
+
+	/* fetch the entire edid from BIOS */
+	r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
+	if (r < 0) {
+		DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
+		return -EINVAL;
+	}
+	if (len > r || start > r || start + len > r) {
+		r = EINVAL;
+		goto cleanup;
+	}
+
+	memcpy(buf, edid + start, len);
+	r = 0;
+cleanup:
+	kfree(edid);
+	return r;
+}
+
 static void connector_bad_edid(struct drm_connector *connector,
 			       const struct edid *edid, int num_blocks)
 {
@@ -2643,6 +2685,37 @@  struct edid *drm_get_edid(struct drm_connector *connector,
 }
 EXPORT_SYMBOL(drm_get_edid);
 
+/**
+ * drm_get_acpi_edid - get EDID data, if available
+ * @connector: connector we're probing
+ *
+ * Use the BIOS to attempt to grab EDID data if possible.  If found,
+ * attach it to the connector.
+ *
+ * Return: Pointer to valid EDID or NULL if we couldn't find any.
+ */
+struct edid *drm_get_acpi_edid(struct drm_connector *connector)
+{
+	struct edid *edid = NULL;
+
+	switch (connector->connector_type) {
+	case DRM_MODE_CONNECTOR_LVDS:
+	case DRM_MODE_CONNECTOR_eDP:
+		break;
+	default:
+		return NULL;
+	}
+
+	if (connector->force == DRM_FORCE_OFF)
+		return NULL;
+
+	edid = _drm_do_get_edid(connector, drm_do_probe_acpi_edid, connector->dev, NULL);
+
+	drm_connector_update_edid_property(connector, edid);
+	return edid;
+}
+EXPORT_SYMBOL(drm_get_acpi_edid);
+
 /**
  * drm_edid_read_custom - Read EDID data using given EDID block read function
  * @connector: Connector to use
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 518d1b8106c7..60fbdc06badc 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -412,6 +412,7 @@  struct edid *drm_do_get_edid(struct drm_connector *connector,
 	void *data);
 struct edid *drm_get_edid(struct drm_connector *connector,
 			  struct i2c_adapter *adapter);
+struct edid *drm_get_acpi_edid(struct drm_connector *connector);
 u32 drm_edid_get_panel_id(struct i2c_adapter *adapter);
 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
 				     struct i2c_adapter *adapter);