Example #1
0
#define     CFG_TXBITS(tx)                      ((tx - 1)<<8)    /* 0x1F~0x1, 0x1: 2bits ... 0x1F: 32bits */
#define     CFG_SPI_ENA(spi)                    (spi<<3)
#define     CFG_SPI_SEL(spi)                    (spi<<2)   /* 1: port1; 0: port0 */
#define     CFG_SPI_3W4WB(wire)                 (wire<<1)  /* 1: 3-wire; 0: 4-wire */

static struct pxa910fb_mach_info u830_lcd_info __initdata = {
	.id                     = "Base",
	.modes                  = xinli_video_modes,
	.num_modes              = ARRAY_SIZE(xinli_video_modes),
	.pix_fmt                = PIX_FMT_RGB565,
	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
	.dumb_mode              = DUMB_MODE_RGB666,
	.active                 = 1,
	.spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(9) | CFG_SPI_SEL(1) | CFG_SPI_3W4WB(0) | CFG_SPI_ENA(1),
	.spi_gpio_cs            = -1,
	.spi_gpio_reset		= mfp_to_gpio(MFP_PIN_GPIO106),
	.panel_rbswap		= 1,
	.pxa910fb_lcd_power	= xinli_lcd_power_on,
	.invert_pixclock	= 1,
	.max_fb_size		= 1280 * 720 * 4,
};

static struct pxa910fb_mach_info u830_lcd_ovly_info __initdata = {
	.id                     = "Ovly",
	.modes                  = xinli_video_modes,
	.num_modes              = ARRAY_SIZE(xinli_video_modes),
	.pix_fmt                = PIX_FMT_RGB565,
	.io_pin_allocation_mode = PIN_MODE_DUMB_18_SPI,
	.dumb_mode              = DUMB_MODE_RGB666,
	.active                 = 1,
        .spi_ctrl               = CFG_SCLKCNT(16) | CFG_TXBITS(9) | CFG_SPI_SEL(1) | CFG_SPI_3W4WB(0) | CFG_SPI_ENA(1),
/*-- AT_Command[Flash mode] --*/
void __init init_samsung_cam(void)
{
	int ret;
	struct device *dev_r;
	struct device *dev_f;

	camera_flash_en = mfp_to_gpio(MFP_PIN_GPIO20);
	camera_flash_set = mfp_to_gpio(MFP_PIN_GPIO97);

	ret= s5k43_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----s5k43_pin_init --failed!!!--------\n");
		return;
	}

	ret= sr030pc30_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----sr030pc30_pin_init --failed!!!--------\n");
		return;
	}

	ret= subsensor_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----subsensor_pin_init --failed!!!--------\n");
		return;
	}

	platform_add_devices(ARRAY_AND_SIZE(camera_platform_devices));
	pxa988_add_cam(&mv_cam_data_forssg);

	if (camera_flash_en && gpio_request(camera_flash_en, "CAM_HI_SENSOR_PWD_20")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", camera_flash_en);
		camera_flash_en = 0;
		return;
	}
	if (camera_flash_set && gpio_request(camera_flash_set, "CAM_HI_SENSOR_PWD_8")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", camera_flash_set);
		camera_flash_set = 0;
		return;
	}

	/*++ AT_Command[Flash mode] : [email protected]_20121012 ++*/
	camera_class = class_create(THIS_MODULE, "camera");
	
	if (IS_ERR(camera_class)) 
	{
		printk("Failed to create camera_class!\n");
		return PTR_ERR( camera_class );
	}
	
	dev_f= device_create(camera_class, NULL, 0, "%s", "front");	
	if (device_create_file(dev_f, &dev_attr_front_type) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_front_type.attr.name);
	if (device_create_file(dev_f, &dev_attr_front_camfw) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_front_camfw.attr.name);

	dev_r = device_create(camera_class, NULL, 0, "%s", "rear");		
	if (device_create_file(dev_r, &dev_attr_rear_type) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_type.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_camfw) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_camfw.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_flash) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_flash.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_vendorid) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_vendorid.attr.name);

	/*-- AT_Command[Flash mode] --*/
}
/* sensor init */
static int sensor_power_set(int res, int flag)
{
	/*
	 * RES, 0, LOW RESOLUTION, 1 HIGH RESOLUTION
	 * FLAG, 1: ON, 0: OFF
	 * GPIO93 LOW FOR HIGH
	 * GPIO14 LOW FOR LOW
	 */
	int high_pin = mfp_to_gpio(MFP_PIN_GPIO39);
	int low_pin = mfp_to_gpio(MFP_PIN_GPIO40);

	int mipi_sw_sel_pin = mfp_to_gpio(MFP_PIN_GPIO49);
	int mipi_sw_noe_pin = mfp_to_gpio(MFP_PIN_GPIO48);

	cam_power_set(flag);

	if (gpio_request(mipi_sw_noe_pin, "MIPI_SW_NOE")) {
		printk(KERN_ERR "Request GPIO failed,"
			   "gpio: %d\n", mipi_sw_noe_pin);
		return -EIO;
	}
	if (gpio_request(mipi_sw_sel_pin, "MIPI_SW_SEL")) {
		printk(KERN_ERR "Request GPIO failed,"
			   "gpio: %d\n", mipi_sw_sel_pin);
		return -EIO;
	}

	if (res) {
		if (gpio_request(high_pin, "CAM_EANBLE_HI_SENSOR")) {
			printk(KERN_ERR "Request GPIO failed,"
			       "gpio: %d\n", high_pin);
			return -EIO;
		}
		if (flag) {
			gpio_direction_output(high_pin, 0);	/* enable */
			msleep(1);
			gpio_direction_output(mipi_sw_sel_pin, 0);
			gpio_direction_output(mipi_sw_noe_pin, 0);
		} else {
			gpio_direction_output(high_pin, 1);	/* disable */
			gpio_direction_output(mipi_sw_noe_pin, 1);
		}
		gpio_free(high_pin);

	} else {
		if (gpio_request(low_pin, "CAM_EANBLE_LOW_SENSOR")) {
			printk(KERN_ERR "Request GPIO failed,"
			       "gpio: %d\n", low_pin);
			return -EIO;
		}
		if (flag) {
			gpio_direction_output(low_pin, 0);	/* enable */
			msleep(1);
			gpio_direction_output(mipi_sw_sel_pin, 1);
			gpio_direction_output(mipi_sw_noe_pin, 0);
		} else {
			gpio_direction_output(low_pin, 1);	/* disable */
			gpio_direction_output(mipi_sw_noe_pin, 1);
		}
		gpio_free(low_pin);
	}
	gpio_free(mipi_sw_sel_pin);
	gpio_free(mipi_sw_noe_pin);
	return 0;
}
Example #4
0
#endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */

/* Ethernet support: Davicom DM9000 */
static struct resource dm9k_resources[] = {
	[0] = {
	       .start = MXM_8X10_ETH_PHYS + 0x300,
	       .end = MXM_8X10_ETH_PHYS + 0x300,
	       .flags = IORESOURCE_MEM
	},
	[1] = {
	       .start = MXM_8X10_ETH_PHYS + 0x308,
	       .end = MXM_8X10_ETH_PHYS + 0x308,
	       .flags = IORESOURCE_MEM
	},
	[2] = {
	       .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
	       .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
	       .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
	}
};

static struct dm9000_plat_data dm9k_plat_data = {
	.flags = DM9000_PLATF_16BITONLY
};

static struct platform_device dm9k_device = {
	.name = "dm9000",
	.id = 0,
	.num_resources = ARRAY_SIZE(dm9k_resources),
	.resource = dm9k_resources,
	.dev = {
static int gp2a_prox_probe(struct i2c_client *client,const struct i2c_device_id *id)
{
	int ret =0, out_pin;
	u8 reg_value;

	printk(KERN_INFO "[GP2A] %s start \n", __func__);

	prox_ctrl_regulator(1);
	
	/* Allocate driver_data */
	gp2a_data = kzalloc(sizeof(struct gp2a_prox_data),GFP_KERNEL);
	if(!gp2a_data)
	{
		error("kzalloc:allocating driver_data error");
		return -ENOMEM;		
	} 
	
	gp2a_data->gp2a_prox_i2c_client = client;
	i2c_set_clientdata(client, gp2a_data);
	
	/*misc device registration*/
    if( (ret = misc_register(&gp2a_prox_misc_device)) < 0 )
    {
		error("gp2a_prox driver misc_register failed");
		goto FREE_GP2A_DATA;
    }
	
	/*Input Device Settings*/
	gp2a_data->prox_input_dev = input_allocate_device();
	if (!gp2a_data->prox_input_dev) 
	{
		error("Not enough memory for gp2a_data->prox_input_dev");
		ret = -ENOMEM;
		goto MISC_DREG;
	}
	gp2a_data->prox_input_dev->name = "proximity_sensor";
	set_bit(EV_SYN,gp2a_data->prox_input_dev->evbit);
	set_bit(EV_ABS,gp2a_data->prox_input_dev->evbit);	
	input_set_abs_params(gp2a_data->prox_input_dev, ABS_DISTANCE, 0, 1, 0, 0);
	ret = input_register_device(gp2a_data->prox_input_dev);
	if (ret) 
	{
		error("Failed to register input device");
		input_free_device(gp2a_data->prox_input_dev);
		goto MISC_DREG;
	}
	debug("Input device settings complete");
    
#if USE_INTERRUPT	
	/* Workqueue Settings */
	gp2a_prox_wq = create_singlethread_workqueue("gp2a_prox_wq");
	if (!gp2a_prox_wq)
	{
		error("Not enough memory for gp2a_prox_wq");
		ret = -ENOMEM;
		goto INPUT_DEV_DREG;
	}    
	INIT_WORK(&gp2a_data->work_prox, gp2a_prox_work_func);
	debug("Workqueue settings complete");		


	/*Initialisation of GPIO_PS_OUT of proximity sensor*/
	out_pin = mfp_to_gpio(GPIO_PS_OUT);
	if (gpio_request(out_pin, "Proximity Out")) {
		printk(KERN_ERR "[GP2A] Proximity Request GPIO_%d failed!\n", out_pin);
	}
	
	gpio_direction_input(out_pin);
	gpio_free(out_pin);    
	mdelay(2);
    
	gp2a_data->irq = -1;	
	set_irq_type(PROX_IRQ, IRQ_TYPE_EDGE_FALLING);
	if( (ret = request_irq(PROX_IRQ, gp2a_irq_handler,IRQF_DISABLED | IRQF_NO_SUSPEND , "proximity_int", NULL )) )
	{
		error("GP2A request_irq failed IRQ_NO:%d", PROX_IRQ);
		goto DESTROY_WORK_QUEUE;
	} 
	else
		debug("GP2A request_irq success IRQ_NO:%d", PROX_IRQ);
	
	gp2a_data->irq = PROX_IRQ;	
#endif

	/* wake lock init */
	wake_lock_init(&prx_wake_lock, WAKE_LOCK_SUSPEND, "prx_wake_lock");

	timeA = ktime_set(0,0);
	timeB = ktime_set(0,0);
	
#if 0	
	/*create sysfs attributes*/
	ret = sysfs_create_group(&client->dev.kobj, &gp2a_prox_attr_group);
    if (ret)
    {
		error("Failed to create sysfs attributes");
		goto FREE_IRQ;
	}
#endif    
	
	/*Device Initialisation with recommended register values from datasheet*/
	
	reg_value = 0x18;
	if((ret=gp2a_i2c_write(GP2A_REG_CON,&reg_value))<0)
			error("gp2a_i2c_write 1 failed");	
		
	reg_value = 0x08;
	if((ret=gp2a_i2c_write(GP2A_REG_GAIN,&reg_value))<0)
			error("gp2a_i2c_write 2 failed");
	
	reg_value = 0x40;
	if((ret=gp2a_i2c_write(GP2A_REG_HYS,&reg_value))<0)
			error("gp2a_i2c_write 3 failed");
	
	reg_value = 0x04;
	if((ret=gp2a_i2c_write(GP2A_REG_CYCLE,&reg_value))<0)
			error("gp2a_i2c_write 4 failed");
	
	/*Pulling the GPIO_PS_OUT Pin High*/
	gpio_set_value(GPIO_PS_OUT, 1);
	printk(KERN_INFO "[GP2A] gpio_get_value of GPIO_PS_OUT is %d\n",gpio_get_value(GPIO_PS_OUT));

	/*Setting the device into shutdown mode*/
	gp2a_prox_mode(0);

	printk(KERN_INFO "[GP2A] %s end\n", __func__);	
	return ret;
#if 0 /* prevent CID58528 */
FREE_IRQ:
	free_irq(PROX_IRQ,NULL);
#endif
DESTROY_WORK_QUEUE:
	destroy_workqueue(gp2a_prox_wq);
INPUT_DEV_DREG:
	input_unregister_device(gp2a_data->prox_input_dev);	
MISC_DREG:
	misc_deregister(&gp2a_prox_misc_device);
FREE_GP2A_DATA:
	kfree(gp2a_data);
	return ret;
}	
			pxa->pdata->setpower(card->host->parent,1);/*exit suspend */
	}

exit:
	return 0;
}

static struct sdhci_pxa_platdata mci0_platform_data = {
	.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
	.flags = PXA_FLAG_CARD_PERMANENT | PXA_FLAG_ACITVE_IN_SUSPEND | PXA_FLAG_SD_8_BIT_CAPABLE_SLOT,
	.soc_set_ops = mmc_set_ops,
};

static struct sdhci_pxa_platdata mci1_platform_data = {
	.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
	.ext_cd_gpio = mfp_to_gpio(MFP_PIN_GPIO47),
	.ext_cd_gpio_invert = 1,
	.ext_cd_init = ext_cd_init,
	.ext_cd_cleanup = ext_cd_cleanup,
	.setpower = mci_setpower,
	.lp_switch = mmc1_lp_switch,
	.soc_set_ops = mmc_set_ops,
};

static struct sdhci_pxa_platdata mci2_platform_data = {
	.flags  = PXA_FLAG_DISABLE_CLOCK_GATING |
						PXA_FLAG_SDIO_RESUME |
						PXA_FLAG_CARD_PERMANENT |
						PXA_FLAG_SDIO_IRQ_ALWAYS_ON |
						PXA_FLAG_DISABLE_PROBE_CDDET,
	.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Example #7
0
static int pm800_headset_switch_probe(struct platform_device *pdev)
{
	struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent);
	struct pm800_headset_info *info;
	struct gpio_switch_platform_data *pdata_headset = pdev->dev.platform_data;
	struct headset_switch_data *switch_data_headset = NULL;
	struct pm80x_platform_data *pm80x_pdata;
	int irq_headset, irq_hook, ret = 0;
#if 1 //KSND
	struct class *audio;
	struct device *earjack;
#endif

