From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753244AbbJUC5T (ORCPT ); Tue, 20 Oct 2015 22:57:19 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:38613 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751578AbbJUC5Q (ORCPT ); Tue, 20 Oct 2015 22:57:16 -0400 MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 X-AuditID: cbfee68d-f79ae6d00000149a-b5-5626ff050459 Content-transfer-encoding: 8BIT Message-id: <5626FF05.80908@samsung.com> Date: Wed, 21 Oct 2015 11:57:09 +0900 From: Chanwoo Choi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Sergei Shtylyov Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, myungjoo.ham@samsung.com, grant.likely@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] extcon: add MAX3355 driver References: <14631865.01KLlU2iKL@wasted.cogentembedded.com> <5490CEE2.1030900@samsung.com> <5491FC69.7090203@cogentembedded.com> <562685EF.7010504@cogentembedded.com> In-reply-to: <562685EF.7010504@cogentembedded.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsWyRsSkUJf1v1qYwc33Khbzj5xjteh/s5DV 4sCfHYwW516tZLS4vGsOm8WcP1OYLRYta2W2WHr9IpPF7cYVbBYTpq9lsWjde4Td4syqW+wO PB5r5q1h9Ljc18vk8WDqfyaPlcu/sHlsWtXJ5nHn2h42j74tqxg9Pm+SC+CI4rJJSc3JLEst 0rdL4Mo48vIxY8F8k4qHP3+wNDCu0uhi5OCQEDCRmNJu38XICWSKSVy4t54NxBYSWMEo8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zVvE DFH/gFHi04tJTBD1GhKnrt1iA7FZBFQlzpzrYwWx2QS0JPa/uMEGMkdUIEKi+0QlSFhEwELi buMiFpA5zALzmSQmHtgA1issoC/x4uJrqINWMUr8/n4TbAGngJHEhGVL2ScwCsxCct8shPtm IblvASMzUG9qQXJBcVJ6rlFearlecWJucWleul5yfu4mRnCqeCa9g/HwLvdDjAIcjEo8vB8W qoUJsSaWFVfmHmKU4GBWEuE9eQ0oxJuSWFmVWpQfX1Sak1p8iNEU6MGJzFKiyfnANJZXEm9o bGJmZGlkbmhhZGyuJM574xBDmJBAemJJanZqakFqEUwfEwenVAOjxr8XpTeXZi2dXlO5Ujry D4tutJi5aUeyKssnZ7F3FsJP4z/OLJbolm3WuFL9UkdEROX3fYHOjfM9H2dZm7p8k3mZ0s/X Of/rH5MLpnr8OWu2+K35turB18/+xTJ+f2d8mnd2076f8fZcn3KP+H2/W5edELLy93S7mw3T V5ctzpr5gXf3pCdiSizFGYmGWsxFxYkAPje6DCsDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sergei, I think this patch is too much delay. I recommend you better to develop this driver based on latest extcon-next branch[1]. [1] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/log/?h=extcon-next Thanks, Chanwoo Choi On 2015년 10월 21일 03:20, Sergei Shtylyov wrote: > Hello. > > On 12/18/2014 12:58 AM, Sergei Shtylyov wrote: > >>>> MAX3355E chip integrates a charge pump and comparators to enable a system with >>>> an integrated USB OTG dual-role transceiver to function as a USB OTG dual-role >>>> device. In addition to sensing/controlling Vbus, the chip also passes thru the >>>> ID signal from the USB OTG connector. On some Renesas boards, this signal is >>>> just fed into the SoC thru a GPIO pin -- there's no real OTG controller, only >>>> host and gadget USB controllers sharing the same USB bus; however, we'd like >>>> to allow host or gadget drivers to be loaded depending on the cable type, >>>> hence >>>> the need for the MAX3355 extcon driver. The Vbus status signals are also wired >>>> to GPIOs (however, we're not currently intested in them), the OFFVBUS# signal >>>> is controlled by the host controllers, there's also the SHDN# signal wired to >>>> GPIO, which should be high for normal operation. >> >>>> Signed-off-by: Sergei Shtylyov >> >>>> --- >>>> The patch is against the 'extcon-next' branch of the 'extcon.git' repo. >> >>>> Documentation/devicetree/bindings/extcon/extcon-max3355.txt | 21 ++ >>>> drivers/extcon/Kconfig | 6 >>>> drivers/extcon/Makefile | 1 >>>> drivers/extcon/extcon-max3355.c | 122 >>>> ++++++++++++ >>>> 4 files changed, 150 insertions(+) >> >>>> Index: extcon/Documentation/devicetree/bindings/extcon/extcon-max3355.txt >>>> =================================================================== >>>> --- /dev/null >>>> +++ extcon/Documentation/devicetree/bindings/extcon/extcon-max3355.txt >>>> @@ -0,0 +1,21 @@ >>>> +MAX3355 USB OTG chip >> >>> Need manufactor information as following : >>> -> Maxim MAX3355 >> >> Would be Maxim enough? Or perhaps I should use Maxim Integrated [Products]? > > You haven't replied to my questions. > >>>> +-------------------- >>>> + >>>> +MAX3355 integrates a charge pump and comparators to enable a system with an >>>> +integrated USB OTG dual-role transceiver to function as a USB OTG dual-role >>>> +device. >>>> + >>>> +Required properties: >>>> +- compatible: should be "maxim,max3355"; >>>> +- maxim,shdn-gpio: should contain a phandle and GPIO specifier for the >>>> GPIO pin >>>> + connected to the MAX3355's SHDN# pin; >>>> +- maxim,id-gpio: should contain a phandle and GPIO specifier for the GPIO pin >>>> + connected to the MAX3355's ID_OUT pin. >>>> + >>>> +Example (Koelsch board): >>>> + >>>> + usb-otg { >>>> + compatible = "maxim,max3355"; >>>> + maxim,shdn-gpio = <&gpio2 4 GPIO_ACTIVE_LOW>; >>>> + maxim,id-gpio = <&gpio5 31 GPIO_ACTIVE_HIGH>; >> >>> Kernel already supported the gpio helper function to get gpio from devicetree. >>> I prefer use follwoing style by using of_get_gpio()/of_get_gpio_flags() in >>> include/linux/of_gpio.h. >> >>> gpios = <&gpio2 4 GPIO_ACTIVE_LOW>, <&gpio5 31 GPIO_ACTIVE_HIGH>; >> >> OK, though Documentation/devicetree/bindings/gpio/gpio.txt does not seem >> to insist on using this one... > > Moreover, it now says "gpios" isn't allowed for the new bindings. So I have to strongly disagree here... > > [...] > >>>> +static irqreturn_t max3355_id_irq(int irq, void *dev_id) >>>> +{ >>>> + struct max3355_data *data = dev_id; >>>> + int id = gpio_get_value(data->id_gpio); >>>> + >>>> + extcon_set_cable_state(data->edev, "USB-HOST", !id); >> >>> You have to get the gpio flag in the devicetree by using of_get_gpio_flags() >>> function >>> and then you would set the cable state according to gpio state and flag. >> >> I'm sorry but I just don't see why I have to do it. This is not a generic >> GPIO driver, and the polarities of the GPIOs are determined solely by the >> MAX3355 specs. > > Again, got not reply... > >> [...] >>>> +static int max3355_probe(struct platform_device *pdev) >>>> +{ >>>> + struct device_node *np = pdev->dev.of_node; >>>> + struct max3355_data *data; >>>> + int gpio, irq, ret; >>>> + >>>> + data = devm_kzalloc(&pdev->dev, sizeof(struct max3355_data), >>>> + GFP_KERNEL); >>>> + if (!data) >>>> + return -ENOMEM; >>>> + >>>> + data->edev = devm_extcon_dev_allocate(&pdev->dev, max3355_cable); >>>> + if (IS_ERR(data->edev)) { >>>> + dev_err(&pdev->dev, "failed to allocate extcon device\n"); >>>> + return PTR_ERR(data->edev); >>>> + } >>>> + data->edev->name = kstrdup(np->name, GFP_KERNEL); >>>> + >>>> + gpio = of_get_named_gpio(np, "maxim,id-gpio", 0); >> >>> Use of_get_gpio() or of_get_gpio_flags(). >> >> OK, I'll use the first one. > > No, I won't due to not being able to use "gpios" anymore. > > [...] > >>>> + >>>> + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, max3355_id_irq, >>>> + IRQF_TRIGGER_RISING | >>>> + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, >> >>> Is it right to add both RISING and FALLING trigger? >> >> How else I'm supposed to know when the OTG ID signal goes low and high? >> >>> and need to add IRQF_NO_SUSPEND to wakeup from suspend state when interrupt >>> happen. >> >> Hm, are you sure we want to wake up on plugging another kind of USB cable? > > No reply to that as well... > > [...] >>>> +static struct platform_driver max3355_driver = { >>>> + .probe = max3355_probe, >>>> + .driver = { >>>> + .name = "extcon-max3355", >>>> + .of_match_table = max3355_match_table, >>>> + .owner = THIS_MODULE, >>>> + }, >>>> +}; >>>> + >>>> +module_platform_driver(max3355_driver); >>>> + >> >>> Don't need un-used blank line. >> >> I don't understand. There's empty line in such case in extcon-gpio.c... > > No reply... > > [...] > >>> Thanks, >>> Chanwoo Choi > > MBR, Sergei > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >