mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
To: Hikmah Gumelar <hikmahgumelar@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-clk@vger.kernel.org, Abel Vesa <abelvesa@kernel.org>
Subject: Re: [PATCH v5 3/7] media: i2c: add s5k5e8 image sensor driver
Date: Fri, 27 Nov 2026 19:13:17 +0200	[thread overview]
Message-ID: <2ed19776-e8ed-438e-b946-7a83d9c318f0@linaro.org> (raw)
In-Reply-To: <20261127134507.125513-4-hikmahgumelar@gmail.com>

On 11/27/26 15:45, Hikmah Gumelar wrote:
> Add V4L2 subdev driver for the Samsung S5K5E8 5-megapixel MIPI CSI-2
> 
> CMOS image sensor supporting 2592x1944 10-bit Bayer output.
> 
> Signed-off-by: Hikmah Gumelar <hikmahgumelar@gmail.com>
> ---
>   MAINTAINERS                |   7 +
>   drivers/media/i2c/Kconfig  |  10 +
>   drivers/media/i2c/Makefile |   1 +
>   drivers/media/i2c/s5k5e8.c | 567 +++++++++++++++++++++++++++++++++++++
>   4 files changed, 585 insertions(+)
>   create mode 100644 drivers/media/i2c/s5k5e8.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f72ce07a4e38..2ac245d4ad7c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -25007,6 +25007,13 @@ T:	git git://linuxtv.org/media_tree.git
>   F:	Documentation/devicetree/bindings/media/i2c/samsung,s5k3m5.yaml
>   F:	drivers/media/i2c/s5k3m5.c
>   
> +SAMSUNG S5K5E8 CAMERA SENSOR DRIVER
> +M:	Hikmah Gumelar <hikmahgumelar@gmail.com>
> +L:	linux-media@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/devicetree/bindings/media/i2c/samsung,s5k5e8.yaml
> +F:	drivers/media/i2c/s5k5e8.c
> +
>   SAMSUNG S5K5BAF CAMERA DRIVER
>   M:	Sylwester Nawrocki <s.nawrocki@samsung.com>
>   M:	Andrzej Hajda <andrzej.hajda@intel.com>
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 162b8ea02601..4c622e5eef73 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -879,6 +879,16 @@ config VIDEO_S5K3M5
>   	  To compile this driver as a module, choose M here: the
>   	  module will be called s5k3m5.
>   
> +config VIDEO_S5K5E8
> +	tristate "Samsung S5K5E8 sensor support"
> +	select V4L2_CCI_I2C
> +	help
> +	  This is a Video4Linux2 sensor-level driver for the Samsung
> +	  S5K5E8 5MP camera.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called s5k5e8.
> +
>   config VIDEO_S5K5BAF
>   	tristate "Samsung S5K5BAF sensor support"
>   	help
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index a750942e9c62..bdcb8f34aca3 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -136,6 +136,7 @@ obj-$(CONFIG_VIDEO_RDACM21) += rdacm21.o
>   obj-$(CONFIG_VIDEO_RJ54N1) += rj54n1cb0c.o
>   obj-$(CONFIG_VIDEO_S5C73M3) += s5c73m3/
>   obj-$(CONFIG_VIDEO_S5K3M5) += s5k3m5.o
> +obj-$(CONFIG_VIDEO_S5K5E8) += s5k5e8.o
>   obj-$(CONFIG_VIDEO_S5K5BAF) += s5k5baf.o
>   obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o
>   obj-$(CONFIG_VIDEO_S5KJN1) += s5kjn1.o
> diff --git a/drivers/media/i2c/s5k5e8.c b/drivers/media/i2c/s5k5e8.c
> new file mode 100644
> index 000000000000..d25b978d7eda
> --- /dev/null
> +++ b/drivers/media/i2c/s5k5e8.c
> @@ -0,0 +1,567 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/unaligned.h>
> +#include <media/v4l2-ctrls.h>
> +#include <media/v4l2-device.h>
> +#include <media/v4l2-fwnode.h>
> +
> +#define S5K5E8_CHIP_ID_REG		0x0000
> +#define S5K5E8_CHIP_ID			0x5e80
> +#define S5K5E8_REG_MODE_SELECT		0x0100
> +#define S5K5E8_MODE_STANDBY		0x00
> +#define S5K5E8_REG_VTS			0x0340
> +#define S5K5E8_REG_EXPOSURE		0x0202
> +#define S5K5E8_REG_ANALOG_GAIN		0x0204
> +#define S5K5E8_REG_TEST_PATTERN		0x0600
> +#define S5K5E8_XVCLK_FREQ		24000000
> +#define S5K5E8_LINK_FREQ_418MHZ		418000000ULL
> +#define S5K5E8_PIXEL_RATE		167200000ULL
> +
> +struct s5k5e8_reg {
> +	u16 address;
> +	u8 val;
> +};
> +
> +struct s5k5e8_mode {
> +	u32 width, height, hts_def, num_regs;
> +	const struct s5k5e8_reg *regs;
> +};
> +
> +static const char * const s5k5e8_supply_names[] = { "avdd", "dvdd", "dovdd" };
> +#define S5K5E8_NUM_SUPPLIES ARRAY_SIZE(s5k5e8_supply_names)
> +
> +/* Register initialization tables derived from Xiaomi Mi A1 vendor configuration */
> +static const struct s5k5e8_reg s5k5e8_common_regs[] = {
> +	{ 0x0100, 0x00 }, { 0x3906, 0x7e }, { 0x3c01, 0x0f }, { 0x3c14, 0x00 },

You should use CCI interfaces.

Overall perphaps it might be a long and tedious review process for the changes,
and I would recommend to send and get accepted two sensor drivers only, then
do other work.

> +	{ 0x3235, 0x08 }, { 0x3063, 0x2e }, { 0x307a, 0x10 }, { 0x307b, 0x0e },
> +	{ 0x3079, 0x20 }, { 0x3070, 0x05 }, { 0x3067, 0x06 }, { 0x3071, 0x62 },
> +	{ 0x3072, 0x16 }, { 0x3203, 0x43 }, { 0x3205, 0x43 }, { 0x320b, 0x42 },
> +	{ 0x3007, 0x00 }, { 0x3008, 0x14 }, { 0x3020, 0x58 }, { 0x300d, 0x34 },
> +	{ 0x300e, 0x17 }, { 0x3021, 0x02 }, { 0x3010, 0x59 }, { 0x3002, 0x01 },
> +	{ 0x3005, 0x01 }, { 0x3008, 0x04 }, { 0x300f, 0x70 }, { 0x3010, 0x69 },
> +	{ 0x3017, 0x10 }, { 0x3019, 0x19 }, { 0x300c, 0x62 }, { 0x3064, 0x10 },
> +	{ 0x3c08, 0x0e }, { 0x3c09, 0x10 }, { 0x3c31, 0x0d }, { 0x3c32, 0xac },
> +};
> +
> +static const struct s5k5e8_reg s5k5e8_2592x1944_regs[] = {
> +	{ 0x0100, 0x00 }, { 0x0136, 0x18 }, { 0x0137, 0x00 }, { 0x0305, 0x06 },
> +	{ 0x0306, 0x18 }, { 0x0307, 0xa8 }, { 0x0308, 0x34 }, { 0x0309, 0x42 },
> +	{ 0x3c1f, 0x00 }, { 0x3c17, 0x00 }, { 0x3c0b, 0x04 }, { 0x3c1c, 0x47 },
> +	{ 0x3c1d, 0x15 }, { 0x3c14, 0x04 }, { 0x3c16, 0x00 }, { 0x0820, 0x03 },
> +	{ 0x0821, 0x44 }, { 0x0114, 0x01 }, { 0x0344, 0x00 }, { 0x0345, 0x08 },
> +	{ 0x0346, 0x00 }, { 0x0347, 0x08 }, { 0x0348, 0x0a }, { 0x0349, 0x27 },
> +	{ 0x034a, 0x07 }, { 0x034b, 0x9f }, { 0x034c, 0x0a }, { 0x034d, 0x20 },
> +	{ 0x034e, 0x07 }, { 0x034f, 0x98 }, { 0x0900, 0x00 }, { 0x0901, 0x00 },
> +	{ 0x0381, 0x01 }, { 0x0383, 0x01 }, { 0x0385, 0x01 }, { 0x0387, 0x01 },
> +	{ 0x0340, 0x07 }, { 0x0341, 0xb0 }, { 0x0342, 0x0b }, { 0x0343, 0x28 },
> +	{ 0x0200, 0x00 }, { 0x0201, 0x00 }, { 0x0202, 0x03 }, { 0x0203, 0xde },
> +	{ 0x3303, 0x02 }, { 0x3400, 0x00 }, { 0x323b, 0x02 }, { 0x3301, 0x00 },
> +	{ 0x3321, 0x04 }, { 0x3306, 0x00 }, { 0x3307, 0x08 }, { 0x3308, 0x0a },
> +	{ 0x3309, 0x27 }, { 0x330a, 0x01 }, { 0x330b, 0x01 }, { 0x330e, 0x00 },
> +	{ 0x330f, 0x08 }, { 0x3310, 0x07 }, { 0x3311, 0x9f }, { 0x3312, 0x01 },
> +	{ 0x3313, 0x01 },
> +};
> +
> +static const struct s5k5e8_mode default_mode = {
> +		.width = 2592, .height = 1944, .hts_def = 2856,
> +			.num_regs = ARRAY_SIZE(s5k5e8_2592x1944_regs),
> +		.regs = s5k5e8_2592x1944_regs,

There should be an endline after comma.

> +	};
> +
> +static const s64 link_freq_menu_items[] = { S5K5E8_LINK_FREQ_418MHZ };
> +
> +struct s5k5e8 {
> +	struct device *dev;
> +	struct v4l2_subdev sd;
> +	struct media_pad pad;
> +	struct clk *xvclk;
> +	struct gpio_desc *reset_gpio;
> +	struct regulator_bulk_data supplies[S5K5E8_NUM_SUPPLIES];
> +	struct v4l2_ctrl_handler ctrl_handler;
> +	struct v4l2_ctrl *link_freq, *hblank, *exposure;
> +	const struct s5k5e8_mode *cur_mode;
> +	/* Serialize access to sensor registers and streaming state */
> +	struct mutex mutex;
> +	bool streaming;
> +};
> +
> +static inline struct s5k5e8 *to_s5k5e8(struct v4l2_subdev *sd)
> +{
> +	return container_of(sd, struct s5k5e8, sd);
> +}
> +
> +static int s5k5e8_read_reg(struct s5k5e8 *s5k5e8, u16 reg, u32 len, u32 *val)
> +{
> +	struct i2c_client *client = v4l2_get_subdevdata(&s5k5e8->sd);
> +	struct i2c_msg msgs[2];
> +	u8 addr_buf[2], data_buf[4] = { 0 };
> +	int ret;
> +
> +	put_unaligned_be16(reg, addr_buf);
> +	msgs[0].addr = client->addr;
> +	msgs[0].flags = 0;
> +	msgs[0].len = 2;
> +	msgs[0].buf = addr_buf;
> +	msgs[1].addr = client->addr;
> +	msgs[1].flags = I2C_M_RD;
> +	msgs[1].len = len;
> +	msgs[1].buf = &data_buf[4 - len];
> +	ret = i2c_transfer(client->adapter, msgs, 2);
> +	if (ret != 2)
> +		return ret < 0 ? ret : -EIO;
> +	*val = get_unaligned_be32(data_buf);
> +	return 0;
> +}

