27 #include <linux/module.h>
33 static void ch7006_encoder_set_config(
struct drm_encoder *encoder,
41 static void ch7006_encoder_destroy(
struct drm_encoder *encoder)
70 static void ch7006_encoder_save(
struct drm_encoder *encoder)
72 struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
80 static void ch7006_encoder_restore(
struct drm_encoder *encoder)
82 struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
90 static bool ch7006_encoder_mode_fixup(
struct drm_encoder *encoder,
104 static int ch7006_encoder_mode_valid(
struct drm_encoder *encoder,
113 static void ch7006_encoder_mode_set(
struct drm_encoder *encoder,
117 struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
180 struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
218 encoder->
dev->mode_config.tv_subconnector_property,
225 static int ch7006_encoder_get_modes(
struct drm_encoder *encoder,
246 static int ch7006_encoder_create_resources(
struct drm_encoder *encoder,
279 static int ch7006_encoder_set_property(
struct drm_encoder *encoder,
284 struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
289 bool modes_changed =
false;
322 modes_changed =
true;
351 modes_changed =
true;
367 crtc->
funcs->set_config(&modeset);
375 .set_config = ch7006_encoder_set_config,
376 .destroy = ch7006_encoder_destroy,
377 .dpms = ch7006_encoder_dpms,
378 .save = ch7006_encoder_save,
379 .restore = ch7006_encoder_restore,
380 .mode_fixup = ch7006_encoder_mode_fixup,
381 .mode_valid = ch7006_encoder_mode_valid,
382 .mode_set = ch7006_encoder_mode_set,
383 .detect = ch7006_encoder_detect,
384 .get_modes = ch7006_encoder_get_modes,
385 .create_resources = ch7006_encoder_create_resources,
386 .set_property = ch7006_encoder_set_property,
408 ch7006_info(client,
"Detected version ID: %x\n", val);
418 ch7006_err(client,
"Error %d reading version ID\n", ret);
423 static int ch7006_remove(
struct i2c_client *client)
430 static int ch7006_resume(
struct device *
dev)
441 static int ch7006_encoder_init(
struct i2c_client *client,
477 if (i == NUM_TV_NORMS)
478 ch7006_err(client,
"Invalid TV norm setting \"%s\".\n",
485 ch7006_err(client,
"Invalid scale setting \"%d\".\n",
497 static const struct dev_pm_ops ch7006_pm_ops = {
498 .resume = ch7006_resume,
503 .probe = ch7006_probe,
504 .remove = ch7006_remove,
508 .pm = &ch7006_pm_ops,
511 .id_table = ch7006_ids,
514 .encoder_init = ch7006_encoder_init,
520 static int __init ch7006_init(
void)
522 return drm_i2c_encoder_register(
THIS_MODULE, &ch7006_driver);
525 static void __exit ch7006_exit(
void)
527 drm_i2c_encoder_unregister(&ch7006_driver);
537 "\t\tSupported: PAL, PAL-M, PAL-N, PAL-Nc, PAL-60, NTSC-M, NTSC-J.\n"
543 "\t\tSupported: 0 -> Select video modes with a higher blanking ratio.\n"
544 "\t\t\t1 -> Select default video modes.\n"
545 "\t\t\t2 -> Select video modes with a lower blanking ratio.");