lkml.org 
[lkml]   [2021]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 4/7] pwm: ntxec: Add driver for PWM function in Netronix EC
On Tue, 12 Jan 2021 20:39:02 +0100
Andreas Kemnade <andreas@kemnade.info> wrote:

[...]
> > +static int ntxec_pwm_probe(struct platform_device *pdev)
> > +{
> > + struct ntxec *ec = dev_get_drvdata(pdev->dev.parent);
> > + struct ntxec_pwm *priv;
> > + struct pwm_chip *chip;
> > +
> > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + priv->ec = ec;
> > + priv->dev = &pdev->dev;
> > +
> > + platform_set_drvdata(pdev, priv);
> > +
> > + chip = &priv->chip;
> > + chip->dev = &pdev->dev;
>
> Hmm, I needed
> chip->dev = &pdev->dev.parent to use the backlight example
> in patch 2/7.
> Not sure what the correct solution is. Maybe the pwm deserves its own
> devicetree node.
>
probably just assigning the node from the parent.

pdev->dev.of_node = pdev->dev.parent->of_node;

Regards,
Andreas

\
 
 \ /
  Last update: 2021-01-14 03:03    [W:0.157 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site