	if (pdev->dev.parent->platform_data) {
		pm80x_pdata = pdev->dev.parent->platform_data;
	} else {
		pr_debug("Invalid pm800 platform data!\n");
		return -EINVAL;
	}
	if (!pm80x_pdata->headset) {
		dev_err(&pdev->dev, "No headset platform info!\n");
		return -EINVAL;
	}
	if (pdata_headset == NULL) {
		pr_debug("Invalid gpio switch platform data!\n");
		return -EBUSY;
	}
	irq_headset = platform_get_irq(pdev, 0);
	if (irq_headset < 0) {
		dev_err(&pdev->dev, "No IRQ resource for headset!\n");
		return -EINVAL;
	}
	irq_hook = platform_get_irq(pdev, 1);
	if (irq_hook < 0) {
		dev_err(&pdev->dev, "No IRQ resource for hook/mic!\n");
		return -EINVAL;
	}
	info =
	    devm_kzalloc(&pdev->dev, sizeof(struct pm800_headset_info),
			 GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	info->pdata = pm80x_pdata->headset; //KSND

	info->chip = chip;
	info->mic_set_power = pm80x_pdata->headset->mic_set_power;
	info->headset_flag = pm80x_pdata->headset->headset_flag;
	info->map = chip->regmap;
	info->map_gpadc = chip->subchip->regmap_gpadc;
	info->dev = &pdev->dev;
	info->irq_headset = irq_headset + chip->irq_base;
	info->irq_hook = irq_hook + chip->irq_base;

	info->idev = input_allocate_device();
	if (!info->idev) {
		dev_err(&pdev->dev, "Failed to allocate input dev\n");
		ret = -ENOMEM;
		goto input_allocate_fail;
	}

	info->idev->name = "88pm800_hook_vol";
	info->idev->phys = "88pm800_hook_vol/input0";
	info->idev->id.bustype = BUS_I2C;
	info->idev->dev.parent = &pdev->dev;

	__set_bit(EV_KEY, info->idev->evbit);
	__set_bit(KEY_MEDIA, info->idev->keybit);
	__set_bit(KEY_VOLUMEUP, info->idev->keybit);
	__set_bit(KEY_VOLUMEDOWN, info->idev->keybit);
	info->hook_vol_status = HOOK_VOL_ALL_RELEASED;

	switch_data_headset =
	    devm_kzalloc(&pdev->dev, sizeof(struct headset_switch_data),
			 GFP_KERNEL);
	if (!switch_data_headset) {
		dev_err(&pdev->dev, "Failed to allocate headset data\n");
		ret = -ENOMEM;
		goto headset_allocate_fail;
	}

	switch_data_headset->sdev.name = pdata_headset->name;
	switch_data_headset->name_on = pdata_headset->name_on;
	switch_data_headset->name_off = pdata_headset->name_off;
	switch_data_headset->state_on = pdata_headset->state_on;
	switch_data_headset->state_off = pdata_headset->state_off;
	switch_data_headset->sdev.print_state = switch_headset_print_state;
	info->psw_data_headset = switch_data_headset;

	ret = switch_dev_register(&switch_data_headset->sdev);
	if (ret < 0)
		goto err_switch_dev_register;

	
#ifdef FET_EN_CONTROL //KSND
		if(system_rev < LT02_R0_3){
			info->gpio_fet_en = mfp_to_gpio(GPIO008_GPIO_8);
		
			if( gpio_request(info->gpio_fet_en,"FET EN CTRL") ){
				gpio_free(info->gpio_fet_en);
				pr_info("%s: FET_EN CTRL Request Fail!!\n", __func__);
			}
			gpio_direction_output(info->gpio_fet_en, 0 );
		}
#endif /* FET_EN_CONTROL */
	
#ifdef COM_DET_CONTROL 
		info->gpio_com = mfp_to_gpio(GPIO012_GPIO_12);
	
		if( gpio_request(info->gpio_com,"COM_DET CTRL") ){
			gpio_free(info->gpio_com);
			pr_info("%s: COM_DET CTRL Request Fail!!\n", __func__);
		}
		gpio_direction_input(info->gpio_com);
#endif /* COM_DET_CONTROL */
	
#ifdef HP_MUTE_CONTROL
		if(system_rev < LT02_R0_2){
			info->gpio_hp_mute = mfp_to_gpio(GPIO031_GPIO_31);
		
			if( gpio_request(info->gpio_hp_mute,"HP_MUTE CTRL") ){
				gpio_free(info->gpio_hp_mute);
				pr_info("%s: HP_MUTE CTRL Request Fail!!\n", __func__);
			}
			gpio_direction_output(info->gpio_hp_mute, 0 );
		}
#endif

	mutex_init(&info->hs_mutex);
#ifdef COM_DET_CONTROL //KSND
	/* com detection irq initialization(only rising edge detect) - ffkaka */
	info->irq_com = gpio_to_irq(info->gpio_com);
	ret = 
		request_threaded_irq(info->irq_com,NULL,pm800_jack_com_det_irq_thread,
		IRQF_ONESHOT|IRQF_TRIGGER_RISING, "headset com detect", info);
	if (ret < 0) {
		pr_info( "[headset] Failed to request IRQ com detect : #%d: %d\n",
			info->irq_com, ret);
		goto out_irq_com;
	}
	disable_irq(info->irq_com);
#endif

	ret =
	    request_threaded_irq(info->irq_headset, NULL, pm800_jack_detect_irq_thread,
				 IRQF_ONESHOT, "headset", info);
	if (ret < 0) {
		dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
			info->irq_headset, ret);
		goto out_irq_headset;
	}

