Show a patch.

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

{
    "id": 4170,
    "url": "https://patchwork.libcamera.org/api/patches/4170/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4170/",
    "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": "<20200623165550.45835-4-jacopo@jmondi.org>",
    "date": "2020-06-23T16:55:48",
    "name": "[libcamera-devel,23/25] media: ov5647: Support V4L2_CID_HBLANK control",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "3b9d7212963f29a76eadd5d1fae05336964fbe05",
    "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/4170/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/4170/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4170/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 760B560103\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 18:52: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 relay12.mail.gandi.net (Postfix) with ESMTPSA id 1C10A20000A;\n\tTue, 23 Jun 2020 16:52:49 +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": "mrodin@de.adit-jv.com, hugues.fruchet@st.com, mripard@kernel.org,\n\taford173@gmail.com, sudipi@jp.adit-jv.com, andrew_gabbasov@mentor.com,\n\terosca@de.adit-jv.com, linux-media@vger.kernel.org,\n\tlibcamera-devel@lists.libcamera.org, Jacopo Mondi <jacopo@jmondi.org>",
        "Date": "Tue, 23 Jun 2020 18:55:48 +0200",
        "Message-Id": "<20200623165550.45835-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 23/25] media: ov5647: Support\n\tV4L2_CID_HBLANK control",
        "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 16:52:53 -0000"
    },
    "content": "Add support for the V4L2_CID_HBLANK read-only control.\n\nThe implementation has been upported from RaspberryPi BSP commit:\ncommit d82f202156605 (\"media: i2c: ov5647: Set V4L2_SUBDEV_FL_HAS_EVENTS flag\")\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/i2c/ov5647.c | 26 +++++++++++++++++++++++++-\n 1 file changed, 25 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c\nindex 218576a05e66b..3467a8090b38d 100644\n--- a/drivers/media/i2c/ov5647.c\n+++ b/drivers/media/i2c/ov5647.c\n@@ -77,6 +77,7 @@ struct ov5647_mode {\n \tstruct v4l2_mbus_framefmt\tformat;\n \tstruct v4l2_rect\t\tcrop;\n \tu64\t\t\t\tpixel_rate;\n+\tint\t\t\t\thts;\n \tstruct regval_list\t\t*reg_list;\n \tunsigned int\t\t\tnum_regs;\n };\n@@ -99,6 +100,7 @@ struct ov5647 {\n \tstruct ov5647_mode\t\t*mode;\n \tstruct ov5647_mode\t\t*current_mode;\n \tstruct v4l2_ctrl\t\t*pixel_rate;\n+\tstruct v4l2_ctrl\t\t*hblank;\n };\n \n static inline struct ov5647 *to_sensor(struct v4l2_subdev *sd)\n@@ -586,6 +588,7 @@ static struct ov5647_mode ov5647_sbggr8_modes[] = {\n \t\t\t.height\t\t= 960,\n \t\t},\n \t\t.pixel_rate\t= 77291670,\n+\t\t.hts\t\t= 1896,\n \t\t.reg_list\t= ov5647_640x480_sbggr8,\n \t\t.num_regs\t= ARRAY_SIZE(ov5647_640x480_sbggr8)\n \t},\n@@ -608,6 +611,7 @@ static struct ov5647_mode ov5647_sbggr10_modes[] = {\n \t\t\t.height\t\t= 1944\n \t\t},\n \t\t.pixel_rate\t= 87500000,\n+\t\t.hts\t\t= 2844,\n \t\t.reg_list\t= ov5647_2592x1944_sbggr10,\n \t\t.num_regs\t= ARRAY_SIZE(ov5647_2592x1944_sbggr10)\n \t},\n@@ -627,6 +631,7 @@ static struct ov5647_mode ov5647_sbggr10_modes[] = {\n \t\t\t.height\t\t= 1080,\n \t\t},\n \t\t.pixel_rate\t= 81666700,\n+\t\t.hts\t\t= 2416,\n \t\t.reg_list\t= ov5647_1080p30_sbggr10,\n \t\t.num_regs\t= ARRAY_SIZE(ov5647_1080p30_sbggr10)\n \t},\n@@ -646,6 +651,7 @@ static struct ov5647_mode ov5647_sbggr10_modes[] = {\n \t\t\t.height\t\t= 1944,\n \t\t},\n \t\t.pixel_rate\t= 81666700,\n+\t\t.hts\t\t= 1896,\n \t\t.reg_list\t= ov5647_2x2binned_sbggr10,\n \t\t.num_regs\t= ARRAY_SIZE(ov5647_2x2binned_sbggr10)\n \t},\n@@ -665,6 +671,7 @@ static struct ov5647_mode ov5647_sbggr10_modes[] = {\n \t\t\t.height\t\t= 1920,\n \t\t},\n \t\t.pixel_rate\t= 55000000,\n+\t\t.hts\t\t= 1852,\n \t\t.reg_list\t= ov5647_640x480_sbggr10,\n \t\t.num_regs\t= ARRAY_SIZE(ov5647_640x480_sbggr10)\n \t},\n@@ -1072,6 +1079,7 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,\n \tstruct ov5647_mode *ov5647_mode_list;\n \tstruct ov5647_mode *mode;\n \tunsigned int num_modes;\n+\tint hblank;\n \n \t/*\n \t * Default mbus code MEDIA_BUS_FMT_SBGGR10_1X10 if the requested one\n@@ -1105,6 +1113,9 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,\n \t__v4l2_ctrl_modify_range(sensor->pixel_rate, mode->pixel_rate,\n \t\t\t\t mode->pixel_rate, 1, mode->pixel_rate);\n \n+\thblank = mode->hts - mode->format.width;\n+\t__v4l2_ctrl_modify_range(sensor->hblank, hblank, hblank, 1, hblank);\n+\n \t*fmt = mode->format;\n \tmutex_unlock(&sensor->lock);\n \n@@ -1309,6 +1320,9 @@ static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)\n \tcase V4L2_CID_PIXEL_RATE:\n \t\t/* Read-only, but we adjust it based on mode. */\n \t\treturn 0;\n+\tcase V4L2_CID_HBLANK:\n+\t\t/* Read-only, but we adjust it based on mode. */\n+\t\treturn 0;\n \tdefault:\n \t\tdev_info(&client->dev,\n \t\t\t \"Control (id:0x%x, val:0x%x) not supported\\n\",\n@@ -1326,8 +1340,9 @@ static const struct v4l2_ctrl_ops ov5647_ctrl_ops = {\n static int ov5647_init_controls(struct ov5647 *sensor)\n {\n \tstruct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);\n+\tint hblank;\n \n-\tv4l2_ctrl_handler_init(&sensor->ctrls, 6);\n+\tv4l2_ctrl_handler_init(&sensor->ctrls, 7);\n \n \tv4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,\n \t\t\t  V4L2_CID_AUTOGAIN, 0, 1, 1, 0);\n@@ -1357,6 +1372,15 @@ static int ov5647_init_controls(struct ov5647 *sensor)\n \t\tgoto handler_free;\n \tsensor->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY;\n \n+\t/* By default, HBLANK is read only, but it does change per mode */\n+\thblank = sensor->mode->hts - sensor->mode->format.width;\n+\tsensor->hblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,\n+\t\t\t\t\t   V4L2_CID_HBLANK, hblank, hblank, 1,\n+\t\t\t\t\t   hblank);\n+\tif (!sensor->hblank)\n+\t\tgoto handler_free;\n+\tsensor->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;\n+\n \tif (sensor->ctrls.error)\n \t\tgoto handler_free;\n \n",
    "prefixes": [
        "libcamera-devel",
        "23/25"
    ]
}