Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcmips/vr * update copyright year.



details:   https://anonhg.NetBSD.org/src/rev/ae35c3d4ee1e
branches:  trunk
changeset: 504314:ae35c3d4ee1e
user:      sato <sato%NetBSD.org@localhost>
date:      Tue Feb 27 08:48:38 2001 +0000

description:
* update copyright year.
* some machines(MC-R700 etc) have pre-vrc4172 asic.
  they don's work as vrc4172 specification, so skip some probe sequence.
  - add platid related parameter.
  - add VRC4172PWM_BROKEN_PROBE code.
* add MC-R700,700A parameters (tested on MC-R700).
* add contrast parameters.(but no one use yet).
* turn some message in probing to VPRINTF().
* enlarge VRC2_PWM_N_BRIGHTNESS.

diffstat:

 sys/arch/hpcmips/vr/vrc4172pwm.c    |  61 ++++++++++++++++++++++++++----------
 sys/arch/hpcmips/vr/vrc4172pwmvar.h |  14 ++++++--
 2 files changed, 53 insertions(+), 22 deletions(-)

diffs (155 lines):

diff -r 55ee6d1e996c -r ae35c3d4ee1e sys/arch/hpcmips/vr/vrc4172pwm.c
--- a/sys/arch/hpcmips/vr/vrc4172pwm.c  Tue Feb 27 07:34:15 2001 +0000
+++ b/sys/arch/hpcmips/vr/vrc4172pwm.c  Tue Feb 27 08:48:38 2001 +0000
@@ -1,7 +1,7 @@
-/*     $Id: vrc4172pwm.c,v 1.7 2001/02/26 09:33:03 sato Exp $  */
+/*     $Id: vrc4172pwm.c,v 1.8 2001/02/27 08:48:38 sato Exp $  */
 
 /*
- * Copyright (c) 2000 SATO Kazumi. All rights reserved.
+ * Copyright (c) 2000,2001 SATO Kazumi. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -84,10 +84,17 @@
  * platform related parameters
  */
 struct vrc4172pwm_param vrc4172pwm_mcr530_param = {
+       0,
        8,
        { 0x16, 0x1b, 0x20, 0x25, 0x2a, 0x30, 0x37, 0x3f }
 };
 
+struct vrc4172pwm_param vrc4172pwm_mcr700_param = {
+       1, /* probe broken */
+       8,
+       { 0x12, 0x15, 0x18, 0x1d, 0x24, 0x2d, 0x38, 0x3f }
+};
+
 struct platid_data vrc4172pwm_platid_param_table[] = {
        { &platid_mask_MACH_NEC_MCR_430, 
                &vrc4172pwm_mcr530_param},
@@ -97,6 +104,10 @@
                &vrc4172pwm_mcr530_param},
        { &platid_mask_MACH_NEC_MCR_SIGMARION, 
                &vrc4172pwm_mcr530_param},
+       { &platid_mask_MACH_NEC_MCR_700, 
+               &vrc4172pwm_mcr700_param},
+       { &platid_mask_MACH_NEC_MCR_700A, 
+               &vrc4172pwm_mcr700_param},
        { NULL, NULL}
 };
 
@@ -128,7 +139,14 @@
        platid_mask_t mask;
        struct vrip_attach_args *va = aux;
        bus_space_handle_t ioh;
+#ifdef VRC4172PWM_BROKEN_PROBE
+       int probe = 0;
+#else /* VRC4172PWM_BROKEN_PROBE */
+       int probe = 1;
+#endif /* VRC4172PWM_BROKEN_PROBE */
        int data;
+       int data2;
+       struct vrc4172pwm_param *param;
        int ret = 0;
 
        if (va->va_addr == VRIPCF_ADDR_DEFAULT)
@@ -138,24 +156,31 @@
                return 0;
        if (cf->cf_loc[VRIPCF_PLATFORM] != -1) { /* if specify */
                mask = PLATID_DEREF(cf->cf_loc[VRIPCF_PLATFORM]);
-               DPRINTF(("vrc4172pwmprobe: check platid\n"));
+               VPRINTF(("vrc4172pwmprobe: check platid\n"));
                if (platid_match(&platid, &mask) == 0)  
                        return 0;
-       }
-       if (bus_space_map(va->va_iot, va->va_addr, va->va_size, 0, &ioh)) {
-               return 0;
+               param = vrc4172pwm_getparam();
+               if (param != NULL && param->brokenprobe)
+                       probe = 0;
        }
