Example #1
0
extern int
inr_pc7230_ipod_ducking_test(int autotest)
{
	if (audio_dac_initialize()) {
		printf("audio_dac_initialize fail\n");
		return -1;
	}

	if (socle_request_gpio_irq(SET_GPIO_PIN_NUM(PF, 4), volume_tuner_isr, GPIO_INT_SENSE_EDGE | GPIO_INT_SINGLE_EDGE | GPIO_INT_EVENT_HI, NULL)) {
		printf("I2STesting(): GPIO pin[%d] is busy!\n", SET_GPIO_PIN_NUM(PF, 4));
		return -1;
	}

	// set audio source selection to iPod
	socle_gpio_set_value_with_mask(PE, 0x19, 0x3f);				// PE[1:0] = [01]
	socle_gpio_set_value_with_mask(PE, 0x39, 0x3f);				// PE[1:0] = [01], PE5 = 1

	while (1) {
		if (vol_change) {
			audio_dac_master_volume(vol);
			vol_change = 0;
		}
	}
	return 0;
}
Example #2
0
extern int
socle_lcm_t6963c_test(int autotest)
{
	int ret = 0;

#ifdef CONFIG_PC7210
// 20080714 cyli add for INR
#include "../ADC_PWM/pwmt-regs.h"
#include "../GPIO/gpio.h"

	struct socle_pwmt *p;

	// backlight
	p = get_socle_pwmt_structure(T6963C_BKLGT_PWM_IDX);
	if (NULL == p) {
		printf("socle_lcm_t6963c_test() can't get PWMT structure!!\n");
		return -1;
	}

	p->drv->reset(p);
	p->drv->write_hrc(p, 0x50);
	p->drv->write_lrc(p, 0x1000);
	p->drv->enable(p, 1);
	p->drv->output_enable(p, 1);

	release_socle_pwmt_structure(T6963C_BKLGT_PWM_IDX);

	// contrast
	p = get_socle_pwmt_structure(T6963C_CNTRT_PWM_IDX);
	if (NULL == p) {
		printf("socle_lcm_t6963c_test() can't get PWMT structure!!\n");
		return -1;
	}

	p->drv->reset(p);
	p->drv->write_hrc(p, 0x50);
	p->drv->write_lrc(p, 0x50);
	p->drv->enable(p, 1);
	p->drv->output_enable(p, 1);

	release_socle_pwmt_structure(T6963C_CNTRT_PWM_IDX);

	// set CS0 chip selection to LCM
	socle_gpio_set_value_with_mask(PA, 0, SHIFT_MASK(5));				// PA5 = 0
#endif

	ret = socle_lcm_t6963c_test_sub();

#ifdef CONFIG_PC7210
	// set CS0 chip selection to NOR
	socle_gpio_set_value_with_mask(PA, SHIFT_MASK(5), SHIFT_MASK(5));				// PA5 = 1
#endif

	return ret;
}
static void
gpio_kpd_init(void)
{
	KPD_DBG("\n");

	socle_gpio_claim_lock();

	// normal mode
	socle_gpio_test_mode_en(PJ, 0);

	// single low edge trigger (row - PJ0, PJ1, PJ2, PJ3)
	socle_gpio_set_interrupt_sense_with_mask(PJ, 0x0, 0xf);
	socle_gpio_set_interrupt_both_edges_with_mask(PJ, 0x0, 0xf);
	socle_gpio_set_interrupt_event_with_mask(PJ, 0x0, 0xf);

	// set row as input (row - PJ0, PJ1, PJ2, PJ3)
	(void)socle_gpio_get_value_with_mask(PJ, 0xf);

	// write col pins as 0 (col - PJ4, PJ5, PJ6, PJ7)
	socle_gpio_set_value_with_mask(PJ, 0x0, 0xf0);

	// enable all interrupt (row - PJ0, PJ1, PJ2, PJ3)
	socle_gpio_set_interrupt_mask_with_mask(PJ, 0xf, 0xf);

	socle_gpio_release_lock();
}
static void
pdk_keypad_input_report_key(void *param)
{
	int row, col;

	KPD_DBG("\n");

	socle_gpio_claim_lock();

	// read col pins (col - PJ4, PJ5, PJ6, PJ7)
	tmp2 = socle_gpio_get_value_with_mask(PJ, 0xf0);

	socle_gpio_release_lock();

	KPD_DBG("tmp1 = 0x%x, tmp2 = 0x%x\n", tmp1, tmp2);

	row = kpd_value_convert(tmp1 & 0xf);
	col = kpd_value_convert((tmp2 & 0xf0) >> 4);

	KPD_DBG("row = %d, col = %d\n", row, col);

	pdk_keypad_report_key(row, col);

	mdelay(200);

	socle_gpio_claim_lock();

	// write col pins as 0 (col - PJ4, PJ5, PJ6, PJ7)
	socle_gpio_set_value_with_mask(PJ, 0x0, 0xf0);

	// enable all interrupt (row - PJ0, PJ1, PJ2, PJ3)
	socle_gpio_set_interrupt_mask_with_mask(PJ, 0xf, 0xf);

	socle_gpio_release_lock();
}