[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <414a5760-8283-92c6-fab8-88c15194c798@huawei.com>
Date: Sat, 2 Mar 2019 09:02:51 +0800
From: Chen Yu <chenyu56@...wei.com>
To: Chunfeng Yun <chunfeng.yun@...iatek.com>
CC: <liuyu712@...ilicon.com>, <linux-usb@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<john.stultz@...aro.org>, <suzhuangluan@...ilicon.com>,
<kongfei@...ilicon.com>, <wanghu17@...ilicon.com>,
<butao@...ilicon.com>, <chenyao11@...wei.com>,
<fangshengzhou@...ilicon.com>, <lipengcheng8@...wei.com>,
<songxiaowei@...ilicon.com>, <xuyiping@...ilicon.com>,
<xuyoujun4@...wei.com>, <yudongbin@...ilicon.com>,
<zangleigang@...ilicon.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Binghui Wang <wangbinghui@...ilicon.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Subject: Re: [PATCH v2 08/10] hikey960: Support usb functionality of Hikey960
Hi Chunfeng Yun,
On 2019/2/22 15:32, Chunfeng Yun wrote:
> On Tue, 2019-02-19 at 11:20 +0800, Chen Yu wrote:
>> Hi,
>>
>> On 2019/2/19 10:50, Chunfeng Yun wrote:
>>>> + if (ret)
>>>> + hisi_hikey_usb->typec_vbus_enable_val = 1;
>>>> +
>>>> + hisi_hikey_usb->typec_vbus = devm_gpiod_get(dev, "typec-vbus",
>>>> + hisi_hikey_usb->typec_vbus_enable_val ?
>>>> + GPIOD_OUT_LOW : GPIOD_OUT_HIGH);
>>>> + if (!hisi_hikey_usb->typec_vbus)
>>>> + return -ENOENT;
>>>> + else if (IS_ERR(hisi_hikey_usb->typec_vbus))
>>>> + return PTR_ERR(hisi_hikey_usb->typec_vbus);
>>>> +
>>>> + gpiod_direction_output(hisi_hikey_usb->typec_vbus,
>>>> + !hisi_hikey_usb->typec_vbus_enable_val);
>>> maybe a simple way if use fixed regulator?
>>>
>> The hardware of the Hikey960 board has been fixed, and the type-c
>> port can act as UFP. So it is better to close the vbus when Hikey960
>> connect to host(e.g PC).
> I guess you misunderstand what I mean?
> Please refer to bindings/regulator/fixed-regulator.txt
> If you control vbus by gpio, you can use fixed-regulator, it will be
> easy to make compatible with other cases, think about using a LDO to
> control vbus
Sorry for misunderstanding the fixed-regulator and thanks for your advice!
I have read bindings/regulator/fixed-regulator.txt and I think it is enough
to use gpiod API right now.
>>>> +
>>>> + hisi_hikey_usb->otg_switch = devm_gpiod_get(dev, "otg-switch", GPIOD_IN);
>>>> + if (!hisi_hikey_usb->otg_switch)
>>>> + return -ENOENT;
>>>> + else if (IS_ERR(hisi_hikey_usb->otg_switch))
>>>> + return PTR_ERR(hisi_hikey_usb->otg_switch);
>>>> +
>>>> + gpiod_direction_output(hisi_hikey_usb->otg_switch, USB_SWITCH_TO_HUB);
>>>> +
>>>> + /* hub-vdd33-en is optional */
>>>> + hisi_hikey_usb->hub_vbus = devm_gpiod_get(dev, "hub-vdd33-en",
>>>> + GPIOD_OUT_LOW);
>>>> + if (IS_ERR(hisi_hikey_usb->hub_vbus))
>>>> + return PTR_ERR(hisi_hikey_usb->hub_vbus);
>>>> +
>>>> + gpiod_direction_output(hisi_hikey_usb->hub_vbus, HUB_VBUS_POWER_ON);
>>> ditto
>>>> +
>>>> + hisi_hikey_usb->role_sw = usb_role_switch_get(dev);
>>>> + if (!hisi_hikey_usb->role_sw)
>>>> + return -EPROBE_DEFER;
>>>> + else if (IS_ERR(hisi_hikey_usb->role_sw))
>>>> + return PTR_ERR(hisi_hikey_usb->role_sw);
>>>> +
>>
>> Thanks
>> Yu Chen
>>
>
Thanks
Yu Chen
Powered by blists - more mailing lists