Show a patch.

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

{
    "id": 4124,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/4124/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4124/",
    "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-11-jacopo@jmondi.org>",
    "date": "2020-06-22T17:18:55",
    "name": "[libcamera-devel,10/25] media: ov5647: Program mode at s_stream(1) time",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "60e7af181a59aa083aef75f5d907ed614d81a15a",
    "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/4124/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/4124/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4124/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 B48B8603B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jun 2020 19:16:38 +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 5378020004;\n\tMon, 22 Jun 2020 17:16:35 +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:55 +0200",
        "Message-Id": "<20200622171910.608894-11-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 10/25] media: ov5647: Program mode at\n\ts_stream(1) time",
        "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:38 -0000"
    },
    "content": "Rename __sensor_init() function to ov5647_set_mode() as the function\nis a regular one and the double underscores prefix shall be removed, and\nthen move it to program the mode at s_stream(1) time, not at sensor power\nup.\n\nBreak out from __sensor_init() the stream_off() operation call at sensor\npower up to coax the lanes in LP-11 state.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/i2c/ov5647.c | 81 +++++++++++++++++++++-----------------\n 1 file changed, 44 insertions(+), 37 deletions(-)",
    "diff": "diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c\nindex 0c88f682de9b9..bb9ff77f49fe0 100644\n--- a/drivers/media/i2c/ov5647.c\n+++ b/drivers/media/i2c/ov5647.c\n@@ -264,12 +264,54 @@ static int ov5647_set_virtual_channel(struct v4l2_subdev *sd, int channel)\n \treturn ov5647_write(sd, OV5647_REG_MIPI_CTRL14, channel_id | (channel << 6));\n }\n \n+static int ov5647_set_mode(struct v4l2_subdev *sd)\n+{\n+\tstruct i2c_client *client = v4l2_get_subdevdata(sd);\n+\tu8 resetval, rdval;\n+\tint ret;\n+\n+\tret = ov5647_read(sd, OV5647_SW_STANDBY, &rdval);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tret = ov5647_write_array(sd, ov5647_640x480,\n+\t\t\t\t ARRAY_SIZE(ov5647_640x480));\n+\tif (ret < 0) {\n+\t\tdev_err(&client->dev, \"write sensor default regs error\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\tret = ov5647_set_virtual_channel(sd, 0);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tret = ov5647_read(sd, OV5647_SW_STANDBY, &resetval);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tif (!(resetval & 0x01)) {\n+\t\tdev_err(&client->dev, \"Device was in SW standby\");\n+\t\tret = ov5647_write(sd, OV5647_SW_STANDBY, 0x01);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int ov5647_stream_on(struct v4l2_subdev *sd)\n {\n+\tstruct i2c_client *client = v4l2_get_subdevdata(sd);\n \tstruct ov5647 *ov5647 = to_state(sd);\n \tu8 val = MIPI_CTRL00_BUS_IDLE;\n \tint ret;\n \n+\tret = ov5647_set_mode(sd);\n+\tif (ret) {\n+\t\tdev_err(&client->dev, \"Failed to program sensor mode: %d\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n \tif (ov5647->clock_ncont)\n \t\tval |= MIPI_CTRL00_CLOCK_LANE_GATE |\n \t\t       MIPI_CTRL00_LINE_SYNC_ENABLE;\n@@ -318,42 +360,6 @@ static int set_sw_standby(struct v4l2_subdev *sd, bool standby)\n \treturn ov5647_write(sd, OV5647_SW_STANDBY, rdval);\n }\n \n-static int __sensor_init(struct v4l2_subdev *sd)\n-{\n-\tstruct i2c_client *client = v4l2_get_subdevdata(sd);\n-\tu8 resetval, rdval;\n-\tint ret;\n-\n-\tret = ov5647_read(sd, OV5647_SW_STANDBY, &rdval);\n-\tif (ret < 0)\n-\t\treturn ret;\n-\n-\tret = ov5647_write_array(sd, ov5647_640x480,\n-\t\t\t\t ARRAY_SIZE(ov5647_640x480));\n-\tif (ret < 0) {\n-\t\tdev_err(&client->dev, \"write sensor default regs error\\n\");\n-\t\treturn ret;\n-\t}\n-\n-\tret = ov5647_set_virtual_channel(sd, 0);\n-\tif (ret < 0)\n-\t\treturn ret;\n-\n-\tret = ov5647_read(sd, OV5647_SW_STANDBY, &resetval);\n-\tif (ret < 0)\n-\t\treturn ret;\n-\n-\tif (!(resetval & 0x01)) {\n-\t\tdev_err(&client->dev, \"Device was in SW standby\");\n-\t\tret = ov5647_write(sd, OV5647_SW_STANDBY, 0x01);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\t}\n-\n-\t/* Stream off to make the clock lane into LP-11 state. */\n-\treturn ov5647_stream_off(sd);\n-}\n-\n static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)\n {\n \tstruct i2c_client *client = v4l2_get_subdevdata(sd);\n@@ -385,7 +391,8 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)\n \t\t\tgoto out;\n \t\t}\n \n-\t\tret = __sensor_init(sd);\n+\t\t/* Stream off to coax lanes into LP-11 state. */\n+\t\tret = ov5647_stream_off(sd);\n \t\tif (ret < 0) {\n \t\t\tclk_disable_unprepare(ov5647->xclk);\n \t\t\tdev_err(&client->dev,\n",
    "prefixes": [
        "libcamera-devel",
        "10/25"
    ]
}