Thread (13 messages) 13 messages, 3 authors, 2021-09-17

Re: [RFC 1/3] media: tw9910: Allow to probe from device tree

From: Fabio Estevam <festevam@gmail.com>
Date: 2021-08-28 13:58:30

On Fri, Aug 27, 2021 at 10:02 AM Fabio Estevam [off-list ref] wrote:
Currently the driver only probes via platform data passed from
board file.

Allow to probe from device tree too.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Hi,

I am currently sending this series as RFC because I was
not able to get the TW9990 to work on a imx6sx board yet.

# media-ctl -p
Media controller API version 5.14.0

Media device information
------------------------
driver          imx7-csi
model           imx-media
serial
bus info
hw revision     0x0
driver version  5.14.0

Device topology
- entity 1: csi (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                <- "tw9910 2-0044":0 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: tw9910 2-0044 (1 pad, 1 link)
             type V4L2 subdev subtype Decoder flags 0
             device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:UYVY8_2X8/640x480 field:interlaced-bt colorspace:smpte170m
                 crop.bounds:(0,0)/640x480
                 crop:(0,0)/640x480]
                -> "csi":0 [ENABLED,IMMUTABLE]

I get the following error when setting up the pipeline:

media-ctl -l "'tw9910 2-0044':0 -> 'csi':0[1]"
media-ctl -l "'csi':1 -> 'csi capture':0[1]"
media-ctl -v -V "'tw9910 2-0044':0 [fmt:UYVY8_2X8/800x480 field:any]"

Opening media device /dev/media0
Enumerating entities
Found 3 entities
Enumerating pads and links
Setting up format UYVY8_2X8 800x480 on pad tw9910 2-0044/0
Unable to set format: No such device or address (-6)
Unable to setup formats: No such device or address (6)

This -6 (ENXIO) error comes from:

tw9910_set_frame() ---> tw9910_mask_set() ---> i2c_smbus_read_byte_data():


static int tw9910_mask_set(struct i2c_client *client, u8 command,
                           u8 mask, u8 set)
{
        s32 val = i2c_smbus_read_byte_data(client, command);

I am able to dump TW9990 registers via i2cdetect and also via the probe
function, so I2C access is OK.

Not sure why I am getting these i2c_smbus_read_byte_data() errors.
I found the reason: the tw9910 driver was getting unpowered in the
incorrect place.
This problem was present prior to the DT conversion.

I will send a fix for it soon.

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help