From patchwork Sat Nov 9 22:05:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13869716 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32AB019D88F for ; Sat, 9 Nov 2024 22:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189951; cv=none; b=BrjZMXn0k4CqV4uFuBeJxVpOzLgmc5o8lVRUKp6LZb2SEIdDJ57Ztazlk8/m9fkYbSkvOTICwwzGoGsBb6wvrfHwT4gkBgNJWJ4THL1R1JboVHiYkef/Wxycpqz0dUmUsGr5ORXEhXyWb5Lh+xW7n/IEyyXFs/ssijlSF4Oxh8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189951; c=relaxed/simple; bh=zbyvOeuzpkWx83tJxZNrwmX1xgN6hpHEOmdTTaXHsYc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E1tsC3CXatyNgsdCT17ynCd1gsvzOzDXbts+ZdLG5ntWTc04W1tPwNUkvVxiYMC80HsYkdEV/ua/sE11+vsQh1DcmizyGdUgpvldBz/dOXgbBJF0v7oCfzOf7kf/vsyLm7xsX/NVr59G/NfX40h3dOlFLR64m9h73DZ4qTk1AgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AS/UWeEI; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AS/UWeEI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731189947; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/U3rkr0xLacn0fq5NzkGGIhsy0/FLOUZHLufQSsY/vY=; b=AS/UWeEImkyHbVdhkg4EKj72rPP7kpWBZKtcdsJ7eIpAWRMIBCi/l6X3iUBIa9qDDkcjwS vxcGPtaSB5XyCSczzXznbrf4mHQk2/+zByeVSerC2ixT9U2L5Vk06WutXo9PN1D7dbyxKC 44hf83FJ9L/2GTuGpkzck2M4qwYLwak= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-snSpkW23OwS2SiqZkEdMLQ-1; Sat, 09 Nov 2024 17:05:44 -0500 X-MC-Unique: snSpkW23OwS2SiqZkEdMLQ-1 X-Mimecast-MFC-AGG-ID: snSpkW23OwS2SiqZkEdMLQ Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5A24A19540EF; Sat, 9 Nov 2024 22:05:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.21]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B8681953882; Sat, 9 Nov 2024 22:05:41 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Cc: Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH 1/5] platform/x86: serdev_helpers: Add get_serdev_controller_from_parent() helper Date: Sat, 9 Nov 2024 23:05:26 +0100 Message-ID: <20241109220530.83394-2-hdegoede@redhat.com> In-Reply-To: <20241109220530.83394-1-hdegoede@redhat.com> References: <20241109220530.83394-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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. Signed-off-by: Hans de Goede --- 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 bcf3a0c356ea..b592b9ff6d93 100644 --- a/drivers/platform/x86/serdev_helpers.h +++ b/drivers/platform/x86/serdev_helpers.h @@ -22,32 +22,14 @@ #include 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); +} From patchwork Sat Nov 9 22:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13869717 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32C0419D88F for ; Sat, 9 Nov 2024 22:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189953; cv=none; b=kvYvyUNTMp5qyDRoh91df5sboU66v0G63Ok6AjYOwroXFpy2HN7VkTEmGavWm+d2Y9Pv5GGLuqvO+64PVjmlEBwbMu3Mtox2IlJxUe9uUU/Jrk7vdG2bQoOMt6abyKIcN72SpeouddoZ70gtmFvW6yVCLbBjQfYXX0OAhuh9p0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189953; c=relaxed/simple; bh=csb59n64P97IasyyzROYGaymJ5eCXYvWjxKp70h+TvE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K7B9iZ4MgwnNOQmeaFeJwr0lEV6bYUdgmrMu0s5mTuI4nXxuJSVWUSL6jm0PqodxMcanFsiu4zaMJ1Wv73l47RG7Y69TAm2mYUdNiCCWRgX79VAngur6Co2pMAzUCwvAFMDq2YeraWMMvUmDvwwJlfiZOxDWdaMopivcMvfx4n8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=igJ7Frvj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="igJ7Frvj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731189951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v21oqqEKdEz80Z80MaiBwUV9KHZZ2uwiOAj41qLvPfk=; b=igJ7Frvjr1hBCIFE5GQl1q0S798Cv/JmHdHTAbLJYIzxmcFtLdb8Ph4UHj4h+xPug0wFN7 uEF+t36wImKOrFUkyY9L7hMJTqBByXJatw9b0FuONxeHLXTwlE+6UxzNr+qzkJOlGM4MVd FiV1Pg2qVErCWsiMagEy8QlKwvCTi9Y= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-624-dlk921z2M_GJ99saOeiZ6Q-1; Sat, 09 Nov 2024 17:05:46 -0500 X-MC-Unique: dlk921z2M_GJ99saOeiZ6Q-1 X-Mimecast-MFC-AGG-ID: dlk921z2M_GJ99saOeiZ6Q Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1AA3F19560A6; Sat, 9 Nov 2024 22:05:45 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.21]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BF1AF1956056; Sat, 9 Nov 2024 22:05:43 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Cc: Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH 2/5] platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*() Date: Sat, 9 Nov 2024 23:05:27 +0100 Message-ID: <20241109220530.83394-3-hdegoede@redhat.com> In-Reply-To: <20241109220530.83394-1-hdegoede@redhat.com> References: <20241109220530.83394-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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()") Signed-off-by: Hans de Goede --- 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; From patchwork Sat Nov 9 22:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13869718 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A24E19E97C for ; Sat, 9 Nov 2024 22:05:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189953; cv=none; b=rYcS3z2Zk91kG6PIz3P25DVJY8RVN+LA/IDXC2tKmV3bdL6GMAwKkg+RLcuJ6+MjIBSHy5Lm3WgyVZgR5gwMy3blO7yY7YKWrjMiA8nIyx8Y76A72KG8CN79/y9BJOd7QSlcBBSEVcW4SUVMixE89BawjjLw1rrJYRBV1ttrGps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189953; c=relaxed/simple; bh=rUeZhLLB1XEmvGMMQ+p7jcGYmp+FTfPxg0MLqRGNFSM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WsETOHJzBVHa/hSaz4BvJfCIEFdPpyrdaAcA/8eynI6q0y+DhpLBTVanCYpuvxNIulnpGl/yydAElxOiQeeG5VdwCskUlizmBv7UnVh5w3ygKSQaHV1Sp6qTa4ljwCULYJWhnR6DZJwCt704oWRB+Y3vkyLkUhn67itHwnqNnXE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CvZp7lMz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CvZp7lMz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731189951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SGB29OKQg97Sp8XtK7VuccgvoHOGWWp7nA1UaLumjhU=; b=CvZp7lMz1cBiJv5KibKH8ZjFFym/sMi3X9zbKg+7V1k5uJuD8ubTcymeGrAAosGxIGYerM r5FxuVYjcKIykBBDphxXiRHS0Imy1aZ359aJymwmzM/Bkvsfn6l0I+EZd5R1RLngIqOMcC fF3u0Z3sDdy8R8psxpC/gW4pJYBpoaI= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-2ItElI6qNpeGZnJg9NQ3pw-1; Sat, 09 Nov 2024 17:05:47 -0500 X-MC-Unique: 2ItElI6qNpeGZnJg9NQ3pw-1 X-Mimecast-MFC-AGG-ID: 2ItElI6qNpeGZnJg9NQ3pw Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CF8C81955F43; Sat, 9 Nov 2024 22:05:46 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.21]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8087B1956056; Sat, 9 Nov 2024 22:05:45 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Cc: Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH 3/5] platform/x86: x86-android-tablets: Change x86_instantiate_serdev() prototype Date: Sat, 9 Nov 2024 23:05:28 +0100 Message-ID: <20241109220530.83394-4-hdegoede@redhat.com> In-Reply-To: <20241109220530.83394-1-hdegoede@redhat.com> References: <20241109220530.83394-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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. Signed-off-by: Hans de Goede --- 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; From patchwork Sat Nov 9 22:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13869719 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8949E19E97C for ; Sat, 9 Nov 2024 22:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189956; cv=none; b=nhkuaZukXNxoNBqvHyAzorzDKUxHOrcp7qcTD2tFiQ02WE/JvDw1AXlwiitgz9yLpedYz+I0uciu+m1WM0fDfJezFF6RYhWcyOcsDZqYEsjvygqbNtX3mktZYHwsA1Wy9cHB96S4Elg/r+vXDWf5cQuw+XvMIVG73QuJHWavCY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189956; c=relaxed/simple; bh=FsezVi9lwWQ0kHJ/ANClkX0JdBCXcIzCmCWtks8nHLE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MlCY6asE7VqPri4/bV1c8dZDrXcmjA7hIGWwXnROi8Vp93OxWzFq42jppkrBJI9rz9gMNtXRKMSQnkceQ/FYaEHGFGtW0L0X9cQz3gJyZHYPElWHyQtVHZTuFYMNrIKjmeeBcCQD6M+fGViax+KvCYPRrs0xEzNIz00axAzb3gA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LUpbcRVe; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LUpbcRVe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731189953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S/Rys6gUkBVn8yEccKL39GiIokpWyRkhEE85j5Zwodo=; b=LUpbcRVexvQEUUFwk6BCjPG2BiJryGY/ta1t9+O9O/EWUUYGqlvLcD5a3h/BTngY8GENGK UfhnOKONgqyMdaCglc8O6dvLqIGHw1Q0gjaoV+0/9URcGR5H2hpc4BzpaK3+lXp8CDva+G r3FVwp+O3E2DWMB+WdSM6ivlQUCiPCY= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-201-r7CtkWhdMbmGeY9bNL49cA-1; Sat, 09 Nov 2024 17:05:49 -0500 X-MC-Unique: r7CtkWhdMbmGeY9bNL49cA-1 X-Mimecast-MFC-AGG-ID: r7CtkWhdMbmGeY9bNL49cA Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8FB9019560AE; Sat, 9 Nov 2024 22:05:48 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.21]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 401DA1956056; Sat, 9 Nov 2024 22:05:47 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Cc: Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH 4/5] platform/x86: x86-android-tablets: Add support for getting serdev-controller by PCI parent Date: Sat, 9 Nov 2024 23:05:29 +0100 Message-ID: <20241109220530.83394-5-hdegoede@redhat.com> In-Reply-To: <20241109220530.83394-1-hdegoede@redhat.com> References: <20241109220530.83394-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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. Signed-off-by: Hans de Goede --- .../platform/x86/x86-android-tablets/core.c | 22 ++++++++++++++++--- .../platform/x86/x86-android-tablets/other.c | 2 +- .../x86-android-tablets/x86-android-tablets.h | 6 ++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c index 800d6c84dced..4633a9560bd2 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_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_hid, info->ctrl_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_hid, info->ctrl_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 725948044da4..f5140d5ce61a 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 0fc7e8cff672..bab27fdcd873 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 { + /* For ACPI enumerated controllers */ const char *ctrl_hid; const char *ctrl_uid; + /* For PCI enumerated controllers */ + unsigned int ctrl_devfn; + /* Typically "serial0" */ const char *ctrl_devname; /* * ATM the serdev core only supports of or ACPI matching; and so far all @@ -91,7 +95,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, From patchwork Sat Nov 9 22:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13869720 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EACF1A0B12 for ; Sat, 9 Nov 2024 22:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189957; cv=none; b=EzhW1jTBL1nskZtr5CDUvmB39kL8YMyers+RUVHvi7RoxhlLLGPYOXvtQGM3k2kKkOLxUGjJWF5tJpGc97lJLJdM8t+9WlCpLI+C3T2zRuv2T9Hxekrm/E821PT68ea3u1Svx0/RJg5I1PjgOMZMLJ5N6iJothL5CJ+IZAeTbKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731189957; c=relaxed/simple; bh=wGjay0XXEHMMg1cHLWXT5TvMZj/O02jEoYIhxtlw5GM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z+fE/QngqoigpZvlU4OnkB41K/CnpLb8nkdMYC9AV+6jsqV+31qodvVrHd5A6oRvxLtYod8qh3OypsorSbfcABETS/QCvfpInhN9Ub9Z00QIMaFs9/S8/BxOYsFY7/Lp9EYaAcbCtIP7jOKcrmyB5Xm1ZIVfdmdAfxnmEiV4jd8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Ol/nAw+x; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ol/nAw+x" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731189954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eLsIBzB1nVrQ3HFXQrE9g9jpr/O8NrZg9Omehom/Mqo=; b=Ol/nAw+xAfyJOW7EarwAvUV7us7dWidhr2RWdTgmXQ3zhp1ZYYnmTtZi2Hm1s2QF+qGvgJ m0lE/gIOAaWN2+SyLCV2E53dNZf050mqogQ4qnlI97TrGuvShe+79sxUZoykWw3lakrQLE He+tPqU4/ozr9dDc+hjuNVpKzGrQCRE= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-ja_hyaE4PeecTY9yfMXw1w-1; Sat, 09 Nov 2024 17:05:51 -0500 X-MC-Unique: ja_hyaE4PeecTY9yfMXw1w-1 X-Mimecast-MFC-AGG-ID: ja_hyaE4PeecTY9yfMXw1w Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4DE8E1955EE9; Sat, 9 Nov 2024 22:05:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.21]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F2C801956056; Sat, 9 Nov 2024 22:05:48 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Cc: Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH 5/5] platform/x86: x86-android-tablets: Add Bluetooth support for Vexia EDU ATLA 10 Date: Sat, 9 Nov 2024 23:05:30 +0100 Message-ID: <20241109220530.83394-6-hdegoede@redhat.com> In-Reply-To: <20241109220530.83394-1-hdegoede@redhat.com> References: <20241109220530.83394-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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. Signed-off-by: Hans de Goede --- 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 f5140d5ce61a..9b8353dec7b6 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_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,