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: 648356 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: 648355 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);