From patchwork Sat Jan 28 20:26:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kaehn X-Patchwork-Id: 13119950 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AA19C61DA7 for ; Sat, 28 Jan 2023 20:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234846AbjA1U0M (ORCPT ); Sat, 28 Jan 2023 15:26:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjA1U0L (ORCPT ); Sat, 28 Jan 2023 15:26:11 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C1411674; Sat, 28 Jan 2023 12:26:10 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id jr19so6973642qtb.7; Sat, 28 Jan 2023 12:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P38nkYr7bVSnQ/H/Vpc3pcdK//hX8r4owD23WxSwUuo=; b=NNf9FVXPbAUHEH9KozmU33JWehbHYV42nVd5M4EZVh+8BQs+/52obsYgTll6f2sdMK LtKzoColyFQbDbbA6NcNdn5PgMphnDZT4e7rZKvoxtVWtrvenP+gAdMcwMcOrawpTxNk u5HQJdgFiTA/Ub4kPxSBdRorj5D2RGiGcXrNl3CeyTtdQrOYjXC5Zz50ROTVYDk70AEM EMULEKqtukI3bAAfzmrUC/fC6QXoXguz/AUxa4ne1vwtPSrVuP1N1FKnGj1i3SOfr30y cF8e/WnBAo/0viPbUHBOMAyAaT/zx6+tIi+iRwo1aZrNrsnSh8UwNOreY3pCz2JwwM8G 6tWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P38nkYr7bVSnQ/H/Vpc3pcdK//hX8r4owD23WxSwUuo=; b=cPFgOPVEV47CN+W1aanc5kgykzxkicxT/wr8BIp7AUr/y3hm4WJ80m3T2Ym/tM6pyK EidhfpNj0l8/gLTvyddtwVtBjvLh9rZ1NRu+xpIp/YvOrwl/Mfq/fzlp54olRj6Jx9T5 WES4M3GIA7yrEV/dCSf+x+2vN6HmYsehwIKa3fjZ1dBfGYu+GhGgO/8K486+1grpP1K8 3CxbQkwoesQv98gTJ/W5d0+wbbwQl+AOcoMgDdh2jWgt29/tvwFQAfMRI0LVzCPjD/a6 vhwUY0uM+RdHxn0h2/FvTu5Kc4b4u/gSnupQI71cWYiIpjuNUfR3/w/ZJoZMcQvBSmr2 ucyw== X-Gm-Message-State: AO0yUKUpPmTrQdTd+4EXgSF2IOeeKuJN1h7+19j0i/RLlIMgQB07ABCY Z/3/gX6J+GwiYAwrAW3C5mY= X-Google-Smtp-Source: AK7set8DkI2a5r4UZYytvdX4PK6facivD7jG+1vWeFqaL7eN+vCtn5lkjBxPWh4l64BjIu/Ya6sqbg== X-Received: by 2002:ac8:7d41:0:b0:3b8:4b00:575e with SMTP id h1-20020ac87d41000000b003b84b00575emr3719625qtb.35.1674937569359; Sat, 28 Jan 2023 12:26:09 -0800 (PST) Received: from DANNY-DESKTOP.localdomain (071-013-243-092.res.spectrum.com. [71.13.243.92]) by smtp.gmail.com with ESMTPSA id q26-20020a05620a025a00b0071de2b6d439sm52460qkn.49.2023.01.28.12.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 12:26:09 -0800 (PST) From: Danny Kaehn To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, ethan.twardy@plexus.com Subject: [PATCH 1/4] dt-bindings: hid: Add CP2112 HID USB to SMBus Bridge Date: Sat, 28 Jan 2023 14:26:19 -0600 Message-Id: <20230128202622.12676-2-kaehndan@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com> References: <20230128202622.12676-1-kaehndan@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This is a USB HID device which includes an I2C controller and 8 GPIO pins. The binding allows describing the chip's gpio and i2c controller in DT using the subnodes named "gpio" and "i2c", respectively. This is intended to be used in configurations where the CP2112 is permanently connected in hardware. Signed-off-by: Danny Kaehn --- .../bindings/hid/silabs,cp2112.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/hid/silabs,cp2112.yaml diff --git a/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml new file mode 100644 index 000000000000..49287927c63f --- /dev/null +++ b/Documentation/devicetree/bindings/hid/silabs,cp2112.yaml @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hid/silabs,cp2112.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: CP2112 HID USB to SMBus/I2C Bridge + +maintainers: + - Danny Kaehn + +description: + This is a USB HID device which includes an I2C controller and 8 GPIO pins. + While USB devices typically aren't described in DeviceTree, doing so with the + CP2112 allows use of its i2c and gpio controllers with other DT nodes when + the chip is expected to be found on a USB port. + +properties: + compatible: + const: usb10c4,ea90 + reg: + maxItems: 1 + description: The USB port number on the host controller + i2c: + $ref: /schemas/i2c/i2c-controller.yaml# + gpio: + $ref: /schemas/gpio/gpio.yaml# + + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include + #include + + usb1 { + #address-cells = <1>; + #size-cells = <0>; + + usb@1 { + compatible = "usb424,2514"; + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + device@1 { /* CP2112 I2C Bridge */ + compatible = "usb10c4,ea90"; + reg = <1>; + + cp2112_i2c0: i2c { + #address-cells = <1>; + #size-cells = <0>; + /* Child I2C Devices can be described as normal here */ + temp@48 { + compatible = "national,lm75"; + reg = <0x48>; + }; + }; + + cp2112_gpio0: gpio { + gpio-controller; + interrupt-controller; + #gpio-cells = <2>; + gpio-line-names = + "TEST0", + "TEST1", + "TEST2", + "TEST3", + "TEST4", + "TEST5", + "TEST6", + "TEST7"; + }; + }; + }; + }; From patchwork Sat Jan 28 20:26:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kaehn X-Patchwork-Id: 13119952 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF43AC636BD for ; Sat, 28 Jan 2023 20:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234851AbjA1U0M (ORCPT ); Sat, 28 Jan 2023 15:26:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbjA1U0L (ORCPT ); Sat, 28 Jan 2023 15:26:11 -0500 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36945974E; Sat, 28 Jan 2023 12:26:11 -0800 (PST) Received: by mail-qt1-x82d.google.com with SMTP id g16so6999070qtu.2; Sat, 28 Jan 2023 12:26:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vxwJJG81TUrsdw3X7aHgdC1I62jcckROfzmxoyJojKQ=; b=URtavpQBA2/CY0XWdyBJ0v+t61xJy68CN0yky35YNb7oRu57C7nq4bz+/Z3XEmxKCy n8M56bgnBSBaVD643+JDLdCEu5pqG0veZ1/0UL2j+njHoXN5xJyIF0ko81TcFIVgdgtT rjSEZfQyD+DjItgz6OqkoBrrpF4+hRVmJaPr2E0PDCmzcT6pV3Ox7fAwGln+hrKQB/M4 rBrGzOOqN8TjaNl6i9G+3kmhz5518wvOA+e6LtpkZHrgzKB5zhHU3ybrS10dd6rpAtLN KdO16/1/89VbK8WlL5FsvmVtd9sd+4nuGc7EK40k4XcaaqXDkiaqBOCJFBLLXiUUtTph ZHkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vxwJJG81TUrsdw3X7aHgdC1I62jcckROfzmxoyJojKQ=; b=DtpUaSjdLvd7Kx6dXld2RZqu9C270PNpgeUUE/d/pcj+GEwQ3po2VP61awVIQmaFIT q779FTTB6iFEwnVexlKF1pGHRzn4dIKbvEQgqhUcpkvExdQJtTof/rGUbZ+ApXqTOnzy Tdiib6IuY8gM46Y07D+2s5YZbvjMysPfNDyT04oINCdW8hAce5zfW9Pk9BYi2WOmnw5M IGl3o+ImqeSmq3V+05owsW1yXxva9YqhfxnjMa2KH6QE3ow3zAb7Bd7Rdr2j03GUhYh4 fqoOnyINYA1xXh8Bd9+CQm3UErEn7Fjw8rGnDSfgzUgAKi+9ELK/NiwtsWL6pKkO9hUP 8OYQ== X-Gm-Message-State: AO0yUKXNzal6PFBkxHllIh4jBLE6mSj8DkoOLR5s+10umL86ux5dS1e5 bxBPOb6xEzfPJiyyFVx7v+U= X-Google-Smtp-Source: AK7set8Aig5lx3lr9IWnguPTAkqw3Yw6Iv6eicsQkUAkdzYNhORw1Eox/FQb54W7hduRHg8wDARBGw== X-Received: by 2002:ac8:5cc7:0:b0:3a5:977e:d05d with SMTP id s7-20020ac85cc7000000b003a5977ed05dmr5599574qta.52.1674937570222; Sat, 28 Jan 2023 12:26:10 -0800 (PST) Received: from DANNY-DESKTOP.localdomain (071-013-243-092.res.spectrum.com. [71.13.243.92]) by smtp.gmail.com with ESMTPSA id q26-20020a05620a025a00b0071de2b6d439sm52460qkn.49.2023.01.28.12.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 12:26:10 -0800 (PST) From: Danny Kaehn To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, ethan.twardy@plexus.com Subject: [PATCH 2/4] Share USB device devicetree node with child HID device Date: Sat, 28 Jan 2023 14:26:20 -0600 Message-Id: <20230128202622.12676-3-kaehndan@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com> References: <20230128202622.12676-1-kaehndan@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org USB HID core now shares its devicetree of_node with its child HID device. Since there can only be one HID device on a USB interface, it is redundant to specify a hid node under the USB device (and further, binding this way isn't currently possible, as hid_driver does not support of_match_table). Signed-off-by: Danny Kaehn --- drivers/hid/usbhid/hid-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index be4c731aaa65..b6c968af258f 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "usbhid.h" /* @@ -1369,6 +1370,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * hid->hiddev_report_event = hiddev_report_event; #endif hid->dev.parent = &intf->dev; + device_set_of_node_from_dev(&hid->dev, &intf->dev); hid->bus = BUS_USB; hid->vendor = le16_to_cpu(dev->descriptor.idVendor); hid->product = le16_to_cpu(dev->descriptor.idProduct); From patchwork Sat Jan 28 20:26:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kaehn X-Patchwork-Id: 13119951 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DFB4C636CC for ; Sat, 28 Jan 2023 20:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234860AbjA1U0O (ORCPT ); Sat, 28 Jan 2023 15:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234854AbjA1U0N (ORCPT ); Sat, 28 Jan 2023 15:26:13 -0500 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40EC9974E; Sat, 28 Jan 2023 12:26:12 -0800 (PST) Received: by mail-qt1-x82d.google.com with SMTP id jr19so6973701qtb.7; Sat, 28 Jan 2023 12:26:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oAYdJzzeTeXOhvH5ct62NBOgopLWCsTH7OnUSEt6qQ0=; b=GKIuk772QE2v02yt/wXoHqaULN88l0wbCXkSj5HiRTiWU44xg17i8yzXajuWZ01kwk LSN2W7LO6PdYHlw8mv5PXfN7w6Yfav3OsybJydBLWJUoMugen80QfqBTawNelrRJVDJW Kui2FyexGUwGMX9DtQjppzKkEwAK/03+ka8e+Fcn3J7bZ9fBVORirKsCA5/vWi3PrBkZ 9Xbl0ct8GMfETX71O9tjYvCEIHHiEU/DwfbKcArMQdnAe8ru4BRjrvxuaa8IHwbBvth6 l/8Ifw5vePJlgs/4L04yo7Ye6yZ1AoW1fILs9PHR8XcqcSEqjgXG26Qv9jmlisxEYGoo erqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oAYdJzzeTeXOhvH5ct62NBOgopLWCsTH7OnUSEt6qQ0=; b=d9PasDmuCfGaV3w3/3ApKGsgVDArQ0uI5J6d7FvudkzKIv47MWGTBD2/dqG4r2O2GR BshH7byVWAtUWbE64omPPn6I+mVVD2M1XMrT2mZYNYT1wAsgAzq8kSKXhiAxe/s42ZAU f5w4VsCPEbo/AWia7Md4xqEx5snZVQw6hoEtWX3BBfX/e2p1tz5IYE0745Ajhe3p48uu 4Sx1vT78ZIN9iN2dRbGTIcB6FNjJ7RBS3z/WxRNxbJToQGoVb0zah5NHzUVocAyxpEl9 QK4DMTKA6myVNKenwZ/mNZVMqZn2iPdBDizN5EaZksl1b3Ki0AEnFHWddU8jozv1gtay rLow== X-Gm-Message-State: AFqh2krNSgvyo2so6T8YtSC06h51H5vai+XtmrEtR420XpbRzu+FD6rj z/S8izE9rAXpKQn78qUlc3yxSHGx89gcc30L X-Google-Smtp-Source: AMrXdXsvYLogNEoYbs8voafCF7oSyNjF4f2/cY6lecilaEdFI+OOGCB5jsjsPj875IrhELv0UdRVVg== X-Received: by 2002:a05:622a:2298:b0:3b6:2ff8:3009 with SMTP id ay24-20020a05622a229800b003b62ff83009mr64180996qtb.2.1674937571216; Sat, 28 Jan 2023 12:26:11 -0800 (PST) Received: from DANNY-DESKTOP.localdomain (071-013-243-092.res.spectrum.com. [71.13.243.92]) by smtp.gmail.com with ESMTPSA id q26-20020a05620a025a00b0071de2b6d439sm52460qkn.49.2023.01.28.12.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 12:26:10 -0800 (PST) From: Danny Kaehn To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, ethan.twardy@plexus.com Subject: [PATCH 3/4] Fix CP2112 driver not registering GPIO IRQ chip as threaded Date: Sat, 28 Jan 2023 14:26:21 -0600 Message-Id: <20230128202622.12676-4-kaehndan@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com> References: <20230128202622.12676-1-kaehndan@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The CP2112 generates interrupts from a polling routine on a thread, and can only support threaded interrupts. This patch configures the gpiochip irq chip with this flag, disallowing consumers to request a hard IRQ from this driver, which resulted in a segfault previously. Signed-off-by: Danny Kaehn --- drivers/hid/hid-cp2112.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 1e16b0fa310d..27cadadda7c9 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -1354,6 +1354,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) girq->parents = NULL; girq->default_type = IRQ_TYPE_NONE; girq->handler = handle_simple_irq; + girq->threaded = true; ret = gpiochip_add_data(&dev->gc, dev); if (ret < 0) { From patchwork Sat Jan 28 20:26:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kaehn X-Patchwork-Id: 13119953 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E655C636D0 for ; Sat, 28 Jan 2023 20:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234862AbjA1U0P (ORCPT ); Sat, 28 Jan 2023 15:26:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234861AbjA1U0O (ORCPT ); Sat, 28 Jan 2023 15:26:14 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 516F123C5A; Sat, 28 Jan 2023 12:26:13 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id j9so6383408qvt.0; Sat, 28 Jan 2023 12:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zjpzg4TvvF5ijVNt6jTclmaBmB/Tsf6MP2Z3c8TENhI=; b=L/DPCADetPtg/QOsFtQGtyT/6BINpDgO0UaDCPp8TmailR5OaD5/T50cVJLpExhZYO bNjt9z/UstDx/4TLi18brrZASVSgmW1SSWSRCfrPPxFu+5jWD/3dUpmQddzmMHPtUvih CaX1VcvKPTUe0s0dshF+oVMqzbqi59IB8k8Re4dVjQ+j9PUI/bz4Oxs8eYOQhg8QEHM5 eLz8MhndtIAc14wBjN8A+BhfHOud87OLJgDjjqJiBlMhctPnVsEt2eTXcC+hnvVCPYL4 FXQgUbQiM6PbpscJ0EOrAK8532Bz+ucvWmN6zFLVbKkkuGmSlReqCBhTy4yX3du99HRf eXmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zjpzg4TvvF5ijVNt6jTclmaBmB/Tsf6MP2Z3c8TENhI=; b=0k85Wr7ALyJCUwSF5xXQgYRyJzVb3gRxTehTamEGVlV/kiZxy7H28TNboAOIR5hMdY Si3GaDj6wDjbJe/7Aa6chVi5wYhHm2eDrbxyY4iqP5mneKMHcnkptKf2Uv7pyvpMO+2f fQdwzmRsLvRxZU0EWmXRqDFa+TpIRWIjYUGS+R8oQYimFTRl5vuS0DkiMEL2kRBWnfI+ cSfba6irFTYqcAS9rzYHBisBB+1X3aUYF9OHE8b7PKEt4drqyWCc8YmkvgLzRwkhKf0E eepM6+agL6U4ZvYqumyp0P0HbFkbSwd+9KN4J28/tduVnMT5NP1JBtzXKNlBDeJsHcn2 3a8A== X-Gm-Message-State: AO0yUKVlYHCyUcyPijjZLGHgYh88fEP4PV7C5Kb2VQaCtlQ4jOtoOCuK H0NN5rHIpHb6409ZE6uFbC0= X-Google-Smtp-Source: AK7set8wV8BbmblBu4kZSfSb7TtOUKCx68BYFiscFflITiIB+fD0v5vh/46Xbi9HkV9PIG4x2rsn0A== X-Received: by 2002:a05:6214:1712:b0:537:ab77:fbd9 with SMTP id db18-20020a056214171200b00537ab77fbd9mr13570652qvb.28.1674937572300; Sat, 28 Jan 2023 12:26:12 -0800 (PST) Received: from DANNY-DESKTOP.localdomain (071-013-243-092.res.spectrum.com. [71.13.243.92]) by smtp.gmail.com with ESMTPSA id q26-20020a05620a025a00b0071de2b6d439sm52460qkn.49.2023.01.28.12.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 12:26:12 -0800 (PST) From: Danny Kaehn To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, ethan.twardy@plexus.com Subject: [PATCH 4/4] CP2112 Devicetree Support Date: Sat, 28 Jan 2023 14:26:22 -0600 Message-Id: <20230128202622.12676-5-kaehndan@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230128202622.12676-1-kaehndan@gmail.com> References: <20230128202622.12676-1-kaehndan@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Bind i2c and gpio interfaces to subnodes with names "i2c" and "gpio" if they exist, respectively. This allows the gpio and i2c controllers to be described in DT as usual. Signed-off-by: Danny Kaehn --- drivers/hid/hid-cp2112.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 27cadadda7c9..99e8043e1c34 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -1310,6 +1310,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) dev->adap.algo = &smbus_algorithm; dev->adap.algo_data = dev; dev->adap.dev.parent = &hdev->dev; + dev->adap.dev.of_node = of_get_child_by_name(hdev->dev.of_node, "i2c"); snprintf(dev->adap.name, sizeof(dev->adap.name), "CP2112 SMBus Bridge on hidraw%d", ((struct hidraw *)hdev->hidraw)->minor); @@ -1336,6 +1337,9 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) dev->gc.ngpio = 8; dev->gc.can_sleep = 1; dev->gc.parent = &hdev->dev; +#if defined(CONFIG_OF_GPIO) + dev->gc.of_node = of_get_child_by_name(hdev->dev.of_node, "gpio"); +#endif dev->irq.name = "cp2112-gpio"; dev->irq.irq_startup = cp2112_gpio_irq_startup; @@ -1391,6 +1395,11 @@ static void cp2112_remove(struct hid_device *hdev) struct cp2112_device *dev = hid_get_drvdata(hdev); int i; + of_node_put(dev->adap.dev.of_node); +#if defined(CONFIG_OF_GPIO) + of_node_put(dev->gc.of_node); +#endif + sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group); i2c_del_adapter(&dev->adap);