x86: galileo: pinmux: update get/set functions

This implements the get function for the Galileo pinmux
driver. Also modify the set function so that the get
function would work correctly.

Change-Id: I463b01a903389a9c640bb1354ce92b9c0e37030f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2015-10-15 16:05:11 -07:00 committed by Anas Nashif
commit fed1cc8833

View file

@ -622,10 +622,17 @@ uint8_t _galileo_set_pin(struct device *port, uint8_t pin, uint8_t func)
return DEV_OK;
}
#ifdef CONFIG_PINMUX_DEV
static uint32_t galileo_dev_set(struct device *dev,
uint32_t pin,
uint8_t func)
{
if (pin > CONFIG_PINMUX_NUM_PINS) {
return DEV_INVALID_CONF;
}
mux_config[pin].mode = func;
return _galileo_set_pin(dev, pin, func);
}
@ -633,8 +640,37 @@ static uint32_t galileo_dev_get(struct device *dev,
uint32_t pin,
uint8_t *func)
{
if (pin > CONFIG_PINMUX_NUM_PINS) {
return DEV_INVALID_CONF;
}
*func = mux_config[pin].mode;
return DEV_OK;
}
#else
static uint32_t galileo_dev_set(struct device *dev,
uint32_t pin,
uint8_t func)
{
ARG_UNUSED(dev);
ARG_UNUSED(pin);
ARG_UNUSED(func);
return DEV_INVALID_OP;
}
static uint32_t galileo_dev_get(struct device *dev,
uint32_t pin,
uint8_t *func)
{
ARG_UNUSED(dev);
ARG_UNUSED(pin);
ARG_UNUSED(func);
return DEV_INVALID_OP;
}
#endif
static struct pinmux_driver_api api_funcs = {
.set = galileo_dev_set,