Skip to content

Commit c485335

Browse files
committed
fix(p4_usb): p4 tinyusb device phy init
1 parent cc286d8 commit c485335

File tree

7 files changed

+18
-25
lines changed

7 files changed

+18
-25
lines changed

components/audio/pwm_audio/pwm_audio.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
1+
/* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
22
*
33
* SPDX-License-Identifier: Apache-2.0
44
*/
@@ -475,18 +475,12 @@ esp_err_t pwm_audio_init(const pwm_audio_config_t *cfg)
475475
/**
476476
* Get the address of LEDC register to reduce the addressing time
477477
*/
478-
g_ledc_left_duty_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].\
479-
channel[handle->ledc_channel[CHANNEL_LEFT_INDEX].channel].duty.val;
480-
g_ledc_left_conf0_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].\
481-
channel[handle->ledc_channel[CHANNEL_LEFT_INDEX].channel].conf0.val;
482-
g_ledc_left_conf1_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].\
483-
channel[handle->ledc_channel[CHANNEL_LEFT_INDEX].channel].conf1.val;
484-
g_ledc_right_duty_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].\
485-
channel[handle->ledc_channel[CHANNEL_RIGHT_INDEX].channel].duty.val;
486-
g_ledc_right_conf0_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].\
487-
channel[handle->ledc_channel[CHANNEL_RIGHT_INDEX].channel].conf0.val;
488-
g_ledc_right_conf1_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].\
489-
channel[handle->ledc_channel[CHANNEL_RIGHT_INDEX].channel].conf1.val;
478+
g_ledc_left_duty_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].channel[handle->ledc_channel[CHANNEL_LEFT_INDEX].channel].duty.val;
479+
g_ledc_left_conf0_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].channel[handle->ledc_channel[CHANNEL_LEFT_INDEX].channel].conf0.val;
480+
g_ledc_left_conf1_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].channel[handle->ledc_channel[CHANNEL_LEFT_INDEX].channel].conf1.val;
481+
g_ledc_right_duty_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].channel[handle->ledc_channel[CHANNEL_RIGHT_INDEX].channel].duty.val;
482+
g_ledc_right_conf0_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].channel[handle->ledc_channel[CHANNEL_RIGHT_INDEX].channel].conf0.val;
483+
g_ledc_right_conf1_val = &LEDC.channel_group[handle->ledc_timer.speed_mode].channel[handle->ledc_channel[CHANNEL_RIGHT_INDEX].channel].conf1.val;
490484

491485
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
492486
gptimer_config_t timer_config = {

components/usb/usb_device_uvc/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog
22

3+
## v1.1.1 2024-10-17
4+
5+
* Add USB PHY initialization support for P4.
6+
37
## v1.1.0 2024-6-13
48

59
* Remove support for ESP-IDF < v5.0

components/usb/usb_device_uvc/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.1.0"
1+
version: "1.1.1"
22
targets:
33
- esp32s2
44
- esp32s3

components/usb/usb_device_uvc/usb_device_uvc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
#if CONFIG_TINYUSB_RHPORT_HS
1313
#include "soc/hp_sys_clkrst_reg.h"
1414
#include "soc/hp_system_reg.h"
15-
#else
16-
#include "esp_private/usb_phy.h"
1715
#endif
16+
#include "esp_private/usb_phy.h"
1817
#include "tusb.h"
1918
#include "usb_device_uvc.h"
2019

@@ -27,9 +26,7 @@ static const char *TAG = "usbd_uvc";
2726
#endif
2827

2928
typedef struct {
30-
#if !CONFIG_TINYUSB_RHPORT_HS
3129
usb_phy_handle_t phy_hdl;
32-
#endif
3330
bool uvc_init[UVC_CAM_NUM];
3431
uvc_format_t format[UVC_CAM_NUM];
3532
uvc_device_config_t user_config[UVC_CAM_NUM];
@@ -41,15 +38,16 @@ static uvc_device_t s_uvc_device;
4138

4239
static void usb_phy_init(void)
4340
{
44-
#if !CONFIG_TINYUSB_RHPORT_HS
4541
// Configure USB PHY
4642
usb_phy_config_t phy_conf = {
4743
.controller = USB_PHY_CTRL_OTG,
4844
.otg_mode = USB_OTG_MODE_DEVICE,
4945
.target = USB_PHY_TARGET_INT,
46+
#if CONFIG_TINYUSB_RHPORT_HS
47+
.otg_speed = USB_PHY_SPEED_HIGH,
48+
#endif
5049
};
5150
usb_new_phy(&phy_conf, &s_uvc_device.phy_hdl);
52-
#endif
5351
}
5452

5553
static inline uint32_t get_time_millis(void)

examples/.build-rules.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ examples/usb/device/usb_uac:
259259

260260
examples/usb/device/usb_dual_uvc_device:
261261
enable:
262-
- if: IDF_TARGET in ["esp32s3","esp32s2","esp32p4"]
262+
- if: IDF_TARGET in ["esp32s3","esp32s2"]
263+
- if: IDF_TARGET in ["esp32p4"] and (IDF_VERSION_MAJOR >= 5 and IDF_VERSION_MINOR >= 3)
263264
disable:
264265
- if: IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 0
265266
temporary: true

examples/usb/device/usb_extend_screen/main/app_usb.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static const char *TAG = "app_usb";
2424
//--------------------------------------------------------------------+
2525
static void usb_phy_init(void)
2626
{
27-
#if !CONFIG_TINYUSB_RHPORT_HS
2827
usb_phy_handle_t phy_hdl;
2928
// Configure USB PHY
3029
usb_phy_config_t phy_conf = {
@@ -33,7 +32,6 @@ static void usb_phy_init(void)
3332
};
3433
phy_conf.target = USB_PHY_TARGET_INT;
3534
usb_new_phy(&phy_conf, &phy_hdl);
36-
#endif
3735
}
3836

3937
static void tusb_device_task(void *arg)

examples/usb/device/usb_extend_screen/main/uac/usb_device_uac.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ static portMUX_TYPE s_mux = portMUX_INITIALIZER_UNLOCKED;
7272

7373
static void usb_phy_init(void)
7474
{
75-
#if !CONFIG_TINYUSB_RHPORT_HS
7675
// Configure USB PHY
7776
usb_phy_config_t phy_conf = {
7877
.controller = USB_PHY_CTRL_OTG,
7978
.otg_mode = USB_OTG_MODE_DEVICE,
8079
.target = USB_PHY_TARGET_INT,
8180
};
8281
usb_new_phy(&phy_conf, &s_uac_device->phy_hdl);
83-
#endif
8482
}
8583

8684
// Invoked when device is mounted

0 commit comments

Comments
 (0)