static int atv_dac_power(int on)
{
	int rc = 0;
	pr_info("%s: on/off=%d\n", __func__, on);

	#define _GET_REGULATOR(var, name) do {				\
		var = regulator_get(NULL, name);			\
		if (IS_ERR(var)) {					\
			pr_err("'%s' regulator not found, rc=%ld\n",	\
				name, IS_ERR(var));			\
			var = NULL;					\
			return -ENODEV;					\
		}							\
	} while (0)

	if (!reg_8058_l13)
		_GET_REGULATOR(reg_8058_l13, "8058_l13");
	#undef _GET_REGULATOR

	if (on) {
		//gpio_set_value(PM8058_GPIO_PM_TO_SYS(DOUBLESHOT_TVOUT_SW - 1), 1);
		rc = regulator_set_voltage(reg_8058_l13, 2050000, 2050000);
		if (rc) {
			pr_err("%s: '%s' regulator set voltage failed,\
				rc=%d\n", __func__, "8058_l13", rc);
			goto end;
		}

		rc = regulator_enable(reg_8058_l13);
		if (rc) {
			pr_err("%s: '%s' regulator enable failed,\
				rc=%d\n", __func__, "8058_l13", rc);
			goto end;
		}
	} else {
Exemplo n.º 2
0
static void display_panel_power(int on)
{
	int rc;
	static struct regulator *display_reg;
	static struct regulator *lvds_reg;
      #if S7_HWID_L3H(S7, S7301, B)
      static struct regulator *iovcc_reg;
      #endif

      if(on) {
          /* LCD VCCS set to 3.0V */
          _GET_REGULATOR(display_reg, "8901_l2");
          if (!display_reg)
            return;
          rc = regulator_set_voltage(display_reg,
          	3000000, 3000000);
          if (rc)
          	goto out_display_reg;
          rc = regulator_enable(display_reg);
          if (rc)
          	goto out_display_reg;

          /* LVDS VCCS set to 3.30 */
          _GET_REGULATOR(lvds_reg, "8901_l3");
          if (!lvds_reg)
          	return;

          rc = regulator_set_voltage(lvds_reg,
          	3000000, 3000000);

          if (rc)
          	goto out_lvds_reg;
          rc = regulator_enable(lvds_reg);
          if (rc)
          	goto out_lvds_reg;

          #if S7_HWID_L3H(S7, S7301, B)
          /* LVDS_IOVCC set to 1.8V */
          _GET_REGULATOR(iovcc_reg, "8058_l11");
          if (!iovcc_reg)
          	return;
          rc = regulator_set_voltage(iovcc_reg,
          	1800000, 1800000);
          if (rc)
          	goto out_iovcc_reg;
          rc = regulator_enable(iovcc_reg);
          if (rc)
          	goto out_iovcc_reg;
          #endif

          /* LCD_H_REV */
          rc = gpio_request(lcd_h_rev, "lcd_h_rev");
          if (rc == 0) {
		/* output, pull low to enable */
		gpio_direction_output(lcd_h_rev, 0);
          } else {
		pr_err("%s: lcd_h_rev=%d, gpio_request failed\n",
			__func__, lcd_h_rev);
             goto out_pm_reg;
          }
          
          /* LCD_V_REV */
          rc = gpio_request(lcd_v_rev, "lcd_v_rev");
          if (rc == 0) {
		/* output, pull low to enable */
		gpio_direction_output(lcd_v_rev, 0);
          } else {
		pr_err("%s: lcd_v_rev=%d, gpio_request failed\n",
			__func__, lcd_v_rev);
             goto out_lcd_h_rev;
          }

		  
          /* LCD_ID */
          rc = gpio_request(lcd_panel_id, "lcd_panel_id");
          if (rc == 0) {
		/* output, pull high to enable */
		gpio_direction_input(lcd_panel_id);
          } else {
		pr_err("%s: lcd_panel_id=%d, gpio_request failed\n",
			__func__, lcd_panel_id);
             goto out_lcd_v_rev;
          } 

          display_power_on = 1;
      }else {
          if (display_power_on) {       
            display_power_on = 0;
            goto out_lcd_panel_id;
          }
      }
      return;


out_lcd_panel_id:
       gpio_free(lcd_panel_id);          
out_lcd_v_rev:
       gpio_free(lcd_v_rev);     
out_lcd_h_rev:
       gpio_free(lcd_h_rev);      
out_pm_reg:
#if S7_HWID_L3L(S7, S7301, T0)
	regulator_disable(lvds_reg);
#elif S7_HWID_L3H(S7, S7301, B)
	regulator_disable(iovcc_reg);
#endif      
#if S7_HWID_L3H(S7, S7301, B)   
out_iovcc_reg:
	regulator_disable(lvds_reg);
	regulator_put(iovcc_reg);
	iovcc_reg = NULL;     
#endif
out_lvds_reg:
	regulator_disable(display_reg);
	regulator_put(lvds_reg);
	lvds_reg = NULL;
out_display_reg:
	regulator_put(display_reg);
	display_reg = NULL;    
}