コード例 #1
0
ファイル: pinmux_dev_galileo.c プロジェクト: gemtara/z
static int galileo_dev_set(struct device *dev,
				uint32_t pin,
				uint32_t func)
{
	if (pin > PINMUX_NUM_PINS) {
		return -EINVAL;
	}

	return _galileo_pinmux_set_pin(dev, pin, func);
}
コード例 #2
0
ファイル: pinmux.c プロジェクト: agatti/zephyr
static int pinmux_galileo_initialize(struct device *port)
{
	struct galileo_data *dev = port->driver_data;
	int i;

	/* Grab the EXP0, EXP1, EXP2, and PWM0 now by name */
	dev->exp0 = device_get_binding(PINMUX_GALILEO_EXP0_NAME);
	if (!dev->exp0) {
		return -EINVAL;
	}
	dev->exp1 = device_get_binding(PINMUX_GALILEO_EXP1_NAME);
	if (!dev->exp1) {
		return -EINVAL;
	}
	dev->exp2 = device_get_binding(PINMUX_GALILEO_EXP2_NAME);
	if (!dev->exp2) {
		return -EINVAL;
	}
	dev->pwm0 = device_get_binding(PINMUX_GALILEO_PWM0_NAME);
	if (!dev->pwm0) {
		return -EINVAL;
	}
	dev->gpio_dw = device_get_binding(PINMUX_GALILEO_GPIO_DW_NAME);
	if (!dev->gpio_dw) {
		return -EINVAL;
	}
	dev->gpio_core = device_get_binding(
			    PINMUX_GALILEO_GPIO_INTEL_CW_NAME);
	if (!dev->gpio_core) {
		return -EINVAL;
	}
	dev->gpio_resume = device_get_binding(
			    PINMUX_GALILEO_GPIO_INTEL_RW_NAME);
	if (!dev->gpio_resume) {
		return -EINVAL;
	}

	/*
	 * Now that we have everything, let us start parsing everything
	 * from the above mapping as selected by the end user
	 */
	for (i = 0; i < PINMUX_NUM_PINS; i++) {
		_galileo_pinmux_set_pin(port,
				 mux_config[i].pin_num,
				 mux_config[i].mode);
	}

	return 0;
}