* [PATCH] ARM: pcm037: convert custom GPIO-based power function to a regulator
@ 2013-10-31 10:20 Guennadi Liakhovetski
2013-11-04 8:40 ` Sascha Hauer
0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2013-10-31 10:20 UTC (permalink / raw)
To: linux-arm-kernel
Add a fixed-voltage GPIO-enabled regulator to switch the camera on and off
instead of using a .power() platform callback.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
Only tested to grab the regulator during probing, couldn't test
functionality due to the lack of an mt9t031 sensor.
arch/arm/mach-imx/mach-pcm037.c | 50 ++++++++++++++++++++++++++++-----------
1 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index 639a3df..6c19eb1 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -288,12 +288,39 @@ static struct at24_platform_data board_eeprom = {
.flags = AT24_FLAG_ADDR16,
};
-static int pcm037_camera_power(struct device *dev, int on)
-{
- /* disable or enable the camera in X7 or X8 PCM970 connector */
- gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on);
- return 0;
-}
+/* Fixed 3.3V regulator to be used by cameras */
+static struct regulator_consumer_supply vcc_cam_consumers[] = {
+ REGULATOR_SUPPLY("vcc", "soc-camera-pdrv.0"),
+};
+
+static struct regulator_init_data vcc_cam_init_data = {
+ .constraints = {
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+ },
+ .num_consumer_supplies = ARRAY_SIZE(vcc_cam_consumers),
+ .consumer_supplies = vcc_cam_consumers,
+};
+
+static struct fixed_voltage_config vcc_cam_info = {
+ .supply_name = "Camera Vcc",
+ .microvolts = 2800000,
+ .gpio = IOMUX_TO_GPIO(MX31_PIN_CSI_D5),
+ .init_data = &vcc_cam_init_data,
+};
+
+static struct platform_device vcc_cam = {
+ .name = "reg-fixed-voltage",
+ .id = 1,
+ .dev = {
+ .platform_data = &vcc_cam_info,
+ },
+};
+
+static struct regulator_bulk_data cam_supply[] = {
+ {
+ .supply = "vcc",
+ },
+};
static struct i2c_board_info pcm037_i2c_camera[] = {
{
@@ -311,7 +338,8 @@ static struct soc_camera_link iclink_mt9v022 = {
static struct soc_camera_link iclink_mt9t031 = {
.bus_id = 0, /* Must match with the camera ID */
- .power = pcm037_camera_power,
+ .num_regulators = ARRAY_SIZE(cam_supply),
+ .regulators = cam_supply,
.board_info = &pcm037_i2c_camera[0],
.i2c_adapter_id = 2,
};
@@ -436,6 +464,7 @@ err:
static struct platform_device *devices[] __initdata = {
&pcm037_flash,
&pcm037_sram_device,
+ &vcc_cam,
&pcm037_mt9t031,
&pcm037_mt9v022,
};
@@ -647,13 +676,6 @@ static void __init pcm037_init(void)
imx31_add_mx3_sdc_fb(&mx3fb_pdata);
/* CSI */
- /* Camera power: default - off */
- ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), "mt9t031-power");
- if (!ret)
- gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1);
- else
- iclink_mt9t031.power = NULL;
-
pcm037_init_camera();
pcm970_sja1000_resources[1].start =
--
1.7.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: pcm037: convert custom GPIO-based power function to a regulator
2013-10-31 10:20 [PATCH] ARM: pcm037: convert custom GPIO-based power function to a regulator Guennadi Liakhovetski
@ 2013-11-04 8:40 ` Sascha Hauer
2013-11-05 21:56 ` Guennadi Liakhovetski
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2013-11-04 8:40 UTC (permalink / raw)
To: linux-arm-kernel
Hi Guennadi,
On Thu, Oct 31, 2013 at 11:20:46AM +0100, Guennadi Liakhovetski wrote:
> Add a fixed-voltage GPIO-enabled regulator to switch the camera on and off
> instead of using a .power() platform callback.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> Only tested to grab the regulator during probing, couldn't test
> functionality due to the lack of an mt9t031 sensor.
>
> arch/arm/mach-imx/mach-pcm037.c | 50 ++++++++++++++++++++++++++++-----------
> 1 files changed, 36 insertions(+), 14 deletions(-)
What's the motivation for this patch? It probably does the right thing,
but I think we need a plan for converting this to devicetree rather than
adding more stuff.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: pcm037: convert custom GPIO-based power function to a regulator
2013-11-04 8:40 ` Sascha Hauer
@ 2013-11-05 21:56 ` Guennadi Liakhovetski
0 siblings, 0 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2013-11-05 21:56 UTC (permalink / raw)
To: linux-arm-kernel
Hi Sascha,
On Mon, 4 Nov 2013, Sascha Hauer wrote:
> Hi Guennadi,
>
> On Thu, Oct 31, 2013 at 11:20:46AM +0100, Guennadi Liakhovetski wrote:
> > Add a fixed-voltage GPIO-enabled regulator to switch the camera on and off
> > instead of using a .power() platform callback.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> >
> > Only tested to grab the regulator during probing, couldn't test
> > functionality due to the lack of an mt9t031 sensor.
> >
> > arch/arm/mach-imx/mach-pcm037.c | 50 ++++++++++++++++++++++++++++-----------
> > 1 files changed, 36 insertions(+), 14 deletions(-)
>
> What's the motivation for this patch? It probably does the right thing,
> but I think we need a plan for converting this to devicetree rather than
> adding more stuff.
It's not adding stuff. It's getting rid of a custom callback and replacing
it with a proper regulator. Sure, if there's a plan to port this platform
to DT in a foreseeable future - feel free to drop this. But such a port
would require adding DT support to the mx3_camera driver / the soc-camera
framework, which might take some time, and this board isn't too new
either, so, maybe not many customers will be prepared to pay for that kind
of work ;) Anyway, I find this useful in its present form, but if there
are plans to switch to DT soon enough - no problem with dropping it
either.
Thanks
Guennadi
> Sascha
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-05 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 10:20 [PATCH] ARM: pcm037: convert custom GPIO-based power function to a regulator Guennadi Liakhovetski
2013-11-04 8:40 ` Sascha Hauer
2013-11-05 21:56 ` Guennadi Liakhovetski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).