* In LPAR poll with 4kHz frequency. Poll every 250000 nanoseconds.
  * If z/VM change to 1500000 nanoseconds to adjust to z/VM polling.
  */
-static unsigned long long poll_timeout = 250000;
+static unsigned long poll_high_timeout = 250000UL;
+
+/*
+ * Some state machine states only require a low frequency polling.
+ * We use 25 Hz frequency for these.
+ */
+static unsigned long poll_low_timeout = 40000000UL;
 
 /* Maximum domain id, if not given via qci */
 static int ap_max_domain_id = 15;
                        break;
                }
                fallthrough;
-       case AP_SM_WAIT_TIMEOUT:
+       case AP_SM_WAIT_LOW_TIMEOUT:
+       case AP_SM_WAIT_HIGH_TIMEOUT:
                spin_lock_bh(&ap_poll_timer_lock);
                if (!hrtimer_is_queued(&ap_poll_timer)) {
-                       hr_time = poll_timeout;
+                       hr_time =
+                               wait == AP_SM_WAIT_LOW_TIMEOUT ?
+                               poll_low_timeout : poll_high_timeout;
                        hrtimer_forward_now(&ap_poll_timer, hr_time);
                        hrtimer_restart(&ap_poll_timer);
                }
 static ssize_t poll_thread_store(struct bus_type *bus,
                                 const char *buf, size_t count)
 {
-       int flag, rc;
+       bool value;
+       int rc;
 
-       if (sscanf(buf, "%d\n", &flag) != 1)
-               return -EINVAL;
-       if (flag) {
+       rc = kstrtobool(buf, &value);
+       if (rc)
+               return rc;
+
+       if (value) {
                rc = ap_poll_thread_start();
                if (rc)
                        count = rc;
 
 static ssize_t poll_timeout_show(struct bus_type *bus, char *buf)
 {
-       return sysfs_emit(buf, "%llu\n", poll_timeout);
+       return sysfs_emit(buf, "%lu\n", poll_high_timeout);
 }
 
 static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
                                  size_t count)
 {
-       unsigned long long time;
+       unsigned long value;
        ktime_t hr_time;
+       int rc;
+
+       rc = kstrtoul(buf, 0, &value);
+       if (rc)
+               return rc;
 
        /* 120 seconds = maximum poll interval */
-       if (sscanf(buf, "%llu\n", &time) != 1 || time < 1 ||
-           time > 120000000000ULL)
+       if (value > 120000000000UL)
                return -EINVAL;
-       poll_timeout = time;
-       hr_time = poll_timeout;
+       poll_high_timeout = value;
+       hr_time = poll_high_timeout;
 
        spin_lock_bh(&ap_poll_timer_lock);
        hrtimer_cancel(&ap_poll_timer);
         * If we are running under z/VM adjust polling to z/VM polling rate.
         */
        if (MACHINE_IS_VM)
-               poll_timeout = 1500000;
+               poll_high_timeout = 1500000;
        hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
        ap_poll_timer.function = ap_poll_timeout;
 
 
  * AP queue state wait behaviour
  */
 enum ap_sm_wait {
-       AP_SM_WAIT_AGAIN = 0,   /* retry immediately */
-       AP_SM_WAIT_TIMEOUT,     /* wait for timeout */
-       AP_SM_WAIT_INTERRUPT,   /* wait for thin interrupt (if available) */
-       AP_SM_WAIT_NONE,        /* no wait */
+       AP_SM_WAIT_AGAIN = 0,    /* retry immediately */
+       AP_SM_WAIT_HIGH_TIMEOUT, /* poll high freq, wait for timeout */
+       AP_SM_WAIT_LOW_TIMEOUT,  /* poll low freq, wait for timeout */
+       AP_SM_WAIT_INTERRUPT,    /* wait for thin interrupt (if available) */
+       AP_SM_WAIT_NONE,         /* no wait */
        NR_AP_SM_WAIT
 };
 
 
        case AP_RESPONSE_NO_PENDING_REPLY:
                if (aq->queue_count > 0)
                        return aq->interrupt ?
-                               AP_SM_WAIT_INTERRUPT : AP_SM_WAIT_TIMEOUT;
+                               AP_SM_WAIT_INTERRUPT : AP_SM_WAIT_HIGH_TIMEOUT;
                aq->sm_state = AP_SM_STATE_IDLE;
                return AP_SM_WAIT_NONE;
        default:
        case AP_RESPONSE_Q_FULL:
                aq->sm_state = AP_SM_STATE_QUEUE_FULL;
                return aq->interrupt ?
-                       AP_SM_WAIT_INTERRUPT : AP_SM_WAIT_TIMEOUT;
+                       AP_SM_WAIT_INTERRUPT : AP_SM_WAIT_HIGH_TIMEOUT;
        case AP_RESPONSE_RESET_IN_PROGRESS:
                aq->sm_state = AP_SM_STATE_RESET_WAIT;
-               return AP_SM_WAIT_TIMEOUT;
+               return AP_SM_WAIT_LOW_TIMEOUT;
        case AP_RESPONSE_INVALID_DOMAIN:
                AP_DBF_WARN("%s RESPONSE_INVALID_DOMAIN on NQAP\n", __func__);
                fallthrough;
        case AP_RESPONSE_RESET_IN_PROGRESS:
                aq->sm_state = AP_SM_STATE_RESET_WAIT;
                aq->interrupt = false;
-               return AP_SM_WAIT_TIMEOUT;
+               return AP_SM_WAIT_LOW_TIMEOUT;
        default:
                aq->dev_state = AP_DEV_STATE_ERROR;
                aq->last_err_rc = status.response_code;
                return AP_SM_WAIT_AGAIN;
        case AP_RESPONSE_BUSY:
        case AP_RESPONSE_RESET_IN_PROGRESS:
-               return AP_SM_WAIT_TIMEOUT;
+               return AP_SM_WAIT_LOW_TIMEOUT;
        case AP_RESPONSE_Q_NOT_AVAIL:
        case AP_RESPONSE_DECONFIGURED:
        case AP_RESPONSE_CHECKSTOPPED:
                        return AP_SM_WAIT_AGAIN;
                fallthrough;
        case AP_RESPONSE_NO_PENDING_REPLY:
-               return AP_SM_WAIT_TIMEOUT;
+               return AP_SM_WAIT_LOW_TIMEOUT;
        default:
                aq->dev_state = AP_DEV_STATE_ERROR;
                aq->last_err_rc = status.response_code;