BigW Consortium Gitlab

Commit 741ac74d by Ashish Syal

Updated with working version of expander

parent 4160cb4d
......@@ -50,6 +50,7 @@ static int _var##_store(struct device *dev, \
\
gpio_set_value_cansleep(exp->gpio_expander_base + _offset, val); \
atomic_set(&exp->_var##_val, val); \
dev_info(dev, "Setting GPIO %d to %d\n", exp->gpio_expander_base + _offset, val); \
\
return count; \
} \
......@@ -70,18 +71,25 @@ static void gpio_initial_status(struct platform_device *pdev,
atomic_t *atomic_val)
{
struct expander_device* exp = dev_get_drvdata(&pdev->dev);
devm_gpio_request(&pdev->dev, exp->gpio_expander_base+function_number,
//struct expander_device* exp = dev_get_drvdata(&pdev->dev);
dev_info(&pdev->dev, "%s(): initial_status\n", __func__);
devm_gpio_request(&pdev->dev, function_number,
dev_name(&pdev->dev));
atomic_set(atomic_val, function_val);
dev_info(&pdev->dev, "%s(): initial_status_line2\n", __func__);
atomic_set(atomic_val, function_val);
dev_info(&pdev->dev, "%s(): initial_status_line3\n", __func__);
gpio_direction_output(exp->gpio_expander_base+function_number,
gpio_direction_output(function_number,
function_val);
dev_info(&pdev->dev, "%s(): initial_status_line4\n", __func__);
device_create_file(&pdev->dev, attr);
dev_info(&pdev->dev, "%s(): initial_status_line5\n", __func__);
}
......@@ -91,12 +99,15 @@ static void gpio_final_status(struct platform_device *pdev,
int function_number,int function_val)
{
struct expander_device* exp = dev_get_drvdata(&pdev->dev);
dev_info(&pdev->dev, "%s(): final_status\n", __func__);
device_remove_file(&pdev->dev, attr);
dev_info(&pdev->dev, "%s(): final_status_line2\n", __func__);
gpio_set_value_cansleep(exp->gpio_expander_base+function_number, function_val);
gpio_set_value_cansleep(function_number, function_val);
dev_info(&pdev->dev, "%s(): final_status_line3\n", __func__);
}
......@@ -107,6 +118,7 @@ static int expander_probe(struct platform_device *pdev)
{
struct expander_device* dev;
int ret = 0;
//int *pass = NULL;
struct expander_platform_data *pdata = dev_get_platdata(&pdev->dev);
dev_info(&pdev->dev, "%s(): probe\n", __func__);
......@@ -127,14 +139,13 @@ static int expander_probe(struct platform_device *pdev)
dev->pdev = pdev;
dev->gpio_expander_base = pdata->gpio_expander_base;
gpio_initial_status(pdev,&dev_attr_generic_led, GENERIC_LED, 0, &dev->generic_led_val);
gpio_initial_status(pdev,&dev_attr_pcm_sel, PCM_SEL, 0, &dev->pcm_sel_val);
gpio_initial_status(pdev,&dev_attr_sdio_sel, SDIO_SEL, 0, &dev->sdio_sel_val);
gpio_initial_status(pdev,&dev_attr_tri_led_blu, TRI_LED_BLU, 0, &dev->tri_led_blu_val);
gpio_initial_status(pdev,&dev_attr_tri_led_red, TRI_LED_RED, 0, &dev->tri_led_red_val);
gpio_initial_status(pdev,&dev_attr_tri_led_grn, TRI_LED_GRN, 0, &dev->tri_led_grn_val);
gpio_initial_status(pdev,&dev_attr_buzzer, BUZZER, 0, &dev->buzzer_val);
gpio_initial_status(pdev,&dev_attr_generic_led, dev->gpio_expander_base+GENERIC_LED, 0, &dev->generic_led_val);
gpio_initial_status(pdev,&dev_attr_pcm_sel, dev->gpio_expander_base+PCM_SEL, 0, &dev->pcm_sel_val);
gpio_initial_status( pdev,&dev_attr_sdio_sel, dev->gpio_expander_base+SDIO_SEL, 0, &dev->sdio_sel_val);
gpio_initial_status(pdev,&dev_attr_tri_led_blu, dev->gpio_expander_base+TRI_LED_BLU, 0, &dev->tri_led_blu_val);
gpio_initial_status(pdev,&dev_attr_tri_led_red, dev->gpio_expander_base+TRI_LED_RED, 0, &dev->tri_led_red_val);
gpio_initial_status(pdev,&dev_attr_tri_led_grn, dev->gpio_expander_base+TRI_LED_GRN, 0, &dev->tri_led_grn_val);
gpio_initial_status(pdev,&dev_attr_buzzer, dev->gpio_expander_base+BUZZER, 0, &dev->buzzer_val);
platform_set_drvdata(pdev, dev);
......@@ -144,17 +155,17 @@ done:
static int expander_remove(struct platform_device *pdev)
{
// struct expander_device* dev = dev_get_drvdata(&pdev->dev);
dev_info(&pdev->dev, "%s(): remove\n", __func__);
struct expander_device* dev = dev_get_drvdata(&pdev->dev);
/* remove sysfs files & set final state values for gpio expander*/
gpio_final_status(pdev,&dev_attr_generic_led, GENERIC_LED, 0);
gpio_final_status(pdev,&dev_attr_pcm_sel, PCM_SEL, 0);
gpio_final_status(pdev,&dev_attr_sdio_sel, SDIO_SEL, 0);
gpio_final_status(pdev,&dev_attr_tri_led_blu, TRI_LED_BLU, 0);
gpio_final_status(pdev,&dev_attr_tri_led_red, TRI_LED_RED, 0);
gpio_final_status(pdev,&dev_attr_tri_led_grn, TRI_LED_GRN, 0);
gpio_final_status(pdev,&dev_attr_buzzer, BUZZER, 0);
gpio_final_status(pdev,&dev_attr_generic_led, dev->gpio_expander_base+GENERIC_LED, 0);
gpio_final_status(pdev,&dev_attr_pcm_sel, dev->gpio_expander_base+PCM_SEL, 0);
gpio_final_status(pdev,&dev_attr_sdio_sel, dev->gpio_expander_base+SDIO_SEL, 0);
gpio_final_status(pdev,&dev_attr_tri_led_blu, dev->gpio_expander_base+TRI_LED_BLU, 0);
gpio_final_status(pdev,&dev_attr_tri_led_red, dev->gpio_expander_base+TRI_LED_RED, 0);
gpio_final_status(pdev,&dev_attr_tri_led_grn, dev->gpio_expander_base+TRI_LED_GRN, 0);
gpio_final_status(pdev,&dev_attr_buzzer, dev->gpio_expander_base+BUZZER, 0);
return 0;
}
......
......@@ -5,7 +5,7 @@ sources:
cflags:
{
// -DDEBUG
-DDEBUG
}
params:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment