mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
linux3.10:io_domain:modify io_vol_domain
This commit is contained in:
@@ -630,3 +630,27 @@
|
||||
};
|
||||
};
|
||||
|
||||
&ap0_vcc_domain{
|
||||
regulator-name= "vccio_wl";
|
||||
};
|
||||
&ap1_vcc_domain{
|
||||
regulator-name= "vccio";
|
||||
};
|
||||
&cif_vcc_domain{
|
||||
regulator-name= "vcc18_cif";
|
||||
};
|
||||
&flash_vcc_domain{
|
||||
regulator-name= "vcc_flash";
|
||||
};
|
||||
&vccio0_vcc_domain{
|
||||
regulator-name= "vccio";
|
||||
};
|
||||
&vccio1_vcc_domain{
|
||||
regulator-name= "vccio";
|
||||
};
|
||||
&lcdc0_vcc_domain{
|
||||
regulator-name= "vcc_lcd";
|
||||
};
|
||||
&lcdc1_vcc_domain{
|
||||
regulator-name= "vccio";
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "skeleton.dtsi"
|
||||
#include "rk3188-pinctrl.dtsi"
|
||||
#include "rk3188-clocks.dtsi"
|
||||
#include "rk3188_io_vol_domain.dtsi"
|
||||
|
||||
/ {
|
||||
compatible = "rockchip,rk3188";
|
||||
@@ -772,4 +771,62 @@
|
||||
pinctrl-0 = <&rmii_clkoutpin &rmii_txpins &rmii_rxpins &rmii_mdpins>;
|
||||
pinctrl-1 = <&rmii_clkinpin &rmii_txpins &rmii_rxpins &rmii_mdpins>;
|
||||
};
|
||||
|
||||
ap0_vcc_domain: ap0-vcc-domain {
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&ap0_vcc >;
|
||||
pinctrl-1 = <&ap0_vcc_18>;
|
||||
pinctrl-2 = <&ap0_vcc_33>;
|
||||
};
|
||||
ap1_vcc_domain: ap1-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&ap1_vcc >;
|
||||
pinctrl-1 = <&ap1_vcc_18>;
|
||||
pinctrl-2 = <&ap1_vcc_33>;
|
||||
};
|
||||
cif_vcc_domain: cif-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&cif_vcc>;
|
||||
pinctrl-1 = <&cif_vcc_18>;
|
||||
pinctrl-2 = <&cif_vcc_33>;
|
||||
};
|
||||
flash_vcc_domain: flash-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&flash_vcc>;
|
||||
pinctrl-1 = <&flash_vcc_18>;
|
||||
pinctrl-2 = <&flash_vcc_33>;
|
||||
};
|
||||
vccio0_vcc_domain: vccio0-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&vccio0_vcc>;
|
||||
pinctrl-1 = <&vccio0_vcc_18>;
|
||||
pinctrl-2 = <&vccio0_vcc_33>;
|
||||
};
|
||||
vccio1_vcc_domain: vccio1-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&vccio1_vcc>;
|
||||
pinctrl-1 = <&vccio1_vcc_18>;
|
||||
pinctrl-2 = <&vccio1_vcc_33>;
|
||||
};
|
||||
lcdc0_vcc_domain: lcdc0-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&lcdc0_vcc>;
|
||||
pinctrl-1 = <&lcdc0_vcc_18>;
|
||||
pinctrl-2 = <&lcdc0_vcc_33>;
|
||||
};
|
||||
lcdc1_vcc_domain: lcdc1-vcc-domain{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&lcdc1_vcc>;
|
||||
pinctrl-1 = <&lcdc1_vcc_18>;
|
||||
pinctrl-2 = <&lcdc1_vcc_33>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
|
||||
/ {
|
||||
|
||||
vccio{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&ap1_vcc &vccio0_vcc &vccio1_vcc &lcdc1_vcc>;
|
||||
pinctrl-1 = <&ap1_vcc_18 &vccio0_vcc_18 &vccio1_vcc_18 &lcdc1_vcc_18>;
|
||||
pinctrl-2 = <&ap1_vcc_33 &vccio0_vcc_33 &vccio1_vcc_33 &lcdc1_vcc_33>;
|
||||
|
||||
regulator_name{
|
||||
regulator-name= "vccio";
|
||||
};
|
||||
};
|
||||
vccio_wl{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&ap0_vcc>;
|
||||
pinctrl-1 = <&ap0_vcc_18>;
|
||||
pinctrl-2 = <&ap0_vcc_33>;
|
||||
|
||||
regulator_name{
|
||||
regulator-name= "vccio_wl";
|
||||
};
|
||||
};
|
||||
vcc18_cif{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&cif_vcc>;
|
||||
pinctrl-1 = <&cif_vcc_18>;
|
||||
pinctrl-2 = <&cif_vcc_33>;
|
||||
|
||||
regulator_name{
|
||||
regulator-name= "vcc18_cif";
|
||||
};
|
||||
};
|
||||
vcc_flash{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&flash_vcc>;
|
||||
pinctrl-1 = <&flash_vcc_18>;
|
||||
pinctrl-2 = <&flash_vcc_33>;
|
||||
|
||||
regulator_name{
|
||||
regulator-name= "vcc_flash";
|
||||
};
|
||||
};
|
||||
vcc_lcd{
|
||||
compatible = "rockchip,io_vol_domain";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pinctrl-names = "default", "1.8V", "3.3V";
|
||||
pinctrl-0 = <&lcdc0_vcc>;
|
||||
pinctrl-1 = <&lcdc0_vcc_18>;
|
||||
pinctrl-2 = <&lcdc0_vcc_33>;
|
||||
|
||||
regulator_name{
|
||||
regulator-name= "vcc_lcd";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -30,7 +30,11 @@ int io_domain_regulator_set_voltage(struct regulator *regulator, int min_uV, int
|
||||
printk("IO_DOMAIN:ERROR:The io vol domin is not exit. %s\n",__func__);
|
||||
}
|
||||
|
||||
if (min_uV >= old_voltage){
|
||||
if (min_uV == old_voltage){
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:the vol is not modify,not need to set io vol domain. %s \n",__func__);
|
||||
return 0;
|
||||
}
|
||||
else if (min_uV > old_voltage){
|
||||
if( min_uV > IO_VOL_DOMAIN_3V3){
|
||||
pinctrl_select_state(g_uap->pctl, g_uap->pins_3v3);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:set io domain 3.3v. %s \n",__func__);
|
||||
@@ -52,7 +56,6 @@ int io_domain_regulator_set_voltage(struct regulator *regulator, int min_uV, int
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:set io domain 1.8v. %s \n",__func__);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
@@ -76,8 +79,7 @@ static int rk_io_vol_domain_resume(struct platform_device *pdev)
|
||||
static int rk_io_vol_domain_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct io_domain_port *uap;
|
||||
struct vd_node *vd;
|
||||
struct device_node *io_domain_node,*pd_dev_node ;
|
||||
struct device_node *io_domain_node ;
|
||||
struct regulator *vol_regulator;
|
||||
struct io_domain_device *io_vol_dev = NULL;
|
||||
int vol=0,ret =0;
|
||||
@@ -89,7 +91,7 @@ static int rk_io_vol_domain_probe(struct platform_device *pdev)
|
||||
}
|
||||
platform_set_drvdata(pdev, io_vol_dev);
|
||||
io_vol_dev->dev = &pdev->dev;
|
||||
|
||||
|
||||
uap = devm_kzalloc(&pdev->dev, sizeof(struct io_domain_port),
|
||||
GFP_KERNEL);
|
||||
if (uap == NULL) {
|
||||
@@ -101,49 +103,40 @@ static int rk_io_vol_domain_probe(struct platform_device *pdev)
|
||||
uap->pins_1v8 = pinctrl_lookup_state(uap->pctl, "1.8V");
|
||||
uap->pins_3v3 = pinctrl_lookup_state(uap->pctl,"3.3V");
|
||||
g_uap = uap;
|
||||
|
||||
|
||||
io_domain_node = of_node_get(pdev->dev.of_node);
|
||||
if (!io_domain_node) {
|
||||
printk("could not find rk_io_vol_domain-node\n");
|
||||
return -ENOMEM ;
|
||||
return -ENODEV ;
|
||||
}
|
||||
|
||||
for_each_available_child_of_node(io_domain_node,pd_dev_node) {
|
||||
vd = kzalloc(sizeof(struct vd_node), GFP_KERNEL);
|
||||
if (!vd)
|
||||
return -ENOMEM;
|
||||
|
||||
vd->name = pd_dev_node->name;
|
||||
pd_dev_node->name = of_get_property(pd_dev_node, "regulator-name", NULL);
|
||||
if (pd_dev_node->name== NULL) {
|
||||
printk("%s vd(%s) pd_dev_node->name(%s) get regulator_name err, ret:%d\n",
|
||||
__func__,vd->name , pd_dev_node->name,ret);
|
||||
kfree(vd);
|
||||
continue;
|
||||
}
|
||||
vol_regulator = regulator_get(NULL,pd_dev_node->name);
|
||||
if (IS_ERR(vol_regulator)){
|
||||
pinctrl_select_state(uap->pctl, uap->pins_default);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:ERROR:The io vol domin is not exit,set it by defult. %s %s\n",__func__,pd_dev_node->name);
|
||||
continue;
|
||||
}
|
||||
else{
|
||||
io_domain_node->name = of_get_property(io_domain_node, "regulator-name", NULL);
|
||||
|
||||
if (io_domain_node->name== NULL) {
|
||||
printk("%s io_domain_node->name(%s) get regulator_name err, ret:%d\n", __func__, io_domain_node->name,ret);
|
||||
return -ENODEV ;
|
||||
}
|
||||
vol_regulator = regulator_get(NULL,io_domain_node->name);
|
||||
if (IS_ERR(vol_regulator)){
|
||||
pinctrl_select_state(uap->pctl, uap->pins_default);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:ERROR:The io vol domin regulator name is not exit,set it by defult. %s %s\n",__func__,io_domain_node->name);
|
||||
return 0 ;
|
||||
}
|
||||
else{
|
||||
vol = regulator_get_voltage(vol_regulator);
|
||||
if (vol > IO_VOL_DOMAIN_3V3){
|
||||
pinctrl_select_state(uap->pctl, uap->pins_3v3);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:set io domain 3.3v. %s %s = %d\n",__func__,pd_dev_node->name,vol);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:set io domain 3.3v. %s %s = %d\n",__func__,io_domain_node->name,vol);
|
||||
}
|
||||
else if (vol > IO_VOL_DOMAIN_1V8){
|
||||
pinctrl_select_state(uap->pctl, uap->pins_1v8);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:set io domain 1.8v. %s %s = %d\n",__func__,pd_dev_node->name,vol);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:set io domain 1.8v. %s %s = %d\n",__func__,io_domain_node->name,vol);
|
||||
}
|
||||
else{
|
||||
pinctrl_select_state(uap->pctl, uap->pins_default);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:ERROR:The io vol domin is not exit,set it by defult. %s %s\n",__func__,pd_dev_node->name);
|
||||
IO_DOMAIN_DBG("IO_DOMAIN:ERROR:The io vol domin is not exit,set it by defult. %s %s\n",__func__,io_domain_node->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user