| .. | .. |
|---|
| 44 | 44 | *.xz |
|---|
| 45 | 45 | Module.symvers |
|---|
| 46 | 46 | modules.builtin |
|---|
| 47 | +*.modinfo |
|---|
| 47 | 48 | |
|---|
| 48 | 49 | # |
|---|
| 49 | 50 | # Top-level generic files |
|---|
| .. | .. |
|---|
| 38 | 38 | io-channels = <&saradc 3>; |
|---|
| 39 | 39 | io-channel-names = "adc-detect"; |
|---|
| 40 | 40 | keyup-threshold-microvolt = <1800000>; |
|---|
| 41 | | - pinctrl-0 = <&hp_det>; |
|---|
| 41 | + pinctrl-0 = <&spk_con>; |
|---|
| 42 | 42 | pinctrl-names = "default"; |
|---|
| 43 | | - hp-det-gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>; |
|---|
| 44 | | - spk-con-gpio = <&gpio3 RK_PC3 GPIO_ACTIVE_HIGH>; |
|---|
| 43 | + //hp-det-gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>; |
|---|
| 44 | + //spk-con-gpio = <&gpio3 RK_PC3 GPIO_ACTIVE_HIGH>; |
|---|
| 45 | 45 | play-pause-key { |
|---|
| 46 | 46 | label = "playpause"; |
|---|
| 47 | 47 | linux,code = <164>; |
|---|
| .. | .. |
|---|
| 132 | 132 | }; |
|---|
| 133 | 133 | |
|---|
| 134 | 134 | rk_headset: rk-headset { |
|---|
| 135 | | - status = "disabled"; |
|---|
| 135 | + status = "okay"; |
|---|
| 136 | 136 | compatible = "rockchip_headset"; |
|---|
| 137 | | - headset_gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>; |
|---|
| 137 | + headset_gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>; |
|---|
| 138 | + spk_ctl_gpio = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; |
|---|
| 138 | 139 | pinctrl-names = "default"; |
|---|
| 139 | 140 | pinctrl-0 = <&hp_det>; |
|---|
| 140 | 141 | io-channels = <&saradc 3>; |
|---|
| .. | .. |
|---|
| 389 | 390 | &combphy0_ps { |
|---|
| 390 | 391 | status = "okay"; |
|---|
| 391 | 392 | }; |
|---|
| 393 | + |
|---|
| 394 | +/* |
|---|
| 395 | +&usbdrd_dwc3_0 { |
|---|
| 396 | + dr_mode = "otg"; |
|---|
| 397 | + extcon = <&u2phy0>; |
|---|
| 398 | + status = "okay"; |
|---|
| 399 | +}; |
|---|
| 400 | +*/ |
|---|
| 392 | 401 | |
|---|
| 393 | 402 | &combphy1_ps { |
|---|
| 394 | 403 | status = "okay"; |
|---|
| .. | .. |
|---|
| 901 | 910 | hp_det: hp-det { |
|---|
| 902 | 911 | rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; |
|---|
| 903 | 912 | }; |
|---|
| 913 | + |
|---|
| 914 | + spk_con: spk-con { |
|---|
| 915 | + rockchip,pins = <3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; |
|---|
| 916 | + }; |
|---|
| 904 | 917 | }; |
|---|
| 905 | 918 | |
|---|
| 906 | 919 | hym8563 { |
|---|
| .. | .. |
|---|
| 1050 | 1063 | vmmc-supply = <&vcc_3v3_sd_s0>; |
|---|
| 1051 | 1064 | }; |
|---|
| 1052 | 1065 | |
|---|
| 1053 | | -&uart9 { |
|---|
| 1054 | | - status = "okay"; |
|---|
| 1055 | | - pinctrl-names = "default"; |
|---|
| 1056 | | - pinctrl-0 = <&uart9m0_xfer &uart9m0_ctsn>; |
|---|
| 1057 | | -}; |
|---|
| 1058 | | - |
|---|
| 1059 | 1066 | &u2phy0_otg { |
|---|
| 1060 | 1067 | status = "okay"; |
|---|
| 1061 | 1068 | }; |
|---|
| .. | .. |
|---|
| 1099 | 1106 | status = "okay"; |
|---|
| 1100 | 1107 | }; |
|---|
| 1101 | 1108 | |
|---|
| 1102 | | -&usbdrd_dwc3_0 { |
|---|
| 1103 | | - dr_mode = "otg"; |
|---|
| 1104 | | - extcon = <&u2phy0>; |
|---|
| 1105 | | - status = "okay"; |
|---|
| 1106 | | -}; |
|---|
| 1107 | | - |
|---|
| 1108 | 1109 | &usbdrd_dwc3_1 { |
|---|
| 1109 | 1110 | dr_mode = "host"; |
|---|
| 1110 | 1111 | maximum-speed = "high-speed"; |
|---|
| 1111 | | - status = "okay"; |
|---|
| 1112 | + status = "disabled"; |
|---|
| 1112 | 1113 | }; |
|---|
| 1113 | 1114 | |
|---|
| 1114 | 1115 | &uart1 { |
|---|
| .. | .. |
|---|
| 153 | 153 | { |
|---|
| 154 | 154 | int level = 0; |
|---|
| 155 | 155 | int level2 = 0; |
|---|
| 156 | + int ret; |
|---|
| 156 | 157 | struct rk_headset_pdata *pdata = headset_info->pdata; |
|---|
| 157 | 158 | static unsigned int old_status = 0; |
|---|
| 158 | 159 | |
|---|
| .. | .. |
|---|
| 177 | 178 | pr_warn("old_status == headset_info->headset_status\n"); |
|---|
| 178 | 179 | goto out; |
|---|
| 179 | 180 | } |
|---|
| 180 | | - DBG("(headset in is %s)headset status is %s\n", |
|---|
| 181 | + DBG("(troy test headset in is %s)headset status is %s\n", |
|---|
| 181 | 182 | pdata->headset_insert_type ? "high level" : "low level", |
|---|
| 182 | 183 | headset_info->headset_status ? "in" : "out"); |
|---|
| 183 | 184 | if (headset_info->headset_status == HEADSET_IN) { |
|---|
| 184 | 185 | headset_info->cur_headset_status = BIT_HEADSET_NO_MIC; |
|---|
| 186 | + ret = gpio_direction_output(pdata->spk_ctl_gpio,1); |
|---|
| 187 | + if (ret < 0) { |
|---|
| 188 | + printk("spk_ctl_gpio set direction fail\n"); |
|---|
| 189 | + } |
|---|
| 185 | 190 | if (pdata->headset_insert_type == HEADSET_IN_HIGH) |
|---|
| 186 | 191 | irq_set_irq_type(headset_info->irq[HEADSET], |
|---|
| 187 | 192 | IRQF_TRIGGER_FALLING); |
|---|
| .. | .. |
|---|
| 196 | 201 | goto out; |
|---|
| 197 | 202 | } |
|---|
| 198 | 203 | } else if (headset_info->headset_status == HEADSET_OUT) { |
|---|
| 204 | + ret = gpio_direction_output(pdata->spk_ctl_gpio,0); |
|---|
| 205 | + if (ret < 0) { |
|---|
| 206 | + printk("spk_ctl_gpio set direction fail\n"); |
|---|
| 207 | + } |
|---|
| 199 | 208 | headset_info->hook_status = HOOK_UP; |
|---|
| 200 | 209 | if (headset_info->isHook_irq == enable) { |
|---|
| 201 | 210 | DBG("disable headset_hook irq\n"); |
|---|
| .. | .. |
|---|
| 11 | 11 | struct rk_headset_pdata { |
|---|
| 12 | 12 | /* heaset about */ |
|---|
| 13 | 13 | unsigned int headset_gpio; |
|---|
| 14 | + unsigned int spk_ctl_gpio; |
|---|
| 14 | 15 | /* Headphones into the state level */ |
|---|
| 15 | 16 | unsigned int headset_insert_type; |
|---|
| 16 | 17 | /* hook about */ |
|---|
| .. | .. |
|---|
| 111 | 111 | struct rk_headset_pdata *pdata = headset_info->pdata; |
|---|
| 112 | 112 | static unsigned int old_status = 0; |
|---|
| 113 | 113 | int i, level = 0; |
|---|
| 114 | + int ret; |
|---|
| 114 | 115 | |
|---|
| 115 | 116 | disable_irq_nosync(headset_info->irq[HEADSET]); |
|---|
| 116 | 117 | if (headset_info->heatset_irq_working == BUSY || |
|---|
| .. | .. |
|---|
| 161 | 162 | goto out; |
|---|
| 162 | 163 | } |
|---|
| 163 | 164 | |
|---|
| 164 | | - pr_info("(headset in is %s)headset status is %s\n", |
|---|
| 165 | + pr_info("(myttest headset in is %s)headset status is %s\n", |
|---|
| 165 | 166 | pdata->headset_insert_type ? "high level" : "low level", |
|---|
| 166 | 167 | headset_info->headset_status ? "in" : "out"); |
|---|
| 167 | 168 | |
|---|
| 168 | 169 | if (headset_info->headset_status == HEADSET_IN) { |
|---|
| 170 | + ret = gpio_direction_output(pdata->spk_ctl_gpio,1); |
|---|
| 171 | + if (ret < 0) { |
|---|
| 172 | + printk("spk_ctl_gpio set direction fail\n"); |
|---|
| 173 | + } |
|---|
| 169 | 174 | if (pdata->chan != 0) { |
|---|
| 170 | 175 | /* detect Hook key */ |
|---|
| 171 | 176 | schedule_delayed_work( |
|---|
| .. | .. |
|---|
| 186 | 191 | irq_set_irq_type(headset_info->irq[HEADSET], |
|---|
| 187 | 192 | IRQF_TRIGGER_RISING); |
|---|
| 188 | 193 | } else if (headset_info->headset_status == HEADSET_OUT) { |
|---|
| 194 | + ret = gpio_direction_output(pdata->spk_ctl_gpio,0); |
|---|
| 195 | + if (ret < 0) { |
|---|
| 196 | + printk("spk_ctl_gpio set direction fail\n"); |
|---|
| 197 | + } |
|---|
| 189 | 198 | headset_info->cur_headset_status = HEADSET_OUT; |
|---|
| 190 | 199 | cancel_delayed_work(&headset_info->hook_work); |
|---|
| 191 | 200 | if (headset_info->isMic) { |
|---|
| .. | .. |
|---|
| 73 | 73 | HEADSET_IN_LOW : |
|---|
| 74 | 74 | HEADSET_IN_HIGH; |
|---|
| 75 | 75 | } |
|---|
| 76 | + |
|---|
| 77 | + /* spk-ctl */ |
|---|
| 78 | + ret = of_get_named_gpio_flags(node, "spk_ctl_gpio", 0, &flags); |
|---|
| 79 | + if (ret < 0) { |
|---|
| 80 | + dev_err(&pdev->dev, "Can not read property headset_gpio\n"); |
|---|
| 81 | + goto err; |
|---|
| 82 | + } else { |
|---|
| 83 | + pdata->spk_ctl_gpio = ret; |
|---|
| 84 | + ret = devm_gpio_request(&pdev->dev, pdata->spk_ctl_gpio, |
|---|
| 85 | + "spk_ctl_gpio"); |
|---|
| 86 | + if (ret < 0) { |
|---|
| 87 | + dev_err(&pdev->dev, "spk_ctl_gpio request fail\n"); |
|---|
| 88 | + goto err; |
|---|
| 89 | + } |
|---|
| 90 | + |
|---|
| 91 | + ret = gpio_get_value(pdata->headset_gpio); |
|---|
| 92 | + printk(" headset_gpio value : %d\n",ret); |
|---|
| 93 | + if (ret == 0) |
|---|
| 94 | + ret = gpio_direction_output(pdata->spk_ctl_gpio,0); |
|---|
| 95 | + else |
|---|
| 96 | + ret = gpio_direction_output(pdata->spk_ctl_gpio,1); |
|---|
| 97 | + if (ret < 0) { |
|---|
| 98 | + dev_err(&pdev->dev, |
|---|
| 99 | + "spk_ctl_gpio set direction fail\n"); |
|---|
| 100 | + goto err; |
|---|
| 101 | + } |
|---|
| 102 | + } |
|---|
| 103 | + |
|---|
| 76 | 104 | /* hook */ |
|---|
| 77 | 105 | ret = of_get_named_gpio_flags(node, "hook_gpio", 0, &pdata->hook_gpio); |
|---|
| 78 | 106 | if (ret < 0) { |
|---|