diff --git a/arch/riscv/boot/dts/thead/a200-evb.dts b/arch/riscv/boot/dts/thead/a200-evb.dts index aac5d486d..c3308cb4e 100644 --- a/arch/riscv/boot/dts/thead/a200-evb.dts +++ b/arch/riscv/boot/dts/thead/a200-evb.dts @@ -6,7 +6,7 @@ / { model = "A200 EVB configuration"; - compatible = "zhihe,a200-evb"; + compatible = "sipeed,lichee-pi-4a", "sipeed,lichee-module-4a", "thead,th1520", "thead,light", "zhihe,a200-evb"; aliases { vivcam3 = &vvcam_sensor3; @@ -263,20 +263,42 @@ vin-supply = <®_vdd_3v3>; }; - reg_aud_3v3: regulator-aud-3v3 { + reg_aud_adc_3v3: regulator-aud-adc-3v3 { compatible = "regulator-fixed"; - regulator-name = "aud_3v3"; + regulator-name = "aud_adc_3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; + gpio = <&aud_ioexp 0 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; }; - reg_aud_1v8: regulator-aud-1v8 { + reg_aud_adc_1v8: regulator-aud-adc-1v8 { compatible = "regulator-fixed"; - regulator-name = "aud_1v8"; + regulator-name = "aud_adc_1v8"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; + gpio = <&aud_ioexp 1 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + reg_aud_dac_3v3: regulator-aud-dac-3v3 { + compatible = "regulator-fixed"; + regulator-name = "aud_dac_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&aud_ioexp 2 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + reg_aud_dac_1v8: regulator-aud-dac-1v8 { + compatible = "regulator-fixed"; + regulator-name = "aud_dac_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + gpio = <&aud_ioexp 3 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; }; @@ -336,7 +358,7 @@ #sound-dai-cells = <0>; compatible = "xuantie,th1520-hdmi-pcm"; sound-name-prefix = "DUMMY"; - status = "disabled"; + status = "okay"; }; th1520_sound: soundcard@1 { @@ -380,7 +402,7 @@ usb-hub { #address-cells = <1>; #size-cells = <0>; - status = "disabled"; + status = "okay"; hub_2_0: hub@1 { compatible = "usb2109,2817"; @@ -406,7 +428,7 @@ WIFI,poweren-gpios = <&ioexp2 12 0>; power_on_after_init; power_on_when_resume; - status = "disabled"; + status = "okay"; }; gpio-keys { @@ -450,16 +472,16 @@ i2c_data_width = /bits/ 8 <1>; i2c_addr = /bits/ 8 <0x36>; i2c_bus = /bits/ 8 <0>; - status = "disabled"; + status = "okay"; }; video2: cam_dev@300 { compatible = "xuantie,th1520-video"; vi_mem_pool_region = <0>; // vi_mem: framebuffer, region[0] - status = "disabled"; + status = "okay"; channel0 { channel_id = <0>; - status = "disabled"; + status = "okay"; sensor1 { subdev_name = "vivcam"; idx = <3>; @@ -539,7 +561,7 @@ video3: cam_dev@400{ compatible = "xuantie,th1520-video"; vi_mem_pool_region = <0>; // vi_mem: framebuffer, region[0] - status = "disabled"; + status = "okay"; channel0 { sensor1 { subdev_name = "vivcam"; @@ -1456,7 +1478,7 @@ }; i2s1_pa_pins: i2s1-pa-0 { i2s-pa-pins { - pins = "AUDIO_PA14", "AUDIO_PA15", "AUDIO_PA16", "AUDIO_PA17"; + pins = "AUDIO_PA13", "AUDIO_PA14", "AUDIO_PA15", "AUDIO_PA16", "AUDIO_PA17"; function = "audio"; bias-disable; drive-strength = <0>; @@ -1521,7 +1543,7 @@ i2s1_pins: i2s1-0 { i2s-pins { - pins = "PA14_FUNC", "PA15_FUNC", "PA16_FUNC", "PA17_FUNC"; + pins = "PA13_FUNC", "PA14_FUNC", "PA15_FUNC", "PA16_FUNC", "PA17_FUNC"; function = "aud_i2s1"; bias-disable; drive-strength = <13>; @@ -1592,20 +1614,22 @@ compatible = "everest,es8156"; reg = <0x08>; sound-name-prefix = "ES8156"; - AVDD-supply = <®_aud_3v3>; - DVDD-supply = <®_aud_1v8>; - PVDD-supply = <®_aud_1v8>; + AVDD-supply = <®_aud_dac_3v3>; + DVDD-supply = <®_aud_dac_1v8>; + PVDD-supply = <®_aud_dac_1v8>; + status = "okay"; }; - es7210_audio_codec: es7210@40 { + es7210_audio_codec: es7210@40 { /* connect to I2S2 */ #sound-dai-cells = <0>; compatible = "MicArray_0"; reg = <0x40>; sound-name-prefix = "ES7210"; - MVDD-supply = <®_aud_3v3>; - AVDD-supply = <®_aud_3v3>; - DVDD-supply = <®_aud_1v8>; - PVDD-supply = <®_aud_1v8>; + MVDD-supply = <®_aud_adc_3v3>; + AVDD-supply = <®_aud_adc_3v3>; + DVDD-supply = <®_aud_adc_1v8>; + PVDD-supply = <®_aud_adc_1v8>; + status = "okay"; }; }; @@ -1800,30 +1824,31 @@ &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>; - status = "disabled"; + status = "okay"; }; &uart3 { pinctrl-names = "default"; pinctrl-0 = <&uart3_pins>; - status = "disabled"; + status = "okay"; }; &uart4 { pinctrl-names = "default"; pinctrl-0 = <&uart4_pins>; - status = "disabled"; + status = "okay"; }; &usb { - hubswitch-gpio = <&aogpio 4 0>; - status = "disabled"; + usb3-vbus-en-gpios = <&ioexp1 11 GPIO_ACTIVE_HIGH>; + usb3-oc-gpios = <&ioexp1 12 GPIO_ACTIVE_HIGH>; + status = "okay"; }; &usb_dwc3 { #address-cells = <1>; #size-cells = <0>; - status = "disabled"; + status = "okay"; }; &adc { @@ -1831,7 +1856,7 @@ #io-channel-cells = <1>; sampling-frequency = <1000000>; resolution = <12>; - status = "disabled"; + status = "okay"; }; &spi { @@ -1840,7 +1865,7 @@ rx-sample-delay-ns = <10>; pinctrl-names = "default"; pinctrl-0 = <&spi_pins>; - status = "disabled"; + status = "okay"; spi_norflash@0 { #address-cells = <1>; @@ -1857,7 +1882,7 @@ cs-gpios = <&gpio2 3 0>; pinctrl-names = "default"; pinctrl-0 = <&qspi0_pins>; - status = "disabled"; + status = "okay"; spi_norflash@0 { #address-cells = <1>; @@ -1891,7 +1916,7 @@ cs-gpios = <&gpio0 1 0>; pinctrl-names = "default"; pinctrl-0 = <&qspi1_pins>; - status = "disabled"; + status = "okay"; spi-flash@0 { #address-cells = <1>; @@ -1951,89 +1976,89 @@ }; &ap_i2s { - status = "disabled"; + status = "okay"; }; &i2s1 { pinctrl-names = "default"; pinctrl-0 = <&i2s1_pa_pins>, <&i2s1_pins>; - status = "disabled"; + status = "okay"; }; &isp0 { - status = "disabled"; + status = "okay"; }; &isp1 { - status = "disabled"; + status = "okay"; }; &isp_ry0 { - status = "disabled"; + status = "okay"; }; &dewarp { - status = "disabled"; + status = "okay"; }; &dec400_isp0 { - status = "disabled"; + status = "okay"; }; &dec400_isp1 { - status = "disabled"; + status = "okay"; }; &dec400_isp2 { - status = "disabled"; + status = "okay"; }; &bm_visys { - status = "disabled"; + status = "okay"; }; &bm_csi0 { - status = "disabled"; + status = "okay"; }; &bm_csi1 { - status = "disabled"; + status = "okay"; }; &bm_csi2 { - status = "disabled"; + status = "okay"; }; &vidmem { - status = "disabled"; + status = "okay"; memory-region = <&vi_mem>; }; &vi_pre { - status = "disabled"; + status = "okay"; }; &xtensa_dsp { - status = "disabled"; + status = "okay"; }; &xtensa_dsp0 { - status = "disabled"; + status = "okay"; memory-region = <&dsp0_mem>; }; &xtensa_dsp1 { - status = "disabled"; + status = "okay"; memory-region = <&dsp1_mem>; }; &gpu { - status = "disabled"; + status = "okay"; }; &npu { vha_clk_rate = <1000000000>; - status = "disabled"; + status = "okay"; }; &npu_opp_table { @@ -2055,7 +2080,7 @@ &hdmi_tx { pinctrl-names = "default"; pinctrl-0 = <&hdmi_tx_pins>; - status = "disabled"; + status = "okay"; port@0 { /* input */ @@ -2066,5 +2091,13 @@ }; &eip_28 { - status = "disabled"; + status = "okay"; +}; + +&dmac0 { + status = "okay"; +}; + +&dmac2 { + status = "okay"; }; diff --git a/drivers/gpu/drm/verisilicon/vs_crtc.c b/drivers/gpu/drm/verisilicon/vs_crtc.c index d5167067d..b0c6817cd 100644 --- a/drivers/gpu/drm/verisilicon/vs_crtc.c +++ b/drivers/gpu/drm/verisilicon/vs_crtc.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "vs_crtc.h" @@ -267,6 +268,17 @@ static bool vs_crtc_mode_fixup(struct drm_crtc *crtc, return vs_crtc->funcs->mode_fixup(vs_crtc->dev, crtc, mode, adjusted_mode); } +static enum drm_mode_status vs_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + struct vs_crtc *vs_crtc = to_vs_crtc(crtc); + + if (vs_crtc->funcs->mode_valid) + return vs_crtc->funcs->mode_valid(vs_crtc->dev, crtc, mode); + + return MODE_OK; +} + #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0) static void vs_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *old_state) @@ -361,6 +373,7 @@ static void vs_crtc_atomic_flush(struct drm_crtc *crtc, } static const struct drm_crtc_helper_funcs vs_crtc_helper_funcs = { + .mode_valid = vs_crtc_mode_valid, .mode_fixup = vs_crtc_mode_fixup, .atomic_enable = vs_crtc_atomic_enable, .atomic_disable = vs_crtc_atomic_disable, diff --git a/drivers/gpu/drm/verisilicon/vs_crtc.h b/drivers/gpu/drm/verisilicon/vs_crtc.h index 154f2f4bf..521036d8b 100644 --- a/drivers/gpu/drm/verisilicon/vs_crtc.h +++ b/drivers/gpu/drm/verisilicon/vs_crtc.h @@ -20,6 +20,9 @@ struct vs_crtc_funcs { struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); + enum drm_mode_status (*mode_valid)(struct device *dev, + struct drm_crtc *crtc, + const struct drm_display_mode *mode); void (*set_gamma)(struct device *dev, struct drm_crtc *crtc, struct drm_color_lut *lut, unsigned int size); void (*enable_gamma)(struct device *dev, struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/verisilicon/vs_dc.c b/drivers/gpu/drm/verisilicon/vs_dc.c index 7ef65f887..8cc1106ca 100644 --- a/drivers/gpu/drm/verisilicon/vs_dc.c +++ b/drivers/gpu/drm/verisilicon/vs_dc.c @@ -438,6 +438,34 @@ static bool vs_dc_mode_fixup(struct device *dev, return true; } +static enum drm_mode_status vs_dc_mode_valid(struct device *dev, + struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + struct vs_dc *dc = dev_get_drvdata(dev); + int id = to_vs_display_id(dc, crtc); + long clk_rate, request_rate; + + if (unlikely(id >= DC_DISPLAY_NUM)) + return MODE_BAD; + + if (!dc->pixclk[id]) + return MODE_OK; + + request_rate = mode->clock * 1000; + clk_rate = clk_round_rate(dc->pixclk[id], request_rate); + + /* + * If the clock rate difference is more than 100, the mode is + * considered unsupported by the CRTC hardware. + * refer to dw_hdmi_tx_phy_gen2_configure() function + */ + if (abs(clk_rate - request_rate) > 100) + return MODE_CLOCK_RANGE; + + return MODE_OK; +} + static void vs_dc_set_gamma(struct device *dev, struct drm_crtc *crtc, struct drm_color_lut *lut, unsigned int size) { @@ -942,6 +970,7 @@ static const struct vs_crtc_funcs dc_crtc_funcs = { .enable = vs_dc_enable, .disable = vs_dc_disable, .mode_fixup = vs_dc_mode_fixup, + .mode_valid = vs_dc_mode_valid, .set_gamma = vs_dc_set_gamma, .enable_gamma = vs_dc_enable_gamma, .enable_vblank = vs_dc_enable_vblank, diff --git a/drivers/usb/dwc3/dwc3-thead.c b/drivers/usb/dwc3/dwc3-thead.c index a8c8a4359..1112b81db 100644 --- a/drivers/usb/dwc3/dwc3-thead.c +++ b/drivers/usb/dwc3/dwc3-thead.c @@ -86,6 +86,8 @@ struct dwc3_thead { struct regmap *misc_sysreg; struct gpio_desc *hubswitch; + struct gpio_desc *usb3_vbus_ok; + struct gpio_desc *usb3_oc; struct regulator *hub1v2; struct regulator *hub5v; struct regulator *vbus; @@ -155,6 +157,18 @@ static int dwc3_thead_probe(struct platform_device *pdev) dev_err(dev, "no need to get hubswitch GPIO\n"); dev_info(dev, "hubswitch usb_role = %d\n", usb_role); + thead->usb3_vbus_ok = devm_gpiod_get_optional(&pdev->dev, "usb3-vbus-en", GPIOD_OUT_LOW); + if (IS_ERR(thead->usb3_vbus_ok)) + thead->usb3_vbus_ok = NULL; + else if (thead->usb3_vbus_ok) + gpiod_set_value(thead->usb3_vbus_ok, 1); + + thead->usb3_oc = devm_gpiod_get_optional(&pdev->dev, "usb3-oc", GPIOD_OUT_LOW); + if (IS_ERR(thead->usb3_oc)) + thead->usb3_oc = NULL; + else if (thead->usb3_oc) + gpiod_set_value(thead->usb3_oc, 1); + thead->misc_sysreg = syscon_regmap_lookup_by_phandle(np, "usb3-misc-regmap"); if (IS_ERR(thead->misc_sysreg)) { dev_err(dev, "failed to get regmap - %ld\n", PTR_ERR(thead->misc_sysreg)); @@ -273,4 +287,4 @@ module_platform_driver(dwc3_thead_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("DesignWare DWC3 T-HEAD Glue Driver"); -MODULE_AUTHOR("Jisheng Zhang "); \ No newline at end of file +MODULE_AUTHOR("Jisheng Zhang ");