* [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10
@ 2024-12-04 20:42 Hans de Goede
2024-12-04 20:42 ` [PATCH v3 1/8] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*() Hans de Goede
` (8 more replies)
0 siblings, 9 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
Hi All,
Here is a patch-series for adding Bluetooth support for the Vexia EDU ATLA
10 tablet to x86-android-tablets.
Due to the LPSS UARTs being enumerated through PCI rather than through
ACPI, this is somewhat involved. Just like how this special case needed
some extra work for instantiating the various i2c-clients.
Changes in v3:
- Make the "platform/x86: x86-android-tablets: Add missing __init to
get_i2c_adap_by_*()" bugfix the first patch in the series
- Add 2 more bugfixes as patches 2 - 3
Changes in v2:
- Use a union in struct x86_serdev_info which stores either ACPI HID + UID
or the PCI devfn of the serdev-controller
Regards,
Hans
Hans de Goede (8):
platform/x86: x86-android-tablets: Add missing __init to
get_i2c_adap_by_*()
platform/x86: x86-android-tablets: Make variables only used locally
static
platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
platform/x86: serdev_helpers: Add get_serdev_controller_from_parent()
helper
platform/x86: x86-android-tablets: Change x86_instantiate_serdev()
prototype
platform/x86: x86-android-tablets: Store serdev-controller ACPI HID +
UID in a union
platform/x86: x86-android-tablets: Add support for getting
serdev-controller by PCI parent
platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU
ATLA 10
drivers/platform/x86/serdev_helpers.h | 60 +++++++++++--------
.../platform/x86/x86-android-tablets/asus.c | 4 +-
.../platform/x86/x86-android-tablets/core.c | 31 +++++++---
.../platform/x86/x86-android-tablets/lenovo.c | 4 +-
.../platform/x86/x86-android-tablets/other.c | 16 ++++-
.../x86-android-tablets/x86-android-tablets.h | 13 +++-
6 files changed, 85 insertions(+), 43 deletions(-)
--
2.47.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/8] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*()
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-04 20:42 ` [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static Hans de Goede
` (7 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
get_i2c_adap_by_handle() and get_i2c_adap_by_pci_parent() both are only
used by x86_instantiate_i2c_client() which is __init itself and in case
of the latter it also uses match_parent() which is also __init.
Fixes: 5b78e809f948 ("platform/x86: x86-android-tablets: Add support for getting i2c_adapter by PCI parent devname()")
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index e9f4d91496d5..affaffadd179 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -157,7 +157,7 @@ static struct gpiod_lookup_table * const *gpiod_lookup_tables;
static const struct software_node *bat_swnode;
static void (*exit_handler)(void);
-static struct i2c_adapter *
+static __init struct i2c_adapter *
get_i2c_adap_by_handle(const struct x86_i2c_client_info *client_info)
{
acpi_handle handle;
@@ -177,7 +177,7 @@ static __init int match_parent(struct device *dev, const void *data)
return dev->parent == data;
}
-static struct i2c_adapter *
+static __init struct i2c_adapter *
get_i2c_adap_by_pci_parent(const struct x86_i2c_client_info *client_info)
{
struct i2c_adapter *adap = NULL;
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
2024-12-04 20:42 ` [PATCH v3 1/8] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*() Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-05 9:03 ` Andy Shevchenko
2024-12-04 20:42 ` [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL Hans de Goede
` (6 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko
Cc: Hans de Goede, platform-driver-x86, kernel test robot
Commit 06f876def346 ("platform/x86: x86-android-tablets: Add support for
Vexia EDU ATLA 10 tablet") omitted the static keyword from some variables
which are only used inside other.c .
Add the missing static keyword to these, this fixes the following warnings:
drivers/platform/x86/x86-android-tablets/other.c:605:12: sparse: sparse: symbol 'crystal_cove_pwrsrc_psy' was not declared. Should it be static?
drivers/platform/x86/x86-android-tablets/other.c:612:28: sparse: sparse: symbol 'vexia_edu_atla10_ulpmc_node' was not declared. Should it be static?
Fixes: 06f876def346 ("platform/x86: x86-android-tablets: Add support for Vexia EDU ATLA 10 tablet")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411301001.1glTy7Xm-lkp@intel.com/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets/other.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index 725948044da4..de5b3f1ce9a7 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -602,14 +602,14 @@ const struct x86_dev_info whitelabel_tm800a550l_info __initconst = {
* Vexia EDU ATLA 10 tablet, Android 4.2 / 4.4 + Guadalinex Ubuntu tablet
* distributed to schools in the Spanish Andalucía region.
*/
-const char * const crystal_cove_pwrsrc_psy[] = { "crystal_cove_pwrsrc" };
+static const char * const crystal_cove_pwrsrc_psy[] = { "crystal_cove_pwrsrc" };
static const struct property_entry vexia_edu_atla10_ulpmc_props[] = {
PROPERTY_ENTRY_STRING_ARRAY("supplied-from", crystal_cove_pwrsrc_psy),
{ }
};
-const struct software_node vexia_edu_atla10_ulpmc_node = {
+static const struct software_node vexia_edu_atla10_ulpmc_node = {
.properties = vexia_edu_atla10_ulpmc_props,
};
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
2024-12-04 20:42 ` [PATCH v3 1/8] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*() Hans de Goede
2024-12-04 20:42 ` [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-05 9:05 ` Andy Shevchenko
2024-12-04 20:42 ` [PATCH v3 4/8] platform/x86: serdev_helpers: Add get_serdev_controller_from_parent() helper Hans de Goede
` (5 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko
Cc: Hans de Goede, platform-driver-x86, stable
dell_uart_bl_pdev_probe() calls get_serdev_controller() with the
serial_ctrl_uid parameter set to NULL.
In case of errors this NULL parameter then gets passed to pr_err()
as argument matching a "%s" conversion specification. This leads to
compiler warnings when building with "make W=1".
Check serial_ctrl_uid before passing it to pr_err() to avoid these.
Fixes: dc5afd720f84 ("platform/x86: Add new get_serdev_controller() helper")
Cc: stable@vger.kernel.org
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/serdev_helpers.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/serdev_helpers.h b/drivers/platform/x86/serdev_helpers.h
index bcf3a0c356ea..3bc7fd8e1e19 100644
--- a/drivers/platform/x86/serdev_helpers.h
+++ b/drivers/platform/x86/serdev_helpers.h
@@ -35,7 +35,7 @@ get_serdev_controller(const char *serial_ctrl_hid,
ctrl_adev = acpi_dev_get_first_match_dev(serial_ctrl_hid, serial_ctrl_uid, -1);
if (!ctrl_adev) {
pr_err("error could not get %s/%s serial-ctrl adev\n",
- serial_ctrl_hid, serial_ctrl_uid);
+ serial_ctrl_hid, serial_ctrl_uid ?: "*");
return ERR_PTR(-ENODEV);
}
@@ -43,7 +43,7 @@ get_serdev_controller(const char *serial_ctrl_hid,
ctrl_dev = get_device(acpi_get_first_physical_node(ctrl_adev));
if (!ctrl_dev) {
pr_err("error could not get %s/%s serial-ctrl physical node\n",
- serial_ctrl_hid, serial_ctrl_uid);
+ serial_ctrl_hid, serial_ctrl_uid ?: "*");
ctrl_dev = ERR_PTR(-ENODEV);
goto put_ctrl_adev;
}
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 4/8] platform/x86: serdev_helpers: Add get_serdev_controller_from_parent() helper
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
` (2 preceding siblings ...)
2024-12-04 20:42 ` [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-04 20:42 ` [PATCH v3 5/8] platform/x86: x86-android-tablets: Change x86_instantiate_serdev() prototype Hans de Goede
` (4 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
The x86-android-tablets code needs to be able to get a serdev_controller
device from a PCI parent, rather then by the ACPI HID+UID of the parent,
because on some tablets the UARTs are enumerated as PCI devices instead
of ACPI devices.
Split the code to walk the device hierarchy to find the serdev_controller
from its parents out into a get_serdev_controller_from_parent() helper
so that the x86-android-tablets code can re-use it.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/serdev_helpers.h | 60 +++++++++++++++------------
1 file changed, 34 insertions(+), 26 deletions(-)
diff --git a/drivers/platform/x86/serdev_helpers.h b/drivers/platform/x86/serdev_helpers.h
index 3bc7fd8e1e19..57eac75805e2 100644
--- a/drivers/platform/x86/serdev_helpers.h
+++ b/drivers/platform/x86/serdev_helpers.h
@@ -22,32 +22,14 @@
#include <linux/string.h>
static inline struct device *
-get_serdev_controller(const char *serial_ctrl_hid,
- const char *serial_ctrl_uid,
- int serial_ctrl_port,
- const char *serdev_ctrl_name)
+get_serdev_controller_from_parent(struct device *ctrl_dev,
+ int serial_ctrl_port,
+ const char *serdev_ctrl_name)
{
- struct device *ctrl_dev, *child;
- struct acpi_device *ctrl_adev;
+ struct device *child;
char name[32];
int i;
- ctrl_adev = acpi_dev_get_first_match_dev(serial_ctrl_hid, serial_ctrl_uid, -1);
- if (!ctrl_adev) {
- pr_err("error could not get %s/%s serial-ctrl adev\n",
- serial_ctrl_hid, serial_ctrl_uid ?: "*");
- return ERR_PTR(-ENODEV);
- }
-
- /* get_first_physical_node() returns a weak ref */
- ctrl_dev = get_device(acpi_get_first_physical_node(ctrl_adev));
- if (!ctrl_dev) {
- pr_err("error could not get %s/%s serial-ctrl physical node\n",
- serial_ctrl_hid, serial_ctrl_uid ?: "*");
- ctrl_dev = ERR_PTR(-ENODEV);
- goto put_ctrl_adev;
- }
-
/* Walk host -> uart-ctrl -> port -> serdev-ctrl */
for (i = 0; i < 3; i++) {
switch (i) {
@@ -67,14 +49,40 @@ get_serdev_controller(const char *serial_ctrl_hid,
put_device(ctrl_dev);
if (!child) {
pr_err("error could not find '%s' device\n", name);
- ctrl_dev = ERR_PTR(-ENODEV);
- goto put_ctrl_adev;
+ return ERR_PTR(-ENODEV);
}
ctrl_dev = child;
}
-put_ctrl_adev:
- acpi_dev_put(ctrl_adev);
return ctrl_dev;
}
+
+static inline struct device *
+get_serdev_controller(const char *serial_ctrl_hid,
+ const char *serial_ctrl_uid,
+ int serial_ctrl_port,
+ const char *serdev_ctrl_name)
+{
+ struct acpi_device *adev;
+ struct device *parent;
+
+ adev = acpi_dev_get_first_match_dev(serial_ctrl_hid, serial_ctrl_uid, -1);
+ if (!adev) {
+ pr_err("error could not get %s/%s serial-ctrl adev\n",
+ serial_ctrl_hid, serial_ctrl_uid ?: "*");
+ return ERR_PTR(-ENODEV);
+ }
+
+ /* get_first_physical_node() returns a weak ref */
+ parent = get_device(acpi_get_first_physical_node(adev));
+ acpi_dev_put(adev);
+ if (!parent) {
+ pr_err("error could not get %s/%s serial-ctrl physical node\n",
+ serial_ctrl_hid, serial_ctrl_uid ?: "*");
+ return ERR_PTR(-ENODEV);
+ }
+
+ /* This puts our reference on parent and returns a ref on the ctrl */
+ return get_serdev_controller_from_parent(parent, serial_ctrl_port, serdev_ctrl_name);
+}
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 5/8] platform/x86: x86-android-tablets: Change x86_instantiate_serdev() prototype
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
` (3 preceding siblings ...)
2024-12-04 20:42 ` [PATCH v3 4/8] platform/x86: serdev_helpers: Add get_serdev_controller_from_parent() helper Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-04 20:42 ` [PATCH v3 6/8] platform/x86: x86-android-tablets: Store serdev-controller ACPI HID + UID in a union Hans de Goede
` (3 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
Make x86_instantiate_serdev() take a "struct x86_dev_info *" + idx as
arguments instead of a "struct x86_serdev_info *" + idx.
This makes the x86_instantiate_serdev() prototype match
the x86_instantiate_i2c_client() and x86_instantiate_spi_dev() prototypes.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index affaffadd179..800d6c84dced 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -271,8 +271,9 @@ static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, i
return 0;
}
-static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int idx)
+static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, int idx)
{
+ const struct x86_serdev_info *info = &dev_info->serdev_info[idx];
struct acpi_device *serdev_adev;
struct serdev_device *serdev;
struct device *ctrl_dev;
@@ -446,7 +447,7 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
serdev_count = dev_info->serdev_count;
for (i = 0; i < serdev_count; i++) {
- ret = x86_instantiate_serdev(&dev_info->serdev_info[i], i);
+ ret = x86_instantiate_serdev(dev_info, i);
if (ret < 0) {
x86_android_tablet_remove(pdev);
return ret;
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 6/8] platform/x86: x86-android-tablets: Store serdev-controller ACPI HID + UID in a union
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
` (4 preceding siblings ...)
2024-12-04 20:42 ` [PATCH v3 5/8] platform/x86: x86-android-tablets: Change x86_instantiate_serdev() prototype Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-04 20:42 ` [PATCH v3 7/8] platform/x86: x86-android-tablets: Add support for getting serdev-controller by PCI parent Hans de Goede
` (2 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
Store the serdev-controller ACPI HID + UID in a union inside struct
x86_serdev_info.
This is a preparation patch for adding support for PCI enumerated serdev-
controllers which will be done by the devfn value of the PCI device.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- This is a new patch in v2 of this patch-series
---
drivers/platform/x86/x86-android-tablets/asus.c | 4 ++--
drivers/platform/x86/x86-android-tablets/core.c | 2 +-
drivers/platform/x86/x86-android-tablets/lenovo.c | 4 ++--
.../x86/x86-android-tablets/x86-android-tablets.h | 8 ++++++--
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/asus.c b/drivers/platform/x86/x86-android-tablets/asus.c
index 07fbeab2319a..7dde63b9943f 100644
--- a/drivers/platform/x86/x86-android-tablets/asus.c
+++ b/drivers/platform/x86/x86-android-tablets/asus.c
@@ -145,8 +145,8 @@ static const struct x86_i2c_client_info asus_me176c_i2c_clients[] __initconst =
static const struct x86_serdev_info asus_me176c_serdevs[] __initconst = {
{
- .ctrl_hid = "80860F0A",
- .ctrl_uid = "2",
+ .ctrl.acpi.hid = "80860F0A",
+ .ctrl.acpi.uid = "2",
.ctrl_devname = "serial0",
.serdev_hid = "BCM2E3A",
},
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 800d6c84dced..59909c53fca4 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -279,7 +279,7 @@ static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, in
struct device *ctrl_dev;
int ret = -ENODEV;
- ctrl_dev = get_serdev_controller(info->ctrl_hid, info->ctrl_uid, 0,
+ ctrl_dev = get_serdev_controller(info->ctrl.acpi.hid, info->ctrl.acpi.uid, 0,
info->ctrl_devname);
if (IS_ERR(ctrl_dev))
return PTR_ERR(ctrl_dev);
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index ae087f1471c1..98085cb49c74 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -178,8 +178,8 @@ static const struct platform_device_info lenovo_yb1_x90_pdevs[] __initconst = {
*/
static const struct x86_serdev_info lenovo_yb1_x90_serdevs[] __initconst = {
{
- .ctrl_hid = "8086228A",
- .ctrl_uid = "1",
+ .ctrl.acpi.hid = "8086228A",
+ .ctrl.acpi.uid = "1",
.ctrl_devname = "serial0",
.serdev_hid = "BCM2E1A",
},
diff --git a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
index 0fc7e8cff672..5ddec4beb552 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -57,8 +57,12 @@ struct x86_spi_dev_info {
};
struct x86_serdev_info {
- const char *ctrl_hid;
- const char *ctrl_uid;
+ union {
+ struct {
+ const char *hid;
+ const char *uid;
+ } acpi;
+ } ctrl;
const char *ctrl_devname;
/*
* ATM the serdev core only supports of or ACPI matching; and so far all
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 7/8] platform/x86: x86-android-tablets: Add support for getting serdev-controller by PCI parent
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
` (5 preceding siblings ...)
2024-12-04 20:42 ` [PATCH v3 6/8] platform/x86: x86-android-tablets: Store serdev-controller ACPI HID + UID in a union Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-04 20:42 ` [PATCH v3 8/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
2024-12-10 14:03 ` [PATCH v3 0/8] " Ilpo Järvinen
8 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
On the Vexia EDU ATLA 10 tablet, which ships with Android + a custom Linux
(guadalinex) using the custom Android kernel the UART controllers are not
enumerated as ACPI devices as they typically are.
Instead they are enumerated through PCI and getting the serdev-controller
by ACPI HID + UID does not work.
Add support for getting the serdev-controller by the PCI devfn of its
parent instead.
This also renames the use_pci_devname flag to use_pci since the former
name now no longer is accurate.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- Store PCI devfn in a union inside struct x86_dev_info
---
.../platform/x86/x86-android-tablets/core.c | 22 ++++++++++++++++---
.../platform/x86/x86-android-tablets/other.c | 2 +-
.../x86-android-tablets/x86-android-tablets.h | 5 ++++-
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 59909c53fca4..379ba0916ad8 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -212,7 +212,7 @@ static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info
if (board_info.irq < 0)
return board_info.irq;
- if (dev_info->use_pci_devname)
+ if (dev_info->use_pci)
adap = get_i2c_adap_by_pci_parent(client_info);
else
adap = get_i2c_adap_by_handle(client_info);
@@ -271,6 +271,19 @@ static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, i
return 0;
}
+static __init struct device *
+get_serdev_controller_by_pci_parent(const struct x86_serdev_info *info)
+{
+ struct pci_dev *pdev;
+
+ pdev = pci_get_domain_bus_and_slot(0, 0, info->ctrl.pci.devfn);
+ if (!pdev)
+ return ERR_PTR(-EPROBE_DEFER);
+
+ /* This puts our reference on pdev and returns a ref on the ctrl */
+ return get_serdev_controller_from_parent(&pdev->dev, 0, info->ctrl_devname);
+}
+
static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, int idx)
{
const struct x86_serdev_info *info = &dev_info->serdev_info[idx];
@@ -279,8 +292,11 @@ static __init int x86_instantiate_serdev(const struct x86_dev_info *dev_info, in
struct device *ctrl_dev;
int ret = -ENODEV;
- ctrl_dev = get_serdev_controller(info->ctrl.acpi.hid, info->ctrl.acpi.uid, 0,
- info->ctrl_devname);
+ if (dev_info->use_pci)
+ ctrl_dev = get_serdev_controller_by_pci_parent(info);
+ else
+ ctrl_dev = get_serdev_controller(info->ctrl.acpi.hid, info->ctrl.acpi.uid,
+ 0, info->ctrl_devname);
if (IS_ERR(ctrl_dev))
return PTR_ERR(ctrl_dev);
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index de5b3f1ce9a7..3032b6337804 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -757,7 +757,7 @@ const struct x86_dev_info vexia_edu_atla10_info __initconst = {
.i2c_client_count = ARRAY_SIZE(vexia_edu_atla10_i2c_clients),
.gpiod_lookup_tables = vexia_edu_atla10_gpios,
.init = vexia_edu_atla10_init,
- .use_pci_devname = true,
+ .use_pci = true,
};
/*
diff --git a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
index 5ddec4beb552..63a38a0069ba 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -62,6 +62,9 @@ struct x86_serdev_info {
const char *hid;
const char *uid;
} acpi;
+ struct {
+ unsigned int devfn;
+ } pci;
} ctrl;
const char *ctrl_devname;
/*
@@ -95,7 +98,7 @@ struct x86_dev_info {
int gpio_button_count;
int (*init)(struct device *dev);
void (*exit)(void);
- bool use_pci_devname;
+ bool use_pci;
};
int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id,
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 8/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
` (6 preceding siblings ...)
2024-12-04 20:42 ` [PATCH v3 7/8] platform/x86: x86-android-tablets: Add support for getting serdev-controller by PCI parent Hans de Goede
@ 2024-12-04 20:42 ` Hans de Goede
2024-12-10 14:03 ` [PATCH v3 0/8] " Ilpo Järvinen
8 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-04 20:42 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86
The UART used for the Bluetooth HCI on the Vexia EDU ATLA 10 is enumerated
as a PCI device, but the ODBA7823 ACPI fwnode for the HCI expects it to
use the more standard ACPI enumeration mode.
So Bluetooth does not work out of the box. Add x86_serdev_info to make
the x86-android-tablets manually associate the fwnode with the UART.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets/other.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index 3032b6337804..172c9c5d3468 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -715,6 +715,14 @@ static const struct x86_i2c_client_info vexia_edu_atla10_i2c_clients[] __initcon
}
};
+static const struct x86_serdev_info vexia_edu_atla10_serdevs[] __initconst = {
+ {
+ .ctrl.pci.devfn = PCI_DEVFN(0x1e, 3),
+ .ctrl_devname = "serial0",
+ .serdev_hid = "OBDA8723",
+ },
+};
+
static struct gpiod_lookup_table vexia_edu_atla10_ft5416_gpios = {
.dev_id = "i2c-FTSC1000",
.table = {
@@ -755,6 +763,8 @@ static int __init vexia_edu_atla10_init(struct device *dev)
const struct x86_dev_info vexia_edu_atla10_info __initconst = {
.i2c_client_info = vexia_edu_atla10_i2c_clients,
.i2c_client_count = ARRAY_SIZE(vexia_edu_atla10_i2c_clients),
+ .serdev_info = vexia_edu_atla10_serdevs,
+ .serdev_count = ARRAY_SIZE(vexia_edu_atla10_serdevs),
.gpiod_lookup_tables = vexia_edu_atla10_gpios,
.init = vexia_edu_atla10_init,
.use_pci = true,
--
2.47.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static
2024-12-04 20:42 ` [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static Hans de Goede
@ 2024-12-05 9:03 ` Andy Shevchenko
2024-12-08 14:16 ` Hans de Goede
0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2024-12-05 9:03 UTC (permalink / raw)
To: Hans de Goede; +Cc: Ilpo Järvinen, platform-driver-x86, kernel test robot
On Wed, Dec 04, 2024 at 09:42:13PM +0100, Hans de Goede wrote:
> Commit 06f876def346 ("platform/x86: x86-android-tablets: Add support for
> Vexia EDU ATLA 10 tablet") omitted the static keyword from some variables
> which are only used inside other.c .
>
> Add the missing static keyword to these, this fixes the following warnings:
>
> drivers/platform/x86/x86-android-tablets/other.c:605:12: sparse: sparse: symbol 'crystal_cove_pwrsrc_psy' was not declared. Should it be static?
> drivers/platform/x86/x86-android-tablets/other.c:612:28: sparse: sparse: symbol 'vexia_edu_atla10_ulpmc_node' was not declared. Should it be static?
I believe you can shorten these lines like
.../x86-android-tablets/<and so on>
(Note '...' instead of PDx86 root path.)
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
2024-12-04 20:42 ` [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL Hans de Goede
@ 2024-12-05 9:05 ` Andy Shevchenko
2024-12-05 10:32 ` Ilpo Järvinen
0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2024-12-05 9:05 UTC (permalink / raw)
To: Hans de Goede; +Cc: Ilpo Järvinen, platform-driver-x86, stable
On Wed, Dec 04, 2024 at 09:42:14PM +0100, Hans de Goede wrote:
> dell_uart_bl_pdev_probe() calls get_serdev_controller() with the
> serial_ctrl_uid parameter set to NULL.
>
> In case of errors this NULL parameter then gets passed to pr_err()
> as argument matching a "%s" conversion specification. This leads to
> compiler warnings when building with "make W=1".
>
> Check serial_ctrl_uid before passing it to pr_err() to avoid these.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
...
> + serial_ctrl_hid, serial_ctrl_uid ?: "*");
Not sure about '*' as it would mean 'any', perhaps 'none', '-', or 'undefined'
would be better, but since they are error messages, it's not so critical.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
2024-12-05 9:05 ` Andy Shevchenko
@ 2024-12-05 10:32 ` Ilpo Järvinen
2024-12-05 14:11 ` Andy Shevchenko
0 siblings, 1 reply; 15+ messages in thread
From: Ilpo Järvinen @ 2024-12-05 10:32 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86, stable
On Thu, 5 Dec 2024, Andy Shevchenko wrote:
> On Wed, Dec 04, 2024 at 09:42:14PM +0100, Hans de Goede wrote:
> > dell_uart_bl_pdev_probe() calls get_serdev_controller() with the
> > serial_ctrl_uid parameter set to NULL.
> >
> > In case of errors this NULL parameter then gets passed to pr_err()
> > as argument matching a "%s" conversion specification. This leads to
> > compiler warnings when building with "make W=1".
> >
> > Check serial_ctrl_uid before passing it to pr_err() to avoid these.
>
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
>
> ...
>
> > + serial_ctrl_hid, serial_ctrl_uid ?: "*");
>
> Not sure about '*' as it would mean 'any', perhaps 'none', '-', or 'undefined'
> would be better, but since they are error messages, it's not so critical.
Isn't not checking _UID (in acpi_dev_get_first_match_dev()) same as "any"
_UID?
--
i.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
2024-12-05 10:32 ` Ilpo Järvinen
@ 2024-12-05 14:11 ` Andy Shevchenko
0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2024-12-05 14:11 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Andy Shevchenko, Hans de Goede, platform-driver-x86, stable
On Thu, Dec 5, 2024 at 12:32 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
> On Thu, 5 Dec 2024, Andy Shevchenko wrote:
> > On Wed, Dec 04, 2024 at 09:42:14PM +0100, Hans de Goede wrote:
...
> > > + serial_ctrl_hid, serial_ctrl_uid ?: "*");
> >
> > Not sure about '*' as it would mean 'any', perhaps 'none', '-', or 'undefined'
> > would be better, but since they are error messages, it's not so critical.
>
> Isn't not checking _UID (in acpi_dev_get_first_match_dev()) same as "any"
> _UID?
Ah, good point!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static
2024-12-05 9:03 ` Andy Shevchenko
@ 2024-12-08 14:16 ` Hans de Goede
0 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2024-12-08 14:16 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Ilpo Järvinen, platform-driver-x86, kernel test robot
Hi,
On 5-Dec-24 10:03 AM, Andy Shevchenko wrote:
> On Wed, Dec 04, 2024 at 09:42:13PM +0100, Hans de Goede wrote:
>> Commit 06f876def346 ("platform/x86: x86-android-tablets: Add support for
>> Vexia EDU ATLA 10 tablet") omitted the static keyword from some variables
>> which are only used inside other.c .
>>
>> Add the missing static keyword to these, this fixes the following warnings:
>>
>> drivers/platform/x86/x86-android-tablets/other.c:605:12: sparse: sparse: symbol 'crystal_cove_pwrsrc_psy' was not declared. Should it be static?
>> drivers/platform/x86/x86-android-tablets/other.c:612:28: sparse: sparse: symbol 'vexia_edu_atla10_ulpmc_node' was not declared. Should it be static?
>
> I believe you can shorten these lines like
>
> .../x86-android-tablets/<and so on>
>
> (Note '...' instead of PDx86 root path.)
Fine by me, note that the warning will still not fit on a single 75
char line then though.
Ilpo do you want me to send a new version of the series for this?
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
Thank you.
Regards,
Hans
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
` (7 preceding siblings ...)
2024-12-04 20:42 ` [PATCH v3 8/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
@ 2024-12-10 14:03 ` Ilpo Järvinen
8 siblings, 0 replies; 15+ messages in thread
From: Ilpo Järvinen @ 2024-12-10 14:03 UTC (permalink / raw)
To: Andy Shevchenko, Hans de Goede; +Cc: platform-driver-x86
On Wed, 04 Dec 2024 21:42:11 +0100, Hans de Goede wrote:
> Here is a patch-series for adding Bluetooth support for the Vexia EDU ATLA
> 10 tablet to x86-android-tablets.
>
> Due to the LPSS UARTs being enumerated through PCI rather than through
> ACPI, this is somewhat involved. Just like how this special case needed
> some extra work for instantiating the various i2c-clients.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/8] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*()
commit: 981fd70a5ac4347368fa8a3329b7d67f1c567ee7
[2/8] platform/x86: x86-android-tablets: Make variables only used locally static
commit: f6728073baa172be6223512fffd72796de891536
[3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL
commit: 478b00a623d6c8ae23a1be7bcc96cb5497045cef
[4/8] platform/x86: serdev_helpers: Add get_serdev_controller_from_parent() helper
commit: a6593c5c50455852cd3b2b51e09bdec90b99738f
[5/8] platform/x86: x86-android-tablets: Change x86_instantiate_serdev() prototype
commit: c1007dd139b6f8b2b00ba7bdce32a94c3da34dbe
[6/8] platform/x86: x86-android-tablets: Store serdev-controller ACPI HID + UID in a union
commit: dd6db239cb30ef1ccc0084a530839c9897009a6f
[7/8] platform/x86: x86-android-tablets: Add support for getting serdev-controller by PCI parent
commit: 7d28fb4d16fb8ad2309616ee3bdcdbf161c13dc5
[8/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10
commit: c0f1bfc141ea52ea039bd17537b46b705ff8a93d
--
i.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-12-10 14:03 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04 20:42 [PATCH v3 0/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
2024-12-04 20:42 ` [PATCH v3 1/8] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*() Hans de Goede
2024-12-04 20:42 ` [PATCH v3 2/8] platform/x86: x86-android-tablets: Make variables only used locally static Hans de Goede
2024-12-05 9:03 ` Andy Shevchenko
2024-12-08 14:16 ` Hans de Goede
2024-12-04 20:42 ` [PATCH v3 3/8] platform/x86: serdev_helpers: Check for serial_ctrl_uid == NULL Hans de Goede
2024-12-05 9:05 ` Andy Shevchenko
2024-12-05 10:32 ` Ilpo Järvinen
2024-12-05 14:11 ` Andy Shevchenko
2024-12-04 20:42 ` [PATCH v3 4/8] platform/x86: serdev_helpers: Add get_serdev_controller_from_parent() helper Hans de Goede
2024-12-04 20:42 ` [PATCH v3 5/8] platform/x86: x86-android-tablets: Change x86_instantiate_serdev() prototype Hans de Goede
2024-12-04 20:42 ` [PATCH v3 6/8] platform/x86: x86-android-tablets: Store serdev-controller ACPI HID + UID in a union Hans de Goede
2024-12-04 20:42 ` [PATCH v3 7/8] platform/x86: x86-android-tablets: Add support for getting serdev-controller by PCI parent Hans de Goede
2024-12-04 20:42 ` [PATCH v3 8/8] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Hans de Goede
2024-12-10 14:03 ` [PATCH v3 0/8] " Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox