Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sony imx296 sensors support #5039

Merged
merged 11 commits into from May 20, 2022
95 changes: 95 additions & 0 deletions Documentation/devicetree/bindings/media/i2c/sony,imx296.yaml
@@ -0,0 +1,95 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/media/i2c/sony,imx296.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Sony IMX296 1/2.8-Inch CMOS Image Sensor

maintainers:
- Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Laurent Pinchart <laurent.pinchart@ideasonboard.com>

description: |-
The Sony IMX296 is a 1/2.9-Inch active pixel type CMOS Solid-state image
sensor with square pixel array and 1.58 M effective pixels. This chip
features a global shutter with variable charge-integration time. It is
programmable through I2C and 4-wire interfaces. The sensor output is
available via CSI-2 serial data output (1 Lane).

properties:
compatible:
const: sony,imx296

reg:
maxItems: 1

clocks:
maxItems: 1

clock-names:
description: Input clock (37.125 MHz, 54 MHz or 74.25 MHz)
items:
- const: inck

avdd-supply:
description: Analog power supply (3.3V)

dvdd-supply:
description: Digital power supply (1.2V)

ovdd-supply:
description: Interface power supply (1.8V)

reset-gpios:
description: Sensor reset (XCLR) GPIO
maxItems: 1

port:
$ref: /schemas/graph.yaml#/properties/port

required:
- compatible
- reg
- clocks
- clock-names
- avdd-supply
- dvdd-supply
- ovdd-supply
- port

additionalProperties: false

examples:
- |
#include <dt-bindings/gpio/gpio.h>

i2c {
#address-cells = <1>;
#size-cells = <0>;

imx296: camera-sensor@1a {
compatible = "sony,imx296";
reg = <0x1a>;

pinctrl-names = "default";
pinctrl-0 = <&camera_rear_default>;

clocks = <&gcc 90>;
clock-names = "inck";

avdd-supply = <&camera_vdda_3v3>;
dvdd-supply = <&camera_vddd_1v2>;
ovdd-supply = <&camera_vddo_1v8>;

reset-gpios = <&msmgpio 35 GPIO_ACTIVE_LOW>;

port {
imx296_ep: endpoint {
remote-endpoint = <&csiphy0_ep>;
};
};
};
};

...
9 changes: 9 additions & 0 deletions MAINTAINERS
Expand Up @@ -17497,6 +17497,15 @@ T: git git://linuxtv.org/media_tree.git
F: Documentation/devicetree/bindings/media/i2c/imx290.txt
F: drivers/media/i2c/imx290.c

SONY IMX296 SENSOR DRIVER
M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
L: linux-media@vger.kernel.org
S: Maintained
T: git git://linuxtv.org/media_tree.git
F: Documentation/devicetree/bindings/media/i2c/sony,imx296.yaml
F: drivers/media/i2c/imx296.c

SONY IMX319 SENSOR DRIVER
M: Bingbu Cao <bingbu.cao@intel.com>
L: linux-media@vger.kernel.org
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Expand Up @@ -104,6 +104,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
imx219.dtbo \
imx258.dtbo \
imx290.dtbo \
imx296.dtbo \
imx378.dtbo \
imx477.dtbo \
imx519.dtbo \
Expand Down
15 changes: 15 additions & 0 deletions arch/arm/boot/dts/overlays/README
Expand Up @@ -1979,6 +1979,21 @@ Params: 4lane Enable 4 CSI2 lanes. This requires a Compute
Compute Module (CSI0, i2c_vc, and cam0_reg).

naushir marked this conversation as resolved.
Show resolved Hide resolved

Name: imx296
Info: Sony IMX296 camera module.
Uses Unicam 1, which is the standard camera connector on most Pi
variants.
Load: dtoverlay=imx296,<param>=<val>
Params: rotation Mounting rotation of the camera sensor (0 or
180, default 180)
orientation Sensor orientation (0 = front, 1 = rear,
2 = external, default external)
media-controller Configure use of Media Controller API for
configuring the sensor (default on)
cam0 Adopt the default configuration for CAM0 on a
Compute Module (CSI0, i2c_vc, and cam0_reg).


Name: imx378
Info: Sony IMX378 camera module.
Uses Unicam 1, which is the standard camera connector on most Pi
Expand Down
103 changes: 103 additions & 0 deletions arch/arm/boot/dts/overlays/imx296-overlay.dts
@@ -0,0 +1,103 @@
// SPDX-License-Identifier: GPL-2.0-only
// Definitions for IMX296 camera module on VC I2C bus
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>

/{
compatible = "brcm,bcm2835";

fragment@0 {
target = <&i2c0if>;
__overlay__ {
status = "okay";
};
};

clk_frag: fragment@1 {
target = <&cam1_clk>;
__overlay__ {
status = "okay";
clock-frequency = <37125000>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an override for the clock frequency?

};
};

fragment@2 {
target = <&i2c0mux>;
__overlay__ {
status = "okay";
};
};

reg_frag: fragment@5 {
target = <&cam1_reg>;
cam_reg: __overlay__ {
startup-delay-us = <500000>;
};
};

i2c_frag: fragment@100 {
target = <&i2c_csi_dsi>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

imx296: imx296@1a {
compatible = "sony,imx296";
reg = <0x1a>;
status = "okay";

clocks = <&cam1_clk>;
clock-names = "inck";

avdd-supply = <&cam1_reg>; /* 3.3v */
dvdd-supply = <&cam_dummy_reg>; /* 1.8v */
ovdd-supply = <&cam_dummy_reg>; /* 1.2v */

rotation = <180>;
orientation = <2>;

port {
imx296_0: endpoint {
remote-endpoint = <&csi_ep>;
clock-lanes = <0>;
data-lanes = <1>;
clock-noncontinuous;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find reference in the datasheet as to whether the clock lane does drop to LP-11 during blanking or not. Ought to validate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, need clock-noncontinuous otherwise streaming does not behave.

link-frequencies =
/bits/ 64 <594000000>;
};
};
};
};
};

