From patchwork Tue Nov 8 14:22:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2740979wru; Tue, 8 Nov 2022 06:28:20 -0800 (PST) X-Google-Smtp-Source: AMsMyM57jn2y/tt17OcSjCGDpzFAm1Q3c004y0FylXrZPoavGd3OHwu4svjy+gWnwk/MltG2N8b/ X-Received: by 2002:a17:90b:33c7:b0:214:1ddc:c6bd with SMTP id lk7-20020a17090b33c700b002141ddcc6bdmr39112222pjb.151.1667917700659; Tue, 08 Nov 2022 06:28:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917700; cv=none; d=google.com; s=arc-20160816; b=XIUcu7y/icVOBGFBS3w8hPS5o2uir2sJDSeCXZ0cA2LEK6q5Jnr+2PLYjliYo8UiFY UvNAKt6rocUpbI1FjaQ8Jzxl6FVkIAnoxwD2GRycSbx6OAKsy301FGnSvv8L3WR5To8x tNNEqPeL83v/2W0u/Nfw0Jt7UUckpdHupcZm5XAW1OZCNdcEMImfXc/Y7DghroROzg0i p4VWEmeHrMf+F6OxvWvEg1C1T1wANp3OLu3FRT7C0BsRctyQwWikb3PGN9eS1n1VAz/a hXMfADzrWtuT2I1decUdc8LRYXx8DXPiFARETs3Hz6ZSjYxLWam/4aLXCzEvJSh/h18l IS4A== 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=ja10i/+FGGcIospyEbaZwmx5exM6xSLPnTcgO6I2Dfg=; b=B2xS0Aku9CSPAVK8ll3Uupbist/KJIZliJ38iM7+8s/44WV9Ww8ZoTHgvPZYqLSf/J uE4s7IJ340ALl24SYPr9ZnQv2vXvNRr7jQglMEyOlIm1b7GHluVFiqP0UbWxm+cDaV2z emvQ/uUA2/TLVqg87FFet3+2yk1TSd1XONZ0lYP9vqAaj5urgLzAKPHiYTqmYQ+WMAD0 qQeBLwJeRQZDQ1iMcPyqgIHs1TR690l5EJLFwJ4jJtIJyII4T6yTa1cNyo7nN1J7r1Yk CyeBQGmXkXSypw6CHGnuygc1+kA9Ehf+6Xt7gx9QrPuJd2ry+CiUjEvdExu+mqzaiqzq AMyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HWwT3AIg; 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 k16-20020a056a00169000b005637366edb8si14925133pfc.9.2022.11.08.06.28.06; Tue, 08 Nov 2022 06:28:20 -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=HWwT3AIg; 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 S234398AbiKHOWl (ORCPT + 99 others); Tue, 8 Nov 2022 09:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234589AbiKHOWI (ORCPT ); Tue, 8 Nov 2022 09:22:08 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E51C54B13; Tue, 8 Nov 2022 06:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667917328; x=1699453328; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jmvq9J3vKVtopSojPs7YdH4K99jNadewdc2yE8CsvjU=; b=HWwT3AIgrd+7IjtOHLu8rOxuFRIE+nHxD9Y/YFfDpslBBK6uMbmIXPKj fGOH2Jz4/rwjPweGLDf/DfKDzv5HjE1XyGrNZAZAC91zAw/KP41I6j3mz VCmZzK6+ByKmsUinDLrD0wFUDOVfCu3wrcpKuvTpPvgPB3X/kTVPBAuHk K98NUMTfceJ+SNapnoW2BoPudAueCDegVcd+6BnTgrDtFRp5JVxj4ZgBa mw9PrcBE21vKuFNBoy+psZMjfskc+NxKUgAhp5JQRoPAgrV48bScBDd3n /laBS19PBW6tOa6Ou6iJ0K/2JObZ4B+XB/DJPDnazwTnbUBDzdVpZtXjj A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="298219282" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="298219282" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 06:22:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="699938291" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="699938291" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 08 Nov 2022 06:22:03 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6B189155; Tue, 8 Nov 2022 16:22:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Hans de Goede , =?utf-8?q?Uwe_Kleine-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 1/6] pwm: Add a stub for devm_pwmchip_add() Date: Tue, 8 Nov 2022 16:22:21 +0200 Message-Id: <20221108142226.63161-2-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748938471125593005?= X-GMAIL-MSGID: =?utf-8?q?1748938471125593005?= devm_pwmchip_add() can be called by a module that optionally instantiates PWM chip. In case of CONFIG_PWM=n, the compilation can't be performed. Hence, add a necessary stub. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg Acked-by: Uwe Kleine-König --- include/linux/pwm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/pwm.h b/include/linux/pwm.h index d70c6e5a839d..bba492eea96c 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -478,6 +478,11 @@ static inline int pwmchip_remove(struct pwm_chip *chip) return -EINVAL; } +static inline int devm_pwmchip_add(struct device *dev, struct pwm_chip *chip) +{ + return -EINVAL; +} + static inline struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, unsigned int index, const char *label) From patchwork Tue Nov 8 14:22:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17068 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2741196wru; Tue, 8 Nov 2022 06:28:40 -0800 (PST) X-Google-Smtp-Source: AMsMyM6KzExzkeM05RJ/OWHNcK1t5uGHFBKFRpyOY4MgO3vr6gs9sJxuvSUcC6IjmKFSITZaHRE6 X-Received: by 2002:a05:6a00:852:b0:56d:e2bc:1978 with SMTP id q18-20020a056a00085200b0056de2bc1978mr37584570pfk.47.1667917720264; Tue, 08 Nov 2022 06:28:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917720; cv=none; d=google.com; s=arc-20160816; b=sGXViMmGvDgpZOoEHpX+VClNqGjyBGgMN2BxI5DsyQPuxajaxUc/O2CZgu8xnzye+w B1woP1bbkJmidnwa9vb3qBTMuxYdl8uJzqY6QzOpwnrIV7AVjpCnYhumwnd5hsPNI+TF UQsSKHbSE0G1/0DQ6VrLE6MPPZw3IgEPTkjqRlWmui5Eex3iweRXzGF+22G0WJRx1lPJ fPHjvJNa/K+RC7+L4VabcaH8wpJ9ff3OlUtPYDfZzTXuEWe1nMsmIu9MAfN1HwkU0onY KYZI0TdZdM64Vd7Qi+BqxxTZmQIH5b8W6hFPu3YA2LF+x1FISJ4AkWoH6pqg+9Tx90uo qF8g== 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=AeNEMyQ3Y6oWtuh/ijlUtJQIoeOGCjlVRGN+T3yRZok=; b=qrAggX88u6/ZxxhpSU923j5mWv9rp16jweNawR+vCXQDlOKOd6XQ0rQnz8Q6hiB87o KFAipiKL/nD4jFOeW5xhFcrzlvuyYqTkzTHOGVIUAL6iF7B4J+th9pPYwDPBmA/A3Ed+ HdW5iDls5elenXcxXODj3FfLAN+EG21Qh37qYp973AUgHeongDLpawuefdnJPT1+qVM0 HjI8WwkViUC3bu7aZN7Tsp0t0oj2+iy3hRDo6wnWePxBx7Gr51/Q+cBIZGivwYyITidy 7uTnfm5WFfr4cTQCVP8ZoJ5VTY8HYbHphJAgGC9TyNbXurBzsbETM8hg/fUa45SMK+d/ j4Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IY8eOGG5; 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 d6-20020a630e06000000b0041b7a0b673fsi14197633pgl.449.2022.11.08.06.28.25; Tue, 08 Nov 2022 06:28: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=IY8eOGG5; 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 S234589AbiKHOXD (ORCPT + 99 others); Tue, 8 Nov 2022 09:23:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234352AbiKHOWT (ORCPT ); Tue, 8 Nov 2022 09:22:19 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 809DE54B2F; Tue, 8 Nov 2022 06:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667917338; x=1699453338; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E9ags/i2eDk5WiEL1lMfAOWBo+2EbAcbpeazBtcJaqI=; b=IY8eOGG5AbGU/thfTYtpls063zxVpV5GhebaF0WBpN2XhwgrSwOyfsur BRM61jpRSb4AobgbzZ+yG5nimeoU1d1v7Do86xiHmC/G6KJi9qOS9BQFv Qq0ImAW8CxPffvRmL9vCtmOQK75sXKwYmaphjjLea5UZdu4zkguVYJrow LSzqAE0zazYMulRy5y+mGWyHYLPYZrqlMDX4xmUDu1B973kBe9+nAcEVm 4RiIabUdg2lD8fJ1L1iTbSY48pDbzWmsXUNXTS4XlIgxeoAC8SUWH2RFK pjS4y4T6biqEi/Id9/ILyH35ko5Mtlxx6KC4MU05w0g7TJaUAUJA3qmy4 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="310700753" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="310700753" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 06:22:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="587386418" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="587386418" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 08 Nov 2022 06:22:03 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 75ED429D; Tue, 8 Nov 2022 16:22:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Hans de Goede , =?utf-8?q?Uwe_Kleine-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 2/6] pwm: lpss: Rename MAX_PWMS --> LPSS_MAX_PWMS Date: Tue, 8 Nov 2022 16:22:22 +0200 Message-Id: <20221108142226.63161-3-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 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748938491376164977?= X-GMAIL-MSGID: =?utf-8?q?1748938491376164977?= The MAX_PWMS definition is already being used by PWM core. Using the same name in the certain driver confuses people and potentially can clash with it. Hence, rename it by adding LPSS prefix. Reported-by: Uwe Kleine-König Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg Reviewed-by: Uwe Kleine-König --- drivers/pwm/pwm-lpss.c | 2 +- drivers/pwm/pwm-lpss.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c index accdef5dd58e..b8739cd2c235 100644 --- a/drivers/pwm/pwm-lpss.c +++ b/drivers/pwm/pwm-lpss.c @@ -252,7 +252,7 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, int i, ret; u32 ctrl; - if (WARN_ON(info->npwm > MAX_PWMS)) + if (WARN_ON(info->npwm > LPSS_MAX_PWMS)) return ERR_PTR(-ENODEV); lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL); diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h index 8e82eb5a7e00..2c746c51b883 100644 --- a/drivers/pwm/pwm-lpss.h +++ b/drivers/pwm/pwm-lpss.h @@ -13,7 +13,7 @@ #include #include -#define MAX_PWMS 4 +#define LPSS_MAX_PWMS 4 struct pwm_lpss_chip { struct pwm_chip chip; From patchwork Tue Nov 8 14:22:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2740961wru; Tue, 8 Nov 2022 06:28:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5lmvJRHJlV6i92q8Fl0k1ZaWzsTSF1viDIvGOCy1rJk/AfNWefheY6Jp+62hf0y0Tcu1Ue X-Received: by 2002:a17:902:a401:b0:188:79ba:d542 with SMTP id p1-20020a170902a40100b0018879bad542mr15235720plq.126.1667917700269; Tue, 08 Nov 2022 06:28:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917700; cv=none; d=google.com; s=arc-20160816; b=in493ELJPILO37fmzqarDpBq/BI5sAp4A/n1eAQeIsae0areCK5XSZ2uh53BmuIfNk hRSUeFNal+wCSvQdAeM61p2EIQydJEGxiuy2KEMIwVCSu0KSv+YXIbyoH8S41rKxN0VW yourRZnSexyF6clL3O4kgxwkHQaPfunOmVh/SrNvYOpeSC5S2zznaGfqZPT25O+nsJAV hsEe9Ubo+65zB4LTxtbRubUHxJxrBoBBu7HgQJ4mgST0LKTrO97Qjbax4+B75dbL+EZr /Ckuek7XDnWmZIfeopiSHew/zJ2qT6ICg8cSW5h10TkIg6h3WnntRw9+8tqZdOKsRI7u rlkg== 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=Gry1qXs3puA6+vjs1Qo+vfBKKNvG3UM/+7ig2JiH1Pg=; b=oudJvPFwuoxUXoVpfLq9R/42bbMeOnS6zZiMD9eXIGuW/A70gLLaKuL60JYlkjBg/k jkn4hhs0AldfPRNWYuJGSPfLjxD+ohAcNmkgfTdHluKnnSAm/iCRPTHz7eu5zFT0ujA4 9t9BZaTizI2pDVZbo61dr6Zpto6IbQ/VBQMa7FQyXHgjQzIjWADGpz7VHwdi2VVh/YZa kNxG/r3ZcL/Bz9qpCBq3Dq2huI21edZhdoENUAnTqw4hPiSpFJcZqVtutUFiG3/Xz2Eb RZFHbueJrj/P/7D8PR0fyeMf/WQoTMyLFX39WW91U3nWF1XMyMUxlE/fhlUpKYPQ1tca vhQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZN261CEa; 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 ik9-20020a170902ab0900b00176a8746df6si12902113plb.433.2022.11.08.06.28.06; Tue, 08 Nov 2022 06:28:20 -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=ZN261CEa; 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 S234181AbiKHOWg (ORCPT + 99 others); Tue, 8 Nov 2022 09:22:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234583AbiKHOWI (ORCPT ); Tue, 8 Nov 2022 09:22:08 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374E854B0D; Tue, 8 Nov 2022 06:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667917327; x=1699453327; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3WwHPrGYys4CM9wArmF05npxQAsVuUHXIQrsJgDTthA=; b=ZN261CEaHOZHPI3HLUxY/UrppgnZgBuZlNn6VI7quBnUwrN+lgWzoSpV BeD07CBevYXyfrgUE7VivGWGNRJLLlZ/v5wCpU5Hs6lL8WaIvG4JYgqTo XQdd6VhQnJxjLgQv1pxZ08nM+l6aknOuwLSFmRwB5A8u5aejyA2aIr5AS qbbPGgsbBKb+Xbk2JHquK5RkHr5La0WZ/CjBSmd9gJaOJSrem6mBoOlhK Je0++cTO4vurwqRM/5P12zDOvgCrSt9MBrjffd7lnGpILcHYrW3u+87A5 cAoydPJl9VgeiAIoHmhrrTPlYSDAHKf/oSON+xzOm9rKTOyeHgbC1xYPM A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="298219278" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="298219278" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 06:22:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="699938289" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="699938289" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 08 Nov 2022 06:22:03 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7D7B92B7; Tue, 8 Nov 2022 16:22:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Hans de Goede , =?utf-8?q?Uwe_Kleine-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 3/6] pwm: lpss: Include headers we are direct user of Date: Tue, 8 Nov 2022 16:22:23 +0200 Message-Id: <20221108142226.63161-4-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748938470715331867?= X-GMAIL-MSGID: =?utf-8?q?1748938470715331867?= For the sake of integrity, include headers we are direct user of. While at it, move the struct pwm_lpss_chip to be after the struct pwm_lpss_boardinfo as the former uses pointer to the latter. Replace device.h with a forward declaration in order to improve the compilation time due to reducing overhead of device.h parsing with entire train of dependencies. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg Reviewed-by: Hans de Goede --- drivers/pwm/pwm-lpss.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h index 2c746c51b883..4561d229b27d 100644 --- a/drivers/pwm/pwm-lpss.h +++ b/drivers/pwm/pwm-lpss.h @@ -10,16 +10,12 @@ #ifndef __PWM_LPSS_H #define __PWM_LPSS_H -#include #include +#include -#define LPSS_MAX_PWMS 4 +struct device; -struct pwm_lpss_chip { - struct pwm_chip chip; - void __iomem *regs; - const struct pwm_lpss_boardinfo *info; -}; +#define LPSS_MAX_PWMS 4 struct pwm_lpss_boardinfo { unsigned long clk_rate; @@ -43,6 +39,12 @@ extern const struct pwm_lpss_boardinfo pwm_lpss_bsw_info; extern const struct pwm_lpss_boardinfo pwm_lpss_bxt_info; extern const struct pwm_lpss_boardinfo pwm_lpss_tng_info; +struct pwm_lpss_chip { + struct pwm_chip chip; + void __iomem *regs; + const struct pwm_lpss_boardinfo *info; +}; + struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, const struct pwm_lpss_boardinfo *info); From patchwork Tue Nov 8 14:22:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2741166wru; Tue, 8 Nov 2022 06:28:37 -0800 (PST) X-Google-Smtp-Source: AMsMyM4AjBylEfSUaSr0uyU13tl/hk4JA5rQum6Gj3waRX3lVAK2JCotTG0slxaqDA0ns8mkTfRb X-Received: by 2002:a17:90b:4c46:b0:213:d3e3:ba44 with SMTP id np6-20020a17090b4c4600b00213d3e3ba44mr49488382pjb.18.1667917717294; Tue, 08 Nov 2022 06:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917717; cv=none; d=google.com; s=arc-20160816; b=gQAy1Qanwgc0qRPv/FgRsw1yCc1AevdvzlluMkn27EM9Ij+2oM3ZQnBrvUSqG5RNyU iHtE3EhcJbbrn4INIGgaC1uIE1/EgPcXdtdq/RoRRIuDvYZNQANfTQ8PgzuzyvHqEeJi LiW+3hRQyz08dpG0WkmvCI3CAIQsDvRHRMypEaBLW9/gN8otXFcgfaTVC12+NIltTacj ROqHArQohVWQEbSAemYgYy5ra6gmwMx90LHYV/K47X9LUmHROoE+zWO66ByjaCXhgaGp cbkdtkM5MwM65X1xWDuUuqsOMgMsdletRLvW0esHkECb5DXOOR7zHj+EGUQ18dqZADGB Ircw== 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=+Km2wSTS+HEL+2fseQzOIacGCgEiXFCLh7kPJKkiKYY=; b=GC4V54JHrGVSMlOzT000YFYBjtIk4oHcQZ8hrg1QMJeL5D8Xvk0A8O3RM66In5aWNt ytT2psfn1kUSsLndB/NWsGZYMltuTDOV2gqC+IDjcM8lUDzgCv3wOJ00pt2sHixOTYT1 f7qyadyCIXgU/uD8fmnufKy8d6sv4u5nJ0Per/ukJWmVCD/aUwuyYFeLHwWT0TSsyVKw ipJSchSJe86AqeJKSy2qabenFSlFPMc9hBETBC5KE5fboqCWGYajh2WPXXNJ2PZSEQZV ESmmvpWOBGBpvqt8KdzPLpXcOlz8auDs+FX9UkGeAnsdf2Ey3Z3Ad8rtJf0vkHXiuULv rJKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JV+nccWw; 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 b75-20020a63344e000000b0046f5ffcfc1dsi17220909pga.324.2022.11.08.06.28.23; Tue, 08 Nov 2022 06:28:37 -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=JV+nccWw; 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 S234417AbiKHOW5 (ORCPT + 99 others); Tue, 8 Nov 2022 09:22:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbiKHOWS (ORCPT ); Tue, 8 Nov 2022 09:22:18 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEC854B2A; Tue, 8 Nov 2022 06:22:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667917337; x=1699453337; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9wMt9wnnchEhbLXtKxX2j9VHDQPKe8GNUSxFdZnl9NM=; b=JV+nccWw2tmUCMBzCMns2veaLpZAPZZGOmcNoiV+Op3gkbbTUHVu0Lpp DUURDi4g7UZ10OeHF6F3oHmQ7LGepLQElIXp0dD4hyNOo6AFh6fhhK7eH d1jBSlnDUnqvEhfsA4mGFD2E1LOWIq5mbk6d+kQQjEavKYLjEBewvr2Is 1+euyMRjxSHGUDfW0kKAioRUoLfEhWgwL2Bip4eis4d2Vut57+oAKcEgu wHHtLmxXNQYUR4t3Qlo3N82hdBv+iMuOlX6SOvkF63tUtoas/3aG7Qo2x 7VMSPfbizY1iD150L7jgD0pBbpVwRFjIZw7yw8mze6qvqOqKmJLimUrmh g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="310700748" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="310700748" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 06:22:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="587386417" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="587386417" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 08 Nov 2022 06:22:03 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 89C534B5; Tue, 8 Nov 2022 16:22:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Hans de Goede , =?utf-8?q?Uwe_Kleine-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 4/6] pwm: lpss: Allow other drivers to enable PWM LPSS Date: Tue, 8 Nov 2022 16:22:24 +0200 Message-Id: <20221108142226.63161-5-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 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748938488483984516?= X-GMAIL-MSGID: =?utf-8?q?1748938488483984516?= The PWM LPSS device can be embedded in another device. In order to enable it, allow that drivers to probe a corresponding device. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg Reviewed-by: Hans de Goede --- drivers/pwm/pwm-lpss.h | 22 +-------------- .../linux/platform_data/x86}/pwm-lpss.h | 28 ++++--------------- 2 files changed, 6 insertions(+), 44 deletions(-) copy {drivers/pwm => include/linux/platform_data/x86}/pwm-lpss.h (53%) diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h index 4561d229b27d..b721532c6c3c 100644 --- a/drivers/pwm/pwm-lpss.h +++ b/drivers/pwm/pwm-lpss.h @@ -13,27 +13,10 @@ #include #include -struct device; +#include #define LPSS_MAX_PWMS 4 -struct pwm_lpss_boardinfo { - unsigned long clk_rate; - unsigned int npwm; - unsigned long base_unit_bits; - /* - * Some versions of the IP may stuck in the state machine if enable - * bit is not set, and hence update bit will show busy status till - * the reset. For the rest it may be otherwise. - */ - bool bypass; - /* - * On some devices the _PS0/_PS3 AML code of the GPU (GFX0) device - * messes with the PWM0 controllers state, - */ - bool other_devices_aml_touches_pwm_regs; -}; - extern const struct pwm_lpss_boardinfo pwm_lpss_byt_info; extern const struct pwm_lpss_boardinfo pwm_lpss_bsw_info; extern const struct pwm_lpss_boardinfo pwm_lpss_bxt_info; @@ -45,7 +28,4 @@ struct pwm_lpss_chip { const struct pwm_lpss_boardinfo *info; }; -struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, - const struct pwm_lpss_boardinfo *info); - #endif /* __PWM_LPSS_H */ diff --git a/drivers/pwm/pwm-lpss.h b/include/linux/platform_data/x86/pwm-lpss.h similarity index 53% copy from drivers/pwm/pwm-lpss.h copy to include/linux/platform_data/x86/pwm-lpss.h index 4561d229b27d..296bd837ddbb 100644 --- a/drivers/pwm/pwm-lpss.h +++ b/include/linux/platform_data/x86/pwm-lpss.h @@ -1,21 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Intel Low Power Subsystem PWM controller driver - * - * Copyright (C) 2014, Intel Corporation - * - * Derived from the original pwm-lpss.c - */ +/* Intel Low Power Subsystem PWM controller driver */ -#ifndef __PWM_LPSS_H -#define __PWM_LPSS_H +#ifndef __PLATFORM_DATA_X86_PWM_LPSS_H +#define __PLATFORM_DATA_X86_PWM_LPSS_H -#include #include struct device; -#define LPSS_MAX_PWMS 4 +struct pwm_lpss_chip; struct pwm_lpss_boardinfo { unsigned long clk_rate; @@ -34,18 +27,7 @@ struct pwm_lpss_boardinfo { bool other_devices_aml_touches_pwm_regs; }; -extern const struct pwm_lpss_boardinfo pwm_lpss_byt_info; -extern const struct pwm_lpss_boardinfo pwm_lpss_bsw_info; -extern const struct pwm_lpss_boardinfo pwm_lpss_bxt_info; -extern const struct pwm_lpss_boardinfo pwm_lpss_tng_info; - -struct pwm_lpss_chip { - struct pwm_chip chip; - void __iomem *regs; - const struct pwm_lpss_boardinfo *info; -}; - struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, const struct pwm_lpss_boardinfo *info); -#endif /* __PWM_LPSS_H */ +#endif /* __PLATFORM_DATA_X86_PWM_LPSS_H */ From patchwork Tue Nov 8 14:22:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2741063wru; Tue, 8 Nov 2022 06:28:28 -0800 (PST) X-Google-Smtp-Source: AMsMyM4zgzv6w2uiwIgq5hxK8AP4qrTd1xUCXpPFO/j0OB3+uIOJxeuyzU/1QgnU09YsGha6gz4w X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:630e with SMTP id b12-20020a056a00114c00b005282c7a630emr55481564pfm.86.1667917708027; Tue, 08 Nov 2022 06:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917708; cv=none; d=google.com; s=arc-20160816; b=L0XiZou9VHui+j/dDgKhVJLqM+RLKXJ00aoz/XMeIpS+yBgcExSYsiGih7rA3JqTOH PDnFn7aNVD1amVEaPHJf4aUj9Sm4wPmIIwoIuP5m1VbtwdSybTGbzWQTnSbtN46LKqk5 WZEMhBm2O8nE2BhIAMJpu2aTTc9TMbbk7Mww5Y6CbvG5iVo6TiwzVxKUvs61cZtM6hj9 vFx2cUzet7ZRQRBjBY1Gp9O6zXKveAfPo9qQL4YgDCU0/q2UZAxAc9hvsRqqB5FIqlEO SvizPP339K4w16CF5EgAV+/+0DmGyaO/kEdVsKGDeCdlIN8AZVxZtvjS2ILXN5wdMcXO +Dyg== 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=WjoQ7Wy3cYEBcirACJhx2v7EEY6eHrt56PdQOiz6Kcc=; b=dm04iBKQBwnE0HrdTEGqbXxl8aTVWn+Mna4Gq2OgZDGk/gn98XSd+J3mXg/cSG8CKm imu883G7wxlp4ibUaNo/5Q1KPtLkl1EaSWm8GHXNs4lof0TTOSk+/+92wbpDQuAcNndr RaTYa/h+NJRPS6J3i2zfktaCXIsi6Z1GnXsYE46ToY9lDjIdi/JXBI/5bQNvzrdS/wKK ixthoThShEdODej80Ef3YvyUxpbtTws35dxvkJIMCjOnpdxBXjaOpDsQcTi5dnXrNXyT QoIHkxx2/x0+2GQpWBMDifUq98QJPcukq4IArtA4S8IfpHZLbNL5eTX4KPk8cRVSNMdi nwEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fJ3Bc5U5; 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 e4-20020a17090301c400b0018666611f85si15933745plh.508.2022.11.08.06.28.13; Tue, 08 Nov 2022 06:28:28 -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=fJ3Bc5U5; 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 S234530AbiKHOWx (ORCPT + 99 others); Tue, 8 Nov 2022 09:22:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233807AbiKHOWL (ORCPT ); Tue, 8 Nov 2022 09:22:11 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F2454B1E; 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=VsJcziyUcLS2jz0W0PAWmK1QOKoj8deRzU/nYzqqEQU=; b=fJ3Bc5U55+8hYgAWOuiRe4giMeuNM/FeA14n87WN2opLQAJwHM0+xGJn 7yispibOlJ1vyzp2gmUJLBS39yBkVzvMGVghlR3cCrdo4jW+WiJxQANFs fqENY3p0qdkxQM16UTOSbt+YdPtbFXvs+YsV9HCbSBbSl9+MgoMKAO4qA MKpailFpZEwX2PS6YHFseILiRqlp7Dy+7cL47PC9vn+21RZ1bi0hd4WMV QfKx4VCJnadXZFymvhTECbpGhfgEmat7YxpYzYlBXnoMNueh9Y923Phtr YZSp0K8B5xQF7XugRlJGCVOkAYZ+girtevDYWCB1j2Dzy/dVWZhogP5jE w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="298219292" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="298219292" 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="761506503" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="761506503" 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 93544533; Tue, 8 Nov 2022 16:22:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Hans de Goede , =?utf-8?q?Uwe_Kleine-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 5/6] pwm: lpss: Add pwm_lpss_probe() stub Date: Tue, 8 Nov 2022 16:22:25 +0200 Message-Id: <20221108142226.63161-6-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748938478551292350?= X-GMAIL-MSGID: =?utf-8?q?1748938478551292350?= In case the PWM LPSS module is not provided, allow users to be compiled with a help of a pwm_lpss_probe() stub. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- include/linux/platform_data/x86/pwm-lpss.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/platform_data/x86/pwm-lpss.h b/include/linux/platform_data/x86/pwm-lpss.h index 296bd837ddbb..c868b396ed2c 100644 --- a/include/linux/platform_data/x86/pwm-lpss.h +++ b/include/linux/platform_data/x86/pwm-lpss.h @@ -4,6 +4,8 @@ #ifndef __PLATFORM_DATA_X86_PWM_LPSS_H #define __PLATFORM_DATA_X86_PWM_LPSS_H +#include +#include #include struct device; @@ -27,7 +29,16 @@ struct pwm_lpss_boardinfo { bool other_devices_aml_touches_pwm_regs; }; +#if IS_REACHABLE(CONFIG_PWM_LPSS) struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, const struct pwm_lpss_boardinfo *info); +#else +static inline +struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, + const struct pwm_lpss_boardinfo *info) +{ + return ERR_PTR(-ENODEV); +} +#endif /* CONFIG_PWM_LPSS */ #endif /* __PLATFORM_DATA_X86_PWM_LPSS_H */ From patchwork Tue Nov 8 14:22:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17066 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2741074wru; Tue, 8 Nov 2022 06:28:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jknN6QtXx+KYrIh7331PSzae3pDVEVXdRCPQ/J9FTRnD7np1gMI13pr0InkhHi1ZP33s4 X-Received: by 2002:a05:6a00:a86:b0:56f:3529:e310 with SMTP id b6-20020a056a000a8600b0056f3529e310mr7140248pfl.79.1667917708484; Tue, 08 Nov 2022 06:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917708; cv=none; d=google.com; s=arc-20160816; b=PDX11n6s0kG5/SOEqja5Pv7/+cTR7u8Bbb0EWBRlo98hSAxm+GhsPcevUhSvFAujcN aFr8DhBDnRRXhitqIdABOcQg7/hmqZ0/v2+YB9aT1SYeQ1nK4LzmCxxwfdgpOOBX80cw Av9pZn16/NJXg5DVWuSa6PRfnojqktVLx2Kzs5LIFcGm7TvwLre9Yrn8LXYkTzFNNNVz ZeMy6rBA6RwJI+4tQS8Zl3H9a0cW5sc225p0je2uZe8ikcfTR1lw5os7YRePFO25TIRU 5rT5WJIINr+odVEUDNIMqttJC2I8BVas1AaoQJZ26CTuj2T/z+jsUkF9zPnqQf+Ou0BM 3Bsg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902ced200b0017d2bb81273si16215193plg.600.2022.11.08.06.28.12; Tue, 08 Nov 2022 06:28:28 -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 + 99 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_Kleine-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748938479013512233?= X-GMAIL-MSGID: =?utf-8?q?1748938479013512233?= 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 Acked-by: Linus Walleij --- 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);