From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84D08566C73 for ; Wed, 14 Oct 2026 17:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792000484; cv=none; b=DEj/QnmwWVfw0BB8j8GGbjXPs1dAmigNgBMPXfk8TUiyEu78mdjA1GsGRQQqDP/IEckJ6wlZao02Gv56qkU0ZNXeEsPi/qZUUpaz1P4lMkodHLA5wVFA/CUDia+YcgATMz/H0YdRaEQImXjtUWPF3RUNsBv+ELjlPUV52WbsgRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792000484; c=relaxed/simple; bh=LDcbTNir62rV20SGZG1KYPB/lL6RsAH2wL+Y3BnGfRQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nkl8fON4pjiIof7hAyjtyiZ/ubQuWHdnIk09HIOfNnBngjn7c/T9eSDMUzi0QfNvN0orjN8dBW22TOSp0JXZu5WwZvUMnaOMzmd7VSx5z3i89kPWWcKFBwB+3jF7A6Uiw0+baHZPqstbnmG3uZ3UiXkZ6yrSYxMNR9ABk+0ZpfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=pbyIaDkk; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="pbyIaDkk" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-49ff680331aso14565985e9.3 for ; Wed, 14 Oct 2026 10:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1792000479; x=1792605279; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=A11ELgzrLJMDPQP6jv4hsgi3W8J+7I8K+Xp7zfgIt1I=; b=pbyIaDkkb08bkvSaWp97zTs8tueqDvFXNDY8977PIDq/EOthm2fAVfIx1cvU8gYFb3 EAwPa1IyQLv06T8n8QTlNtpg7nR6uk56YD1O1zP5QK6CCcHvItorvL3PXewWHRFGwtf1 bohk+NKr9B1IkXH6GEAAjW+Q23hMkBNN9aqvbmefIWzI2f1qWjxdfzEYUox9CWYxKRu5 jAku7y8vDOoccK27gj00Ujty6qooGKKaR42UeI/Ua2T9jMxuvWm0crRtjALUbqNw+DMc EctzeLz8ZL2suC+YGFwYXKV+OnJxRv5dVmC+NlU+0niTzc7UNiJ62KVMH3v/sIX2888y pVqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792000479; x=1792605279; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=A11ELgzrLJMDPQP6jv4hsgi3W8J+7I8K+Xp7zfgIt1I=; b=SrxSVu2p8oWeEpFIvQeXa0DuH5GFzCbVi/sV7ViRtVKKq9GzuaZ7I8ICTcnr5njvhU 7jpeytLjgF6KnT7SF9qJ8Vwzf2aOEQKvTz8KKe3STvlRTlZekZOzw2bOntrPFVPbSiim v4VZMSRQgyFeU6YwJ5iGULlbMg+kJIW2SfNm40xM4dLp3zTWQCkY+uP2AdYUr+8JuhES MMHvnA4+vw5r4/nXMu0+YLTzxeb6a48BsgTp9Uq7OALKqlHr7KtEL4WnWyv7IW9QZF3+ mdL0QbgzYVwZwvew3ezyBoUPHLFNJX+8uEyZLmH0bSD6jYSK3JRT2n5eVoV5yjA8seAD ZCNg== X-Forwarded-Encrypted: i=1; AKwUvBwoDLy1XY9etxEb3FUne2KjtI0oslGaYUlGxFLv6/mm/BrrKJl9I6KZVxYg2Z9Nnc6i8GT8266/Qj9axg4=@vger.kernel.org X-Gm-Message-State: AFq9FYKyBST5DtvpiaGZOFh09aEWGU9P/9P3rDwXTmugjbJw7H91jq+u CU1aU4iLBPW3JADiNAEs/pNec84uamJT3jmk+01l54HqqeQXe7ZHf0S+Eb7sR2R7FhM= X-Gm-Gg: AYBFou0xUVqe61wPD3e5zlDjk1qgyLvVl6U4+zFDSlyr+95UuPSJKqajpywSC509wlt U0hTUdJLP9iZuVvyty3hFKEYjsrPY6yTD6mReQWFtE6jaUkk5sVU7t2ZmbLUu4WwJZfuarb/A9A SA1w8NIiPbOxvO+ZsDzmtDGVkvDQPwXnBnnuTJrdLls+P1776q7KwxjRkluqL7WAmWdaqro8ytm ooi5nx26CTOvTqc0zfbEkVHTAPiLgOF15SpnJxyh7gfiiavkumZmyaP6fo8brD8/WTfAjuAr6FR o59wgybCQoHmbwawuw6SzuLun+CPaO8DQNvKI8FD5gORFQTNTeWrCJ988izYIaVAeGTuSwQjhFQ 7wawbLTLYuUq5iGOhbZlM53N91ygPA8Hs/eA/YWzZpobcxybvCCsvmBF/7CtXZLQDReq9Ed6slq 9w5eTry9p55Sv57bIDNoaMjv5VKf4z2InBlDVXWFn5rt+OmsVqGWWL4oAkHbnJssZeWU6mbwkOA VDvgAXSd9HJkfeoMIFx1dtZySTvl9F3yZbVcErdP/+4CHzBSpI= X-Received: by 2002:a05:600c:620f:b0:49f:dc71:e609 with SMTP id 5b1f17b1804b1-4a18e499874mr312463525e9.20.1792000478126; Wed, 14 Oct 2026 10:54:38 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4a1bd986095sm8188395e9.7.2026.10.14.10.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 10:54:37 -0700 (PDT) From: Dave Stevenson Date: Wed, 14 Oct 2026 18:54:30 +0100 Subject: [PATCH v3 09/14] media: sony-starvis2: Add support for IMX662 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261014-media-starvis2-v3-9-c958362b5d06@raspberrypi.com> References: <20261014-media-starvis2-v3-0-c958362b5d06@raspberrypi.com> In-Reply-To: <20261014-media-starvis2-v3-0-c958362b5d06@raspberrypi.com> To: Sakari Ailus , Jai Luthra , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Laurent Pinchart , Alexander Shiyan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 IMX662 is a 1080p Starvis 2 sensor that follows the same programming pattern as IMX678, so add it to the newly parameterised common driver. Signed-off-by: Dave Stevenson --- drivers/media/i2c/sony-starvis2.c | 155 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c index 4fade8671bb5..2bba3217cb04 100644 --- a/drivers/media/i2c/sony-starvis2.c +++ b/drivers/media/i2c/sony-starvis2.c @@ -8,6 +8,8 @@ * Currently supported are: * IMX678: Diagonal 8.86 mm (Type 1/1.8) CMOS image sensor with 8.40 M effective * pixels. + * IMX662: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective + * pixels. * * Copyright (C) 2026 Ideas On Board Oy. * @@ -661,6 +663,136 @@ const struct starvis2_variant imx678_variant_def = { .hmax_min_pixel_array = 550, }; +static const struct cci_reg_sequence imx662_common_regs[] = { + { CCI_REG8(0x3444), 0xac }, + { CCI_REG8(0x3492), 0x08 }, + { CCI_REG8(0x3b00), 0x39 }, + { CCI_REG8(0x3b23), 0x2d }, + { CCI_REG8(0x3b45), 0x04 }, + { CCI_REG8(0x3c0a), 0x1f }, + { CCI_REG8(0x3c0b), 0x1e }, + { CCI_REG8(0x3c38), 0x21 }, + { CCI_REG8(0x3c44), 0x00 }, + { CCI_REG8(0x3cb6), 0xd8 }, + { CCI_REG8(0x3cc4), 0xda }, + { CCI_REG8(0x3e24), 0x79 }, + { CCI_REG8(0x3e2c), 0x15 }, + { CCI_REG8(0x3edc), 0x2d }, + { CCI_REG8(0x4498), 0x05 }, + { CCI_REG8(0x449c), 0x19 }, + { CCI_REG8(0x449d), 0x00 }, + { CCI_REG8(0x449e), 0x32 }, + { CCI_REG8(0x449f), 0x01 }, + { CCI_REG8(0x44a0), 0x92 }, + { CCI_REG8(0x44a2), 0x91 }, + { CCI_REG8(0x44a4), 0x8c }, + { CCI_REG8(0x44a6), 0x87 }, + { CCI_REG8(0x44a8), 0x82 }, + { CCI_REG8(0x44aa), 0x78 }, + { CCI_REG8(0x44ac), 0x6e }, + { CCI_REG8(0x44ae), 0x69 }, + { CCI_REG8(0x44b0), 0x92 }, + { CCI_REG8(0x44b2), 0x91 }, + { CCI_REG8(0x44b4), 0x8c }, + { CCI_REG8(0x44b6), 0x87 }, + { CCI_REG8(0x44b8), 0x82 }, + { CCI_REG8(0x44ba), 0x78 }, + { CCI_REG8(0x44bc), 0x6e }, + { CCI_REG8(0x44be), 0x69 }, + { CCI_REG8(0x44c0), 0x7f }, + { CCI_REG8(0x44c1), 0x01 }, + { CCI_REG8(0x44c2), 0x7f }, + { CCI_REG8(0x44c3), 0x01 }, + { CCI_REG8(0x44c4), 0x7a }, + { CCI_REG8(0x44c5), 0x01 }, + { CCI_REG8(0x44c6), 0x7a }, + { CCI_REG8(0x44c7), 0x01 }, + { CCI_REG8(0x44c8), 0x70 }, + { CCI_REG8(0x44c9), 0x01 }, + { CCI_REG8(0x44ca), 0x6b }, + { CCI_REG8(0x44cb), 0x01 }, + { CCI_REG8(0x44cc), 0x6b }, + { CCI_REG8(0x44cd), 0x01 }, + { CCI_REG8(0x44ce), 0x5c }, + { CCI_REG8(0x44cf), 0x01 }, + { CCI_REG8(0x44d0), 0x7f }, + { CCI_REG8(0x44d1), 0x01 }, + { CCI_REG8(0x44d2), 0x7f }, + { CCI_REG8(0x44d3), 0x01 }, + { CCI_REG8(0x44d4), 0x7a }, + { CCI_REG8(0x44d5), 0x01 }, + { CCI_REG8(0x44d6), 0x7a }, + { CCI_REG8(0x44d7), 0x01 }, + { CCI_REG8(0x44d8), 0x70 }, + { CCI_REG8(0x44d9), 0x01 }, + { CCI_REG8(0x44da), 0x6b }, + { CCI_REG8(0x44db), 0x01 }, + { CCI_REG8(0x44dc), 0x6b }, + { CCI_REG8(0x44dd), 0x01 }, + { CCI_REG8(0x44de), 0x5c }, + { CCI_REG8(0x44df), 0x01 }, + { CCI_REG8(0x4534), 0x1c }, + { CCI_REG8(0x4535), 0x03 }, + { CCI_REG8(0x4538), 0x1c }, + { CCI_REG8(0x4539), 0x1c }, + { CCI_REG8(0x453a), 0x1c }, + { CCI_REG8(0x453b), 0x1c }, + { CCI_REG8(0x453c), 0x1c }, + { CCI_REG8(0x453d), 0x1c }, + { CCI_REG8(0x453e), 0x1c }, + { CCI_REG8(0x453f), 0x1c }, + { CCI_REG8(0x4540), 0x1c }, + { CCI_REG8(0x4541), 0x03 }, + { CCI_REG8(0x4542), 0x03 }, + { CCI_REG8(0x4543), 0x03 }, + { CCI_REG8(0x4544), 0x03 }, + { CCI_REG8(0x4545), 0x03 }, + { CCI_REG8(0x4546), 0x03 }, + { CCI_REG8(0x4547), 0x03 }, + { CCI_REG8(0x4548), 0x03 }, + { CCI_REG8(0x4549), 0x03 }, + { STARVIS2_REG_WDMODE, 0x00 }, + { STARVIS2_REG_MDBIT, 0x01 }, + { STARVIS2_REG_XXS_DRV, 0x00 }, +}; + +static const u16 imx662_min_hmax_2lane[] = { + [STARVIS2_LINK_FREQ_297MHZ] = 1980, + [STARVIS2_LINK_FREQ_360MHZ] = 1980, + [STARVIS2_LINK_FREQ_445MHZ] = 1188, + [STARVIS2_LINK_FREQ_594MHZ] = 990, + [STARVIS2_LINK_FREQ_720MHZ] = 990, + [STARVIS2_LINK_FREQ_891MHZ] = 990, + [STARVIS2_LINK_FREQ_1039MHZ] = 990, + [STARVIS2_LINK_FREQ_1188MHZ] = 990, +}; + +const struct starvis2_variant imx662_variant_def = { + .name = "imx662", + .id_reg = CCI_REG16_LE(0x4d1c), + .id_mask = 0x3ff, + .id_value = 0x296, + .native_area = { + .top = 0, + .left = 0, + .width = 1937, + .height = 1101, + }, + .active_area = { + .top = 0, + .left = 0, + .width = 1936, + .height = 1096, + }, + .pixel_rate = 222750000, + .pix_per_clk = 3, + .common_regs = imx662_common_regs, + .num_common_regs = ARRAY_SIZE(imx662_common_regs), + .vmax_default = 1136, + .hmax_min_link_freq = imx662_min_hmax_2lane, + .hmax_min_pixel_array = 990, +}; + struct starvis2_model_info { enum starvis2_type type; const u32 *codes; @@ -691,6 +823,26 @@ static const struct starvis2_model_info imx678_autodetect_info = { .auto_detect_mono = &imx678_aamr_info, }; +static const struct starvis2_model_info imx662_aaqr_info = { + .type = STARVIS2_COLOR, + .codes = codes_bayer, + .num_codes = ARRAY_SIZE(codes_bayer), + .variant = &imx662_variant_def, +}; + +static const struct starvis2_model_info imx662_aamr_info = { + .type = STARVIS2_MONOCHROME, + .codes = codes_monochrome, + .num_codes = ARRAY_SIZE(codes_monochrome), + .variant = &imx662_variant_def, +}; + +static const struct starvis2_model_info imx662_autodetect_info = { + .variant = &imx662_variant_def, + .auto_detect_colour = &imx662_aaqr_info, + .auto_detect_mono = &imx662_aamr_info, +}; + static const char * const starvis2_supply_name[] = { "avdd", /* Analog (3.3V) supply */ "dvdd", /* Digital Core (1.1V) supply */ @@ -1518,9 +1670,12 @@ static const struct dev_pm_ops starvis2_pm_ops = { }; static const struct of_device_id starvis2_of_match[] = { + { .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info }, + { .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info }, { .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info }, { .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info }, /* for non-conforming DTs that rely on runtime check */ + { .compatible = "sony,imx662", .data = &imx662_autodetect_info }, { .compatible = "sony,imx678", .data = &imx678_autodetect_info }, { /* sentinel */ } }; -- 2.34.1