[U-Boot] [PATCH v2 03/11] pmic: Add support for setting transmission length in uclass private data

Simon Glass sjg at chromium.org
Sun May 13 22:01:28 UTC 2018


On 7 May 2018 at 06:26, Lukasz Majewski <lukma at denx.de> wrote:
> The struct dm_pmic_info's trans_len field stores the number of types to
> be transmitted per PMIC transfer.
>
> Signed-off-by: Lukasz Majewski <lukma at denx.de>
>
> ---
>
> Changes in v2:
> - New patch
>
>  drivers/power/pmic/pmic-uclass.c | 10 ++++++++++
>  include/power/pmic.h             |  4 ++++
>  2 files changed, 14 insertions(+)
>

Reviewed-by: Simon Glass <sjg at chromium.org>

Please see below.

> diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
> index 5e8f6d6190..88669533bd 100644
> --- a/drivers/power/pmic/pmic-uclass.c
> +++ b/drivers/power/pmic/pmic-uclass.c
> @@ -166,7 +166,17 @@ int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set)
>         return pmic_reg_write(dev, reg, byte);
>  }
>
> +static int pmic_pre_probe(struct udevice *dev)
> +{
> +       struct dm_pmic_info *pmic_info = dev_get_uclass_priv(dev);
> +
> +       pmic_info->trans_len = 1;
> +       return 0;
> +}
> +
>  UCLASS_DRIVER(pmic) = {
>         .id             = UCLASS_PMIC,
>         .name           = "pmic",
> +       .pre_probe      = pmic_pre_probe,
> +       .per_device_auto_alloc_size = sizeof(struct dm_pmic_info),
>  };
> diff --git a/include/power/pmic.h b/include/power/pmic.h
> index f2fe537fb7..0791c6aa2c 100644
> --- a/include/power/pmic.h
> +++ b/include/power/pmic.h
> @@ -298,6 +298,10 @@ int pmic_reg_write(struct udevice *dev, uint reg, uint value);
>   */
>  int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set);
>
> +struct dm_pmic_info {
> +       uint trans_len;

Please add a comment for this. Also, how about uc_pmic_priv since this
is device-specific private information owned by the uclass.

> +};
> +
>  #endif /* CONFIG_DM_PMIC */
>
>  #ifdef CONFIG_POWER
> --
> 2.11.0
>


More information about the U-Boot mailing list