	ret =
	    request_threaded_irq(info->irq_hook, NULL, pm800_jack_buttons_irq_thread,
				 IRQF_ONESHOT, "hook", info);
	if (ret < 0) {
		dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
			info->irq_hook, ret);
		goto out_irq_hook;
	}
	
	voice_call_enable = 0;
	if (info->proc_file == NULL) {
		info->proc_file =
			create_proc_entry(PM800_HEADSET_PROC_FILE, 0644, NULL);
		if (info->proc_file) {
			info->proc_file->read_proc = pm800_headset_proc_read;
			info->proc_file->write_proc = (write_proc_t  *)pm800_headset_proc_write;
			info->proc_file->data = info;
		} else
			pr_info("pm800 headset proc file create failed!\n");
	}

#if 1 //KSND
	audio = class_create(THIS_MODULE, "audio");
	if (IS_ERR(audio))
		pr_err("Failed to create class(audio)!\n");

	earjack = device_create(audio, NULL, 0, NULL, "earjack");
	if (IS_ERR(earjack))
		pr_err("Failed to create device(earjack)!\n");

	ret = device_create_file(earjack, &dev_attr_key_state);
	if (ret)
		pr_err("Failed to create device file in sysfs entries!\n");

	ret = device_create_file(earjack, &dev_attr_state);
	if (ret)
		pr_err("Failed to create device file in sysfs entries!\n");
    
	ret = device_create_file(earjack, &dev_attr_select_jack);
	if (ret)
		pr_err("Failed to create device file in sysfs entries(%s)!\n", dev_attr_select_jack.attr.name);
#endif

	/* Initialize timer for detecting loop */
	setup_timer(&info->headset_timer,pm800_jack_timer_handler,(unsigned long)info);

  /* Init Timer for Button Release */ //KSND
	setup_timer(&info->button_timer,pm800_button_timer_handler,(unsigned 	long)info); 

	/*
	 * disable hook irq to ensure this irq will be enabled
	 * after plugging in headset
	 */
	info->hook_count = 1;
	pm800_hook_int(info, 0);
	ret = input_register_device(info->idev);
	if (ret < 0)
		goto err_input_dev_register;

	platform_set_drvdata(pdev, info);
	INIT_WORK(&info->work_headset, pm800_jack_det_work);
	INIT_WORK(&info->work_hook, pm800_jack_buttons_work);
	INIT_WORK(&info->work_release, pm800_hook_release_work);
	hsdetect_dev = &pdev->dev;
	hs_detect.hsdetect_status = 0;
	hs_detect.hookswitch_status = 0;
	/* default 4_POLES */
	hs_detect.hsmic_status = PM8XXX_HS_MIC_ADD;

	/* Pointer for handling info in this driver KSND */
	local_info = info;

	/* Hook:32 ms debounce time */
	regmap_update_bits(info->map, PM800_MIC_CNTRL, MIC_DET_DBS,
			   MIC_DET_DBS_32MS);
	/* Hook:256ms period duty cycle */
	regmap_update_bits(info->map, PM800_MIC_CNTRL, MIC_DET_PRD,
			   MIC_DET_PRD_CTN_256MS);
	/* set GPADC_DIR to 1, set to 0 cause pop noise in recording */
	regmap_update_bits(info->map_gpadc, PM800_GPADC_MISC_CONFIG1,
			   PM800_GPADC4_DIR, PM800_GPADC4_DIR);
	/* enable headset detection on GPIO3 */
	regmap_update_bits(info->map, PM800_HEADSET_CNTRL, PM800_HEADSET_DET_EN,
			   PM800_HEADSET_DET_EN);
	pm800_jack_det_work(&info->work_headset);

	dev_set_drvdata(earjack, info);  //KSND  

