diff --git a/arch/riscv/boot/dts/zhihe/a210-dev.dts b/arch/riscv/boot/dts/zhihe/a210-dev.dts old mode 100644 new mode 100755 index 1050c22d6..582785ac3 --- a/arch/riscv/boot/dts/zhihe/a210-dev.dts +++ b/arch/riscv/boot/dts/zhihe/a210-dev.dts @@ -1,5 +1,6 @@ /dts-v1/; +#include #include "a210-soc-core.dtsi" #include "a210-soc-peri.dtsi" #include "a210-platform-dev.dtsi" @@ -37,6 +38,7 @@ i2c5 = &i2c5; i2c6 = &i2c6; i2c7 = &i2c7; + aoi2c1 = &aoi2c1; can0 = &can0; can1 = &can1; @@ -148,6 +150,17 @@ slew-rate = <0>; }; }; + aoi2c1_pins: aoi2c1-0 { + i2c-pins { + pins = "AOI2C1_SCL", "AOI2C1_SDA"; + function = "aoi2c1"; + bias-disable; + drive-strength = <7>; + input-enable; + input-schmitt-enable; + slew-rate = <0>; + }; + }; }; &peri1_padctrl { @@ -573,6 +586,7 @@ compatible = "awinic,aw87565_pa"; reg = <0x5b>; sound-name-prefix = "AW87565_PA2"; + reset-gpios = <&aw9535_0 8 GPIO_ACTIVE_LOW>; status = "okay"; }; }; @@ -589,6 +603,41 @@ clock-frequency = <400000>; }; +&aoi2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&aoi2c1_pins>; + clock-frequency = <400000>; + status = "okay"; + + aw9535_0: gpio@20 { + compatible = "awinic,aw9535"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + interrupt-parent = <&ao_gpio1>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; + gpio-line-names = + "CSI1_PWDN_IO0", "CSI1_RST_IO1", "CSI1_FSIN_IO2", "CSI0_PWDN_IO3", // index 0..3 + "CSI0_RST_IO4", "CSI0_FSIN_IO5", "PCIE_X1_PRSNT_L_IO6", "PCIE_X4_PRSNT_L_IO7", // index 4..7 + "AUDIO1_PARST0_IO8", "AUDIO_ADC1_INT_IO9", "AUDIO_ADC0_INT_IO10", "HP_CTL_H_IO11", // index 8..11 + "SIT91211_SSC_EN_IO12","DISP_RST_IO13","SWITCH3_SEL_IO14","SWITCH1_SEL_IO15"; // index 12..15 + }; + + aw9535_1: gpio@21 { + compatible = "awinic,aw9535"; + reg = <0x21>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + gpio-line-names = + "PCIE_BAT_EN_IO0", "AUDIO_3V3_PWREN_IO1", "AUDIO_1V8_PWREN_IO2", "MIPI_CSI0_PWREN_IO3", // index 0..3 + "MIPI_CSI1_PWREN_IO4", "MIPI_TP_PWREN_IO5", "PCIE_3V3_EN_IO6", "PCIE_12V_EN_IO7", // index 4..7 + "USBCON_PWREN_IO8", "USBCON1_PWREN_IO9", "PCIE_3V3_AUX_EN_IO10", "SDIO_3V3_PWREN_IO11", // index 8..11 + "SDIO_1V8_PWREN_IO12","SIT91211_3V3_EN_IO13","MIPI_DSI_PWREN_IO14","BL_EN_IO15"; // index 12..15 + }; +}; + &uart4 { pinctrl-names = "default"; pinctrl-0 = <&uart4_pins>; diff --git a/arch/riscv/boot/dts/zhihe/a210-soc-peri.dtsi b/arch/riscv/boot/dts/zhihe/a210-soc-peri.dtsi old mode 100644 new mode 100755 index b3cffacd9..7430fc671 --- a/arch/riscv/boot/dts/zhihe/a210-soc-peri.dtsi +++ b/arch/riscv/boot/dts/zhihe/a210-soc-peri.dtsi @@ -1045,6 +1045,20 @@ status = "okay"; }; + aoi2c1: i2c@30891000{ + compatible = "snps,designware-i2c"; + reg = <0x00 0x30891000 0x0 0x1000>; + interrupt-parent = <&intc>; + interrupts = <20>; + //clocks = <&clk_peri PERI2_I2C7_IC_CLK_EN>, <&clk_peri PERI2_I2C7_PCLK_EN>; + clocks = <&aon_110m>; + clock-names = "ref", "pclk"; + //power-domains = <&power_peri2>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + }; + vdec: vdec@0006800000 { compatible = "zhihe,vpu-vc9000d"; address-cells = <2>; diff --git a/arch/riscv/configs/a210_evb_defconfig b/arch/riscv/configs/a210_evb_defconfig old mode 100644 new mode 100755 index 54ac98ee3..7d8e6124c --- a/arch/riscv/configs/a210_evb_defconfig +++ b/arch/riscv/configs/a210_evb_defconfig @@ -176,6 +176,8 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_A210=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_DWAPB=y +CONFIG_GPIO_PCA953X=y +CONFIG_GPIO_PCA953X_IRQ=y CONFIG_SENSORS_MR75203=y CONFIG_SENSORS_TMP102=m CONFIG_WATCHDOG=y diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 7a73e08e4..c7569d6c5 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -112,8 +113,11 @@ static const struct i2c_device_id pca953x_id[] = { { "tca9539", 16 | PCA953X_TYPE | PCA_INT, }, { "tca9554", 8 | PCA953X_TYPE | PCA_INT, }, { "xra1202", 8 | PCA953X_TYPE }, + + { "aw9535", 16 | PCA953X_TYPE | PCA_INT, }, { } }; + MODULE_DEVICE_TABLE(i2c, pca953x_id); #ifdef CONFIG_GPIO_PCA953X_IRQ @@ -1351,6 +1355,8 @@ static const struct of_device_id pca953x_dt_ids[] = { { .compatible = "onnn,pca9655", .data = OF_953X(16, PCA_INT), }, { .compatible = "exar,xra1202", .data = OF_953X( 8, 0), }, + + { .compatible = "awinic,aw9535", .data = OF_953X(16, PCA_INT) }, { } }; diff --git a/sound/soc/codecs/aw87565.c b/sound/soc/codecs/aw87565.c index cc3e573ed..fa70919b5 100644 --- a/sound/soc/codecs/aw87565.c +++ b/sound/soc/codecs/aw87565.c @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include "aw87565.h" /******************************************************************************* @@ -396,6 +398,9 @@ static const struct snd_soc_component_driver aw87565_component_driver = { static int aw87565_i2c_probe(struct i2c_client *client) { struct device_node *np = client->dev.of_node; + struct device_node *node; + struct device_node *aw9535_node = NULL; + int reg_val; int ret = -1; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { @@ -421,7 +426,14 @@ static int aw87565_i2c_probe(struct i2c_client *client) aw87565->i2c_client = client; i2c_set_clientdata(client, aw87565); - /* aw87565芯片ID检查 */ + aw87565->audio_parst0_desc = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); + if (aw87565->audio_parst0_desc) { + gpiod_set_value_cansleep(aw87565->audio_parst0_desc, 1); + msleep(1); + gpiod_set_value_cansleep(aw87565->audio_parst0_desc, 0); + msleep(5); + } + ret = aw87565_read_chipid(aw87565); if (ret < 0) { dev_err(&client->dev, "%s: aw87565_read_chipid failed %d\n", @@ -442,8 +454,6 @@ static int aw87565_i2c_probe(struct i2c_client *client) return devm_snd_soc_register_component(&client->dev, &aw87565_component_driver, NULL, 0); exit_i2c_check_id_failed: -exit_gpio_request_failed: -exit_gpio_get_failed: devm_kfree(&client->dev, aw87565); aw87565 = NULL; exit_devm_kzalloc_failed: @@ -453,6 +463,9 @@ exit_check_functionality_failed: static void aw87565_i2c_remove(struct i2c_client *client) { + if (aw87565->audio_parst0_desc) + gpiod_put(aw87565->audio_parst0_desc); + return; } static const struct i2c_device_id aw87565_i2c_id[] = { diff --git a/sound/soc/codecs/aw87565.h b/sound/soc/codecs/aw87565.h index 4ec20402a..c2925f478 100644 --- a/sound/soc/codecs/aw87565.h +++ b/sound/soc/codecs/aw87565.h @@ -158,6 +158,7 @@ struct aw87565 { unsigned char spk_cfg_update_flag; unsigned char rcv_cfg_update_flag; struct regmap *regmap; + struct gpio_desc *audio_parst0_desc; }; /*******************************************************************************