Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13304853rwl; Wed, 4 Jan 2023 06:26:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRE6/zd6AkmtyljEHtaJBVWCAk75Rti7gf4WOkXipsDWguAG3KDZQBV+xcG3/0Se/Q95wo X-Received: by 2002:a17:907:8312:b0:7c1:bb4:ea20 with SMTP id mq18-20020a170907831200b007c10bb4ea20mr39236321ejc.71.1672842416152; Wed, 04 Jan 2023 06:26:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672842416; cv=none; d=google.com; s=arc-20160816; b=imrXmjMwDgCNBiAdb3S4yK9z+ZQ2vL9oFktuIiUHxWAovfb3tlEzOseAOyspxkWsGs XXTV8zNt0bk65ftA+6gqC7VBQ0lxnku0B+QOD9Et3FgYYSg4BS42cz8ojeOaBFNhp1kV eLatQuwjbMsx41uOzVs31GYMsT1hluBgLPxgLhGuW7qgOooQk+JK3XjqYu/UI5hFy2dZ 3JvOFcSEN671L46961LzJwsafrSpqfpZ38kMhaGDfd02NE0JTEq4vuyfwVZGju8RJlwy Bo4qq6jCujklWDvWFlrRvlzwa+xav7aWJRGUYsTQOzHzw7BQqbYB91h5vPbd12p61csO l1XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GInMGnABfjC0QlvcYrq8TrKeuaCvr1m9DUS8iTssmEQ=; b=yBsxiI+OraSmdgd4LlLO3v3vwOHZLSJSR/cKh0B9XppTwLeOyfOXyeXhLlnrVjS7DC RM4jeHtUbjEFcGPfBkpQzgbo1KSFOwnqYZBxl8o1P6+OQj5dRa4Ojape3V1lp0sfWugX DMridWJcECnIbcQ79RVivow0MGFcp8k7GmZ3rQDGAN784kKVPvi96lqyKzmBoo3IhxkU IYEgsPtvx5NpfYgAaDPSYg57C/Dsn4WwAaY7NGKEOGqO6jA3ACS9n/+XLmxqUFsXcf/q uyZ27fo6rUiWwmBsDlBuRuvPClkjOrZAo6qc+ldkAK6NgO24yWQ88hE79AWMSt51x6d2 Xcyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XLTtOC0k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a170906844500b007763cc7093csi22729973ejy.884.2023.01.04.06.26.41; Wed, 04 Jan 2023 06:26:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XLTtOC0k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239108AbjADNmw (ORCPT + 57 others); Wed, 4 Jan 2023 08:42:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239490AbjADNgo (ORCPT ); Wed, 4 Jan 2023 08:36:44 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5A863AA93; Wed, 4 Jan 2023 05:34:41 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id qk9so82397832ejc.3; Wed, 04 Jan 2023 05:34:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GInMGnABfjC0QlvcYrq8TrKeuaCvr1m9DUS8iTssmEQ=; b=XLTtOC0knfQCVZH+146a2GWv96cOBiXw4Kew86LersRiG4TBuWhYpPL8u2d3k9X/91 MKj2y/a+eRaw/ywqHLmRN/4hGcf6UVyCjqGx8GPJqavZh38qdBZuUs87dmwAs4i7EIPv OjikbF0DkViJZh6W4k1IO+165SDL362Cb7hd8D0yqJBFI/8kL2RBHZRbqzo4MdnlgmUI ScEBrNkRyXyTG7qGxb4cP86auHWb1KTia2Rl+qYUTmDh0qQrPgubLatcNFkq2+cOsUAp VEodyP9+lUvEGRNb1btEjSM26lmeFmpaEhyvNo+nqdvH33i5Ve80RGR3Z3sLkhyzNhze I7+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GInMGnABfjC0QlvcYrq8TrKeuaCvr1m9DUS8iTssmEQ=; b=ZNgoe6B6zx+GqsTcAPfmckt5+y4FHcVdwP8RRyt5X90e+dCC53DawJ4y/mNg0qLHZK YdsUeHzUap/0N1BG9qu9XivFqWcicn28Up5maWx71MlHKQXjwmbq/mxXpXK/XejW/8KO zEKnngVUzCwdrs9UkfWuxr9nuurPuClx2vTIZxtqgAspyhYR6r59xy51FmPPxP/s1hMb oqK6/a5tfYETAri5Bp3InCzJ81EPBo2NdBUXXGX10T46QZRymJLFl6f3rdPmV7VtftqR sntUbI1aZ+hY+MedF+WhIkCHTd3T41vtM9NssMjKY9VdD3/F7eD3JfRoiXaS509uISWa TkHg== X-Gm-Message-State: AFqh2krVg8YJ715fmGueLZM9pm5myQ3LXPlKYqXzLoFd8tPbEXWhIhyd /JB+LUtX9Vulfsh0r6h5R2fYScT2sf+igg== X-Received: by 2002:a17:906:345a:b0:7c0:eb33:892a with SMTP id d26-20020a170906345a00b007c0eb33892amr37438113ejb.77.1672839270995; Wed, 04 Jan 2023 05:34:30 -0800 (PST) Received: from fedora.local.tbs-biometrics.cz (176-74-132-138.netdatacomm.cz. [176.74.132.138]) by smtp.gmail.com with ESMTPSA id sb20-20020a170906edd400b0073dbaeb50f6sm15211659ejb.169.2023.01.04.05.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 05:34:30 -0800 (PST) From: =?UTF-8?q?Martin=20Za=C5=A5ovi=C4=8D?= To: linux-kernel@vger.kernel.org Cc: devicetree@vger.kernel.org, mani@kernel.org, hemantk@codeaurora.org, quic_jhugo@quicinc.com, andersson@kernel.org, Michael.Srba@seznam.cz, arnd@arndb.de, dipenp@nvidia.com, bvanassche@acm.org, iwona.winiarska@intel.com, ogabbay@kernel.org, tzimmermann@suse.de, fmdefrancesco@gmail.com, jason.m.bills@linux.intel.com, jae.hyun.yoo@linux.intel.com, gregkh@linuxfoundation.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, =?UTF-8?q?Martin=20Za=C5=A5ovi=C4=8D?= Subject: [PATCH 0/3] Wiegand bus driver and GPIO controller driver Date: Wed, 4 Jan 2023 14:34:11 +0100 Message-Id: <20230104133414.39305-1-m.zatovic1@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I would like to thank everyone that commented on my last RFC, which made me realize the shortcuts in design I was making. I think I have finally understood the concept of how bus drivers operate and I have implemented a Wiegand bus driver. The driver now manages controllers and devices connected to them. It attaches drivers to Wiegand devices and provides an abstract API in "include/linux/wiegand.h". Most of the Wiegand bus driver code is inspired by the SPI bus driver written by David Brownell. I have also implemented a driver for Wiegand GPIO bit-banging. This driver gets the devicetree defined GPIO lines and sends Wiegand formatted data through them. I have also tested creating sample drivers for devices attached to the bus and working with them. CHANGELOG since RFCv3: - implemented a proper bus driver for controller and device allocation, devicetree probing and driver matching - Wiegand bus is now represented as Wiegand controller node in the devicetree - re-wrote the old version of GPIO bit-banging driver as a Wiegand controller - used standard units for devicetree attributes - removed global variables - tested unbinding of drivers and fixed memory leaks - created a Wiegand protocol sub-system - a folder "drivers/wiegand/" for Wiegand controller drivers I am not sure, whether this bus is complex enough to create a subsystem for, however I do believe that this is the way most buses do it. Martin Zaťovič (3): dt-bindings: add Wiegand controller dt-binding documentation bus: add Wiegand bus driver wiegand: add Wiegand GPIO bit-banged controller driver .../ABI/testing/sysfs-driver-wiegand-gpio | 17 + .../bindings/wiegand/wiegand-controller.yaml | 83 ++ MAINTAINERS | 9 + drivers/Kconfig | 2 + drivers/bus/Kconfig | 5 + drivers/bus/Makefile | 1 + drivers/bus/wiegand.c | 768 ++++++++++++++++++ drivers/wiegand/Kconfig | 8 + drivers/wiegand/Makefile | 1 + drivers/wiegand/wiegand-gpio.c | 471 +++++++++++ include/linux/wiegand.h | 228 ++++++ 11 files changed, 1593 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-wiegand-gpio create mode 100644 Documentation/devicetree/bindings/wiegand/wiegand-controller.yaml create mode 100644 drivers/bus/wiegand.c create mode 100644 drivers/wiegand/Kconfig create mode 100644 drivers/wiegand/Makefile create mode 100644 drivers/wiegand/wiegand-gpio.c create mode 100644 include/linux/wiegand.h -- 2.38.1