#if defined(CONFIG_MACH_LT02) || defined(CONFIG_MACH_COCOA7)
	usb_switch_register_notify(&dock_nb);
#endif

	return 0;

out_irq_hook:	
	free_irq(info->irq_hook, info);
out_irq_headset:
	free_irq(info->irq_headset, info);
#ifdef COM_DET_CONTROL
out_irq_com:
	free_irq(info->irq_com,info);
#endif
err_input_dev_register:
	input_free_device(info->idev);
err_switch_dev_register:
	switch_dev_unregister(&switch_data_headset->sdev);
headset_allocate_fail:
	devm_kfree(&pdev->dev, switch_data_headset);
input_allocate_fail:
	devm_kfree(&pdev->dev, info);
	return ret;
}
	DF_IO12_ND_IO12,
	DF_IO13_ND_IO13,
	DF_IO14_ND_IO14,
	DF_IO15_ND_IO15,
};

#define SAAR_ETH_PHYS	(0x14000000)

static struct resource smc91x_resources[] = {
	[0] = {
		.start	= (SAAR_ETH_PHYS + 0x300),
		.end	= (SAAR_ETH_PHYS + 0xfffff),
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
		.end	= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
	}
};

static struct smc91x_platdata saar_smc91x_info = {
	.flags	= SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
};

