diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-05-02 10:11:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-05-21 06:50:56 -0400 |
commit | 95323361e5313733a54771c5059f5b352adbf32c (patch) | |
tree | 9731320d716278f03171002ee6c98d6d2948af6e | |
parent | c7e3cc3ca1ff2fe1aeffd2ba642548d79f9a73dc (diff) |
[media] media: i2c: Convert to gpio_request_one()
Replace gpio_request() with gpio_request_one() and remove the associated
gpio_direction_output() calls.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/i2c/adv7183.c | 14 | ||||
-rw-r--r-- | drivers/media/i2c/m5mols/m5mols_core.c | 6 | ||||
-rw-r--r-- | drivers/media/i2c/noon010pc30.c | 8 | ||||
-rw-r--r-- | drivers/media/i2c/vs6624.c | 3 |
4 files changed, 16 insertions, 15 deletions
diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c index 56a1fa4af0fe..2bc032894bae 100644 --- a/drivers/media/i2c/adv7183.c +++ b/drivers/media/i2c/adv7183.c | |||
@@ -474,9 +474,9 @@ static int adv7183_s_stream(struct v4l2_subdev *sd, int enable) | |||
474 | struct adv7183 *decoder = to_adv7183(sd); | 474 | struct adv7183 *decoder = to_adv7183(sd); |
475 | 475 | ||
476 | if (enable) | 476 | if (enable) |
477 | gpio_direction_output(decoder->oe_pin, 0); | 477 | gpio_set_value(decoder->oe_pin, 0); |
478 | else | 478 | else |
479 | gpio_direction_output(decoder->oe_pin, 1); | 479 | gpio_set_value(decoder->oe_pin, 1); |
480 | udelay(1); | 480 | udelay(1); |
481 | return 0; | 481 | return 0; |
482 | } | 482 | } |
@@ -580,13 +580,15 @@ static int adv7183_probe(struct i2c_client *client, | |||
580 | decoder->reset_pin = pin_array[0]; | 580 | decoder->reset_pin = pin_array[0]; |
581 | decoder->oe_pin = pin_array[1]; | 581 | decoder->oe_pin = pin_array[1]; |
582 | 582 | ||
583 | if (gpio_request(decoder->reset_pin, "ADV7183 Reset")) { | 583 | if (gpio_request_one(decoder->reset_pin, GPIOF_OUT_INIT_LOW, |
584 | "ADV7183 Reset")) { | ||
584 | v4l_err(client, "failed to request GPIO %d\n", decoder->reset_pin); | 585 | v4l_err(client, "failed to request GPIO %d\n", decoder->reset_pin); |
585 | ret = -EBUSY; | 586 | ret = -EBUSY; |
586 | goto err_free_decoder; | 587 | goto err_free_decoder; |
587 | } | 588 | } |
588 | 589 | ||
589 | if (gpio_request(decoder->oe_pin, "ADV7183 Output Enable")) { | 590 | if (gpio_request_one(decoder->oe_pin, GPIOF_OUT_INIT_HIGH, |
591 | "ADV7183 Output Enable")) { | ||
590 | v4l_err(client, "failed to request GPIO %d\n", decoder->oe_pin); | 592 | v4l_err(client, "failed to request GPIO %d\n", decoder->oe_pin); |
591 | ret = -EBUSY; | 593 | ret = -EBUSY; |
592 | goto err_free_reset; | 594 | goto err_free_reset; |
@@ -619,12 +621,10 @@ static int adv7183_probe(struct i2c_client *client, | |||
619 | decoder->input = ADV7183_COMPOSITE4; | 621 | decoder->input = ADV7183_COMPOSITE4; |
620 | decoder->output = ADV7183_8BIT_OUT; | 622 | decoder->output = ADV7183_8BIT_OUT; |
621 | 623 | ||
622 | gpio_direction_output(decoder->oe_pin, 1); | ||
623 | /* reset chip */ | 624 | /* reset chip */ |
624 | gpio_direction_output(decoder->reset_pin, 0); | ||
625 | /* reset pulse width at least 5ms */ | 625 | /* reset pulse width at least 5ms */ |
626 | mdelay(10); | 626 | mdelay(10); |
627 | gpio_direction_output(decoder->reset_pin, 1); | 627 | gpio_set_value(decoder->reset_pin, 1); |
628 | /* wait 5ms before any further i2c writes are performed */ | 628 | /* wait 5ms before any further i2c writes are performed */ |
629 | mdelay(5); | 629 | mdelay(5); |
630 | 630 | ||
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c index 0b899cb6cda1..f0b870c06376 100644 --- a/drivers/media/i2c/m5mols/m5mols_core.c +++ b/drivers/media/i2c/m5mols/m5mols_core.c | |||
@@ -930,6 +930,7 @@ static int m5mols_probe(struct i2c_client *client, | |||
930 | const struct i2c_device_id *id) | 930 | const struct i2c_device_id *id) |
931 | { | 931 | { |
932 | const struct m5mols_platform_data *pdata = client->dev.platform_data; | 932 | const struct m5mols_platform_data *pdata = client->dev.platform_data; |
933 | unsigned long gpio_flags; | ||
933 | struct m5mols_info *info; | 934 | struct m5mols_info *info; |
934 | struct v4l2_subdev *sd; | 935 | struct v4l2_subdev *sd; |
935 | int ret; | 936 | int ret; |
@@ -956,12 +957,13 @@ static int m5mols_probe(struct i2c_client *client, | |||
956 | info->pdata = pdata; | 957 | info->pdata = pdata; |
957 | info->set_power = pdata->set_power; | 958 | info->set_power = pdata->set_power; |
958 | 959 | ||
959 | ret = gpio_request(pdata->gpio_reset, "M5MOLS_NRST"); | 960 | gpio_flags = pdata->reset_polarity |
961 | ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; | ||
962 | ret = gpio_request_one(pdata->gpio_reset, gpio_flags, "M5MOLS_NRST"); | ||
960 | if (ret) { | 963 | if (ret) { |
961 | dev_err(&client->dev, "Failed to request gpio: %d\n", ret); | 964 | dev_err(&client->dev, "Failed to request gpio: %d\n", ret); |
962 | goto out_free; | 965 | goto out_free; |
963 | } | 966 | } |
964 | gpio_direction_output(pdata->gpio_reset, pdata->reset_polarity); | ||
965 | 967 | ||
966 | ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies), supplies); | 968 | ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies), supplies); |
967 | if (ret) { | 969 | if (ret) { |
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c index 8554b47f993a..a115842ab996 100644 --- a/drivers/media/i2c/noon010pc30.c +++ b/drivers/media/i2c/noon010pc30.c | |||
@@ -746,24 +746,24 @@ static int noon010_probe(struct i2c_client *client, | |||
746 | info->curr_win = &noon010_sizes[0]; | 746 | info->curr_win = &noon010_sizes[0]; |
747 | 747 | ||
748 | if (gpio_is_valid(pdata->gpio_nreset)) { | 748 | if (gpio_is_valid(pdata->gpio_nreset)) { |
749 | ret = gpio_request(pdata->gpio_nreset, "NOON010PC30 NRST"); | 749 | ret = gpio_request_one(pdata->gpio_nreset, GPIOF_OUT_INIT_LOW, |
750 | "NOON010PC30 NRST"); | ||
750 | if (ret) { | 751 | if (ret) { |
751 | dev_err(&client->dev, "GPIO request error: %d\n", ret); | 752 | dev_err(&client->dev, "GPIO request error: %d\n", ret); |
752 | goto np_err; | 753 | goto np_err; |
753 | } | 754 | } |
754 | info->gpio_nreset = pdata->gpio_nreset; | 755 | info->gpio_nreset = pdata->gpio_nreset; |
755 | gpio_direction_output(info->gpio_nreset, 0); | ||
756 | gpio_export(info->gpio_nreset, 0); | 756 | gpio_export(info->gpio_nreset, 0); |
757 | } | 757 | } |
758 | 758 | ||
759 | if (gpio_is_valid(pdata->gpio_nstby)) { | 759 | if (gpio_is_valid(pdata->gpio_nstby)) { |
760 | ret = gpio_request(pdata->gpio_nstby, "NOON010PC30 NSTBY"); | 760 | ret = gpio_request_one(pdata->gpio_nstby, GPIOF_OUT_INIT_LOW, |
761 | "NOON010PC30 NSTBY"); | ||
761 | if (ret) { | 762 | if (ret) { |
762 | dev_err(&client->dev, "GPIO request error: %d\n", ret); | 763 | dev_err(&client->dev, "GPIO request error: %d\n", ret); |
763 | goto np_gpio_err; | 764 | goto np_gpio_err; |
764 | } | 765 | } |
765 | info->gpio_nstby = pdata->gpio_nstby; | 766 | info->gpio_nstby = pdata->gpio_nstby; |
766 | gpio_direction_output(info->gpio_nstby, 0); | ||
767 | gpio_export(info->gpio_nstby, 0); | 767 | gpio_export(info->gpio_nstby, 0); |
768 | } | 768 | } |
769 | 769 | ||
diff --git a/drivers/media/i2c/vs6624.c b/drivers/media/i2c/vs6624.c index f366fad6269e..6b8c0b7aa488 100644 --- a/drivers/media/i2c/vs6624.c +++ b/drivers/media/i2c/vs6624.c | |||
@@ -805,12 +805,11 @@ static int vs6624_probe(struct i2c_client *client, | |||
805 | if (ce == NULL) | 805 | if (ce == NULL) |
806 | return -EINVAL; | 806 | return -EINVAL; |
807 | 807 | ||
808 | ret = gpio_request(*ce, "VS6624 Chip Enable"); | 808 | ret = gpio_request_one(*ce, GPIOF_OUT_INIT_HIGH, "VS6624 Chip Enable"); |
809 | if (ret) { | 809 | if (ret) { |
810 | v4l_err(client, "failed to request GPIO %d\n", *ce); | 810 | v4l_err(client, "failed to request GPIO %d\n", *ce); |
811 | return ret; | 811 | return ret; |
812 | } | 812 | } |
813 | gpio_direction_output(*ce, 1); | ||
814 | /* wait 100ms before any further i2c writes are performed */ | 813 | /* wait 100ms before any further i2c writes are performed */ |
815 | mdelay(100); | 814 | mdelay(100); |
816 | 815 | ||