Re: [PATCH v8 08/12] regulator: bd718x7: Split driver to common and bd718x7 specific parts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 30 Dec 2019, Matti Vaittinen wrote:

> Few ROHM PMICs allow setting the voltage states for different system states
> like RUN, IDLE, SUSPEND and LPSR. States are then changed via SoC specific
> mechanisms. bd718x7 driver implemented device-tree parsing functions for
> these state specific voltages. The parsing functions can be re-used by
> other ROHM chip drivers like bd71828. Split the generic functions from
> bd718x7-regulator.c to rohm-regulator.c and export them for other modules
> to use.
> 
> Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx>
> Acked-by: Mark Brown <broonie@xxxxxxxxxx>
> ---
> 
> Changes from v7 - no changes
> 
>  drivers/regulator/Kconfig             |   4 +
>  drivers/regulator/Makefile            |   1 +
>  drivers/regulator/bd718x7-regulator.c | 183 ++++++++------------------
>  drivers/regulator/rohm-regulator.c    |  95 +++++++++++++
>  include/linux/mfd/rohm-generic.h      |  44 +++++++
>  5 files changed, 199 insertions(+), 128 deletions(-)
>  create mode 100644 drivers/regulator/rohm-regulator.c

[...]

> diff --git a/include/linux/mfd/rohm-generic.h b/include/linux/mfd/rohm-generic.h
> index ff3dd7578fd3..8037421cc6a1 100644
> --- a/include/linux/mfd/rohm-generic.h
> +++ b/include/linux/mfd/rohm-generic.h
> @@ -4,6 +4,9 @@
>  #ifndef __LINUX_MFD_ROHM_H__
>  #define __LINUX_MFD_ROHM_H__
>  
> +#include <linux/regmap.h>
> +#include <linux/regulator/driver.h>
> +
>  enum rohm_chip_type {
>  	ROHM_CHIP_TYPE_BD71837 = 0,
>  	ROHM_CHIP_TYPE_BD71847,
> @@ -17,4 +20,45 @@ struct rohm_regmap_dev {
>  	struct regmap *regmap;
>  };
>  
> +enum {
> +	ROHM_DVS_LEVEL_UNKNOWN,
> +	ROHM_DVS_LEVEL_RUN,
> +	ROHM_DVS_LEVEL_IDLE,
> +	ROHM_DVS_LEVEL_SUSPEND,
> +	ROHM_DVS_LEVEL_LPSR,
> +#define ROHM_DVS_LEVEL_MAX ROHM_DVS_LEVEL_LPSR
> +};
> +
> +struct rohm_dvs_config {
> +	uint64_t level_map;
> +	unsigned int run_reg;
> +	unsigned int run_mask;
> +	unsigned int run_on_mask;
> +	unsigned int idle_reg;
> +	unsigned int idle_mask;
> +	unsigned int idle_on_mask;
> +	unsigned int suspend_reg;
> +	unsigned int suspend_mask;
> +	unsigned int suspend_on_mask;
> +	unsigned int lpsr_reg;
> +	unsigned int lpsr_mask;
> +	unsigned int lpsr_on_mask;
> +};

I think this deserves a kernel-doc header.

> +#if IS_ENABLED(CONFIG_REGULATOR_ROHM)
> +int rohm_regulator_set_dvs_levels(const struct rohm_dvs_config *dvs,
> +				  struct device_node *np,
> +				  const struct regulator_desc *desc,
> +				  struct regmap *regmap);

Does these really need to live in the parent's header file?

What other call-sites are there?

> +#else
> +static inline int rohm_regulator_set_dvs_levels(const struct rohm_dvs_config *dvs,
> +						struct device_node *np,
> +						const struct regulator_desc *desc,
> +						struct regmap *regmap)
> +{
> +	return 0;
> +}
> +#endif //IS_ENABLED(CONFIG_REGULATOR_ROHM)

a) This comment is not really required
b) You shouldn't be using C++ comments

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux