예제 #1
0
static int rk32_lcdc_parse_dt(struct lcdc_device *lcdc_dev,
				     const void *blob)
{
	int order = FB0_WIN0_FB1_WIN1_FB2_WIN2;

	if (lcdc_dev->id == 0)
		lcdc_dev->node  = fdt_path_offset(blob, "lcdc0");
	else
		lcdc_dev->node  = fdt_path_offset(blob, "lcdc1");
	if (lcdc_dev->node < 0) {
		debug("rk32 lcdc node is not found\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob, lcdc_dev->node)) {
		debug("device lcdc is disabled\n");
		return -EPERM;
	}

	lcdc_dev->regs = fdtdec_get_addr(blob, lcdc_dev->node, "reg");
	order = fdtdec_get_int(blob, lcdc_dev->node,
			       "rockchip,fb-win-map", order);
	lcdc_dev->dft_win = order % 10;

	return 0;
}
예제 #2
0
static int rk818_parse_dt(const void* blob)
{
	int node, nd;
	struct fdt_gpio_state gpios[2];
	u32 bus, addr;
	int ret, i;

	node = fdt_node_offset_by_compatible(blob,
					0, COMPAT_ROCKCHIP_RK818);
	if (node < 0) {
		printf("can't find dts node for rk818\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		printf("device rk818 is disabled\n");
		return -1;
	}
	
	ret = fdt_get_i2c_info(blob, node, &bus, &addr);
	if (ret < 0) {
		printf("pmic rk818 get fdt i2c failed\n");
		return ret;
	}

	ret = rk818_i2c_probe(bus, addr);
	if (ret < 0) {
		printf("pmic rk818 i2c probe failed\n");
		return ret;
	}
	
	nd = fdt_get_regulator_node(blob, node);
	if (nd < 0)
		printf("%s: Cannot find regulators\n", __func__);
	else
		fdt_regulator_match(blob, nd, rk818_reg_matches,
					RK818_NUM_REGULATORS);
	
	for (i = 0; i < RK818_NUM_REGULATORS; i++) {
		if (rk818_reg_matches[i].boot_on && (rk818_reg_matches[i].min_uV == rk818_reg_matches[i].max_uV))
			ret = rk818_set_regulator_init(&rk818_reg_matches[i], i);
	}

	fdtdec_decode_gpios(blob, node, "gpios", gpios, 2);
	support_dc_chg = fdtdec_get_int(blob, node, "rk818,support_dc_chg",0);

	rk818.pmic = pmic_alloc();
	rk818.node = node;
	rk818.pmic->hw.i2c.addr = addr;
	rk818.pmic->bus = bus;
	debug("rk818 i2c_bus:%d addr:0x%02x\n", rk818.pmic->bus,
		rk818.pmic->hw.i2c.addr);

	return 0;
}
예제 #3
0
static int rk808_parse_dt(const void* blob)
{
	int node, parent, nd;
	u32 i2c_bus_addr, bus;
	int ret;
	fdt_addr_t addr;
	struct fdt_gpio_state gpios[2];
	node = fdt_node_offset_by_compatible(blob,
					0, COMPAT_ROCKCHIP_RK808);
	if (node < 0) {
		printf("can't find dts node for rk808\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		debug("device rk808 is disabled\n");
		return -1;
	}
	
	addr = fdtdec_get_addr(blob, node, "reg");
	fdtdec_decode_gpios(blob, node, "gpios", gpios, 2);
	
	parent = fdt_parent_offset(blob, node);
	if (parent < 0) {
		debug("%s: Cannot find node parent\n", __func__);
		return -1;
	}
	i2c_bus_addr = fdtdec_get_addr(blob, parent, "reg");
	bus = i2c_get_bus_num_fdt(i2c_bus_addr);
	ret = rk808_i2c_probe(bus, addr);
	if (ret < 0) {
		debug("pmic rk808 i2c probe failed\n");
		return ret;
	}
	
	nd = fdt_get_regulator_node(blob, node);
	if (nd < 0)
		printf("%s: Cannot find regulators\n", __func__);
	else
		fdt_regulator_match(blob, nd, rk808_reg_matches,
					RK808_NUM_REGULATORS);
	rk808.pmic = pmic_alloc();
	rk808.node = node;
	rk808.pmic->hw.i2c.addr = addr;
	rk808.pmic->bus = bus;
	rk808.pwr_hold.gpio = rk_gpio_base_to_bank(gpios[1].gpio & RK_GPIO_BANK_MASK) | 
				(gpios[1].gpio & RK_GPIO_PIN_MASK);
	rk808.pwr_hold.flags = !(gpios[1].flags  & OF_GPIO_ACTIVE_LOW);
	debug("rk808 i2c_bus:%d addr:0x%02x\n", rk808.pmic->bus,
		rk808.pmic->hw.i2c.addr);
	return 0;
	 
}
예제 #4
0
int ricoh619_parse_dt(const void* blob)
{
	int node, parent, nd;
	u32 i2c_bus_addr, bus;
	int ret;
	fdt_addr_t addr;
	node = fdt_node_offset_by_compatible(blob, 0,
					COMPAT_RICOH_RICOH619);
	if (node < 0) {
		printf("can't find dts node for ricoh619\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		debug("device ricoh619 is disabled\n");
		return -1;
	}
	
	addr = fdtdec_get_addr(blob, node, "reg");
	parent = fdt_parent_offset(blob, node);
	if (parent < 0) {
		debug("%s: Cannot find node parent\n", __func__);
		return -1;
	}
	i2c_bus_addr = fdtdec_get_addr(blob, parent, "reg");
	bus = i2c_get_bus_num_fdt(i2c_bus_addr);
	ret = ricoh619_i2c_probe(bus, addr);
	if (ret < 0) {
		debug("pmic ricoh619 i2c probe failed\n");
		return ret;
	}
	nd = fdt_get_regulator_node(blob, node);
	if (nd < 0)
		printf("%s: Cannot find regulators\n", __func__);
	else
		fdt_regulator_match(blob, nd, ricoh619_regulator_matches,
					RICOH619_NUM_REGULATORS);
	ricoh619.pmic = pmic_alloc();
	ricoh619.node = node;
	ricoh619.pmic->hw.i2c.addr = addr;
	ricoh619.pmic->bus = bus;
	debug("ricoh619 i2c_bus:%d addr:0x%02x\n", ricoh619.pmic->bus,
		ricoh619.pmic->hw.i2c.addr);
	return 0;
	 
}
예제 #5
0
static int rt5025_parse_dt(const void* blob)
{
	int node, nd;
	u32 bus, addr;
	int ret;
	node = fdt_node_offset_by_compatible(blob,
					0, COMPAT_ROCKCHIP_RT5025);
	if (node < 0) {
		printf("can't find dts node for rt5025\n");
		return -ENODEV;
	}

	if (!fdt_device_is_available(blob,node)) {
		debug("device rt5025 is disabled\n");
		return -1;
	}
	
	ret = fdt_get_i2c_info(blob, node, &bus, &addr);
	if (ret < 0) {
		debug("pmic rt5025 get fdt i2c failed\n");
		return ret;
	}

	nd = rt5025_i2c_probe(bus, addr);
	if (nd < 0) {
		printf("pmic rt5025 i2c probe failed\n");
		return -1;
	}

	fdt_regulator_match(blob, nd, rt5025_reg_matches,
					RT5025_NUM_REGULATORS);
	
	rt5025.pmic = pmic_alloc();
	rt5025.node = node;
	rt5025.pmic->hw.i2c.addr = addr;
	rt5025.pmic->bus = bus;
	debug("rt5025 i2c_bus:%d addr:0x%02x\n", rt5025.pmic->bus,
		rt5025.pmic->hw.i2c.addr);

	return 0;
}
예제 #6
0
int rk3036_tve_init(vidinfo_t *panel)
{
	int val = 0;
	int node = 0;

#if defined(CONFIG_RKCHIP_RK3036)
	tve_s.reg_phy_base = 0x10118000 + 0x200;
	tve_s.soctype = SOC_RK3036;
//	printf("%s start soc is 3036\n", __func__);
#elif defined(CONFIG_RKCHIP_RK3128)
	tve_s.reg_phy_base = 0x1010e000 + 0x200;
	tve_s.soctype = SOC_RK312X;
	tve_s.saturation = 0;

	if (gd->fdt_blob)
	{
		node = fdt_node_offset_by_compatible(gd->fdt_blob,
			0, "rockchip,rk312x-tve");
		if (node < 0) {
			printf("can't find dts node for rk312x-tve\n");
			return -ENODEV;
		}

		if (!fdt_device_is_available(gd->fdt_blob, node)) {
			printf("rk312x-tve is disabled\n");
			return -EPERM;
		}

		tve_s.test_mode = fdtdec_get_int(gd->fdt_blob, node, "test_mode", 0);
		tve_s.saturation = fdtdec_get_int(gd->fdt_blob, node, "saturation", 0);

	}
	printf("test_mode=%d,saturation=0x%x\n", tve_s.test_mode, tve_s.saturation);
//	printf("%s start soc is 3128\n", __func__);
#endif

	rk3036_tve_init_panel(panel);

	if(g_tve_pos < 0)
	{
		g_tve_pos = TVOUT_DEAULT;
		printf("%s:use default config g_tve_pos = %d \n", __func__,g_tve_pos);
	}
	else
	{
		printf("%s:use baseparamer config g_tve_pos = %d \n", __func__,g_tve_pos);
	}

	if(g_tve_pos < 0)
	{
		g_tve_pos = TVOUT_DEAULT;
		printf("%s:use default config g_tve_pos = %d \n", __func__,g_tve_pos);
	}
	else
	{
		printf("%s:use baseparamer config g_tve_pos = %d \n", __func__,g_tve_pos);
	}

	dac_enable(0);
	tve_set_mode(g_tve_pos);
	dac_enable(1);


//	rk3036_tve_show_reg();
}