devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Billy Tsai <billy_tsai@aspeedtech.com>,
	jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, joel@jms.id.au,
	andrew@aj.id.au, lee@kernel.org, thierry.reding@gmail.com,
	u.kleine-koenig@pengutronix.de, corbet@lwn.net,
	p.zabel@pengutronix.de, linux-hwmon@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-doc@vger.kernel.org,
	patrick@stwcx.xyz
Subject: Re: [v5 4/5] pwm: Add Aspeed ast2600 PWM support
Date: Tue, 6 Jun 2023 12:55:45 +0200	[thread overview]
Message-ID: <676e5c04-e13c-417b-5a2a-73ee339fbbd3@linaro.org> (raw)
In-Reply-To: <20230606094535.5388-5-billy_tsai@aspeedtech.com>

On 06/06/2023 11:45, Billy Tsai wrote:
> Add the support of PWM controller which can be found at aspeed ast2600
> soc. The pwm supoorts up to 16 channels and it's part function of
> multi-function device "pwm-tach controller".
> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---


> +static int aspeed_pwm_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +	struct aspeed_pwm_data *priv;
> +	struct device_node *np;
> +	struct platform_device *parent_dev;
> +
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	np = pdev->dev.parent->of_node;
> +	if (!of_device_is_compatible(np, "aspeed,ast2600-pwm-tach"))
> +		return dev_err_probe(dev, -ENODEV,
> +				     "Unsupported pwm device binding\n");

No, don't embed compatibles in your code. This is useless, so drop it.

> +
> +	priv->regmap = syscon_node_to_regmap(np);
> +	if (IS_ERR(priv->regmap))
> +		return dev_err_probe(dev, PTR_ERR(priv->regmap),
> +				     "Couldn't get regmap\n");
> +
> +	parent_dev = of_find_device_by_node(np);

Why? You already have parent!

> +	priv->clk = devm_clk_get_enabled(&parent_dev->dev, NULL);
> +	if (IS_ERR(priv->clk))
> +		return dev_err_probe(dev, PTR_ERR(priv->clk),
> +				     "Couldn't get clock\n");

NAK. This is purely broken. You cannot play with parent's clock and I
told you this last time. Parent is simple-mfd so this code is a hacky
workaround over using simple-mfd even though I told you that yuo cannot
use simple-mfd.

> +
> +	priv->reset = devm_reset_control_get_shared(&parent_dev->dev, NULL);

NAK.


Best regards,
Krzysztof


  reply	other threads:[~2023-06-06 10:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  9:45 [v5 0/5] Support pwm/tach driver for aspeed ast26xx Billy Tsai
2023-06-06  9:45 ` [v5 1/5] dt-bindings: pwm: Add bindings for aspeed pwm controller Billy Tsai
2023-06-06 10:42   ` Krzysztof Kozlowski
2023-06-06  9:45 ` [v5 2/5] dt-bindings: hwmon: Add bindings for aspeed tach controller Billy Tsai
2023-06-06 10:46   ` Krzysztof Kozlowski
2023-06-06  9:45 ` [v5 3/5] dt-bindings: mfd: Add aspeed pwm-tach binding Billy Tsai
2023-06-06 10:27   ` Rob Herring
2023-06-06 10:49   ` Krzysztof Kozlowski
2023-06-06 14:06     ` Patrick Williams
2023-06-06 14:23       ` Krzysztof Kozlowski
     [not found]         ` <SG2PR06MB33652E18980E9CF8E4F0894D8B53A@SG2PR06MB3365.apcprd06.prod.outlook.com>
2023-06-07  7:10           ` Krzysztof Kozlowski
     [not found]             ` <SG2PR06MB33657063A2E3239AD0A21F718B53A@SG2PR06MB3365.apcprd06.prod.outlook.com>
2023-06-07  8:33               ` Krzysztof Kozlowski
2023-06-07  8:55           ` Krzysztof Kozlowski
2023-06-07 18:26           ` Krzysztof Kozlowski
2023-06-08 15:15         ` Rob Herring
2023-06-06  9:45 ` [v5 4/5] pwm: Add Aspeed ast2600 PWM support Billy Tsai
2023-06-06 10:55   ` Krzysztof Kozlowski [this message]
2023-06-06  9:45 ` [v5 5/5] hwmon: Add Aspeed ast2600 TACH support Billy Tsai
2023-06-06 10:56   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=676e5c04-e13c-417b-5a2a-73ee339fbbd3@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=andrew@aj.id.au \
    --cc=billy_tsai@aspeedtech.com \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=joel@jms.id.au \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=p.zabel@pengutronix.de \
    --cc=patrick@stwcx.xyz \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).