Show a patch.

GET /api/1.1/patches/4117/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 4117,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/4117/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4117/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200622171910.608894-4-jacopo@jmondi.org>",
    "date": "2020-06-22T17:18:48",
    "name": "[libcamera-devel,03/25] media: ov5647: Add support for PWDN GPIO.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b32f5260870c909757563afe693f5878525baee3",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4117/mbox/",
    "series": [
        {
            "id": 1026,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1026/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1026",
            "date": "2020-06-22T17:18:45",
            "name": "media: ov5647: Support RaspberryPi Camera Module v1",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1026/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4117/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4117/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3AB04603B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jun 2020 19:16:14 +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 relay7-d.mail.gandi.net (Postfix) with ESMTPSA id BBBB72000A;\n\tMon, 22 Jun 2020 17:16:10 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.118.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "lolivei@synopsys.com, mchehab@kernel.org, sakari.ailus@linux.intel.com, \n\thverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com,\n\troman.kovalivskyi@globallogic.com, dave.stevenson@raspberrypi.org,\n\tnaush@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": "Mon, 22 Jun 2020 19:18:48 +0200",
        "Message-Id": "<20200622171910.608894-4-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200622171910.608894-1-jacopo@jmondi.org>",
        "References": "<20200622171910.608894-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": "Mon, 22 Jun 2020 17:16:14 -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"
    ]
}