bgp                32 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id);
bgp                44 drivers/thermal/ti-soc-thermal/ti-bandgap.c static u32 ti_bandgap_readl(struct ti_bandgap *bgp, u32 reg)
bgp                46 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	return readl(bgp->base + reg);
bgp                57 drivers/thermal/ti-soc-thermal/ti-bandgap.c static void ti_bandgap_writel(struct ti_bandgap *bgp, u32 val, u32 reg)
bgp                59 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	writel(val, bgp->base + reg);
bgp                68 drivers/thermal/ti-soc-thermal/ti-bandgap.c #define RMW_BITS(bgp, id, reg, mask, val)			\
bgp                73 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	t = bgp->conf->sensors[(id)].registers;		\
bgp                74 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	r = ti_bandgap_readl(bgp, t->reg);			\
bgp                77 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_writel(bgp, r, t->reg);			\
bgp                92 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_power(struct ti_bandgap *bgp, bool on)
bgp                96 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!TI_BANDGAP_HAS(bgp, POWER_SWITCH))
bgp                99 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++)
bgp               101 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		RMW_BITS(bgp, i, temp_sensor_ctrl, bgap_tempsoff_mask, !on);
bgp               121 drivers/thermal/ti-soc-thermal/ti-bandgap.c static u32 ti_errata814_bandgap_read_temp(struct ti_bandgap *bgp,  u32 reg)
bgp               125 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	val1 = ti_bandgap_readl(bgp, reg);
bgp               126 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	val2 = ti_bandgap_readl(bgp, reg);
bgp               133 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	return ti_bandgap_readl(bgp, reg);
bgp               148 drivers/thermal/ti-soc-thermal/ti-bandgap.c static u32 ti_bandgap_read_temp(struct ti_bandgap *bgp, int id)
bgp               153 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	tsr = bgp->conf->sensors[id].registers;
bgp               156 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) {
bgp               157 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 1);
bgp               166 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, ERRATA_814))
bgp               167 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		temp = ti_errata814_bandgap_read_temp(bgp, reg);
bgp               169 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		temp = ti_bandgap_readl(bgp, reg);
bgp               173 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, FREEZE_BIT))
bgp               174 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 0);
bgp               196 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	struct ti_bandgap *bgp = data;
bgp               201 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_lock(&bgp->lock);
bgp               202 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp               203 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		tsr = bgp->conf->sensors[i].registers;
bgp               204 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ctrl = ti_bandgap_readl(bgp, tsr->bgap_status);
bgp               215 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ctrl = ti_bandgap_readl(bgp, tsr->bgap_mask_ctrl);
bgp               229 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ti_bandgap_writel(bgp, ctrl, tsr->bgap_mask_ctrl);
bgp               231 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_dbg(bgp->dev,
bgp               233 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			__func__, bgp->conf->sensors[i].domain,
bgp               237 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->report_temperature)
bgp               238 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			bgp->conf->report_temperature(bgp, i);
bgp               240 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_unlock(&bgp->lock);
bgp               282 drivers/thermal/ti-soc-thermal/ti-bandgap.c int ti_bandgap_adc_to_mcelsius(struct ti_bandgap *bgp, int adc_val, int *t)
bgp               284 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	const struct ti_bandgap_data *conf = bgp->conf;
bgp               290 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	*t = bgp->conf->conv_table[adc_val - conf->adc_start_val];
bgp               305 drivers/thermal/ti-soc-thermal/ti-bandgap.c static inline int ti_bandgap_validate(struct ti_bandgap *bgp, int id)
bgp               307 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!bgp || IS_ERR(bgp)) {
bgp               312 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if ((id < 0) || (id >= bgp->conf->sensor_count)) {
bgp               313 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_err(bgp->dev, "%s: sensor id out of range (%d)\n",
bgp               327 drivers/thermal/ti-soc-thermal/ti-bandgap.c static void ti_bandgap_read_counter(struct ti_bandgap *bgp, int id,
bgp               333 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	tsr = bgp->conf->sensors[id].registers;
bgp               334 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	time = ti_bandgap_readl(bgp, tsr->bgap_counter);
bgp               337 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	time = time * 1000 / bgp->clk_rate;
bgp               347 drivers/thermal/ti-soc-thermal/ti-bandgap.c static void ti_bandgap_read_counter_delay(struct ti_bandgap *bgp, int id,
bgp               353 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	tsr = bgp->conf->sensors[id].registers;
bgp               355 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	reg_val = ti_bandgap_readl(bgp, tsr->bgap_mask_ctrl);
bgp               378 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_warn(bgp->dev, "Wrong counter delay value read from register %X",
bgp               391 drivers/thermal/ti-soc-thermal/ti-bandgap.c int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id,
bgp               396 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_validate(bgp, id);
bgp               400 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!TI_BANDGAP_HAS(bgp, COUNTER) &&
bgp               401 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	    !TI_BANDGAP_HAS(bgp, COUNTER_DELAY)) {
bgp               406 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, COUNTER)) {
bgp               407 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ti_bandgap_read_counter(bgp, id, interval);
bgp               411 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_read_counter_delay(bgp, id, interval);
bgp               424 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_write_counter_delay(struct ti_bandgap *bgp, int id,
bgp               449 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_warn(bgp->dev, "Delay %d ms is not supported\n", interval);
bgp               453 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_lock(&bgp->lock);
bgp               454 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_counter_delay_mask, rval);
bgp               455 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_unlock(&bgp->lock);
bgp               466 drivers/thermal/ti-soc-thermal/ti-bandgap.c static void ti_bandgap_write_counter(struct ti_bandgap *bgp, int id,
bgp               469 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	interval = interval * bgp->clk_rate / 1000;
bgp               470 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_lock(&bgp->lock);
bgp               471 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	RMW_BITS(bgp, id, bgap_counter, counter_mask, interval);
bgp               472 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_unlock(&bgp->lock);
bgp               483 drivers/thermal/ti-soc-thermal/ti-bandgap.c int ti_bandgap_write_update_interval(struct ti_bandgap *bgp,
bgp               486 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	int ret = ti_bandgap_validate(bgp, id);
bgp               490 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!TI_BANDGAP_HAS(bgp, COUNTER) &&
bgp               491 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	    !TI_BANDGAP_HAS(bgp, COUNTER_DELAY)) {
bgp               496 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, COUNTER)) {
bgp               497 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ti_bandgap_write_counter(bgp, id, interval);
bgp               501 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_write_counter_delay(bgp, id, interval);
bgp               514 drivers/thermal/ti-soc-thermal/ti-bandgap.c int ti_bandgap_read_temperature(struct ti_bandgap *bgp, int id,
bgp               520 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_validate(bgp, id);
bgp               524 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!TI_BANDGAP_HAS(bgp, MODE_CONFIG)) {
bgp               525 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ret = ti_bandgap_force_single_read(bgp, id);
bgp               530 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_lock(&bgp->lock);
bgp               531 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	temp = ti_bandgap_read_temp(bgp, id);
bgp               532 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_unlock(&bgp->lock);
bgp               534 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_adc_to_mcelsius(bgp, temp, &temp);
bgp               552 drivers/thermal/ti-soc-thermal/ti-bandgap.c int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data)
bgp               554 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	int ret = ti_bandgap_validate(bgp, id);
bgp               558 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->regval[id].data = data;
bgp               571 drivers/thermal/ti-soc-thermal/ti-bandgap.c void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id)
bgp               573 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	int ret = ti_bandgap_validate(bgp, id);
bgp               577 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	return bgp->regval[id].data;
bgp               593 drivers/thermal/ti-soc-thermal/ti-bandgap.c ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
bgp               599 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
bgp               600 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		RMW_BITS(bgp, id, bgap_mode_ctrl, mode_ctrl_mask, 0);
bgp               603 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 1);
bgp               606 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	tsr = bgp->conf->sensors[id].registers;
bgp               609 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (ti_bandgap_readl(bgp, tsr->temp_sensor_ctrl) &
bgp               615 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 0);
bgp               620 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (!(ti_bandgap_readl(bgp, tsr->temp_sensor_ctrl) &
bgp               639 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_set_continuous_mode(struct ti_bandgap *bgp)
bgp               643 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp               645 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ti_bandgap_force_single_read(bgp, i);
bgp               646 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		RMW_BITS(bgp, i, bgap_mode_ctrl, mode_ctrl_mask, 1);
bgp               667 drivers/thermal/ti-soc-thermal/ti-bandgap.c int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
bgp               673 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_validate(bgp, id);
bgp               677 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!TI_BANDGAP_HAS(bgp, HISTORY_BUFFER) ||
bgp               678 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	    !TI_BANDGAP_HAS(bgp, FREEZE_BIT)) {
bgp               683 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_lock(&bgp->lock);
bgp               685 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	tsr = bgp->conf->sensors[id].registers;
bgp               688 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 1);
bgp               693 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	temp1 = ti_bandgap_readl(bgp, reg1);
bgp               696 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	temp2 = ti_bandgap_readl(bgp, reg2);
bgp               700 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_adc_to_mcelsius(bgp, temp1, &t1);
bgp               704 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_adc_to_mcelsius(bgp, temp2, &t2);
bgp               709 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = ti_bandgap_read_update_interval(bgp, id, &interval);
bgp               719 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	dev_dbg(bgp->dev, "The temperatures are t1 = %d and t2 = %d and trend =%d\n",
bgp               723 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 0);
bgp               724 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_unlock(&bgp->lock);
bgp               743 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_tshut_init(struct ti_bandgap *bgp,
bgp               746 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	int gpio_nr = bgp->tshut_gpio;
bgp               752 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_err(bgp->dev, "Could not request for TSHUT GPIO:%i\n", 86);
bgp               757 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_err(bgp->dev, "Cannot set input TSHUT GPIO %d\n", gpio_nr);
bgp               765 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		dev_err(bgp->dev, "request irq failed for TSHUT");
bgp               784 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_talert_init(struct ti_bandgap *bgp,
bgp               789 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->irq = platform_get_irq(pdev, 0);
bgp               790 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (bgp->irq < 0) {
bgp               792 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		return bgp->irq;
bgp               794 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = request_threaded_irq(bgp->irq, NULL,
bgp               797 drivers/thermal/ti-soc-thermal/ti-bandgap.c 				   "talert", bgp);
bgp               822 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	struct ti_bandgap *bgp;
bgp               832 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp = devm_kzalloc(&pdev->dev, sizeof(*bgp), GFP_KERNEL);
bgp               833 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!bgp)
bgp               838 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		bgp->conf = of_id->data;
bgp               841 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,
bgp               842 drivers/thermal/ti-soc-thermal/ti-bandgap.c 				   sizeof(*bgp->regval), GFP_KERNEL);
bgp               843 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (!bgp->regval)
bgp               855 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			bgp->base = chunk;
bgp               862 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
bgp               863 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		bgp->tshut_gpio = of_get_gpio(node, 0);
bgp               864 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (!gpio_is_valid(bgp->tshut_gpio)) {
bgp               866 drivers/thermal/ti-soc-thermal/ti-bandgap.c 				bgp->tshut_gpio);
bgp               871 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	return bgp;
bgp               879 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	struct ti_bandgap *bgp;
bgp               882 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp = ti_bandgap_build(pdev);
bgp               883 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (IS_ERR(bgp)) {
bgp               885 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		return PTR_ERR(bgp);
bgp               887 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->dev = &pdev->dev;
bgp               889 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, UNRELIABLE))
bgp               893 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
bgp               894 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ret = ti_bandgap_tshut_init(bgp, pdev);
bgp               902 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->fclock = clk_get(NULL, bgp->conf->fclock_name);
bgp               903 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (IS_ERR(bgp->fclock)) {
bgp               905 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ret = PTR_ERR(bgp->fclock);
bgp               909 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->div_clk = clk_get(NULL, bgp->conf->div_ck_name);
bgp               910 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (IS_ERR(bgp->div_clk)) {
bgp               912 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ret = PTR_ERR(bgp->div_clk);
bgp               916 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp               920 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		tsr = bgp->conf->sensors[i].registers;
bgp               926 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		val = ti_bandgap_readl(bgp, tsr->bgap_efuse);
bgp               932 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	clk_rate = clk_round_rate(bgp->div_clk,
bgp               933 drivers/thermal/ti-soc-thermal/ti-bandgap.c 				  bgp->conf->sensors[0].ts_data->max_freq);
bgp               934 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (clk_rate < bgp->conf->sensors[0].ts_data->min_freq ||
bgp               941 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ret = clk_set_rate(bgp->div_clk, clk_rate);
bgp               945 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->clk_rate = clk_rate;
bgp               946 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, CLK_CTRL))
bgp               947 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		clk_prepare_enable(bgp->fclock);
bgp               950 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	spin_lock_init(&bgp->lock);
bgp               951 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	bgp->dev = &pdev->dev;
bgp               952 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	platform_set_drvdata(pdev, bgp);
bgp               954 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_power(bgp, true);
bgp               957 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, COUNTER))
bgp               958 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		for (i = 0; i < bgp->conf->sensor_count; i++)
bgp               959 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, bgap_counter, counter_mask, 1);
bgp               962 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp               965 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ts_data = bgp->conf->sensors[i].ts_data;
bgp               967 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, TALERT)) {
bgp               969 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, bgap_threshold,
bgp               971 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, bgap_threshold,
bgp               974 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, bgap_mask_ctrl, mask_hot_mask, 1);
bgp               975 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, bgap_mask_ctrl, mask_cold_mask, 1);
bgp               978 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, TSHUT_CONFIG)) {
bgp               980 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, tshut_threshold,
bgp               982 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, tshut_threshold,
bgp               987 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
bgp               988 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ti_bandgap_set_continuous_mode(bgp);
bgp               991 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, COUNTER))
bgp               992 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		for (i = 0; i < bgp->conf->sensor_count; i++)
bgp               993 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			RMW_BITS(bgp, i, bgap_counter, counter_mask,
bgp               994 drivers/thermal/ti-soc-thermal/ti-bandgap.c 				 bgp->clk_rate / 4);
bgp               997 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp              1000 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->sensors[i].register_cooling) {
bgp              1001 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ret = bgp->conf->sensors[i].register_cooling(bgp, i);
bgp              1006 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->expose_sensor) {
bgp              1007 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			domain = bgp->conf->sensors[i].domain;
bgp              1008 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ret = bgp->conf->expose_sensor(bgp, i, domain);
bgp              1019 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, TALERT)) {
bgp              1020 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ret = ti_bandgap_talert_init(bgp, pdev);
bgp              1023 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			i = bgp->conf->sensor_count;
bgp              1031 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (bgp->conf->sensors[i].unregister_cooling)
bgp              1032 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		bgp->conf->sensors[i].unregister_cooling(bgp, i);
bgp              1035 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->sensors[i].unregister_cooling)
bgp              1036 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			bgp->conf->sensors[i].unregister_cooling(bgp, i);
bgp              1037 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->remove_sensor)
bgp              1038 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			bgp->conf->remove_sensor(bgp, i);
bgp              1040 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_power(bgp, false);
bgp              1042 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, CLK_CTRL))
bgp              1043 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		clk_disable_unprepare(bgp->fclock);
bgp              1045 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	clk_put(bgp->div_clk);
bgp              1047 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	clk_put(bgp->fclock);
bgp              1049 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
bgp              1050 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		free_irq(gpio_to_irq(bgp->tshut_gpio), NULL);
bgp              1051 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		gpio_free(bgp->tshut_gpio);
bgp              1060 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	struct ti_bandgap *bgp = platform_get_drvdata(pdev);
bgp              1064 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp              1065 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->sensors[i].unregister_cooling)
bgp              1066 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			bgp->conf->sensors[i].unregister_cooling(bgp, i);
bgp              1068 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (bgp->conf->remove_sensor)
bgp              1069 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			bgp->conf->remove_sensor(bgp, i);
bgp              1072 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_power(bgp, false);
bgp              1074 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, CLK_CTRL))
bgp              1075 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		clk_disable_unprepare(bgp->fclock);
bgp              1076 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	clk_put(bgp->fclock);
bgp              1077 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	clk_put(bgp->div_clk);
bgp              1079 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, TALERT))
bgp              1080 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		free_irq(bgp->irq, bgp);
bgp              1082 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
bgp              1083 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		free_irq(gpio_to_irq(bgp->tshut_gpio), NULL);
bgp              1084 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		gpio_free(bgp->tshut_gpio);
bgp              1091 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_save_ctxt(struct ti_bandgap *bgp)
bgp              1095 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp              1099 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		rval = &bgp->regval[i];
bgp              1100 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		tsr = bgp->conf->sensors[i].registers;
bgp              1102 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
bgp              1103 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			rval->bg_mode_ctrl = ti_bandgap_readl(bgp,
bgp              1105 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, COUNTER))
bgp              1106 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			rval->bg_counter = ti_bandgap_readl(bgp,
bgp              1108 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, TALERT)) {
bgp              1109 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			rval->bg_threshold = ti_bandgap_readl(bgp,
bgp              1111 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			rval->bg_ctrl = ti_bandgap_readl(bgp,
bgp              1115 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, TSHUT_CONFIG))
bgp              1116 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			rval->tshut_threshold = ti_bandgap_readl(bgp,
bgp              1123 drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp)
bgp              1127 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	for (i = 0; i < bgp->conf->sensor_count; i++) {
bgp              1132 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		rval = &bgp->regval[i];
bgp              1133 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		tsr = bgp->conf->sensors[i].registers;
bgp              1135 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, COUNTER))
bgp              1136 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			val = ti_bandgap_readl(bgp, tsr->bgap_counter);
bgp              1138 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, TSHUT_CONFIG))
bgp              1139 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ti_bandgap_writel(bgp, rval->tshut_threshold,
bgp              1144 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		ti_bandgap_force_single_read(bgp, i);
bgp              1146 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, COUNTER))
bgp              1147 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ti_bandgap_writel(bgp, rval->bg_counter,
bgp              1149 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
bgp              1150 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ti_bandgap_writel(bgp, rval->bg_mode_ctrl,
bgp              1152 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		if (TI_BANDGAP_HAS(bgp, TALERT)) {
bgp              1153 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ti_bandgap_writel(bgp, rval->bg_threshold,
bgp              1155 drivers/thermal/ti-soc-thermal/ti-bandgap.c 			ti_bandgap_writel(bgp, rval->bg_ctrl,
bgp              1165 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	struct ti_bandgap *bgp = dev_get_drvdata(dev);
bgp              1168 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	err = ti_bandgap_save_ctxt(bgp);
bgp              1169 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_power(bgp, false);
bgp              1171 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, CLK_CTRL))
bgp              1172 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		clk_disable_unprepare(bgp->fclock);
bgp              1179 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	struct ti_bandgap *bgp = dev_get_drvdata(dev);
bgp              1181 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	if (TI_BANDGAP_HAS(bgp, CLK_CTRL))
bgp              1182 drivers/thermal/ti-soc-thermal/ti-bandgap.c 		clk_prepare_enable(bgp->fclock);
bgp              1184 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	ti_bandgap_power(bgp, true);
bgp              1186 drivers/thermal/ti-soc-thermal/ti-bandgap.c 	return ti_bandgap_restore_ctxt(bgp);
bgp               231 drivers/thermal/ti-soc-thermal/ti-bandgap.h 	int (*register_cooling)(struct ti_bandgap *bgp, int id);
bgp               232 drivers/thermal/ti-soc-thermal/ti-bandgap.h 	int (*unregister_cooling)(struct ti_bandgap *bgp, int id);
bgp               321 drivers/thermal/ti-soc-thermal/ti-bandgap.h 	int (*report_temperature)(struct ti_bandgap *bgp, int id);
bgp               322 drivers/thermal/ti-soc-thermal/ti-bandgap.h 	int (*expose_sensor)(struct ti_bandgap *bgp, int id, char *domain);
bgp               323 drivers/thermal/ti-soc-thermal/ti-bandgap.h 	int (*remove_sensor)(struct ti_bandgap *bgp, int id);
bgp               329 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, int *thot);
bgp               330 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val);
bgp               331 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_read_tcold(struct ti_bandgap *bgp, int id, int *tcold);
bgp               332 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_write_tcold(struct ti_bandgap *bgp, int id, int val);
bgp               333 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id,
bgp               335 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id,
bgp               337 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_read_temperature(struct ti_bandgap *bgp, int id,
bgp               339 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data);
bgp               340 drivers/thermal/ti-soc-thermal/ti-bandgap.h void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id);
bgp               341 drivers/thermal/ti-soc-thermal/ti-bandgap.h int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend);
bgp                31 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	struct ti_bandgap *bgp;
bgp                71 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	struct ti_bandgap *bgp;
bgp                79 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	bgp = data->bgp;
bgp                80 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	s = &bgp->conf->sensors[data->sensor_id];
bgp                82 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	ret = ti_bandgap_read_temperature(bgp, data->sensor_id, &tmp);
bgp                99 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 			dev_err(bgp->dev,
bgp               120 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	struct ti_bandgap *bgp;
bgp               123 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	bgp = data->bgp;
bgp               126 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	ret = ti_bandgap_get_trend(bgp, id, &tr);
bgp               146 drivers/thermal/ti-soc-thermal/ti-thermal-common.c *ti_thermal_build_data(struct ti_bandgap *bgp, int id)
bgp               150 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data = devm_kzalloc(bgp->dev, sizeof(*data), GFP_KERNEL);
bgp               152 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 		dev_err(bgp->dev, "kzalloc fail\n");
bgp               156 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data->bgp = bgp;
bgp               165 drivers/thermal/ti-soc-thermal/ti-thermal-common.c int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
bgp               170 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data = ti_bandgap_get_sensor_data(bgp, id);
bgp               173 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 		data = ti_thermal_build_data(bgp, id);
bgp               179 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data->ti_thermal = devm_thermal_zone_of_sensor_register(bgp->dev, id,
bgp               182 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 		dev_err(bgp->dev, "thermal zone device is NULL\n");
bgp               186 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	ti_bandgap_set_sensor_data(bgp, id, data);
bgp               187 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	ti_bandgap_write_update_interval(bgp, data->sensor_id,
bgp               193 drivers/thermal/ti-soc-thermal/ti-thermal-common.c int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
bgp               197 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data = ti_bandgap_get_sensor_data(bgp, id);
bgp               207 drivers/thermal/ti-soc-thermal/ti-thermal-common.c int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
bgp               211 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data = ti_bandgap_get_sensor_data(bgp, id);
bgp               218 drivers/thermal/ti-soc-thermal/ti-thermal-common.c int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
bgp               221 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	struct device_node *np = bgp->dev->of_node;
bgp               231 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data = ti_bandgap_get_sensor_data(bgp, id);
bgp               233 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 		data = ti_thermal_build_data(bgp, id);
bgp               248 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 		dev_err(bgp->dev, "Failed to register cpu cooling device %d\n",
bgp               254 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	ti_bandgap_set_sensor_data(bgp, id, data);
bgp               259 drivers/thermal/ti-soc-thermal/ti-thermal-common.c int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
bgp               263 drivers/thermal/ti-soc-thermal/ti-thermal-common.c 	data = ti_bandgap_get_sensor_data(bgp, id);
bgp                57 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
bgp                58 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
bgp                59 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
bgp                60 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
bgp                61 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
bgp                64 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
bgp                70 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
bgp                76 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
bgp                82 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
bgp                88 drivers/thermal/ti-soc-thermal/ti-thermal.h int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)