-       data =  bus_space_read_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN);
-       bus_space_write_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN, 0xff);
-       if (bus_space_read_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN) 
-               == VRC2_PWM_LCDEN_MASK) {
-               DPRINTF(("vrc4172pwmprobe: VRC2_PWM_LCDDUTYEN found\n"));
+       if (probe) {
+               if (bus_space_map(va->va_iot, va->va_addr, va->va_size, 0, &ioh)) {
+                       return 0;
+               }
+               data =  bus_space_read_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN);
+               bus_space_write_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN, 0xff);
+               if ((data2 = bus_space_read_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN))
+                       == VRC2_PWM_LCDEN_MASK) {
+                       VPRINTF(("vrc4172pwmprobe: VRC2_PWM_LCDDUTYEN found\n"));
+                       ret = 1;
+               } else {
+                       VPRINTF(("vrc4172pwmprobe: VRC2_PWM_LCDDUTYEN not found org=%x, data=%x!=%x\n", data, data2, VRC2_PWM_LCDEN_MASK));
+               }
+               bus_space_write_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN, data);
+               bus_space_unmap(va->va_iot, ioh, va->va_size);
+       } else
                ret = 1;
-       }
-       bus_space_write_2(va->va_iot, ioh, VRC2_PWM_LCDDUTYEN, data);
-       bus_space_unmap(va->va_iot, ioh, va->va_size);
-
-       DPRINTF(("vrc4172pwmprobe: return %d\n", ret));
+       VPRINTF(("vrc4172pwmprobe: return %d\n", ret));
        return ret;
 }
 
@@ -321,7 +346,7 @@
        if (sc->sc_param == NULL)
                return VRC2_PWM_MAX_BRIGHTNESS;
        for (i = 0; i < sc->sc_param->n_brightness; i++) {
-               if (sc->sc_raw_duty <= sc->sc_param->values[i])
+               if (sc->sc_raw_duty <= sc->sc_param->bvalues[i])
                        break;
        }
        if (i >= sc->sc_param->n_brightness-1)
@@ -340,7 +365,7 @@
 {
        if (sc->sc_param == NULL)
                return VRC2_PWM_LCDDUTY_MASK;
-       return sc->sc_param->values[sc->sc_brightness];
+       return sc->sc_param->bvalues[sc->sc_brightness];
 }
 
 
diff -r 55ee6d1e996c -r ae35c3d4ee1e sys/arch/hpcmips/vr/vrc4172pwmvar.h
--- a/sys/arch/hpcmips/vr/vrc4172pwmvar.h       Tue Feb 27 07:34:15 2001 +0000
+++ b/sys/arch/hpcmips/vr/vrc4172pwmvar.h       Tue Feb 27 08:48:38 2001 +0000
@@ -1,7 +1,7 @@
-/*     $Id: vrc4172pwmvar.h,v 1.4 2000/12/29 15:54:17 sato Exp $       */
+/*     $Id: vrc4172pwmvar.h,v 1.5 2001/02/27 08:48:38 sato Exp $       */
 
 /*
- * Copyright (c) 2000 SATO Kazumi.  All rights reserved.
+ * Copyright (c) 2000,2001 SATO Kazumi.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,12 +25,18 @@
  * SUCH DAMAGE.
  */
 
-#define VRC2_PWM_N_BRIGHTNESS  8
+#define VRC2_PWM_N_BRIGHTNESS  16
 #define VRC2_PWM_MAX_BRIGHTNESS        (VRC2_PWM_N_BRIGHTNESS-1)
+#define VRC2_PWM_N_CONTRAST    32
+#define VRC2_PWM_MAX_CONTRAST  (VRC2_PWM_N_CONTRAST-1)
+
 
 struct vrc4172pwm_param {
+       int brokenprobe;
        int n_brightness;
-       int values[VRC2_PWM_N_BRIGHTNESS];
+       int bvalues[VRC2_PWM_N_BRIGHTNESS];
+       int n_contrast;
+       int cvalues[VRC2_PWM_N_CONTRAST];
 };
 
 struct vrc4172pwm_softc {



Home | Main Index | Thread Index | Old Index