diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-03-02 02:00:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-03-03 09:26:40 -0500 |
commit | 269bd1324fbfaa52832bb3efe9f5105c9146a33a (patch) | |
tree | 7e46f8a01305a415d3227fb4bab6c94141f94354 /drivers/media/i2c | |
parent | 48ab45adcccc0835ac2a09805f3f9dff6b073b6c (diff) |
[media] media: adv7604: improve usage of gpiod API
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.
Simplify accordingly.
Moreover use devm_gpiod_get_index_optional instead of
devm_gpiod_get_index with ignoring all errors.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/adv7604.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index b7a4e32683e4..aaab9c9cebee 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -538,12 +538,8 @@ static void adv76xx_set_hpd(struct adv76xx_state *state, unsigned int hpd) | |||
538 | { | 538 | { |
539 | unsigned int i; | 539 | unsigned int i; |
540 | 540 | ||
541 | for (i = 0; i < state->info->num_dv_ports; ++i) { | 541 | for (i = 0; i < state->info->num_dv_ports; ++i) |
542 | if (IS_ERR(state->hpd_gpio[i])) | ||
543 | continue; | ||
544 | |||
545 | gpiod_set_value_cansleep(state->hpd_gpio[i], hpd & BIT(i)); | 542 | gpiod_set_value_cansleep(state->hpd_gpio[i], hpd & BIT(i)); |
546 | } | ||
547 | 543 | ||
548 | v4l2_subdev_notify(&state->sd, ADV76XX_HOTPLUG, &hpd); | 544 | v4l2_subdev_notify(&state->sd, ADV76XX_HOTPLUG, &hpd); |
549 | } | 545 | } |
@@ -2729,13 +2725,13 @@ static int adv76xx_probe(struct i2c_client *client, | |||
2729 | /* Request GPIOs. */ | 2725 | /* Request GPIOs. */ |
2730 | for (i = 0; i < state->info->num_dv_ports; ++i) { | 2726 | for (i = 0; i < state->info->num_dv_ports; ++i) { |
2731 | state->hpd_gpio[i] = | 2727 | state->hpd_gpio[i] = |
2732 | devm_gpiod_get_index(&client->dev, "hpd", i); | 2728 | devm_gpiod_get_index_optional(&client->dev, "hpd", i, |
2729 | GPIOD_OUT_LOW); | ||
2733 | if (IS_ERR(state->hpd_gpio[i])) | 2730 | if (IS_ERR(state->hpd_gpio[i])) |
2734 | continue; | 2731 | return PTR_ERR(state->hpd_gpio[i]); |
2735 | |||
2736 | gpiod_direction_output(state->hpd_gpio[i], 0); | ||
2737 | 2732 | ||
2738 | v4l_info(client, "Handling HPD %u GPIO\n", i); | 2733 | if (state->hpd_gpio[i]) |
2734 | v4l_info(client, "Handling HPD %u GPIO\n", i); | ||
2739 | } | 2735 | } |
2740 | 2736 | ||
2741 | state->timings = cea640x480; | 2737 | state->timings = cea640x480; |