Lines Matching refs:unitp

170 	struct max1617_unit *unitp;
184 unitp = ddi_get_soft_state(max1617_soft_statep, instance);
186 (void) snprintf(unitp->max1617_name, sizeof (unitp->max1617_name),
196 " name '%s'", unitp->max1617_name, minor_name);
209 unitp->max1617_name, minor_name);
216 if (i2c_client_register(dip, &unitp->max1617_hdl) != I2C_SUCCESS) {
223 mutex_init(&unitp->max1617_mutex, NULL, MUTEX_DRIVER, NULL);
224 cv_init(&unitp->max1617_cv, NULL, CV_DRIVER, NULL);
235 struct max1617_unit *unitp;
237 if ((unitp = ddi_get_soft_state(max1617_soft_statep, instance)) ==
242 (void) i2c_transfer_alloc(unitp->max1617_hdl,
249 i2ctp->i2c_wbuf[1] = unitp->max1617_cpr_state.max1617_config;
251 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
257 i2ctp->i2c_wbuf[1] = unitp->max1617_cpr_state.max1617_conv_rate;
258 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
264 i2ctp->i2c_wbuf[1] = unitp->max1617_cpr_state.max1617_lcl_hlimit;
266 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
272 i2ctp->i2c_wbuf[1] = unitp->max1617_cpr_state.max1617_remote_hlimit;
274 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
280 i2ctp->i2c_wbuf[1] = unitp->max1617_cpr_state.max1617_lcl_llimit;
282 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
288 i2ctp->i2c_wbuf[1] = unitp->max1617_cpr_state.max1617_remote_llimit;
290 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
296 mutex_enter(&unitp->max1617_mutex);
297 unitp->max1617_flags = 0;
298 cv_signal(&unitp->max1617_cv);
299 mutex_exit(&unitp->max1617_mutex);
301 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
324 struct max1617_unit *unitp;
329 unitp = ddi_get_soft_state(max1617_soft_statep, instance);
331 if (unitp == NULL) {
335 i2c_client_unregister(unitp->max1617_hdl);
339 mutex_destroy(&unitp->max1617_mutex);
340 cv_destroy(&unitp->max1617_cv);
352 struct max1617_unit *unitp;
354 if ((unitp = ddi_get_soft_state(max1617_soft_statep, instance)) ==
359 (void) i2c_transfer_alloc(unitp->max1617_hdl,
366 mutex_enter(&unitp->max1617_mutex);
367 while (unitp->max1617_flags == MAX1617_BUSY) {
368 cv_wait(&unitp->max1617_cv, &unitp->max1617_mutex);
370 unitp->max1617_flags = MAX1617_BUSY;
371 mutex_exit(&unitp->max1617_mutex);
376 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
380 unitp->max1617_cpr_state.max1617_config = i2ctp->i2c_rbuf[0];
383 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
387 unitp->max1617_cpr_state.max1617_conv_rate = i2ctp->i2c_rbuf[0];
390 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
394 unitp->max1617_cpr_state.max1617_lcl_hlimit = i2ctp->i2c_rbuf[0];
397 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
401 unitp->max1617_cpr_state.max1617_remote_hlimit = i2ctp->i2c_rbuf[0];
404 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
408 unitp->max1617_cpr_state.max1617_lcl_llimit = i2ctp->i2c_rbuf[0];
411 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
415 unitp->max1617_cpr_state.max1617_remote_llimit = i2ctp->i2c_rbuf[0];
418 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
421 mutex_enter(&unitp->max1617_mutex);
422 unitp->max1617_flags = 0;
423 cv_broadcast(&unitp->max1617_cv);
424 mutex_exit(&unitp->max1617_mutex);
451 struct max1617_unit *unitp;
462 unitp = (struct max1617_unit *)
465 if (unitp == NULL) {
475 mutex_enter(&unitp->max1617_mutex);
478 if (unitp->max1617_oflag != 0) {
481 unitp->max1617_oflag = FEXCL;
484 if (unitp->max1617_oflag == FEXCL) {
487 unitp->max1617_oflag = (uint16_t)FOPEN;
492 mutex_exit(&unitp->max1617_mutex);
502 struct max1617_unit *unitp;
510 unitp = (struct max1617_unit *)
513 if (unitp == NULL) {
518 mutex_enter(&unitp->max1617_mutex);
520 unitp->max1617_oflag = 0;
522 mutex_exit(&unitp->max1617_mutex);
528 set_temp_limit(struct max1617_unit *unitp,
537 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp, 2, 0, I2C_SLEEP);
544 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
551 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
555 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
561 get_temp_limit(struct max1617_unit *unitp,
570 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp, 1, 1, I2C_SLEEP);
574 if (i2c_transfer(unitp->max1617_hdl, i2ctp) == I2C_SUCCESS) {
587 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
597 struct max1617_unit *unitp;
604 unitp = (struct max1617_unit *)
616 mutex_enter(&unitp->max1617_mutex);
617 while (unitp->max1617_flags == MAX1617_BUSY) {
618 if (cv_wait_sig(&unitp->max1617_cv,
619 &unitp->max1617_mutex) <= 0) {
620 mutex_exit(&unitp->max1617_mutex);
624 unitp->max1617_flags = MAX1617_BUSY;
625 mutex_exit(&unitp->max1617_mutex);
647 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp,
653 if (i2c_transfer(unitp->max1617_hdl, i2ctp) == I2C_SUCCESS) {
668 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
672 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp,
678 if (i2c_transfer(unitp->max1617_hdl, i2ctp) == I2C_SUCCESS) {
686 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
689 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp, 1, 1,
694 if (i2c_transfer(unitp->max1617_hdl, i2ctp) == I2C_SUCCESS) {
702 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
705 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp,
710 if (i2c_transfer(unitp->max1617_hdl, i2ctp) == I2C_SUCCESS) {
718 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
724 err = get_temp_limit(unitp, MAX1617_LOCALTEMP_HIGH_REG,
728 err = get_temp_limit(unitp, MAX1617_REMOTETEMP_HIGH_REG,
741 err = get_temp_limit(unitp, MAX1617_LOCALTEMP_LOW_REG,
745 err = get_temp_limit(unitp, MAX1617_REMOTETEMP_LOW_REG,
754 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp,
764 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
767 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
771 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp,
781 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
785 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
791 err = set_temp_limit(unitp,
795 err = set_temp_limit(unitp,
806 err = set_temp_limit(unitp,
810 err = set_temp_limit(unitp,
819 (void) i2c_transfer_alloc(unitp->max1617_hdl, &i2ctp, 1, 0,
824 if (i2c_transfer(unitp->max1617_hdl, i2ctp) != I2C_SUCCESS) {
828 i2c_transfer_free(unitp->max1617_hdl, i2ctp);
837 mutex_enter(&unitp->max1617_mutex);
838 unitp->max1617_flags = 0;
839 cv_signal(&unitp->max1617_cv);
840 mutex_exit(&unitp->max1617_mutex);