[BACK]Return to sht3x.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / i2c

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/i2c/sht3x.c between version 1.3 and 1.4

version 1.3, 2021/11/13 13:36:42 version 1.4, 2021/11/14 18:36:13
Line 1 
Line 1 
   
 /*      $NetBSD$        */  /*      $NetBSD$        */
   
 /*  /*
Line 487  sht3x_init_periodic_measurement(void *au
Line 488  sht3x_init_periodic_measurement(void *au
         if (error) {          if (error) {
                 DPRINTF(sc, 2, ("%s: Could not acquire iic bus for initing: "                  DPRINTF(sc, 2, ("%s: Could not acquire iic bus for initing: "
                     " %d\n", device_xname(sc->sc_dev), error));                      " %d\n", device_xname(sc->sc_dev), error));
                 goto out;                  goto outm;
         }          }
   
         error = sht3x_take_break(sc, true);          error = sht3x_take_break(sc, true);
Line 510  sht3x_init_periodic_measurement(void *au
Line 511  sht3x_init_periodic_measurement(void *au
   
 out:  out:
         iic_release_bus(sc->sc_tag, 0);          iic_release_bus(sc->sc_tag, 0);
   outm:
         mutex_exit(&sc->sc_mutex);          mutex_exit(&sc->sc_mutex);
         return error;          return error;
 }  }
Line 605  err:
Line 607  err:
             "%x%x - %x -- %d\n", device_xname(sc->sc_dev), rawbuf[0], rawbuf[1],              "%x%x - %x -- %d\n", device_xname(sc->sc_dev), rawbuf[0], rawbuf[1],
             rawbuf[2], rawbuf[3], rawbuf[4], rawbuf[5], error));              rawbuf[2], rawbuf[3], rawbuf[4], rawbuf[5], error));
         iic_release_bus(sc->sc_tag, 0);          iic_release_bus(sc->sc_tag, 0);
         memcpy(sc->sc_pbuffer, "dedbef", sizeof(sc->sc_pbuffer));          if (error != 0) {
                   memcpy(sc->sc_pbuffer, "dedbef", sizeof(sc->sc_pbuffer));
           }
         mutex_exit(&sc->sc_mutex);          mutex_exit(&sc->sc_mutex);
 }  }
   
Line 1427  sht3x_refresh_oneshot(struct sysmon_envs
Line 1431  sht3x_refresh_oneshot(struct sysmon_envs
   
         measurement_command_ss = sht3x_compute_measure_command_ss(          measurement_command_ss = sht3x_compute_measure_command_ss(
             sc->sc_repeatability);              sc->sc_repeatability);
         DPRINTF(sc, 2, ("%s: Measurement command: %04x\n",  
             device_xname(sc->sc_dev), measurement_command_ss));  
         error = sht3x_cmdr(sc, measurement_command_ss, rawdata, sizeof(rawdata));          error = sht3x_cmdr(sc, measurement_command_ss, rawdata, sizeof(rawdata));
           DPRINTF(sc, 2, ("%s: Status for single-shot measurement cmd %04x "
               "Error %d\n", device_xname(sc->sc_dev), measurement_command_ss, error));
         if (error == 0) {          if (error == 0) {
                 DPRINTF(sc, 2, ("%s: Failed to get new status in refresh for "                  error = sht3x_parse_data(sc, edata, rawdata);
                     "single-shot %d\n", device_xname(sc->sc_dev), error));  
                 if ((error = sht3x_parse_data(sc, edata, rawdata)) == 0)  
                         return 0;  
         }          }
   
         uint16_t sbuf;          uint16_t sbuf;
Line 1455  sht3x_refresh_oneshot(struct sysmon_envs
Line 1456  sht3x_refresh_oneshot(struct sysmon_envs
         }          }
   
         iic_release_bus(sc->sc_tag, 0);          iic_release_bus(sc->sc_tag, 0);
         return 0;  
           return error;
 }  }
   
 static void  static void
Line 1875  sht3x_set_limits(struct sysmon_envsys *s
Line 1877  sht3x_set_limits(struct sysmon_envsys *s
                 rawlimitslow = (rawlimitslow & 0x1FF) | limitlow;                  rawlimitslow = (rawlimitslow & 0x1FF) | limitlow;
                 DPRINTF(sc, 2, ("%s: RH new raw limits high/low "                  DPRINTF(sc, 2, ("%s: RH new raw limits high/low "
                     "%04x %04x from %x %x\n",                      "%04x %04x from %x %x\n",
                     device_xname(sc->sc_dev), rawlimitshigh, rawlimitslow,                      device_xname(sc->sc_dev), rawlimitshigh, rawlimitslow,
                     limithigh, limitlow));                      limithigh, limitlow));
                 sht3x_set_alert_limits(sc, rawlimitshigh, rawlimitslow, true);                  sht3x_set_alert_limits(sc, rawlimitshigh, rawlimitslow, true);
                 break;                  break;
Line 2036  sht3x_detach(device_t self, int flags)
Line 2038  sht3x_detach(device_t self, int flags)
                 mutex_exit(&sc->sc_read_mutex);                  mutex_exit(&sc->sc_read_mutex);
                 DPRINTF(sc, 2, ("%s: Will wait for anything to exit\n",                  DPRINTF(sc, 2, ("%s: Will wait for anything to exit\n",
                     device_xname(sc->sc_dev)));                      device_xname(sc->sc_dev)));
                   /* In the worst case this will time out after 5 seconds.
                    * It really should not take that long for the drain / whatever
                    * to happen
                    */
                 cv_timedwait_sig(&sc->sc_cond_dying,                  cv_timedwait_sig(&sc->sc_cond_dying,
                     &sc->sc_dying_mutex, mstohz(5000));                      &sc->sc_dying_mutex, mstohz(5000));
                 mutex_exit(&sc->sc_dying_mutex);                  mutex_exit(&sc->sc_dying_mutex);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

CVSweb <webmaster@jp.NetBSD.org>