Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2310008imm; Wed, 16 May 2018 10:52:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqjciDhPXCACQvdw64NN0Vx4VnvZ5RmmAH0QkURzvzZcvDO6aHotn4RwPdILfz+gDtHP0EQ X-Received: by 2002:a65:65d5:: with SMTP id y21-v6mr1435231pgv.277.1526493148764; Wed, 16 May 2018 10:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526493148; cv=none; d=google.com; s=arc-20160816; b=mCr9NgvrdfVKAiuHWrZ+hR03lzOY1RJOOc5vz8ipwfSjW3fQPKvNK3dWUc4vN76bpY BKCKI22AgJkgFPKeLYpn1mVXRQs4dTKdsOj0VZsEmAx5rI2j4BSFkKAn0uAkbICPzlcq UsxzBtOJfum0W8yc0vZAj/SsAfhIKJ2Ll80KdiWtJe7amHqmNHVcKHEWOYPWLnzASgjL M5/cqguDMykYZsfoTxJz/Gl9zxUW5h6zVWSzVQ9X5Z2Yp61hV9AmtoWJ+1s6X36Z1ytD 9Akjazhe5RFAdwwAeGr6PBdY4lrF+T2emmNTzzO/tm9CCfMK2kvXoeNRLDuOifd4N66K r+bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ayJqoRiyOWp3D3wkiC7PxLvrQlN3G7X8v+vRiBBvnTg=; b=gCh87eoFE5752YO8PqGji1jZfFA9YcvhmC0fQML3dWhV2MD1vfJCEIZaTiLlV3cKbK eF7LdulomwGWB0weA0oDjwxLbnbaFHEDgKxCdhjNQw4ZTN1r56EFqxoYz/MAAjyR9H9C /ISFAqNifWvxgVFsBhInvmJqEG0nLzlAb5bWw7Z7BFTRphu8jqdcX9+AEJoby9aEeUes z27bTCHJpm04Vl4uZew2uwk7Koey65NJiz+OKV8EnFaBfrJ/d0SkhHybwfgD1kgE4/vi kvYPP6G0WD8SWFuCjy/gza+g6IRk57ntAwjJbgQfmO2QqCIcyW23Id0jV2WtmE6Q2FQB L2LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XtFwsq3C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w68-v6si3225527pfk.14.2018.05.16.10.52.14; Wed, 16 May 2018 10:52:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XtFwsq3C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751620AbeEPRum (ORCPT + 99 others); Wed, 16 May 2018 13:50:42 -0400 Received: from mail-yb0-f194.google.com ([209.85.213.194]:44142 "EHLO mail-yb0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbeEPRuj (ORCPT ); Wed, 16 May 2018 13:50:39 -0400 Received: by mail-yb0-f194.google.com with SMTP id m127-v6so550405ybm.11; Wed, 16 May 2018 10:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ayJqoRiyOWp3D3wkiC7PxLvrQlN3G7X8v+vRiBBvnTg=; b=XtFwsq3CL72t4uCZ6SGYAL4oFEBuVLA6ckOYeKy+MHCwQrU3AR0ERN2EdyU2oGhdd+ MOMyZRMrbznMUOIfa69iq8T1e2GQ50rUitQm0K9o6x+o9AhXNlOWUlEk9iRDLgWuZb2s y51BAECNSD3a2onpCmLSViMAWM5qBcQ8Vh//lj7F1GqhkSCiET1k2cJE3biabZNTrN3g RXwByXG1IYtqz8jMBtaAhuFSoTHV5OhyaAujCzHGr+kPkFna8sTGc8kQGafHMUOi/4+N Mg0qKvlWLZEj9hTwJJbPWh1LyE3Bc7gD6TimfJmM64x4G7NbHHuoSSG0ZZi6wCUJrHgB VNGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ayJqoRiyOWp3D3wkiC7PxLvrQlN3G7X8v+vRiBBvnTg=; b=gAq3+z9B31L9bQQXzF2TSwUYCa0iUOKZ8a66tSjmOkNqxPVQzd82e+C+NlBt4Oh7VP ifb87gQx49JvhB+1IFLvip6oTdkt088ZM4DfLdb23IvpCnNAX6hyY4aQln10oWBvChGy 2QMNyEWYiC0R6iiXXL1OwuzlW+E+5KVFx8cLQdITkYzyio48JYRZtWBBpOEMkhJmbbmM 6WaerhQDNZrUEAoHg5tBfNd1UFDmhaBrjw5x1Ibg+iOlsmw8f8Ebj/1EAAnZ8KenaJZD UweW8tfLxkqKQ5tNmyFcv7RZfR/ozOG+dxG8tLStK3jTJX+VjGo7Ybxnu0qyxI0VGIY2 Qi4w== X-Gm-Message-State: ALKqPwcpQ9C2/dhV/tn2+Kktm6co4/XF0s50U8ZSbroE7U5rhN2W7QWN JPyW1GrFdEWn6bSAVlhnHBgl5A== X-Received: by 2002:a25:b707:: with SMTP id t7-v6mr1058061ybj.359.1526493038741; Wed, 16 May 2018 10:50:38 -0700 (PDT) Received: from localhost ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id q40-v6sm1132005ywa.7.2018.05.16.10.50.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 10:50:38 -0700 (PDT) From: William Breathitt Gray To: jic23@kernel.org Cc: benjamin.gaignard@st.com, fabrice.gasnier@st.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, William Breathitt Gray Subject: [PATCH v6 0/9] Introduce the Counter subsystem Date: Wed, 16 May 2018 13:50:10 -0400 Message-Id: X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This revision is primarily a code refactor and formatting cleanup -- the interface has remained essentially the same as revision 5, with some minor additions. Here's a brief summary of the Generic Counter interface and related code changes in this revision: * checkpatch.pl formatting suggestions implemented (parameters line up with opening round bracket, etc.) * Implement struct counter_ops to enable const structure for driver callbacks * Provide const string array for count_direction and count_mode options to help maintain a consistent interface * Reduce local variables by inlining where appropriate * Bring memory cleanup code closer to respective allocations for clarity and easier debugging * Implement counter_name_attribute_create function to reduce repeated code for various "name" attributes * Implement counter_global_attr_register function to organize global counter attribute registration together * Implement prepare_counter_device_groups_list and prepare_counter_device_groups functions to organize sysfs attribute configuration into logical groups (this makes the counter_register function logic much easier to follow) Furthermore, the following additions have been made: * The "ceiling" and "floor" attributes are defined to represent the upper limit and lower limit respectively for a Count * The following attributes are now part of the main Generic Counter interface: count_mode, direction, enable, preset, preset_enable, and error_noise * The "Quadrature x1" and "Quadrature x2" function modes are now known as "Quadrature x1 A" and "Quadrature x2 A" respectively * The following new function modes are defined in order to support the STM32 LP Timer quadrature modes: Quadrature x1 B, Quadrature x2 B, Quadrature x2 Rising, and Quadrature x2 Falling * The "num_counts" and "num_signals" attributes are defined to represent the total number of Counts and total number of Signals respectively The 104-QUAD-8 counter driver has been updated to make use of the Generic Counter API changes ("ceiling" and "floor" attributes, constant counter_ops structure, count_mode and direction string arrays, etc.). The STM32 Timer counter driver has been updated to make use of the Generic Counter API changes ("ceiling" attribute, constant counter_ops structure, etc.). In addition, Fabrice Gasnier added support for a missing encoder mode (see STM32_COUNT_ENCODER_MODE_2). Proper Generic Counter interface support for the STM32 LP Timer has been added to its respective counter driver. This is the last in-tree Linux kernel driver using the deprecated IIO Counter interface, so we can safely remove that interface in the future now. I've added deprecation notices to the IIO Counter attributes to encourage the switch to the Generic Counter interface. I didn't mention a removal date for the relevant code, but perhaps before the next longterm kernel release would be a good idea -- this should prevent the IIO Counter API from persisting longer than necessary. William Breathitt Gray Benjamin Gaignard (2): dt-bindings: counter: Document stm32 quadrature encoder counter: Add STM32 Timer quadrature encoder Fabrice Gasnier (1): counter: stm32-lptimer: add counter device William Breathitt Gray (6): counter: Introduce the Generic Counter interface counter: Documentation: Add Generic Counter sysfs documentation docs: Add Generic Counter interface documentation counter: 104-quad-8: Add Generic Counter interface support counter: 104-quad-8: Documentation: Add Generic Counter sysfs documentation iio: counter: Remove IIO counter subdirectory Documentation/ABI/testing/sysfs-bus-counter | 241 +++ .../ABI/testing/sysfs-bus-counter-104-quad-8 | 36 + Documentation/ABI/testing/sysfs-bus-iio | 8 + .../testing/sysfs-bus-iio-counter-104-quad-8 | 16 + .../{iio => }/counter/stm32-lptimer-cnt.txt | 0 .../bindings/counter/stm32-timer-cnt.txt | 26 + .../devicetree/bindings/mfd/stm32-lptimer.txt | 2 +- .../devicetree/bindings/mfd/stm32-timers.txt | 7 + Documentation/driver-api/generic-counter.rst | 336 ++++ Documentation/driver-api/index.rst | 1 + MAINTAINERS | 14 +- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/counter/104-quad-8.c | 1335 ++++++++++++++ drivers/counter/Kconfig | 59 + drivers/{iio => }/counter/Makefile | 6 +- drivers/counter/generic-counter.c | 1541 +++++++++++++++++ drivers/counter/stm32-lptimer-cnt.c | 722 ++++++++ drivers/counter/stm32-timer-cnt.c | 390 +++++ drivers/iio/Kconfig | 1 - drivers/iio/Makefile | 1 - drivers/iio/counter/104-quad-8.c | 596 ------- drivers/iio/counter/Kconfig | 34 - drivers/iio/counter/stm32-lptimer-cnt.c | 382 ---- include/linux/counter.h | 554 ++++++ 25 files changed, 5293 insertions(+), 1018 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-counter create mode 100644 Documentation/ABI/testing/sysfs-bus-counter-104-quad-8 rename Documentation/devicetree/bindings/{iio => }/counter/stm32-lptimer-cnt.txt (100%) create mode 100644 Documentation/devicetree/bindings/counter/stm32-timer-cnt.txt create mode 100644 Documentation/driver-api/generic-counter.rst create mode 100644 drivers/counter/104-quad-8.c create mode 100644 drivers/counter/Kconfig rename drivers/{iio => }/counter/Makefile (52%) create mode 100644 drivers/counter/generic-counter.c create mode 100644 drivers/counter/stm32-lptimer-cnt.c create mode 100644 drivers/counter/stm32-timer-cnt.c delete mode 100644 drivers/iio/counter/104-quad-8.c delete mode 100644 drivers/iio/counter/Kconfig delete mode 100644 drivers/iio/counter/stm32-lptimer-cnt.c create mode 100644 include/linux/counter.h -- 2.17.0