#include <linux/i2c.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_connector.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_kunit_helpers.h>
#include <drm/drm_modes.h>
#include <drm/display/drm_hdmi_helper.h>
#include <kunit/test.h>
#include "../drm_crtc_internal.h"
struct drm_connector_init_priv { … };
static const struct drm_connector_hdmi_funcs dummy_hdmi_funcs = …;
static const struct drm_connector_funcs dummy_funcs = …;
static int dummy_ddc_xfer(struct i2c_adapter *adapter,
struct i2c_msg *msgs, int num)
{ … }
static u32 dummy_ddc_func(struct i2c_adapter *adapter)
{ … }
static const struct i2c_algorithm dummy_ddc_algorithm = …;
static void i2c_del_adapter_wrapper(void *ptr)
{ … }
static int drm_test_connector_init(struct kunit *test)
{ … }
static void drm_test_drmm_connector_init(struct kunit *test)
{ … }
static void drm_test_drmm_connector_init_null_ddc(struct kunit *test)
{ … }
static void drm_test_drmm_connector_init_type_valid(struct kunit *test)
{ … }
static const unsigned int drm_connector_init_type_valid_tests[] = …;
static void drm_connector_init_type_desc(const unsigned int *type, char *desc)
{ … }
KUNIT_ARRAY_PARAM(drm_connector_init_type_valid,
drm_connector_init_type_valid_tests,
drm_connector_init_type_desc);
static struct kunit_case drmm_connector_init_tests[] = …;
static struct kunit_suite drmm_connector_init_test_suite = …;
static void drm_test_connector_hdmi_init_valid(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_null_ddc(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_null_vendor(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_null_product(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_product_valid(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_product_length_exact(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_product_length_too_long(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_vendor_valid(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_vendor_length_too_long(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_bpc_invalid(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_bpc_null(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_bpc_8(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_bpc_10(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_bpc_12(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_formats_empty(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_formats_no_rgb(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_init_type_valid(struct kunit *test)
{ … }
static const unsigned int drm_connector_hdmi_init_type_valid_tests[] = …;
static void drm_connector_hdmi_init_type_desc(const unsigned int *type, char *desc)
{ … }
KUNIT_ARRAY_PARAM(drm_connector_hdmi_init_type_valid,
drm_connector_hdmi_init_type_valid_tests,
drm_connector_hdmi_init_type_desc);
static void drm_test_connector_hdmi_init_type_invalid(struct kunit *test)
{ … }
static const unsigned int drm_connector_hdmi_init_type_invalid_tests[] = …;
KUNIT_ARRAY_PARAM(drm_connector_hdmi_init_type_invalid,
drm_connector_hdmi_init_type_invalid_tests,
drm_connector_hdmi_init_type_desc);
static struct kunit_case drmm_connector_hdmi_init_tests[] = …;
static struct kunit_suite drmm_connector_hdmi_init_test_suite = …;
struct drm_get_tv_mode_from_name_test { … };
#define TV_MODE_NAME(_name, _mode) …
static void drm_test_get_tv_mode_from_name_valid(struct kunit *test)
{ … }
static const
struct drm_get_tv_mode_from_name_test drm_get_tv_mode_from_name_valid_tests[] = …;
static void
drm_get_tv_mode_from_name_valid_desc(const struct drm_get_tv_mode_from_name_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(drm_get_tv_mode_from_name_valid,
drm_get_tv_mode_from_name_valid_tests,
drm_get_tv_mode_from_name_valid_desc);
static void drm_test_get_tv_mode_from_name_truncated(struct kunit *test)
{
const char *name = "NTS";
int ret;
ret = drm_get_tv_mode_from_name(name, strlen(name));
KUNIT_EXPECT_LT(test, ret, 0);
};
static struct kunit_case drm_get_tv_mode_from_name_tests[] = …;
static struct kunit_suite drm_get_tv_mode_from_name_test_suite = …;
struct drm_hdmi_connector_get_broadcast_rgb_name_test { … };
#define BROADCAST_RGB_TEST(_kind, _name) …
static void drm_test_drm_hdmi_connector_get_broadcast_rgb_name(struct kunit *test)
{ … }
static const
struct drm_hdmi_connector_get_broadcast_rgb_name_test
drm_hdmi_connector_get_broadcast_rgb_name_valid_tests[] = …;
static void
drm_hdmi_connector_get_broadcast_rgb_name_valid_desc(const struct drm_hdmi_connector_get_broadcast_rgb_name_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(drm_hdmi_connector_get_broadcast_rgb_name_valid,
drm_hdmi_connector_get_broadcast_rgb_name_valid_tests,
drm_hdmi_connector_get_broadcast_rgb_name_valid_desc);
static void drm_test_drm_hdmi_connector_get_broadcast_rgb_name_invalid(struct kunit *test)
{
KUNIT_EXPECT_NULL(test, drm_hdmi_connector_get_broadcast_rgb_name(3));
};
static struct kunit_case drm_hdmi_connector_get_broadcast_rgb_name_tests[] = …;
static struct kunit_suite drm_hdmi_connector_get_broadcast_rgb_name_test_suite = …;
struct drm_hdmi_connector_get_output_format_name_test { … };
#define OUTPUT_FORMAT_TEST(_kind, _name) …
static void drm_test_drm_hdmi_connector_get_output_format_name(struct kunit *test)
{ … }
static const
struct drm_hdmi_connector_get_output_format_name_test
drm_hdmi_connector_get_output_format_name_valid_tests[] = …;
static void
drm_hdmi_connector_get_output_format_name_valid_desc(const struct drm_hdmi_connector_get_output_format_name_test *t,
char *desc)
{ … }
KUNIT_ARRAY_PARAM(drm_hdmi_connector_get_output_format_name_valid,
drm_hdmi_connector_get_output_format_name_valid_tests,
drm_hdmi_connector_get_output_format_name_valid_desc);
static void drm_test_drm_hdmi_connector_get_output_format_name_invalid(struct kunit *test)
{
KUNIT_EXPECT_NULL(test, drm_hdmi_connector_get_output_format_name(4));
};
static struct kunit_case drm_hdmi_connector_get_output_format_name_tests[] = …;
static struct kunit_suite drm_hdmi_connector_get_output_format_name_test_suite = …;
static void drm_test_drm_connector_attach_broadcast_rgb_property(struct kunit *test)
{ … }
static void drm_test_drm_connector_attach_broadcast_rgb_property_hdmi_connector(struct kunit *test)
{ … }
static struct kunit_case drm_connector_attach_broadcast_rgb_property_tests[] = …;
static struct kunit_suite drm_connector_attach_broadcast_rgb_property_test_suite = …;
static void drm_test_drm_hdmi_compute_mode_clock_rgb(struct kunit *test)
{ … }
static void drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc(struct kunit *test)
{ … }
static void drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1(struct kunit *test)
{ … }
static void drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc(struct kunit *test)
{ … }
static void drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1(struct kunit *test)
{ … }
static void drm_test_drm_hdmi_compute_mode_clock_rgb_double(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_compute_mode_clock_yuv420_valid(struct kunit *test)
{ … }
static const unsigned int drm_hdmi_compute_mode_clock_yuv420_vic_valid_tests[] = …;
static void drm_hdmi_compute_mode_clock_yuv420_vic_desc(const unsigned int *vic, char *desc)
{ … }
KUNIT_ARRAY_PARAM(drm_hdmi_compute_mode_clock_yuv420_valid,
drm_hdmi_compute_mode_clock_yuv420_vic_valid_tests,
drm_hdmi_compute_mode_clock_yuv420_vic_desc);
static void drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc(struct kunit *test)
{ … }
static void drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc(struct kunit *test)
{ … }
static struct kunit_case drm_hdmi_compute_mode_clock_tests[] = …;
static struct kunit_suite drm_hdmi_compute_mode_clock_test_suite = …;
kunit_test_suites(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;