Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
95323361 c7e3cc3c

+16 -15
+7 -7
drivers/media/i2c/adv7183.c
··· 474 474 struct adv7183 *decoder = to_adv7183(sd); 475 475 476 476 if (enable) 477 - gpio_direction_output(decoder->oe_pin, 0); 477 + gpio_set_value(decoder->oe_pin, 0); 478 478 else 479 - gpio_direction_output(decoder->oe_pin, 1); 479 + gpio_set_value(decoder->oe_pin, 1); 480 480 udelay(1); 481 481 return 0; 482 482 } ··· 580 580 decoder->reset_pin = pin_array[0]; 581 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 585 v4l_err(client, "failed to request GPIO %d\n", decoder->reset_pin); 585 586 ret = -EBUSY; 586 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 592 v4l_err(client, "failed to request GPIO %d\n", decoder->oe_pin); 591 593 ret = -EBUSY; 592 594 goto err_free_reset; ··· 621 619 decoder->input = ADV7183_COMPOSITE4; 622 620 decoder->output = ADV7183_8BIT_OUT; 623 621 624 - gpio_direction_output(decoder->oe_pin, 1); 625 622 /* reset chip */ 626 - gpio_direction_output(decoder->reset_pin, 0); 627 623 /* reset pulse width at least 5ms */ 628 624 mdelay(10); 629 - gpio_direction_output(decoder->reset_pin, 1); 625 + gpio_set_value(decoder->reset_pin, 1); 630 626 /* wait 5ms before any further i2c writes are performed */ 631 627 mdelay(5); 632 628
+4 -2
drivers/media/i2c/m5mols/m5mols_core.c
··· 930 930 const struct i2c_device_id *id) 931 931 { 932 932 const struct m5mols_platform_data *pdata = client->dev.platform_data; 933 + unsigned long gpio_flags; 933 934 struct m5mols_info *info; 934 935 struct v4l2_subdev *sd; 935 936 int ret; ··· 957 956 info->pdata = pdata; 958 957 info->set_power = pdata->set_power; 959 958 960 - ret = gpio_request(pdata->gpio_reset, "M5MOLS_NRST"); 959 + gpio_flags = pdata->reset_polarity 960 + ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; 961 + ret = gpio_request_one(pdata->gpio_reset, gpio_flags, "M5MOLS_NRST"); 961 962 if (ret) { 962 963 dev_err(&client->dev, "Failed to request gpio: %d\n", ret); 963 964 goto out_free; 964 965 } 965 - gpio_direction_output(pdata->gpio_reset, pdata->reset_polarity); 966 966 967 967 ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies), supplies); 968 968 if (ret) {
+4 -4
drivers/media/i2c/noon010pc30.c
··· 746 746 info->curr_win = &noon010_sizes[0]; 747 747 748 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 751 if (ret) { 751 752 dev_err(&client->dev, "GPIO request error: %d\n", ret); 752 753 goto np_err; 753 754 } 754 755 info->gpio_nreset = pdata->gpio_nreset; 755 - gpio_direction_output(info->gpio_nreset, 0); 756 756 gpio_export(info->gpio_nreset, 0); 757 757 } 758 758 759 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 762 if (ret) { 762 763 dev_err(&client->dev, "GPIO request error: %d\n", ret); 763 764 goto np_gpio_err; 764 765 } 765 766 info->gpio_nstby = pdata->gpio_nstby; 766 - gpio_direction_output(info->gpio_nstby, 0); 767 767 gpio_export(info->gpio_nstby, 0); 768 768 } 769 769
+1 -2
drivers/media/i2c/vs6624.c
··· 805 805 if (ce == NULL) 806 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 809 if (ret) { 810 810 v4l_err(client, "failed to request GPIO %d\n", *ce); 811 811 return ret; 812 812 } 813 - gpio_direction_output(*ce, 1); 814 813 /* wait 100ms before any further i2c writes are performed */ 815 814 mdelay(100); 816 815