lkml.org 
[lkml]   [2019]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 08/10] hikey960: Support usb functionality of Hikey960
From
Date
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).
>> +
>> + 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

\
 
 \ /
  Last update: 2019-02-19 04:21    [W:0.664 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site