From patchwork Mon Dec 19 12:42:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 635863 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 33DBAC10F1B for ; Mon, 19 Dec 2022 12:42:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231859AbiLSMmY (ORCPT ); Mon, 19 Dec 2022 07:42:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231857AbiLSMmX (ORCPT ); Mon, 19 Dec 2022 07:42:23 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9727E00F; Mon, 19 Dec 2022 04:42:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671453742; x=1702989742; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dlPPnlNjLJmioznly2ozXS6UiYy5/U2w53JSKTh6byQ=; b=MTke11rjUmg1NYxPOodI0QenntzWaH1bWsWXYNxYxytFKAVaAfatxk+5 LEw/ZipU0fqn6VdROPZCsPN4zJzzV2uwEJ40hqyh4R91NDXUiuAMkUmO/ oF2/YguZVaC1HjtuZMDWR8h/RF3/kRFdUrw4fC0CcWNaWff9AqJXGiN/F ULCPC18hJs75q439iamYugtM7yZg9P1MzvXFnkq7JYEuCe2UyWGVD11rq aIpWG9iBLv2zpzW7WTSg/kDOWawGtej2w+5HCzNTVcAYzKPlbIU+/Ov8+ rd9Wfx3chOg4cN3CaMI/cZpenssVgd3sq2Pa3L7M3zW1SGa1GzhmEvR18 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="320510332" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="320510332" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 04:42:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="681210329" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="681210329" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 19 Dec 2022 04:42:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id BBD87F7; Mon, 19 Dec 2022 14:42:49 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v1 1/8] pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro Date: Mon, 19 Dec 2022 14:42:33 +0200 Message-Id: <20221219124240.62781-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are many pin control drivers define their own data type for pin function representation which is the same or embed the same data as newly introduced one. Provide the data type and convenient macro for all pin control drivers. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- include/linux/pinctrl/pinctrl.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index a0d39b303431..4d252ea00ed1 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h @@ -206,6 +206,26 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev, const char *pin_group, const unsigned **pins, unsigned *num_pins); +/** + * struct pinfunction - Description about a function + * @name: Name of the function + * @groups: An array of groups for this function + * @ngroups: Number of groups in @groups + */ +struct pinfunction { + const char *name; + const char * const *groups; + size_t ngroups; +}; + +/* Convenience macro to define a single named pinfunction */ +#define PINCTRL_PINFUNCTION(_name, _groups, _ngroups) \ +(struct pinfunction) { \ + .name = (_name), \ + .groups = (_groups), \ + .ngroups = (_ngroups), \ + } + #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL) extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np); #else