Re: [PATCH v8 1/1] [media] i2c: add support for OV13858 sensor
Hi Hyungwoo, [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.12-rc3 next-20170602] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Hyungwoo-Yang/i2c-add-support-for-OV13858-sensor/20170603-110225 base: git://linuxtv.org/media_tree.git master config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 6.2.0 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=ia64 All errors (new ones prefixed by >>): drivers/media//i2c/ov13858.c: In function 'ov13858_start_streaming': >> drivers/media//i2c/ov13858.c:1411:9: error: implicit declaration of function >> '__v4l2_ctrl_handler_setup' [-Werror=implicit-function-declaration] ret = __v4l2_ctrl_handler_setup(ov13858->sd.ctrl_handler); ^ cc1: some warnings being treated as errors vim +/__v4l2_ctrl_handler_setup +1411 drivers/media//i2c/ov13858.c 1405 if (ret) { 1406 dev_err(&client->dev, "%s failed to set mode\n", __func__); 1407 return ret; 1408 } 1409 1410 /* Apply customized values from user */ > 1411 ret = __v4l2_ctrl_handler_setup(ov13858->sd.ctrl_handler); 1412 if (ret) 1413 return ret; 1414 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
Re: [PATCH v8 1/1] [media] i2c: add support for OV13858 sensor
Hi Hyungwoo, On Fri, Jun 02, 2017 at 11:11:25AM -0700, Hyungwoo Yang wrote: ... > +static int ov13858_probe(struct i2c_client *client, > + const struct i2c_device_id *devid) > +{ > + struct ov13858 *ov13858; > + int ret; > + > + ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL); > + if (!ov13858) > + return -ENOMEM; > + > + /* Initialize subdev */ > + v4l2_i2c_subdev_init(&ov13858->sd, client, &ov13858_subdev_ops); > + > + /* Check module identity */ > + ret = ov13858_identify_module(ov13858); > + if (ret) { > + dev_err(&client->dev, "failed to find sensor: %d\n", ret); > + return ret; > + } > + > + /* Set default mode to max resolution */ > + ov13858->cur_mode = &supported_modes[0]; > + > + ret = ov13858_init_controls(ov13858); > + if (ret) > + return ret; > + > + /* Initialize subdev */ > + ov13858->sd.internal_ops = &ov13858_internal_ops; > + ov13858->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; > + ov13858->sd.entity.ops = &ov13858_subdev_entity_ops; > + ov13858->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; > + > + /* Initialize source pad */ > + ov13858->pad.flags = MEDIA_PAD_FL_SOURCE; > + ret = media_entity_pads_init(&ov13858->sd.entity, 1, &ov13858->pad); > + if (ret) { > + dev_err(&client->dev, "%s failed:%d\n", __func__, ret); > + goto error_handler_free; > + } > + > + ret = v4l2_async_register_subdev(&ov13858->sd); > + if (ret < 0) > + 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_get_noresume(&client->dev); > + pm_runtime_set_active(&client->dev); > + pm_runtime_enable(&client->dev); > + pm_runtime_put(&client->dev); As you're implying in the above code, pm_runtime_set_active() and pm_runtime_enable() alone aren't enough to power the device down after probe. Let's go with this for now and address it later. Acked-by: Sakari Ailus > + > + return 0; > + > +error_media_entity: > + media_entity_cleanup(&ov13858->sd.entity); > + > +error_handler_free: > + ov13858_free_controls(ov13858); > + dev_err(&client->dev, "%s failed:%d\n", __func__, ret); > + > + return ret; > +} > + > +static int ov13858_remove(struct i2c_client *client) > +{ > + struct v4l2_subdev *sd = i2c_get_clientdata(client); > + struct ov13858 *ov13858 = to_ov13858(sd); > + > + v4l2_async_unregister_subdev(sd); > + media_entity_cleanup(&sd->entity); > + ov13858_free_controls(ov13858); > + > + /* > + * Disable runtime PM but keep the device turned on. > + * i2c-core with ACPI domain PM will turn off the device. > + */ > + pm_runtime_get_sync(&client->dev); > + pm_runtime_disable(&client->dev); > + pm_runtime_set_suspended(&client->dev); > + pm_runtime_put_noidle(&client->dev); > + > + return 0; > +} -- Regards, Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
[PATCH v8 1/1] [media] i2c: add support for OV13858 sensor
This patch adds driver for Omnivision's ov13858 sensor, the driver supports following features: - manual exposure/analog gain - two link frequencies - VBLANK support - test pattern support - media controller support - runtime pm support - supported resolutions + 4224x3136 at 30FPS + 2112x1568 at 30FPS(default) and 60FPS + 2112x1188 at 30FPS(default) and 60FPS + 1056x784 at 30FPS(default) and 60FPS Signed-off-by: Hyungwoo Yang --- drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/ov13858.c | 1752 +++ 3 files changed, 1761 insertions(+) create mode 100644 drivers/media/i2c/ov13858.c diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index fd181c9..f8c5cca 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -589,6 +589,14 @@ config VIDEO_OV9650 This is a V4L2 sensor-level driver for the Omnivision OV9650 and OV9652 camera sensors. +config VIDEO_OV13858 + tristate "OmniVision OV13858 sensor support" + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on MEDIA_CAMERA_SUPPORT + ---help--- + This is a Video4Linux2 sensor-level driver for the OmniVision + OV13858 camera. + config VIDEO_VS6624 tristate "ST VS6624 sensor support" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 62323ec..3f4dc02 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -63,6 +63,7 @@ obj-$(CONFIG_VIDEO_OV5647) += ov5647.o obj-$(CONFIG_VIDEO_OV7640) += ov7640.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o obj-$(CONFIG_VIDEO_OV9650) += ov9650.o +obj-$(CONFIG_VIDEO_OV13858) += ov13858.o obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_VIDEO_MT9M111) += mt9m111.o obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c new file mode 100644 index 000..17127b5 --- /dev/null +++ b/drivers/media/i2c/ov13858.c @@ -0,0 +1,1752 @@ +/* + * Copyright (c) 2017 Intel Corporation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +#define OV13858_REG_VALUE_08BIT1 +#define OV13858_REG_VALUE_16BIT2 +#define OV13858_REG_VALUE_24BIT3 + +#define OV13858_REG_MODE_SELECT0x0100 +#define OV13858_MODE_STANDBY 0x00 +#define OV13858_MODE_STREAMING 0x01 + +#define OV13858_REG_SOFTWARE_RST 0x0103 +#define OV13858_SOFTWARE_RST 0x01 + +/* PLL1 generates PCLK and MIPI_PHY_CLK */ +#define OV13858_REG_PLL1_CTRL_00x0300 +#define OV13858_REG_PLL1_CTRL_10x0301 +#define OV13858_REG_PLL1_CTRL_20x0302 +#define OV13858_REG_PLL1_CTRL_30x0303 +#define OV13858_REG_PLL1_CTRL_40x0304 +#define OV13858_REG_PLL1_CTRL_50x0305 + +/* PLL2 generates DAC_CLK, SCLK and SRAM_CLK */ +#define OV13858_REG_PLL2_CTRL_B0x030b +#define OV13858_REG_PLL2_CTRL_C0x030c +#define OV13858_REG_PLL2_CTRL_D0x030d +#define OV13858_REG_PLL2_CTRL_E0x030e +#define OV13858_REG_PLL2_CTRL_F0x030f +#define OV13858_REG_PLL2_CTRL_12 0x0312 +#define OV13858_REG_MIPI_SC_CTRL0 0x3016 +#define OV13858_REG_MIPI_SC_CTRL1 0x3022 + +/* Chip ID */ +#define OV13858_REG_CHIP_ID0x300a +#define OV13858_CHIP_ID0x00d855 + +/* V_TIMING internal */ +#define OV13858_REG_VTS0x380e +#define OV13858_VTS_30FPS 0x0c8e /* 30 fps */ +#define OV13858_VTS_60FPS 0x0648 /* 60 fps */ +#define OV13858_VTS_MAX0x7fff +#define OV13858_VBLANK_MIN 56 + +/* Exposure control */ +#define OV13858_REG_EXPOSURE 0x3500 +#define OV13858_EXPOSURE_MIN 4 +#define OV13858_EXPOSURE_MAX (OV13858_VTS_MAX - 8) +#define OV13858_EXPOSURE_STEP 1 +#define OV13858_EXPOSURE_DEFAULT 0x640 + +/* Analog gain control */ +#define OV13858_REG_ANALOG_GAIN0x3508 +#define OV13858_ANA_GAIN_MIN 0 +#define OV13858_ANA_GAIN_MAX 0x1fff +#define OV13858_ANA_GAIN_STEP 1 +#define OV13858_ANA_GAIN_DEFAULT 0x80 + +/* Test Pattern Control */ +#define OV13858_REG_TEST_PATTERN 0x4503 +#define OV13858_TEST_PATTERN_ENABLEBIT(7) +#define OV13858_TEST_PATTERN_MASK