lkml.org 
[lkml]   [2022]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v2 09/41] drm/connector: Add TV standard property
    From


    Den 29.08.2022 15.11, skrev Maxime Ripard:
    > The TV mode property has been around for a while now to select and get the
    >
    > current TV mode output on an analog TV connector.
    >
    >
    >
    > Despite that property name being generic, its content isn't and has been
    >
    > driver-specific which makes it hard to build any generic behaviour on top
    >
    > of it, both in kernel and user-space.
    >
    >
    >
    > Let's create a new bitmask tv norm property, that can contain any of the
    >
    > analog TV standards currently supported by kernel drivers. Each driver can
    >
    > then pass in a bitmask of the modes it supports.
    >
    >
    >
    > We'll then be able to phase out the older tv mode property.
    >
    >
    >
    > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    >
    >
    >

    > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c

    > +/**
    >
    > + * drm_mode_create_tv_properties - create TV specific connector properties
    >
    > + * @dev: DRM device
    >
    > + * @supported_tv_modes: Bitmask of TV modes supported (See DRM_MODE_TV_MODE_*)
    >
    > +
    >
    > + * Called by a driver's TV initialization routine, this function creates
    >
    > + * the TV specific connector properties for a given device. Caller is
    >
    > + * responsible for allocating a list of format names and passing them to
    >
    > + * this routine.
    >
    > + *
    >
    > + * Returns:
    >
    > + * 0 on success or a negative error code on failure.
    >
    > + */
    >
    > +int drm_mode_create_tv_properties(struct drm_device *dev,
    >
    > + unsigned int supported_tv_modes)
    >
    > +{
    >
    > + struct drm_prop_enum_list tv_mode_list[DRM_MODE_TV_MODE_MAX];
    >
    > + struct drm_property *tv_mode;
    >
    > + unsigned int i, len = 0;
    >
    > +
    >

    Can you add a check here like in the legacy version:

    if (dev->mode_config.tv_mode_property)
    return 0;

    This way it's possible to call this multiple times. Like in drm/gud
    during connector init if there are multiple TV connectors or if a device
    with multiple IP blocks should show up.

    Noralf.

    > + for (i = 0; i < DRM_MODE_TV_MODE_MAX; i++) {
    >
    > + if (!(supported_tv_modes & BIT(i)))
    >
    > + continue;
    >
    > +
    >
    > + tv_mode_list[len].type = i;
    >
    > + tv_mode_list[len].name = drm_get_tv_mode_name(i);
    >
    > + len++;
    >
    > + }
    >
    > +
    >
    > + tv_mode = drm_property_create_enum(dev, 0, "TV mode",
    >
    > + tv_mode_list, len);
    >
    > + if (!tv_mode)
    >
    > + return -ENOMEM;
    >
    > +
    >
    > + dev->mode_config.tv_mode_property = tv_mode;
    >
    > +
    >
    > + return drm_mode_create_tv_properties_legacy(dev, 0, NULL);
    >
    > +}
    >
    > +EXPORT_SYMBOL(drm_mode_create_tv_properties);
    >

    \
     
     \ /
      Last update: 2022-09-05 12:20    [W:4.156 / U:0.152 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site