All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: andreas@kemnade.info, bcousson@baylibre.com, conor+dt@kernel.org,
	devicetree@vger.kernel.org, dmitry.torokhov@gmail.com,
	krzysztof.kozlowski+dt@linaro.org, lee@kernel.org,
	linux-clk@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	mturquette@baylibre.com, robh+dt@kernel.org, tony@atomide.com
Subject: Re: [PATCH v3 4/5] clk: twl: add clock driver for TWL6032
Date: Tue, 12 Sep 2023 11:04:02 -0700	[thread overview]
Message-ID: <9a8476b92ab656387fa7dcf54a0713a3.sboyd@kernel.org> (raw)
In-Reply-To: <20230911221346.1484543-5-andreas@kemnade.info>

Quoting Andreas Kemnade (2023-09-11 15:13:45)
> diff --git a/drivers/clk/clk-twl.c b/drivers/clk/clk-twl.c
> new file mode 100644
> index 0000000000000..09006e53a32ec
> --- /dev/null
> +++ b/drivers/clk/clk-twl.c
> @@ -0,0 +1,197 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Clock driver for twl device.
> + *
> + * inspired by the driver for the Palmas device
> + */
> +
> +#include <linux/clk.h>

Please drop this include unless it is used.

> +#include <linux/clk-provider.h>
> +#include <linux/mfd/twl.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +
> +#define VREG_STATE              2
> +#define TWL6030_CFG_STATE_OFF   0x00
> +#define TWL6030_CFG_STATE_ON    0x01
> +#define TWL6030_CFG_STATE_MASK  0x03
> +
> +struct twl_clock_info {
> +       struct device *dev;
> +       u8 base;
> +       struct clk_hw hw;
> +};
[...]
> +
> +static int twl_clks_probe(struct platform_device *pdev)
> +{
> +       struct clk_hw_onecell_data *clk_data;
> +       const struct twl_clks_data *hw_data;
> +
> +       struct twl_clock_info *cinfo;
> +       int ret;
> +       int i;
> +       int count;
> +
> +       hw_data = twl6032_clks;
> +       for (count = 0; hw_data[count].init.name; count++)
> +               ;
> +
> +       clk_data = devm_kzalloc(&pdev->dev,
> +                               struct_size(clk_data, hws, count),
> +                               GFP_KERNEL);
> +       if (!clk_data)
> +               return -ENOMEM;
> +
> +       clk_data->num = count;
> +       cinfo = devm_kcalloc(&pdev->dev, count, sizeof(*cinfo), GFP_KERNEL);
> +       if (!cinfo)
> +               return -ENOMEM;
> +
> +       for (i = 0; i < count; i++) {
> +               cinfo[i].base = hw_data[i].base;
> +               cinfo[i].dev = &pdev->dev;
> +               cinfo[i].hw.init = &hw_data[i].init;
> +               ret = devm_clk_hw_register(&pdev->dev, &cinfo[i].hw);
> +               if (ret) {
> +                       dev_err(&pdev->dev, "Fail to register clock %s, %d\n",

Use dev_err_probe()

> +                               hw_data[i].init.name, ret);
> +                       return ret;
> +               }
> +               clk_data->hws[i] = &cinfo[i].hw;
> +       }
> +
> +       ret = devm_of_clk_add_hw_provider(&pdev->dev,
> +                                         of_clk_hw_onecell_get, clk_data);
> +       if (ret < 0)
> +               dev_err(&pdev->dev, "Fail to add clock driver, %d\n", ret);

Use dev_err_probe()

> +
> +       return ret;

  parent reply	other threads:[~2023-09-12 18:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 22:13 [PATCH v3 0/5] ARM: omap: omap4-embt2ws: 32K clock for WLAN Andreas Kemnade
2023-09-11 22:13 ` [PATCH v3 1/5] dt-bindings: mfd: convert twl-family.txt to json-schema Andreas Kemnade
2023-09-12 17:00   ` Conor Dooley
2023-09-11 22:13 ` [PATCH v3 2/5] dt-bindings: mfd: ti,twl: Add clock provider properties Andreas Kemnade
2023-09-11 22:13 ` [PATCH v3 3/5] mfd: twl-core: Add a clock subdevice for the TWL6032 Andreas Kemnade
2023-09-11 22:13 ` [PATCH v3 4/5] clk: twl: add clock driver for TWL6032 Andreas Kemnade
2023-09-12 17:15   ` Christophe JAILLET
2023-09-12 18:24     ` Marion & Christophe JAILLET
2023-09-12 18:56     ` Andreas Kemnade
2023-09-12 18:04   ` Stephen Boyd [this message]
2023-09-11 22:13 ` [PATCH v3 5/5] ARM: dts: omap4-embt2ws: enable 32K clock on WLAN Andreas Kemnade

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=9a8476b92ab656387fa7dcf54a0713a3.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=andreas@kemnade.info \
    --cc=bcousson@baylibre.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.