您好,我这边创建一个相机的驱动程序,但是加载后发现没有生成/dev/video0,probe里面没有执行alg031_subdev_internal_ops,但tegracam_device_register函数等没有报错,加了日志,发现设备树映射的I2C地址和devnode也没有问题,请问我应该如何进一步排查呢?
static int alg031_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct device_node *node = dev->of_node;
struct tegracam_device *tc_dev;
struct alg031 *priv;
int err;
dev_info(dev,"alg031 probing v4l2 sensor at addr 0x%0x\n",client->addr);
if (!IS_ENABLED(CONFIG_OF) || !node)
return -EINVAL;
priv = devm_kzalloc(dev,sizeof(struct alg031), GFP_KERNEL);
if (!priv){
dev_err(dev,"unable to allocate memory!\n");
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, "alg031", sizeof(tc_dev->name));
tc_dev->dev_regmap_config = &sensor_regmap_config;
tc_dev->sensor_ops = &alg031_common_ops;
tc_dev->v4l2sd_internal_ops = &alg031_subdev_internal_ops;
tc_dev->tcctrl_ops = &alg031_ctrl_ops;
hello tiancai1234,
may I double confirm the Jetpack release version now you’re working with?
besides, is it your 1st time to bring-up alg031
? had you verified it on any previous Jetpack release, or other Jetson platforms?
使用36.2版本,alg031之前在35.2.1平台上使用过,现在移植过来
我在probe函数里面加了一些打印,发现能够正确识别设备树的devnode值是video0,但是我再进一步打印num_channels和port@0,却发现我设置的num_channels是8,但读取的是2,并且port@0也无法读取,我不知道是我打印的有问题,还是说设备树设置哪里不对,下面是dmesg日志,以及设备树和我加打印的部分源码
alg031 7-001a: alg031 probing v4l2 sensor at addr 0x1a
[ 78.958171] alg031 7-001a: Device node full name: alg031_a@1a
[ 78.958173] alg031 7-001a: I2C Bus: 7, I2C Adapter Name: c250000.i2c
[ 78.958175] alg031 7-001a: Device tree node devnode: video0
[ 78.958443] num-channels: 2
[ 78.958445] endpoint node not found in port@0
[ 78.958447] alg031 7-001a: Tegracam Device:
[ 78.958449] alg031 7-001a: Client Addr: 0x1a
[ 78.958450] alg031 7-001a: Device Name: alg031
[ 78.958451] alg031 7-001a: Sensor Ops: 0000000000000000
[ 78.958453] alg031 7-001a: V4L2 SD Internal Ops: 0000000000000000
[ 78.958454] alg031 7-001a: TC Control Ops: 0000000000000000
[ 78.958455] alg031 7-001a: V4L2 SD Internal Ops: 000000003729f4e3
// 查找 tegra-capture-vi 节点
vi_node = of_find_node_by_name(NULL, "tegra-capture-vi");
if (!vi_node) {
pr_err("tegra-capture-vi node not found\n");
return -ENODEV;
}
// 读取 num-channels 属性
if (of_property_read_u32(vi_node, "num-channels", &num_channels)) {
pr_err("Failed to read num-channels\n");
} else {
pr_info("num-channels: %u\n", num_channels);
}
// 遍历 tegra-capture-vi 节点的子节点
for_each_child_of_node(vi_node, child) {
// 查找 port@0 节点
if (of_node_name_eq(child, "port@0")) {
port_node = child;
break;
}
}
if (!port_node) {
pr_err("port@0 node not found\n");
} else {
// 查找 port@0 下的 endpoint 节点
struct device_node *endpoint_node = of_get_child_by_name(port_node, "endpoint");
if (endpoint_node) {
// 读取 vc-id 属性
if (of_property_read_u32(endpoint_node, "vc-id", &vc_id)) {
pr_err("Failed to read vc-id\n");
} else {
pr_info("vc-id of port@0: %u\n", vc_id);
}
} else {
pr_err("endpoint node not found in port@0\n");
}
}
i2c@c250000 {
alg031_a@1a {
compatible = "nvidia,alg031";
reg = <0x1a>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "15.0";
physical_h = "12.5";
sensor_model ="alg031";
post_crop_frame_drop = "0";
/* Convert Gain to unit of dB (decibel) befor passing to kernel driver */
use_decibel_gain = "true";
/* enable CID_SENSOR_MODE_ID for sensor modes selection */
use_sensor_mode_id = "true";
/ {
tegra-capture-vi {
num-channels = <8>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
alg031_vi_in0: endpoint {
vc-id = <0>;
port-index = <0>;
bus-width = <4>;
remote-endpoint = <&alg031_csi_out0>;
};
};
与正常的日志相比,发现缺少这一行打印
tegra-camrtc-capture-vi tegra-capture-vi: subdev alg031 0-001a bound
hello tiancai1234,
we may dig into your device tree settings. please disassembler the dtb file into text file for reference.
for instance, $ dtc -I dtb -O dts -o output.txt tegra234-xxx.dtb
output.txt (335.1 KB)
您好,这是反编译设备树的文件
hello tiancai1234,
it looks you’ve using two 4-lane CSI ports, (i.e. CSI-A/B and CSI-C/D), each of them running with 4 virtual channels.
is it a customization carrier board?
FYI, p3768 (Orin Nano DevKit carrier board) can work with 4-lane camera only on Cam0 slot,
we’re not support CSI-B in 4-lane config because of CSI clock limitations.
BTW,
there’re something wrong within your nvcsi@15a00000
node, it looks you did not utilize the port bindings correctly. please double check the node definitions.
system
Closed
September 10, 2024, 8:32am
11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.