From: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com> To: "mazziesaccount@gmail.com" <mazziesaccount@gmail.com>, "sboyd@kernel.org" <sboyd@kernel.org> Cc: "dmurphy@ti.com" <dmurphy@ti.com>, "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>, "linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>, "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>, "mturquette@baylibre.com" <mturquette@baylibre.com>, "lgirdwood@gmail.com" <lgirdwood@gmail.com>, "jacek.anaszewski@gmail.com" <jacek.anaszewski@gmail.com>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "a.zummo@towertech.it" <a.zummo@towertech.it>, "linus.walleij@linaro.org" <linus.walleij@linaro.org>, "mark.rutland@arm.com" <mark.rutland@arm.com>, "robh+dt@kernel.org" <robh+dt@kernel.org>, "bgolaszewski@baylibre.com" <bgolaszewski@baylibre.com>, "linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>, "pavel@ucw.cz" <pavel@ucw.cz>, "lee.jones@linaro.org" <lee.jones@linaro.org>, "broonie@kernel.org" <broonie@kernel.org> Subject: Re: [RFC PATCH v2 05/13] clk: bd718x7: Support ROHM BD71828 clk block Date: Tue, 29 Oct 2019 06:28:51 +0000 Message-ID: <95b21eeaee8025dc430623429273116c35c1b769.camel@fi.rohmeurope.com> (raw) In-Reply-To: <20191028233256.798AD21479@mail.kernel.org> Hello Stephen, Thanks for the comments once again :) On Mon, 2019-10-28 at 16:32 -0700, Stephen Boyd wrote: > Quoting Matti Vaittinen (2019-10-24 04:44:40) > > diff --git a/drivers/clk/clk-bd718x7.c b/drivers/clk/clk-bd718x7.c > > index ae6e5baee330..d17a19e04592 100644 > > --- a/drivers/clk/clk-bd718x7.c > > +++ b/drivers/clk/clk-bd718x7.c > > @@ -8,6 +8,7 @@ > > #include <linux/platform_device.h> > > #include <linux/slab.h> > > #include <linux/mfd/rohm-bd718x7.h> > > +#include <linux/mfd/rohm-bd71828.h> > > #include <linux/mfd/rohm-bd70528.h> > > It would be really great to not need to include these random header > files in this driver and just use raw numbers somehow. Looks like > maybe > it can be done by populating a different device name from the mfd > driver > depending on the version of the clk controller desired? Then that can > be > matched in this clk driver and we can just put the register info in > this > file? I still like keeping the chip type information on one header - no matter what-ever format the clk-controller type/version information is. Rationale is that MFD and also few other sub-devices (not only the clk) need to use it. Currently at least the RTC. But if we define clk register information for all PMICs in this c-file, then (I think) we can only include the <linux/mfd/rohm-generic.h> - which contains the PMIC type defines and the generic MFD data structure. That would: -#include <linux/mfd/rohm-bd718x7.h> -#include <linux/mfd/rohm-bd71828.h> -#include <linux/mfd/rohm-bd70528.h> +#include <linux/mfd/rohm-generic.h> That way the chip-type information could still be same for MFD and all sub-devices but clk driver would not need to include all the details for all the PMICs. I understand your point well as clk registers for these PMICs are really *limited*. > > > #include <linux/clk-provider.h> > > #include <linux/clkdev.h> > > @@ -21,10 +22,8 @@ struct bd718xx_clk { > > struct rohm_regmap_dev *mfd; > > }; > > > > -static int bd71837_clk_set(struct clk_hw *hw, int status) > > +static int bd71837_clk_set(struct bd718xx_clk *c, int status) > > should it be unsigned int status? Or maybe u32? > > > { > > - struct bd718xx_clk *c = container_of(hw, struct > > bd718xx_clk, hw); > > - > > return regmap_update_bits(c->mfd->regmap, c->reg, c->mask, > > status); > > } > > > > @@ -33,14 +32,16 @@ static void bd71837_clk_disable(struct clk_hw > > *hw) > > int rv; > > struct bd718xx_clk *c = container_of(hw, struct > > bd718xx_clk, hw); > > > > - rv = bd71837_clk_set(hw, 0); > > + rv = bd71837_clk_set(c, 0); > > if (rv) > > dev_dbg(&c->pdev->dev, "Failed to disable 32K clk > > (%d)\n", rv); > > } > > > > static int bd71837_clk_enable(struct clk_hw *hw) > > { > > - return bd71837_clk_set(hw, 1); > > + struct bd718xx_clk *c = container_of(hw, struct > > bd718xx_clk, hw); > > + > > + return bd71837_clk_set(c, 0xffffffff); > > Because now this is passing -1 to unsigned int taking > regmap_update_bits()? I think that bit-wise it is all the same. Currently registers are only 8bits wide so it is enough that lowest 8 bits are set. And 0xffffffff should work nicely up-to 32bit registers as long as int is 32 bit or more. But you are correct that this is not looking good. At first sight unsigned int is much nicer. I prefer unsigned int over forced u32 to guarantee natural alignment - which does not really matter in this case either. unsigned int matches regmap though so I'll switch to it. Thanks for pointing this out :) I'll try to include these clk changes in v3. Br, Matti Vaittinen
next prev parent reply index Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-24 11:40 [RFC PATCH v2 00/13] Support ROHM BD71828 PMIC Matti Vaittinen 2019-10-24 11:41 ` [RFC PATCH v2 01/13] mfd: bd71828: Support ROHM BD71828 PMIC - core Matti Vaittinen 2019-10-24 11:41 ` [RFC PATCH v2 02/13] dt-bindings: mfd: Document ROHM BD71828 bindings Matti Vaittinen 2019-10-24 19:35 ` Dan Murphy 2019-10-25 5:49 ` Vaittinen, Matti 2019-10-29 12:08 ` Lee Jones 2019-10-29 19:34 ` Rob Herring 2019-10-30 8:26 ` Vaittinen, Matti 2019-10-30 19:22 ` Rob Herring 2019-10-31 12:54 ` Vaittinen, Matti 2019-10-31 17:50 ` Rob Herring 2019-11-01 12:52 ` Vaittinen, Matti 2019-11-04 19:28 ` Rob Herring 2019-10-24 11:42 ` [RFC PATCH v2 03/13] dt-bindings: regulator: Document ROHM BD71282 regulator bindings Matti Vaittinen 2019-10-24 11:44 ` [RFC PATCH v2 04/13] mfd: input: bd71828: Add power-key support Matti Vaittinen 2019-10-24 11:44 ` [RFC PATCH v2 05/13] clk: bd718x7: Support ROHM BD71828 clk block Matti Vaittinen 2019-10-28 23:32 ` Stephen Boyd 2019-10-29 6:28 ` Vaittinen, Matti [this message] [not found] ` <20191105005541.7913220717@mail.kernel.org> 2019-11-05 8:11 ` Vaittinen, Matti 2019-10-24 11:45 ` [RFC PATCH v2 06/13] regulator: bd718x7: Split driver to common and bd718x7 specific parts Matti Vaittinen 2019-10-24 11:46 ` [RFC PATCH v2 07/13] regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators Matti Vaittinen 2019-10-24 11:46 ` [RFC PATCH v2 08/13] regulator: bd71828: Add GPIO based run-level control for regulators Matti Vaittinen 2019-10-24 11:47 ` [RFC PATCH v2 09/13] regulator: bd71828: enhanced run-level support Matti Vaittinen 2019-10-24 11:47 ` [RFC PATCH v2 10/13] regulator: bd71828: Support in-kernel APIs to change run-level Matti Vaittinen 2019-10-24 11:50 ` [RFC PATCH v2 11/13] rtc: bd70528 add BD71828 support Matti Vaittinen 2019-10-24 11:50 ` [RFC PATCH v2 12/13] gpio: bd71828: Initial support for ROHM BD71828 PMIC GPIOs Matti Vaittinen 2019-10-24 11:59 ` Linus Walleij 2019-10-24 13:34 ` Vaittinen, Matti 2019-10-24 11:52 ` [RFC PATCH v2 13/13] led: bd71828: Support LED outputs on ROHM BD71828 PMIC Matti Vaittinen
Reply instructions: You may reply publically 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=95b21eeaee8025dc430623429273116c35c1b769.camel@fi.rohmeurope.com \ --to=matti.vaittinen@fi.rohmeurope.com \ --cc=a.zummo@towertech.it \ --cc=alexandre.belloni@bootlin.com \ --cc=bgolaszewski@baylibre.com \ --cc=broonie@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=dmurphy@ti.com \ --cc=jacek.anaszewski@gmail.com \ --cc=lee.jones@linaro.org \ --cc=lgirdwood@gmail.com \ --cc=linus.walleij@linaro.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-leds@vger.kernel.org \ --cc=linux-rtc@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mazziesaccount@gmail.com \ --cc=mturquette@baylibre.com \ --cc=pavel@ucw.cz \ --cc=robh+dt@kernel.org \ --cc=sboyd@kernel.org \ /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
Linux-LEDs Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-leds/0 linux-leds/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-leds linux-leds/ https://lore.kernel.org/linux-leds \ linux-leds@vger.kernel.org public-inbox-index linux-leds Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-leds AGPL code for this site: git clone https://public-inbox.org/public-inbox.git