diff mbox series

[1/1,SRU,H,I] UBUNTU: ODM: mfd: Check AAEON BFPI version before adding device

Message ID 20210811085617.1389423-2-acelan.kao@canonical.com
State New
Headers show
Series GPIO error logs in start and dmesg after update of kernel | expand

Commit Message

AceLan Kao Aug. 11, 2021, 8:56 a.m. UTC
From: Kunyang_Fan <kunyang_fan@asus.com>

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.

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>
---
 drivers/mfd/mfd-aaeon.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Tim Gardner Aug. 11, 2021, 12:31 p.m. UTC | #1
Shouldn't the $subject be 'UBUNTU: SAUCE:' ?

On 8/11/21 2:56 AM, AceLan Kao wrote:
> From: Kunyang_Fan <kunyang_fan@asus.com>
> 
> 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.
> 
> 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>
> ---
>   drivers/mfd/mfd-aaeon.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
> index 9d2efde53cad..74211d01ce65 100644
> --- a/drivers/mfd/mfd-aaeon.c
> +++ b/drivers/mfd/mfd-aaeon.c
> @@ -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);
>
Stefan Bader Aug. 12, 2021, 7:27 a.m. UTC | #2
On 11.08.21 14:31, Tim Gardner wrote:
> Shouldn't the $subject be 'UBUNTU: SAUCE:' ?

And additionally being SAUCE and no indication why it cannot go upstream that 
way is another reason to NACK for SRU. And when it goes upstream, then SRU 
should wait until it is in linux-next at least.

-Stefan

> 
> On 8/11/21 2:56 AM, AceLan Kao wrote:
>> From: Kunyang_Fan <kunyang_fan@asus.com>
>>
>> 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.
>>
>> 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>
>> ---
>>   drivers/mfd/mfd-aaeon.c | 22 ++++++++++++++++++++++
>>   1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
>> index 9d2efde53cad..74211d01ce65 100644
>> --- a/drivers/mfd/mfd-aaeon.c
>> +++ b/drivers/mfd/mfd-aaeon.c
>> @@ -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);
>>
>
AceLan Kao Aug. 13, 2021, 2:25 a.m. UTC | #3
Hi Tim,

This patch is to fix the issue from ODM patches, so it marks as "UBUNTU: ODM:"
ex. (in hirsute kernel)
3027a1d40b49 UBUNTU: ODM: [Config] update config for AAEON devices
2957f1962dbc UBUNTU: ODM: leds: add driver for AAEON devices
abf0a8bdbc2f UBUNTU: ODM: hwmon: add driver for AAEON devices
85be47f033bb UBUNTU: ODM: watchdog: add driver for AAEON devices
16c04b79bdc6 UBUNTU: ODM: gpio: add driver for AAEON devices
45a8bb8699cc UBUNTU: ODM: mfd: Add support for IO functions of AAEON devices

Hi Stefan,

Those patches are from ODM program and only exists in our ubuntu kernels.
ODM tried to upstream their patches, but it wasn't going smoothly and
suspended now.

Stefan Bader <stefan.bader@canonical.com> 於 2021年8月12日 週四 下午3:27寫道:
>
> On 11.08.21 14:31, Tim Gardner wrote:
> > Shouldn't the $subject be 'UBUNTU: SAUCE:' ?
>
> And additionally being SAUCE and no indication why it cannot go upstream that
> way is another reason to NACK for SRU. And when it goes upstream, then SRU
> should wait until it is in linux-next at least.
>
> -Stefan
>
> >
> > On 8/11/21 2:56 AM, AceLan Kao wrote:
> >> From: Kunyang_Fan <kunyang_fan@asus.com>
> >>
> >> 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.
> >>
> >> 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>
> >> ---
> >>   drivers/mfd/mfd-aaeon.c | 22 ++++++++++++++++++++++
> >>   1 file changed, 22 insertions(+)
> >>
> >> diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
> >> index 9d2efde53cad..74211d01ce65 100644
> >> --- a/drivers/mfd/mfd-aaeon.c
> >> +++ b/drivers/mfd/mfd-aaeon.c
> >> @@ -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);
> >>
> >
>
>
Stefan Bader Aug. 13, 2021, 12:09 p.m. UTC | #4
On 13.08.21 04:25, AceLan Kao wrote:
> Hi Tim,
> 
> This patch is to fix the issue from ODM patches, so it marks as "UBUNTU: ODM:"
> ex. (in hirsute kernel)
> 3027a1d40b49 UBUNTU: ODM: [Config] update config for AAEON devices
> 2957f1962dbc UBUNTU: ODM: leds: add driver for AAEON devices
> abf0a8bdbc2f UBUNTU: ODM: hwmon: add driver for AAEON devices
> 85be47f033bb UBUNTU: ODM: watchdog: add driver for AAEON devices
> 16c04b79bdc6 UBUNTU: ODM: gpio: add driver for AAEON devices
> 45a8bb8699cc UBUNTU: ODM: mfd: Add support for IO functions of AAEON devices
> 
> Hi Stefan,
> 
> Those patches are from ODM program and only exists in our ubuntu kernels.
> ODM tried to upstream their patches, but it wasn't going smoothly and
> suspended now.
> 
If all that info had been in the cover email this probably would not have gone 
wrong that way. Maybe one could have spotted the ODM or remembered the driver 
name. But frankly there are so many things going on nowadays that I can hardly 
remember all things. So please, submit again with more hints in the cover email 
(that this is one of the ODM drivers and therefor there is no upstream).

-Stefan

> Stefan Bader <stefan.bader@canonical.com> 於 2021年8月12日 週四 下午3:27寫道:
>>
>> On 11.08.21 14:31, Tim Gardner wrote:
>>> Shouldn't the $subject be 'UBUNTU: SAUCE:' ?
>>
>> And additionally being SAUCE and no indication why it cannot go upstream that
>> way is another reason to NACK for SRU. And when it goes upstream, then SRU
>> should wait until it is in linux-next at least.
>>
>> -Stefan
>>
>>>
>>> On 8/11/21 2:56 AM, AceLan Kao wrote:
>>>> From: Kunyang_Fan <kunyang_fan@asus.com>
>>>>
>>>> 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.
>>>>
>>>> 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>
>>>> ---
>>>>    drivers/mfd/mfd-aaeon.c | 22 ++++++++++++++++++++++
>>>>    1 file changed, 22 insertions(+)
>>>>
>>>> diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
>>>> index 9d2efde53cad..74211d01ce65 100644
>>>> --- a/drivers/mfd/mfd-aaeon.c
>>>> +++ b/drivers/mfd/mfd-aaeon.c
>>>> @@ -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);
>>>>
>>>
>>
>>
diff mbox series

Patch

diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
index 9d2efde53cad..74211d01ce65 100644
--- a/drivers/mfd/mfd-aaeon.c
+++ b/drivers/mfd/mfd-aaeon.c
@@ -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);