static struct platform_device smc91x_device = {
	.name		= "smc91x",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.resource	= smc91x_resources,
	.dev		= {
static int s5k43_pin_init(void){

	Main_STBY = mfp_to_gpio(MFP_PIN_GPIO14);
	Main_RST = mfp_to_gpio(MFP_PIN_GPIO15);

	CAM_AF = mfp_to_gpio(MFP_PIN_GPIO6);
	CAM_IO = mfp_to_gpio(MFP_PIN_GPIO79);
	CAM_AVDD = mfp_to_gpio(MFP_PIN_GPIO80);
#ifdef CONFIG_FLED_RT5033 	
	CAM_CORE = mfp_to_gpio(MFP_PIN_GPIO7);
#endif
	
		
	if( (!Main_STBY) || (! Main_RST) || (! CAM_AF) || (! CAM_IO) || (! CAM_AVDD)) {
		printk(KERN_ERR "mfp_to_gpio  failed,"
				"gpio: Main_STBY :%d, Main_RST:%d, CAM_AF :%d, CAM_IO:%d, CAM_AVDD :%d\n", Main_STBY, Main_RST, CAM_AF, CAM_IO, CAM_AVDD);	
		return -1;
	}

#ifdef CONFIG_FLED_RT5033 	
	if(! CAM_CORE){
		printk(KERN_ERR "mfp_to_gpio  failed,"
				"gpio: CAM_CORE :%d\n", CAM_CORE);	
		return -1;
	}	
#endif
	/* Camera hold these GPIO forever, should not be accquired by others */
	if (Main_STBY && gpio_request(Main_STBY, "CAM_HI_SENSOR_PWD_14")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", Main_STBY);
		Main_STBY = 0;
		return -1;
	}
	if (Main_RST && gpio_request(Main_RST, "CAM_HI_SENSOR_PWD_15")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", Main_RST);
		Main_RST = 0;
		return -1;
	}

	
	if (CAM_AF && gpio_request(CAM_AF, "CAM_HI_SENSOR_PWD_6")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", CAM_AF);
		CAM_AF = 0;
		return -1;
	}
#ifdef CONFIG_FLED_RT5033 		
	if (CAM_CORE && gpio_request(CAM_CORE, "CAM_HI_SENSOR_PWD_7")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", CAM_CORE);
		CAM_CORE = 0;
		return -1;
	}
#endif
	if (CAM_IO && gpio_request(CAM_IO, "CAM_HI_SENSOR_PWD_79")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", CAM_IO);
		CAM_IO = 0;
		return -1;
	}
	if (CAM_AVDD && gpio_request(CAM_AVDD, "CAM_HI_SENSOR_PWD_80")){
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", CAM_AVDD);
		CAM_AVDD = 0;
		return -1;
	}

	return 0;
}
Example #10
0
static void pm800_jack_det_work(struct work_struct *work)
{
	struct pm800_headset_info *info =
	    container_of(work, struct pm800_headset_info, work_headset);
	unsigned int value, voltage;
	int ret, i, com_value;
	static int com_det_cnt = 0;
	int count[MAX_ZONE_LIMIT] = {0};

	ret = regmap_read(info->map, PM800_GPIO_2_3_CNTRL, &value);
	if (ret < 0) {
		dev_err(info->dev,
			"Failed to read PM800_GPIO_2_3_CNTRL: 0x%x\n", ret);
		return;
	}

	value &= PM800_GPIO3_VAL;
	if (info->headset_flag == PM800_HS_DET_INVERT)
		value = !value;

	com_value = gpio_get_value(mfp_to_gpio(GPIO012_GPIO_12));

	/* Retry 10 times for check GND status */
	if(value && com_value){
		if(com_det_cnt < 10){
			com_det_cnt++;
			pr_info("[headset] check Com Status cnt=[%d]\n",com_det_cnt);//temp
			mod_timer(&info->headset_timer, jiffies + msecs_to_jiffies(100));
			return;
		}
		com_det_cnt=0;
		return;
	}
	else if(value && (!com_value)){
		/* MIC_BIAS on */
		pm800_jack_set_type(info, SEC_UNKNOWN_DEVICE, 1);
		com_det_cnt=0;

		/* determine the type of headset based on the
		 * adc value.  An adc value can fall in various
		 * ranges or zones.  Within some ranges, the type
		 * can be returned immediately.  Within others, the
		 * value is considered unstable and we need to sample
		 * a few more types (up to the limit determined by
		 * the range) before we return the type for that range.
		 */
		while(value && !(com_value)){
			/* Get ADC value */
			voltage = gpadc4_measure_voltage(info);
			pr_info("%s: adc = %d mv\n", __func__, voltage);
		
			for (i = 0; i < info->pdata->num_zones; i++) {
				if (voltage <= info->pdata->zones[i].adc_high) {
					if (++count[i] > info->pdata->zones[i].check_count) {
						// Set Earjack type (3 pole or 4 pole)
						pm800_jack_set_type(info, info->pdata->zones[i].jack_type, 0);
#if defined(CONFIG_MACH_LT02) || defined(CONFIG_MACH_COCOA7)
						sm5502_chgpump_en();
						if(dock_state == CABLE_TYPE2_DESKDOCK_MUIC || dock_state == CABLE_TYPE3_DESKDOCK_VB_MUIC){
							fsa9480_disable_vaudio();
						}
#endif
						return;
					}
					if (info->pdata->zones[i].delay_ms > 0)
						msleep(info->pdata->zones[i].delay_ms);
					break;
				}
			}
		}
		/* jack detection is failed */
		pr_info("%s : detection is failed\n", __func__);
		pm800_jack_set_type(info, SEC_JACK_NO_DEVICE, 0);
	}
	else {
		pr_info("%s : disconnected Headset \n", __func__);
		pm800_jack_key_handle(info, info->pdata->press_release_th); //KSND
		pm800_jack_set_type(info, SEC_JACK_NO_DEVICE, 0);
		com_det_cnt=0;
#if defined(CONFIG_MACH_LT02) || defined(CONFIG_MACH_COCOA7)
		sm5502_chgpump_dis();
		if(dock_state == CABLE_TYPE2_DESKDOCK_MUIC || dock_state == CABLE_TYPE3_DESKDOCK_VB_MUIC){
			fsa9480_set_vaudio();
		}
#endif
		return;
	}
}
Example #11
0
};

#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
static struct resource dm9000_resources[] = {
	[0] = {
		.start	= CM_X300_ETH_PHYS,
		.end	= CM_X300_ETH_PHYS + 0x3,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= CM_X300_ETH_PHYS + 0x4,
		.end	= CM_X300_ETH_PHYS + 0x4 + 500,
		.flags	= IORESOURCE_MEM,
	},
	[2] = {
		.start	= IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)),
		.end	= IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)),
		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
	}
};

static struct dm9000_plat_data cm_x300_dm9000_platdata = {
	.flags		= DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
};