csi_frag: fragment@101 {
target = <&csi1>;
csi: __overlay__ {
status = "okay";
brcm,media-controller;

port {
csi_ep: endpoint {
remote-endpoint = <&imx296_0>;
clock-lanes = <0>;
data-lanes = <1>;
clock-noncontinuous;
};
};
};
};

__overrides__ {
rotation = <&imx296>,"rotation:0";
orientation = <&imx296>,"orientation:0";
media-controller = <&csi>,"brcm,media-controller?";
cam0 = <&i2c_frag>, "target:0=",<&i2c_vc>,
<&csi_frag>, "target:0=",<&csi0>,
<&clk_frag>, "target:0=",<&cam0_clk>,
<&imx296>, "clocks:0=",<&cam0_clk>,
<&imx296>, "VANA-supply:0=",<&cam0_reg>;
};
};
1 change: 1 addition & 0 deletions arch/arm/configs/bcm2709_defconfig
Expand Up @@ -928,6 +928,7 @@ CONFIG_VIDEO_ARDUCAM_PIVARIETY=m
CONFIG_VIDEO_IMX219=m
CONFIG_VIDEO_IMX258=m
CONFIG_VIDEO_IMX290=m
CONFIG_VIDEO_IMX296=m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course now the commit text is wrong ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arghhhhh

CONFIG_VIDEO_IMX477=m
CONFIG_VIDEO_IMX519=m
CONFIG_VIDEO_OV2311=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcm2711_defconfig
Expand Up @@ -944,6 +944,7 @@ CONFIG_VIDEO_ARDUCAM_PIVARIETY=m
CONFIG_VIDEO_IMX219=m
CONFIG_VIDEO_IMX258=m
CONFIG_VIDEO_IMX290=m
CONFIG_VIDEO_IMX296=m
naushir marked this conversation as resolved.
Show resolved Hide resolved
CONFIG_VIDEO_IMX477=m
CONFIG_VIDEO_IMX519=m
CONFIG_VIDEO_OV2311=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcmrpi_defconfig
Expand Up @@ -921,6 +921,7 @@ CONFIG_VIDEO_ARDUCAM_PIVARIETY=m
CONFIG_VIDEO_IMX219=m
CONFIG_VIDEO_IMX258=m
CONFIG_VIDEO_IMX290=m
CONFIG_VIDEO_IMX296=m
CONFIG_VIDEO_IMX477=m
CONFIG_VIDEO_IMX519=m
CONFIG_VIDEO_OV2311=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/bcm2711_defconfig
Expand Up @@ -950,6 +950,7 @@ CONFIG_VIDEO_ARDUCAM_PIVARIETY=m
CONFIG_VIDEO_IMX219=m
CONFIG_VIDEO_IMX258=m
CONFIG_VIDEO_IMX290=m
CONFIG_VIDEO_IMX296=m
CONFIG_VIDEO_IMX477=m
CONFIG_VIDEO_IMX519=m
CONFIG_VIDEO_OV2311=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/bcmrpi3_defconfig
Expand Up @@ -892,6 +892,7 @@ CONFIG_VIDEO_ARDUCAM_PIVARIETY=m
CONFIG_VIDEO_IMX219=m
CONFIG_VIDEO_IMX258=m
CONFIG_VIDEO_IMX290=m
CONFIG_VIDEO_IMX296=m
CONFIG_VIDEO_IMX477=m
CONFIG_VIDEO_IMX519=m
CONFIG_VIDEO_OV2311=m
Expand Down
12 changes: 12 additions & 0 deletions drivers/media/i2c/Kconfig
Expand Up @@ -828,6 +828,18 @@ config VIDEO_IMX290
To compile this driver as a module, choose M here: the
module will be called imx290.

config VIDEO_IMX296
tristate "Sony IMX296 sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on MEDIA_CAMERA_SUPPORT
select V4L2_FWNODE
help
This is a Video4Linux2 sensor driver for the Sony
IMX296 camera.

To compile this driver as a module, choose M here: the
module will be called imx296.

config VIDEO_IMX477
tristate "Sony IMX477 sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
Expand Down
1 change: 1 addition & 0 deletions drivers/media/i2c/Makefile
Expand Up @@ -128,6 +128,7 @@ obj-$(CONFIG_VIDEO_IMX219) += imx219.o
obj-$(CONFIG_VIDEO_IMX258) += imx258.o
obj-$(CONFIG_VIDEO_IMX274) += imx274.o
obj-$(CONFIG_VIDEO_IMX290) += imx290.o
obj-$(CONFIG_VIDEO_IMX296) += imx296.o
obj-$(CONFIG_VIDEO_IMX477) += imx477.o
obj-$(CONFIG_VIDEO_IMX319) += imx319.o
obj-$(CONFIG_VIDEO_IMX334) += imx334.o
Expand Down