From patchwork Mon Mar 17 00:39:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018559 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 86BA0EED8 for ; Mon, 17 Mar 2025 00:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171984; cv=none; b=SMQJwsv6PB0hxpSEaANqB0lXyn+8BrmypXRf5Hy/8ecQD1Pzlk3UCCfh2kihAnKSXkpw7X4yXBP5hPwCX529r4u6wGl3v3HCZ6dZr1hWbGQ/CKHtOH1NWrTXQnfKrgn2Bm1kjfGbeqTljzY0/as1MwOSHYnnYkhfCq6YnPqWVl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171984; c=relaxed/simple; bh=LNaAkzEltZLxOUbOqbFu9FNibqscZviTnVjPzj8sR4E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b5Ri0mV0YVXS29rrie89GOHyEwfUYOO9K+eQQdcgmRSP2OzIaPF3SC6rxU+vFVrJ6JI0j0GfNsGvcRyX85Ux0s7dwj7sg6VB3xX31O3mmfp4mOgEWigRDy2FmWJ9AI47MZcacXJ+PJ2lAdHVSqWh0QpEaHSPRHZSsF85UMxFUf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LODKKn6K; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LODKKn6K" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aaf0f1adef8so207293266b.3 for ; Sun, 16 Mar 2025 17:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171980; x=1742776780; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ihwPD3UMc4J97W1CrIubuAYVRcrzaarmeWo517AInDE=; b=LODKKn6K9eCuglMQv1zVVvHBz1znx+2ySLJgzhEdD+toCGbmg6Sfx4zU+GBUBe9GEm XiXQxg8Tk3oAbmWU5S0/g1dkL6R9hjCa041byrzeeoPUEaXXHtBAR6Zx4Od0x+8KgGgN FlubSkqMfI5Rd3rvCNF8uXSeS8DZlW6nc3iUPIJHqwzI6Rs+E5+CUGCyKpJpOwoH9Ko4 lxkQK/+HMZfFWNuZp0pBuDGbNzupmX0xLpPAJkMJRtW/sLXfr6vlHR9jub3UsYBo4Q2Q wvKGWek/6m9X0qdbXkeVP+ltlbqezTKDuy5WoN/zssAf8axgHnph/0y4W5FAs6mOS22H IAJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171980; x=1742776780; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ihwPD3UMc4J97W1CrIubuAYVRcrzaarmeWo517AInDE=; b=gXTT/s6M8Crq3uXJ5zb58DgTmKz21xci3m4EKDPanHx94F0nLMQfZC9a7sxmOqs8bD F7kr29OsvM28jc2CBfEGWh/9Oe2/mwehru7f/mZp/+yC3jZ/YPz2a4pplgE1aBLEYRUe i2F7MZ2aClAdGWbfezJukcRo5Ft45gU7Fr8FPXjft0yz2puHqWed2J1J2Pz7l6wGprc/ JQ5+6GIjaRH7KG7doeShvpjGVjrEz1QD4tO2SkwCi/byp8qGZ5eAIb6kKvdyqcmzYh7B q06vMNrQkj7njaTWyS0mAXATlWCL7nlBD+WVFPzK42NALlgDW4W34xpbcjx/XSigFP4q 0kaw== X-Forwarded-Encrypted: i=1; AJvYcCUEOADiBWa38Txdzyc+vYrIdUCWrx1PytdC0uJqT3hCRfVP2lB1klgnU1UMt6ZE+TwDeC/lxHsWNNjpvQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yz39/WHNxbVBpYHhOjO8Bos3chYCH3d+f0YsVex3PIoaBuVBiWO H5sJGlHtG1al9CQuD3JPSO5vW8+GcbuGtDoabB4s0xXinuLKUFDcMYMGQ7AFhgA= X-Gm-Gg: ASbGncuXCuxGUPWy95wHLvCmjqi8pR92Mfmfk3ja8Fp7ORpqelmigKGWAUIzWFjIs+V vgNxjmDZSDZ9I/3bc+WdkQEdXTZTn76KC0urnRtwAHzx53YiMYhbf9AfItxoAir8j/xeF4SNvOD thSLcwhzUizyWBMN5w9lJzzYgt6SdZQu5JYJN8PZkV+XrslL06YWPE6fELbb80vMO19gyWOAvRV ga+dq+Hvr2GUIIF/sFDi06NsAiKZLp2/DCCImEHRKXxJ7rc3kpC2gVY5WsyTS1bnm+oVBfYghjL 6sZDWH/w6rfBFgtcsifWjTpQnt9u1nW1g1XdYCFRpJU6NqN6ndmmFsHEDozccySj+CWcJd83wkT x87RQSmDK22VS5/owNT5BT5S7ewodzRKMWAUTjQzjhUcK0qtP2JsZpqTQ9+LlSpNUoctp X-Google-Smtp-Source: AGHT+IE0OpVCIFv22B4bWrLXG3KIuV47aR4P9f6EwKgo1+B4sxrYAEkQVg1rvg7xp/ohDKUmIE9O2g== X-Received: by 2002:a17:907:2d89:b0:ac2:fa32:f3 with SMTP id a640c23a62f3a-ac330506270mr1224633366b.52.1742171979711; Sun, 16 Mar 2025 17:39:39 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:38 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:33 +0000 Subject: [PATCH 1/8] media: i2c: add OV02E10 image sensor driver Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-1-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 From: Jingjing Xiong Add in the ov02e10 driver from the Intel IPU6 repository. Signed-off-by: Jingjing Xiong Co-developed-by: Hao Yao Signed-off-by: Hao Yao Co-developed-by: Jim Lai Signed-off-by: Jim Lai Co-developed-by: You-Sheng Yang Signed-off-by: You-Sheng Yang Co-developed-by: Alan Stern Signed-off-by: Alan Stern Co-developed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/Kconfig | 10 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ov02e10.c | 975 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 986 insertions(+) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index e576b213084d232e90b7e556a7a855a3bb95544c..7b8af1c87a0e40c19ef8ddb9a8603a1962877163 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -356,6 +356,16 @@ config VIDEO_OV02A10 To compile this driver as a module, choose M here: the module will be called ov02a10. +config VIDEO_OV02E10 + tristate "OmniVision OV02E10 sensor support" + select V4L2_CCI_I2C + help + This is a Video4Linux2 sensor driver for the OmniVision + OV02E10 camera. + + To compile this driver as a module, choose M here: the + module will be called ov02e10. + config VIDEO_OV08D10 tristate "OmniVision OV08D10 sensor support" help diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 6c23a4463527cf762032df663bbfe26be29018c8..ed5e62fd6199d8c0ab0d3104fd353243021a11be 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -83,6 +83,7 @@ obj-$(CONFIG_VIDEO_MT9V111) += mt9v111.o obj-$(CONFIG_VIDEO_OG01A1B) += og01a1b.o obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o obj-$(CONFIG_VIDEO_OV02A10) += ov02a10.o +obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o obj-$(CONFIG_VIDEO_OV08D10) += ov08d10.o obj-$(CONFIG_VIDEO_OV08X40) += ov08x40.o obj-$(CONFIG_VIDEO_OV13858) += ov13858.o diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c new file mode 100644 index 0000000000000000000000000000000000000000..8c4455b3643307be5b1e8110979740a7e843c146 --- /dev/null +++ b/drivers/media/i2c/ov02e10.c @@ -0,0 +1,975 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2023 Intel Corporation. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OV02E10_LINK_FREQ_360MHZ 360000000ULL +#define OV02E10_SCLK 36000000LL +#define OV02E10_MCLK 19200000 +#define OV02E10_DATA_LANES 2 +#define OV02E10_RGB_DEPTH 10 + +#define OV02E10_REG_PAGE_FLAG CCI_REG8(0xfd) +#define OV02E10_PAGE_0 0x0 +#define OV02E10_PAGE_1 0x1 +#define OV02E10_PAGE_2 0x2 +#define OV02E10_PAGE_3 0x3 +#define OV02E10_PAGE_5 0x4 +#define OV02E10_PAGE_7 0x5 +#define OV02E10_PAGE_8 0x6 +#define OV02E10_PAGE_9 0xF +#define OV02E10_PAGE_D 0x8 +#define OV02E10_PAGE_E 0x9 +#define OV02E10_PAGE_F 0xA + +#define OV02E10_REG_CHIP_ID CCI_REG32(0x00) +#define OV02E10_CHIP_ID 0x45025610 + +/* vertical-timings from sensor */ +#define OV02E10_REG_VTS CCI_REG16(0x35) +#define OV02E10_VTS_DEF 2244 +#define OV02E10_VTS_MIN 2244 +#define OV02E10_VTS_MAX 0x7fff + +/* horizontal-timings from sensor */ +#define OV02E10_REG_HTS CCI_REG16(0x37) + +/* Exposure controls from sensor */ +#define OV02E10_REG_EXPOSURE CCI_REG16(0x03) +#define OV02E10_EXPOSURE_MIN 1 +#define OV02E10_EXPOSURE_MAX_MARGIN 2 +#define OV02E10_EXPOSURE_STEP 1 + +/* Analog gain controls from sensor */ +#define OV02E10_REG_ANALOG_GAIN CCI_REG8(0x24) +#define OV02E10_ANAL_GAIN_MIN 0x10 +#define OV02E10_ANAL_GAIN_MAX 0xf8 +#define OV02E10_ANAL_GAIN_STEP 1 + +/* Digital gain controls from sensor */ +#define OV02E10_REG_DIGITAL_GAIN CCI_REG16(0x21) +#define OV02E10_DGTL_GAIN_MIN 256 +#define OV02E10_DGTL_GAIN_MAX 1020 +#define OV02E10_DGTL_GAIN_STEP 1 +#define OV02E10_DGTL_GAIN_DEFAULT 256 + +/* Register update control */ +#define OV02E10_REG_COMMAND_UPDATE CCI_REG8(0xE7) +#define OV02E10_COMMAND_UPDATE 0x00 +#define OV02E10_COMMAND_HOLD 0x01 + +/* Test Pattern Control */ +#define OV02E10_REG_TEST_PATTERN CCI_REG8(0x12) +#define OV02E10_TEST_PATTERN_ENABLE BIT(0) +#define OV02E10_TEST_PATTERN_BAR_SHIFT 1 + +enum { + OV02E10_LINK_FREQ_360MHZ_INDEX, +}; + +struct reg_sequence_list { + u32 num_regs; + const struct reg_sequence *regs; +}; + +struct ov02e10_mode { + /* Frame width in pixels */ + u32 width; + + /* Frame height in pixels */ + u32 height; + + /* Horizontal timining size */ + u32 hts; + + /* Default vertical timining size */ + u32 vts_def; + + /* Min vertical timining size */ + u32 vts_min; + + /* Link frequency needed for this resolution */ + u32 link_freq_index; + + /* Sensor register settings for this resolution */ + const struct reg_sequence_list reg_list; +}; + +static const struct reg_sequence mode_1928x1088_30fps_2lane[] = { + { 0xfd, 0x00 }, + { 0x20, 0x00 }, + { 0x20, 0x0b }, + { 0x21, 0x02 }, + { 0x10, 0x23 }, + { 0xc5, 0x04 }, + { 0x21, 0x00 }, + { 0x14, 0x96 }, + { 0x17, 0x01 }, + { 0xfd, 0x01 }, + { 0x03, 0x00 }, + { 0x04, 0x04 }, + { 0x05, 0x04 }, + { 0x06, 0x62 }, + { 0x07, 0x01 }, + { 0x22, 0x80 }, + { 0x24, 0xff }, + { 0x40, 0xc6 }, + { 0x41, 0x18 }, + { 0x45, 0x3f }, + { 0x48, 0x0c }, + { 0x4c, 0x08 }, + { 0x51, 0x12 }, + { 0x52, 0x10 }, + { 0x57, 0x98 }, + { 0x59, 0x06 }, + { 0x5a, 0x04 }, + { 0x5c, 0x38 }, + { 0x5e, 0x10 }, + { 0x67, 0x11 }, + { 0x7b, 0x04 }, + { 0x81, 0x12 }, + { 0x90, 0x51 }, + { 0x91, 0x09 }, + { 0x92, 0x21 }, + { 0x93, 0x28 }, + { 0x95, 0x54 }, + { 0x9d, 0x20 }, + { 0x9e, 0x04 }, + { 0xb1, 0x9a }, + { 0xb2, 0x86 }, + { 0xb6, 0x3f }, + { 0xb9, 0x30 }, + { 0xc1, 0x01 }, + { 0xc5, 0xa0 }, + { 0xc6, 0x73 }, + { 0xc7, 0x04 }, + { 0xc8, 0x25 }, + { 0xc9, 0x05 }, + { 0xca, 0x28 }, + { 0xcb, 0x00 }, + { 0xcf, 0x16 }, + { 0xd2, 0xd0 }, + { 0xd7, 0x3f }, + { 0xd8, 0x40 }, + { 0xd9, 0x40 }, + { 0xda, 0x44 }, + { 0xdb, 0x3d }, + { 0xdc, 0x3d }, + { 0xdd, 0x3d }, + { 0xde, 0x3d }, + { 0xdf, 0xf0 }, + { 0xea, 0x0f }, + { 0xeb, 0x04 }, + { 0xec, 0x29 }, + { 0xee, 0x47 }, + { 0xfd, 0x01 }, + { 0x31, 0x01 }, + { 0x27, 0x00 }, + { 0x2f, 0x41 }, + { 0xfd, 0x02 }, + { 0xa1, 0x01 }, + { 0xfd, 0x02 }, + { 0x9a, 0x03 }, + { 0xfd, 0x03 }, + { 0x9d, 0x0f }, + { 0xfd, 0x07 }, + { 0x42, 0x00 }, + { 0x43, 0xad }, + { 0x44, 0x00 }, + { 0x45, 0xa8 }, + { 0x46, 0x00 }, + { 0x47, 0xa8 }, + { 0x48, 0x00 }, + { 0x49, 0xad }, + { 0xfd, 0x00 }, + { 0xc4, 0x01 }, + { 0xfd, 0x01 }, + { 0x33, 0x03 }, + { 0xfd, 0x00 }, + { 0x20, 0x1f }, +}; + +static const char *const ov02e10_test_pattern_menu[] = { + "Disabled", + "Color Bar", +}; + +static const s64 link_freq_menu_items[] = { + OV02E10_LINK_FREQ_360MHZ, +}; + +static const struct ov02e10_mode supported_modes[] = { + { + .width = 1928, + .height = 1088, + .hts = 534, + .vts_def = 2244, + .vts_min = 2244, + .reg_list = { + .num_regs = ARRAY_SIZE(mode_1928x1088_30fps_2lane), + .regs = mode_1928x1088_30fps_2lane, + }, + + .link_freq_index = OV02E10_LINK_FREQ_360MHZ_INDEX, + }, +}; + +struct ov02e10 { + struct regmap *regmap; + struct v4l2_subdev sd; + struct media_pad pad; + struct v4l2_ctrl_handler ctrl_handler; + + /* V4L2 Controls */ + struct v4l2_ctrl *link_freq; + struct v4l2_ctrl *pixel_rate; + struct v4l2_ctrl *vblank; + struct v4l2_ctrl *hblank; + struct v4l2_ctrl *exposure; + + struct clk *img_clk; + struct regulator *avdd; + struct gpio_desc *reset; + struct gpio_desc *handshake; + + /* Current mode */ + const struct ov02e10_mode *cur_mode; + + /* To serialize asynchronus callbacks */ + struct mutex mutex; + + /* Streaming on/off */ + bool streaming; +}; + +static inline struct ov02e10 *to_ov02e10(struct v4l2_subdev *subdev) +{ + return container_of(subdev, struct ov02e10, sd); +} + +static u64 to_pixel_rate(u32 f_index) +{ + u64 pixel_rate = link_freq_menu_items[f_index] * 2 * OV02E10_DATA_LANES; + + do_div(pixel_rate, OV02E10_RGB_DEPTH); + + return pixel_rate; +} + +static u64 to_pixels_per_line(u32 hts, u32 f_index) +{ + u64 ppl = hts * to_pixel_rate(f_index); + + do_div(ppl, OV02E10_SCLK); + + return ppl; +} + +static void ov02e10_test_pattern(struct ov02e10 *ov02e10, u32 pattern, int *pret) +{ + if (pattern) + pattern = pattern << OV02E10_TEST_PATTERN_BAR_SHIFT | + OV02E10_TEST_PATTERN_ENABLE; + + cci_write(ov02e10->regmap, OV02E10_REG_TEST_PATTERN, pattern, pret); +} + +static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) +{ + struct ov02e10 *ov02e10 = container_of(ctrl->handler, + struct ov02e10, ctrl_handler); + struct i2c_client *client = v4l2_get_subdevdata(&ov02e10->sd); + s64 exposure_max; + int ret; + + /* Propagate change of current control to all related controls */ + if (ctrl->id == V4L2_CID_VBLANK) { + /* Update max exposure while meeting expected vblanking */ + exposure_max = ov02e10->cur_mode->height + ctrl->val - + OV02E10_EXPOSURE_MAX_MARGIN; + __v4l2_ctrl_modify_range(ov02e10->exposure, + ov02e10->exposure->minimum, + exposure_max, ov02e10->exposure->step, + exposure_max); + } + + /* V4L2 controls values will be applied only when power is already up */ + if (!pm_runtime_get_if_in_use(&client->dev)) + return 0; + ret = cci_write(ov02e10->regmap, OV02E10_REG_COMMAND_UPDATE, + OV02E10_COMMAND_HOLD, NULL); + + switch (ctrl->id) { + case V4L2_CID_ANALOGUE_GAIN: + dev_dbg(&client->dev, "set analog gain\n"); + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, + OV02E10_PAGE_1, &ret); + cci_write(ov02e10->regmap, OV02E10_REG_ANALOG_GAIN, + ctrl->val, &ret); + break; + + case V4L2_CID_DIGITAL_GAIN: + dev_dbg(&client->dev, "set digital gain\n"); + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, + OV02E10_PAGE_1, &ret); + cci_write(ov02e10->regmap, OV02E10_REG_DIGITAL_GAIN, + ctrl->val, &ret); + break; + + case V4L2_CID_EXPOSURE: + dev_dbg(&client->dev, "set exposure\n"); + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, + OV02E10_PAGE_1, &ret); + cci_write(ov02e10->regmap, OV02E10_REG_EXPOSURE, + ctrl->val, &ret); + break; + + case V4L2_CID_VBLANK: + dev_dbg(&client->dev, "set vblank\n"); + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, + OV02E10_PAGE_1, &ret); + cci_write(ov02e10->regmap, OV02E10_REG_VTS, + ov02e10->cur_mode->height + ctrl->val, &ret); + break; + + case V4L2_CID_TEST_PATTERN: + dev_dbg(&client->dev, "set test pattern\n"); + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, + OV02E10_PAGE_1, &ret); + ov02e10_test_pattern(ov02e10, ctrl->val, &ret); + break; + + default: + ret = -EINVAL; + break; + } + dev_dbg(&client->dev, "will update cmd\n"); + cci_write(ov02e10->regmap, OV02E10_REG_COMMAND_UPDATE, + OV02E10_COMMAND_UPDATE, &ret); + + pm_runtime_put(&client->dev); + + return ret; +} + +static const struct v4l2_ctrl_ops ov02e10_ctrl_ops = { + .s_ctrl = ov02e10_set_ctrl, +}; + +static int ov02e10_init_controls(struct ov02e10 *ov02e10) +{ + struct v4l2_ctrl_handler *ctrl_hdlr; + const struct ov02e10_mode *cur_mode; + s64 exposure_max, h_blank, pixel_rate; + u32 vblank_min, vblank_max, vblank_default; + int size; + int ret; + + ctrl_hdlr = &ov02e10->ctrl_handler; + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8); + + if (ret) + return ret; + + ctrl_hdlr->lock = &ov02e10->mutex; + cur_mode = ov02e10->cur_mode; + size = ARRAY_SIZE(link_freq_menu_items); + + ov02e10->link_freq = + v4l2_ctrl_new_int_menu(ctrl_hdlr, &ov02e10_ctrl_ops, + V4L2_CID_LINK_FREQ, size - 1, 0, + link_freq_menu_items); + if (ov02e10->link_freq) + ov02e10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; + + pixel_rate = to_pixel_rate(OV02E10_LINK_FREQ_360MHZ_INDEX); + ov02e10->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops, + V4L2_CID_PIXEL_RATE, 0, + pixel_rate, 1, pixel_rate); + + vblank_min = cur_mode->vts_min - cur_mode->height; + vblank_max = OV02E10_VTS_MAX - cur_mode->height; + vblank_default = cur_mode->vts_def - cur_mode->height; + ov02e10->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops, + V4L2_CID_VBLANK, vblank_min, + vblank_max, 1, vblank_default); + + h_blank = to_pixels_per_line(cur_mode->hts, cur_mode->link_freq_index); + h_blank -= cur_mode->width; + ov02e10->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops, + V4L2_CID_HBLANK, h_blank, h_blank, + 1, h_blank); + if (ov02e10->hblank) + ov02e10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; + + v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops, V4L2_CID_ANALOGUE_GAIN, + OV02E10_ANAL_GAIN_MIN, OV02E10_ANAL_GAIN_MAX, + OV02E10_ANAL_GAIN_STEP, OV02E10_ANAL_GAIN_MIN); + v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops, V4L2_CID_DIGITAL_GAIN, + OV02E10_DGTL_GAIN_MIN, OV02E10_DGTL_GAIN_MAX, + OV02E10_DGTL_GAIN_STEP, OV02E10_DGTL_GAIN_DEFAULT); + exposure_max = cur_mode->vts_def - OV02E10_EXPOSURE_MAX_MARGIN; + ov02e10->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops, + V4L2_CID_EXPOSURE, + OV02E10_EXPOSURE_MIN, + exposure_max, + OV02E10_EXPOSURE_STEP, + exposure_max); + v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &ov02e10_ctrl_ops, + V4L2_CID_TEST_PATTERN, + ARRAY_SIZE(ov02e10_test_pattern_menu) - 1, + 0, 0, ov02e10_test_pattern_menu); + if (ctrl_hdlr->error) + return ctrl_hdlr->error; + + ov02e10->sd.ctrl_handler = ctrl_hdlr; + + return 0; +} + +static void ov02e10_update_pad_format(const struct ov02e10_mode *mode, + struct v4l2_mbus_framefmt *fmt) +{ + fmt->width = mode->width; + fmt->height = mode->height; + fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; + fmt->field = V4L2_FIELD_NONE; +} + +static int ov02e10_set_stream_mode(struct ov02e10 *ov02e10, u8 val) +{ + int ret = 0; + + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_0, &ret); + cci_write(ov02e10->regmap, CCI_REG8(0xa0), val, &ret); + cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_1, &ret); + cci_write(ov02e10->regmap, CCI_REG8(0x01), 0x02, &ret); + + return ret; +} + +static int ov02e10_start_streaming(struct ov02e10 *ov02e10) +{ + struct i2c_client *client = v4l2_get_subdevdata(&ov02e10->sd); + const struct reg_sequence_list *reg_list; + int ret; + + reg_list = &ov02e10->cur_mode->reg_list; + ret = regmap_multi_reg_write(ov02e10->regmap, reg_list->regs, + reg_list->num_regs); + if (ret) { + dev_err(&client->dev, "failed to set mode\n"); + return ret; + } + ret = __v4l2_ctrl_handler_setup(ov02e10->sd.ctrl_handler); + if (ret) { + dev_err(&client->dev, "setup V4L2 ctrl handler fail\n"); + return ret; + } + + return ov02e10_set_stream_mode(ov02e10, 1); +} + +static inline void ov02e10_stop_streaming(struct ov02e10 *ov02e10) +{ + ov02e10_set_stream_mode(ov02e10, 0); +} + +static int ov02e10_set_stream(struct v4l2_subdev *sd, int enable) +{ + struct ov02e10 *ov02e10 = to_ov02e10(sd); + struct i2c_client *client = v4l2_get_subdevdata(sd); + int ret = 0; + + if (ov02e10->streaming == enable) + return 0; + + mutex_lock(&ov02e10->mutex); + if (enable) { + ret = pm_runtime_get_sync(&client->dev); + if (ret < 0) { + pm_runtime_put_noidle(&client->dev); + mutex_unlock(&ov02e10->mutex); + return ret; + } + + ret = ov02e10_start_streaming(ov02e10); + if (ret) { + dev_dbg(&client->dev, "start streaming failed\n"); + enable = 0; + ov02e10_stop_streaming(ov02e10); + pm_runtime_put(&client->dev); + } + } else { + ov02e10_stop_streaming(ov02e10); + pm_runtime_put(&client->dev); + } + + ov02e10->streaming = enable; + mutex_unlock(&ov02e10->mutex); + + return ret; +} + +/* This function tries to get power control resources */ +static int ov02e10_get_pm_resources(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov02e10 *ov02e10 = to_ov02e10(sd); + int ret; + + ov02e10->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(ov02e10->reset)) + return dev_err_probe(dev, PTR_ERR(ov02e10->reset), + "failed to get reset gpio\n"); + + ov02e10->handshake = devm_gpiod_get_optional(dev, "handshake", + GPIOD_OUT_LOW); + if (IS_ERR(ov02e10->handshake)) + return dev_err_probe(dev, PTR_ERR(ov02e10->handshake), + "failed to get handshake gpio\n"); + + ov02e10->img_clk = devm_clk_get_optional(dev, NULL); + if (IS_ERR(ov02e10->img_clk)) + return dev_err_probe(dev, PTR_ERR(ov02e10->img_clk), + "failed to get imaging clock\n"); + + ov02e10->avdd = devm_regulator_get_optional(dev, "avdd"); + if (IS_ERR(ov02e10->avdd)) { + ret = PTR_ERR(ov02e10->avdd); + ov02e10->avdd = NULL; + if (ret != -ENODEV) + return dev_err_probe(dev, ret, + "failed to get avdd regulator\n"); + } + + return 0; +} + +static int ov02e10_power_off(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov02e10 *ov02e10 = to_ov02e10(sd); + int ret = 0; + + gpiod_set_value_cansleep(ov02e10->reset, 1); + gpiod_set_value_cansleep(ov02e10->handshake, 0); + + if (ov02e10->avdd) + ret = regulator_disable(ov02e10->avdd); + + clk_disable_unprepare(ov02e10->img_clk); + + return ret; +} + +static int ov02e10_power_on(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov02e10 *ov02e10 = to_ov02e10(sd); + int ret; + + ret = clk_prepare_enable(ov02e10->img_clk); + if (ret < 0) { + dev_err(dev, "failed to enable imaging clock: %d\n", ret); + return ret; + } + + if (ov02e10->avdd) { + ret = regulator_enable(ov02e10->avdd); + if (ret < 0) { + dev_err(dev, "failed to enable avdd: %d\n", ret); + clk_disable_unprepare(ov02e10->img_clk); + return ret; + } + } + gpiod_set_value_cansleep(ov02e10->handshake, 1); + gpiod_set_value_cansleep(ov02e10->reset, 0); + + /* Lattice MIPI aggregator with some version FW needs longer delay + after handshake triggered. We set 25ms as a safe value and wait + for a stable version FW. */ + msleep_interruptible(25); + + return ret; +} + +static int __maybe_unused ov02e10_suspend(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov02e10 *ov02e10 = to_ov02e10(sd); + + mutex_lock(&ov02e10->mutex); + if (ov02e10->streaming) + ov02e10_stop_streaming(ov02e10); + + mutex_unlock(&ov02e10->mutex); + + return 0; +} + +static int __maybe_unused ov02e10_resume(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov02e10 *ov02e10 = to_ov02e10(sd); + int ret = 0; + + mutex_lock(&ov02e10->mutex); + if (!ov02e10->streaming) + goto exit; + + ret = ov02e10_start_streaming(ov02e10); + if (ret) { + ov02e10->streaming = false; + ov02e10_stop_streaming(ov02e10); + } + +exit: + mutex_unlock(&ov02e10->mutex); + return ret; +} + +static int ov02e10_set_format(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_format *fmt) +{ + struct ov02e10 *ov02e10 = to_ov02e10(sd); + const struct ov02e10_mode *mode; + s32 vblank_def, h_blank; + + mode = v4l2_find_nearest_size(supported_modes, + ARRAY_SIZE(supported_modes), + width, height, fmt->format.width, + fmt->format.height); + + mutex_lock(&ov02e10->mutex); + ov02e10_update_pad_format(mode, &fmt->format); + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { + *v4l2_subdev_state_get_format(sd_state, fmt->pad) = + fmt->format; + } else { + ov02e10->cur_mode = mode; + __v4l2_ctrl_s_ctrl(ov02e10->link_freq, mode->link_freq_index); + __v4l2_ctrl_s_ctrl_int64(ov02e10->pixel_rate, + to_pixel_rate(mode->link_freq_index)); + + /* Update limits and set FPS to default */ + vblank_def = mode->vts_def - mode->height; + __v4l2_ctrl_modify_range(ov02e10->vblank, + mode->vts_min - mode->height, + OV02E10_VTS_MAX - mode->height, 1, + vblank_def); + __v4l2_ctrl_s_ctrl(ov02e10->vblank, vblank_def); + h_blank = to_pixels_per_line(mode->hts, mode->link_freq_index) - + mode->width; + __v4l2_ctrl_modify_range(ov02e10->hblank, h_blank, h_blank, 1, + h_blank); + } + mutex_unlock(&ov02e10->mutex); + + return 0; +} + +static int ov02e10_get_format(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_format *fmt) +{ + struct ov02e10 *ov02e10 = to_ov02e10(sd); + + mutex_lock(&ov02e10->mutex); + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) + fmt->format = *v4l2_subdev_state_get_format(sd_state, fmt->pad); + else + ov02e10_update_pad_format(ov02e10->cur_mode, &fmt->format); + + mutex_unlock(&ov02e10->mutex); + + return 0; +} + +static int ov02e10_enum_mbus_code(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_mbus_code_enum *code) +{ + if (code->index > 0) + return -EINVAL; + + code->code = MEDIA_BUS_FMT_SGRBG10_1X10; + + return 0; +} + +static int ov02e10_enum_frame_size(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_frame_size_enum *fse) +{ + if (fse->index >= ARRAY_SIZE(supported_modes)) + return -EINVAL; + + if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) + return -EINVAL; + + fse->min_width = supported_modes[fse->index].width; + fse->max_width = fse->min_width; + fse->min_height = supported_modes[fse->index].height; + fse->max_height = fse->min_height; + + return 0; +} + +static int ov02e10_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +{ + struct ov02e10 *ov02e10 = to_ov02e10(sd); + + mutex_lock(&ov02e10->mutex); + ov02e10_update_pad_format(&supported_modes[0], + v4l2_subdev_state_get_format(fh->state, 0)); + mutex_unlock(&ov02e10->mutex); + + return 0; +} + +static const struct v4l2_subdev_video_ops ov02e10_video_ops = { + .s_stream = ov02e10_set_stream, +}; + +static const struct v4l2_subdev_pad_ops ov02e10_pad_ops = { + .set_fmt = ov02e10_set_format, + .get_fmt = ov02e10_get_format, + .enum_mbus_code = ov02e10_enum_mbus_code, + .enum_frame_size = ov02e10_enum_frame_size, +}; + +static const struct v4l2_subdev_ops ov02e10_subdev_ops = { + .video = &ov02e10_video_ops, + .pad = &ov02e10_pad_ops, +}; + +static const struct media_entity_operations ov02e10_subdev_entity_ops = { + .link_validate = v4l2_subdev_link_validate, +}; + +static const struct v4l2_subdev_internal_ops ov02e10_internal_ops = { + .open = ov02e10_open, +}; + +static int ov02e10_identify_module(struct ov02e10 *ov02e10) +{ + struct i2c_client *client = v4l2_get_subdevdata(&ov02e10->sd); + int ret; + u64 val; + + ret = cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, + OV02E10_PAGE_0, NULL); + cci_read(ov02e10->regmap, OV02E10_REG_CHIP_ID, &val, &ret); + if (ret) + return ret; + + if (val != OV02E10_CHIP_ID) { + dev_err(&client->dev, "chip id mismatch: %x!=%x\n", + OV02E10_CHIP_ID, (u32) val); + return -ENXIO; + } + + return 0; +} + +static int ov02e10_check_hwcfg(struct device *dev) +{ + struct v4l2_fwnode_endpoint bus_cfg = { + .bus_type = V4L2_MBUS_CSI2_DPHY + }; + struct fwnode_handle *ep; + struct fwnode_handle *fwnode = dev_fwnode(dev); + unsigned int i, j; + int ret; + u32 ext_clk; + + ep = fwnode_graph_get_next_endpoint(fwnode, NULL); + if (!ep) + return dev_err_probe(dev, -EPROBE_DEFER, + "waiting for fwnode graph endpoint\n"); + + ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); + fwnode_handle_put(ep); + if (ret) + return dev_err_probe(dev, ret, "parsing endpoint failed\n"); + + ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", + &ext_clk); + if (ret) { + dev_err(dev, "can't get clock frequency\n"); + goto out_err; + } + + if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV02E10_DATA_LANES) { + dev_err(dev, "number of CSI2 data lanes %d is not supported\n", + bus_cfg.bus.mipi_csi2.num_data_lanes); + ret = -EINVAL; + goto out_err; + } + + if (!bus_cfg.nr_of_link_frequencies) { + dev_err(dev, "no link frequencies defined\n"); + ret = -EINVAL; + goto out_err; + } + + for (i = 0; i < ARRAY_SIZE(link_freq_menu_items); i++) { + for (j = 0; j < bus_cfg.nr_of_link_frequencies; j++) { + if (link_freq_menu_items[i] == + bus_cfg.link_frequencies[j]) + break; + } + + if (j == bus_cfg.nr_of_link_frequencies) { + dev_err(dev, "no link frequency %lld supported\n", + link_freq_menu_items[i]); + ret = -EINVAL; + goto out_err; + } + } + +out_err: + v4l2_fwnode_endpoint_free(&bus_cfg); + + return ret; +} + +static void ov02e10_remove(struct i2c_client *client) +{ + struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct ov02e10 *ov02e10 = to_ov02e10(sd); + + v4l2_async_unregister_subdev(sd); + media_entity_cleanup(&sd->entity); + v4l2_ctrl_handler_free(sd->ctrl_handler); + pm_runtime_disable(&client->dev); + mutex_destroy(&ov02e10->mutex); +} + +static int ov02e10_probe(struct i2c_client *client) +{ + struct ov02e10 *ov02e; + int ret; + + /* Check HW config */ + ret = ov02e10_check_hwcfg(&client->dev); + if (ret) + return ret; + + ov02e = devm_kzalloc(&client->dev, sizeof(*ov02e), GFP_KERNEL); + if (!ov02e) + return -ENOMEM; + + /* Initialize subdev */ + ov02e->regmap = devm_cci_regmap_init_i2c(client, 8); + if (IS_ERR(ov02e->regmap)) + return PTR_ERR(ov02e->regmap); + + v4l2_i2c_subdev_init(&ov02e->sd, client, &ov02e10_subdev_ops); + ov02e10_get_pm_resources(&client->dev); + + ret = ov02e10_power_on(&client->dev); + if (ret) { + dev_err_probe(&client->dev, ret, "failed to power on\n"); + goto error_power_off; + } + + /* Check module identity */ + ret = ov02e10_identify_module(ov02e); + if (ret) { + dev_err(&client->dev, "failed to find sensor: %d\n", ret); + goto error_power_off; + } + + /* Set default mode to max resolution */ + ov02e->cur_mode = &supported_modes[0]; + + dev_dbg(&client->dev, "will Init controls\n"); + ret = ov02e10_init_controls(ov02e); + if (ret) + return ret; + + /* Initialize subdev */ + ov02e->sd.internal_ops = &ov02e10_internal_ops; + ov02e->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; + ov02e->sd.entity.ops = &ov02e10_subdev_entity_ops; + ov02e->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; + + /* Initialize source pad */ + ov02e->pad.flags = MEDIA_PAD_FL_SOURCE; + ret = media_entity_pads_init(&ov02e->sd.entity, 1, &ov02e->pad); + if (ret) { + dev_err(&client->dev, "%s failed:%d\n", __func__, ret); + goto error_handler_free; + } + + ret = v4l2_async_register_subdev_sensor(&ov02e->sd); + if (ret < 0) { + dev_err(&client->dev, "async reg subdev error\n"); + goto error_media_entity; + } + + /* + * Device is already turned on by i2c-core with ACPI domain PM. + * Enable runtime PM and turn off the device. + */ + pm_runtime_set_active(&client->dev); + pm_runtime_enable(&client->dev); + pm_runtime_idle(&client->dev); + + return 0; + +error_media_entity: + media_entity_cleanup(&ov02e->sd.entity); + +error_handler_free: + v4l2_ctrl_handler_free(ov02e->sd.ctrl_handler); + mutex_destroy(&ov02e->mutex); + dev_err(&client->dev, "%s failed:%d\n", __func__, ret); +error_power_off: + ov02e10_power_off(&client->dev); + + dev_dbg(&client->dev, "probe done\n"); + return ret; +} + +static const struct dev_pm_ops ov02e10_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(ov02e10_suspend, ov02e10_resume) + SET_RUNTIME_PM_OPS(ov02e10_power_off, ov02e10_power_on, NULL) +}; + +static const struct acpi_device_id ov02e10_acpi_ids[] = { + { "OVTI02E1" }, + { } +}; + +MODULE_DEVICE_TABLE(acpi, ov02e10_acpi_ids); + +static struct i2c_driver ov02e10_i2c_driver = { + .driver = { + .name = "ov02e10", + .pm = &ov02e10_pm_ops, + .acpi_match_table = ov02e10_acpi_ids, + }, + .probe = ov02e10_probe, + .remove = ov02e10_remove, +}; + +module_i2c_driver(ov02e10_i2c_driver); + +MODULE_AUTHOR("Jingjing Xiong "); +MODULE_DESCRIPTION("OmniVision OV02E10 sensor driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Mar 17 00:39:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018560 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 9A3F438F91 for ; Mon, 17 Mar 2025 00:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171985; cv=none; b=GvjbC9CGbrA28G+mQKiEjhYJqskr3+BHCfF0hSvr2KFARdvo/Kx6/4roispieljL8iD4glNsUMv0ZGEDjhFBRt4lMPgsBf9tCqgl5u3jrWq9J0jjBJZJFr8JqRlXFrq0s+bjXDh3+VPqXFRjNrJoC717WO1n5Ag1/AaKWaK1naA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171985; c=relaxed/simple; bh=3QrEKdTshQRi2xw4f5hCGvoDJjZMloAagBZBYMjysZ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a/7IJDAU/C171d+dYt6ME+TlKZYQ314f7m9vk919oTuHN3fI+qHaZGjDGTbpElahPDgxsRrQTw0nnPxKrQd6U9+RqS9tIEBt1/PrxVd9ysVy1HAMZ6iBm1TWckGdMl7jj4ZBlxJudmRvZ/CIVp9G7zsHj32zVvRsTPr1UFuKQd8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Zb+n8QMq; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Zb+n8QMq" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5e5491eb379so5818242a12.3 for ; Sun, 16 Mar 2025 17:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171982; x=1742776782; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NjMvwquUu5HvTpeV8tRi1qdeKCAJgZcm3OhYAciYMmY=; b=Zb+n8QMqtAJfUrnUn2Hf6aLcRH0Ofw2ocoAxBxX4OKkb9LnnkTPgYXLHTy2xSlpTun T9S4wXGOttRuHGWC6Mnh1CT9OtCn/hZxdSQ9wyvdJuiR9m2HsJzce/uDecBG+16jiFUf cE1DoBQe/a4xUgC2spdjUHJQHyJ5UjMFXtY7omNQ9XrTiBkMaaKoWg5T0uT07ysF4t1w s84pPNMTcbX2Dxz+nOxzGyEKoMaOCyf7e02ch4owRIJfBRxUntL37RI9dh85tqBJpBx7 TKJXw1Y8hZ9IrHt2xvkyWXFXjjd0o8TWhX3WvnyGgFHBTc8sp10sjFRXznhc7CyAOZbw rlJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171982; x=1742776782; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NjMvwquUu5HvTpeV8tRi1qdeKCAJgZcm3OhYAciYMmY=; b=Xt+ThWd4E91PExhu7aopwlHuP1ZzYt8uxVfCLrNALbv4mXrh1Fnvn0ClegKiU4Fvsg zTuBZDUp2GFscQV/982BrSkj17y0ggCz/fOTE58zaFM37DwJVqb9T6f79VasGyp1dplz BvF9Na8IIrmTfimgSkgkDj3QIJuV1r5xEOJnuvz2lHKbc14ZHagBzZcUWA5mrkvGJxvl GZyw4FmcXIIjj54I7eBKZxooNXbigiyA10CArcQBB7uhzAFp+MvfYHJCqOcUOasgsmlh c9a7DXRJWk/9aeLYnQ3CNa6LAqMklpH2dRU4p7wvCPH8mFLZFLtfcFtJgD5Vf2kE2g5i Tb2A== X-Forwarded-Encrypted: i=1; AJvYcCXgSdYugF5gb0KhVNTwexAwec1OlrsAM6szfCY0L3GDTIig4L9n/K8WRVqNf38k+S1J85ccvi5wuOxiGg==@vger.kernel.org X-Gm-Message-State: AOJu0Yx3vTCiRNhuyyhxtGFYxUnDDX/QnwYpTNXlILmwMk3fjZXXRYwX uPFvILg+IWWs+nlg0KVwS/QmLn5K4D0X/mEzT5K5oIz1fXl57cug6KBJ3gMG96w= X-Gm-Gg: ASbGncsOsiGWML/sne5o6bXDMXze6d/bGjh8Th08hHlApWLR/e+9OMgm6hYS424eH0o nQ4oUP0xQImGmgQEl7DVKOrTK6/RBt+VZttUs8k6MGn98HHUE6CzrVy832vHMfMi5HCCWnLaxul ipodE/hfvGm3BWfPb+ObPOl1Z+6ayFnxQvJSIRNh3jyGWwWvLg3smEXCk6H9pNkyyagAyO8M4ul oXsgFL27fTfGslzEeaCBQ0kkX+ikNvEZsW09EVzmoVJ/KPaRvgo6IYqGwpWPYTsy2C/iWYX1Pj9 BC4F5ht20pTAvhITM6mkrjfOFIWTwwO5Ho6o9pFwtMY6TxJUjisygdHArJUaPjLCVjh8+OCkE7Q JIS4jHcVT3MFOFaYtP6mR7ApSsXHDSESjoTEVHNHyTm1TfHUMWI++zJ07NShH9OfojDxS X-Google-Smtp-Source: AGHT+IG2MA1VjloGr2GNffV2SfFhbl1kHIYBhP5Cte6pgnARhrLj1e4TxqCjo29diAEMPEL/GmQdjw== X-Received: by 2002:a17:907:1ca3:b0:ac2:d1bd:3293 with SMTP id a640c23a62f3a-ac3301e34c8mr955902066b.19.1742171981897; Sun, 16 Mar 2025 17:39:41 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:40 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:34 +0000 Subject: [PATCH 2/8] media: i2c: ov02e10: Fix initial indentation and spacing Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-2-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 8c4455b3643307be5b1e8110979740a7e843c146..db27d8c9f3f0b8dd6df6f9757cc674075e419075 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -220,7 +220,6 @@ static const struct ov02e10_mode supported_modes[] = { .num_regs = ARRAY_SIZE(mode_1928x1088_30fps_2lane), .regs = mode_1928x1088_30fps_2lane, }, - .link_freq_index = OV02E10_LINK_FREQ_360MHZ_INDEX, }, }; @@ -771,14 +770,14 @@ static int ov02e10_identify_module(struct ov02e10 *ov02e10) u64 val; ret = cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, - OV02E10_PAGE_0, NULL); + OV02E10_PAGE_0, NULL); cci_read(ov02e10->regmap, OV02E10_REG_CHIP_ID, &val, &ret); if (ret) return ret; if (val != OV02E10_CHIP_ID) { dev_err(&client->dev, "chip id mismatch: %x!=%x\n", - OV02E10_CHIP_ID, (u32) val); + OV02E10_CHIP_ID, (u32)val); return -ENXIO; } @@ -948,7 +947,7 @@ static int ov02e10_probe(struct i2c_client *client) static const struct dev_pm_ops ov02e10_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(ov02e10_suspend, ov02e10_resume) - SET_RUNTIME_PM_OPS(ov02e10_power_off, ov02e10_power_on, NULL) + SET_RUNTIME_PM_OPS(ov02e10_power_off, ov02e10_power_on, NULL) }; static const struct acpi_device_id ov02e10_acpi_ids[] = { @@ -960,10 +959,10 @@ MODULE_DEVICE_TABLE(acpi, ov02e10_acpi_ids); static struct i2c_driver ov02e10_i2c_driver = { .driver = { - .name = "ov02e10", - .pm = &ov02e10_pm_ops, - .acpi_match_table = ov02e10_acpi_ids, - }, + .name = "ov02e10", + .pm = &ov02e10_pm_ops, + .acpi_match_table = ov02e10_acpi_ids, + }, .probe = ov02e10_probe, .remove = ov02e10_remove, }; From patchwork Mon Mar 17 00:39:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018561 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 C7EE46F06A for ; Mon, 17 Mar 2025 00:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171987; cv=none; b=U00x2lSzT8j+5TLEtQLRm3g0g7drl5JGQm52d5Wv/r8HuYnf4Hl7IeGLN+H1qnH31ooDUY/N3xGgPPIbBuG7oP4Y/glb+KBPGQTs6QjHEA1rBtJnWg+PzZvk58RmAEBsfl/wic25iLcX256GvSSmgsd8Ex7V5OcNV6rmTq2Ls2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171987; c=relaxed/simple; bh=KIg73JLaVi8hOvqu+RYn7ANzfZBohIjnh0HTlx/y0GI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IQIvjTrzwK7gtVTg5oSm+Aw8fYZsY5TTaUgPvj8G6o4nHcotL0SloOnj+/kf09duHiY6Bydjv3nq+qhUqdz5Ezhl0CdqxkwC2Y9R8U+bfZqmSNQzrTneXbpeLGaljpqDjszJ04eO4b3WtsEOkzxtsTL+jJ3NugVLHXF7zGVfGY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=TILKBI8J; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TILKBI8J" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-ac2aeada833so759653566b.0 for ; Sun, 16 Mar 2025 17:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171984; x=1742776784; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IoT6hEWGo8s9UTjENCcvZ5oqOOzIvji9QYyI5V3xbzI=; b=TILKBI8JYvFHYyPEcM0klEATbTiKZJN2oWNOJhIb9jPT22HtmrhqL5uUrPb67zBh+Q sdAsCj48CiFAuZA2CYKmAvAUjc9HEk2ngotbAyPOvUcY6o0ra3wOtTjHVeLJdFL76RNL jhJFE5J2lH2bkkH2TZapF3ucSA+WLnffOClFCVIYvuwc/yQAyMJb2ZfBGEZ1TQzA8fBS FPFPnWmR7GdYHG2E1N2H/111M59ewzK9Lnd75V1tKPb1sIS2Qz85JmMxRKWAaWRRqe3M UW6FXLl27sxT6Ui1XMSpefxz/4g3vIEu+cqcRh1/nR+XzA4og8kGuCtNuK9Xa3ItSq9d WOoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171984; x=1742776784; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IoT6hEWGo8s9UTjENCcvZ5oqOOzIvji9QYyI5V3xbzI=; b=i1EmnZajP9P7WecUn1IOb4F0IFoI/FoiyG16rrsbRBPVZP5I85R89MBbNKwjoNTpAf p0YxvoZRpe+LazSgNPEwqX1BpbpXzNr6adoyS9VNbU9jFZViASTHkf2s+n8eYR2/c7dE fPb10O99JWqONaYToBYXNh8xaILCKgvWoMIrKMtQS+bGXxT2M1w3BLDHbZkSQGA5BQyl 19QmjuHb7PUKS6gtdAFQE7diPC4/wj8FX9/J1piFvvogW7PQQER+nEAt/fx3yx4IRPAg JJ0XE6PBkDv6icX0zwRG0LdCR3G7UJpemdizoyu4YaQj5S2Yd5V93/0dgBAqsf1mg+kH oyHQ== X-Forwarded-Encrypted: i=1; AJvYcCWNMTDEHVRjQTpygHIe83A5Ho44IgIO7zozSROm2H5dKDH0aqIJrtQiFU7KjqL4Hbg4Eal8DR7uAwscMQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yxo3K2Nxvy9J6TnDigsJ4ApZJZuDs2bwuKXiaBTZxS7gWdsvyeZ seaQEUEzoKFzCn9ROaBWuVoclDHmrzxFhLaZKnxK+TEOFc7I3t9RnFvaVHLTHtNVBKWRyKjD9iy OfXVqPA== X-Gm-Gg: ASbGnctFngugn2RZvL3WUiHvnJYD1paLcSMrbOKBaYQiRjMblbjZXy/SUvirGDdUZ0h ieqH6y4IOee4sveYPQ7+uo7l//QKjDNLQi5+HeMd3yWEQNpYSsq34XB540666Ie3BeOj5j810tL o04PtT6gM4vDqr1PIwve1PbKDIN8mH+HqGhfMJAGRixTp0C5UOgBPDdz4qTJWoYtRkbzoJsSHS2 z2XK5O9xQEErQmWwX2cAM9GrnPwjUEqI2fYXpbY6ifiXD5p1RcskLEUq03iyQk5FHfctPVnPQco 5vfSNOhwRFyTpgGHW3Be6wGlXTHAdkXmNXGoz/IBvHuisbXM5pPQlJB1yquNHVtkMKE0Eu1oRBg Eqsb+WR6HWQ0XPkVuIdLoCRY94YHUCOp4FovSflmN9sJ52kWo38uSzpaYSLwb+5xv24Ec X-Google-Smtp-Source: AGHT+IGxj3hD3Zl/SHYK+Ro/Yq/QeM0EbgWKhYdvYO1QgDwVz72yJECHm1FociRYklXqmpJxEGwR4A== X-Received: by 2002:a17:906:730b:b0:ac2:f24e:1fa3 with SMTP id a640c23a62f3a-ac3314f59eamr858256366b.20.1742171984107; Sun, 16 Mar 2025 17:39:44 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:43 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:35 +0000 Subject: [PATCH 3/8] media: i2c: ov02e10: Drop IPU6 FPGA specific handshake GPIO Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-3-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 The IPU6 handshake GPIO signals to the FPGA on IPU6/IPU7 laptops and as such is not a sensor signal. Hans has a proposal for handling those GPIOs below. Dropf from the incoming sensor driver. link: https://lore.kernel.org/linux-media/4b87a956-a767-48dc-b98b-f80d9a44adc8@redhat.com Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index db27d8c9f3f0b8dd6df6f9757cc674075e419075..29f9eec927b4660f941fa8e32249b321d25b7735 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -240,7 +240,6 @@ struct ov02e10 { struct clk *img_clk; struct regulator *avdd; struct gpio_desc *reset; - struct gpio_desc *handshake; /* Current mode */ const struct ov02e10_mode *cur_mode; @@ -533,12 +532,6 @@ static int ov02e10_get_pm_resources(struct device *dev) return dev_err_probe(dev, PTR_ERR(ov02e10->reset), "failed to get reset gpio\n"); - ov02e10->handshake = devm_gpiod_get_optional(dev, "handshake", - GPIOD_OUT_LOW); - if (IS_ERR(ov02e10->handshake)) - return dev_err_probe(dev, PTR_ERR(ov02e10->handshake), - "failed to get handshake gpio\n"); - ov02e10->img_clk = devm_clk_get_optional(dev, NULL); if (IS_ERR(ov02e10->img_clk)) return dev_err_probe(dev, PTR_ERR(ov02e10->img_clk), @@ -563,7 +556,6 @@ static int ov02e10_power_off(struct device *dev) int ret = 0; gpiod_set_value_cansleep(ov02e10->reset, 1); - gpiod_set_value_cansleep(ov02e10->handshake, 0); if (ov02e10->avdd) ret = regulator_disable(ov02e10->avdd); @@ -593,14 +585,8 @@ static int ov02e10_power_on(struct device *dev) return ret; } } - gpiod_set_value_cansleep(ov02e10->handshake, 1); gpiod_set_value_cansleep(ov02e10->reset, 0); - /* Lattice MIPI aggregator with some version FW needs longer delay - after handshake triggered. We set 25ms as a safe value and wait - for a stable version FW. */ - msleep_interruptible(25); - return ret; } From patchwork Mon Mar 17 00:39:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018562 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 537E712CD96 for ; Mon, 17 Mar 2025 00:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171989; cv=none; b=nNIZtuYJ/s8b5485AaE0vDi3pVhHsj0bium0gB0tSgQq97C2qQQlawto8f4tJOLbs2xtx178+nRPeGlP35W0yudbSCM/nAXSFVZwLPDuCnHN+OeoaRr/s0I0TwCdSPOHVInQpo8SEDtLB7wHAKEbZ28y/LCcdRcwUgPp3GQkdf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171989; c=relaxed/simple; bh=eRL0pzRV5KcpM/Epzs62OHbODj4sT3wl0WJ5nHoAiS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WCHz6BKiOjdhIOUuTqsUq+2bdyX6YARKN+qaL1keu8P/dafCsvVZB7l729MwkxVZyYKSKnrteBr/wp9ZF/FIzmbN0Limecbwj3/EMyB6JPmUrSzwoT+Ae6qSgBF3HP5yXWCwXyxBzqEFPaUBAd2VcDHlHxwA+8oYoBu/vbsz8os= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Ynz5jpJz; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ynz5jpJz" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5e6c18e2c7dso6586594a12.3 for ; Sun, 16 Mar 2025 17:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171986; x=1742776786; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n082EhybKfMTlm5jNgC5EZa5zxrxPioIfsLFHDtNktM=; b=Ynz5jpJzvKjK/QzLn6GZ6emyWWiNmi00f+YlMX2vGGUqG1eJ2lY4FCDB4R22Wr5xfj v+ON+0pUAWxzLMvBX4imbe1513utnqjqIHlUbUL67RhlY2Ht44IREKpjumP45S8+Ftak h/4HutK4cr/sSmiv7rMSvtQQz7+ACYdimDFK6YYEDTtyAi8nK2f5BlJ5V6bs70zT/iqt dGhxpjH86H3NsaoFh9GlHujmTdDbDtFkB7do8jb84nxZ7kmfZc6VR5/oM5a7IJlgx1DG lZmckWu1BKgVA/4A+OVHRfOxmmeHF7gSw6N8aE534zbHAX07RCgxMN7XW0XbyI4we5TX IE7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171986; x=1742776786; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n082EhybKfMTlm5jNgC5EZa5zxrxPioIfsLFHDtNktM=; b=psl4d7OwF7T3QElnAJR87aOBsluVRoSgLFizzs9U1WSAx47XZSTMQyiz0Vq3F/EMEg lbCD7gQ0jLqurgHEO3KzJlIsMneTNvlj7Fvoqnw2y88r4UlVNuaQnmlWp86G5s/vkIEe A9fVK9IyYaEDwLpvmSw8C7AdfrYQLqCQ1adOBQHx/3iub8zJuKqX3WUq8H6/o1VAoK/j T1LzQveIZ6tH2+iMaUwhPtfxsIOznp/jZMI1L6egzWDqZyz0Ana40Oxe+Lhw2hxfp3z3 YGDDE3Ctg2APBKh8aLHul1FF7H7rpK4hhgaK8jZFImEmsHS2qY0SAhaOHmXCaDV8JKOm Yceg== X-Forwarded-Encrypted: i=1; AJvYcCXd+xMUYD1l8SW7yosIMizC8XTrwRE8cPohlUk9pPEb6ZgOOV/1old/q+lWLP37XRr1EdVnjhRfBzT6Jw==@vger.kernel.org X-Gm-Message-State: AOJu0YzS1WuO2YWPuyS2h/qpg1HWaMqtD+/puV4AVacj+L82mSmtrMkQ kvuIF1711Y4I5IJNIP76LXYP579lG1wf/wEKF7cu6yoy7pgLl0I0agpdn8jUFhw= X-Gm-Gg: ASbGncsdZumkYX+gMnskw8daQ52Am80p0eRlVxXEEsJROdMoDo9Q8b/jqxfdBJ2wFE9 8xYgiF6fu3TWF2hO+I5dfw5Qj1kuMAovDM0TzrAQc3FZjZvh5/Wv7/C521XatfQmJyhVOcDqA65 +KHZg6N+4U95U1Uo2VsgYIbBF9tReosis4AUrC4US9cWBiQ0YbuMCahcGr6L6/U16CuKyEqOM22 aqkbW0so3mlrD2hst89694fgCiP3tMXuorKxQ7sdyEFYbZUlqGGhOgJoJK8Ff3rm75k1MQgt+EO RKkNeTZdFWz/odyGHkXcv4HRvUBRM90cg4n1VMzWujGVozKYehIJrcS8jU0/ol3R6jv/adZRHza NZ7HGjkZMwXTWRkSWiZeCcLy8qhJn1aaK1IGSlx11RoJr7+FuDxqdAgwrqHRtFVnhPOMBgxevXS s2WxQ= X-Google-Smtp-Source: AGHT+IF0LQVRgCzkI7Nuvq266Wk5lgf/Th1urxfb6eFhn7BdMEj7xPDiCeLXnIeLYP+vZb6jZV9IdQ== X-Received: by 2002:a17:907:2cc4:b0:abf:75ba:c99f with SMTP id a640c23a62f3a-ac330404688mr1052267966b.46.1742171985688; Sun, 16 Mar 2025 17:39:45 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:45 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:36 +0000 Subject: [PATCH 4/8] media: i2c: ov02e10: Convert to regulator_bulk API Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-4-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 Change to regulator_bulk API to capture the full range of rails to the o02e10 sensor. This will work for ACPI systems which only have the avdd rail available as missing rails won't fail the regulator_bulk_* function calls. Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 48 ++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 29f9eec927b4660f941fa8e32249b321d25b7735..0a016cb23cbe98d8af371c6a35db2f1d8c699d68 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -224,6 +224,12 @@ static const struct ov02e10_mode supported_modes[] = { }, }; +static const char * const ov02e10_supply_names[] = { + "dovdd", /* Digital I/O power */ + "avdd", /* Analog power */ + "dvdd", /* Digital core power */ +}; + struct ov02e10 { struct regmap *regmap; struct v4l2_subdev sd; @@ -238,7 +244,7 @@ struct ov02e10 { struct v4l2_ctrl *exposure; struct clk *img_clk; - struct regulator *avdd; + struct regulator_bulk_data supplies[ARRAY_SIZE(ov02e10_supply_names)]; struct gpio_desc *reset; /* Current mode */ @@ -525,7 +531,7 @@ static int ov02e10_get_pm_resources(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov02e10 *ov02e10 = to_ov02e10(sd); - int ret; + int i; ov02e10->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ov02e10->reset)) @@ -537,32 +543,26 @@ static int ov02e10_get_pm_resources(struct device *dev) return dev_err_probe(dev, PTR_ERR(ov02e10->img_clk), "failed to get imaging clock\n"); - ov02e10->avdd = devm_regulator_get_optional(dev, "avdd"); - if (IS_ERR(ov02e10->avdd)) { - ret = PTR_ERR(ov02e10->avdd); - ov02e10->avdd = NULL; - if (ret != -ENODEV) - return dev_err_probe(dev, ret, - "failed to get avdd regulator\n"); - } + for (i = 0; i < ARRAY_SIZE(ov02e10_supply_names); i++) + ov02e10->supplies[i].supply = ov02e10_supply_names[i]; - return 0; + return devm_regulator_bulk_get(dev, ARRAY_SIZE(ov02e10_supply_names), + ov02e10->supplies); } static int ov02e10_power_off(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov02e10 *ov02e10 = to_ov02e10(sd); - int ret = 0; gpiod_set_value_cansleep(ov02e10->reset, 1); - if (ov02e10->avdd) - ret = regulator_disable(ov02e10->avdd); + regulator_bulk_disable(ARRAY_SIZE(ov02e10_supply_names), + ov02e10->supplies); clk_disable_unprepare(ov02e10->img_clk); - return ret; + return 0; } static int ov02e10_power_on(struct device *dev) @@ -577,16 +577,20 @@ static int ov02e10_power_on(struct device *dev) return ret; } - if (ov02e10->avdd) { - ret = regulator_enable(ov02e10->avdd); - if (ret < 0) { - dev_err(dev, "failed to enable avdd: %d\n", ret); - clk_disable_unprepare(ov02e10->img_clk); - return ret; - } + ret = regulator_bulk_enable(ARRAY_SIZE(ov02e10_supply_names), + ov02e10->supplies); + if (ret < 0) { + dev_err(dev, "failed to enable regulators\n"); + goto disable_clk; } + gpiod_set_value_cansleep(ov02e10->reset, 0); + return 0; + +disable_clk: + clk_disable_unprepare(ov02e10->img_clk); + return ret; } From patchwork Mon Mar 17 00:39:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018563 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 D2B85D517 for ; Mon, 17 Mar 2025 00:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171990; cv=none; b=Gcj2Qn4GJqFdm8N5j2J13ceZes04WQhhmYG+6yOvb1EXC9GRwNMg7Icvyn8Cvx90m6EHC8XhSnVjr5Ittxyi+uhWMoNe3OMMrBUYFoZ3/a53eekmkroRoHaVEVV+QRRkLkEMV4/BG58bd8/TtC+5s4AGKNxWmkv01wllO8a6hFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171990; c=relaxed/simple; bh=R9gQe3qP710QBxP5kvOsE7wmBexZNkhKVtIyauDUWSk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R0pSrZyctOf2LfwXek1WPMAU8djDyQXLj1P/1u0f6+WSLNpsVoYiosTGEwNPp4U4o0bDXEq4KFy/8ou1tWTwA+vdflzj+WIpGSNSoUVA34fYgS/TXh5dqrTYGWWRg8519J4bR3X/2UoKUpveLfKbUfYcxyeGap4rIngNMNk7J2w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SEPwx1IQ; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SEPwx1IQ" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5e8be1c6ff8so3316979a12.1 for ; Sun, 16 Mar 2025 17:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171987; x=1742776787; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Fa0+XG41AnTpCxI6rUtKEupAlgua8QfZ9lbTB2DppLg=; b=SEPwx1IQrSNh92hFzyoF5ugg/rFJjO5/LcvTcvLrdNeJ+C8jktKA3qESRRmhIiTaOS KkmtSfIM1FXE9tZvnk3dv+JtZ7II5acrZfS86f4rQaIj3YPGyZFIHbvF0IhWzJ3LIzsj TbdAHmcEQxT4EWb3jl5xEDEuKQTh3N1J18JVXcYEqniI35X9ftpMKOmWJa3X9gbOefQd 4BGq6+aYpbxjvKzN5bejZ+b00+cT4AFWImikmpimD341JsXmALAK8Uj7G6a3tcmjRMIL sieH3k4rFNIyq4aLaaoTRgVFm8c+hpUSpg+gH+qZLVN39L6D39rvmwf40h1jv4/vWGb6 btWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171987; x=1742776787; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fa0+XG41AnTpCxI6rUtKEupAlgua8QfZ9lbTB2DppLg=; b=EeG4O2/kvU1KlzEk+Ha1Qd6EDzkHdCALrZuxwTwxzjEkfi56Y6f5brqMBdYoP/AUMy gpADcpi5S8abveZarKgXQXW2T3KYCbhdhr5eGYjp+WvSnkyvITKhA0GYOz+DnlQi8KwC YFv6FJ+hKm6M49c+ySNvwSu9N1Ueg6ZJqWt5CDRnbT91nRtnyhjmEhx7GsglHGqNpldg fnzsyEY0Lguf+Aq7iN+bqh270muRptX8x3ZFP9ocdhQPvuGqAlfIF+FHmbUBvnT+ln/A 5WTdV+m31eoS9js71iTYi/4ab7hgVYkwDtdvVzetUNPnOteRnMeEjVSYY62d/+ZfMbC3 hFNg== X-Forwarded-Encrypted: i=1; AJvYcCVXKTpIV53WPwgQO3qLfPSLafnkjLnIHJDonGB2viclWBQKtg+6K9v4kU+IOJ5UqJkUKaWNKfSq6FCo9Q==@vger.kernel.org X-Gm-Message-State: AOJu0Yyi42dBfxb75Kt43wfIHQHTm8A64D5s56yOCR0uLsFBv3N47Gd0 zXLXKbFn8QdON4FeNqnXE5uOX4daamDg/21V7fbT7tK0Wk/1M8WfxpVfDWXgifk= X-Gm-Gg: ASbGncvRTHFWyDsl+dMImJ/tPHvsryXhCzqnZOgnMHB4Tje9S4KaOFdfd58Z+qphe/F XnoDqxTVBLUSY7k6b6zsLm0fRMIof1GdYjaX7rDkm0kE1FBj2rJsmNBelAvwut3trDEL2eTapvI cK4dLe5/02slOcXFFH2JWSLmq+3iP9Jv4GdxBDdu7t+ayH1EyV56OIv7XrkKZCUqhPnWPrmGhfu kCkUPmI+9gUvJiChzpUW7679dM1CYPfjObAUUQrBTIIFthOCd5R+79p33gyAvz3ZHIMUz3m4rsq MQASusG+MD8teLjf7DvWn45bqfcO3XbA5ZWrTnE3NiOzDVKMb+2Yrt2qqnh41EaSBCSmlpRakzY 8kcqfnBYsqLalUHrXWH84hGAN5MLdZXahiKMkdS+KIBlimuVUiPvvtlNhY5IGs+x33bju X-Google-Smtp-Source: AGHT+IFGB/6ELCetEqsulbq9XYDj362qmt+yhgOiXelWC2RLXXmy8I2ZSYJBdVHdEvtB3cFlQPysAQ== X-Received: by 2002:a17:907:6ea9:b0:abf:52e1:2615 with SMTP id a640c23a62f3a-ac3301db85emr1179198966b.7.1742171987230; Sun, 16 Mar 2025 17:39:47 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:46 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:37 +0000 Subject: [PATCH 5/8] media: i2c: ov02e10: Rework MCLK clock get logic to facilitate OF Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-5-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 Move the MCLK validation logic to check_hwcfg() and move check_hwcfg() to after devm_kzalloc() so that we can pass a struct ov02e pointer to check_hwcfg() to begin to enumerate that structure. Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 0a016cb23cbe98d8af371c6a35db2f1d8c699d68..9ad70671a718ea0aaf80ad3adcc5738ee57a7ff6 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -538,11 +538,6 @@ static int ov02e10_get_pm_resources(struct device *dev) return dev_err_probe(dev, PTR_ERR(ov02e10->reset), "failed to get reset gpio\n"); - ov02e10->img_clk = devm_clk_get_optional(dev, NULL); - if (IS_ERR(ov02e10->img_clk)) - return dev_err_probe(dev, PTR_ERR(ov02e10->img_clk), - "failed to get imaging clock\n"); - for (i = 0; i < ARRAY_SIZE(ov02e10_supply_names); i++) ov02e10->supplies[i].supply = ov02e10_supply_names[i]; @@ -774,7 +769,7 @@ static int ov02e10_identify_module(struct ov02e10 *ov02e10) return 0; } -static int ov02e10_check_hwcfg(struct device *dev) +static int ov02e10_check_hwcfg(struct device *dev, struct ov02e10 *ov02e10) { struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = V4L2_MBUS_CSI2_DPHY @@ -795,10 +790,28 @@ static int ov02e10_check_hwcfg(struct device *dev) if (ret) return dev_err_probe(dev, ret, "parsing endpoint failed\n"); - ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", - &ext_clk); - if (ret) { - dev_err(dev, "can't get clock frequency\n"); + ov02e10->img_clk = devm_clk_get_optional(dev, NULL); + if (IS_ERR(ov02e10->img_clk)) { + ret = dev_err_probe(dev, PTR_ERR(ov02e10->img_clk), + "failed to get imaging clock\n"); + goto out_err; + } + + if (ov02e10->img_clk) { + ext_clk = clk_get_rate(ov02e10->img_clk); + } else { + ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", + &ext_clk); + if (ret) { + dev_err(dev, "can't get clock frequency\n"); + goto out_err; + } + } + + if (ext_clk != OV02E10_MCLK) { + dev_err(dev, "external clock %d is not supported\n", + ext_clk); + ret = -EINVAL; goto out_err; } @@ -853,15 +866,15 @@ static int ov02e10_probe(struct i2c_client *client) struct ov02e10 *ov02e; int ret; - /* Check HW config */ - ret = ov02e10_check_hwcfg(&client->dev); - if (ret) - return ret; - ov02e = devm_kzalloc(&client->dev, sizeof(*ov02e), GFP_KERNEL); if (!ov02e) return -ENOMEM; + /* Check HW config */ + ret = ov02e10_check_hwcfg(&client->dev, ov02e); + if (ret) + return ret; + /* Initialize subdev */ ov02e->regmap = devm_cci_regmap_init_i2c(client, 8); if (IS_ERR(ov02e->regmap)) From patchwork Mon Mar 17 00:39:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018564 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 5D52914A614 for ; Mon, 17 Mar 2025 00:39:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171992; cv=none; b=coDoO7OQWtnZ02rPU5gD8xZ3ndk0J1oNHMQFF9T8FHIbK2KxCKBOl4Yj7n6g6SUxTQpe/f8WHpF8AAeisrxDucymXm3dujZbdIyPHpcDwMXfmxVuI0j2mLSUOxdrzLAyxSDmuFmnTCudxzS07dIhfIbgS230C71QSRUGVaW3gxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171992; c=relaxed/simple; bh=xI8NEGU+/vOVowktJFplHlwmCPwO6Su0nn2Dpzy9ADE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ippUg/2IdYGPG17Ew5v7yY0UhL2WdjyQt7zRZZS75pLWpFOAhXrku+mWP1CbAYkfeF8w484+TBJrY4c2nKHpbDUjW8C4l9PbNEC3kctYmx2+geWfaUorauTxr4KXX42xeXtx6DDnnRuRfttsuqVJImn//Vq1Fegh/IrmYw031SM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dwgW4dxD; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dwgW4dxD" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5e5b6f3025dso5541795a12.1 for ; Sun, 16 Mar 2025 17:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171989; x=1742776789; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LTwjuKAVPDFwywDGvwuXvBGY8agm/8D4s3lYkbuf/68=; b=dwgW4dxDF+giCyGeXOSUDreZyh24J1wwO4BvjZifUPRO9VDJLse7s4ombFqDgswKgb 8cKLPBvEohcHc9dui1TKnX7wgmHyqkOISp27ts87Ph5JeNBluC7RRWJ477Ty3+romS3G L4NMLXkDsTgT4FThjCQdgafoz/zdiEquVycZgNAq2ZI2JRMSRRv7+CeIge+cJSAiOCQ2 bCSb74Mxulpf5kRVA2xVYxaqshgCGhyGrNHxpV7ZLzLsNZmY79DExvOKv2ot8oBnKc8B O18FSpej0eu5UZcNf6KKOlV0jnkdt805dF6bs6gr8YK0eK+hb/24E6TFxfcSnsFyF20E DQZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171989; x=1742776789; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LTwjuKAVPDFwywDGvwuXvBGY8agm/8D4s3lYkbuf/68=; b=SIBGm7kkGgCE4Co4LGuX57ZwOf9ENi7ejo7LJz0jKNSVrpZ1ag2grPAMC3Dbl/rjXt AwqJIT6goJpwZVul4ZquyuAKvrhyhemPT7V5kjtQIuC7D4qOjDRrU0SnPs6YgwLGURJc Ia+wzf49EcWEDKrri+1yDKFPlDlAh4pEvZuhncd0A8PG8YbLJIXVl1bAFlr9dYqGNQs8 XkGaS9kQNFhU9notDb4Dy2j+W1LsgD1pNyQP0ep7XmlO3gpP8Ek0ujU36LtyPjXiHRRM AVC7cz4TrXA718u+APhb2gZ5JfWWr1lmXmVFWgOduz03jAbaTFKYI6A1yDjuOB/X/Soj TeGg== X-Forwarded-Encrypted: i=1; AJvYcCVM3Fqjk+A4RnqqjFMMIpZrU2Qi76hs9a8mp+uHkQeeYtlGc5l2gvXSchSfNVlcwld+K+87MSQPMdotDw==@vger.kernel.org X-Gm-Message-State: AOJu0YxadeeKNZNvSo97Ob8j29LNY9tFkHXvzkGdXueCG9DxnOrQc9S9 zIpx5zOQ6uA7vX4U62lp9S1kO+M1u7FSx0cQmA7RTft0SeJah+DCHYYyW3S2L+o= X-Gm-Gg: ASbGncuxkZx6B4GmEasuc4Zy6NIJq8ViH/8mTeIJFxU/zuQ1B7EuKXIsVxNWI6Fetrp 5Kocx/zustc5vBYYvA2XsatPxZoZD1prj0NWeyjT9Y82wU8mbwt2w+zTwt+Tq2QFdjUd7t8KrIe IcERsXJ0bSzH3rVWqT8CQcLn7h/EXEPWDJpZk7YA7lYdPnPKDDWcCLEG3+2XrfbY6dUf3pxmKgS lwjrD3TyGoWJTkY5qWwQCNO2LrjoUTudkxjK9pWOEDSqScGkGNulF2IB42KfmLQTPcMZ2Z8RFW8 H5prhzh9xF5D+3OEm/9qNkFdBP6NkgjyY+4y+BEbnwl4Xzbc9UKwGukHGdtsIXxlS1R5mAgu6iu xSg+1qU4RFPZAu4AU+PVgMzlysDhAC56UI6EG7Sz3vi6Lw4Q+aI9/EL+JLnxSXXO3ZF2T X-Google-Smtp-Source: AGHT+IHuPF9RmLSS+cmRMvKhsL6P3ptFy8EeFpnvckAhRdDHOi6nF7p0bB4TaCKF/ZRiT1JFMASrhA== X-Received: by 2002:a17:907:960f:b0:ac3:1b00:e17d with SMTP id a640c23a62f3a-ac3303dc6dcmr1028421966b.54.1742171988774; Sun, 16 Mar 2025 17:39:48 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:47 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:38 +0000 Subject: [PATCH 6/8] media: i2c: ov02e10: Implement specification t3 and t5 delays on power-up Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-6-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 The ov02e10 specification says for power-on: t3 = the time between dvdd stable and XSHUTDOWN deassert t5 = the time between XSHUTDOWN deassert and SCCB ready The power-off path in the spec shows no required delays between XSHUTDONW and power-rail shut off so power-off is left alone. Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 9ad70671a718ea0aaf80ad3adcc5738ee57a7ff6..40c4d3ee36e3e2a0bb8be3ff10d016e2bb9bbc9d 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -579,7 +579,11 @@ static int ov02e10_power_on(struct device *dev) goto disable_clk; } - gpiod_set_value_cansleep(ov02e10->reset, 0); + if (ov02e10->reset) { + usleep_range(5000, 5100); + gpiod_set_value_cansleep(ov02e10->reset, 0); + usleep_range(8000, 8100); + } return 0; From patchwork Mon Mar 17 00:39:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018565 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 EBAAD155322 for ; Mon, 17 Mar 2025 00:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171994; cv=none; b=fBC90VCGcqDhfgPqDV/PVJ4S/kp1fJd/TqrDUpJ1WOuFaipppq1/2mjxlD365CFtsn4fBJrmlYwcqNbrFjO95GEyCxFiBmY6XVotltWDwhdPXni7Oc2cm3rr3Ftd9e6cUE0LLhXaSJjpeQ8ghF1vCskme/dNiFDH0tQAI0nPYRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171994; c=relaxed/simple; bh=BseOSyrWbC7XsN7Ir+jFiDNzEQWe5FkrG+nPfKJhH3o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Eg1oLTvR/9JJJ3U9d4N6ixi/kN1PrXsDCk84aok3eAq88EhSkOQztBiBKjb0Gks0IHftOE6hyUm56kaO5fp+9V6GYzrE+kxLLJoq1SZfVwV7gApI08yo/+lITOJfIKII/L2roT8SigOIn9w6RhdugRYu5MYkarV/ICu+CDmm1Hk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=eOyyBbPI; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eOyyBbPI" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-aaeec07b705so606450466b.2 for ; Sun, 16 Mar 2025 17:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171990; x=1742776790; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9CgiISetOnuxy15HQS3MAPprAz1pVNJBASTHqb0R23I=; b=eOyyBbPIbg+Fi+qJ0SIKD7AmsuvhuHBn3AktJ6Qkn2l317ppI9xtuSvfjam+RN7l+D wZF/a1iqAx4lbHBoFypAN4w5puZbRA5LrIpOsfKKv33CKONov3yRqIAwgaABvoyLuhQT FsGUmlYXooLEfuBFrWEWN1Z0NgCdJVfHEJ3SpSqQIXOnaxh6cr6rL1n+MmXbDZycOnPI rdtYxkYvWvVei0iPyc0dxQXYIIRw7FGbCYUGm/R9eeymG8hA8SsRfP1ejl4rVMjpqvhA 9JzHQ19zmJgFdhXcy+JAdy7VkRvI/AOahksdboq+cHPZ0OHzZA4AwhXZ9s9ItwA2YKwm ImiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171990; x=1742776790; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9CgiISetOnuxy15HQS3MAPprAz1pVNJBASTHqb0R23I=; b=SVF5M5keCmSCheLXHqKA2xOuhdaV3ObpTdpJj2nK0H8NZ6D+xY7LOM+cwJgXgxc8Z7 vYpbtLib3KYlhBhOZfiMROe8coXsP68RKkxAtidYRLe3d92ECMSkOKR8WOtMlQ+u2lZm kwg95jllBOcwYtL1yEk0KoA6CZauwchTi6aZVQVq/lv3lK9g3BBS5xZCrozNjsaEddED lUyLbEWDnXOFOkB7iKZobpOe32iqlmtUU6q3WlMMCHFCi+uC/yELXdImEDPmA9YiN7SN u+Eao3S/fkxkRFLxyJsTqUfgm3wP0/nNNHZglsh5zpH/pspF6HhANJD00cl4ZH2cqKtW 8r0g== X-Forwarded-Encrypted: i=1; AJvYcCXtixHMVo0VZzI+MIciLVDFTlurmJmZt1MrpbR4n+NtzBM2b7017Oc5Ym3JbFjwzffstB1RRUXzz6ufDg==@vger.kernel.org X-Gm-Message-State: AOJu0Ywo4ATlEelgtGEzi27mO87CKIbySdBq2md04geBEaUoECm+6pjL XQEfi13JP79r3eMjLJ7p0cPcYwE4taJhq6vUDD4TISR67o96huBPQZC3wvm4Aqo= X-Gm-Gg: ASbGncsRmKtrGQPZ8Qws9sMEO5D+kNd69W1bcbpjCDzK/IZIoEWQp7xinv+UvtqdNj8 nng8m9UvIOKYd5/+VqI8UuzGfTFv52U9PauFGvVseSQJPeHhMBo6+M4wAm9i56WVDpxNi4HMvDg vIR33zCLxl9S1h7EKG4h9RIse+5aP3fukty4BMCbDrCJOUkYV/pE9+nFHwo/NvYvpW1u7qAwS0x teuz5m7CcgOy6ZvpRreZjqh9R/umhgL5XOtW1k4LnjQfJHEGeY9Kb617epEsCc+ZAOZ4dkgJaZ3 /blePq4q7E+YgkOES6Twva4ZlEvlhKJXiqig/dtJpLy78pQ4K47LKmsXLGdQ794T8bFu8JuvCSG 8/9NOGpcA/iP1eluZfQAQqF/FH3j4xqcPbo27fYtXS6aPfUBnxPx1EVDQNB5ttRyu7vp9 X-Google-Smtp-Source: AGHT+IHN6MpPoVaqeceUTiJ12TLHptJq+aSorclyfov0XAOk0vnOAfc+Ft0TUVap5T6G00OSbPu+0A== X-Received: by 2002:a17:907:7d87:b0:ac3:26fb:f420 with SMTP id a640c23a62f3a-ac3303715c9mr1205541966b.42.1742171990333; Sun, 16 Mar 2025 17:39:50 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:49 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:39 +0000 Subject: [PATCH 7/8] media: i2c: ov02e10: Remove redundant dev_dbg() and some extra dev_err() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-7-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 40c4d3ee36e3e2a0bb8be3ff10d016e2bb9bbc9d..2c15df8ca733aa4f37e125ac3bfb51a319e34c6e 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -316,7 +316,6 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl->id) { case V4L2_CID_ANALOGUE_GAIN: - dev_dbg(&client->dev, "set analog gain\n"); cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_1, &ret); cci_write(ov02e10->regmap, OV02E10_REG_ANALOG_GAIN, @@ -324,7 +323,6 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_DIGITAL_GAIN: - dev_dbg(&client->dev, "set digital gain\n"); cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_1, &ret); cci_write(ov02e10->regmap, OV02E10_REG_DIGITAL_GAIN, @@ -332,7 +330,6 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_EXPOSURE: - dev_dbg(&client->dev, "set exposure\n"); cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_1, &ret); cci_write(ov02e10->regmap, OV02E10_REG_EXPOSURE, @@ -340,7 +337,6 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_VBLANK: - dev_dbg(&client->dev, "set vblank\n"); cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_1, &ret); cci_write(ov02e10->regmap, OV02E10_REG_VTS, @@ -348,7 +344,6 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_TEST_PATTERN: - dev_dbg(&client->dev, "set test pattern\n"); cci_write(ov02e10->regmap, OV02E10_REG_PAGE_FLAG, OV02E10_PAGE_1, &ret); ov02e10_test_pattern(ov02e10, ctrl->val, &ret); @@ -358,7 +353,7 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl) ret = -EINVAL; break; } - dev_dbg(&client->dev, "will update cmd\n"); + cci_write(ov02e10->regmap, OV02E10_REG_COMMAND_UPDATE, OV02E10_COMMAND_UPDATE, &ret); @@ -510,7 +505,6 @@ static int ov02e10_set_stream(struct v4l2_subdev *sd, int enable) ret = ov02e10_start_streaming(ov02e10); if (ret) { - dev_dbg(&client->dev, "start streaming failed\n"); enable = 0; ov02e10_stop_streaming(ov02e10); pm_runtime_put(&client->dev); @@ -903,7 +897,6 @@ static int ov02e10_probe(struct i2c_client *client) /* Set default mode to max resolution */ ov02e->cur_mode = &supported_modes[0]; - dev_dbg(&client->dev, "will Init controls\n"); ret = ov02e10_init_controls(ov02e); if (ret) return ret; @@ -917,10 +910,8 @@ static int ov02e10_probe(struct i2c_client *client) /* Initialize source pad */ ov02e->pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&ov02e->sd.entity, 1, &ov02e->pad); - if (ret) { - dev_err(&client->dev, "%s failed:%d\n", __func__, ret); + if (ret) goto error_handler_free; - } ret = v4l2_async_register_subdev_sensor(&ov02e->sd); if (ret < 0) { @@ -944,11 +935,10 @@ static int ov02e10_probe(struct i2c_client *client) error_handler_free: v4l2_ctrl_handler_free(ov02e->sd.ctrl_handler); mutex_destroy(&ov02e->mutex); - dev_err(&client->dev, "%s failed:%d\n", __func__, ret); + error_power_off: ov02e10_power_off(&client->dev); - dev_dbg(&client->dev, "probe done\n"); return ret; } From patchwork Mon Mar 17 00:39:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 14018566 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 9CC50224D7 for ; Mon, 17 Mar 2025 00:39:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171995; cv=none; b=Z4TNHQmZgsY+nr6ZyJNCi+923YavPNtaDjfoPv92nFuDKOQGhaB+nJSrnfKm5rrfXAM4POqfxstU+YCUBjod9eo8yeyqit+C/PKj0RVnNCpAjGNrAfrQ8b5fqKk8xmnrEN570CwP8r20bA5Y7Y2OMmogcHK4+l6PAwqXWW+snrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742171995; c=relaxed/simple; bh=EC9j2bIq4ciGt5bTfsPpCKAcRq1j/C87MvJJDh4ON1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V2ry+crZ9gJi/M4zQZOsysRMrhw7/Tu1tpb4O1ADZ4gW26eV2Dxp6kHj8tQ6ltJsisJBT9l+Gk32e9pqymT5LP0BEsemSHWfkxqyph+hvPKTwWuVSdVLP9dF5hzXp9eLJqJUMC18I9KtKFThQlQlsIBK2yRvfEWNCC4Q9QrczsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oX3pM9Ip; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oX3pM9Ip" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-ac345bd8e13so235422266b.0 for ; Sun, 16 Mar 2025 17:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742171992; x=1742776792; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3oIaC4JSPq4Hxx0BCotHyy3fEpNhxbu3GVa44qnjARE=; b=oX3pM9IpCKJ5eXZxBEMA5VP2Zh4cZLsOAJFCJdsAaZooEFe1ZRqeduJAZlQnU8GCTI Eq/+HRAQ7zxmOT1EIFenukb960BHGeO4GzEdCwGKNWE0mpUgeVDk1BWbE6GQ+Icpf3zK 2fD8hj38v/8gR8TAGZG6Y/nYZti26HjX3c5WXoypF30mJRNFg11fs1xEalA1bBCHNv8D /KyLZ7N1+Muz8YeYGyY2sjKeI/DYgr5FVYT12B5SOqG9BNNloRzP5s0vQaVKlzo9AJqG FhzzMMzNC5faCCBMhJifEvggxqBkINSjCt7GDZcig/yWqgnRDiyCdErOHlGGA6NcNg0A Gl3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742171992; x=1742776792; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3oIaC4JSPq4Hxx0BCotHyy3fEpNhxbu3GVa44qnjARE=; b=C5dg6TospnqgAAPYPAjQc9XY0ABN1RT4DAdKBk/eF+YIfOX8/ydhmIYPqQSHUA53Yt KCBo8THvLBf/BZ1oAHKQJATYGeFyU4o7A4uAqWRP+mPO2GXvI6LxKRrSeVkrZndy3eCk aC5J6xAgbL05Lddy76S31lKNhXVCPnHPTtfw7wtmP5DKXe5DL+OttatBjL6o5gCh38fN WmW7tBXE3FyMvS28pA/KsIHPBt91HqfK32GuZc1HP6kCm5v9hHcpZukwHClH/BLQ91Xf 6SU2SaQt9H2vhgvP/zc4xXnY3ThUY30M684NbtHEmzFXpnoX7EzEjVY+Bz+9ho8r4yjy J4gw== X-Forwarded-Encrypted: i=1; AJvYcCU1OHDt8+3KT5ZWQXYNuhlwPSKiPng3MH5O8xm+8hv0bSCewxLBmVJxDbveEui56vUeEihDnasoi4hcKw==@vger.kernel.org X-Gm-Message-State: AOJu0YwhZY0MgOx0cyoNAwnxo03OMeno9qxBoPb4Nicbw0Y4fbSw/gmu ANwPIG7eiON/dH9ISQFMu0LRdhHFIbozn3ivjSv7rvT6jA7+/A4k9LrhWNY/i6g= X-Gm-Gg: ASbGnctsfNuNmSOKIPhLKw8sWvPTzahfOcQ0I7RrIsR64oKN6IDcqHsTiWptOs7oHB0 N5N4jiujY/D33GZuGoiV0SMz7RcCVRbc2bcdAoutXr/rXqun8KzZtVbvth0uhMO2JObdIyPdqgY 3C/JAUae+1EPVqVAgNav2bgleKLQYTIlBdlx8fwyzSZaw+SwyDS9C78ImW4+ebuFWRionL4s7c0 9V+CLOIbyXaihjlsLU+G5K+JzdrDUGkGhlcKSu5FAV9OsWIDAMmoprAztMnXkrTkaVQ/XOTUXuj I/BA6hB1A44m9Y9/toejACwCL6Lkke6nTUV0wRWkRvGk4caaJeqGLhLg58JwgIARG6UsMAtaRAh MzhjIGNOydoS6SB5cvch1FotX2p+7+KxDK1EaFgjYpfxuNj9XpBKxlGxOnRAPcWhxDxDU X-Google-Smtp-Source: AGHT+IGw5bWEY5CU0ToSapKWjZkga24fSjvSj722h9dS/H4k7EkMFeAOLRKF/irP9dBdAZwFIVLVfQ== X-Received: by 2002:a17:907:7e8d:b0:ac2:29cf:643d with SMTP id a640c23a62f3a-ac3301e4c55mr1021762166b.25.1742171991816; Sun, 16 Mar 2025 17:39:51 -0700 (PDT) Received: from [192.168.178.107] (2001-1c06-2302-5600-7555-cca3-bbc4-648b.cable.dynamic.v6.ziggo.nl. [2001:1c06:2302:5600:7555:cca3:bbc4:648b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3146aefadsm562407166b.8.2025.03.16.17.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Mar 2025 17:39:51 -0700 (PDT) From: Bryan O'Donoghue Date: Mon, 17 Mar 2025 00:39:40 +0000 Subject: [PATCH 8/8] media: i2c: ov02e10: Add OF probe support Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-8-bd924634b889@linaro.org> References: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> In-Reply-To: <20250317-b4-media-comitters-next-25-03-13-ov02e10-v1-0-bd924634b889@linaro.org> To: Mauro Carvalho Chehab , Sakari Ailus , Liam Girdwood , Mark Brown Cc: Jingjing Xiong , Hao Yao , Jim Lai , You-Sheng Yang , Alan Stern , Hans de Goede , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Bryan O'Donoghue X-Mailer: b4 0.14.2 Supply OF probe matching table and enumeration structure hook. Signed-off-by: Bryan O'Donoghue --- drivers/media/i2c/ov02e10.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 2c15df8ca733aa4f37e125ac3bfb51a319e34c6e..10cac199b23f14ed79f4fb7e84d2c685c6d70399 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -954,11 +954,18 @@ static const struct acpi_device_id ov02e10_acpi_ids[] = { MODULE_DEVICE_TABLE(acpi, ov02e10_acpi_ids); +static const struct of_device_id ov02e10_of_match[] = { + { .compatible = "ovti,ov02e10" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, ov02e10_of_match); + static struct i2c_driver ov02e10_i2c_driver = { .driver = { .name = "ov02e10", .pm = &ov02e10_pm_ops, .acpi_match_table = ov02e10_acpi_ids, + .of_match_table = ov02e10_of_match, }, .probe = ov02e10_probe, .remove = ov02e10_remove,