lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9f8a584c-03a7-437e-96a7-56484523b2e4@bootlin.com>
Date: Mon, 15 Apr 2024 13:48:48 +0200
From: Thomas Bonnefille <thomas.bonnefille@...tlin.com>
To: jszhang@...nel.org
Cc: conor+dt@...nel.org, devicetree@...r.kernel.org, guoren@...nel.org,
 krzysztof.kozlowski+dt@...aro.org, linux-kernel@...r.kernel.org,
 linux-pwm@...r.kernel.org, linux-riscv@...ts.infradead.org,
 robh+dt@...nel.org, thierry.reding@...il.com,
 u.kleine-koenig@...gutronix.de, wefu@...hat.com,
 Miquel Raynal <miquel.raynal@...tlin.com>,
 Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v3 2/2] pwm: add T-HEAD PWM driver

 > T-HEAD SoCs such as the TH1520 contain a PWM controller used
 > to control the LCD backlight, fan and so on. Add driver for it.
 >
 > Signed-off-by: Jisheng Zhang <jszhang@...nel.org > ---

Hello,
I've just tested your driver and it works flawlessly on the 
BeagleV-Ahead with the last mainline kernel. However, I had to modify 
some portion of the code to comply with the last kernel needs.

 > +static const struct pwm_ops thead_pwm_ops = {
 > +    .apply = thead_pwm_apply,
 > +    .get_state = thead_pwm_get_state,
 > +    .owner = THIS_MODULE,

Since commit 384461abcab6, the owner of a pwm_ops structure is implicit 
and so, you can (must) remove this last line now.

 > +};
 > ...
 > +static int thead_pwm_probe(struct platform_device *pdev)
 > +{
 > +    struct thead_pwm_chip *priv;
 > +    int ret, i;
 > +    u32 val;
 > +
 > +    priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 > +    if (!priv)
 > +        return -ENOMEM;
 > +
 > +    platform_set_drvdata(pdev, priv);
 > +
 > +    priv->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 > +    if (IS_ERR(priv->mmio_base))
 > +        return PTR_ERR(priv->mmio_base);
 > +
 > +    priv->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 > +    if (IS_ERR(priv->clk))
 > +        return PTR_ERR(priv->clk);
 > +
 > +    priv->chip.ops = &thead_pwm_ops;
 > +    priv->chip.dev = &pdev->dev;
 > +    priv->chip.npwm = THEAD_PWM_MAX_NUM;
 > +
 > +    /* check whether PWM is ever started or not */
 > +    for (i = 0; i < priv->chip.npwm; i++) {
 > +        val = readl(priv->mmio_base + THEAD_PWM_FP(i));
 > +        if (val)
 > +            priv->channel_ever_started |= 1 << i;

					     BIT(i) ?
If the bootloader starts a PWM channel for some reason, it will not be 
referenced by the PM usage counter, I added this line in the if 
statement to counter this problem :
		pm_runtime_get(&pdev->dev);

 > +    }
 > +
 > +    ret = devm_pwmchip_add(&pdev->dev, &priv->chip);
 > +    if (ret)
 > +        return ret;
 > +
 > +    devm_pm_runtime_enable(&pdev->dev);
 > +
 > +    return 0;
 > +}


Thank you for your work. With the above comments addressed:

Tested-by: Thomas Bonnefille <thomas.bonnefille@...tlin.com>

Do you plan to send out a new iteration of this patch soon ?

Best regards,
Thomas Bonnefille

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