Patch Detail
Show a patch.
GET /api/1.1/patches/4154/?format=api
{ "id": 4154, "url": "https://patchwork.libcamera.org/api/1.1/patches/4154/?format=api", "web_url": "https://patchwork.libcamera.org/patch/4154/", "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": "<20200623100815.10674-11-jacopo@jmondi.org>", "date": "2020-06-23T10:08:00", "name": "[libcamera-devel,10/25] media: ov5647: Program mode at s_stream(1) time", "commit_ref": null, "pull_url": null, "state": "not-applicable", "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": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/4154/mbox/", "series": [ { "id": 1030, "url": "https://patchwork.libcamera.org/api/1.1/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/4154/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/4154/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BAA5A609A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 12:05:53 +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 relay11.mail.gandi.net (Postfix) with ESMTPSA id AA02D100008;\n\tTue, 23 Jun 2020 10:05:47 +0000 (UTC)" ], "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:08:00 +0200", "Message-Id": "<20200623100815.10674-11-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 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": "Tue, 23 Jun 2020 10:05:53 -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" ] }