From patchwork Mon Nov 14 16:55:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2250816wru; Mon, 14 Nov 2022 08:59:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4S4HAcQXXzlF2G3LYfCxR5/9gi5wsn3SPxmqqhbQhPynHtFMGwAKAzKec08L+tsjq9zoDp X-Received: by 2002:a17:906:ae52:b0:7ad:4a55:5e19 with SMTP id lf18-20020a170906ae5200b007ad4a555e19mr11085400ejb.65.1668445181049; Mon, 14 Nov 2022 08:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445181; cv=none; d=google.com; s=arc-20160816; b=Xd5Egr//iHvaQaDSU1ZPXsfYgnvqsd/w1PXej9VrCihPxzUs06MP8rH2LXFzVY6+7E Xt8jjM4EMZP08dsBqkdCIGmTZTkrVtJNV5XBAb1i1mWtzJdJomd01hkQAhk7T4Iv6NIV ubl8P1XoG3ojoDBOjhKd7nitKbisClwi684dK2Lq3+m1i5KR4uRyUl6Iy1z39WubYmaY 6Sr0wlSpwBuQ+ofdGb034QUKs5CpuQJwQl9elFU8C0NWhaNWy+pIdfi+4dnLylV5t8+1 ZW1yM0EzK3jVGX4y2Uy72P3AvW3j/FRTr+fqPbXVPI8oA61dZ1fj2ivpHPacf5S49bhv +uFw== 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=4mJHNUNkUb7RaQffjAzU/xeJwrC/qNrnQPj0zB1QRdQ=; b=O5XG2dBBvuc8TuFbou47mZ+F0XZLdxQjWZxND/9BL2ZIC590oZPnI/uA9bBjcYYVVZ seFeFarImvThSwMpUyqXMazBjnfMRmVflYOdwzbFM+nkcfXJJPwpH3c9DN+/Zf9asEuO ldNsj2xnS99aLnegRiaJyLZBmQywFW+Ow23PA6cSC8NB6ANs8UY+qN0N/x8gq4rmgx0M AFxpClOrhOOXkf7rERoqfnU4Tx23ccij8hlj9DsDIN8fJtV/zsNBMsMFVVIzuMwND7Mw Lqmo1TKziGH/AHcMY19chPpLv4Jqx6g7jJ1hCOySlQQQCxk+n16MJMTSUdVyqlF2GHll 5OsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WaN+xPZK; 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 l9-20020a056402230900b0046150eb704csi8251988eda.532.2022.11.14.08.59.09; Mon, 14 Nov 2022 08:59:41 -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=WaN+xPZK; 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 S237694AbiKNQzi (ORCPT + 99 others); Mon, 14 Nov 2022 11:55:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237484AbiKNQz1 (ORCPT ); Mon, 14 Nov 2022 11:55:27 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7236FCE6; Mon, 14 Nov 2022 08:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444927; x=1699980927; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/5ATWhqQrc1DZJ4f0j7ZyUNBHQXbdLiioN7qk5/mljI=; b=WaN+xPZKEgkBTdTvXGn9VV+GSrKD5o19L+Z8GkL4UwSgzvxTfCPcaBvw DMhQYzCHMNnYh7al1jAwWZvdw2996ww0R++Z8oN+qoLAZBeiZsAfWEQt+ 0YsS9UDAlFTdQH0f0dpbD9T9go4k79SOYfNUEBJ9Lb+rrnWw+IfN7csz6 c1QuCW6vU1z+vu5k2fH1bJ1erRG02+ykPw6PUveEpzm+Lo7f0aFLYvtUF 7lImpXUjSlT8xjx2ugFrd4QBkm2UPui1JT1LxqqYie/vzNUvTDPW3mPmN cIZOQkY/if5JUhR9NjiAOJNkBOK/JntLH60pUGAelsU8kTgOm+8hH1iHw g==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="295382829" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="295382829" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="727593541" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="727593541" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2022 08:55:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DC9A3B7; Mon, 14 Nov 2022 18:55:46 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 1/7] pwm: Add a stub for devm_pwmchip_add() Date: Mon, 14 Nov 2022 18:55:39 +0200 Message-Id: <20221114165545.56088-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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?1749491574469973964?= X-GMAIL-MSGID: =?utf-8?q?1749491574469973964?= The devm_pwmchip_add() can be called by a module that optionally instantiates PWM chip. In the case of CONFIG_PWM=n, the compilation can't be performed. Hence, add a necessary stub. Signed-off-by: Andy Shevchenko Acked-by: Thierry Reding 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 Mon Nov 14 16:55:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2250815wru; Mon, 14 Nov 2022 08:59:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4QIazZDX+nEgbr4z1EXMnPCZscnLLid1+Pdm75V7roRr41gdPS7ETowC9T4EweXKa4C7YD X-Received: by 2002:aa7:c649:0:b0:463:b0de:c210 with SMTP id z9-20020aa7c649000000b00463b0dec210mr12096986edr.10.1668445180975; Mon, 14 Nov 2022 08:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445180; cv=none; d=google.com; s=arc-20160816; b=TEJsiPYtJ6S94vKq4NooAfxjlsPmYcw+3CEzrDLmFOqX0PxMNMlok7FmSzqkjuwgNs 7ag+oYqi/y3rJ0gBeNc3YMNIhPC00VIHU/RUEmf4GAkKU4+SlSSqO8q7cLkzD1kMDD1D U/yVynXWST4zwjlzVae99tohIGaonvg7ZWHCGSEhsc0GF6SNtWixfcC+klXaE8mhhmp+ 2kiRY13RJUIlAYJEfkX7yCwHQkxkTmfB0Qh4IBJDh6nowgdXmbJDly77zbUn/wHOKZy7 ROA+crXxIKutExt+pTwuanWODogGjj48xHrBol17D9PymKbBn8YJFS9cRi5qJDDboiTi H8XA== 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=vZZE9Whmb0Eca4vR+lCKP5AXpzYDuF3iwqprX5WYFE8=; b=sZAMJXHxgV5iwy7hGm4GOppArsN8DwuNxcaAYcXdLv1snlUNv+7jwWbtdaEu4qMOWV IsQhOP19noU7fCxw4VA9/FqKs9PVPc/XY3UGAbtdl8T7+pszuBxvZWrN7UG87wPfnMXM uGfEHReiZ9Dj9b8KulEJ3HAG4wY0pYbkJkdCHxT1BXR3VBZJrhnJojsuV9Zg3jIGssaI aQvXBtRwymM+Lef3Xvj/36oW5NI2XaCJpey9+6xzCmO6vUecib8RCCgTw697dNTE4iWI AtV1sBcM7kTxh2fGruUQnswMBsVQZ7XSBuUG4lEo5uhBtRVKQjPRDPI3kvgqmepSZVrG w/Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lU9dD0m7; 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 c20-20020a50f614000000b004588af9ea19si9580171edn.166.2022.11.14.08.59.15; Mon, 14 Nov 2022 08:59: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=lU9dD0m7; 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 S238036AbiKNQzq (ORCPT + 99 others); Mon, 14 Nov 2022 11:55:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236786AbiKNQz3 (ORCPT ); Mon, 14 Nov 2022 11:55:29 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B68315715; Mon, 14 Nov 2022 08:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444928; x=1699980928; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gGDtImubOcSLVP60+TzwKMDasoMDqFJiSB9lXa2+0Eg=; b=lU9dD0m7ywUUNSo+VuTImB3Bpfq7MoszSG4gtFlJabuUAEXFalcCYaj3 o09rj7PyuFsDJNNZVIdI4ALIjHo1NdXz9n1nHALeLFiG2xe8UkQ8zsZpI e1UcjTXFe8OYWMipO1GVpSW29+KrFgtFwwYbwDZM2CteLnIWKm75RTdtR sHtVzgqNPTBrkh6/UsU1x+/eLqm1jyPUkqpdJJW0O36EqvfeGLii+B6+u 02AGOQZdImA6igThD4wGFl1ZGSea2tJodKm7PwjGN8LxmV59JoGRxuEvK CpsGxlDRTzI+osvO2Ch+n+RoDxePvAnzo/3+prKGR5+8fLnyzDUjuOvSH g==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="292417752" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="292417752" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="702079042" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="702079042" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 14 Nov 2022 08:55:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id F0169339; Mon, 14 Nov 2022 18:55:46 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 2/7] pwm: lpss: Rename MAX_PWMS --> LPSS_MAX_PWMS Date: Mon, 14 Nov 2022 18:55:40 +0200 Message-Id: <20221114165545.56088-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-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,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?1749491574545623081?= X-GMAIL-MSGID: =?utf-8?q?1749491574545623081?= The MAX_PWMS definition is already being used by the 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 Acked-by: Thierry Reding 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 Mon Nov 14 16:55:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2250756wru; Mon, 14 Nov 2022 08:59:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5R24SfuPdy9eipwA3O3CuiOeiqaYnXCRXTz1wcdNt8W6v8lxCzt5Ox8Kbl0fsaGugH8eJz X-Received: by 2002:a17:90b:d86:b0:213:5dd:f523 with SMTP id bg6-20020a17090b0d8600b0021305ddf523mr14430147pjb.63.1668445169970; Mon, 14 Nov 2022 08:59:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445169; cv=none; d=google.com; s=arc-20160816; b=y902bTiu62rrVdcTVJvjfNI9RqQ9/vFEkAMHPPq5qfgSKOlRPOcD2/449OVSmFSDHa ba19Ua8XIUp0bNPAV4bwliY/g6uRjd6kRWE6LxJrO6kEeQO6u47HiKfONvRtNqZlhczb QriDIIdDRHqRD2v/T+IzpSRv6vJ/5xKUNDul2+F7igJHH7aYmPoOrx+R/b1IhRHnH+I3 glkj5C9nmiIVoDHVMC5UF51fVgYsubyk7H7BE/8M/qfivRZX/zLwvlKNvfmD9nzx0wLi f+ntUNhw5oSF6vG7Qb6Fem7xlbh02/2HQYoxehKc3yYTnTyKfzy47l9O/H3kD4gnNDwS jvtQ== 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=zONIO1g8Xxv1MsOcaYzMayrnroUYZ6yw0Nvc8kpI5iU=; b=bYe0LC3nHGvaMW3LsB9aIdF5a3Gj97cNBiiocmL1n4V0jIzN4TS+sCT0ZT6LpCrK3+ 45fdB3/YHN91vQL22BXVSRt95TuA2ljBij3P0Tw4OoDi16MDDJZvkkK22pqYxnrMKQB5 l9sqTxsc6FQKfajkRZpEwC+qYAdFhkOamGEkGXsLuoTeQCk0lKNwjM1xS4q94QKxSIdb tY9sxnN73rssCJXnU55iVezxec9xyqQEVhlUxL354oUPdch59optER41EGY8i6Dwe+kT rgkMtUEA4loOOCkoq7Hx4L6zezeKPYb1T4xGsU9NEG8o9Z+rdFCUy+BPRe1TGeBZZBWl mCKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Fy1XPPea; 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 m21-20020a170902d19500b00186971db5fbsi8907350plb.220.2022.11.14.08.59.15; Mon, 14 Nov 2022 08:59:29 -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=Fy1XPPea; 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 S238024AbiKNQzo (ORCPT + 99 others); Mon, 14 Nov 2022 11:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237434AbiKNQz1 (ORCPT ); Mon, 14 Nov 2022 11:55:27 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A37F5B3; Mon, 14 Nov 2022 08:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444926; x=1699980926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hBRMuBSSbtGLeszkWGLvZmNwu94+mL8SqSvJtb11lV8=; b=Fy1XPPeavFvP2CdGL3Z2yUglJkDmjs9JnmIaAf205oiovXRmC4d0kS1G 9kCErMm4TvhgjNVLb8J3C0MBwYPwfpum8dbOsGcMXDT6K5H6p6t3p2C36 dBs2s/VMdgGzoom0kKoIHmei3XwEvyOfCrLm+/MXfPB8fE6qapUMWrOt3 d2XiShnFr/hzcckuhbD9nciD76DHDb9COngD2WJgUGPT7j0FRKlrkiP99 02C+q9VHGcaKEspAzw343W30ZzKlvox4HOpBR4vnzq+xw3DKzpO7uWpTP NGqGN3iMf8cbv1xxUnvXjXDUXrG9Nt7/z7K0GudD72ewBbM8sGzLv+AdX Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="295382826" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="295382826" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="727593540" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="727593540" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2022 08:55:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0633B32E; Mon, 14 Nov 2022 18:55:47 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 3/7] pwm: lpss: Include headers we are the direct user of Date: Mon, 14 Nov 2022 18:55:41 +0200 Message-Id: <20221114165545.56088-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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?1749491562419190176?= X-GMAIL-MSGID: =?utf-8?q?1749491562419190176?= For the sake of integrity, include headers we are the direct user of. Replace the inclusion of device.h by a forward declaration of struct device plus a (cheaper) of types.h as device.h is an expensive include (measured in compiler effort). 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. Signed-off-by: Andy Shevchenko Acked-by: Thierry Reding 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 Mon Nov 14 16:55:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2250755wru; Mon, 14 Nov 2022 08:59:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5OfcoUuRX/fmuCdOAbUygxyt9AcZZmXUX05+5HJmZqPhy/pbIEn3yJ0yDcrF0OvbVbOAFz X-Received: by 2002:a17:903:4101:b0:188:a8a2:f43a with SMTP id r1-20020a170903410100b00188a8a2f43amr99387pld.130.1668445169786; Mon, 14 Nov 2022 08:59:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445169; cv=none; d=google.com; s=arc-20160816; b=Xnr+UNsjH9S9ZUOM2tiqPvXdET7VTQvxGlRCaQot0I1gjLlJ0ALqtWLGDo190880fD 9qmvieJk4TqKkezVnz9srx94t4gjVN3DYimMEGPe0dZLgp7yW9eCvS3C0XDKuvpvLFVY VGW6LZTcSURLGKXRw6IBNdDmJUlbkxDEKirKY9hIhIt0RpfQMgPHYJ6JvgRDaJJOINYu i/W9cWyP4yMQpKeYwzBVr+OrrlkLe57QSvTvtwdbPE7OmE89Zl7Fb+MIx6ng12alKJqE 2wz86wgsx/M3B/KltE8LXB2llJ9KchInoldqjJRvnlRs7tnXFXc0v+lAJc+pD/RBi5+d JKWw== 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=Fr7zZeYaHpV4yjUqOepaEOphFz0toYN7NihxT52I65U=; b=iMSn40s/3g1nvdNLyJrcXVkYNDBLPHodI30koHpSS2ZDrLnLMLA+RKOlSWuBrcOWaz ukh6tv7TFQmxFQrNZIvqxvE8fYOxyxMnY8WtUr2C2eMoshmD0EnAuGg5keS2Y2U1sz1I GAkxuozfGiyqoEAQhdk5H11KQcqhsc8LqKw3H0E8CTb5PpeChi8kBY76LHp94csIppzk jxjEJQsGxkQgpJ8IdEDUunF6qCZpdWc/uo6T/91h1AegT9YmOi851lBgmo4iI2kgLmNj pVHV9m03Esr1Qd7cgv+1FK2nqdx0NvE0eflwIpBObxjImUErdmzuAgPiAwY4d6rFglex OlSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TfvqZO61; 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 l27-20020a63571b000000b0046f622b47b9si10157898pgb.180.2022.11.14.08.59.15; Mon, 14 Nov 2022 08:59:29 -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=TfvqZO61; 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 S237848AbiKNQzl (ORCPT + 99 others); Mon, 14 Nov 2022 11:55:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237500AbiKNQz2 (ORCPT ); Mon, 14 Nov 2022 11:55:28 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB431116D; Mon, 14 Nov 2022 08:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444927; x=1699980927; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tc2JPC4Ucwzjez+ObJHFyVfZGmoZxVkh4qEL5MEhM04=; b=TfvqZO61wfG0TAKVUd38J5+CSC778/UdQ+Nj5fjr+ANz8hZd5pMRbBSf uyiVc1KgiI0h7GLsHEFRAKO4n6gBrLG8W3+/zrwcxsSRe6H6Xz20uFINi 60SW5UwTTm8w6QOr54Xqt5cz4khqAYW8KsHh8GiXUMjd5ZU+IdVwMUVJ8 3bOt8UV5J9vcBN+E59cil+Xjg+qNBUHCcwbClfuJk8+mdwax0EGxzv8IZ QZjFomdrySiR9RPOy4Hyj8siGaWpUN2vtx24GQQFTmzTgaKCPMhji5kpt zXXYVG/dYcgGnmsmRL3woml8ZUS2A6dDG7TP09TU4hJFBWetf6BsGQYbQ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="292417751" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="292417751" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="702079043" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="702079043" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 14 Nov 2022 08:55:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1C7B8348; Mon, 14 Nov 2022 18:55:47 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 4/7] pwm: lpss: Allow other drivers to enable PWM LPSS Date: Mon, 14 Nov 2022 18:55:42 +0200 Message-Id: <20221114165545.56088-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-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,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?1749491562542896474?= X-GMAIL-MSGID: =?utf-8?q?1749491562542896474?= 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 Acked-by: Thierry Reding Reviewed-by: Mika Westerberg Reviewed-by: Hans de Goede Acked-by: Uwe Kleine-König --- 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 Mon Nov 14 16:55:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2252473wru; Mon, 14 Nov 2022 09:02:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf6rYS4drUQgCxvWxDn/sfKgglIecBDU7snjKRonII9PbiD7vUiTYWY9DbkdzmIiZ5pKpbSi X-Received: by 2002:a17:902:eb81:b0:186:85a0:550 with SMTP id q1-20020a170902eb8100b0018685a00550mr95658plg.144.1668445324154; Mon, 14 Nov 2022 09:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445324; cv=none; d=google.com; s=arc-20160816; b=jBQxyeOcYG8Nz46e9D56Z/kFlsp4/uRn5BfJHzMtq9bkaoz9irnRJ36RSRQxmrW+0p OZjMBLD/iiGqh4WEfjOriXvFdWVCdejM9P5Sw075QZoZfD8PTzafRk+cnPQ5GWGshT3W NZmeUFGt2NG7xa9P8QOQyS/i68LtvBDnksOGX2VtVMAZiXc/QCg8E2k1THA/+OviJNOK qDA8K66EZk++QNspHpMsRhoQzxci0ow1Rw1psQ+D0ytC24pZPnaDWLHl0edrSA1n36AX 7zgSaqftpD1kx1PNITHXHBUn47c0c3aeWqnZoSDQwkJ4rByVLOFw4qOWs8B1Kmd6dYXl djig== 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=79B0RgyL4c/9hVcmdA8kqnmo+TBzLEHCw3cq9o9aFa8=; b=CTzA+Sf402S3ImSWjGb64YS5sqJfXPUtMSgQp+xOx7FehOb28pgy2Jr1ZyOyEYiG3H E0UQ7ZCtlvJVGWmcEGho0RPO3CPNGc0Z7IVvSibAuyX3fHTOcDw0XwCMgrMTAtig/zcX Zphyi5Tk1WxCTbJUJLWal2SWtDSlmZewmosE8252YiZHSNdg+67+fyU2Uy2Tsqi52QbU S80x4pU6q2aCgpPLpFWrTjEP0tQmkdSaZ/4sGgsFrJBWM4ilNUn302Y7GWjhKJhtQtEA Iw5y5IJyq3iWyh6OJyLqEvBC4CDo19S+OBqPflTi6JnzfmLoKd0IHtrr+Z5HnY1L2+UJ QwUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NGzwMexs; 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 z13-20020a170902d54d00b001782bd6c443si9981753plf.621.2022.11.14.09.01.46; Mon, 14 Nov 2022 09:02:04 -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=NGzwMexs; 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 S238092AbiKNQ4F (ORCPT + 99 others); Mon, 14 Nov 2022 11:56:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237618AbiKNQza (ORCPT ); Mon, 14 Nov 2022 11:55:30 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C18B5220E4; Mon, 14 Nov 2022 08:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444929; x=1699980929; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IkuaKQE6muJiKEUj5oH1o7j+tKeDX81ryQ4zKUFKwN0=; b=NGzwMexsYeSatPJrSGNRvPG3Aj+WZhOKl4k+J8GK7EBIo9hiGDa5xHbp rheDwZFV4vTFeSsANpEeJ0vtY7cCZUX9kQSkIZH1Uw+PmdNSExeLlVAoB IggKqdKubAjLluBlj9LO8ek6ae9zWpgvtXh1asoWdLJqy3jotJj4sPSaK JuSOEi2mSes4TzQvyKyX1N9Kt+17oznPaVKdIN/XL3okQ+LNHbnTh0sI1 PJZYnPSwJt7ooHxBnjOufK9U547wqaqSaNc8sh8Tr8dHmX6Wmi5lYg14r FW3YaVdtq8IhOXLH8TDe3YQMGOIubft7+z8gFa0xW0lWpB8bznh7ZnWOS A==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="295382843" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="295382843" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="727593561" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="727593561" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2022 08:55:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 223DF346; Mon, 14 Nov 2022 18:55:47 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 5/7] pwm: lpss: Rename pwm_lpss_probe() --> devm_pwm_lpss_probe() Date: Mon, 14 Nov 2022 18:55:43 +0200 Message-Id: <20221114165545.56088-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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?1749491724146307991?= X-GMAIL-MSGID: =?utf-8?q?1749491724146307991?= The pwm_lpss_probe() uses managed resources. Show this to the users explicitly by adding devm prefix to its name. Signed-off-by: Andy Shevchenko Acked-by: Uwe Kleine-König --- drivers/pwm/pwm-lpss-pci.c | 2 +- drivers/pwm/pwm-lpss-platform.c | 2 +- drivers/pwm/pwm-lpss.c | 6 +++--- include/linux/platform_data/x86/pwm-lpss.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-lpss-pci.c b/drivers/pwm/pwm-lpss-pci.c index 98413d364338..b4134bee2863 100644 --- a/drivers/pwm/pwm-lpss-pci.c +++ b/drivers/pwm/pwm-lpss-pci.c @@ -30,7 +30,7 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev, return err; info = (struct pwm_lpss_boardinfo *)id->driver_data; - lpwm = pwm_lpss_probe(&pdev->dev, pcim_iomap_table(pdev)[0], info); + lpwm = devm_pwm_lpss_probe(&pdev->dev, pcim_iomap_table(pdev)[0], info); if (IS_ERR(lpwm)) return PTR_ERR(lpwm); diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c index c48c6f2b2cd8..f350607e28bd 100644 --- a/drivers/pwm/pwm-lpss-platform.c +++ b/drivers/pwm/pwm-lpss-platform.c @@ -31,7 +31,7 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - lpwm = pwm_lpss_probe(&pdev->dev, base, info); + lpwm = devm_pwm_lpss_probe(&pdev->dev, base, info); if (IS_ERR(lpwm)) return PTR_ERR(lpwm); diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c index b8739cd2c235..bb740346b699 100644 --- a/drivers/pwm/pwm-lpss.c +++ b/drivers/pwm/pwm-lpss.c @@ -244,8 +244,8 @@ static const struct pwm_ops pwm_lpss_ops = { .owner = THIS_MODULE, }; -struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, - const struct pwm_lpss_boardinfo *info) +struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base, + const struct pwm_lpss_boardinfo *info) { struct pwm_lpss_chip *lpwm; unsigned long c; @@ -284,7 +284,7 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, return lpwm; } -EXPORT_SYMBOL_GPL(pwm_lpss_probe); +EXPORT_SYMBOL_GPL(devm_pwm_lpss_probe); MODULE_DESCRIPTION("PWM driver for Intel LPSS"); MODULE_AUTHOR("Mika Westerberg "); diff --git a/include/linux/platform_data/x86/pwm-lpss.h b/include/linux/platform_data/x86/pwm-lpss.h index 296bd837ddbb..c852fe24fe2a 100644 --- a/include/linux/platform_data/x86/pwm-lpss.h +++ b/include/linux/platform_data/x86/pwm-lpss.h @@ -27,7 +27,7 @@ struct pwm_lpss_boardinfo { bool other_devices_aml_touches_pwm_regs; }; -struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, void __iomem *base, - const struct pwm_lpss_boardinfo *info); +struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base, + const struct pwm_lpss_boardinfo *info); #endif /* __PLATFORM_DATA_X86_PWM_LPSS_H */ From patchwork Mon Nov 14 16:55:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2251390wru; Mon, 14 Nov 2022 09:00:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fBQvbtAvARYmuYSf8orHLYXMfYsl7Hx12BMARR39GeT0qS2WqAPEnf5EWC4zMlcVUjFAw X-Received: by 2002:a17:902:bcc9:b0:17f:cdd1:7ab1 with SMTP id o9-20020a170902bcc900b0017fcdd17ab1mr137545pls.86.1668445245104; Mon, 14 Nov 2022 09:00:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445245; cv=none; d=google.com; s=arc-20160816; b=PBmRyA/wWoKks/7Moon8w3pC+Apjr6wNQNYQIVM8gScsxWNmd3P1/L5oATJnDW30Gx 97HGg4aIqWNmfey2SW1ht/f1Nmox+YQSStP4JEYkyBhzf8VzSMvCkKIi/o8EAq4DxR3L zxbssAOiMrwagS7FvWyFdLOa+a4yUV07vl1XHtV4qXtvwaw+60Sp5CQ0D5BHgaVVPC/T iI7ph/IHYQw8UvQvzjqYrE8IIQawYg7lhKNtyyWLEdzNAGWDVjapqEUEq7KCax6+g3nj 8OSpD0rgRd7atXDdHOGi2INgw9WggWNGNCfetGgHYr1dVUCxaS46TdFq3XT6M7Sh5GsU HY8w== 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=MFKxy3kbakFchJNSIPgMdW8uXCXs6zXv162PRaFFwHk=; b=B8GgfCWtDIHnEyx0FeiIILJCRB9WnG4uwBFX4eKV+pCourIGlN2Dx2Mw5i280mALQQ 8ahUyp7px39b/Hxw1uhGZaOTJV44fNutEImo0vKw6cmTJlGLBv0lgGUUNf76sica/4vj P3RQ/WE7YQUXFuTbWb+8i+ObTTwIqH+row/Jijp1ai2BgwVKzv5lzJ7l2kRccJkVvMBO tRD2mgxRYUG/pFWYQHlMKj0veoygToxLKbWxa4XjtRhv8AD35t0xDbvJ785/1l0nFyQQ q+hHJMHjktQWf9SMl3ZkWvDNWlmFS16JRWTL7Vej5yxy5FCPEEqnX5BB1r3BSOnsdzQh bbkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UFSVZxDp; 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 k11-20020aa788cb000000b0056d89d8fba7si10715352pff.154.2022.11.14.09.00.28; Mon, 14 Nov 2022 09:00:45 -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=UFSVZxDp; 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 S238046AbiKNQ4B (ORCPT + 99 others); Mon, 14 Nov 2022 11:56:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237534AbiKNQza (ORCPT ); Mon, 14 Nov 2022 11:55:30 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88B6186CB; Mon, 14 Nov 2022 08:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444928; x=1699980928; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vb4Kjx+Zzgw7pJ7ccpP6XKDAM1GDRLtTdQAtD7V1YcM=; b=UFSVZxDpalM2YYD1T6RFq7dEwhdAGYuQZ5g8koAfC1UendLsd6DY7iQB jTffM8ir224m61XgRdK+XzM1darMRNGQDvy+EZ6mPuMqNPIOtoth4/GrB 8RjmONiA/F3CJL+vFFyGW4IU0drvQZgWixHMEA4waNl/RVKjLFx7CJsFy G/I3IJiYk1+KRn49PVAZ8ak4iMYaGnNdICG7J3PWNrzcvoWaBDHA2o04t +o3hTiwV5hlECM+JCo0KGKbxm3yS0OyR0z8RKz7Z8DCfnUM8vbEZCavon oGRpO8YT25wMy6gaoc9nTt9q/wFKqcp7c712qKD5r2CmNBJ+dMd++nI2p w==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="310728460" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="310728460" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="727593562" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="727593562" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2022 08:55:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2C7E7389; Mon, 14 Nov 2022 18:55:47 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 6/7] pwm: lpss: Add devm_pwm_lpss_probe() stub Date: Mon, 14 Nov 2022 18:55:44 +0200 Message-Id: <20221114165545.56088-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-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,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?1749491641603820530?= X-GMAIL-MSGID: =?utf-8?q?1749491641603820530?= In case the PWM LPSS module is not provided, allow users to be compiled with the help of the devm_pwm_lpss_probe() stub. Signed-off-by: Andy Shevchenko Acked-by: Thierry Reding 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 c852fe24fe2a..6ef21b8baec7 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 *devm_pwm_lpss_probe(struct device *dev, void __iomem *base, const struct pwm_lpss_boardinfo *info); +#else +static inline +struct pwm_lpss_chip *devm_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 Mon Nov 14 16:55:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2250826wru; Mon, 14 Nov 2022 08:59:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5zhuXlgDajK5jgaGJcoVxKnO2nQGQHwDUGJD7ZK/eI5FVTw0emTa5ej2TBsXK+ml70zrni X-Received: by 2002:a17:907:77c4:b0:78d:2af:a818 with SMTP id kz4-20020a17090777c400b0078d02afa818mr10616473ejc.675.1668445182042; Mon, 14 Nov 2022 08:59:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445182; cv=none; d=google.com; s=arc-20160816; b=t6u9aOmtZXVw+L1c+/0EuwQ3x28IbZ5TnINZU4Ap/IDO40+bPhvn/4bdAVesSZQRd0 J3ESm5RqD3YTIAavyKszS1scPE39KS5hENTmITwl3idqa+oxeXS/MgTi9XnZckQtGTmz GRRqRcq8tvL1hxcKBMmhoGAPPpqL0haFzVpZtZIZYeTRtqlLPYxH2oSz+G5vIFiCb+H9 kI79REsNGDsbRjNnjapaCitKQ43BoeQxH6nMpZ7irD+6bNgKsGcjiE2l0LrSNiErhgOG ur9gwPcuNunxBY8aZEzvl+pn3khscxtkVbPS8ViS7jmzbMdKq6wZaDgpoNratS0TmtmJ hSAg== 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=yWFVmlF0rasYQjl9XGtXc7cEz9jCP/FE+kFmZWwZyCc=; b=J++eJAEwOdhrCV3EUjzsIkDA1GTqblwUe9X1BjpDrZforBCb2jtzWjuTnR489DwTJh PBI0WZrXMW9VWYXIsV2wTcSynOwsh6OC6tTV9GYad4jj9gyu1RLGDIpbuU2ohouN3lRJ Vm9yZ6H3CS3jKGQmwvR/wrhWeuMcdSJkSjBcOV/h2yuJKF7Ms1lI8uvR+umJ1+mzOY8z kzgHC0jdFV8a64YpXmPyX+bEGmQsZg6c6scgltN2RgbCKPx2BoU/j2ju2Y+8HdZ4uNEc GpkPKXmDSwRIfYLSg8n/ptlj47+tdIL9oUMIJpkrIV+M8i/U1Tiuapay8RdyInHYQtF0 mrow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hQoUNycJ; 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 qw36-20020a1709066a2400b0078d4b605b71si8311050ejc.338.2022.11.14.08.59.17; Mon, 14 Nov 2022 08:59:42 -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=hQoUNycJ; 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 S238072AbiKNQz4 (ORCPT + 99 others); Mon, 14 Nov 2022 11:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237532AbiKNQza (ORCPT ); Mon, 14 Nov 2022 11:55:30 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF7215A3D; Mon, 14 Nov 2022 08:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668444928; x=1699980928; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4bK27zP/N3caFulgZnyVlq3ehz9vA1uIH/LjAHWuGOM=; b=hQoUNycJ282qkPU7tEt1ipLZ87QRHJ1DlZ/JDsZc1OxQaW6jMBOWEx61 JP/VS/IXp0CJKi4Si79oj/sYwNmiKmSjybYNmICtdblkiZgS5woSejAys 8149ySJIXCRn4/R27dpPqiVPysF2AddKu8FlDuJODGheVNS27fqiIv4fn um5ROQIJXLo7j0K8uh01DglQ1NoGTbDgJ38vgdp7KC9VjJWDOeu6EktjQ nWLxD9Vt1rrvSDf5SOa/PGdSmJUU3PY57vbvDJyPonCcteBNp5Y1FszN9 ExFlvMAt2YpyGPMTV6Ailr0KajWKLkrfjcNLeRTOfUVnWpy1CnBimcCJQ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="292417758" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="292417758" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:55:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="702079051" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="702079051" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 14 Nov 2022 08:55:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 346863B9; Mon, 14 Nov 2022 18:55:47 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Thierry Reding , Hans de Goede , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org Cc: Andy Shevchenko , Linus Walleij Subject: [PATCH v4 7/7] pinctrl: intel: Enumerate PWM device when community has a capability Date: Mon, 14 Nov 2022 18:55:45 +0200 Message-Id: <20221114165545.56088-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114165545.56088-1-andriy.shevchenko@linux.intel.com> References: <20221114165545.56088-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,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?1749491575480924780?= X-GMAIL-MSGID: =?utf-8?q?1749491575480924780?= Some of the Communities may have PWM capability. In such cases, enumerate the 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 Acked-by: Thierry Reding Reviewed-by: Mika Westerberg Acked-by: Linus Walleij Acked-by: Uwe Kleine-König --- drivers/pinctrl/intel/pinctrl-intel.c | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 52ecd66ce357..d61c22e9d531 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -21,6 +21,8 @@ #include #include +#include + #include "../core.h" #include "pinctrl-intel.h" @@ -46,6 +48,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 @@ -1499,6 +1503,30 @@ 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; + + if (!IS_REACHABLE(CONFIG_PWM_LPSS)) + return 0; + + pwm = devm_pwm_lpss_probe(pctrl->dev, community->regs + PWMC, &info); + if (IS_ERR(pwm)) + return PTR_ERR(pwm); + + return 0; +} + static int intel_pinctrl_probe(struct platform_device *pdev, const struct intel_pinctrl_soc_data *soc_data) { @@ -1584,6 +1612,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);