[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 12 Dec 2019 09:23:07 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: Chunfeng Yun <chunfeng.yun@...iatek.com>
Cc: linux-usb@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Maxime Ripard <mripard@...nel.org>,
Chen-Yu Tsai <wens@...e.org>, Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Stefan Agner <stefan@...er.ch>,
Linus Walleij <linus.walleij@...aro.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Subject: Re: [PATCH v2 4/4] usb: usb3503: Convert to use GPIO descriptors
Hi Chunfeng,
On 12.12.2019 03:10, Chunfeng Yun wrote:
> On Wed, 2019-12-11 at 15:52 +0100, Marek Szyprowski wrote:
>> From: Linus Walleij <linus.walleij@...aro.org>
>>
>> This converts the USB3503 to pick GPIO descriptors from the
>> device tree instead of iteratively picking out GPIO number
>> references and then referencing these from the global GPIO
>> numberspace.
>>
>> The USB3503 is only used from device tree among the in-tree
>> platforms. If board files would still desire to use it they can
>> provide machine descriptor tables.
>>
>> Make sure to preserve semantics such as the reset delay
>> introduced by Stefan.
>>
>> Cc: Chunfeng Yun <chunfeng.yun@...iatek.com>
>> Cc: Marek Szyprowski <m.szyprowski@...sung.com>
>> Cc: Stefan Agner <stefan@...er.ch>
>> Cc: Krzysztof Kozlowski <krzk@...nel.org>
>> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
>> [mszyprow: invert the logic behind reset GPIO line]
>> Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
>> ---
>> drivers/usb/misc/usb3503.c | 94 ++++++++++-----------------
>> include/linux/platform_data/usb3503.h | 3 -
>> 2 files changed, 35 insertions(+), 62 deletions(-)
>>
>> diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
>> index 72f39a9751b5..116bd789e568 100644
>> --- a/drivers/usb/misc/usb3503.c
>> +++ b/drivers/usb/misc/usb3503.c
>> @@ -7,11 +7,10 @@
>>
>> #include <linux/clk.h>
>> #include <linux/i2c.h>
>> -#include <linux/gpio.h>
>> +#include <linux/gpio/consumer.h>
>> #include <linux/delay.h>
>> #include <linux/slab.h>
>> #include <linux/module.h>
>> -#include <linux/of_gpio.h>
>> #include <linux/platform_device.h>
>> #include <linux/platform_data/usb3503.h>
>> #include <linux/regmap.h>
>> @@ -47,19 +46,19 @@ struct usb3503 {
>> struct device *dev;
>> struct clk *clk;
>> u8 port_off_mask;
>> - int gpio_intn;
>> - int gpio_reset;
>> - int gpio_connect;
>> + struct gpio_desc *intn;
>> + struct gpio_desc *reset;
>> + struct gpio_desc *connect;
>> bool secondary_ref_clk;
>> };
>>
>> static int usb3503_reset(struct usb3503 *hub, int state)
>> {
>> - if (!state && gpio_is_valid(hub->gpio_connect))
>> - gpio_set_value_cansleep(hub->gpio_connect, 0);
>> + if (!state && hub->connect)
>> + gpiod_set_value_cansleep(hub->connect, 0);
>>
>> - if (gpio_is_valid(hub->gpio_reset))
>> - gpio_set_value_cansleep(hub->gpio_reset, state);
>> + if (hub->reset)
>> + gpiod_set_value_cansleep(hub->reset, !state);
> What about preparing another patch for @state before this path?
In such case the driver will be broken after such patch until a
conversion to descriptor based GPIO api is done.
...
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Powered by blists - more mailing lists