Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3633821rwb; Tue, 8 Nov 2022 06:48:40 -0800 (PST) X-Google-Smtp-Source: AMsMyM77FiBj6oIDlBYjSaYvExnS61jkk4orVjlLpttDX5XczBQcU1OBXP93YHEwj+UCb0XxVLXg X-Received: by 2002:a17:906:e214:b0:7ae:3c5c:399a with SMTP id gf20-20020a170906e21400b007ae3c5c399amr19710550ejb.650.1667918920394; Tue, 08 Nov 2022 06:48:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667918920; cv=none; d=google.com; s=arc-20160816; b=K6rJI6NzDAm+ZbA27mbaYRuvWFhw+vXi/jEyn9hZXR8386n/cbneUS58qjZp4Y9uaK XsCrBZuc7WJJWdEuPErL7uvyl553dk/xPsFpO2CoUwSZupXPd9fqYTlQGmNNc0xZqYwb fng8pDDmATNHisxrz9qZZhD02bwDRrgvaNrpyUgPLaLM3MUT7xyqLx2TXe4CBemPFBpu 1d7xQskwPU7q3u8xYgCBmLg/yLCLpC81GOgJ/gltZPSenGqZuXcLEs2q7cK+lPW2CJ11 uXxnuRN7LFsRU0LlVhwmBz/RL4ZUthUEr2GNv5aVYOY5pZGtAQkxDGEjcFFbVWm6j9oN fvhg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x27RTc5/n84/ShKHSf1BizBMPXkcUYH5HqIJniat2gg=; b=xB85YudWacgl8X4CEsGT0fVk86SOIpoiLVgtM8/7Hdr1DaaNLWq/1079v6YaHRrV5B YenZXTuITJE0sBc4QwPaZDwh5JtM5GYFmsGbzuRrUd1Uh29ENLfqWji562hptVtz6uDs ztHYGxyfWc/iIKUMPHqp0ZJa1BJ0YCvpEZlQ3IpElqendSklqoCxpe6lNT6ABUiZFQGA LlmX62Ti6fjt8zRP8DFyzJuhmzVkxRD2WhIvWyQPyjh3Z5lBLfHzsAtNbE/KZIHPo0Rk 5mKD+F/d0sNgI7MERIL09u1OSA26Almsm+rFYykhQArVJygSQ4b0y8py4Rbuu4IwlFDU vYUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G1+TTT56; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020aa7c45a000000b00463cd7d6e7asi2588082edr.30.2022.11.08.06.48.18; Tue, 08 Nov 2022 06:48:40 -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=@intel.com header.s=Intel header.b=G1+TTT56; 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 S234333AbiKHOWt (ORCPT + 92 others); Tue, 8 Nov 2022 09:22:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234674AbiKHOWK (ORCPT ); Tue, 8 Nov 2022 09:22:10 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 323C254B1D; Tue, 8 Nov 2022 06:22:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667917330; x=1699453330; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vyYkmlrH3FTwJFyY/NU3XVwDT0lsgxH2Rn0Y02epYKs=; b=G1+TTT565RKy1lMiBsTNmEHn5iMOuM8unZyEpMe+MWemIzobWOPfbfC8 Sf+QGiIRCuaIvGJmctei9VJl8rRomJCnx25omWEVtZ+HWykVCsqtb0dm7 eMSH658/teUTWEwbdD2q8QMKHFAH7p4LsjevAGxPN7qI/0ZNPWxnl0dI0 OC8+Pe6UxF6Wd26EcUDhOb2ZE7D5I4/jC+97KpvSzKjtZ0kdvfiAp/hye 03gtvqqoeQPMVhL1/VbyHojmli/bBXKf+N1PDa9w03hgiztobDtSUrgBO 2BaqU96GIKZyr4nzdzMwGdB5PFUL0LEomCDapyxOtqcr+yYrvtODfRGjF A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="298219291" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="298219291" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 06:22:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="761506504" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="761506504" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 08 Nov 2022 06:22:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9945657A; Tue, 8 Nov 2022 16:22:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Hans de Goede , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v2 6/6] pinctrl: intel: Enumerate PWM device when community has a capabilitty Date: Tue, 8 Nov 2022 16:22:26 +0200 Message-Id: <20221108142226.63161-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221108142226.63161-1-andriy.shevchenko@linux.intel.com> References: <20221108142226.63161-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 Some of the Communities may have PWM capability. In such cases, enumerate PWM device via respective driver. User is still responsible for setting correct pin muxing for the line that needs to output the signal. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- drivers/pinctrl/intel/pinctrl-intel.c | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 6e630e87fed6..6b685ff7041f 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -24,6 +24,8 @@ #include #include +#include + #include "../core.h" #include "pinctrl-intel.h" @@ -49,6 +51,8 @@ #define PADOWN_MASK(p) (GENMASK(3, 0) << PADOWN_SHIFT(p)) #define PADOWN_GPP(p) ((p) / 8) +#define PWMC 0x204 + /* Offset from pad_regs */ #define PADCFG0 0x000 #define PADCFG0_RXEVCFG_SHIFT 25 @@ -1502,6 +1506,27 @@ static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) return 0; } +static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl, + struct intel_community *community) +{ + static const struct pwm_lpss_boardinfo info = { + .clk_rate = 19200000, + .npwm = 1, + .base_unit_bits = 22, + .bypass = true, + }; + struct pwm_lpss_chip *pwm; + + if (!(community->features & PINCTRL_FEATURE_PWM)) + return 0; + + pwm = pwm_lpss_probe(pctrl->dev, community->regs + PWMC, &info); + if (IS_ERR(pwm) && PTR_ERR(pwm) != -ENODEV) + return PTR_ERR(pwm); + + return 0; +} + static int intel_pinctrl_probe(struct platform_device *pdev, const struct intel_pinctrl_soc_data *soc_data) { @@ -1588,6 +1613,10 @@ static int intel_pinctrl_probe(struct platform_device *pdev, ret = intel_pinctrl_add_padgroups_by_size(pctrl, community); if (ret) return ret; + + ret = intel_pinctrl_probe_pwm(pctrl, community); + if (ret) + return ret; } irq = platform_get_irq(pdev, 0); -- 2.35.1