From patchwork Mon Aug 14 06:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 135160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2562489vqi; Sun, 13 Aug 2023 23:53:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvNreBJxHHCCqlLBsLi9b9zqC4IzfNRjmCVevWKAyTEesCd0TsaJwtL5pTPm3xljABkLvC X-Received: by 2002:a05:6a00:2283:b0:687:570c:da2d with SMTP id f3-20020a056a00228300b00687570cda2dmr11664037pfe.12.1691995996193; Sun, 13 Aug 2023 23:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691995996; cv=none; d=google.com; s=arc-20160816; b=1AfYsbAcDoW1nPaXJb8q1PjaoWRyizNnU2uBJs5OuXuFsWy9EnrlzQoFsJL42ZGq4u GZu6+/lxSbxLwhPWkb4b9nqQ/czlA5OttrBz+RLlyunvw5BJQ/tiW1Q9eGD7QQwbgzAa wDz2DhglGiY17pmgdaAgWnT+YV7z630LJvgwd7WRvrSJQMaUlDqjcp0dktOt9j8aGdZu RZgalVIKBawyngZ3S2bRMITUjKqm2OQYHeok8SVDLGpKf8xoqaDOQQhXG6OePFVoInci M+JjrGrFP3D97me7t3kMhZPyQibB+o4489i5DySY+Ndfgv2MR4VOoZyNU0tgTb13DCrZ kinA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=3YJ60J94nw/GB/E1rzoCGOr8gKvyXuHr0ZUN3J6VaPM=; fh=ITb4zGKkWO3T0WmJnSV0Z0twUZ/f73yiIOUT0grFSAs=; b=YTD0HJnOgFABACZG8pqMo7jGOQ4kVCxzETpsKx0QVR9bMDWtq3g4OMlq/tqCme2Q4x Es47s7+MkUt4f4G4iI/y3f9liWd6Ag/Ys4WzlX7/4BwTLXlh1pBqCZssdwYUJ4T54+jA sI+sLyH1O3cCoqjrlvFLmwcTBviqbQ83gM5m7fo5MmQUnaTZWU7V3qwSWrYFT9d4Koz1 sky2J7S9GGpXn8Ms6RtO4cRaTKdrsjFluEy6gMymHBQh3xBbb0FwcZYseSIxJWPUeYtN ndizI7Bw96oKduCK6Uf0zLDi14/tJVkCljWfT+Z9ORBb+wSEO+c7vSQPp26udWZVpuiq UJGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gPiLoIRT; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i129-20020a636d87000000b0054f93b261cfsi7647170pgc.88.2023.08.13.23.53.02; Sun, 13 Aug 2023 23:53:16 -0700 (PDT) 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=@intel.com header.s=Intel header.b=gPiLoIRT; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233477AbjHNGES (ORCPT + 99 others); Mon, 14 Aug 2023 02:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233197AbjHNGEG (ORCPT ); Mon, 14 Aug 2023 02:04:06 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4653129; Sun, 13 Aug 2023 23:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691993045; x=1723529045; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=zMDA+didh0MVfZqHCFkYIlUXtN0gsB/nuvcifkiqleI=; b=gPiLoIRTnhVEFIyyy26o4enRWplUVyJqrqJaUJfS31HOjISVIv4WsIdS 9+8DjRtWr8DSE3vdqJDXurFNfm2nW8xxwIrwU9t6GPuBc06h8WT11wYB7 Xm4SFCwLUHw0J/x6SVnXDkjvXa56skQ+VL1FddE8egwER/7ugL8k44qSG nJLkNMNbBJFj8rMhrtWNjAse8H7udac4aWsYvfWtzypRtpbxnA3/KqpQ1 NKy9K5URmJN+liuZ9b7asTqR7FAIxeO0sVOm2seG/ttsn28ZjR9mlzqQw BUI5gt6kW+5m1iOzKvEZgEtCIUg8qa0BrR83THpFKkuA6wx23GmS2mM1M w==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="371970750" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="371970750" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 23:04:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="798702908" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="798702908" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga008.fm.intel.com with ESMTP; 13 Aug 2023 23:04:03 -0700 From: Raag Jadav To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com, Raag Jadav Subject: [PATCH v1 1/4] pinctrl: intel: export common pinctrl functions Date: Mon, 14 Aug 2023 11:33:08 +0530 Message-Id: <20230814060311.15945-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230814060311.15945-1-raag.jadav@intel.com> References: <20230814060311.15945-1-raag.jadav@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774186393819127711 X-GMAIL-MSGID: 1774186393819127711 Export common pinctrl functions that are used across Intel specific platform drivers, so that they can be reused. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-intel.c | 30 ++++++++++++++------------- drivers/pinctrl/intel/pinctrl-intel.h | 12 +++++++++++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 64c3e62b4348..4e019c2cb27a 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -107,8 +107,7 @@ struct intel_community_context { #define pin_to_padno(c, p) ((p) - (c)->pin_base) #define padgroup_offset(g, p) ((p) - (g)->base) -static struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, - unsigned int pin) +struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin) { struct intel_community *community; int i; @@ -123,6 +122,7 @@ static struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, dev_warn(pctrl->dev, "failed to find community for pin %u\n", pin); return NULL; } +EXPORT_SYMBOL_NS_GPL(intel_get_community, PINCTRL_INTEL); static const struct intel_padgroup * intel_community_get_padgroup(const struct intel_community *community, @@ -276,23 +276,24 @@ static bool intel_pad_usable(struct intel_pinctrl *pctrl, unsigned int pin) return intel_pad_owned_by_host(pctrl, pin) && intel_pad_is_unlocked(pctrl, pin); } -static int intel_get_groups_count(struct pinctrl_dev *pctldev) +int intel_get_groups_count(struct pinctrl_dev *pctldev) { struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); return pctrl->soc->ngroups; } +EXPORT_SYMBOL_NS_GPL(intel_get_groups_count, PINCTRL_INTEL); -static const char *intel_get_group_name(struct pinctrl_dev *pctldev, - unsigned int group) +const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group) { struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); return pctrl->soc->groups[group].grp.name; } +EXPORT_SYMBOL_NS_GPL(intel_get_group_name, PINCTRL_INTEL); -static int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group, - const unsigned int **pins, unsigned int *npins) +int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group, + const unsigned int **pins, unsigned int *npins) { struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); @@ -300,6 +301,7 @@ static int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group, *npins = pctrl->soc->groups[group].grp.npins; return 0; } +EXPORT_SYMBOL_NS_GPL(intel_get_group_pins, PINCTRL_INTEL); static void intel_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, unsigned int pin) @@ -359,25 +361,24 @@ static const struct pinctrl_ops intel_pinctrl_ops = { .pin_dbg_show = intel_pin_dbg_show, }; -static int intel_get_functions_count(struct pinctrl_dev *pctldev) +int intel_get_functions_count(struct pinctrl_dev *pctldev) { struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); return pctrl->soc->nfunctions; } +EXPORT_SYMBOL_NS_GPL(intel_get_functions_count, PINCTRL_INTEL); -static const char *intel_get_function_name(struct pinctrl_dev *pctldev, - unsigned int function) +const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function) { struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); return pctrl->soc->functions[function].func.name; } +EXPORT_SYMBOL_NS_GPL(intel_get_function_name, PINCTRL_INTEL); -static int intel_get_function_groups(struct pinctrl_dev *pctldev, - unsigned int function, - const char * const **groups, - unsigned int * const ngroups) +int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function, + const char * const **groups, unsigned int * const ngroups) { struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); @@ -385,6 +386,7 @@ static int intel_get_function_groups(struct pinctrl_dev *pctldev, *ngroups = pctrl->soc->functions[function].func.ngroups; return 0; } +EXPORT_SYMBOL_NS_GPL(intel_get_function_groups, PINCTRL_INTEL); static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, unsigned int group) diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h index 1faf2ada480a..cee512f97b56 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.h +++ b/drivers/pinctrl/intel/pinctrl-intel.h @@ -266,4 +266,16 @@ const struct dev_pm_ops _name = { \ intel_pinctrl_resume_noirq) \ } +struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin); + +int intel_get_groups_count(struct pinctrl_dev *pctldev); +const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group); +int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group, + const unsigned int **pins, unsigned int *npins); + +int intel_get_functions_count(struct pinctrl_dev *pctldev); +const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function); +int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function, + const char * const **groups, unsigned int * const ngroups); + #endif /* PINCTRL_INTEL_H */ From patchwork Mon Aug 14 06:03:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 135183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2580046vqi; Mon, 14 Aug 2023 00:38:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGb2mtOdAo8b8k8o87Yz7wuh0Gh885Jlpxf1ioO3/ev5CQ+pFpdOn9LmkiKDive/hrVElo7 X-Received: by 2002:a17:902:c1c4:b0:1bb:9bc8:d22d with SMTP id c4-20020a170902c1c400b001bb9bc8d22dmr7319665plc.16.1691998694869; Mon, 14 Aug 2023 00:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691998694; cv=none; d=google.com; s=arc-20160816; b=LSBi1dLN8wkOgz6XbM3Mcv6eTFH5KJ/ydQjgVKuKwwo4CsMqd0aWHECORWR/pOtNhN 8d5ioywKiKdC71vI05EPlphronxp3CsJJCWOt4qONMvreQRd3pLmQKLoiBGCMjCkr5Vs rVH4BGTthc7VnwiNoX4tJwQnroSo+ylatNJ9wKtvrHP+tqPkgIZdqk1aim0cQ7gpYn/C mqN02Lvlw5crqX89EuIBEmad+T8AbrHFIMKWZYeDGoKuHzJPCXh2O7zyvsUUcmmIPuhP 6uFdxRCFo0SUQJtLBcoAsyOF/ainDAlUm4GwVkcjs8nNfJfE3NOwBq7AuoYGiOZWS74o GlWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Kp1gLdyLO7DHFqgZP6bmo7uuERyjbJuBaLEDr4YGKD8=; fh=ITb4zGKkWO3T0WmJnSV0Z0twUZ/f73yiIOUT0grFSAs=; b=BaSuRoSYFIlQmxm1zky6FLmjP5Ncyj3AYPaM6ConbMo6xFanekLA9SEAvpV0DKwylQ TdQZTsfcioV4KS79/TGpsCLubliSNuBUMpE6kuJa7KaYsCWWqQ3mZDq+7mSD1g5UzfJD nq9MCAsgeZk9hsf8Gh5iVw8S1U7ReFIhWBNRziD3SSYwVhwluuxFl7qteOXuik/EM8er JXE/9qFyn4q9y1CDcb9goYf4T5HcH8ilrS78O15xjhbLBw2En0RDbWgdm1r0fjonIp9R R5dVnheYqwSX4Jh3pE+Na59i1NF4lhmtoV+y+KtNCo66qFPZOtqnMkMNpDJ/YKjAme1/ ZcSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k4SiMj6l; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a170902ce8a00b001bd9d6e8319si7997687plg.145.2023.08.14.00.38.02; Mon, 14 Aug 2023 00:38:14 -0700 (PDT) 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=@intel.com header.s=Intel header.b=k4SiMj6l; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233501AbjHNGEU (ORCPT + 99 others); Mon, 14 Aug 2023 02:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233294AbjHNGEK (ORCPT ); Mon, 14 Aug 2023 02:04:10 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E678E129; Sun, 13 Aug 2023 23:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691993049; x=1723529049; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=WcdGtChIm1EcfRxknsGqjMYwaa75wWP0SVoFIOs0nSI=; b=k4SiMj6lkVCqQoowyNLmbVjWTuN2TO2DmWY6CUETYfJDERqMsqKYnsJm aw6AXg1ng5W0f5ts6dIHWjWdW9eN1LNsZW8t7mzAck2qgumJ/wbgR1Jy8 OjAFpbSF6YbQXQvdIHx6r+nOlDxbAtzRztK30B83c2H8R4dpXYYESjKS6 YqiKxhBF4ctjSk9yL2VbmPqWrpapRYS9Xo25PMwqsVemovuYNBPT0BvEg eSYsKTD5zJkwdIDCK5B7kWjn+G+3Hqx2wRt/HQMGQadIKsVmHZkLtwbUU TMfi7Jb0xwUYZEpVhZiSN0yWIvDHlDC5p0uhuPXxRO+KHxI6rCqmDFd2F Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="371970755" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="371970755" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 23:04:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="798702943" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="798702943" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga008.fm.intel.com with ESMTP; 13 Aug 2023 23:04:05 -0700 From: Raag Jadav To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com, Raag Jadav Subject: [PATCH v1 2/4] pinctrl: baytrail: reuse common functions from pinctrl-intel Date: Mon, 14 Aug 2023 11:33:09 +0530 Message-Id: <20230814060311.15945-3-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230814060311.15945-1-raag.jadav@intel.com> References: <20230814060311.15945-1-raag.jadav@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774189222981439648 X-GMAIL-MSGID: 1774189222981439648 Reuse common functions from pinctrl-intel driver. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-baytrail.c | 90 +++--------------------- 1 file changed, 11 insertions(+), 79 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 02ab5fd7cbd5..85f1aea2ca89 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -551,25 +552,10 @@ static const struct intel_pinctrl_soc_data *byt_soc_data[] = { static DEFINE_RAW_SPINLOCK(byt_lock); -static struct intel_community *byt_get_community(struct intel_pinctrl *vg, - unsigned int pin) -{ - struct intel_community *comm; - int i; - - for (i = 0; i < vg->ncommunities; i++) { - comm = vg->communities + i; - if (pin < comm->pin_base + comm->npins && pin >= comm->pin_base) - return comm; - } - - return NULL; -} - static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset, int reg) { - struct intel_community *comm = byt_get_community(vg, offset); + struct intel_community *comm = intel_get_community(vg, offset); u32 reg_offset; if (!comm) @@ -591,68 +577,12 @@ static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset, return comm->pad_regs + reg_offset + reg; } -static int byt_get_groups_count(struct pinctrl_dev *pctldev) -{ - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev); - - return vg->soc->ngroups; -} - -static const char *byt_get_group_name(struct pinctrl_dev *pctldev, - unsigned int selector) -{ - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev); - - return vg->soc->groups[selector].grp.name; -} - -static int byt_get_group_pins(struct pinctrl_dev *pctldev, - unsigned int selector, - const unsigned int **pins, - unsigned int *num_pins) -{ - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev); - - *pins = vg->soc->groups[selector].grp.pins; - *num_pins = vg->soc->groups[selector].grp.npins; - - return 0; -} - static const struct pinctrl_ops byt_pinctrl_ops = { - .get_groups_count = byt_get_groups_count, - .get_group_name = byt_get_group_name, - .get_group_pins = byt_get_group_pins, + .get_groups_count = intel_get_groups_count, + .get_group_name = intel_get_group_name, + .get_group_pins = intel_get_group_pins, }; -static int byt_get_functions_count(struct pinctrl_dev *pctldev) -{ - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev); - - return vg->soc->nfunctions; -} - -static const char *byt_get_function_name(struct pinctrl_dev *pctldev, - unsigned int selector) -{ - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev); - - return vg->soc->functions[selector].func.name; -} - -static int byt_get_function_groups(struct pinctrl_dev *pctldev, - unsigned int selector, - const char * const **groups, - unsigned int *ngroups) -{ - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev); - - *groups = vg->soc->functions[selector].func.groups; - *ngroups = vg->soc->functions[selector].func.ngroups; - - return 0; -} - static void byt_set_group_simple_mux(struct intel_pinctrl *vg, const struct intel_pingroup group, unsigned int func) @@ -851,9 +781,9 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, } static const struct pinmux_ops byt_pinmux_ops = { - .get_functions_count = byt_get_functions_count, - .get_function_name = byt_get_function_name, - .get_function_groups = byt_get_function_groups, + .get_functions_count = intel_get_functions_count, + .get_function_name = intel_get_function_name, + .get_function_groups = intel_get_function_groups, .set_mux = byt_set_mux, .gpio_request_enable = byt_gpio_request_enable, .gpio_disable_free = byt_gpio_disable_free, @@ -1261,7 +1191,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) val = readl(val_reg); raw_spin_unlock_irqrestore(&byt_lock, flags); - comm = byt_get_community(vg, pin); + comm = intel_get_community(vg, pin); if (!comm) { seq_printf(s, "Pin %i: can't retrieve community\n", pin); continue; @@ -1848,3 +1778,5 @@ static int __init byt_gpio_init(void) return platform_driver_register(&byt_gpio_driver); } subsys_initcall(byt_gpio_init); + +MODULE_IMPORT_NS(PINCTRL_INTEL); From patchwork Mon Aug 14 06:03:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 135205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2593648vqi; Mon, 14 Aug 2023 01:13:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfPe7INW/oT3vG5lSyFnE93qZBXQ4PVuG8u9V2UnXbndF7gRCLFnHMhERLkAoGQGB44/Z1 X-Received: by 2002:a54:4d8f:0:b0:3a7:8f94:743a with SMTP id y15-20020a544d8f000000b003a78f94743amr8563358oix.10.1692000815965; Mon, 14 Aug 2023 01:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692000815; cv=none; d=google.com; s=arc-20160816; b=swjOpIrYCNBJYAxXXQ8Y0lcFZ47OwEvnbpEMM+dbCiFRStCY/5L/PNp1ZbHoH+/cf4 TyaSUV55GUU8JREZr3Eq5KZJ1Cl6YNi/iTCMND/PcBhnA8PyZdEJxkYJCWkzUEmnQv9p QZq1IsJA9YMgxnK07Thi0PdIVx22yI0tboHGYXBnz9Rpm434vr3MOoQGEhvO+C3tSwKg VT524NcEoFjETGNGssn7MGIY8jODb9cN3OdR+FaIo/eJsOleIOf6pu+n7wUFpJsfzGfC uXNagqG434AVThDFUbtExUUTO0dLBv9kOChxNTV1EkybbXREwj8rIkRYo5WSu3uswqjN rWiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=SreAEuD9OgtrFalIhkkWcp7jD5aC4EbeJ44w/FgeNNk=; fh=ITb4zGKkWO3T0WmJnSV0Z0twUZ/f73yiIOUT0grFSAs=; b=E2Ja9EN6IN81xPqhkYl5JtN0l9yeiONnmsepMCEKzb0P6Z0MneK1u3dngc9RMTZ9mM iOlvm9iSPEDtJ1ndH7b/7jb28EJc3f/QPoaZVuxcuVTuIxOFaW9tXHLdStx2omR71HmK 50iPUxPBaFFv5UcSx6b7zJAmmooVFRoiXShAVwW5ngwTmIhcq7Sr4CpUJSfOfF11kpXj fIcG5HRbgc8s2usOJOwEB7gBExEg0XUIhjr+GNuhe6tJySG3t4us4rL7YzMtpk92mzg+ SbIoCwglu/SgoPsLtaLwUgGsFaQO55CWVkeaDGepnH/JTVpgirngyhNnDEHp+VNTeFY5 8yeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fBFmYCTx; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a72-20020a63904b000000b00565bf035b25si1134785pge.382.2023.08.14.01.13.23; Mon, 14 Aug 2023 01:13:35 -0700 (PDT) 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=@intel.com header.s=Intel header.b=fBFmYCTx; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233521AbjHNGEW (ORCPT + 99 others); Mon, 14 Aug 2023 02:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233338AbjHNGEM (ORCPT ); Mon, 14 Aug 2023 02:04:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A49D129; Sun, 13 Aug 2023 23:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691993051; x=1723529051; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dNS6n8ZSNCyYDSi15UaC1jDhjYzXiYjvjoZeqmbL/X8=; b=fBFmYCTxEIzhDRH8P2SyvNkiIGPTX2PzCr9xI1OVUk0PIi7O+fDq05u4 EB2BKWWT5IBz+pYQcaogoHqGiC8zB/LZVD6WVImYnCakpZPPr28TW9uCp hIHSR+Yyd0kqGp8g4XUgGEM0lvFLn4S7BO+z7YSzRTr+5Zp0sm/42EqY1 Yd3fMPQYlhLB7UAhWUkguFoKZ/gqoYDgAiPwjXjgVx78REH6zhuyxFM+T fgStJ4aMTgmdApdlkGR8FSB9FLqOXjjynHi0fdy+0/ih8NVXSa0haXTIz ufpMYWJYVo+sQgW7tkSJF1QpBJgAdwgQRRfBT15ned19q9le4bCdqHGpu A==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="371970761" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="371970761" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 23:04:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="798702966" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="798702966" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga008.fm.intel.com with ESMTP; 13 Aug 2023 23:04:08 -0700 From: Raag Jadav To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com, Raag Jadav Subject: [PATCH v1 3/4] pinctrl: cherryview: reuse common functions from pinctrl-intel Date: Mon, 14 Aug 2023 11:33:10 +0530 Message-Id: <20230814060311.15945-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230814060311.15945-1-raag.jadav@intel.com> References: <20230814060311.15945-1-raag.jadav@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774191447627902277 X-GMAIL-MSGID: 1774191447627902277 Reuse common functions from pinctrl-intel driver. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-cherryview.c | 69 +++------------------- 1 file changed, 9 insertions(+), 60 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index eee0f9bc3d32..7bde3316addf 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c @@ -617,31 +617,6 @@ static bool chv_pad_locked(struct intel_pinctrl *pctrl, unsigned int offset) return chv_readl(pctrl, offset, CHV_PADCTRL1) & CHV_PADCTRL1_CFGLOCK; } -static int chv_get_groups_count(struct pinctrl_dev *pctldev) -{ - struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - - return pctrl->soc->ngroups; -} - -static const char *chv_get_group_name(struct pinctrl_dev *pctldev, - unsigned int group) -{ - struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - - return pctrl->soc->groups[group].grp.name; -} - -static int chv_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group, - const unsigned int **pins, unsigned int *npins) -{ - struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - - *pins = pctrl->soc->groups[group].grp.pins; - *npins = pctrl->soc->groups[group].grp.npins; - return 0; -} - static void chv_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, unsigned int offset) { @@ -676,39 +651,12 @@ static void chv_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, } static const struct pinctrl_ops chv_pinctrl_ops = { - .get_groups_count = chv_get_groups_count, - .get_group_name = chv_get_group_name, - .get_group_pins = chv_get_group_pins, + .get_groups_count = intel_get_groups_count, + .get_group_name = intel_get_group_name, + .get_group_pins = intel_get_group_pins, .pin_dbg_show = chv_pin_dbg_show, }; -static int chv_get_functions_count(struct pinctrl_dev *pctldev) -{ - struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - - return pctrl->soc->nfunctions; -} - -static const char *chv_get_function_name(struct pinctrl_dev *pctldev, - unsigned int function) -{ - struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - - return pctrl->soc->functions[function].func.name; -} - -static int chv_get_function_groups(struct pinctrl_dev *pctldev, - unsigned int function, - const char * const **groups, - unsigned int * const ngroups) -{ - struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - - *groups = pctrl->soc->functions[function].func.groups; - *ngroups = pctrl->soc->functions[function].func.ngroups; - return 0; -} - static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, unsigned int group) { @@ -884,9 +832,9 @@ static int chv_gpio_set_direction(struct pinctrl_dev *pctldev, } static const struct pinmux_ops chv_pinmux_ops = { - .get_functions_count = chv_get_functions_count, - .get_function_name = chv_get_function_name, - .get_function_groups = chv_get_function_groups, + .get_functions_count = intel_get_functions_count, + .get_function_name = intel_get_function_name, + .get_function_groups = intel_get_function_groups, .set_mux = chv_pinmux_set_mux, .gpio_request_enable = chv_gpio_request_enable, .gpio_disable_free = chv_gpio_disable_free, @@ -1118,7 +1066,7 @@ static int chv_config_group_get(struct pinctrl_dev *pctldev, unsigned int npins; int ret; - ret = chv_get_group_pins(pctldev, group, &pins, &npins); + ret = intel_get_group_pins(pctldev, group, &pins, &npins); if (ret) return ret; @@ -1137,7 +1085,7 @@ static int chv_config_group_set(struct pinctrl_dev *pctldev, unsigned int npins; int i, ret; - ret = chv_get_group_pins(pctldev, group, &pins, &npins); + ret = intel_get_group_pins(pctldev, group, &pins, &npins); if (ret) return ret; @@ -1915,3 +1863,4 @@ module_exit(chv_pinctrl_exit); MODULE_AUTHOR("Mika Westerberg "); MODULE_DESCRIPTION("Intel Cherryview/Braswell pinctrl driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(PINCTRL_INTEL); From patchwork Mon Aug 14 06:03:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 135154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2558083vqi; Sun, 13 Aug 2023 23:40:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+nfSqQmZtXqI/RH4oPibgB+mn09q4a1eFhu0o26Q0FP9VJ5p71Hyr+dcCcW9DF89Eeeg0 X-Received: by 2002:a05:6512:2312:b0:4f9:556b:93c2 with SMTP id o18-20020a056512231200b004f9556b93c2mr8191533lfu.1.1691995247282; Sun, 13 Aug 2023 23:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691995247; cv=none; d=google.com; s=arc-20160816; b=F7aDz2K7PPYwVsM5NvxpdMVryYnSHZ7G8xE+Z5FQQuu3WlwsOOmU9ZIdZxJayP3jNw JTfG/LtMYgNq1atrGOaBGAKau8z2u/TpcVcP8z3qneZHqzJbrlBz2uCVfKlStkjqUooy V+Zc1UpjFI6wL5+zwH+SYoHxLZd273oEJbrKYCy6yBAo8a+666hWHXNDOlLhzZjTrb6e kxHNUkLvAxMliKNUU37ZfcOjTVkp9ZmiNIt3IScpl+Xyp5l6U4Fpy/FbVaUskT4gCuY4 UikiwopWHqT0RBDvkldITP9lYuNhLBNZ0sRSDjpJBNfwIdnvyJvhpxAIhJXrbe4LuDWt D5QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=BES2BDTdLvApN7rIozfhnXt5JhIbAuXDRuuzCaV52KE=; fh=ITb4zGKkWO3T0WmJnSV0Z0twUZ/f73yiIOUT0grFSAs=; b=VLAB4KDs/5OD0HJgotx7LKNbvrx65D4MxHXxS6wYM7HHTwaMSND/Ud2mvZTBTuVsTM wkxymIqFSS+V/kt4aPKV2bcIWSeJlGSkAUCWZ9Sg2ajw2LqweZqZdPrOw6NyNzaYYQdX LX344n0/yyBtNB1TtqtPmW/EpSu9EWhkg25XXGWNG/bZs0urly7dt9bPqAiS2T++lLJH NyFbY9v2Y1GaFSDkRCJjJXcZQ/5K3e9JF5OQcvYMNuSt63OUhzo4ioFq71BgVI68NaYK Ow0fgjJmeq6u4MstxHNM6V/AVzGawF9RpY9PrjTwHXaMRr992ykCFyGShwcdJt5PAm// V5wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=je8x6t67; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020aa7d7d7000000b00521d0a2c5adsi7282751eds.379.2023.08.13.23.40.24; Sun, 13 Aug 2023 23:40:47 -0700 (PDT) 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=@intel.com header.s=Intel header.b=je8x6t67; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233532AbjHNGEY (ORCPT + 99 others); Mon, 14 Aug 2023 02:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbjHNGEO (ORCPT ); Mon, 14 Aug 2023 02:04:14 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF851129; Sun, 13 Aug 2023 23:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691993053; x=1723529053; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=BPpmaoshcMt6goKsPUPVpZaxcfTUVVBLgBqsePBBad0=; b=je8x6t67Y7ZBiwxk70ZgHjUC83FhQKqo7jfSGuOm6ThXy8+FxB99JkU4 GRfBtRKjR1t10o9pxHlrJ+/tVP9B5Wnie81Em0lgfHg7L2KFE/3arP+mF R25wnCa8ug19KAN+ZdnMF1jcTrzMeAgWOLMF66rCWnjn4pQFW7EZ2wHKS Fgo7e1C3aqKXEonMqnWdPKQ3AtHbAMKnXZk7qD5Q8Rh/ASof7Wq0RMKZR kiryM+19UzWvQTjjqzWmRMBL+qfhZIdbXEActQEqxlgHAG9ZNkYOMJdjE CaJaxyMbRxy2BPwKMPpzkWy7EwjNQz5JOEihTyrVoukC6kANsunjGKJ8I g==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="371970764" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="371970764" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 23:04:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="798702983" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="798702983" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga008.fm.intel.com with ESMTP; 13 Aug 2023 23:04:11 -0700 From: Raag Jadav To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com, Raag Jadav Subject: [PATCH v1 4/4] pinctrl: lynxpoint: reuse common functions from pinctrl-intel Date: Mon, 14 Aug 2023 11:33:11 +0530 Message-Id: <20230814060311.15945-5-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230814060311.15945-1-raag.jadav@intel.com> References: <20230814060311.15945-1-raag.jadav@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774185608730053912 X-GMAIL-MSGID: 1774185608730053912 Reuse common functions from pinctrl-intel driver. While at it, select pinctrl-intel for Intel Lynxpoint driver. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/Kconfig | 6 +- drivers/pinctrl/intel/pinctrl-lynxpoint.c | 86 +++-------------------- 2 files changed, 9 insertions(+), 83 deletions(-) diff --git a/drivers/pinctrl/intel/Kconfig b/drivers/pinctrl/intel/Kconfig index eaa45ebfd1c1..f42a83e29b8b 100644 --- a/drivers/pinctrl/intel/Kconfig +++ b/drivers/pinctrl/intel/Kconfig @@ -26,11 +26,7 @@ config PINCTRL_CHERRYVIEW config PINCTRL_LYNXPOINT tristate "Intel Lynxpoint pinctrl and GPIO driver" depends on ACPI - select PINMUX - select PINCONF - select GENERIC_PINCONF - select GPIOLIB - select GPIOLIB_IRQCHIP + select PINCTRL_INTEL help Lynxpoint is the PCH of Intel Haswell. This pinctrl driver provides an interface that allows configuring of PCH pins and diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c index cdace55aaeac..780c9ab79d85 100644 --- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c +++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c @@ -206,21 +206,6 @@ static const struct intel_pinctrl_soc_data lptlp_soc_data = { * IOxAPIC redirection map applies only for gpio 8-10, 13-14, 45-55. */ -static struct intel_community *lp_get_community(struct intel_pinctrl *lg, - unsigned int pin) -{ - struct intel_community *comm; - int i; - - for (i = 0; i < lg->ncommunities; i++) { - comm = &lg->communities[i]; - if (pin < comm->pin_base + comm->npins && pin >= comm->pin_base) - return comm; - } - - return NULL; -} - static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset, int reg) { @@ -228,7 +213,7 @@ static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset, struct intel_community *comm; int reg_offset; - comm = lp_get_community(lg, offset); + comm = intel_get_community(lg, offset); if (!comm) return NULL; @@ -272,34 +257,6 @@ static bool lp_gpio_ioxapic_use(struct gpio_chip *chip, unsigned int offset) return false; } -static int lp_get_groups_count(struct pinctrl_dev *pctldev) -{ - struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); - - return lg->soc->ngroups; -} - -static const char *lp_get_group_name(struct pinctrl_dev *pctldev, - unsigned int selector) -{ - struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); - - return lg->soc->groups[selector].grp.name; -} - -static int lp_get_group_pins(struct pinctrl_dev *pctldev, - unsigned int selector, - const unsigned int **pins, - unsigned int *num_pins) -{ - struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); - - *pins = lg->soc->groups[selector].grp.pins; - *num_pins = lg->soc->groups[selector].grp.npins; - - return 0; -} - static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, unsigned int pin) { @@ -323,40 +280,12 @@ static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, } static const struct pinctrl_ops lptlp_pinctrl_ops = { - .get_groups_count = lp_get_groups_count, - .get_group_name = lp_get_group_name, - .get_group_pins = lp_get_group_pins, + .get_groups_count = intel_get_groups_count, + .get_group_name = intel_get_group_name, + .get_group_pins = intel_get_group_pins, .pin_dbg_show = lp_pin_dbg_show, }; -static int lp_get_functions_count(struct pinctrl_dev *pctldev) -{ - struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); - - return lg->soc->nfunctions; -} - -static const char *lp_get_function_name(struct pinctrl_dev *pctldev, - unsigned int selector) -{ - struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); - - return lg->soc->functions[selector].func.name; -} - -static int lp_get_function_groups(struct pinctrl_dev *pctldev, - unsigned int selector, - const char * const **groups, - unsigned int *ngroups) -{ - struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); - - *groups = lg->soc->functions[selector].func.groups; - *ngroups = lg->soc->functions[selector].func.ngroups; - - return 0; -} - static int lp_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, unsigned int group) { @@ -481,9 +410,9 @@ static int lp_gpio_set_direction(struct pinctrl_dev *pctldev, } static const struct pinmux_ops lptlp_pinmux_ops = { - .get_functions_count = lp_get_functions_count, - .get_function_name = lp_get_function_name, - .get_function_groups = lp_get_function_groups, + .get_functions_count = intel_get_functions_count, + .get_function_name = intel_get_function_name, + .get_function_groups = intel_get_function_groups, .set_mux = lp_pinmux_set_mux, .gpio_request_enable = lp_gpio_request_enable, .gpio_disable_free = lp_gpio_disable_free, @@ -987,3 +916,4 @@ MODULE_AUTHOR("Andy Shevchenko (Intel)"); MODULE_DESCRIPTION("Intel Lynxpoint pinctrl driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:lp_gpio"); +MODULE_IMPORT_NS(PINCTRL_INTEL);