All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: gene_chen@richtek.com, linux-kernel@vger.kernel.org,
	cy_huang@richtek.com, linux-mediatek@lists.infradead.org,
	matthias.bgg@gmail.com, Wilma.Wu@mediatek.com,
	linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com
Subject: Re: [PATCH v4] mfd: mt6360: add pmic mt6360 driver
Date: Thu, 24 Oct 2019 09:29:28 +0100	[thread overview]
Message-ID: <20191024082928.GL15843@dell> (raw)
In-Reply-To: <1571749359-15752-1-git-send-email-gene.chen.richtek@gmail.com>

On Tue, 22 Oct 2019, Gene Chen wrote:

> From: Gene Chen <gene_chen@richtek.com>
> 
> Add mfd driver for mt6360 pmic chip include
> Battery Charger/USB_PD/Flash LED/RGB LED/LDO/Buck
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.com
> ---
>  drivers/mfd/Kconfig                |  12 +
>  drivers/mfd/Makefile               |   1 +
>  drivers/mfd/mt6360-core.c          | 457 +++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/mt6360-private.h | 279 ++++++++++++++++++++++
>  include/linux/mfd/mt6360.h         |  32 +++
>  5 files changed, 781 insertions(+)
>  create mode 100644 drivers/mfd/mt6360-core.c
>  create mode 100644 include/linux/mfd/mt6360-private.h
>  create mode 100644 include/linux/mfd/mt6360.h
> 
> changelogs between v1 & v2
> - include missing header file
> 
> changelogs between v2 & v3
> - add changelogs
> 
> changelogs between v3 & v4
> - fix Kconfig description
> - replace mt6360_pmu_info with mt6360_pmu_data
> - replace probe with probe_new
> - remove unnecessary irq_chip variable
> - remove annotation
> - replace MT6360_MFD_CELL with OF_MFD_CELL

[...]

