[PATCH v2 3/3] pwm: sophgo: add driver for SG2044

Chen Wang unicorn_wang at outlook.com
Fri Apr 18 18:24:23 PDT 2025


On 2025/4/18 10:29, Longbin Li wrote:
> Add PWM controller for SG2044 on base of SG2042.
>
> Signed-off-by: Longbin Li <looong.bin at gmail.com>
> ---
>   drivers/pwm/pwm-sophgo-sg2042.c | 89 ++++++++++++++++++++++++++++++++-
>   1 file changed, 87 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pwm/pwm-sophgo-sg2042.c b/drivers/pwm/pwm-sophgo-sg2042.c
> index 23a83843ba53..26147ec596c9 100644
> --- a/drivers/pwm/pwm-sophgo-sg2042.c
> +++ b/drivers/pwm/pwm-sophgo-sg2042.c
> @@ -13,6 +13,9 @@
>    *   the running period.
>    * - When PERIOD and HLPERIOD is set to 0, the PWM wave output will
>    *   be stopped and the output is pulled to high.
> + * - SG2044 support polarity while SG2042 does not. When PWMSTART is
> + *   false, POLARITY being NORMAL will make output being low,
> + *   POLARITY being INVERSED will make output being high.
>    * See the datasheet [1] for more details.
>    * [1]:https://github.com/sophgo/sophgo-doc/tree/main/SG2042/TRM
>    */
> @@ -26,6 +29,10 @@
>   #include <linux/pwm.h>
>   #include <linux/reset.h>
>
> +#define SG2044_REG_POLARITY		0x40
> +#define SG2044_REG_PWMSTART		0x44
> +#define SG2044_REG_PWM_OE		0xD0

SG2044_REG_xxx, the prefix looks inconsistent with 
SG2042_PWM_HLPERIOD/SG2042_PWM_PERIOD. Can it be unified?

The others look fine.

Reviewed-by: Chen Wang <unicorn_wang at outlook.com>

[......]





More information about the linux-riscv mailing list