From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796092342; b=MJJBCQaAFsn7jjOFNWMsDtVAsrVb2JGIDT0Frh8GgxMJ8LxuHI5dSAiGt/L9bNcXVYAT DwmgcfR9gASE3DehcUcNDBkrUw0sZTm4ygNIjzBs4jV/pANpoyAkRjrX1lipyGEW1BDNk saQ/cGtaTEBMYHYSFJQeOEr7mG8qkOZzPronpoI065HnAPQZNJOx4XK8xxN2pcdoR2m/E ioEypChGWjL7fTdxCYAKezX7SOeBnjXLyUphFJ2soSRo3J5QD5p+VBvSZP91vDct4oCaX LeoJqgosIIr8g5GsFpbTrCKpqomPuKLRnFCxARWcEvgtWDYn9TY6/dg0BkhUHD7g9/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796092342; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=Vk524coWXHyLQ3KOghJUaWhZljIZq+jQHlZEegV5M3U=; b=1vxa7S0d4GWsOx5aYf68m6vFK6S/xHp/jlPIOUdNm2YCG+PVyvVIRHc+ZF6DTXdJQ5oM TDImaSv2A3COJWvmLGvPjqec89c1Y0IuNYZcV7WDO0cP53aaNslzqsnovIAH2fuzaQuVm dYC4yuFiNY/+/ixfe/ph47tQxB7u8rWR5mG/Oup+HDpU0jyo+ZOWUBYfNdWJA1J9XlVei aa6+cS30+hXgGb1ZWe3W2Yvhz29pAldR64iiK0SvKtzbf7vCYjB2sjSkpAP9uloYXySHi y/uISIxCjwkcGzg+tc0ESoeB1x0d5TojOPsBajspWUZib50ci2f93mBZCAcKhoqXRSg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uW+Klv4N; arc=none smtp.remote-ip=209.85.216.41 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E72CE606A325 for ; Tue, 1 Dec 2026 02:32:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E72CE606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uW+Klv4N Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-3b41188c8b9so7334948a91.0 for ; Mon, 30 Nov 2026 18:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796092341; x=1796697141; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Vk524coWXHyLQ3KOghJUaWhZljIZq+jQHlZEegV5M3U=; b=uW+Klv4NcHMRkuDTlznDD7bExHaoPIXMB7GkKuzVGt+jBZkKDysYIm5yiZebxU9JWp qImnmBGG6OBdU4XvJhwjVAljbapLpBmrbsqmhg04rEWuq9Wbh8D66o9ajv0GAAxAYJRz 1AWWkH0bkCSKsP8eQHNFfsBuf4QwEx1MjS0k5xTAuHV59v3xExfiJk80dQqy5pVTJTif ot5kDxXUBeBBNdG8qnt3CkOCIqtWMcdZPIhQ6rUFZW5RB0QjZlHrDFDeur+HwXa3T2Zh aKH5eu9gR2h3F6QVs4+3/L9Hg6bRr05JOXmUYA5NmiUZd62PcfJ7Voa6do2BdfrZaSB9 C1Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796092341; x=1796697141; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Vk524coWXHyLQ3KOghJUaWhZljIZq+jQHlZEegV5M3U=; b=1rcU/y+X4JBfEHnl5BZPOYmgxtCa6+t6QyRhxFuMDic/QRVshC36D1VoqNTFgk3BwK tnybKxkutxwYi8vPpjK3PHoQGLIQmF0g3JRvlyFoWP1+iuScCDgGmPJfN0ndJcPMhkbO ma/Pv7N5kiv5PiFS/L6vX0vLOgvb8JpKrycAXH/lo8EvkQVibhIy6VCsRbdKTbQecnFL 3F9JcxIDCO+H4B8Y+VCKbAL6eV7CX+853FyLETbrIG6wOR1wYWdcZkvTXHC0WxIppvD1 e3daa6qrkaxOWey79cOXSOaKZtVGvEhIys7jZWXmGspUgQhRdVejtdcdYkMXcJvfpoOC VN1w== X-Forwarded-Encrypted: i=1; AL+hErEh9pJxHUFcRX1GjLUAGw8jomOSKL6HFRpQ2/ErUKZ14zt8N6su0ZV/Ua7RHG5lIWMyf1NoIN5Dm2cy2UI=@vger.kernel.org X-Gm-Message-State: APuU4Z+axdFsl0KehuMfOqGKWOYFH+m18EUQXnD9zXgfXlDW4iLz8NLr i/LUb2woZrwIlQs0hEeQ5u5Cjx/fRpLm19mEDgiYgtd74m19OqS3+Vdn X-Gm-Gg: AZFdTZdPklUlqUNokP+PXl5F8KYPqddR7cH2xCqSO/R9TA11SATbf/k5gAc5OdNBPsE v2MR2cPeetr0vlOl8YN88Y7V1ZRqmgO4TzQRRtjXrgpqmuAHXaLhy+m85OPVKrkTa6E8wKS77Gk tNQqkb+AhTMCGBfkEZsNWhgBPCzCoXtqECOl6eo0bos0ixQfTfKnxYAoWGsMoRKC+CKp6+OJ7Su X+XlrGFFbNqvMt8pzR6jeS1+v9iSVeE4i7YbsV18fAfiZWOBrygmJeJzFgpuFtupdfJi8D9C1IM 5GrrispVrNZPjtqHELGLbcK+lth/KC4IBcjQczsae2xr/k/b5jJTHHyPtg6GbpY06Bfx/ispOdG oOFTDX4N7Jc13Dze9Cyia1ef/Yro5IQwOFVAPYvEwiaG/+RqaA85QD+HmpfurmEKCPkX7ITHpHC gdNVUmijNcQtwt0Wxr+jWGzacG7aNKMHKrzKQ1kAMnjLLSxWKeTt4K0qMSEtzRsBQbHIUTrmhVw bCdsuKg37BDfP42TE9u2PV+3G6zPhEpe73zGEI1nel3D3x0zTlOQapgq/UMjQfkhPGq9EhvHdx6 Rth5rcnPopa/ws8PLoDuIOSX7Q== X-Received: by 2002:a17:90b:2d8a:b0:3aa:6b5d:a00a with SMTP id 98e67ed59e1d1-3b41c95b7femr36869168a91.53.1796092341142; Mon, 30 Nov 2026 18:32:21 -0800 (PST) Received: from localhost ([2001:19f0:8000:4ce8:5400:7ff:fe0e:e6b2]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5624d0b07sm13198743a91.15.2026.11.30.18.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 18:32:20 -0800 (PST) Date: Tue, 1 Dec 2026 10:32:06 +0800 From: Inochi Amaoto To: Hiago De Franco , Chen Wang Cc: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Chen Wang , linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, sophgo@lists.linux.dev, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH 2/3] pwm: sophgo-sg2042: add support for CV1800B Message-ID: References: <20261117-milkv-duo-pwm-v1-0-3f1786ea57b7@baylibre.com> <20261117-milkv-duo-pwm-v1-2-3f1786ea57b7@baylibre.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Nov 30, 2026 at 09:57:19AM -0300, Hiago De Franco wrote: > Hi Chen, > > On Mon, Nov 30, 2026 at 01:30:55PM +0800, Chen Wang wrote: > > > > On 11/17/2026 8:57 PM, Hiago De Franco wrote: > > > The CV1800B SoC embeds four instances of a PWM controller derived from > > > the one found on the SG2042 and SG2044 SoCs. The register layout is > > > mostly the same, but there are some differences handled by this patch: > > > > > > - PERIOD and HLPERIOD are 30 bits wide and PERIOD must be strictly > > > greater than HLPERIOD. As a consequence, a 100% duty cycle cannot be > > > represented and the period must be at least two input clock cycles. > > > - The meaning of the POLARITY bit is inverted compared to the SG2044: > > > 0 selects a low default level and 1 a high default level. > > > - A polarity change takes effect immediately, even while the channel is > > > running. > > > - New values written to HLPERIOD/PERIOD while the channel is running are > > > only latched after a 0 -> 1 -> 0 sequence on the PWMUPDATE bit. > > > - When the counter is stopped, the pin is parked at the level selected by > > > POLARITY. Emitting the inactive level would require changing POLARITY, > > > which would make the polarity read back from the hardware differ from the > > > requested one, so the driver disables the output instead. > > > > > > Add a dedicated set of pwm_ops for the CV1800B to take these differences > > > into account, and update the module description accordingly. Update the > > > Kconfig entry to describe all the SoCs supported by the driver, > > > including the already supported SG2044. > > > > > > This was tested on Milk-V Duo with a logic analyzer (GP4/pwm1 ch1). > > > > > > Signed-off-by: Hiago De Franco > > > --- > > > drivers/pwm/Kconfig | 7 +- > > > drivers/pwm/pwm-sophgo-sg2042.c | 201 ++++++++++++++++++++++++++++++++++++++-- > > > 2 files changed, 199 insertions(+), 9 deletions(-) > > > > > > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig > > > index 729776086879..877d5bfa0bb0 100644 > > > --- a/drivers/pwm/Kconfig > > > +++ b/drivers/pwm/Kconfig > > > @@ -671,11 +671,12 @@ config PWM_SL28CPLD > > > will be called pwm-sl28cpld. > > > config PWM_SOPHGO_SG2042 > > > - tristate "Sophgo SG2042 PWM support" > > > + tristate "Sophgo SG2042/SG2044/CV1800B PWM support" > > > depends on ARCH_SOPHGO || COMPILE_TEST > > > help > > > - PWM driver for the PWM controller on Sophgo SG2042 SoC. The PWM > > > - controller supports outputing 4 channels of PWM waveforms. > > > + PWM driver for the PWM controller on Sophgo SG2042, SG2044 and > > > + CV1800B SoCs. Each controller supports 4 channels of PWM > > > + waveforms. > > > To compile this driver as a module, choose M here: the module > > > will be called pwm_sophgo_sg2042. > > > diff --git a/drivers/pwm/pwm-sophgo-sg2042.c b/drivers/pwm/pwm-sophgo-sg2042.c > > > index 0b6461172e6a..45eb1871a127 100644 > > > --- a/drivers/pwm/pwm-sophgo-sg2042.c > > > +++ b/drivers/pwm/pwm-sophgo-sg2042.c > > > @@ -1,21 +1,30 @@ > > > // SPDX-License-Identifier: GPL-2.0 > > > /* > > > - * Sophgo SG2042 PWM Controller Driver > > > + * Sophgo SG2042/SG2044/CV1800B PWM Controller Driver > > > * > > > * Copyright (C) 2024 Sophgo Technology Inc. > > > * Copyright (C) 2024 Chen Wang > > > * > > > * Limitations: > > > - * - After reset, the output of the PWM channel is always high. > > > + * - After reset, the output of the SG2042 PWM channel is always high. > > > * The value of HLPERIOD/PERIOD is 0. > > > * - When HLPERIOD or PERIOD is reconfigured, PWM will start to > > > * output waveforms with the new configuration after completing > > > * the running period. > > > - * - When PERIOD and HLPERIOD is set to 0, the PWM wave output will > > > + * - When PERIOD and HLPERIOD is set to 0, the SG2042 PWM wave output will > > > * be stopped and the output is pulled to high. > > > - * - SG2044 supports both polarities, SG2042 only normal polarity. > > > - * See the datasheet [1] for more details. > > > + * - SG2044 and CV1800B support both polarities, SG2042 only normal polarity. > > > + * - On CV1800B the pin is parked at the level selected by POLARITY while the > > > + * counter is stopped. Emitting the inactive level would require changing > > > + * POLARITY, so the driver disables the output (input mode) instead. > > > + * - On CV1800B a polarity change takes effect immediately, even while the > > > + * channel is running. > > > + * - On CV1800B a 100% duty cycle is not representable. It is rounded down to > > > + * one input clock cycle less than the period. > > > + * - On CV1800B the period must be at least 2 input clock cycles. > > > + * See the datasheets [1] and [2] for more details. > > > * [1]:https://github.com/sophgo/sophgo-doc/tree/main/SG2042/TRM > > > + * [2]:https://github.com/sophgo/sophgo-doc/tree/main/SG200X/TRM > > > */ > > > #include > > > @@ -44,10 +53,14 @@ > > > #define SG2044_PWM_POLARITY 0x40 > > > #define SG2044_PWM_PWMSTART 0x44 > > > +#define SG2044_PWM_PWMUPDATE 0x4c > > `SG2044_PWM_PWMUPDATE` is only called within `pwm_cv1800b_set_pwmupdate`; > > why is `CV1800B_PWM_PWMUPDATE` not used instead? > > Will add this on v2, thanks. > IIRC the PWM on SG2044 and CV1800 are almost the same, so it is fine to keep 2044 prefix. This applys to all the related question. Regards, Inochi > > > #define SG2044_PWM_OE 0xd0 > > > #define SG2042_PWM_CHANNELNUM 4 > > > +#define CV1800B_PWM_MAX_PERIOD GENMASK(29, 0) > > > +#define CV1800B_PWM_MIN_PERIOD 2 > > > + > > > /** > > > * struct sg2042_pwm_ddata - private driver data > > > * @base: base address of mapped PWM registers > > > @@ -155,6 +168,14 @@ static void pwm_sg2044_set_outputen(struct sg2042_pwm_ddata *ddata, struct pwm_d > > > writel(pwmstart, ddata->base + SG2044_PWM_PWMSTART); > > > } > > > +static bool pwm_sg2044_get_outputen(struct sg2042_pwm_ddata *ddata, > > > + struct pwm_device *pwm) > > > +{ > > > + u32 pwmstart = readl(ddata->base + SG2044_PWM_PWMSTART); > > > + > > > + return !!(pwmstart & BIT(pwm->hwpwm)); > > > +} > > > + > > `pwm_sg2044_get_outputen` is only called in pwm_cv1800b_xxx, why not name it > > as pwm_cv1800b_get_outputen and put it together wtih pwm_cv1800b_xxx > > functions? > > In this case I was not entirely sure and got confused with the names. I > agree with you, but pwm_sg2044_set_outputen already exists and > pwm_sg2044_get_outputen is just the a get function for > SG2044_PWM_PWMSTART. So for this specific case I believe keeping it as > pwm_sg2044_get_outputen would be more accurate, what do you think? > > > > static void pwm_sg2044_set_outputdir(struct sg2042_pwm_ddata *ddata, struct pwm_device *pwm, > > > bool enabled) > > > { > > > @@ -208,6 +229,171 @@ static int pwm_sg2044_apply(struct pwm_chip *chip, struct pwm_device *pwm, > > > return 0; > > > } > > > +static int pwm_cv1800b_get_state(struct pwm_chip *chip, struct pwm_device *pwm, > > > + struct pwm_state *state) > > > +{ > > > + struct sg2042_pwm_ddata *ddata = pwmchip_get_drvdata(chip); > > > + unsigned int chan = pwm->hwpwm; > > > + u32 hlperiod_ticks; > > > + u32 period_ticks; > > > + u32 pwm_polarity; > > > + > > > + /* PWMSTART is set to 1 while the channel is running. */ > > > + state->enabled = pwm_sg2044_get_outputen(ddata, pwm); > > > + > > > + period_ticks = readl(ddata->base + SG2042_PWM_PERIOD(chan)); > > > + hlperiod_ticks = readl(ddata->base + SG2042_PWM_HLPERIOD(chan)); > > > + > > > + if (!period_ticks) { > > > + /* > > > + * No waveform is configured, so don't report a duty_cycle > > > + * larger than the period. > > > + */ > > > + state->enabled = false; > > > + state->period = 0; > > > + state->duty_cycle = 0; > > > + } else { > > > + if (hlperiod_ticks >= period_ticks) > > > + hlperiod_ticks = period_ticks - 1; > > > + > > > + state->period = DIV_ROUND_UP_ULL((u64)period_ticks * NSEC_PER_SEC, > > > + ddata->clk_rate_hz); > > > + state->duty_cycle = DIV_ROUND_UP_ULL((u64)hlperiod_ticks * NSEC_PER_SEC, > > > + ddata->clk_rate_hz); > > > + } > > > + > > > + pwm_polarity = readl(ddata->base + SG2044_PWM_POLARITY); > > > + > > > + /* > > > + * Without a configured waveform POLARITY has no meaning, so report the > > > + * neutral default instead of the register's reset value. > > > + */ > > > + if (period_ticks && !(pwm_polarity & BIT(chan))) > > > + state->polarity = PWM_POLARITY_INVERSED; > > > + else > > > + state->polarity = PWM_POLARITY_NORMAL; > > > + > > > + return 0; > > > +} > > > + > > > +static void pwm_cv1800b_set_pwmupdate(struct sg2042_pwm_ddata *ddata, struct pwm_device *pwm, > > > + bool enable) > > > +{ > > > + u32 pwm_update = readl(ddata->base + SG2044_PWM_PWMUPDATE); > > > + > > > + if (enable) > > > + pwm_update |= BIT(pwm->hwpwm); > > > + else > > > + pwm_update &= ~BIT(pwm->hwpwm); > > > + > > > + writel(pwm_update, ddata->base + SG2044_PWM_PWMUPDATE); > > > +} > > > + > > > +static void pwm_cv1800b_set_polarity(struct sg2042_pwm_ddata *ddata, struct pwm_device *pwm, > > > + bool high) > > > +{ > > > + u32 pwm_polarity = readl(ddata->base + SG2044_PWM_POLARITY); > > > + > > > + /* > > > + * POLARITY on CV1800B is the opposite of SG2044: 0 selects a low > > > + * default level (HLPERIOD counts low cycles), 1 selects a high > > > + * default level (HLPERIOD counts high cycles). > > > + */ > > > + if (high) > > > + pwm_polarity |= BIT(pwm->hwpwm); > > > + else > > > + pwm_polarity &= ~BIT(pwm->hwpwm); > > > + > > > + writel(pwm_polarity, ddata->base + SG2044_PWM_POLARITY); > > > +} > > > + > > > +static int pwm_cv1800b_set_dutycycle(struct pwm_chip *chip, struct pwm_device *pwm, > > > + const struct pwm_state *state) > > > +{ > > > + struct sg2042_pwm_ddata *ddata = pwmchip_get_drvdata(chip); > > > + u32 hlperiod_ticks; > > > + u32 period_ticks; > > > + u64 ticks; > > > + > > > + /* > > > + * Duration of High level (duty_cycle) = HLPERIOD x Period_of_input_clk > > > + * Duration of One Cycle (period) = PERIOD x Period_of_input_clk > > > + * > > > + * Different from sg2042, cv1800b has max of 30 bits and PERIOD must be > > > + * strictly greater than HLPERIOD. The shortest representable period is > > > + * two input clock cycles; reject anything shorter instead of rounding > > > + * it up. > > > + */ > > > + ticks = mul_u64_u64_div_u64(ddata->clk_rate_hz, state->period, NSEC_PER_SEC); > > > + period_ticks = min_t(u64, ticks, CV1800B_PWM_MAX_PERIOD); > > > + if (period_ticks < CV1800B_PWM_MIN_PERIOD) > > > + return -EINVAL; > > > + > > > + ticks = mul_u64_u64_div_u64(ddata->clk_rate_hz, state->duty_cycle, NSEC_PER_SEC); > > > + hlperiod_ticks = min_t(u64, ticks, period_ticks - 1); > > > + > > > + dev_dbg(pwmchip_parent(chip), "chan[%u]: ENABLE=%u, PERIOD=%u, HLPERIOD=%u, POLARITY=%u\n", > > > + pwm->hwpwm, state->enabled, period_ticks, hlperiod_ticks, state->polarity); > > > + > > > + pwm_sg2042_config(ddata, pwm->hwpwm, period_ticks, hlperiod_ticks); > > > + > > > + return 0; > > > +} > > > + > > > +static int pwm_cv1800b_apply(struct pwm_chip *chip, struct pwm_device *pwm, > > > + const struct pwm_state *state) > > > +{ > > > + struct sg2042_pwm_ddata *ddata = pwmchip_get_drvdata(chip); > > > + bool high = state->polarity == PWM_POLARITY_NORMAL; > > > + bool running = pwm_sg2044_get_outputen(ddata, pwm); > > > + int ret; > > > + > > > + if (!state->enabled) { > > > + /* > > > + * While the counter is stopped the pin is parked at the level > > > + * selected by POLARITY, i.e. at the level the waveform starts > > > + * with. Emitting the inactive level would require changing > > > + * POLARITY, which would make the polarity read back from the > > > + * hardware differ from the requested one. Disable the output > > > + * instead. > > > + */ > > > + pwm_sg2044_set_outputen(ddata, pwm, false); > > > + pwm_sg2044_set_outputdir(ddata, pwm, false); > > > + > > > + return 0; > > > + } > > > + > > > + ret = pwm_cv1800b_set_dutycycle(chip, pwm, state); > > > + if (ret) > > > + return ret; > > > + > > > + pwm_cv1800b_set_polarity(ddata, pwm, high); > > > + > > > + if (!running) { > > > + pwm_cv1800b_set_pwmupdate(ddata, pwm, false); > > > + pwm_sg2044_set_outputdir(ddata, pwm, true); > > > + pwm_sg2044_set_outputen(ddata, pwm, true); > > > + > > > + return 0; > > > + } > > > + > > > + /* > > > + * Write 1 and then 0 to PWMUPDATE[n] to latch new HLPERIOD/PERIOD > > > + * values while the channel is running. > > > + */ > > > + pwm_cv1800b_set_pwmupdate(ddata, pwm, true); > > > + pwm_cv1800b_set_pwmupdate(ddata, pwm, false); > > > + > > > + return 0; > > > +} > > > + > > > +static const struct sg2042_chip_data cv1800b_chip_data = { > > > + .ops = { > > > + .apply = pwm_cv1800b_apply, > > > + .get_state = pwm_cv1800b_get_state, > > > + }, > > > +}; > > > + > > > static const struct sg2042_chip_data sg2042_chip_data = { > > > .ops = { > > > .apply = pwm_sg2042_apply, > > > @@ -224,6 +410,9 @@ static const struct sg2042_chip_data sg2044_chip_data = { > > > static const struct of_device_id sg2042_pwm_ids[] = { > > > { > > > + .compatible = "sophgo,cv1800b-pwm", > > > + .data = &cv1800b_chip_data, > > > + }, { > > > .compatible = "sophgo,sg2042-pwm", > > > .data = &sg2042_chip_data, > > > }, { > > > @@ -296,5 +485,5 @@ module_platform_driver(pwm_sg2042_driver); > > > MODULE_AUTHOR("Chen Wang"); > > > MODULE_AUTHOR("Longbin Li "); > > You can add your name as author here. > > Will do on V2, thanks! > > > > -MODULE_DESCRIPTION("Sophgo SG2042 PWM driver"); > > > +MODULE_DESCRIPTION("Sophgo SG2042/SG2044/CV1800B PWM driver"); > > > MODULE_LICENSE("GPL"); > > > > Others LGTM > > > > Reviewed-by: Chen Wang > > > > > > Best regards, > -- > Hiago