Patch Detail
Show a patch.
GET /api/patches/4147/?format=api
{ "id": 4147, "url": "https://patchwork.libcamera.org/api/patches/4147/?format=api", "web_url": "https://patchwork.libcamera.org/patch/4147/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200623100815.10674-4-jacopo@jmondi.org>", "date": "2020-06-23T10:07:53", "name": "[libcamera-devel,03/25] media: ov5647: Add support for PWDN GPIO.", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "b32f5260870c909757563afe693f5878525baee3", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/4147/mbox/", "series": [ { "id": 1030, "url": "https://patchwork.libcamera.org/api/series/1030/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1030", "date": "2020-06-23T10:07:50", "name": "media: ov5647: Support RaspberryPi Camera Module v1", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1030/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/4147/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/4147/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 63212609A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 12:05:19 +0200 (CEST)", "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 04339C0016;\n\tTue, 23 Jun 2020 10:05:15 +0000 (UTC)" ], "X-Originating-IP": "93.34.118.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "mchehab@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl,\n\tlaurent.pinchart@ideasonboard.com, roman.kovalivskyi@globallogic.com, \n\tdave.stevenson@raspberrypi.org, naush@raspberrypi.com", "Cc": "Jacopo Mondi <jacopo@jmondi.org>, mrodin@de.adit-jv.com,\n\thugues.fruchet@st.com, mripard@kernel.org, aford173@gmail.com,\n\tsudipi@jp.adit-jv.com, andrew_gabbasov@mentor.com,\n\terosca@de.adit-jv.com, \n\tlinux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org", "Date": "Tue, 23 Jun 2020 12:07:53 +0200", "Message-Id": "<20200623100815.10674-4-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200623100815.10674-1-jacopo@jmondi.org>", "References": "<20200623100815.10674-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 03/25] media: ov5647: Add support for PWDN\n\tGPIO.", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Tue, 23 Jun 2020 10:05:19 -0000" }, "content": "From: Dave Stevenson <dave.stevenson@raspberrypi.org>\n\nAdd support for an optional GPIO connected to PWDN on the sensor. This\nallows the use of hardware standby mode where internal device clock\nand circuit activities are halted.\n\nPlease note that power is off when PWDN is high.\n\nSigned-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>\nSigned-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/i2c/ov5647.c | 28 ++++++++++++++++++++++++++++\n 1 file changed, 28 insertions(+)", "diff": "diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c\nindex e7d2e5b4ad4b9..105ff7f899b34 100644\n--- a/drivers/media/i2c/ov5647.c\n+++ b/drivers/media/i2c/ov5647.c\n@@ -21,6 +21,7 @@\n \n #include <linux/clk.h>\n #include <linux/delay.h>\n+#include <linux/gpio/consumer.h>\n #include <linux/i2c.h>\n #include <linux/init.h>\n #include <linux/io.h>\n@@ -35,6 +36,13 @@\n \n #define SENSOR_NAME \"ov5647\"\n \n+/*\n+ * From the datasheet, \"20ms after PWDN goes low or 20ms after RESETB goes\n+ * high if reset is inserted after PWDN goes high, host can access sensor's\n+ * SCCB to initialize sensor.\"\n+ */\n+#define PWDN_ACTIVE_DELAY_MS\t20\n+\n #define MIPI_CTRL00_CLOCK_LANE_GATE\t\tBIT(5)\n #define MIPI_CTRL00_BUS_IDLE\t\t\tBIT(2)\n #define MIPI_CTRL00_CLOCK_LANE_DISABLE\t\tBIT(0)\n@@ -86,6 +94,7 @@ struct ov5647 {\n \tunsigned int\t\t\theight;\n \tint\t\t\t\tpower_count;\n \tstruct clk\t\t\t*xclk;\n+\tstruct gpio_desc\t\t*pwdn;\n };\n \n static inline struct ov5647 *to_state(struct v4l2_subdev *sd)\n@@ -355,6 +364,11 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)\n \tif (on && !ov5647->power_count)\t{\n \t\tdev_dbg(&client->dev, \"OV5647 power on\\n\");\n \n+\t\tif (ov5647->pwdn) {\n+\t\t\tgpiod_set_value_cansleep(ov5647->pwdn, 0);\n+\t\t\tmsleep(PWDN_ACTIVE_DELAY_MS);\n+\t\t}\n+\n \t\tret = clk_prepare_enable(ov5647->xclk);\n \t\tif (ret < 0) {\n \t\t\tdev_err(&client->dev, \"clk prepare enable failed\\n\");\n@@ -392,6 +406,8 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)\n \t\t\tdev_dbg(&client->dev, \"soft stby failed\\n\");\n \n \t\tclk_disable_unprepare(ov5647->xclk);\n+\n+\t\tgpiod_set_value_cansleep(ov5647->pwdn, 1);\n \t}\n \n \t/* Update the power count. */\n@@ -581,6 +597,10 @@ static int ov5647_probe(struct i2c_client *client)\n \t\treturn -EINVAL;\n \t}\n \n+\t/* Request the power down GPIO asserted */\n+\tsensor->pwdn = devm_gpiod_get_optional(&client->dev, \"pwdn\",\n+\t\t\t\t\t GPIOD_OUT_HIGH);\n+\n \tmutex_init(&sensor->lock);\n \n \tsd = &sensor->sd;\n@@ -594,7 +614,15 @@ static int ov5647_probe(struct i2c_client *client)\n \tif (ret < 0)\n \t\tgoto mutex_remove;\n \n+\tif (sensor->pwdn) {\n+\t\tgpiod_set_value_cansleep(sensor->pwdn, 0);\n+\t\tmsleep(PWDN_ACTIVE_DELAY_MS);\n+\t}\n+\n \tret = ov5647_detect(sd);\n+\n+\tgpiod_set_value_cansleep(sensor->pwdn, 1);\n+\n \tif (ret < 0)\n \t\tgoto error;\n \n", "prefixes": [ "libcamera-devel", "03/25" ] }