Message ID | 1439207974-30902-1-git-send-email-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 10/08/15 14:26, Thierry Reding wrote: > On Mon, Aug 10, 2015 at 02:15:18PM +0100, Srinivas Kandagatla wrote: >> >> >> On 10/08/15 13:38, Thierry Reding wrote: >>> On Mon, Aug 10, 2015 at 12:59:34PM +0100, Srinivas Kandagatla wrote: >>>> This patch modifies the driver to support standard gpio properties along >>>> with deprecated properties. This will help us upstream and cleanup the >>>> non-standard properties over the time. >>>> >>>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >>>> --- >>>> drivers/gpu/drm/msm/hdmi/hdmi.c | 35 +++++++++++++++++++++++++---------- >>>> 1 file changed, 25 insertions(+), 10 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c >>>> index 8145362..e918889 100644 >>>> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c >>>> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c >>>> @@ -339,19 +339,34 @@ static const struct of_device_id dt_match[] = { >>>> }; >>>> >>>> #ifdef CONFIG_OF >>>> +/* This code will be removed once we move to gpiod based calls */ >>> >>> Why don't you do this now instead of duplicating what is essentially >>> already implemented in gpiolib? >>> >> One of the thing that Rob asked in his comments >> (http://www.spinics.net/lists/arm-kernel/msg437675.html) was to retain the >> support for old devices, moving to gpiod ATM would break such devices as >> they are still using legacy gpiolib and its naming. >> >> >> If Rob is ok to drop gpio properties which does not have "-gpio" or "-gpios" >> suffix then we can get rid of this function all together. > > If you make the switch to gpiod_*() APIs you'll get this for free. > There's really no need for having a duplicate of what gpiod_get() > already does for you. > Yes, you are right, my memory was over written on friday by looking at of_find_gpio() for long :-) AFAIK, gpiod_get would also request the gpios so we might want to remove the additional gpio requests in the hdmi_connector.c too. I will give that a try once again.. --srini > Thierry >
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 8145362..e918889 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -339,19 +339,34 @@ static const struct of_device_id dt_match[] = { }; #ifdef CONFIG_OF +/* This code will be removed once we move to gpiod based calls */ static int get_gpio(struct device *dev, struct device_node *of_node, const char *name) { + char name2[32]; int gpio = of_get_named_gpio(of_node, name, 0); - if (gpio < 0) { - char name2[32]; - snprintf(name2, sizeof(name2), "%s-gpio", name); - gpio = of_get_named_gpio(of_node, name2, 0); - if (gpio < 0) { - dev_err(dev, "failed to get gpio: %s (%d)\n", - name, gpio); - gpio = -1; - } - } + + if (gpio_is_valid(gpio)) + goto deprecated; + + snprintf(name2, sizeof(name2), "%s-gpio", name); + gpio = of_get_named_gpio(of_node, name2, 0); + + if (gpio_is_valid(gpio)) + goto deprecated; + + + snprintf(name2, sizeof(name2), "%s-gpios", name); + gpio = of_get_named_gpio(of_node, name2, 0); + + if (gpio_is_valid(gpio)) + return gpio; + + dev_err(dev, "failed to get gpio: %s (%d)\n", name, gpio); + + return -1; + +deprecated: + dev_warn(dev, "binding deprecated for %s\n", name); return gpio; } #endif
This patch modifies the driver to support standard gpio properties along with deprecated properties. This will help us upstream and cleanup the non-standard properties over the time. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- drivers/gpu/drm/msm/hdmi/hdmi.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-)