Remove it, and use CCI interfaces.

-- 
Best wishes,
Vladimir

  reply	other threads:[~2026-11-27 17:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <__OIHsqpwOqb8kxVYcd2PoPvNYDhN8XO6vyXiYMCCK6o3sfyJ1gl1GNdhcGYhdfBf43tQmn6Dt6cWXcSD1uiPA==@protonmail.internalid>
2026-11-27 13:45 ` [PATCH v5 0/7] Enable front and rear cameras on Xiaomi Mi A1 (tissot) Hikmah Gumelar
2026-11-27 13:45   ` [PATCH v5 1/7] clk: qcom: gcc-msm8953: fix csi_phytimer_clk_src 100MHz parent Hikmah Gumelar
2026-11-27 16:11     ` Bryan O'Donoghue
2026-11-27 16:57       ` Hikmah Gumelar
2026-11-27 13:45   ` [PATCH v5 2/7] media: dt-bindings: media: i2c: add Samsung S5K5E8 Hikmah Gumelar
2026-11-27 13:45   ` [PATCH v5 3/7] media: i2c: add s5k5e8 image sensor driver Hikmah Gumelar
2026-11-27 17:13     ` Vladimir Zapolskiy [this message]
2026-11-27 18:03     ` Sakari Ailus
2026-11-27 18:47       ` Hikmah Gumelar
2026-11-27 13:45   ` [PATCH v5 4/7] media: dt-bindings: media: i2c: add OmniVision OV12A10 Hikmah Gumelar
2026-11-27 13:45   ` [PATCH v5 5/7] media: i2c: add ov12a10 image sensor driver Hikmah Gumelar
2026-11-27 17:12     ` Vladimir Zapolskiy
2026-11-27 13:45   ` [PATCH v5 6/7] arm64: dts: qcom: msm8953: add CAMSS node and MCLK pinctrl states Hikmah Gumelar
2026-11-27 13:45   ` [PATCH v5 7/7] arm64: dts: qcom: msm8953-xiaomi-tissot: enable front and rear cameras Hikmah Gumelar
2026-11-27 16:14   ` [PATCH v5 0/7] Enable front and rear cameras on Xiaomi Mi A1 (tissot) Bryan O'Donoghue
2026-11-27 16:32     ` Hikmah Gumelar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ed19776-e8ed-438e-b946-7a83d9c318f0@linaro.org \
    --to=vladimir.zapolskiy@linaro.org \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bmasney+clk@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hikmahgumelar@gmail.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®