X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Mark Gross <mgross@linux.intel.com>,
	"open list:X86 PLATFORM DRIVERS" 
	<platform-driver-x86@vger.kernel.org>
Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Subject: Re: [PATCH] platform/x86: Rename hp-wireless to wireless-hotkey
Date: Thu, 20 May 2021 14:13:31 +0200	[thread overview]
Message-ID: <6dd6b785-e808-2c8e-4b20-71dc6ef57cb8@redhat.com> (raw)
In-Reply-To: <20210519174405.30155-1-mario.limonciello@amd.com>

Hi,

On 5/19/21 7:44 PM, Mario Limonciello wrote:
> This driver was originally intended to support some HP laptops, but
> later support was added for Xioami and AMD laptops.
> 
> Rename it to make it clear that it supports a larger variety of
> systems.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
>  drivers/platform/x86/Kconfig           |   9 ++-
>  drivers/platform/x86/Makefile          |   3 +-
>  drivers/platform/x86/hp-wireless.c     | 102 ------------------------
>  drivers/platform/x86/wireless-hotkey.c | 103 +++++++++++++++++++++++++
>  4 files changed, 109 insertions(+), 108 deletions(-)
>  delete mode 100644 drivers/platform/x86/hp-wireless.c
>  create mode 100644 drivers/platform/x86/wireless-hotkey.c
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 60592fb88e7a..9a668dae2738 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -415,16 +415,17 @@ config HP_ACCEL
>  	  To compile this driver as a module, choose M here: the module will
>  	  be called hp_accel.
>  
> -config HP_WIRELESS
> -	tristate "HP wireless button"
> +config WIRELESS_HOTKEY
> +	tristate "Wireless hotkey button"
>  	depends on ACPI
>  	depends on INPUT
>  	help
> -	 This driver provides supports for new HP wireless button for Windows 8.
> +	 This driver provides supports for the wireless buttons found on some AMD,
> +	 HP, & Xioami laptops.
>  	 On such systems the driver should load automatically (via ACPI alias).
>  
>  	 To compile this driver as a module, choose M here: the module will
> -	 be called hp-wireless.
> +	 be called wireless-hotkey.
>  
>  config HP_WMI
>  	tristate "HP WMI extras"
> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
> index dcc8cdb95b4d..f4e7630186b0 100644
> --- a/drivers/platform/x86/Makefile
> +++ b/drivers/platform/x86/Makefile
> @@ -52,7 +52,6 @@ obj-$(CONFIG_GPD_POCKET_FAN)	+= gpd-pocket-fan.o
>  
>  # Hewlett Packard
>  obj-$(CONFIG_HP_ACCEL)		+= hp_accel.o
> -obj-$(CONFIG_HP_WIRELESS)	+= hp-wireless.o
>  obj-$(CONFIG_HP_WMI)		+= hp-wmi.o
>  obj-$(CONFIG_TC1100_WMI)	+= tc1100-wmi.o
>  
> @@ -115,7 +114,7 @@ obj-$(CONFIG_TOPSTAR_LAPTOP)	+= topstar-laptop.o
>  obj-$(CONFIG_I2C_MULTI_INSTANTIATE)	+= i2c-multi-instantiate.o
>  obj-$(CONFIG_MLX_PLATFORM)		+= mlx-platform.o
>  obj-$(CONFIG_TOUCHSCREEN_DMI)		+= touchscreen_dmi.o
> -
> +obj-$(CONFIG_WIRELESS_HOTKEY)		+= wireless-hotkey.o
>  # Intel uncore drivers
>  obj-$(CONFIG_INTEL_IPS)				+= intel_ips.o
>  obj-$(CONFIG_INTEL_RST)				+= intel-rst.o
> diff --git a/drivers/platform/x86/hp-wireless.c b/drivers/platform/x86/hp-wireless.c
> deleted file mode 100644
> index 0753ef18e721..000000000000
> --- a/drivers/platform/x86/hp-wireless.c
> +++ /dev/null
> @@ -1,102 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - *  Airplane mode button for HP & Xiaomi laptops
> - *
> - *  Copyright (C) 2014-2017 Alex Hung <alex.hung@canonical.com>
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/init.h>
> -#include <linux/input.h>
> -#include <linux/platform_device.h>
> -#include <linux/acpi.h>
> -#include <acpi/acpi_bus.h>
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Alex Hung");
> -MODULE_ALIAS("acpi*:HPQ6001:*");
> -MODULE_ALIAS("acpi*:WSTADEF:*");
> -MODULE_ALIAS("acpi*:AMDI0051:*");
> -
> -static struct input_dev *hpwl_input_dev;
> -
> -static const struct acpi_device_id hpwl_ids[] = {
> -	{"HPQ6001", 0},
> -	{"WSTADEF", 0},
> -	{"AMDI0051", 0},
> -	{"", 0},
> -};
> -
> -static int hp_wireless_input_setup(void)
> -{
> -	int err;
> -
> -	hpwl_input_dev = input_allocate_device();
> -	if (!hpwl_input_dev)
> -		return -ENOMEM;
> -
> -	hpwl_input_dev->name = "HP Wireless hotkeys";
> -	hpwl_input_dev->phys = "hpq6001/input0";
> -	hpwl_input_dev->id.bustype = BUS_HOST;
> -	hpwl_input_dev->evbit[0] = BIT(EV_KEY);
> -	set_bit(KEY_RFKILL, hpwl_input_dev->keybit);
> -
> -	err = input_register_device(hpwl_input_dev);
> -	if (err)
> -		goto err_free_dev;
> -
> -	return 0;
> -
> -err_free_dev:
> -	input_free_device(hpwl_input_dev);
> -	return err;
> -}
> -
> -static void hp_wireless_input_destroy(void)
> -{
> -	input_unregister_device(hpwl_input_dev);
> -}
> -
> -static void hpwl_notify(struct acpi_device *acpi_dev, u32 event)
> -{
> -	if (event != 0x80) {
> -		pr_info("Received unknown event (0x%x)\n", event);
> -		return;
> -	}
> -
> -	input_report_key(hpwl_input_dev, KEY_RFKILL, 1);
> -	input_sync(hpwl_input_dev);
> -	input_report_key(hpwl_input_dev, KEY_RFKILL, 0);
> -	input_sync(hpwl_input_dev);
> -}
> -
> -static int hpwl_add(struct acpi_device *device)
> -{
> -	int err;
> -
> -	err = hp_wireless_input_setup();
> -	if (err)
> -		pr_err("Failed to setup hp wireless hotkeys\n");
> -
> -	return err;
> -}
> -
> -static int hpwl_remove(struct acpi_device *device)
> -{
> -	hp_wireless_input_destroy();
> -	return 0;
> -}
> -
> -static struct acpi_driver hpwl_driver = {
> -	.name	= "hp-wireless",
> -	.owner	= THIS_MODULE,
> -	.ids	= hpwl_ids,
> -	.ops	= {
> -		.add	= hpwl_add,
> -		.remove	= hpwl_remove,
> -		.notify	= hpwl_notify,
> -	},
> -};
> -
> -module_acpi_driver(hpwl_driver);
> diff --git a/drivers/platform/x86/wireless-hotkey.c b/drivers/platform/x86/wireless-hotkey.c
> new file mode 100644
> index 000000000000..b010e4ca3383
> --- /dev/null
> +++ b/drivers/platform/x86/wireless-hotkey.c
> @@ -0,0 +1,103 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *  Airplane mode button for AMD, HP & Xiaomi laptops
> + *
> + *  Copyright (C) 2014-2017 Alex Hung <alex.hung@canonical.com>
> + *  Copyright (C) 2021 Advanced Micro Devices
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/platform_device.h>
> +#include <linux/acpi.h>
> +#include <acpi/acpi_bus.h>
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Alex Hung");
> +MODULE_ALIAS("acpi*:HPQ6001:*");
> +MODULE_ALIAS("acpi*:WSTADEF:*");
> +MODULE_ALIAS("acpi*:AMDI0051:*");
> +
> +static struct input_dev *wl_input_dev;
> +
> +static const struct acpi_device_id wl_ids[] = {
> +	{"HPQ6001", 0},
> +	{"WSTADEF", 0},
> +	{"AMDI0051", 0},
> +	{"", 0},
> +};
> +
> +static int wireless_input_setup(void)
> +{
> +	int err;
> +
> +	wl_input_dev = input_allocate_device();
> +	if (!wl_input_dev)
> +		return -ENOMEM;
> +
> +	wl_input_dev->name = "Wireless hotkeys";
> +	wl_input_dev->phys = "hpq6001/input0";
> +	wl_input_dev->id.bustype = BUS_HOST;
> +	wl_input_dev->evbit[0] = BIT(EV_KEY);
> +	set_bit(KEY_RFKILL, wl_input_dev->keybit);
> +
> +	err = input_register_device(wl_input_dev);
> +	if (err)
> +		goto err_free_dev;
> +
> +	return 0;
> +
> +err_free_dev:
> +	input_free_device(wl_input_dev);
> +	return err;
> +}
> +
> +static void wireless_input_destroy(void)
> +{
> +	input_unregister_device(wl_input_dev);
> +}
> +
> +static void wl_notify(struct acpi_device *acpi_dev, u32 event)
> +{
> +	if (event != 0x80) {
> +		pr_info("Received unknown event (0x%x)\n", event);
> +		return;
> +	}
> +
> +	input_report_key(wl_input_dev, KEY_RFKILL, 1);
> +	input_sync(wl_input_dev);
> +	input_report_key(wl_input_dev, KEY_RFKILL, 0);
> +	input_sync(wl_input_dev);
> +}
> +
> +static int wl_add(struct acpi_device *device)
> +{
> +	int err;
> +
> +	err = wireless_input_setup();
> +	if (err)
> +		pr_err("Failed to setup hp wireless hotkeys\n");
> +
> +	return err;
> +}
> +
> +static int wl_remove(struct acpi_device *device)
> +{
> +	wireless_input_destroy();
> +	return 0;
> +}
> +
> +static struct acpi_driver wl_driver = {
> +	.name	= "wireless-hotkey",
> +	.owner	= THIS_MODULE,
> +	.ids	= wl_ids,
> +	.ops	= {
> +		.add	= wl_add,
> +		.remove	= wl_remove,
> +		.notify	= wl_notify,
> +	},
> +};
> +
> +module_acpi_driver(wl_driver);
> 


      reply	other threads:[~2021-05-20 12:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 17:44 [PATCH] platform/x86: Rename hp-wireless to wireless-hotkey Mario Limonciello
2021-05-20 12:13 ` Hans de Goede [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dd6b785-e808-2c8e-4b20-71dc6ef57cb8@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=mario.limonciello@amd.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox