void zts_attach(struct device *parent, struct device *self, void *aux) { struct zts_softc *sc = (struct zts_softc *)self; struct wsmousedev_attach_args a; timeout_set(&sc->sc_ts_poll, zts_poll, sc); /* Initialize ADS7846 Difference Reference mode */ (void)zssp_ic_send(ZSSP_IC_ADS7846, (1<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); delay(5000); (void)zssp_ic_send(ZSSP_IC_ADS7846, (3<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); delay(5000); (void)zssp_ic_send(ZSSP_IC_ADS7846, (4<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); delay(5000); (void)zssp_ic_send(ZSSP_IC_ADS7846, (5<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); delay(5000); a.accessops = &zts_accessops; a.accesscookie = sc; printf("\n"); /* Copy the default scalue values to each softc */ bcopy(&zts_scale, &sc->sc_tsscale, sizeof(sc->sc_tsscale)); sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); }
void lcd_set_brightness_internal(int newval) { static int curval = 1; int i; /* * It appears that the C3000 backlight can draw too much power if we * switch it from a low to a high brightness. Increasing brightness * in steps avoids this issue. */ if (newval > curval) { for (i = curval + 1; i <= newval; i++) { (void)zssp_ic_send(ZSSP_IC_LZ9JG18, CURRENT_BACKLIGHT[i].duty); scoop_set_backlight(CURRENT_BACKLIGHT[i].on, CURRENT_BACKLIGHT[i].cont); delay(5000); } } else { (void)zssp_ic_send(ZSSP_IC_LZ9JG18, CURRENT_BACKLIGHT[newval].duty); scoop_set_backlight(CURRENT_BACKLIGHT[newval].on, CURRENT_BACKLIGHT[newval].cont); } curval = newval; }
int zts_activate(struct device *self, int act) { struct zts_softc *sc = (struct zts_softc *)self; switch (act) { case DVACT_SUSPEND: if (sc->sc_enabled == 0) break; sc->sc_running = 0; #if 0 pxa2x0_gpio_intr_disestablish(sc->sc_gh); #endif timeout_del(&sc->sc_ts_poll); pxa2x0_gpio_intr_mask(sc->sc_gh); /* Turn off reference voltage but leave ADC on. */ (void)zssp_ic_send(ZSSP_IC_ADS7846, (1 << ADSCTRL_PD1_SH) | (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH)); pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_OUT | GPIO_SET); break; case DVACT_RESUME: if (sc->sc_enabled == 0) break; pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN); pxa2x0_gpio_intr_mask(sc->sc_gh); /* Enable automatic low power mode. */ (void)zssp_ic_send(ZSSP_IC_ADS7846, (4 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH)); #if 0 sc->sc_gh = pxa2x0_gpio_intr_establish(GPIO_TP_INT_C3K, IST_EDGE_FALLING, IPL_TTY, zts_irq, sc, sc->sc_dev.dv_xname); #else pxa2x0_gpio_intr_unmask(sc->sc_gh); #endif sc->sc_running = 1; break; } return 0; }
int max1111_adc_value(int chan) { return ((int)zssp_ic_send(ZSSP_IC_MAX1111, MAXCTRL_PD0 | MAXCTRL_PD1 | MAXCTRL_SGL | MAXCTRL_UNI | (chan << MAXCTRL_SEL_SHIFT) | MAXCTRL_STR)); }