Skip to content

A variation of parameters to create composite PAL output with ms9120 chip via USB-CVBS adapter #37

@moonbaseDelta

Description

@moonbaseDelta

Hi there, for some reason it came interesting to me to use a chinese USB-CVBS Android-TV adapter with Linux. It's a generic device. A black box with two composite video-outs.

So, linux drivers weren't around. Only an apk for Android named 'ms9120.apk'. I checked Macro Silicon catalog and it seems to be the name of the exact chip inside the adapter.

For this project I'm using Debian Sid with this version on branch according to kernel: https://github.com/tiirwaa/ms912x
Vanilla installation does not work properly: the adapter not giving any EDID info so the driver fallbacks. That mode is not able to create composite output, however the device identified by a system as a working display.

#: uname -a
Linux <hostname> 6.16.12+deb14+1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.16.12-2 (2025-10-16) x86_64 GNU/Linux

#: dmesg -T | grep ms
...
usbcore: registered new interface driver ms912x
[drm] Initialized ms912x 0.0.1 for 1-1:1.3 on minor 1
ms912x: EDID not found, falling back to default mode 

At current time I'm no good with DRM-drivers but code examination helped me to identify places prominent for modificaion. Short story short - it works.

The patch is trivial:
I picked up some numbers for fallback-mode and screen parameters and set DRM-mode composite.

By now I'm not sure how to help the driver to identify that it deals with ms9120 or another chip from ms912x family which is not intended for HDMI and at the same time to keep all HDMI modes working.
And I don't know how many guys around who want to use the driver that way. So the ms9120-patch is presented as raw text bellow. If someone else need this and may help with code there will be a pull-request as a full-feature composite support.

So here are the ms9120-patch:

#: cat ms912x_drv.c

...
struct ms912x_mode ms912x_mode_list[] = {
        /* PAL ???  0x1100 */
        MS912X_MODE( 720,  576, 25, 0x1100, MS912X_PIXFMT_UYVY),  
       // ... other modes can be all commented out
};
...
#: cat ms912x_connector.c

...
static void ms912x_add_fallback_mode(struct drm_connector *connector)
{
        struct drm_display_mode *mode;

        mode = drm_mode_create(connector->dev);
        if (!mode)
                return;

        drm_mode_set_name(mode);
        mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;

        // clock, hsync, vsync, totals - are all picked by a guess
        mode->clock = 50000;
        mode->hdisplay = 720;
        mode->hsync_start = 730;
        mode->hsync_end = 736;
        mode->htotal = 780;
        mode->vdisplay = 576;
        mode->vsync_start = 579;
        mode->vsync_end = 585;
        mode->vtotal = 606;
        mode->flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC;

        drm_mode_probed_add(connector, mode);
}
...

int ms912x_connector_init(struct ms912x_device *ms912x)
{
        ...
        ret = drm_connector_init(&ms912x->drm, &ms912x->connector,
                                 &ms912x_connector_funcs,
                                 DRM_MODE_CONNECTOR_Composite); //DRM_MODE_CONNECTOR_HDMIA);
        ...
}
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions