Merge 4.5-rc2 into staging-next
[deliverable/linux.git] / drivers / staging / panel / panel.c
index 79ac19246548afb5a6e5574a97d09dd7cb8ca110..4262db0237f90e46b02f08a3f5505f5d18af953f 100644 (file)
@@ -172,8 +172,6 @@ static __u8 scan_mask_o;
 /* logical or of the input bits involved in the scan matrix */
 static __u8 scan_mask_i;
 
-typedef __u64 pmask_t;
-
 enum input_type {
        INPUT_TYPE_STD,
        INPUT_TYPE_KBD,
@@ -188,8 +186,8 @@ enum input_state {
 
 struct logical_input {
        struct list_head list;
-       pmask_t mask;
-       pmask_t value;
+       __u64 mask;
+       __u64 value;
        enum input_type type;
        enum input_state state;
        __u8 rise_time, fall_time;
@@ -219,19 +217,19 @@ static LIST_HEAD(logical_inputs); /* list of all defined logical inputs */
  * corresponds to the ground.
  * Within each group, bits are stored in the same order as read on the port :
  * BAPSE (busy=4, ack=3, paper empty=2, select=1, error=0).
- * So, each __u64 (or pmask_t) is represented like this :
+ * So, each __u64 is represented like this :
  * 0000000000000000000BAPSEBAPSEBAPSEBAPSEBAPSEBAPSEBAPSEBAPSEBAPSE
  * <-----unused------><gnd><d07><d06><d05><d04><d03><d02><d01><d00>
  */
 
 /* what has just been read from the I/O ports */
-static pmask_t phys_read;
+static __u64 phys_read;
 /* previous phys_read */
-static pmask_t phys_read_prev;
+static __u64 phys_read_prev;
 /* stabilized phys_read (phys_read|phys_read_prev) */
-static pmask_t phys_curr;
+static __u64 phys_curr;
 /* previous phys_curr */
-static pmask_t phys_prev;
+static __u64 phys_prev;
 /* 0 means that at least one logical signal needs be computed */
 static char inputs_stable;
 
@@ -825,8 +823,7 @@ static void lcd_write_cmd_s(int cmd)
        lcd_send_serial(0x1F);  /* R/W=W, RS=0 */
        lcd_send_serial(cmd & 0x0F);
        lcd_send_serial((cmd >> 4) & 0x0F);
-       /* the shortest command takes at least 40 us */
-       usleep_range(40, 100);
+       udelay(40);             /* the shortest command takes at least 40 us */
        spin_unlock_irq(&pprt_lock);
 }
 
@@ -837,8 +834,7 @@ static void lcd_write_data_s(int data)
        lcd_send_serial(0x5F);  /* R/W=W, RS=1 */
        lcd_send_serial(data & 0x0F);
        lcd_send_serial((data >> 4) & 0x0F);
-       /* the shortest data takes at least 40 us */
-       usleep_range(40, 100);
+       udelay(40);             /* the shortest data takes at least 40 us */
        spin_unlock_irq(&pprt_lock);
 }
 
@@ -848,20 +844,19 @@ static void lcd_write_cmd_p8(int cmd)
        spin_lock_irq(&pprt_lock);
        /* present the data to the data port */
        w_dtr(pprt, cmd);
-       /* maintain the data during 20 us before the strobe */
-       usleep_range(20, 100);
+       udelay(20);     /* maintain the data during 20 us before the strobe */
 
        bits.e = BIT_SET;
        bits.rs = BIT_CLR;
        bits.rw = BIT_CLR;
        set_ctrl_bits();
 
-       usleep_range(40, 100);  /* maintain the strobe during 40 us */
+       udelay(40);     /* maintain the strobe during 40 us */
 
        bits.e = BIT_CLR;
        set_ctrl_bits();
 
-       usleep_range(120, 500); /* the shortest command takes at least 120 us */
+       udelay(120);    /* the shortest command takes at least 120 us */
        spin_unlock_irq(&pprt_lock);
 }
 
@@ -871,20 +866,19 @@ static void lcd_write_data_p8(int data)
        spin_lock_irq(&pprt_lock);
        /* present the data to the data port */
        w_dtr(pprt, data);
-       /* maintain the data during 20 us before the strobe */
-       usleep_range(20, 100);
+       udelay(20);     /* maintain the data during 20 us before the strobe */
 
        bits.e = BIT_SET;
        bits.rs = BIT_SET;
        bits.rw = BIT_CLR;
        set_ctrl_bits();
 
-       usleep_range(40, 100);  /* maintain the strobe during 40 us */
+       udelay(40);     /* maintain the strobe during 40 us */
 
        bits.e = BIT_CLR;
        set_ctrl_bits();
 
-       usleep_range(45, 100);  /* the shortest data takes at least 45 us */
+       udelay(45);     /* the shortest data takes at least 45 us */
        spin_unlock_irq(&pprt_lock);
 }
 
@@ -894,7 +888,7 @@ static void lcd_write_cmd_tilcd(int cmd)
        spin_lock_irq(&pprt_lock);
        /* present the data to the control port */
        w_ctr(pprt, cmd);
-       usleep_range(60, 120);
+       udelay(60);
        spin_unlock_irq(&pprt_lock);
 }
 
@@ -904,7 +898,7 @@ static void lcd_write_data_tilcd(int data)
        spin_lock_irq(&pprt_lock);
        /* present the data to the data port */
        w_dtr(pprt, data);
-       usleep_range(60, 120);
+       udelay(60);
        spin_unlock_irq(&pprt_lock);
 }
 
@@ -947,7 +941,8 @@ static void lcd_clear_fast_s(void)
                lcd_send_serial(0x5F);  /* R/W=W, RS=1 */
                lcd_send_serial(' ' & 0x0F);
                lcd_send_serial((' ' >> 4) & 0x0F);
-               usleep_range(40, 100);  /* the shortest data takes at least 40 us */
+               /* the shortest data takes at least 40 us */
+               udelay(40);
        }
        spin_unlock_irq(&pprt_lock);
 
@@ -971,7 +966,7 @@ static void lcd_clear_fast_p8(void)
                w_dtr(pprt, ' ');
 
                /* maintain the data during 20 us before the strobe */
-               usleep_range(20, 100);
+               udelay(20);
 
                bits.e = BIT_SET;
                bits.rs = BIT_SET;
@@ -979,13 +974,13 @@ static void lcd_clear_fast_p8(void)
                set_ctrl_bits();
 
                /* maintain the strobe during 40 us */
-               usleep_range(40, 100);
+               udelay(40);
 
                bits.e = BIT_CLR;
                set_ctrl_bits();
 
                /* the shortest data takes at least 45 us */
-               usleep_range(45, 100);
+               udelay(45);
        }
        spin_unlock_irq(&pprt_lock);
 
@@ -1007,7 +1002,7 @@ static void lcd_clear_fast_tilcd(void)
        for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
                /* present the data to the data port */
                w_dtr(pprt, ' ');
-               usleep_range(60, 120);
+               udelay(60);
        }
 
        spin_unlock_irq(&pprt_lock);
@@ -1788,7 +1783,7 @@ static void phys_scan_contacts(void)
        gndmask = PNL_PINPUT(r_str(pprt)) & scan_mask_i;
 
        /* grounded inputs are signals 40-44 */
-       phys_read |= (pmask_t) gndmask << 40;
+       phys_read |= (__u64)gndmask << 40;
 
        if (bitmask != gndmask) {
                /*
@@ -1804,7 +1799,7 @@ static void phys_scan_contacts(void)
 
                        w_dtr(pprt, oldval & ~bitval);  /* enable this output */
                        bitmask = PNL_PINPUT(r_str(pprt)) & ~gndmask;
-                       phys_read |= (pmask_t) bitmask << (5 * bit);
+                       phys_read |= (__u64)bitmask << (5 * bit);
                }
                w_dtr(pprt, oldval);    /* disable all outputs */
        }
@@ -2041,32 +2036,32 @@ static void init_scan_timer(void)
  * corresponding to out and in bits respectively.
  * returns 1 if ok, 0 if error (in which case, nothing is written).
  */
-static int input_name2mask(const char *name, pmask_t *mask, pmask_t *value,
-                          char *imask, char *omask)
+static u8 input_name2mask(const char *name, __u64 *mask, __u64 *value,
+                         u8 *imask, u8 *omask)
 {
-       static char sigtab[10] = "EeSsPpAaBb";
-       char im, om;
-       pmask_t m, v;
+       const char sigtab[] = "EeSsPpAaBb";
+       u8 im, om;
+       __u64 m, v;
 
-       om = 0ULL;
-       im = 0ULL;
+       om = 0;
+       im = 0;
        m = 0ULL;
        v = 0ULL;
        while (*name) {
                int in, out, bit, neg;
+               const char *idx;
 
-               for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != *name);
-                    in++)
-                       ;
-
-               if (in >= sizeof(sigtab))
+               idx = strchr(sigtab, *name);
+               if (!idx)
                        return 0;       /* input name not found */
+
+               in = idx - sigtab;
                neg = (in & 1); /* odd (lower) names are negated */
                in >>= 1;
                im |= BIT(in);
 
                name++;
-               if (isdigit(*name)) {
+               if (*name >= '0' && *name <= '7') {
                        out = *name - '0';
                        om |= BIT(out);
                } else if (*name == '-') {
This page took 0.029621 seconds and 5 git commands to generate.