Re: [PATCH 1/6] regulator: pbias: program pbias register offset in pbias driver

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

 



* Kishon Vijay Abraham I <kishon@xxxxxx> [150902 03:51]:
> --- a/drivers/regulator/pbias-regulator.c
> +++ b/drivers/regulator/pbias-regulator.c

How about add a comment here:

/* Offset from SCM general area (and syscon) base */
  
> +static const struct pbias_of_data pbias_of_data_omap2 = {
> +	.offset = 0x230,
> +};
> +
> +static const struct pbias_of_data pbias_of_data_omap3 = {
> +	.offset = 0x2b0,
> +};
> +
> +static const struct pbias_of_data pbias_of_data_omap4 = {
> +	.offset = 0x60,
> +};
> +
> +static const struct pbias_of_data pbias_of_data_omap5 = {
> +	.offset = 0x60,
> +};
> +
> +static const struct pbias_of_data pbias_of_data_dra7 = {
> +	.offset = 0xe00,
> +};
> +
>  static const struct of_device_id pbias_of_match[] = {
>  	{ .compatible = "ti,pbias-omap", },
> +	{ .compatible = "ti,pbias-omap2", .data = &pbias_of_data_omap2, },
> +	{ .compatible = "ti,pbias-omap3", .data = &pbias_of_data_omap3, },
> +	{ .compatible = "ti,pbias-omap4", .data = &pbias_of_data_omap4, },
> +	{ .compatible = "ti,pbias-omap5", .data = &pbias_of_data_omap5, },
> +	{ .compatible = "ti,pbias-dra7", .data = &pbias_of_data_dra7, },
>  	{},
>  };
...

> @@ -129,6 +161,18 @@ static int pbias_regulator_probe(struct platform_device *pdev)
>  	if (IS_ERR(syscon))
>  		return PTR_ERR(syscon);
>  
> +	match = of_match_device(of_match_ptr(pbias_of_match), &pdev->dev);
> +	if (match && match->data) {
> +		data = match->data;
> +		offset = data->offset;
> +	} else {
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +		if (!res)
> +			return -EINVAL;
> +
> +		offset = res->start;
> +	}
> +
>  	cfg.regmap = syscon;
>  	cfg.dev = &pdev->dev;
>  

Maybe add a warning here for parsing the legacy broken IORESOURCE_MEM
that's known to be broken from DT point of view?

Other than that, looks OK to me and should allow also changing to
use a generic solution, Mark may have some other comments.

Anyways, something like this is needed for v4.3-rc cycle, probably
best that Mark queues all these after review. So feel free to add
for the whole series:

Acked-by: Tony Lindgren <tony@xxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux