According to this pdf :
https://www.ti.com/lit/ug/tidu917/tidu917.pdfAt pages 6-7 it says:
According the description in the CHY100 datasheet, the processes to enter QC2.0 are:
− Apply a voltage between 0.325 V and 2 V to D+ for at least 1.25 seconds
− Discharge the D- voltage below 0.325 V for at least 1ms while keep the D+ voltage above 0.325 V
− Apply the voltage levels in Table 3 to set the output voltage. (must keep the D+ voltage above 0.325 V)
D+ D- Output Voltage
0.325 V – 2 V 0.325 V – 2 V 12 V
>2 V 0.325 V – 2 V 9 V
0.325 V – 2 V GND 5 V (default)
With 5v default , you could pick two resistors to form a voltage divider and get a bit more than 0.325v on D+ and D- , but still be under 2 v after the voltage changes to 9v
For example you could use a 6.8k resistor and a 1k resistor and you'd get ~0.64v with 5v input, and 1.15v at 9v and 1.54v with 12v input
For >2v you could either directly connect to incoming voltage or use a couple 1k resistors to get half the input voltage
So if you want to switch to 9v using QuickCharge 2 (or higher I guess) you'd need a small something (a 6 pin micro probably could do it) to initially set the D+ voltage between 0.3v-2v for at least 1.25s while D- is tied to ground (or nor connected to anything), then set D+ above 2v and D- must go up to 0.3v .. 2v
The schematic in the picture right above me would work because D- is initially not connected to anything, so it should be below 0.3v , and the 10k and 2k voltage divider produces around 0.9v with 5v input. After voltage switches to 12v, the voltage divider would produce 2.1v which is a bit above 2v so maybe slightly tweaking the values to something like 10k and 1.5k may be better (would produce 0.6v with 5v input, and around 1.5v with 12v input, keeping it below 2v)
You could use a slide switch - in the off switch it outputs to default 5v .. so you wait at least 1.25s, then move slide switch in the ON position, and on one side of the slide switch D+ is connected directly to input voltage instead of <2v (from voltage divider of 2 resistors like above) and the other side of slide switch would connect D- to <2v