From patchwork Wed Oct 4 09:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Devi Priya X-Patchwork-Id: 148186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2621409vqb; Wed, 4 Oct 2023 02:06:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOsINeBgniMkFMxJWnWEgNPMpRdovT2XxLHLijOOMJ9f7OEMiknGT8I9t9SWHNq8js0lkJ X-Received: by 2002:a17:903:2611:b0:1c6:2fc0:9626 with SMTP id jd17-20020a170903261100b001c62fc09626mr1833636plb.6.1696410395459; Wed, 04 Oct 2023 02:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696410395; cv=none; d=google.com; s=arc-20160816; b=fC9XLeD4Q9+zJSQaeicsp3j2UmqdNjnjZZgKwIWgTcj+dh/FyUeAf64TS+g5O+sGCz PUn0620we4AbrCnVsmyAQ4+3NvKrYDnRU4iMMW0vpJoUbJkSQ7OvwR6uIZx9wd+YHhpU thXKREXA6iVcVCsUy9gJ0ceMwkzQXbSd0Sw+jvkA7GM63o7dXtCzWsQgzg5zMkmK7Eb4 G5595sLu5zLx0vEcoV+UebphQ+arxhHyISfgBIRBAh3m1XcklKMq43DfH9wQms0dZSUj aoCdPWPk4GN/0q4gF2UE7x3kKJbQQ9NEbK1Rc96nSQylm3cyq0VD+8SW86+SkO6UJ3y5 +MbA== 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:to:from :dkim-signature; bh=dHVR7Wxobr7XwKaP62PJLY+CpwSiYOfg8O2DSQP/ghg=; fh=UycDYdIyRZJe4f41XbmwXS5JSJ4V+IOpEs9nPSo/jr0=; b=bB5GskdSbLEUvrXXm23qVMuzNU1TR+hWJzBEzVrecDWwvsy1EXmRr0k9kltybb4/N7 HmG9HC9CmidP/feBHwoDQ732F1F310i9cGogqj7hzRv9i1My4MutdUmUWPeuxyDjltAm CVBlCDAllWbs0d+1r/czt9NTHHBDTh7W+UgeEZ/mNjP2fF2mvsnsoL5j4l1b1oofygRg zH0vaPFicm8i3Pi6Nuyfv/Y6/a0kh2k3203ujDBScSw/MoCUTcpdHSctGLdseAsHDAFU 1KlugJifaZamho8uLhh25+QByJQZg1dkRImyVcYuYO+Ak+SR/k9Rg9foDK35KR2pIMjJ iDng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JStyiju6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ik9-20020a170902ab0900b001c62e2ce6a8si3096384plb.449.2023.10.04.02.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:06:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JStyiju6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id AFA4280B6318; Wed, 4 Oct 2023 02:06:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241906AbjJDJFv (ORCPT + 18 others); Wed, 4 Oct 2023 05:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241893AbjJDJFp (ORCPT ); Wed, 4 Oct 2023 05:05:45 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 478B7102; Wed, 4 Oct 2023 02:05:36 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3948wlN9030701; Wed, 4 Oct 2023 09:05:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=dHVR7Wxobr7XwKaP62PJLY+CpwSiYOfg8O2DSQP/ghg=; b=JStyiju6qUC4Hh3BuBoRyhB6P7ZCvJEeFQRfb7EZZRU/oFZdMt39JO2MuLERW+R4FXwl YeN6eceQIGz84qMa6EGttyPr3CY25sPJ4j6RCeFTT9En/vs9P77hEGPK+JmtoYKHkglQ kGEWz3KO2+bS+ov2GSdqjISSDCGG5l/sgdnetIe73L8Zz9d6u3GHGEIWo2KY9Q6/68jC uoBNWltsFox/o3VZI1oLsPy2+/9uZPbg7GtZtL6Gi9WicRfMq8ftMVIdy1jXPRiGEjWu f7J/mjf+MHWmtZP7xmcjYDZioH8jbVqBfDPoUmbMCsnxsaOLhRdI7tQy4O3T9de96npD wQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3th18jgetm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 09:05:16 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39495FND007032 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Oct 2023 09:05:15 GMT Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Wed, 4 Oct 2023 02:05:10 -0700 From: Devi Priya To: , , , , , , , , , , , , , , Subject: [PATCH V13 1/4] pwm: driver for qualcomm ipq6018 pwm block Date: Wed, 4 Oct 2023 14:34:46 +0530 Message-ID: <20231004090449.256229-2-quic_devipriy@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004090449.256229-1-quic_devipriy@quicinc.com> References: <20231004090449.256229-1-quic_devipriy@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: tMUHqMAoLHqHgIaNbm94wsuZerecFNpw X-Proofpoint-ORIG-GUID: tMUHqMAoLHqHgIaNbm94wsuZerecFNpw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-04_01,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310040064 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:06:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778815226991993393 X-GMAIL-MSGID: 1778815226991993393 Driver for the PWM block in Qualcomm IPQ6018 line of SoCs. Based on driver from downstream Codeaurora kernel tree. Removed support for older (V1) variants because I have no access to that hardware. Tested on IPQ6010 based hardware. Co-developed-by: Baruch Siach Signed-off-by: Baruch Siach Signed-off-by: Devi Priya --- V13: No change V12: Fix the below clang warning for overflow check reported by kernel test robot drivers/pwm/pwm-ipq.c:122:11: warning: result of comparison of constant 16000000000 with expression of type 'unsigned long' is always false [-Wtautological-constant-out-of-range-compare] >> if (rate > 16ULL * GIGA) v11: Address comment from Uwe Kleine-König: Drop redundant registers field comments Fix period limit check in .apply Clarify the comment explaining skip of pre_div > pwm_div values Add explicit check for clock rate within limit Add comment explaining the selection of initial pre_div Use pwm_div division with remainder instead of separate diff calculation Round up duty_cycle calculation in .get_state v10: Restore round up in pwm_div calculation; otherwise diff is always <= 0, so only bingo match works Don't overwrite min_diff on every loop iteration v9: Address comment from Uwe Kleine-König: Use period_ns*rate in dividers calculation for better accuracy Round down pre_div and pwm_div Add a comment explaining why pwm_div can't underflow Add a comment explaining why pre_div > pwm_div end the search loop Drop 'CFG_' from register macros Rename to_ipq_pwm_chip() to ipq_pwm_from_chip() Change bare 'unsigned' to 'unsigned int' Clarify the comment on separate REG1 write for enable/disable Round up the period value in .get_state Use direct readl/writel so no need to check for regmap errors v7: Change 'offset' to 'reg' for the tcsr offset (Rob) Drop clock name; there is only one clock (Bjorn) Simplify probe failure code path (Bjorn) v6: Address Uwe Kleine-König review comments: Drop IPQ_PWM_MAX_DEVICES Rely on assigned-clock-rates; drop IPQ_PWM_CLK_SRC_FREQ Simplify register offset calculation Calculate duty cycle more precisely Refuse to set inverted polarity Drop redundant IPQ_PWM_REG1_ENABLE bit clear Remove x1000 factor in pwm_div calculation, use rate directly, and round up Choose initial pre_div such that pwm_div < IPQ_PWM_MAX_DIV Ensure pre_div <= pwm_div Rename close_ to best_ Explain in comment why effective_div doesn't overflow Limit pwm_div to IPQ_PWM_MAX_DIV - 1 to allow 100% duty cycle Disable clock only after pwmchip_remove() const pwm_ops Other changes: Add missing linux/bitfield.h header include (kernel test robot) Adjust code for PWM device node under TCSR (Rob Herring) v5: Use &tcsr_q6 syscon to access registers (Bjorn Andersson) Address Uwe Kleine-König review comments: Implement .get_state() Add IPQ_PWM_ prefix to local macros Use GENMASK/BIT/FIELD_PREP for register fields access Make type of config_div_and_duty() parameters consistent Derive IPQ_PWM_MIN_PERIOD_NS from IPQ_PWM_CLK_SRC_FREQ Integrate enable/disable into config_div_and_duty() to save register read, and reduce frequency glitch on update Use min() instead of min_t() Fix comment format Use dev_err_probe() to indicate probe step failure Add missing clk_disable_unprepare() in .remove Don't set .owner v4: Use div64_u64() to fix link for 32-bit targets ((kernel test robot , Uwe Kleine-König) v3: s/qcom,pwm-ipq6018/qcom,ipq6018-pwm/ (Rob Herring) Fix integer overflow on 32-bit targets (kernel test robot ) v2: Address Uwe Kleine-König review comments: Fix period calculation when out of range Don't set period larger than requested Remove PWM disable on configuration change Implement .apply instead of non-atomic .config/.enable/.disable Don't modify PWM on .request/.free Check pwm_div underflow Fix various code and comment formatting issues Other changes: Use u64 divisor safe division Remove now empty .request/.free drivers/pwm/Kconfig | 12 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-ipq.c | 282 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 295 insertions(+) create mode 100644 drivers/pwm/pwm-ipq.c diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 8ebcddf91f7b..c2d51680823a 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -282,6 +282,18 @@ config PWM_INTEL_LGM To compile this driver as a module, choose M here: the module will be called pwm-intel-lgm. +config PWM_IPQ + tristate "IPQ PWM support" + depends on ARCH_QCOM || COMPILE_TEST + depends on HAVE_CLK && HAS_IOMEM + help + Generic PWM framework driver for IPQ PWM block which supports + 4 pwm channels. Each of the these channels can be configured + independent of each other. + + To compile this driver as a module, choose M here: the module + will be called pwm-ipq. + config PWM_IQS620A tristate "Azoteq IQS620A PWM support" depends on MFD_IQS62X || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index c822389c2a24..1b69e8cb2b91 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_PWM_IMX1) += pwm-imx1.o obj-$(CONFIG_PWM_IMX27) += pwm-imx27.o obj-$(CONFIG_PWM_IMX_TPM) += pwm-imx-tpm.o obj-$(CONFIG_PWM_INTEL_LGM) += pwm-intel-lgm.o +obj-$(CONFIG_PWM_IPQ) += pwm-ipq.o obj-$(CONFIG_PWM_IQS620A) += pwm-iqs620a.o obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o obj-$(CONFIG_PWM_KEEMBAY) += pwm-keembay.o diff --git a/drivers/pwm/pwm-ipq.c b/drivers/pwm/pwm-ipq.c new file mode 100644 index 000000000000..5dbe46bb56d6 --- /dev/null +++ b/drivers/pwm/pwm-ipq.c @@ -0,0 +1,282 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 +/* + * Copyright (c) 2016-2017, 2020 The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* The frequency range supported is 1 Hz to clock rate */ +#define IPQ_PWM_MAX_PERIOD_NS ((u64)NSEC_PER_SEC) + +/* + * The max value specified for each field is based on the number of bits + * in the pwm control register for that field + */ +#define IPQ_PWM_MAX_DIV 0xFFFF + +/* + * Two 32-bit registers for each PWM: REG0, and REG1. + * Base offset for PWM #i is at 8 * #i. + */ +#define IPQ_PWM_REG0 0 +#define IPQ_PWM_REG0_PWM_DIV GENMASK(15, 0) +#define IPQ_PWM_REG0_HI_DURATION GENMASK(31, 16) + +#define IPQ_PWM_REG1 4 +#define IPQ_PWM_REG1_PRE_DIV GENMASK(15, 0) +/* + * Enable bit is set to enable output toggling in pwm device. + * Update bit is set to reflect the changed divider and high duration + * values in register. + */ +#define IPQ_PWM_REG1_UPDATE BIT(30) +#define IPQ_PWM_REG1_ENABLE BIT(31) + +struct ipq_pwm_chip { + struct pwm_chip chip; + struct clk *clk; + void __iomem *mem; +}; + +static struct ipq_pwm_chip *ipq_pwm_from_chip(struct pwm_chip *chip) +{ + return container_of(chip, struct ipq_pwm_chip, chip); +} + +static unsigned int ipq_pwm_reg_read(struct pwm_device *pwm, unsigned int reg) +{ + struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(pwm->chip); + unsigned int off = 8 * pwm->hwpwm + reg; + + return readl(ipq_chip->mem + off); +} + +static void ipq_pwm_reg_write(struct pwm_device *pwm, unsigned int reg, + unsigned int val) +{ + struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(pwm->chip); + unsigned int off = 8 * pwm->hwpwm + reg; + + writel(val, ipq_chip->mem + off); +} + +static void config_div_and_duty(struct pwm_device *pwm, unsigned int pre_div, + unsigned int pwm_div, unsigned long rate, u64 duty_ns, + bool enable) +{ + unsigned long hi_dur; + unsigned long val = 0; + + /* + * high duration = pwm duty * (pwm div + 1) + * pwm duty = duty_ns / period_ns + */ + hi_dur = div64_u64(duty_ns * rate, (pre_div + 1) * NSEC_PER_SEC); + + val = FIELD_PREP(IPQ_PWM_REG0_HI_DURATION, hi_dur) | + FIELD_PREP(IPQ_PWM_REG0_PWM_DIV, pwm_div); + ipq_pwm_reg_write(pwm, IPQ_PWM_REG0, val); + + val = FIELD_PREP(IPQ_PWM_REG1_PRE_DIV, pre_div); + ipq_pwm_reg_write(pwm, IPQ_PWM_REG1, val); + + /* PWM enable toggle needs a separate write to REG1 */ + val |= IPQ_PWM_REG1_UPDATE; + if (enable) + val |= IPQ_PWM_REG1_ENABLE; + ipq_pwm_reg_write(pwm, IPQ_PWM_REG1, val); +} + +static int ipq_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(chip); + unsigned int pre_div, pwm_div, best_pre_div, best_pwm_div; + unsigned long rate = clk_get_rate(ipq_chip->clk); + u64 period_ns, duty_ns, period_rate; + u64 min_diff; + + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + + if (state->period < DIV64_U64_ROUND_UP(NSEC_PER_SEC, rate)) + return -ERANGE; + + period_ns = min(state->period, IPQ_PWM_MAX_PERIOD_NS); + duty_ns = min(state->duty_cycle, period_ns); + + /* + * period_ns is 1G or less. As long as rate is less than 16 GHz, + * period_rate does not overflow. Make that explicit. + */ + if ((unsigned long long)rate > 16ULL * GIGA) + return -EINVAL; + period_rate = period_ns * rate; + best_pre_div = IPQ_PWM_MAX_DIV; + best_pwm_div = IPQ_PWM_MAX_DIV; + /* + * We don't need to consider pre_div values smaller than + * + * period_rate + * pre_div_min := ------------------------------------ + * NSEC_PER_SEC * (IPQ_PWM_MAX_DIV + 1) + * + * because pre_div = pre_div_min results in a better + * approximation. + */ + pre_div = div64_u64(period_rate, + (u64)NSEC_PER_SEC * (IPQ_PWM_MAX_DIV + 1)); + min_diff = period_rate; + + for (; pre_div <= IPQ_PWM_MAX_DIV; pre_div++) { + u64 remainder; + + pwm_div = div64_u64_rem(period_rate, + (u64)NSEC_PER_SEC * (pre_div + 1), &remainder); + /* pwm_div is unsigned; the check below catches underflow */ + pwm_div--; + + /* + * Swapping values for pre_div and pwm_div produces the same + * period length. So we can skip all settings with pre_div > + * pwm_div which results in bigger constraints for selecting + * the duty_cycle than with the two values swapped. + */ + if (pre_div > pwm_div) + break; + + /* + * Make sure we can do 100% duty cycle where + * hi_dur == pwm_div + 1 + */ + if (pwm_div > IPQ_PWM_MAX_DIV - 1) + continue; + + if (remainder < min_diff) { + best_pre_div = pre_div; + best_pwm_div = pwm_div; + min_diff = remainder; + + if (min_diff == 0) /* bingo */ + break; + } + } + + /* config divider values for the closest possible frequency */ + config_div_and_duty(pwm, best_pre_div, best_pwm_div, + rate, duty_ns, state->enabled); + + return 0; +} + +static int ipq_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + struct pwm_state *state) +{ + struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(chip); + unsigned long rate = clk_get_rate(ipq_chip->clk); + unsigned int pre_div, pwm_div, hi_dur; + u64 effective_div, hi_div; + u32 reg0, reg1; + + reg0 = ipq_pwm_reg_read(pwm, IPQ_PWM_REG0); + reg1 = ipq_pwm_reg_read(pwm, IPQ_PWM_REG1); + + state->polarity = PWM_POLARITY_NORMAL; + state->enabled = reg1 & IPQ_PWM_REG1_ENABLE; + + pwm_div = FIELD_GET(IPQ_PWM_REG0_PWM_DIV, reg0); + hi_dur = FIELD_GET(IPQ_PWM_REG0_HI_DURATION, reg0); + pre_div = FIELD_GET(IPQ_PWM_REG1_PRE_DIV, reg1); + + /* No overflow here, both pre_div and pwm_div <= 0xffff */ + effective_div = (u64)(pre_div + 1) * (pwm_div + 1); + state->period = DIV64_U64_ROUND_UP(effective_div * NSEC_PER_SEC, rate); + + hi_div = hi_dur * (pre_div + 1); + state->duty_cycle = DIV64_U64_ROUND_UP(hi_div * NSEC_PER_SEC, rate); + + return 0; +} + +static const struct pwm_ops ipq_pwm_ops = { + .apply = ipq_pwm_apply, + .get_state = ipq_pwm_get_state, + .owner = THIS_MODULE, +}; + +static int ipq_pwm_probe(struct platform_device *pdev) +{ + struct ipq_pwm_chip *pwm; + struct device *dev = &pdev->dev; + int ret; + + pwm = devm_kzalloc(dev, sizeof(*pwm), GFP_KERNEL); + if (!pwm) + return -ENOMEM; + + platform_set_drvdata(pdev, pwm); + + pwm->mem = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(pwm->mem)) + return dev_err_probe(dev, PTR_ERR(pwm->mem), + "regs map failed"); + + pwm->clk = devm_clk_get(dev, NULL); + if (IS_ERR(pwm->clk)) + return dev_err_probe(dev, PTR_ERR(pwm->clk), + "failed to get clock"); + + ret = clk_prepare_enable(pwm->clk); + if (ret) + return dev_err_probe(dev, ret, "clock enable failed"); + + pwm->chip.dev = dev; + pwm->chip.ops = &ipq_pwm_ops; + pwm->chip.npwm = 4; + + ret = pwmchip_add(&pwm->chip); + if (ret < 0) { + dev_err_probe(dev, ret, "pwmchip_add() failed\n"); + clk_disable_unprepare(pwm->clk); + } + + return ret; +} + +static int ipq_pwm_remove(struct platform_device *pdev) +{ + struct ipq_pwm_chip *pwm = platform_get_drvdata(pdev); + + pwmchip_remove(&pwm->chip); + clk_disable_unprepare(pwm->clk); + + return 0; +} + +static const struct of_device_id pwm_ipq_dt_match[] = { + { .compatible = "qcom,ipq6018-pwm", }, + {} +}; +MODULE_DEVICE_TABLE(of, pwm_ipq_dt_match); + +static struct platform_driver ipq_pwm_driver = { + .driver = { + .name = "ipq-pwm", + .of_match_table = pwm_ipq_dt_match, + }, + .probe = ipq_pwm_probe, + .remove = ipq_pwm_remove, +}; + +module_platform_driver(ipq_pwm_driver); + +MODULE_LICENSE("Dual BSD/GPL"); From patchwork Wed Oct 4 09:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Devi Priya X-Patchwork-Id: 148185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2621381vqb; Wed, 4 Oct 2023 02:06:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFAs0iQkD2bmXc1r+70O8ZFXbDnP05EJzFXu/P4H3ppXQpc4VNBwgQOLB1YMMr7LBlzQEf X-Received: by 2002:a17:903:230e:b0:1c3:e5bf:a9f8 with SMTP id d14-20020a170903230e00b001c3e5bfa9f8mr2260119plh.19.1696410391751; Wed, 04 Oct 2023 02:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696410391; cv=none; d=google.com; s=arc-20160816; b=J9vgbyrhvIrXycw7Utjv/bHDFO0SG/XJb/Wc0IF9v1HWqTZWoTLmqKgqSeRRMKaTsC MP6e4l9uQ8WnD60PCKNA2UFbQuQ/zeWxDc+MjZQZ0iDnZQ7XxDsk3cPjLT9UTPURAExI BzGW170zPrkY3LZES0c/nfJVDz1tyOPJEv2k0FHJEDRKoqMjd/IAfUXaf9Xx6EHPhzQ+ jYyviYNLugDE+4Yu0vBdGv6qWZRexW2Kosessn0G6mXVFI9noLHXRL2tZggKiJHU03sB ahSXjBgXi44b1Dx/2MGn/MPP8mkL1WMHgMZ7CgJ+wskO+ibRfQxEtF5ekUTUzLD7Pc42 9JBA== 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:to:from :dkim-signature; bh=KLlIbxbr6FoU2YW+qTSg2/yxNKk+LwDOZJ8E9V40cmk=; fh=UycDYdIyRZJe4f41XbmwXS5JSJ4V+IOpEs9nPSo/jr0=; b=VQRvnuFO5EirJejM6F4lkxGkGKcLhgD92m5wN7jsNJVBkeDWeROJO3sMFUstFXujfk esn0x4MDdpJ3WrJa99KOsnCar2S552EhRwlkr7gPb4QG4ubyZR/tPTJDlLh1FF8zRQtx CpvihEHLZvI2euTKuqVJMAnEOj84JJG+ucDJ/q3a13qdB6dLCz6MAG7yAmceQKhTYRBk 3tmpTeN1yzRmGSmxu+V7h2tS+VlM11YCsugCoLiIbH773dZ9oj4BcW0aAZePBHpOFJZl XR2G59op1WAYLPq6lipkQEO3vYh7ykNnYxETHJ+KcuNGF0ybNK39wOzVQfsB4Oj1KlXx oWZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=baIquWe0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f16-20020a170902ce9000b001c60c77ec1csi3641833plg.511.2023.10.04.02.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=baIquWe0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F41BE807756F; Wed, 4 Oct 2023 02:06:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241974AbjJDJGJ (ORCPT + 18 others); Wed, 4 Oct 2023 05:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241934AbjJDJFw (ORCPT ); Wed, 4 Oct 2023 05:05:52 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB830E9; Wed, 4 Oct 2023 02:05:40 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3945XZC6014767; Wed, 4 Oct 2023 09:05:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=KLlIbxbr6FoU2YW+qTSg2/yxNKk+LwDOZJ8E9V40cmk=; b=baIquWe06O/7gLkahG32HUrEZVrVMwPGxfpo0g9+iO0rIeQAPxTkw6WBd4y4MVGcNlc1 l18GYAvaa3ePEx6E/KvZXC1UxTmA6IlpZgnIsAJTB0ZDqkIqE2tqm6HzimwfNlcs97vg +XQjm+uglGwlRwC34FguhFOw/vKk6jj+vg3nqbvMEFY3+tnB/O1rETRqducYiSrbnVoA IFzjkU/OBCOMZntrdn9rcytLMSptRRpLxhCG+WQ+RlFJI9JmF8S3QVYeG4qf+a53Hqml 3XpNdNfH4bAgNFc4g25RcX2AxQiLhE2STwSWi3lQuCNZbZM1T6y3ssCFnVMqRN2T559n eA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tgr9mhcjt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 09:05:22 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39495KHv014034 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Oct 2023 09:05:20 GMT Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Wed, 4 Oct 2023 02:05:15 -0700 From: Devi Priya To: , , , , , , , , , , , , , , Subject: [PATCH V13 2/4] dt-bindings: pwm: add IPQ6018 binding Date: Wed, 4 Oct 2023 14:34:47 +0530 Message-ID: <20231004090449.256229-3-quic_devipriy@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004090449.256229-1-quic_devipriy@quicinc.com> References: <20231004090449.256229-1-quic_devipriy@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: XQEd-T8x5J1QuMSJw4Bh92ImV3vXhjvt X-Proofpoint-ORIG-GUID: XQEd-T8x5J1QuMSJw4Bh92ImV3vXhjvt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-04_01,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310040064 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:06:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778815222784961105 X-GMAIL-MSGID: 1778815222784961105 DT binding for the PWM block in Qualcomm IPQ6018 SoC. Reviewed-by: Bjorn Andersson Co-developed-by: Baruch Siach Signed-off-by: Baruch Siach Signed-off-by: Devi Priya Reviewed-by: Krzysztof Kozlowski --- v13: Updated the file name to match the compatible Sorted the properties and updated the order in the required field Dropped the syscon node from examples v12: Picked up the R-b tag v11: No change v10: No change v9: Add 'ranges' property to example (Rob) Drop label in example (Rob) v8: Add size cell to 'reg' (Rob) v7: Use 'reg' instead of 'offset' (Rob) Drop 'clock-names' and 'assigned-clock*' (Bjorn) Use single cell address/size in example node (Bjorn) Move '#pwm-cells' lower in example node (Bjorn) List 'reg' as required v6: Device node is child of TCSR; remove phandle (Rob Herring) Add assigned-clocks/assigned-clock-rates (Uwe Kleine-König) v5: Use qcom,pwm-regs for phandle instead of direct regs (Bjorn Andersson, Kathiravan T) v4: Update the binding example node as well (Rob Herring's bot) v3: s/qcom,pwm-ipq6018/qcom,ipq6018-pwm/ (Rob Herring) v2: Make #pwm-cells const (Rob Herring) .../bindings/pwm/qcom,ipq6018-pwm.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/qcom,ipq6018-pwm.yaml diff --git a/Documentation/devicetree/bindings/pwm/qcom,ipq6018-pwm.yaml b/Documentation/devicetree/bindings/pwm/qcom,ipq6018-pwm.yaml new file mode 100644 index 000000000000..6d0d7ed271f7 --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/qcom,ipq6018-pwm.yaml @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/qcom,ipq6018-pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm IPQ6018 PWM controller + +maintainers: + - Baruch Siach + +properties: + compatible: + const: qcom,ipq6018-pwm + + reg: + description: Offset of PWM register in the TCSR block. + maxItems: 1 + + clocks: + maxItems: 1 + + "#pwm-cells": + const: 2 + +required: + - compatible + - reg + - clocks + - "#pwm-cells" + +additionalProperties: false + +examples: + - | + #include + + pwm: pwm@a010 { + compatible = "qcom,ipq6018-pwm"; + reg = <0xa010 0x20>; + clocks = <&gcc GCC_ADSS_PWM_CLK>; + assigned-clocks = <&gcc GCC_ADSS_PWM_CLK>; + assigned-clock-rates = <100000000>; + #pwm-cells = <2>; + }; From patchwork Wed Oct 4 09:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devi Priya X-Patchwork-Id: 148198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6f87:b0:13f:353d:d1ed with SMTP id tl7csp2488764rwb; Wed, 4 Oct 2023 02:18:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFE1ppQkKiGFRg1pOPG2KYabUAAN3Rrtn0eppz4D1POmn/8XywyRqJ6kCkCiODmxgAuKQbc X-Received: by 2002:a05:6a00:2404:b0:68a:45a1:c0ee with SMTP id z4-20020a056a00240400b0068a45a1c0eemr2124341pfh.15.1696411106324; Wed, 04 Oct 2023 02:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696411106; cv=none; d=google.com; s=arc-20160816; b=F3ZG5wpldl5BlK58pjmXb8sudAcTcA04wFfDQY2IybLOl60CSRBGuDxPqNZmKGEy0F 3rUEUZu6aZVc/huwSmlif2LIJpq+YSgJRKuhF1da0T42ZKPlRYOi7bG/C6ksQRTENnlU ymFZnKFR7f0ZCRy/s3cJ3I5Js0fMPd9YmViXOoXqgO2VZyi8Ws6/STAw4Rbuo3uJRw+1 9pNS4djvIs3vhQ4ondJQ++CKSA6zou6v4t1nyl7JsMc1jihZudrurAfkfWR2LKg30XbV XTF3+Ds33Xy8yFbV39BMrAootPhuUvg4lQDYA5o+Q/xQJWc8SmXCW/qvRh+KOo19ZtOU ZC4w== 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:to:from :dkim-signature; bh=pl0XitQlQbuU4A8mQQ0bS01oCfOmc+xlq+Q+YQKCFCA=; fh=UycDYdIyRZJe4f41XbmwXS5JSJ4V+IOpEs9nPSo/jr0=; b=TOzl4vbqpVsAdoXwiUTyzxDj4CJ6KZ2tR+m1LlUgCO15oTWd9NGmSOBcG7chXIhl0e Qhr1RDj2H9oIRONLbMD03RxNrcI+4vskesVrdjToxPoK2PX5fvqkwtIL0zLE6iVZFtQE p2JzGM914s14KBSumAV/qHx26Lr3utKuA14RjlUEMYPtn50zw5QII8NlvMJXFL1vUxco aaQqop/N7qY8tRICAPtqok4AL73IYYn10HR03m+fagvLpPrVSpw/j56saEKnb7Q0kQjt koPgCyD1jFY2D9m8WpDN+HKt29jRmOLikmEB3/GkKVfNeOoJKhAQrEdWw+b7NxBOy7Xy vFHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XBSQE0PF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00563df2ba23fsi3194656pgb.845.2023.10.04.02.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:18:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XBSQE0PF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A053B81E9A57; Wed, 4 Oct 2023 02:18:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbjJDJSZ (ORCPT + 18 others); Wed, 4 Oct 2023 05:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242111AbjJDJGb (ORCPT ); Wed, 4 Oct 2023 05:06:31 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C845E0; Wed, 4 Oct 2023 02:06:00 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3945skwR010880; Wed, 4 Oct 2023 09:05:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=pl0XitQlQbuU4A8mQQ0bS01oCfOmc+xlq+Q+YQKCFCA=; b=XBSQE0PFhGFOuV9j1IEBuR9oPwtgyq8fGuGceBaur4UgzIhoZrPgYtHmP3DZCIdqTbZ4 JFXZjUrCvuO6cu6M/G7rfMylklDTuhJKCIOE0g0uYz4JllGyWPDZtZG0QyHxMnoys8dI JY165VbyJ/yi4iMXXL+AXyrpfu5+G8XD4Er0693Bz3/zc7Y2nxh5EqDvb275nZKc9qLD JhQTkYkfYMtFejTXjkXHNTKevgGlusfD9BJ7ww0MSqH496g8glmaa0mj5loYCPDe1WIx LTrjQTsanC9wnh4vGQ8f4ngvnjr8Uz1jXnMGBjIjxxpxsLtCJDNmA+w/ck/c+1FP/YPC FQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tgxrjrrdf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 09:05:26 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39495Qft022348 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Oct 2023 09:05:26 GMT Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Wed, 4 Oct 2023 02:05:20 -0700 From: Devi Priya To: , , , , , , , , , , , , , , Subject: [PATCH V13 3/4] dt-bindings: mfd: qcom,tcsr: Add simple-mfd support for IPQ6018 Date: Wed, 4 Oct 2023 14:34:48 +0530 Message-ID: <20231004090449.256229-4-quic_devipriy@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004090449.256229-1-quic_devipriy@quicinc.com> References: <20231004090449.256229-1-quic_devipriy@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: u8xJiPeF6VzvtIaXNlmr20g6uXStt41g X-Proofpoint-ORIG-GUID: u8xJiPeF6VzvtIaXNlmr20g6uXStt41g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-04_01,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 suspectscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310040064 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:18:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778815971699637501 X-GMAIL-MSGID: 1778815971699637501 Update the binding to include pwm as the child node to TCSR block and add simple-mfd support for IPQ6018. Signed-off-by: Devi Priya --- V13: Added simple-mfd support for IPQ6018 based devices Added support to include pwm as the child node to TCSR Included syscon node found on IPQ6018 to the examples .../devicetree/bindings/mfd/qcom,tcsr.yaml | 100 ++++++++++++------ 1 file changed, 69 insertions(+), 31 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml index 33c3d023a106..14267a493b15 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml @@ -15,41 +15,58 @@ description: properties: compatible: - items: - - enum: - - qcom,msm8976-tcsr - - qcom,msm8998-tcsr - - qcom,qcs404-tcsr - - qcom,sc7180-tcsr - - qcom,sc7280-tcsr - - qcom,sc8280xp-tcsr - - qcom,sdm630-tcsr - - qcom,sdm845-tcsr - - qcom,sdx55-tcsr - - qcom,sdx65-tcsr - - qcom,sm4450-tcsr - - qcom,sm8150-tcsr - - qcom,sm8450-tcsr - - qcom,tcsr-apq8064 - - qcom,tcsr-apq8084 - - qcom,tcsr-ipq5332 - - qcom,tcsr-ipq6018 - - qcom,tcsr-ipq8064 - - qcom,tcsr-ipq8074 - - qcom,tcsr-ipq9574 - - qcom,tcsr-mdm9615 - - qcom,tcsr-msm8226 - - qcom,tcsr-msm8660 - - qcom,tcsr-msm8916 - - qcom,tcsr-msm8953 - - qcom,tcsr-msm8960 - - qcom,tcsr-msm8974 - - qcom,tcsr-msm8996 - - const: syscon + oneOf: + - items: + - enum: + - qcom,msm8976-tcsr + - qcom,msm8998-tcsr + - qcom,qcs404-tcsr + - qcom,sc7180-tcsr + - qcom,sc7280-tcsr + - qcom,sc8280xp-tcsr + - qcom,sdm630-tcsr + - qcom,sdm845-tcsr + - qcom,sdx55-tcsr + - qcom,sdx65-tcsr + - qcom,sm4450-tcsr + - qcom,sm8150-tcsr + - qcom,sm8450-tcsr + - qcom,tcsr-apq8064 + - qcom,tcsr-apq8084 + - qcom,tcsr-ipq5332 + - qcom,tcsr-ipq6018 + - qcom,tcsr-ipq8064 + - qcom,tcsr-ipq8074 + - qcom,tcsr-ipq9574 + - qcom,tcsr-mdm9615 + - qcom,tcsr-msm8226 + - qcom,tcsr-msm8660 + - qcom,tcsr-msm8916 + - qcom,tcsr-msm8953 + - qcom,tcsr-msm8960 + - qcom,tcsr-msm8974 + - qcom,tcsr-msm8996 + - const: syscon + - items: + - const: qcom,tcsr-ipq6018 + - const: syscon + - const: simple-mfd reg: maxItems: 1 + ranges: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + +patternProperties: + "pwm@[a-f0-9]+$": + $ref: ../pwm/qcom,ipq6018-pwm.yaml + required: - compatible - reg @@ -57,8 +74,29 @@ required: additionalProperties: false examples: + # Example 1 - Syscon node found on MSM8960 - | syscon@1a400000 { compatible = "qcom,tcsr-msm8960", "syscon"; reg = <0x1a400000 0x100>; }; + # Example 2 - Syscon node found on IPQ6018 + - | + #include + + syscon@1937000 { + compatible = "qcom,tcsr-ipq6018", "syscon", "simple-mfd"; + reg = <0x01937000 0x21000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x1937000 0x21000>; + + pwm: pwm@a010 { + compatible = "qcom,ipq6018-pwm"; + reg = <0xa010 0x20>; + clocks = <&gcc GCC_ADSS_PWM_CLK>; + assigned-clocks = <&gcc GCC_ADSS_PWM_CLK>; + assigned-clock-rates = <100000000>; + #pwm-cells = <2>; + }; + }; From patchwork Wed Oct 4 09:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Devi Priya X-Patchwork-Id: 148199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6f87:b0:13f:353d:d1ed with SMTP id tl7csp2488884rwb; Wed, 4 Oct 2023 02:18:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8ogIBJ7Pa8ZpJSIg8PL/y7o6txEEZk/gaYV1XZvBw9/xIYuOrTfN5g6ASqO4VOoTI6pcc X-Received: by 2002:a05:6870:b688:b0:1d6:790e:dacc with SMTP id cy8-20020a056870b68800b001d6790edaccmr2107241oab.6.1696411123396; Wed, 04 Oct 2023 02:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696411123; cv=none; d=google.com; s=arc-20160816; b=g3o0kf8oWsWYmKgNZq/HfcGQi/9ioPdsOz5OvtFGOyWNNnybJ7OBupPIXKTBPLMRRe DlJifPfsWsMEn2vHjy0SIz5x9f5t0a/4so+chIc+rk1LaTnBLFIhkvVD3aI44QRT7iRZ 2anJNz+rltMLqvIs98e23pbqTgU6Y5U4OQz2dDaASGJl32e3/GV4R46d3seb2/Oej416 w+a7IzT0NKG2DBdJdKJ3MIMyDPVEMnqvQ+UY7c5p3Tt1/x8G8tmgqafzRzQNy3sycRQn UozDB5HIY8KzW4JZYFW2UXBdUVXxIWGy5R7A7ru09BIjbISP+PaxIoH/MoMDK4KMq5Jz 6Gpw== 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:to:from :dkim-signature; bh=LE1mw2wrySfr2KkGPiDhsMXN1IAlxEDYkKKwsoRa44A=; fh=UycDYdIyRZJe4f41XbmwXS5JSJ4V+IOpEs9nPSo/jr0=; b=hRnnPHxjMag/Lv/GbdfDq+xH5HOao65qTkBwl3p4Tii+Fb9J6IoucqSr2HTg9QUwdK CBzryhbxOHRCMx3ICLpbytQR72qwVBLXGYPeoVOYjFxRbdElaGif6KNd8mWwqLb+iHSD Na7/05ZWMqg0ldKXQ2OvLZTtfDZxtvydyotM5mNZ2PEFOdGPsl6mu6pX/MSiAvZn4LeC sqJBlKup63pW8sfgKpue02r4DCFtAES3sNNdM938zLI0b7bOCHLHhcg0WcU4JmXNJUfV cMUlng78L1r+AmS+qfGIRfTrp73FtvLS5HB81iNfD7Sgz/CDfTtfzCZ4RpjGPP5qh2jQ 5PMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=aF8ixtrP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k63-20020a638442000000b0056da0ae25a0si3297058pgd.441.2023.10.04.02.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:18:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=aF8ixtrP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 160C281F3330; Wed, 4 Oct 2023 02:18:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232913AbjJDJS2 (ORCPT + 18 others); Wed, 4 Oct 2023 05:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242117AbjJDJGb (ORCPT ); Wed, 4 Oct 2023 05:06:31 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D8EFE; Wed, 4 Oct 2023 02:06:01 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3945qAth006685; Wed, 4 Oct 2023 09:05:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=LE1mw2wrySfr2KkGPiDhsMXN1IAlxEDYkKKwsoRa44A=; b=aF8ixtrPEhscOn3wBh728lf0qecvBkXUAIPTxex32TUdVc5KOwWQ5+gQJHBJQiiGg4NW 1s2zF1OV7NWr/a5sacWn+j3vyUCPZcHg1ryBQF4J8uVrLfI0lsfE1tMjVR6oout5ShrU 64GPRu3rSQUJ4WVSUqwZC14EqIhRSviFyczhnSSkBSp1YnnRWTmGNYJcqmde3nIZiAKl CaqAndRa1sIn0pph8UgYcp12g/iiKES0BvOQVov5MB9yMb0FoCJ0oULCaQ7TL6PPbp35 oJj267aXkzozEPSYqjR8djEQ+ZfQKC/8ZWdOO8o9b5hNzuxQhUyCFPL5Dvqy5hQ/kX7F LA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tgxrjrrdm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 09:05:31 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39495Vcd031256 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Oct 2023 09:05:31 GMT Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Wed, 4 Oct 2023 02:05:25 -0700 From: Devi Priya To: , , , , , , , , , , , , , , Subject: [PATCH V13 4/4] arm64: dts: ipq6018: add pwm node Date: Wed, 4 Oct 2023 14:34:49 +0530 Message-ID: <20231004090449.256229-5-quic_devipriy@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004090449.256229-1-quic_devipriy@quicinc.com> References: <20231004090449.256229-1-quic_devipriy@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: iFldn8bTg8iYj8RvjPbQyocNFN6o00Md X-Proofpoint-ORIG-GUID: iFldn8bTg8iYj8RvjPbQyocNFN6o00Md X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-04_01,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 suspectscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310040064 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:18:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778815990208038285 X-GMAIL-MSGID: 1778815990208038285 Describe the PWM block on IPQ6018. The PWM is in the TCSR area. Make &tcsr "simple-mfd" compatible, and add &pwm as child of &tcsr. Add also ipq6018 specific compatible string. Co-developed-by: Baruch Siach Signed-off-by: Baruch Siach Signed-off-by: Devi Priya Reviewed-by: Krzysztof Kozlowski --- v13: No change v12: No change v11: No change v10: No change v9: Add 'ranges' property (Rob) v8: Add size cell to 'reg' (Rob) v7: Use 'reg' instead of 'offset' (Rob) Add qcom,tcsr-ipq6018 (Rob) Drop clock-names (Bjorn) v6: Make the PWM node child of TCSR (Rob Herring) Add assigned-clocks/assigned-clock-rates (Uwe Kleine-König) v5: Use qcom,pwm-regs for TCSR phandle instead of direct regs v3: s/qcom,pwm-ipq6018/qcom,ipq6018-pwm/ (Rob Herring) arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi index e59b9df96c7e..429ad7cb681c 100644 --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi @@ -390,8 +390,21 @@ tcsr_mutex: hwlock@1905000 { }; tcsr: syscon@1937000 { - compatible = "qcom,tcsr-ipq6018", "syscon"; + compatible = "qcom,tcsr-ipq6018", "syscon", "simple-mfd"; reg = <0x0 0x01937000 0x0 0x21000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x01937000 0x21000>; + + pwm: pwm@a010 { + compatible = "qcom,ipq6018-pwm"; + reg = <0xa010 0x20>; + clocks = <&gcc GCC_ADSS_PWM_CLK>; + assigned-clocks = <&gcc GCC_ADSS_PWM_CLK>; + assigned-clock-rates = <100000000>; + #pwm-cells = <2>; + status = "disabled"; + }; }; usb2: usb@70f8800 {