static struct platform_device dm9000_device = {
	.name		= "dm9000",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(dm9000_resources),
	.resource	= dm9000_resources,
	.dev		= {
Example #12
0
	DF_IO12_ND_IO12,
	DF_IO13_ND_IO13,
	DF_IO14_ND_IO14,
	DF_IO15_ND_IO15,
};

#define SAAR_ETH_PHYS	(0x14000000)

static struct resource smc91x_resources[] = {
	[0] = {
		.start	= (SAAR_ETH_PHYS + 0x300),
		.end	= (SAAR_ETH_PHYS + 0xfffff),
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
		.end	= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
	}
};

static struct smc91x_platdata saar_smc91x_info = {
	.flags	= SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
};

static struct platform_device smc91x_device = {
	.name		= "smc91x",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.resource	= smc91x_resources,
	.dev		= {
Example #13
0
	.touch		= &saarb_touch,
	.backlight	= &saarb_backlight[0],
	.led		= &saarb_led[0],
	.companion_addr	= 0x10,
	.irq_mode	= 0,
	.irq_base	= IRQ_BOARD_START,

	.i2c_port	= GI2C_PORT,
};

static struct i2c_board_info saarb_i2c_info[] = {
	{
		.type		= "88PM860x",
		.addr		= 0x34,
		.platform_data	= &saarb_pm8607_info,
		.irq		= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
	},
};

static void __init saarb_init(void)
{
	pxa_set_ffuart_info(NULL);
	pxa_set_i2c_info(NULL);
	i2c_register_board_info(0, ARRAY_AND_SIZE(saarb_i2c_info));
}

MACHINE_START(SAARB, "PXA955 Handheld Platform (aka SAARB)")
	.atag_offset    = 0x100,
	.map_io         = pxa3xx_map_io,
	.nr_irqs	= SAARB_NR_IRQS,
	.init_irq       = pxa95x_init_irq,
Example #14
0
	/* 10000 ns = 10 ms ^= 100 kHz */
	.pwm_period_ns	= 10000,
};

static struct platform_device raumfeld_pwm_backlight_device = {
	.name	= "pwm-backlight",
	.dev	= {
		.parent		= &pxa27x_device_pwm0.dev,
		.platform_data	= &raumfeld_pwm_backlight_data,
	}
};

/* LT3593 controlled backlight */
static struct gpio_led raumfeld_lt3593_led = {
	.name		= "backlight",
	.gpio		= mfp_to_gpio(MFP_PIN_GPIO17),
	.default_state	= LEDS_GPIO_DEFSTATE_ON,
};

static struct gpio_led_platform_data raumfeld_lt3593_platform_data = {
	.leds		= &raumfeld_lt3593_led,
	.num_leds	= 1,
};

static struct platform_device raumfeld_lt3593_device = {
	.name	= "leds-lt3593",
	.id	= -1,
	.dev	= {
		.platform_data = &raumfeld_lt3593_platform_data,
	},
};
Example #15
0
#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */

/* Ethernet support: Davicom DM9000 */
static struct resource dm9k_resources[] = {
	[0] = {
	       .start = MXM_8X10_ETH_PHYS + 0x300,
	       .end = MXM_8X10_ETH_PHYS + 0x300,
	       .flags = IORESOURCE_MEM
	},
	[1] = {
	       .start = MXM_8X10_ETH_PHYS + 0x308,
	       .end = MXM_8X10_ETH_PHYS + 0x308,
	       .flags = IORESOURCE_MEM
	},
	[2] = {
	       .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
	       .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
	       .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
	}
};

static struct dm9000_plat_data dm9k_plat_data = {
	.flags = DM9000_PLATF_16BITONLY
};

static struct platform_device dm9k_device = {
	.name = "dm9000",
	.id = 0,
	.num_resources = ARRAY_SIZE(dm9k_resources),
	.resource = dm9k_resources,
	.dev = {
Example #16
0
	.port_mode	= PMM_GLOBAL_MODE,
	.flags		= ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
};

void __init colibri_pxa320_init_ohci(void)
{
	pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
	pxa_set_ohci_info(&colibri_pxa320_ohci_info);
}
#else
static inline void colibri_pxa320_init_ohci(void) {}
#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */

#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info = {
	.gpio_vbus		= mfp_to_gpio(MFP_PIN_GPIO96),
	.gpio_pullup		= -1,
};

static struct platform_device colibri_pxa320_gpio_vbus = {
	.name	= "gpio-vbus",
	.id	= -1,
	.dev	= {
		.platform_data	= &colibri_pxa320_gpio_vbus_info,
	},
};

static void colibri_pxa320_udc_command(int cmd)
{
	if (cmd == PXA2XX_UDC_CMD_CONNECT)
		UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
Example #17
0
	/* UART3 */
	GPIO107_UART3_CTS,
	GPIO108_UART3_RTS,
	GPIO109_UART3_TXD,
	GPIO110_UART3_RXD,
};

static struct resource smc91x_resources[] = {
	[0] = {
		.start	= (LITTLETON_ETH_PHYS + 0x300),
		.end	= (LITTLETON_ETH_PHYS + 0xfffff),
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
<<<<<<< HEAD
		.start	= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
		.end	= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
=======
<<<<<<< HEAD
		.start	= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
		.end	= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
=======
		.start	= IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
		.end	= IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
>>>>>>> 58a75b6a81be54a8b491263ca1af243e9d8617b9
>>>>>>> ae1773bb70f3d7cf73324ce8fba787e01d8fa9f2
		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
	}
};

static struct smc91x_platdata littleton_smc91x_info = {