Re: [PATCH v2 08/10] hikey960: Support usb functionality of Hikey960

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux