UBUNTU: ODM: mfd: Check AAEON BFPI version before adding device
BugLink: https://bugs.launchpad.net/bugs/1937897 For the below: error log occurring in some devices: gpio gpiochip0: (gpio_aaeon): tried to insert a GPIO chip with zero lines gpiochip_add_data_with_key: GPIOs 0..-1 (gpio_aaeon) failed to register Add the BFPI version checking mechanism to prevent error log bumping. Fixes: 424945128781 ("UBUNTU: ODM: mfd: Add support for IO functions of AAEON devices") Signed-off-by: Kunyang_Fan <kunyang_fan@asus.com> Acked-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com> Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
committed by
Paolo Pisati
parent
8c31039695
commit
470ba6d178
@@ -16,12 +16,17 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_data/x86/asus-wmi.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/wmi.h>
|
||||
|
||||
#define AAEON_WMI_MGMT_GUID "97845ED0-4E6D-11DE-8A39-0800200C9A66"
|
||||
|
||||
#define WMI_REPORT_CAPABILITY_METHOD 0x00000000
|
||||
#define MAX_BFPI_VERSION 255
|
||||
#define GET_REVISION_ID 0x00
|
||||
|
||||
struct aaeon_wmi_priv {
|
||||
const struct mfd_cell *cells;
|
||||
size_t ncells;
|
||||
@@ -39,6 +44,21 @@ static const struct aaeon_wmi_priv aaeon_wmi_priv_data = {
|
||||
.ncells = ARRAY_SIZE(aaeon_mfd_cells),
|
||||
};
|
||||
|
||||
static int aaeon_wmi_check_device(void)
|
||||
{
|
||||
int err;
|
||||
int retval;
|
||||
|
||||
err = asus_wmi_evaluate_method(WMI_REPORT_CAPABILITY_METHOD, GET_REVISION_ID, 0,
|
||||
&retval);
|
||||
if (err)
|
||||
return -ENODEV;
|
||||
if (retval < 3 || retval > MAX_BFPI_VERSION)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aaeon_wmi_probe(struct wmi_device *wdev, const void *context)
|
||||
{
|
||||
struct aaeon_wmi_priv *priv;
|
||||
@@ -48,6 +68,8 @@ static int aaeon_wmi_probe(struct wmi_device *wdev, const void *context)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (aaeon_wmi_check_device())
|
||||
return -ENODEV;
|
||||
|
||||
priv = (struct aaeon_wmi_priv *)context;
|
||||
dev_set_drvdata(&wdev->dev, priv);
|
||||
|
||||
Reference in New Issue
Block a user