Hi All,
I am migrating a camera driver (without using I2C) for Jetpack-4.5.1 to Jetpack-5.0.2 and facing following error :
[ 15.525536] toto 8-0010: probing v4l2 sensor without i2c.
[ 15.525658] toto 8-0010: tegra camera driver registration failed
Below is the probing function :
static int toto_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct device_node *node = client->dev.of_node;
struct tegracam_device *tc_dev;
struct toto *priv;
int err;
const struct of_device_id *match;
dev_info(dev, "probing v4l2 sensor without i2c.\n");
match = of_match_device(toto_of_match, dev);
if (!match) {
dev_err(dev, "No device match found\n");
return -ENODEV;
}
if (!IS_ENABLED(CONFIG_OF) || !node)
return -EINVAL;
priv = devm_kzalloc(dev,
sizeof(struct toto), GFP_KERNEL);
if (!priv)
return -ENOMEM;
tc_dev = devm_kzalloc(dev,
sizeof(struct tegracam_device), GFP_KERNEL);
if (!tc_dev)
return -ENOMEM;
priv->i2c_client = tc_dev->client = client;
tc_dev->dev = dev;
strncpy(tc_dev->name, "toto", sizeof(tc_dev->name));
tc_dev->dev_regmap_config = &toto_regmap_config;
tc_dev->sensor_ops = &toto_common_ops;
tc_dev->v4l2sd_internal_ops = &toto_subdev_internal_ops;
tc_dev->tcctrl_ops = &toto_ctrl_ops;
err = tegracam_device_register(tc_dev);
if (err) {
dev_err(dev, "tegra camera driver registration failed\n");
return err;
}
priv->tc_dev = tc_dev;
priv->s_data = tc_dev->s_data;
priv->subdev = &tc_dev->s_data->subdev;
tegracam_set_privdata(tc_dev, (void *)priv);
mutex_init(&priv->streaming_lock);
err = tegracam_v4l2subdev_register(tc_dev, true);
if (err) {
dev_err(dev, "tegra camera subdev registration failed\n");
return err;
}
dev_dbg(dev, "Detected TOTO sensor\n");
return 0;
}
and device-tree node:
i2c@31e0000 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
toto_a@10 {
compatible = "sony,toto";
/* I2C device address */
reg = <0x10>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "1.944";
physical_h = "1.097";
sensor_model = "toto";
use_sensor_mode_id = "false";
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
avdd-reg = "vana";
iovdd-reg = "vif";
dvdd-reg = "vdig";
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
/* mclk-index indicates the index of the */
/* mclk-name with in the clock-names array */
clocks = <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>,
<&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
clock-names = "extperiph1", "pllp_grtba";
status = "okay";
mclk = "extperiph1";
clock-frequency = <24000000>;
vana-supply = <&p3509_vdd_3v3_cvb>;
vdig-supply = <&p3509_vdd_sys_en>;
mode0 {
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1920";
active_h = "1080";
mode_type = "yuv";
pixel_phase = "uyvy";
pixel_t = "yuv_uyvy16";
dynamic_pixel_bit_depth = "16";
csi_pixel_bit_depth = "16";
readout_orientation = "0";
line_length = "1920";
inherent_gain = "1";
mclk_multiplier = "30";
pix_clk_hz = "742500000";
gain_factor = "10";
min_gain_val = "10";/* 1DB*/
max_gain_val = "160";/* 16DB*/
step_gain_val = "1";
default_gain = "10";
min_hdr_ratio = "1";
max_hdr_ratio = "1";
framerate_factor = "1000000";
min_framerate = "1816577";/*1.816577 */
max_framerate = "60000000";/*60fps*/
step_framerate = "1";
default_framerate = "60000000";/*60fps*/
exposure_factor = "1000000";
min_exp_time = "34";/* us */
max_exp_time = "550385";/* us */
step_exp_time = "1";
default_exp_time = "33334";/* us */
embedded_metadata_height = "0";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
toto_out0: endpoint {
status = "okay";
port-index = <0>; /* CSI A */
bus-width = <4>;
remote-endpoint = <&toto_csi_in0>;
};
};
};
};
};
I also updated the vi@xxx{} to tegra-capture-vi {} as per the following comment : Xavier NX MIPI CSI-2 without I2C from FPGA - #10 by ShaneCCC
I compared existing drivers btw the aforementioned Jetpacks such as kernel/nvidia/drivers/media/i2c/ov5693.c vs kernel/nvidia/drivers/media/i2c/nv_ov5693.c, kernel/nvidia/drivers/media/i2c/imx219.c vs kernel/nvidia/drivers/media/i2c/nv_imx219.c and kernel/nvidia/drivers/media/i2c/imx477.c vs kernel/nvidia/drivers/media/i2c/nv_imx477.c but did not see big evolution in probing function, except for :
static const struct regmap_config sensor_regmap_config = {
.reg_bits = 16,
.val_bits = 8,
.cache_type = REGCACHE_RBTREE,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
.use_single_rw = true,
#else
.use_single_read = true,
.use_single_write = true,
#endif
};
Could you help to point-out the potential issue, please ? Could it be related to enabling/disabling camera plugin that I haven’t touched ?
Best Regards,
K.