Home | History | Annotate | Line # | Download | only in drm
      1  1.1  riastrad /*	$NetBSD: drm_kms_helper_common.c,v 1.2 2021/12/18 23:44:57 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright  2015 Intel Corporation
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice (including the next
     14  1.1  riastrad  * paragraph) shall be included in all copies or substantial portions of the
     15  1.1  riastrad  * Software.
     16  1.1  riastrad  *
     17  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     20  1.1  riastrad  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21  1.1  riastrad  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     22  1.1  riastrad  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     23  1.1  riastrad  * IN THE SOFTWARE.
     24  1.1  riastrad  *
     25  1.1  riastrad  * Authors:
     26  1.1  riastrad  *    Rafael Antognolli <rafael.antognolli (at) intel.com>
     27  1.1  riastrad  *
     28  1.1  riastrad  */
     29  1.1  riastrad 
     30  1.1  riastrad #include <sys/cdefs.h>
     31  1.1  riastrad __KERNEL_RCSID(0, "$NetBSD: drm_kms_helper_common.c,v 1.2 2021/12/18 23:44:57 riastradh Exp $");
     32  1.1  riastrad 
     33  1.1  riastrad #include <linux/module.h>
     34  1.1  riastrad 
     35  1.1  riastrad #include <drm/drm_print.h>
     36  1.1  riastrad 
     37  1.1  riastrad #include "drm_crtc_helper_internal.h"
     38  1.1  riastrad 
     39  1.1  riastrad MODULE_AUTHOR("David Airlie, Jesse Barnes");
     40  1.1  riastrad MODULE_DESCRIPTION("DRM KMS helper");
     41  1.1  riastrad MODULE_LICENSE("GPL and additional rights");
     42  1.1  riastrad 
     43  1.1  riastrad #if IS_ENABLED(CONFIG_DRM_LOAD_EDID_FIRMWARE)
     44  1.1  riastrad 
     45  1.1  riastrad /* Backward compatibility for drm_kms_helper.edid_firmware */
     46  1.1  riastrad static int edid_firmware_set(const char *val, const struct kernel_param *kp)
     47  1.1  riastrad {
     48  1.1  riastrad 	DRM_NOTE("drm_kms_helper.edid_firmware is deprecated, please use drm.edid_firmware instead.\n");
     49  1.1  riastrad 
     50  1.1  riastrad 	return __drm_set_edid_firmware_path(val);
     51  1.1  riastrad }
     52  1.1  riastrad 
     53  1.1  riastrad static int edid_firmware_get(char *buffer, const struct kernel_param *kp)
     54  1.1  riastrad {
     55  1.1  riastrad 	return __drm_get_edid_firmware_path(buffer, PAGE_SIZE);
     56  1.1  riastrad }
     57  1.1  riastrad 
     58  1.1  riastrad static const struct kernel_param_ops edid_firmware_ops = {
     59  1.1  riastrad 	.set = edid_firmware_set,
     60  1.1  riastrad 	.get = edid_firmware_get,
     61  1.1  riastrad };
     62  1.1  riastrad 
     63  1.1  riastrad module_param_cb(edid_firmware, &edid_firmware_ops, NULL, 0644);
     64  1.1  riastrad __MODULE_PARM_TYPE(edid_firmware, "charp");
     65  1.1  riastrad MODULE_PARM_DESC(edid_firmware,
     66  1.1  riastrad 		 "DEPRECATED. Use drm.edid_firmware module parameter instead.");
     67  1.1  riastrad 
     68  1.1  riastrad #endif
     69  1.1  riastrad 
     70  1.1  riastrad static int __init drm_kms_helper_init(void)
     71  1.1  riastrad {
     72  1.1  riastrad 	int ret;
     73  1.1  riastrad 
     74  1.1  riastrad 	/* Call init functions from specific kms helpers here */
     75  1.1  riastrad 	ret = drm_fb_helper_modinit();
     76  1.1  riastrad 	if (ret < 0)
     77  1.1  riastrad 		goto out;
     78  1.1  riastrad 
     79  1.1  riastrad 	ret = drm_dp_aux_dev_init();
     80  1.1  riastrad 	if (ret < 0)
     81  1.1  riastrad 		goto out;
     82  1.1  riastrad 
     83  1.1  riastrad out:
     84  1.1  riastrad 	return ret;
     85  1.1  riastrad }
     86  1.1  riastrad 
     87  1.1  riastrad static void __exit drm_kms_helper_exit(void)
     88  1.1  riastrad {
     89  1.1  riastrad 	/* Call exit functions from specific kms helpers here */
     90  1.1  riastrad 	drm_dp_aux_dev_exit();
     91  1.1  riastrad }
     92  1.1  riastrad 
     93  1.1  riastrad module_init(drm_kms_helper_init);
     94  1.1  riastrad module_exit(drm_kms_helper_exit);
     95