Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Driver for rockchip rk1000 tv encoder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  Copyright (C) 2017 Fuzhou Rockchip Electronics Co.Ltd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *  Author:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *      Algea Cao <algea.cao@rock-chips.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  This program is free software; you can redistribute  it and/or modify it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  under  the terms of  the GNU General  Public License as published by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  Free Software Foundation;  either version 2 of the  License, or (at your
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *  option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/mfd/syscon.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <drm/drm_atomic_helper.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <drm/drm_crtc_helper.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <drm/drm_of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <drm/drm_probe_helper.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include "../rockchip/rockchip_drm_drv.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define TVE_POWCR 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define TVE_OFF 0X07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define TVE_ON 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) static const struct drm_display_mode rk1000_cvbs_mode[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	{ DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 27000, 720, 732,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		   738, 864, 0, 576, 582, 588, 625, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		   0, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	{ DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 27000, 720, 736,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		   742, 858, 0, 480, 486, 492, 529, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		   0, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) struct rk1000_tve {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct i2c_client *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct drm_connector connector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct drm_bridge bridge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	struct drm_encoder *encoder;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	int mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	struct regmap *ctlmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	struct regmap *tvemap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	u32 preferred_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct rockchip_drm_sub_dev sub_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	CVBS_NTSC = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	CVBS_PAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) static const u8 pal_tve_regs[] = {0x06, 0x00, 0x00, 0x03, 0x00, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) static const u8 pal_ctl_regs[] = {0x41, 0x01};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) static const u8 ntsc_tve_regs[] = {0x00, 0x00, 0x00, 0x03, 0x00, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static const u8 ntsc_ctl_regs[] = {0x43, 0x01};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static const struct regmap_range rk1000_tve_volatile_ranges[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	{ .range_min = 0x00, .range_max = 0x05 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) static const struct regmap_access_table rk1000_tve_reg_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	.yes_ranges = rk1000_tve_volatile_ranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	.n_yes_ranges = ARRAY_SIZE(rk1000_tve_volatile_ranges),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) static const struct regmap_config rk1000_tve_regmap_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	.reg_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	.val_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	.cache_type = REGCACHE_RBTREE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	.volatile_table = &rk1000_tve_reg_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static const struct regmap_range rk1000_ctl_volatile_ranges[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	{ .range_min = 0x03, .range_max = 0x04 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) static const struct regmap_access_table rk1000_ctl_reg_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	.yes_ranges = rk1000_ctl_volatile_ranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.n_yes_ranges = ARRAY_SIZE(rk1000_ctl_volatile_ranges),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static const struct regmap_config rk1000_ctl_regmap_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	.reg_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	.val_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	.cache_type = REGCACHE_RBTREE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.volatile_table = &rk1000_ctl_reg_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static struct rk1000_tve *bridge_to_rk1000(struct drm_bridge *bridge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	return container_of(bridge, struct rk1000_tve, bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static struct rk1000_tve *connector_to_rk1000(struct drm_connector *connector)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	return container_of(connector, struct rk1000_tve, connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static int rk1000_tv_write_block(struct rk1000_tve *rk1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 				 u8 reg, const u8 *buf, u8 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	int i, ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	for (i = 0; i < len; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		ret = regmap_write(rk1000->tvemap, reg + i, buf[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static int rk1000_control_write_block(struct rk1000_tve *rk1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 				      u8 reg, const u8 *buf, u8 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	int i, ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	for (i = 0; i < len; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		ret = regmap_write(rk1000->ctlmap, reg + i, buf[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static int rk1000_mode_set(struct rk1000_tve *rk1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	const u8 *tv_regs, *control_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	switch (rk1000->mode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	case CVBS_PAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		dev_dbg(rk1000->dev, "rk1000 PAL\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		tv_regs = pal_tve_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		control_regs = pal_ctl_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	case CVBS_NTSC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		dev_dbg(rk1000->dev, "rk1000 NTSC\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		tv_regs = ntsc_tve_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		control_regs = ntsc_ctl_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		dev_dbg(rk1000->dev, "mode select err\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	ret = rk1000_tv_write_block(rk1000, 0, tv_regs, 6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		dev_err(rk1000->dev, "rk1000_tv_write_block err!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	ret = rk1000_control_write_block(rk1000, 0x03, control_regs, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		dev_err(rk1000->dev, "rk1000 control write block err\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static int rk1000_tve_disable(struct rk1000_tve *rk1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	u8 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	val = TVE_OFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	ret = rk1000_tv_write_block(rk1000, TVE_POWCR, &val, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) static int rk1000_tve_enable(struct rk1000_tve *rk1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	u8 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	dev_dbg(rk1000->dev, "%s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	ret = rk1000_mode_set(rk1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	val = TVE_ON;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	ret = rk1000_tv_write_block(rk1000, TVE_POWCR, &val, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) static enum drm_mode_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) rk1000_mode_valid(struct drm_connector *connector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		  struct drm_display_mode *mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	return MODE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) rk1000_get_modes(struct drm_connector *connector)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	struct rk1000_tve *rk1000 = connector_to_rk1000(connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	for (count = 0; count < ARRAY_SIZE(rk1000_cvbs_mode); count++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		struct drm_display_mode *mode_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		mode_ptr = drm_mode_duplicate(connector->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 					      &rk1000_cvbs_mode[count]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		if (!mode_ptr) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 			dev_err(rk1000->dev, "mode duplicate failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		if (rk1000->preferred_mode == count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			mode_ptr->type |= DRM_MODE_TYPE_PREFERRED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		drm_mode_probed_add(connector, mode_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) static enum drm_connector_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) rk1000_connector_detect(struct drm_connector *connector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			bool force)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	return connector_status_connected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static struct drm_encoder *rk1000_best_encoder(struct drm_connector *connector)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	struct rk1000_tve *rk1000 = connector_to_rk1000(connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	return rk1000->encoder;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) static
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) const struct drm_connector_helper_funcs rk1000_connector_helper_funcs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	.get_modes = rk1000_get_modes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	.mode_valid = rk1000_mode_valid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	.best_encoder = rk1000_best_encoder,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) static const struct drm_connector_funcs rk1000_connector_funcs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	.fill_modes = drm_helper_probe_single_connector_modes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	.detect = rk1000_connector_detect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	.destroy = drm_connector_cleanup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	.reset = drm_atomic_helper_connector_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) static void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) rk1000_bridge_mode_set(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		       const struct drm_display_mode *mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		       const struct drm_display_mode *adjusted_mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	struct rk1000_tve *rk1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	rk1000 = bridge_to_rk1000(bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	dev_dbg(rk1000->dev, "encoder mode set:%s\n", adjusted_mode->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	if (adjusted_mode->vdisplay == 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		rk1000->mode = CVBS_PAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		rk1000->mode = CVBS_NTSC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static void rk1000_bridge_enable(struct drm_bridge *bridge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	struct rk1000_tve *rk1000 = bridge_to_rk1000(bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	dev_dbg(rk1000->dev, "%s\n",  __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	ret = rk1000_tve_enable(rk1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		dev_err(rk1000->dev, "rk1000 enable failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) static void rk1000_bridge_disable(struct drm_bridge *bridge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	struct rk1000_tve *rk1000 = bridge_to_rk1000(bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	dev_dbg(rk1000->dev, "%s\n",  __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	rk1000_tve_disable(rk1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) static int rk1000_bridge_attach(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 				enum drm_bridge_attach_flags flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	struct rk1000_tve *rk1000 = bridge_to_rk1000(bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	if (!bridge->encoder) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 		dev_err(rk1000->dev, "Parent encoder object not found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	rk1000->encoder = bridge->encoder;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	drm_connector_helper_add(&rk1000->connector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 				 &rk1000_connector_helper_funcs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	ret = drm_connector_init(bridge->dev, &rk1000->connector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 				 &rk1000_connector_funcs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 				 DRM_MODE_CONNECTOR_TV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		dev_err(rk1000->dev, "Failed to initialize connector\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	ret = drm_connector_attach_encoder(&rk1000->connector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 					   bridge->encoder);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 		dev_err(rk1000->dev, "rk1000 attach failed ret:%d", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	rk1000->sub_dev.connector = &rk1000->connector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	rk1000->sub_dev.of_node = rk1000->dev->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	rockchip_drm_register_sub_dev(&rk1000->sub_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) static void rk1000_bridge_detach(struct drm_bridge *bridge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	struct rk1000_tve *rk1000 = bridge_to_rk1000(bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	rockchip_drm_unregister_sub_dev(&rk1000->sub_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static struct drm_bridge_funcs rk1000_bridge_funcs = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	.enable = rk1000_bridge_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	.disable = rk1000_bridge_disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	.mode_set = rk1000_bridge_mode_set,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	.attach = rk1000_bridge_attach,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	.detach = rk1000_bridge_detach,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) static int rk1000_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 			const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	struct device_node *np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	struct device_node *ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	struct rk1000_tve *rk1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	struct i2c_client *ctl_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	rk1000 = devm_kzalloc(&client->dev, sizeof(*rk1000), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	if (!rk1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	np = client->dev.of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	rk1000->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	rk1000->dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	rk1000->mode = CVBS_PAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	rk1000->tvemap = devm_regmap_init_i2c(client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 					      &rk1000_tve_regmap_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	if (IS_ERR(rk1000->tvemap)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		ret = PTR_ERR(rk1000->tvemap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		dev_err(rk1000->dev, "Failed to initialize tve regmap: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 			ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	ctl = of_parse_phandle(np, "rockchip,ctl", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	if (!ctl) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		dev_err(rk1000->dev, "rk1000 can't find control node\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	ctl_client = of_find_i2c_device_by_node(ctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	if (!ctl_client) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		dev_err(rk1000->dev, "rk1000 can't find control client\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		return -EPROBE_DEFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	rk1000->ctlmap = devm_regmap_init_i2c(ctl_client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 					      &rk1000_ctl_regmap_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	if (IS_ERR(rk1000->ctlmap)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 		ret = PTR_ERR(rk1000->ctlmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 		dev_err(rk1000->dev, "Failed to initialize ctl regmap: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 			ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	ret = of_property_read_u32(np, "rockchip,tvemode",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 				   &rk1000->preferred_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 		rk1000->preferred_mode = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	} else if (rk1000->preferred_mode > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 		dev_err(rk1000->dev, "rk1000 tve mode value invalid\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	rk1000->bridge.funcs = &rk1000_bridge_funcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	rk1000->bridge.of_node = rk1000->dev->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	drm_bridge_add(&rk1000->bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	i2c_set_clientdata(client, rk1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	dev_dbg(rk1000->dev, "rk1000 probe ok\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) static int rk1000_remove(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	struct rk1000_tve *rk1000 = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	drm_bridge_remove(&rk1000->bridge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) static const struct i2c_device_id rk1000_i2c_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	{ "rk1000-tve", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) MODULE_DEVICE_TABLE(i2c, rk1000_i2c_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) static const struct of_device_id rk1000_dt_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	{ .compatible = "rockchip,rk1000-tve" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) MODULE_DEVICE_TABLE(of, rk1000_dt_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) static struct i2c_driver rk1000_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 		.name = "rk1000-tve",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 		.of_match_table = of_match_ptr(rk1000_dt_ids),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	.id_table = rk1000_i2c_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	.probe = rk1000_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	.remove = rk1000_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) module_i2c_driver(rk1000_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) MODULE_AUTHOR("Algea Cao <Algea.cao@rock-chips.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) MODULE_DESCRIPTION("ROCKCHIP RK1000 Driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) MODULE_LICENSE("GPL v2");