2016-08-18 2:00 GMT+03:00 Viresh Kumar <viresh.kumar@xxxxxxxxxx>: > On 17-08-16, 18:35, Matwey V. Kornilov wrote: >> Hello, >> >> Does anybody know whether it is possible to implement fast_switch() >> for cpufreq module used on am335x (like BeagleBone)? >> I would like to use fast_switch feature in my software driver rs485 >> duplex control implementation in tty/serial/8250/8250_port.c >> Recently I've faced an timing issue with it. Depending on current CPU >> on BeagleBone Black it takes from 40 usec to 200 usec to handle UART >> IRQ. >> Consequently, it takes 40-200 usec to switch transfer direction after >> the last char transmitted. >> It appeared that there are peripheral which start transmission after >> about 60 usec after last char received (When BeagleBone is not quick >> enough to switch direction to that time, the data go to nowhere). >> In order to avoid input data loss, I have to set CPU governor to >> `performance' on each boot. >> I suppose it would be great to use CPU frequency fast switching in >> UART IRQ handling when delay_rts_after_send is set to 0 in order to >> avoid similar issues. > > You mean that you want to update frequency of the cpu from your tty driver? I am > not sure if its a good idea really. I mean something like the following: static irqreturn_t omap8250_irq(int irq, void *dev_id) { struct uart_port *port = dev_id; struct uart_8250_port *up = up_to_u8250p(port); unsigned int iir; int ret; // fast_switch to the highest rate here #ifdef CONFIG_SERIAL_8250_DMA if (up->dma) { ret = omap_8250_dma_handle_irq(port); return IRQ_RETVAL(ret); } #endif serial8250_rpm_get(up); iir = serial_port_in(port, UART_IIR); ret = serial8250_handle_irq(port, iir); serial8250_rpm_put(up); // switch back here return IRQ_RETVAL(ret); } Probably, I've incorrectly understood the purpose of cpu freq fast switch. > > CPU frequency is governed by cpufreq governors, which evaluate the load at run > time and based on that take a decision to increase/decrease the frequency. > > -- > viresh > -- With best regards, Matwey V. Kornilov. Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia 119991, Moscow, Universitetsky pr-k 13, +7 (495) 9392382 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html