Loading Documentation/devicetree/bindings/regulator/fan53555.txt +15 −1 Original line number Diff line number Diff line Binding for Fairchild FAN53555 regulators Required properties: - compatible: one of "fcs,fan53555", "silergy,syr827", "silergy,syr828" - compatible: one of "fcs,fan53555", "silergy,syr827", "silergy,syr828" or "halo,hl7509" - reg: I2C address Optional properties: Loading @@ -10,6 +11,10 @@ Optional properties: voltage. The other one is used for the runtime voltage setting Possible values are either <0> or <1> - vin-supply: regulator supplying the vin pin - fcs,disable-suspend: Boolean flag which specifies if suspend voltage configuration should be avoided. If this property is present, then the voltage selector register defined by fcs,suspend-voltage-selector should not be modified at runtime. Example: Loading @@ -21,3 +26,12 @@ Example: vin-supply = <&parent_reg>; fcs,suspend-voltage-selector = <1>; }; regulator@60 { compatible = "halo,hl7509"; regulator-name = "hl7509"; regulator-min-microvolt = <600000>; regulator-max-microvolt = <1230000>; fcs,suspend-voltage-selector = <1>; fcs,disable-suspend; }; Documentation/devicetree/bindings/vendor-prefixes.txt +1 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ grinn Grinn grmn Garmin Limited gumstix Gumstix, Inc. gw Gateworks Corporation halo Halo Microelectronics Co., Ltd. hannstar HannStar Display Corporation haoyu Haoyu Microelectronic Co. Ltd. hardkernel Hardkernel Co., Ltd Loading drivers/regulator/fan53555.c +36 −18 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ enum fan53555_vendor { FAN53555_VENDOR_FAIRCHILD = 0, FAN53555_VENDOR_SILERGY, HALO_HL7509, }; /* IC Type */ Loading Loading @@ -98,6 +99,8 @@ struct fan53555_device_info { unsigned int slew_rate; /* Sleep voltage cache */ unsigned int sleep_vol_cache; /* Disable suspend */ bool disable_suspend; }; static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV) Loading @@ -105,6 +108,8 @@ static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV) struct fan53555_device_info *di = rdev_get_drvdata(rdev); int ret; if (di->disable_suspend) return 0; if (di->sleep_vol_cache == uV) return 0; ret = regulator_map_voltage_linear(rdev, uV, uV); Loading Loading @@ -309,6 +314,9 @@ static int fan53555_device_setup(struct fan53555_device_info *di, case FAN53555_VENDOR_SILERGY: ret = fan53555_voltages_setup_silergy(di); break; case HALO_HL7509: ret = fan53555_voltages_setup_fairchild(di); break; default: dev_err(di->dev, "vendor %d not supported!\n", di->vendor); return -EINVAL; Loading Loading @@ -344,26 +352,29 @@ static const struct regmap_config fan53555_regmap_config = { .val_bits = 8, }; static struct fan53555_platform_data *fan53555_parse_dt(struct device *dev, struct device_node *np, static int fan53555_parse_dt(struct fan53555_device_info *di, struct fan53555_platform_data *pdata, const struct regulator_desc *desc) { struct fan53555_platform_data *pdata; struct device *dev = di->dev; struct device_node *np = dev->of_node; int ret; u32 tmp; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) return NULL; pdata->regulator = of_get_regulator_init_data(dev, np, desc); if (!pdata->regulator) { dev_err(dev, "regulator init data is missing\n"); return -ENODEV; } ret = of_property_read_u32(np, "fcs,suspend-voltage-selector", &tmp); if (!ret) pdata->sleep_vsel_id = tmp; return pdata; di->disable_suspend = of_property_read_bool(np, "fcs,disable-suspend"); return ret; } static const struct of_device_id fan53555_dt_ids[] = { Loading @@ -376,6 +387,9 @@ static const struct of_device_id fan53555_dt_ids[] = { }, { .compatible = "silergy,syr828", .data = (void *)FAN53555_VENDOR_SILERGY, }, { .compatible = "halo,hl7509", .data = (void *)HALO_HL7509, }, { } }; Loading @@ -384,7 +398,6 @@ MODULE_DEVICE_TABLE(of, fan53555_dt_ids); static int fan53555_regulator_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device_node *np = client->dev.of_node; struct fan53555_device_info *di; struct fan53555_platform_data *pdata; struct regulator_config config = { }; Loading @@ -397,14 +410,17 @@ static int fan53555_regulator_probe(struct i2c_client *client, return -ENOMEM; pdata = dev_get_platdata(&client->dev); if (!pdata) { pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) pdata = fan53555_parse_dt(&client->dev, np, &di->desc); if (!pdata || !pdata->regulator) { dev_err(&client->dev, "Platform data not found!\n"); return -ENODEV; return -ENOMEM; } di->dev = &client->dev; ret = fan53555_parse_dt(di, pdata, &di->desc); if (ret) return ret; di->regulator = pdata->regulator; if (client->dev.of_node) { di->vendor = Loading @@ -427,7 +443,6 @@ static int fan53555_regulator_probe(struct i2c_client *client, dev_err(&client->dev, "Failed to allocate regmap!\n"); return PTR_ERR(di->regmap); } di->dev = &client->dev; i2c_set_clientdata(client, di); /* Get chip ID */ ret = regmap_read(di->regmap, FAN53555_ID1, &val); Loading Loading @@ -456,7 +471,7 @@ static int fan53555_regulator_probe(struct i2c_client *client, config.init_data = di->regulator; config.regmap = di->regmap; config.driver_data = di; config.of_node = np; config.of_node = client->dev.of_node; ret = fan53555_regulator_register(di, &config); if (ret < 0) Loading @@ -475,6 +490,9 @@ static const struct i2c_device_id fan53555_id[] = { }, { .name = "syr828", .driver_data = FAN53555_VENDOR_SILERGY }, { .name = "hl7509", .driver_data = HALO_HL7509 }, { }, }; Loading Loading
Documentation/devicetree/bindings/regulator/fan53555.txt +15 −1 Original line number Diff line number Diff line Binding for Fairchild FAN53555 regulators Required properties: - compatible: one of "fcs,fan53555", "silergy,syr827", "silergy,syr828" - compatible: one of "fcs,fan53555", "silergy,syr827", "silergy,syr828" or "halo,hl7509" - reg: I2C address Optional properties: Loading @@ -10,6 +11,10 @@ Optional properties: voltage. The other one is used for the runtime voltage setting Possible values are either <0> or <1> - vin-supply: regulator supplying the vin pin - fcs,disable-suspend: Boolean flag which specifies if suspend voltage configuration should be avoided. If this property is present, then the voltage selector register defined by fcs,suspend-voltage-selector should not be modified at runtime. Example: Loading @@ -21,3 +26,12 @@ Example: vin-supply = <&parent_reg>; fcs,suspend-voltage-selector = <1>; }; regulator@60 { compatible = "halo,hl7509"; regulator-name = "hl7509"; regulator-min-microvolt = <600000>; regulator-max-microvolt = <1230000>; fcs,suspend-voltage-selector = <1>; fcs,disable-suspend; };
Documentation/devicetree/bindings/vendor-prefixes.txt +1 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ grinn Grinn grmn Garmin Limited gumstix Gumstix, Inc. gw Gateworks Corporation halo Halo Microelectronics Co., Ltd. hannstar HannStar Display Corporation haoyu Haoyu Microelectronic Co. Ltd. hardkernel Hardkernel Co., Ltd Loading
drivers/regulator/fan53555.c +36 −18 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ enum fan53555_vendor { FAN53555_VENDOR_FAIRCHILD = 0, FAN53555_VENDOR_SILERGY, HALO_HL7509, }; /* IC Type */ Loading Loading @@ -98,6 +99,8 @@ struct fan53555_device_info { unsigned int slew_rate; /* Sleep voltage cache */ unsigned int sleep_vol_cache; /* Disable suspend */ bool disable_suspend; }; static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV) Loading @@ -105,6 +108,8 @@ static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV) struct fan53555_device_info *di = rdev_get_drvdata(rdev); int ret; if (di->disable_suspend) return 0; if (di->sleep_vol_cache == uV) return 0; ret = regulator_map_voltage_linear(rdev, uV, uV); Loading Loading @@ -309,6 +314,9 @@ static int fan53555_device_setup(struct fan53555_device_info *di, case FAN53555_VENDOR_SILERGY: ret = fan53555_voltages_setup_silergy(di); break; case HALO_HL7509: ret = fan53555_voltages_setup_fairchild(di); break; default: dev_err(di->dev, "vendor %d not supported!\n", di->vendor); return -EINVAL; Loading Loading @@ -344,26 +352,29 @@ static const struct regmap_config fan53555_regmap_config = { .val_bits = 8, }; static struct fan53555_platform_data *fan53555_parse_dt(struct device *dev, struct device_node *np, static int fan53555_parse_dt(struct fan53555_device_info *di, struct fan53555_platform_data *pdata, const struct regulator_desc *desc) { struct fan53555_platform_data *pdata; struct device *dev = di->dev; struct device_node *np = dev->of_node; int ret; u32 tmp; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) return NULL; pdata->regulator = of_get_regulator_init_data(dev, np, desc); if (!pdata->regulator) { dev_err(dev, "regulator init data is missing\n"); return -ENODEV; } ret = of_property_read_u32(np, "fcs,suspend-voltage-selector", &tmp); if (!ret) pdata->sleep_vsel_id = tmp; return pdata; di->disable_suspend = of_property_read_bool(np, "fcs,disable-suspend"); return ret; } static const struct of_device_id fan53555_dt_ids[] = { Loading @@ -376,6 +387,9 @@ static const struct of_device_id fan53555_dt_ids[] = { }, { .compatible = "silergy,syr828", .data = (void *)FAN53555_VENDOR_SILERGY, }, { .compatible = "halo,hl7509", .data = (void *)HALO_HL7509, }, { } }; Loading @@ -384,7 +398,6 @@ MODULE_DEVICE_TABLE(of, fan53555_dt_ids); static int fan53555_regulator_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device_node *np = client->dev.of_node; struct fan53555_device_info *di; struct fan53555_platform_data *pdata; struct regulator_config config = { }; Loading @@ -397,14 +410,17 @@ static int fan53555_regulator_probe(struct i2c_client *client, return -ENOMEM; pdata = dev_get_platdata(&client->dev); if (!pdata) { pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) pdata = fan53555_parse_dt(&client->dev, np, &di->desc); if (!pdata || !pdata->regulator) { dev_err(&client->dev, "Platform data not found!\n"); return -ENODEV; return -ENOMEM; } di->dev = &client->dev; ret = fan53555_parse_dt(di, pdata, &di->desc); if (ret) return ret; di->regulator = pdata->regulator; if (client->dev.of_node) { di->vendor = Loading @@ -427,7 +443,6 @@ static int fan53555_regulator_probe(struct i2c_client *client, dev_err(&client->dev, "Failed to allocate regmap!\n"); return PTR_ERR(di->regmap); } di->dev = &client->dev; i2c_set_clientdata(client, di); /* Get chip ID */ ret = regmap_read(di->regmap, FAN53555_ID1, &val); Loading Loading @@ -456,7 +471,7 @@ static int fan53555_regulator_probe(struct i2c_client *client, config.init_data = di->regulator; config.regmap = di->regmap; config.driver_data = di; config.of_node = np; config.of_node = client->dev.of_node; ret = fan53555_regulator_register(di, &config); if (ret < 0) Loading @@ -475,6 +490,9 @@ static const struct i2c_device_id fan53555_id[] = { }, { .name = "syr828", .driver_data = FAN53555_VENDOR_SILERGY }, { .name = "hl7509", .driver_data = HALO_HL7509 }, { }, }; Loading