Ejemplo n.º 1
0
void av_det_irq_init(struct aml_av_det_platform_data *pdata)
{
	if (pdata->irq_in_num && pdata->irq_out_num) {
		gpio_for_irq(pdata->interrupt_pin,
				AML_GPIO_IRQ(pdata->irq_in_num, FILTER_NUM7,
					GPIO_IRQ_FALLING));
		gpio_for_irq(pdata->interrupt_pin,
				AML_GPIO_IRQ(pdata->irq_out_num, FILTER_NUM7,
					GPIO_IRQ_RISING));
		printk(KERN_INFO"av_det_irq_init in:%d out:%d\n",pdata->irq_in_num,pdata->irq_out_num);
	}
}
Ejemplo n.º 2
0
// get gpio configuration from device tree.
static void aml_config_gpio_irq(void)
{
	int ret = 0;
	unsigned int gpio_irq;

	gpio_irq = devinfo->config.gpio_intr;
	ret = amlogic_gpio_request(gpio_irq, gMhlI2cIdTable[0].name);
	ret |= amlogic_gpio_direction_input(gpio_irq, gMhlI2cIdTable[0].name);
	ret |= amlogic_gpio_to_irq(gpio_irq, gMhlI2cIdTable[0].name, AML_GPIO_IRQ((gMhlDevice.pI2cClient->irq-INT_GPIO_0),FILTER_NUM7,GPIO_IRQ_LOW));
	printk("sii5293 config gpio_irq, irq = %d, ret = %d\n",gMhlDevice.pI2cClient->irq, ret);

	return ;
}
Ejemplo n.º 3
0
int meson_cvbs_init(struct drm_device *dev)
{
	struct device *d = dev->dev;
	const char *str;
	int ret;

	ret = of_property_read_string(d->of_node, "cvbs_pal_gpio", &str);
	if (ret < 0) {
		dev_warn(d, "Failed to read property \"cvbs_pal_gpio\"\n");
		goto out;
	}
	gpio_pal = amlogic_gpio_name_map_num(str);
	if (gpio_pal < 0) {
		dev_warn(d, "Failed to map cvbs_pal_gpio to a GPIO number\n");
		goto out;
	}
	ret = amlogic_gpio_request_one(gpio_pal, GPIOF_IN,
			"mesondrm pal");
	if (ret < 0) {
		dev_warn(d, "Failed to request cvbs_pal_gpio\n");
		goto out;
	}
	ret = amlogic_set_pull_up_down(gpio_pal, 1, "mesondrm pal");
	if (ret < 0) {
		dev_warn(d, "Failed to up-down cvbs_pal_gpio\n");
		goto out;
	}

	ret = of_property_read_string(d->of_node, "cvbs_ntsc_gpio", &str);
	if (ret < 0) {
		dev_warn(d, "Failed to read property \"cvbs_ntsc_gpio\"\n");
		goto out;
	}
	gpio_ntsc = amlogic_gpio_name_map_num(str);
	if (gpio_pal < 0) {
		dev_warn(d, "Failed to map cvbs_ntsc_gpio to a GPIO number\n");
		goto out;
	}
	ret = amlogic_gpio_request_one(gpio_ntsc, GPIOF_IN,
				       "mesondrm ntsc");
	if (ret < 0) {
		dev_warn(d, "Failed to request cvbs_ntsc_gpio\n");
		goto out;
	}
	ret = amlogic_set_pull_up_down(gpio_ntsc, 1, "mesondrm ntsc");
	if (ret < 0) {
		dev_warn(d, "Failed to up-down cvbs_ntsc_gpio\n");
		goto out;
	}

	ret = amlogic_gpio_to_irq(gpio_pal, "mesondrm pal",
				  AML_GPIO_IRQ(2, FILTER_NUM7,
					       GPIO_IRQ_RISING));
	if (ret < 0) {
		dev_warn(d,
			 "Failed to get IRQ line for cvbs_pal_gpio rising\n");
		goto out;
	}
	ret = amlogic_gpio_to_irq(gpio_pal, "mesondrm pal",
				  AML_GPIO_IRQ(1, FILTER_NUM7,
					       GPIO_IRQ_FALLING));
	if (ret < 0) {
		dev_warn(d,
			 "Failed to get IRQ line for cvbs_pal_gpio falling\n");
		goto out;
	}

	meson_cvbs_work.dev = dev;
	INIT_DELAYED_WORK(&meson_cvbs_work.work, cvbs_switch_work_func);

	ret = devm_request_threaded_irq(d, INT_GPIO_2, NULL,
					cvbs_switch_intr_handler, IRQF_ONESHOT,
					"mesondrm pal", &meson_cvbs_work);
	if (ret < 0) {
		dev_warn(d, "Failed to claim cvbs_pal_gpio rising IRQ\n");
		goto out;
	}
	ret = devm_request_threaded_irq(d, INT_GPIO_1, NULL,
					cvbs_switch_intr_handler, IRQF_ONESHOT,
					"mesondrm pal", &meson_cvbs_work);
	if (ret < 0) {
		dev_warn(d, "Failed to claim cvbs_pal_gpio falling IRQ\n");
		goto out;
	}

out:
	return ret;
}
Ejemplo n.º 4
0
//#define gpio_dump
//#define pull_dump
//#define dire_dump
static int amlogic_gpio_probe(struct platform_device *pdev)
{
#ifdef CONFIG_OF_GPIO
		amlogic_gpio_chip.of_node = pdev->dev.of_node;
#endif

	amlogic_gpio_chip.base=0;
	amlogic_gpio_chip.ngpio=ARRAY_SIZE(amlogic_pins);
	gpiochip_add(&amlogic_gpio_chip);
	pullup_ops.meson_set_pullup=m8b_set_pullup;
	dev_info(&pdev->dev, "Probed amlogic GPIO driver\n");
#ifdef gpio_dump
	int gi;
	for(gi=0;gi<GPIO_MAX;gi++)
		printk("%s,amlogic_pins[%d]=%d,%d,out en reg=%x,bit=%d,out val reg=%x,bit=%d,input reg=%x,bit=%d\n",
		amlogic_pins[gi].name,gi,amlogic_pins[gi].num,
		gpio_amlogic_name_to_num(amlogic_pins[gi].name),
		(p_gpio_oen_addr[GPIO_REG(amlogic_pins[gi].out_en_reg_bit)]&0xffff)>>2,
		GPIO_BIT(amlogic_pins[gi].out_en_reg_bit),
		(p_gpio_output_addr[GPIO_REG(amlogic_pins[gi].out_value_reg_bit)]&0xffff)>>2,
		GPIO_BIT(amlogic_pins[gi].out_value_reg_bit),
		(p_gpio_input_addr[GPIO_REG(amlogic_pins[gi].input_value_reg_bit)]&0xffff)>>2,
		GPIO_BIT(amlogic_pins[gi].input_value_reg_bit)
	);
#endif
#ifdef irq_dump

	for(i=GPIO_IRQ0;i<GPIO_IRQ7+1;i++){
		gpio_flag=AML_GPIO_IRQ(i,FILTER_NUM7,GPIO_IRQ_HIGH);
		gpio_amlogic_to_irq(NULL,50);
	}
	for(i=GPIO_IRQ_HIGH;i<GPIO_IRQ_FALLING+1;i++){
		gpio_flag=AML_GPIO_IRQ(GPIO_IRQ0,FILTER_NUM7,i);
		gpio_amlogic_to_irq(NULL,50);
	}

#endif
#ifdef pull_dump

	int preg,pbit,penbit,pi;
	for(pi=0;pi<GPIO_TEST_N;pi++){
		m8b_pin_to_pullup(pi,&preg,&pbit,&penbit);
		printk("%s \t,pull up en reg:%x \t,enbit:%d \t,==,pull up reg:%x \t,bit:%d \t\n",
			amlogic_pins[pi].name,
			(p_pull_upen_addr[preg]&0xffff)>>2,
			penbit,
			(p_pull_up_addr[preg]&0xffff)>>2,
			pbit);
	}
#endif
#ifdef dire_dump
extern int m8b_pin_map_to_direction(unsigned int pin,unsigned int *reg,unsigned int *bit);
	int dreg,dbit,di;
	for(di=0;di<GPIO_TEST_N;di++){
		m8b_pin_map_to_direction(di,&dreg,&dbit);
		printk("%s \t,output en reg:%x \t,enbit:%d \t\n",
			amlogic_pins[di].name,
			(p_gpio_oen_addr[dreg]&0xffff)>>2,
			dbit);
	}
#endif
	return 0;
}