mt9p031.c (bbcc9fa0afe4f8a36e8777e14f7b016090605306) mt9p031.c (2660a22b55ae9a01c1e1117e9d514427834704bc)
1/*
2 * Driver for MT9P031 CMOS Image Sensor from Aptina
3 *
4 * Copyright (C) 2011, Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 * Copyright (C) 2011, Javier Martin <javier.martin@vista-silicon.com>
6 * Copyright (C) 2011, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
7 *
8 * Based on the MT9V032 driver and Bastian Hecht's code.

--- 258 unchanged lines hidden (view full) ---

267
268 return mt9p031_write(client, MT9P031_PLL_CONTROL,
269 MT9P031_PLL_CONTROL_PWROFF);
270}
271
272static int mt9p031_power_on(struct mt9p031 *mt9p031)
273{
274 /* Ensure RESET_BAR is low */
1/*
2 * Driver for MT9P031 CMOS Image Sensor from Aptina
3 *
4 * Copyright (C) 2011, Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 * Copyright (C) 2011, Javier Martin <javier.martin@vista-silicon.com>
6 * Copyright (C) 2011, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
7 *
8 * Based on the MT9V032 driver and Bastian Hecht's code.

--- 258 unchanged lines hidden (view full) ---

267
268 return mt9p031_write(client, MT9P031_PLL_CONTROL,
269 MT9P031_PLL_CONTROL_PWROFF);
270}
271
272static int mt9p031_power_on(struct mt9p031 *mt9p031)
273{
274 /* Ensure RESET_BAR is low */
275 if (mt9p031->reset != -1) {
275 if (gpio_is_valid(mt9p031->reset)) {
276 gpio_set_value(mt9p031->reset, 0);
277 usleep_range(1000, 2000);
278 }
279
280 /* Bring up the supplies */
281 regulator_enable(mt9p031->vdd);
282 regulator_enable(mt9p031->vdd_io);
283 regulator_enable(mt9p031->vaa);
284
285 /* Emable clock */
286 if (mt9p031->clk)
287 clk_prepare_enable(mt9p031->clk);
288
289 /* Now RESET_BAR must be high */
276 gpio_set_value(mt9p031->reset, 0);
277 usleep_range(1000, 2000);
278 }
279
280 /* Bring up the supplies */
281 regulator_enable(mt9p031->vdd);
282 regulator_enable(mt9p031->vdd_io);
283 regulator_enable(mt9p031->vaa);
284
285 /* Emable clock */
286 if (mt9p031->clk)
287 clk_prepare_enable(mt9p031->clk);
288
289 /* Now RESET_BAR must be high */
290 if (mt9p031->reset != -1) {
290 if (gpio_is_valid(mt9p031->reset)) {
291 gpio_set_value(mt9p031->reset, 1);
292 usleep_range(1000, 2000);
293 }
294
295 return 0;
296}
297
298static void mt9p031_power_off(struct mt9p031 *mt9p031)
299{
291 gpio_set_value(mt9p031->reset, 1);
292 usleep_range(1000, 2000);
293 }
294
295 return 0;
296}
297
298static void mt9p031_power_off(struct mt9p031 *mt9p031)
299{
300 if (mt9p031->reset != -1) {
300 if (gpio_is_valid(mt9p031->reset)) {
301 gpio_set_value(mt9p031->reset, 0);
302 usleep_range(1000, 2000);
303 }
304
305 regulator_disable(mt9p031->vaa);
306 regulator_disable(mt9p031->vdd_io);
307 regulator_disable(mt9p031->vdd);
308

--- 717 unchanged lines hidden (view full) ---

1026 else
1027 mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
1028
1029 mt9p031->format.width = MT9P031_WINDOW_WIDTH_DEF;
1030 mt9p031->format.height = MT9P031_WINDOW_HEIGHT_DEF;
1031 mt9p031->format.field = V4L2_FIELD_NONE;
1032 mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
1033
301 gpio_set_value(mt9p031->reset, 0);
302 usleep_range(1000, 2000);
303 }
304
305 regulator_disable(mt9p031->vaa);
306 regulator_disable(mt9p031->vdd_io);
307 regulator_disable(mt9p031->vdd);
308

--- 717 unchanged lines hidden (view full) ---

1026 else
1027 mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
1028
1029 mt9p031->format.width = MT9P031_WINDOW_WIDTH_DEF;
1030 mt9p031->format.height = MT9P031_WINDOW_HEIGHT_DEF;
1031 mt9p031->format.field = V4L2_FIELD_NONE;
1032 mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
1033
1034 if (pdata->reset != -1) {
1034 if (gpio_is_valid(pdata->reset)) {
1035 ret = devm_gpio_request_one(&client->dev, pdata->reset,
1036 GPIOF_OUT_INIT_LOW, "mt9p031_rst");
1037 if (ret < 0)
1038 goto done;
1039
1040 mt9p031->reset = pdata->reset;
1041 }
1042

--- 44 unchanged lines hidden ---
1035 ret = devm_gpio_request_one(&client->dev, pdata->reset,
1036 GPIOF_OUT_INIT_LOW, "mt9p031_rst");
1037 if (ret < 0)
1038 goto done;
1039
1040 mt9p031->reset = pdata->reset;
1041 }
1042

--- 44 unchanged lines hidden ---