> +/* IRQ definitions */
> +struct mt6360_pmu_irq_desc {
> +	const char *name;
> +	irq_handler_t irq_handler;
> +};
> +
> +#define  MT6360_DT_VALPROP(name, type) \
> +			{#name, offsetof(type, name)}
> +
> +struct mt6360_val_prop {
> +	const char *name;
> +	size_t offset;
> +};
> +
> +static inline void mt6360_dt_parser_helper(struct device_node *np, void *data,
> +					   const struct mt6360_val_prop *props,
> +					   int prop_cnt)
> +{
> +	int i;
> +
> +	for (i = 0; i < prop_cnt; i++) {
> +		if (unlikely(!props[i].name))
> +			continue;
> +		of_property_read_u32(np, props[i].name, data + props[i].offset);
> +	}
> +}
> +
> +#define MT6360_PDATA_VALPROP(name, type, reg, shift, mask, func, base) \
> +			{offsetof(type, name), reg, shift, mask, func, base}
> +
> +struct mt6360_pdata_prop {
> +	size_t offset;
> +	u8 reg;
> +	u8 shift;
> +	u8 mask;
> +	u32 (*transform)(u32 val);
> +	u8 base;
> +};
> +
> +static inline int mt6360_pdata_apply_helper(void *context, void *pdata,
> +					   const struct mt6360_pdata_prop *prop,
> +					   int prop_cnt)
> +{
> +	int i, ret;
> +	u32 val;
> +
> +	for (i = 0; i < prop_cnt; i++) {
> +		val = *(u32 *)(pdata + prop[i].offset);
> +		if (prop[i].transform)
> +			val = prop[i].transform(val);
> +		val += prop[i].base;
> +		ret = regmap_update_bits(context,
> +			     prop[i].reg, prop[i].mask, val << prop[i].shift);
> +		if (ret < 0)
> +			return ret;
> +	}
> +	return 0;
> +}

Where are these helpers used?

Are they generic?

Why are they helpful to you, but not helpful to anyone else?

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: gene_chen@richtek.com, linux-kernel@vger.kernel.org,
	cy_huang@richtek.com, linux-mediatek@lists.infradead.org,
	matthias.bgg@gmail.com, Wilma.Wu@mediatek.com,
	linux-arm-kernel@lists.infradead.org, shufan_lee@richtek.com
Subject: Re: [PATCH v4] mfd: mt6360: add pmic mt6360 driver
Date: Thu, 24 Oct 2019 09:29:28 +0100	[thread overview]
Message-ID: <20191024082928.GL15843@dell> (raw)
In-Reply-To: <1571749359-15752-1-git-send-email-gene.chen.richtek@gmail.com>

On Tue, 22 Oct 2019, Gene Chen wrote:

> From: Gene Chen <gene_chen@richtek.com>
> 
> Add mfd driver for mt6360 pmic chip include
> Battery Charger/USB_PD/Flash LED/RGB LED/LDO/Buck
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.com
> ---
>  drivers/mfd/Kconfig                |  12 +
>  drivers/mfd/Makefile               |   1 +
>  drivers/mfd/mt6360-core.c          | 457 +++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/mt6360-private.h | 279 ++++++++++++++++++++++
>  include/linux/mfd/mt6360.h         |  32 +++
>  5 files changed, 781 insertions(+)
>  create mode 100644 drivers/mfd/mt6360-core.c
>  create mode 100644 include/linux/mfd/mt6360-private.h
>  create mode 100644 include/linux/mfd/mt6360.h
> 
> changelogs between v1 & v2
> - include missing header file
> 
> changelogs between v2 & v3
> - add changelogs
> 
> changelogs between v3 & v4
> - fix Kconfig description
> - replace mt6360_pmu_info with mt6360_pmu_data
> - replace probe with probe_new
> - remove unnecessary irq_chip variable
> - remove annotation
> - replace MT6360_MFD_CELL with OF_MFD_CELL

[...]

> +/* IRQ definitions */
> +struct mt6360_pmu_irq_desc {
> +	const char *name;
> +	irq_handler_t irq_handler;
> +};
> +
> +#define  MT6360_DT_VALPROP(name, type) \
> +			{#name, offsetof(type, name)}
> +
> +struct mt6360_val_prop {
> +	const char *name;
> +	size_t offset;
> +};
> +
> +static inline void mt6360_dt_parser_helper(struct device_node *np, void *data,
> +					   const struct mt6360_val_prop *props,
> +					   int prop_cnt)
> +{
> +	int i;
> +
> +	for (i = 0; i < prop_cnt; i++) {
> +		if (unlikely(!props[i].name))
> +			continue;
> +		of_property_read_u32(np, props[i].name, data + props[i].offset);
> +	}
> +}
> +
> +#define MT6360_PDATA_VALPROP(name, type, reg, shift, mask, func, base) \
> +			{offsetof(type, name), reg, shift, mask, func, base}
> +
> +struct mt6360_pdata_prop {
> +	size_t offset;
> +	u8 reg;
> +	u8 shift;
> +	u8 mask;
> +	u32 (*transform)(u32 val);
> +	u8 base;
> +};
> +
> +static inline int mt6360_pdata_apply_helper(void *context, void *pdata,
> +					   const struct mt6360_pdata_prop *prop,
> +					   int prop_cnt)
> +{
> +	int i, ret;
> +	u32 val;
> +
> +	for (i = 0; i < prop_cnt; i++) {
> +		val = *(u32 *)(pdata + prop[i].offset);
> +		if (prop[i].transform)
> +			val = prop[i].transform(val);
> +		val += prop[i].base;
> +		ret = regmap_update_bits(context,
> +			     prop[i].reg, prop[i].mask, val << prop[i].shift);
> +		if (ret < 0)
> +			return ret;
> +	}
> +	return 0;
> +}

Where are these helpers used?

Are they generic?

Why are they helpful to you, but not helpful to anyone else?

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	gene_chen@richtek.com, Wilma.Wu@mediatek.com,
	shufan_lee@richtek.com, cy_huang@richtek.com
Subject: Re: [PATCH v4] mfd: mt6360: add pmic mt6360 driver
Date: Thu, 24 Oct 2019 09:29:28 +0100	[thread overview]
Message-ID: <20191024082928.GL15843@dell> (raw)
In-Reply-To: <1571749359-15752-1-git-send-email-gene.chen.richtek@gmail.com>

On Tue, 22 Oct 2019, Gene Chen wrote:

> From: Gene Chen <gene_chen@richtek.com>
> 
> Add mfd driver for mt6360 pmic chip include
> Battery Charger/USB_PD/Flash LED/RGB LED/LDO/Buck
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.com
> ---
>  drivers/mfd/Kconfig                |  12 +
>  drivers/mfd/Makefile               |   1 +
>  drivers/mfd/mt6360-core.c          | 457 +++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/mt6360-private.h | 279 ++++++++++++++++++++++
>  include/linux/mfd/mt6360.h         |  32 +++
>  5 files changed, 781 insertions(+)
>  create mode 100644 drivers/mfd/mt6360-core.c
>  create mode 100644 include/linux/mfd/mt6360-private.h
>  create mode 100644 include/linux/mfd/mt6360.h
> 
> changelogs between v1 & v2
> - include missing header file
> 
> changelogs between v2 & v3
> - add changelogs
> 
> changelogs between v3 & v4
> - fix Kconfig description
> - replace mt6360_pmu_info with mt6360_pmu_data
> - replace probe with probe_new
> - remove unnecessary irq_chip variable
> - remove annotation
> - replace MT6360_MFD_CELL with OF_MFD_CELL

[...]

> +/* IRQ definitions */
> +struct mt6360_pmu_irq_desc {
> +	const char *name;
> +	irq_handler_t irq_handler;
> +};
> +
> +#define  MT6360_DT_VALPROP(name, type) \
> +			{#name, offsetof(type, name)}
> +
> +struct mt6360_val_prop {
> +	const char *name;
> +	size_t offset;
> +};
> +
> +static inline void mt6360_dt_parser_helper(struct device_node *np, void *data,
> +					   const struct mt6360_val_prop *props,
> +					   int prop_cnt)
> +{
> +	int i;
> +
> +	for (i = 0; i < prop_cnt; i++) {
> +		if (unlikely(!props[i].name))
> +			continue;
> +		of_property_read_u32(np, props[i].name, data + props[i].offset);
> +	}
> +}
> +
> +#define MT6360_PDATA_VALPROP(name, type, reg, shift, mask, func, base) \
> +			{offsetof(type, name), reg, shift, mask, func, base}
> +
> +struct mt6360_pdata_prop {
> +	size_t offset;
> +	u8 reg;
> +	u8 shift;
> +	u8 mask;
> +	u32 (*transform)(u32 val);
> +	u8 base;
> +};
> +
> +static inline int mt6360_pdata_apply_helper(void *context, void *pdata,
> +					   const struct mt6360_pdata_prop *prop,
> +					   int prop_cnt)
> +{
> +	int i, ret;
> +	u32 val;
> +
> +	for (i = 0; i < prop_cnt; i++) {
> +		val = *(u32 *)(pdata + prop[i].offset);
> +		if (prop[i].transform)
> +			val = prop[i].transform(val);
> +		val += prop[i].base;
> +		ret = regmap_update_bits(context,
> +			     prop[i].reg, prop[i].mask, val << prop[i].shift);
> +		if (ret < 0)
> +			return ret;
> +	}
> +	return 0;
> +}

Where are these helpers used?

Are they generic?

Why are they helpful to you, but not helpful to anyone else?

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

  parent reply	other threads:[~2019-10-24  8:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 13:02 [PATCH v4] mfd: mt6360: add pmic mt6360 driver Gene Chen
2019-10-22 13:02 ` Gene Chen
2019-10-22 13:02 ` Gene Chen
2019-10-24  8:26 ` Lee Jones
2019-10-24  8:26   ` Lee Jones
2019-10-24  8:26   ` Lee Jones
2019-10-24  8:52   ` Wolfram Sang
2019-10-24  8:52     ` Wolfram Sang
2019-10-24  8:52     ` Wolfram Sang
2019-10-24  8:29 ` Lee Jones [this message]
2019-10-24  8:29   ` Lee Jones
2019-10-24  8:29   ` Lee Jones
2019-10-24 14:42 ` kbuild test robot
2019-10-24 14:42   ` kbuild test robot
2019-10-24 14:42   ` kbuild test robot
2019-10-24 14:42   ` kbuild test robot
2019-10-24 15:07 ` kbuild test robot
2019-10-24 15:07   ` kbuild test robot
2019-10-24 15:07   ` kbuild test robot
2019-10-24 15:07   ` kbuild test robot

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=20191024082928.GL15843@dell \
    --to=lee.jones@linaro.org \
    --cc=Wilma.Wu@mediatek.com \
    --cc=cy_huang@richtek.com \
    --cc=gene.chen.richtek@gmail.com \
    --cc=gene_chen@richtek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=shufan_lee@richtek.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.