[PATCH] USB ehci-omap: Remove second kfree() call on the same object
Remove second kfree() call on the same object in the error path of ehci_hcd_omap_probe() Signed-off-by: Matthias Kaehlcke --- drivers/usb/host/ehci-omap.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index e1da3c9..116ae28 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -734,7 +734,6 @@ err_uhh_ioremap: err_ioremap: usb_put_hcd(hcd); - kfree(omap); err_create_hcd: kfree(omap); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Regulator question regarding I2C devices
Hi Peter, El Fri, Jan 28, 2011 at 05:24:01PM -0500 Peter Barada ha dit: > I have a tsc2004 touch controller on I2C3 that is powered by vaux1, > and since its probed I have to turn the power on before it can be > probed. > > I've created: > > static struct regulator_consumer_supply dm3730logic_vaux1_supply = { > .supply= "vaux1", > }; > > /* VAUX1 for touch chip */ > static struct regulator_init_data dm3730logic_vaux1 = { > .constraints = { > .min_uV= 300, > .max_uV= 300, > .apply_uV= true, > .valid_modes_mask= REGULATOR_MODE_NORMAL > | REGULATOR_MODE_STANDBY, > .valid_ops_mask= REGULATOR_CHANGE_MODE > | REGULATOR_CHANGE_STATUS, > }, > .num_consumer_supplies= 1, > .consumer_supplies= &dm3730logic_vaux1_supply, > }; > > and listed it in the twldata initializer > .vaux1= &dm3730logic_vaux1, > > But it never gets enabled... How can I tell the kernel to turn the regulator > on? > > If I try to call regulator_get() right before the call to > omap_register_i2c_bus for I2C3, regulator_get returns a NULL due to > regulator_map_list being empty. If I look in sys/class/regulator I see VAUX1 > listed (as regulator.4), but there are no users. > > Any suggestions on how I can turn on vaux1 so the tsc2004 touch > controller is visible to by the I2C system? I guess the problem is that the regulators aren't initialized when you call regulator_get() before the i2c bus registration I think the right thing is to do the regulator handling inside the tsc2004 driver The ADS7846 touchscreen driver (drivers/input/touchscreen/ads7846.c) in combination with the TimLL Devkit8000 board (arch/arm/mach-omap2/board-devkit8000.c) can serve you as a reference Best regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam You can't separate peace from freedom because no one can be at peace unless he has his freedom (Malcolm X) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] OMAP34xx: Add padconfig offsets for GPIOs 126-129
Add OMAP3_CONTROL_PADCONF_GPIOxxx_OFFSET constants for GPIOs 126-129 Signed-off-by: Matthias Kaehlcke --- arch/arm/mach-omap2/mux34xx.h |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/mux34xx.h b/arch/arm/mach-omap2/mux34xx.h index 6543ebf..70d2b8d 100644 --- a/arch/arm/mach-omap2/mux34xx.h +++ b/arch/arm/mach-omap2/mux34xx.h @@ -393,6 +393,10 @@ #define OMAP3_CONTROL_PADCONF_SAD2D_SWAKEUP_OFFSET 0xa1c #define OMAP3_CONTROL_PADCONF_JTAG_RTCK_OFFSET 0xa1e #define OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET 0xa20 +#define OMAP3_CONTROL_PADCONF_GPIO127_OFFSET 0xa24 +#define OMAP3_CONTROL_PADCONF_GPIO126_OFFSET 0xa26 +#define OMAP3_CONTROL_PADCONF_GPIO128_OFFSET 0xa28 +#define OMAP3_CONTROL_PADCONF_GPIO129_OFFSET 0xa2a #define OMAP3_CONTROL_PADCONF_MUX_SIZE \ (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] twl4030-usb: Report correct vbus value for accessory charger adapters1
The twl4030-usb driver exports the status of VBUS as sysfs attribute. In case an accessory charger adapter (ACA) is connected to the OTG transceiver the attribute is always 'off', even when the charger provides VBUS. Added a variable to keep track of the status of VBUS and report it correctly Signed-off-by: Matthias Kaehlcke --- drivers/usb/otg/twl4030-usb.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index e01b073..efeb4d1 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c @@ -160,6 +160,7 @@ struct twl4030_usb { int irq; u8 linkstat; + boolvbus_supplied; u8 asleep; boolirq_enabled; }; @@ -250,6 +251,8 @@ static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl) int status; int linkstat = USB_EVENT_NONE; + twl->vbus_supplied = false; + /* * For ID/VBUS sensing, see manual section 15.4.8 ... * except when using only battery backup power, two @@ -265,6 +268,9 @@ static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl) if (status < 0) dev_err(twl->dev, "USB link status err %d\n", status); else if (status & (BIT(7) | BIT(2))) { + if (status & (BIT(7))) +twl->vbus_supplied = true; + if (status & BIT(2)) linkstat = USB_EVENT_ID; else @@ -484,7 +490,7 @@ static ssize_t twl4030_usb_vbus_show(struct device *dev, spin_lock_irqsave(&twl->lock, flags); ret = sprintf(buf, "%s\n", - (twl->linkstat == USB_EVENT_VBUS) ? "on" : "off"); + twl->vbus_supplied ? "on" : "off"); spin_unlock_irqrestore(&twl->lock, flags); return ret; @@ -608,6 +614,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) twl->otg.set_peripheral = twl4030_set_peripheral; twl->otg.set_suspend = twl4030_set_suspend; twl->usb_mode= pdata->usb_mode; + twl->vbus_supplied = false; twl->asleep = 1; /* init spinlock for workqueue */ -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] OMAP34xx: Add padconfig offsets for GPIOs 126-129
Hi Felipe, El Sun, Apr 03, 2011 at 02:06:31PM +0300 Felipe Balbi ha dit: > On Fri, Apr 01, 2011 at 10:23:30PM +0200, Matthias Kaehlcke wrote: > > Add OMAP3_CONTROL_PADCONF_GPIOxxx_OFFSET constants for GPIOs 126-129 > > > > Signed-off-by: Matthias Kaehlcke > > --- > > arch/arm/mach-omap2/mux34xx.h |4 > > 1 files changed, 4 insertions(+), 0 deletions(-) > > > > diff --git a/arch/arm/mach-omap2/mux34xx.h b/arch/arm/mach-omap2/mux34xx.h > > index 6543ebf..70d2b8d 100644 > > --- a/arch/arm/mach-omap2/mux34xx.h > > +++ b/arch/arm/mach-omap2/mux34xx.h > > @@ -393,6 +393,10 @@ > > #define OMAP3_CONTROL_PADCONF_SAD2D_SWAKEUP_OFFSET 0xa1c > > #define OMAP3_CONTROL_PADCONF_JTAG_RTCK_OFFSET 0xa1e > > #define OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET 0xa20 > > +#define OMAP3_CONTROL_PADCONF_GPIO127_OFFSET 0xa24 > > +#define OMAP3_CONTROL_PADCONF_GPIO126_OFFSET 0xa26 > > +#define OMAP3_CONTROL_PADCONF_GPIO128_OFFSET 0xa28 > > +#define OMAP3_CONTROL_PADCONF_GPIO129_OFFSET 0xa2a > > no users for these ? we use these on a custom board whose board specific code won't be mainlined. i think it still makes sense to have the constants in mainline for the sake of completeness kind regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam La libertad es como la mañana. Hay quienes esperan dormidos a que llegue, pero hay quienes desvelan y caminan la noche para alcanzarla (Subcomandante Marcos) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] backlight: Add TPS65217 WLED driver
The TPS65217 chip contains a boost converter and current sinks which can be used to drive LEDs for use as backlights. Expose this functionality via the backlight API. Signed-off-by: Matthias Kaehlcke --- drivers/mfd/tps65217.c| 71 + drivers/video/backlight/Kconfig |7 + drivers/video/backlight/Makefile |1 + drivers/video/backlight/tps65217_bl.c | 272 + include/linux/mfd/tps65217.h | 19 +++ 5 files changed, 370 insertions(+) create mode 100644 drivers/video/backlight/tps65217_bl.c diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 61c097a..c248bb3 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -29,6 +29,12 @@ #include #include +#if defined(CONFIG_BACKLIGHT_TPS65217) || defined(CONFIG_BACKLIGHT_TPS65217_MODULE) +#define tps_has_bl() true +#else +#define tps_has_bl() false +#endif + /** * tps65217_reg_read: Read a single tps65217 register. * @@ -174,6 +180,47 @@ static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) pdata->of_node[i] = reg_matches[i].of_node; } + if (tps_has_bl()) { + struct device_node *np = of_find_node_by_name(node, "backlight"); + if (np) { + u32 val; + + pdata->bl_pdata = devm_kzalloc(&client->dev, sizeof(*pdata->bl_pdata), GFP_KERNEL); + if (!pdata->bl_pdata) + return NULL; + + if (!of_property_read_u32(np, "isel", &val)) { + if (val == 1) { + pdata->bl_pdata->isel = TPS65217_BL_ISET1; + } else if (val == 2) { + pdata->bl_pdata->isel = TPS65217_BL_ISET2; + } else { + dev_err(&client->dev, "invalid value for backlight current limit selection in the device tree\n"); + return NULL; + } + } else { + pdata->bl_pdata->isel = TPS65217_BL_ISET1; + } + + if (!of_property_read_u32(np, "fdim", &val)) { + if (val == 100) { + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_100HZ; + } else if (val == 200) { + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_200HZ; + } else if (val == 500) { + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_500HZ; + } else if (val == 1000) { + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_1000HZ; + } else { + dev_err(&client->dev, "invalid value for backlight dimming frequency in the device tree\n"); + return NULL; + } + } else { + pdata->bl_pdata->fdim = TPS65217_BL_FDIM_200HZ; + } + } + } + return pdata; } @@ -250,7 +297,28 @@ static int __devinit tps65217_probe(struct i2c_client *client, platform_device_add(pdev); } + if (tps_has_bl() && + pdata->bl_pdata) { + tps->bl_pdev = platform_device_alloc("tps65217-bl", 0); + if (!tps->bl_pdev) { + dev_err(tps->dev, "Cannot create backlight platform device\n"); + ret = -ENOMEM; + goto err_alloc_bl_pdev; + } + + tps->bl_pdev->dev.parent = tps->dev; + tps->bl_pdev->dev.platform_data = pdata->bl_pdata; + + platform_device_add(tps->bl_pdev); + } + return 0; + +err_alloc_bl_pdev: + for (i = 0; i < TPS65217_NUM_REGULATOR; i++) + platform_device_unregister(tps->regulator_pdev[i]); + + return ret; } static int __devexit tps65217_remove(struct i2c_client *client) @@ -258,6 +326,9 @@ static int __devexit tps65217_remove(struct i2c_client *client) struct tps65217 *tps = i2c_get_clientdata(client); int i; + if (tps->bl_pdev) + platform_device_unregister(tps->bl_pdev); + for (i = 0; i < TPS65217_NUM_REGULATOR; i++) platform_device_unregister(tps->regulator_pdev[i]); diff --git a/drivers/video/backlight/Kconfig b/drivers/vide
Re: [PATCH] backlight: Add TPS65217 WLED driver
Hi AnilKumar, thanks for your comments El Tue, Aug 07, 2012 at 08:59:17AM + AnilKumar, Chimata ha dit: > Can you re-submit the patch based on linux-next tree? will do > Comments inline > > On Wed, Aug 01, 2012 at 01:18:38, Matthias Kaehlcke wrote: > > The TPS65217 chip contains a boost converter and current sinks which can be > > used to drive LEDs for use as backlights. Expose this functionality via the > > backlight API. > > Can you provide more details here, like patch is based on which > tree? this patch was based on current mainline at the time of submission > Testing details of the driver? the driver has been tested (without device tree) on a custom AM335x board, running an Androidized 3.2 kernel with AM335x support (rowboat project) > > +#if defined(CONFIG_BACKLIGHT_TPS65217) || > > defined(CONFIG_BACKLIGHT_TPS65217_MODULE) > > +#define tps_has_bl() true > > +#else > > +#define tps_has_bl() false > > +#endif > > + > > Is this really required? was inspired by the twl-core driver, but can do without it > > /** > > * tps65217_reg_read: Read a single tps65217 register. > > * > > @@ -174,6 +180,47 @@ static struct tps65217_board *tps65217_parse_dt(struct > > i2c_client *client) > > pdata->of_node[i] = reg_matches[i].of_node; > > } > > > > + if (tps_has_bl()) { > > + struct device_node *np = of_find_node_by_name(node, > > "backlight"); > > + if (np) { > > This can be changed to > np = of_find_node_by_name(node, "backlight"); > if (np) { > } > > else fall into non-backlight case. ok > > + u32 val; > > + > > + pdata->bl_pdata = devm_kzalloc(&client->dev, > > sizeof(*pdata->bl_pdata), GFP_KERNEL); > > + if (!pdata->bl_pdata) > > + return NULL; > > + > > + if (!of_property_read_u32(np, "isel", &val)) { > > + if (val == 1) { > > + pdata->bl_pdata->isel = > > TPS65217_BL_ISET1; > > + } else if (val == 2) { > > + pdata->bl_pdata->isel = > > TPS65217_BL_ISET2; > > + } else { > > + dev_err(&client->dev, "invalid value > > for backlight current limit selection in the device tree\n"); > > fix checkpatch.pl errors before submitting the patches. More than > 80 ch. in this case it will be hard to read the 80 character limit without modifying the log string or breaking it artifically into several lines. i understand the 80 character limit is a soft limit, which can be violated if readability is actually improve by the violation. i'd suggest to make the line slightly shorter by putting the log string in it's own line, but not break the string in between just to reach the 80 char limit > > + return NULL; > > Should not return here, need to handle rest of dt portion. ok > > + } > > + } else { > > + pdata->bl_pdata->isel = TPS65217_BL_ISET1; > > + } > > This can be changed to > > pdata->bl_pdata->isel = TPS65217_BL_ISET1; > of_property_read_u32(np, "isel", &val) > if (val > TPS65217_BL_ISET2 || val < TPS65217_BL_ISET1) { > dev_err(...); > goto rest_dt_portion; > } else { > pdata->bl_pdata->isel = val; > } ok, this also requires the TPS65217_BL_ISETx enum to start at 1 > > + > > + if (!of_property_read_u32(np, "fdim", &val)) { > > + if (val == 100) { > > + pdata->bl_pdata->fdim = > > TPS65217_BL_FDIM_100HZ; > > + } else if (val == 200) { > > + pdata->bl_pdata->fdim = > > TPS65217_BL_FDIM_200HZ; > > + } else if (val == 500) { > > + pdata->bl_pdata->fdim = > > TPS65217_BL_FDIM_500HZ; > > + } else if (val == 1000) { > > + pdata->bl_pdata->fdim = > > TPS65217_BL_FDIM_1000HZ; > > + } else { > > + dev_err(&client->dev, "invalid value > > for backlight dimming frequency in the device tr
Re: [PATCH] backlight: Add TPS65217 WLED driver
Hi AnilKumar, El Wed, Aug 08, 2012 at 09:25:29AM + AnilKumar, Chimata ha dit: > Cross check with mfd/master also. ok > > > > + if (!of_property_read_u32(np, "fdim", &val)) { > > > > + if (val == 100) { > > > > + pdata->bl_pdata->fdim = > > > > TPS65217_BL_FDIM_100HZ; > > > > + } else if (val == 200) { > > > > + pdata->bl_pdata->fdim = > > > > TPS65217_BL_FDIM_200HZ; > > > > + } else if (val == 500) { > > > > + pdata->bl_pdata->fdim = > > > > TPS65217_BL_FDIM_500HZ; > > > > + } else if (val == 1000) { > > > > + pdata->bl_pdata->fdim = > > > > TPS65217_BL_FDIM_1000HZ; > > > > + } else { > > > > + dev_err(&client->dev, "invalid > > > > value for backlight dimming frequency in the device tree\n"); > > > > + return NULL; > > > > + } > > > > + } else { > > > > + pdata->bl_pdata->fdim = > > > > TPS65217_BL_FDIM_200HZ; > > > > + } > > > > + } > > > > + } > > > > > > Same here. > > > > not exactly, the value specified in the device tree for the dimming > > frequency will be a frequency, not a value corresponding to the enum, > > so a range check + assignment isn't enough. if you'd like to see a > > similar handling an option would be to set TPS65217_BL_FDIM_100HZ to > > 100, TPS..._200HZ to 200, ..., and do: > > > > switch (val) { > > case TPS65217_BL_FDIM_100HZ: > > case TPS65217_BL_FDIM_200HZ: > > ... > > pdata->bl_pdata->fdim = val; > > break; > > > > default: > > /* error handling */ > > } > > > > This looks better. taking a closer look i noticed that unfortunately it won't work that way, as the constants TPS65217_BL_FDIM_*HZ are the values which are written to the WLEDCTRL1 registers so the outcome will be: switch (val) { case 100: pdata->bl_pdata->fdim = TPS65217_BL_FDIM_100HZ; break; case 200: ... default: /* error handling */ } or the initial solution, which is slightly shorter, but i think you prefer the switch construct regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam Programming is not just an act of telling a computer what to do: it is also an act of telling other programmers what you wished the computer to do. Both are important, and the latter deserves care (Andrew Morton) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mfd: Fix allocation size of tps65217 platform data
tps65217_parse_dt() allocates a struct tps65217_board for each regulator specified in the device tree. the structure itself provides arrays for the pointers to the regulator init data and the regulator device tree node, so only one instance of it is needed This patch is based on the mfd tree Signed-off-by: Matthias Kaehlcke --- drivers/mfd/tps65217.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 61c097a..cf908ac 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -162,7 +162,7 @@ static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) return NULL; count = ret; - pdata = devm_kzalloc(&client->dev, count * sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) return NULL; -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] backlight: Add TPS65217 WLED driver
The TPS65217 chip contains a boost converter and current sinks which can be used to drive LEDs for use as backlights. Expose this functionality via the backlight API. Tested on an AM335x based custom board with a single WLED string, using different values for ISEL and FDIM (though it would be hard to tell the difference except for the value in WLEDCTRL1). Both instantiation through the device tree and by passing platform data have been tested. Testing has been done with an Androidized 3.2 kernel from the rowboat project This patch is based on the mfd tree, it also applies on linux-next (20120809) Changes since v1: * addressed review comments * moved device tree parsing to the backlight driver Signed-off-by: Matthias Kaehlcke --- drivers/mfd/tps65217.c| 32 +++ drivers/video/backlight/Kconfig |7 + drivers/video/backlight/Makefile |1 + drivers/video/backlight/tps65217_bl.c | 343 + include/linux/mfd/tps65217.h | 25 ++- 5 files changed, 407 insertions(+), 1 deletion(-) create mode 100644 drivers/video/backlight/tps65217_bl.c diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 61c097a..a79902d 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -174,6 +174,10 @@ static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) pdata->of_node[i] = reg_matches[i].of_node; } + node = of_find_node_by_name(node, "backlight"); + if (node) + pdata->of_node[TPS65217_SUBDEV_BL] = node; + return pdata; } @@ -250,7 +254,32 @@ static int __devinit tps65217_probe(struct i2c_client *client, platform_device_add(pdev); } + if (pdata->bl_pdata || pdata->of_node[TPS65217_SUBDEV_BL]) { + tps->bl_pdev = platform_device_alloc("tps65217-bl", 0); + if (!tps->bl_pdev) { + dev_err(tps->dev, "Cannot create backlight platform device\n"); + ret = -ENOMEM; + goto err_alloc_bl_pdev; + } + + tps->bl_pdev->dev.parent = tps->dev; + + if (pdata->bl_pdata) + tps->bl_pdev->dev.platform_data = pdata->bl_pdata; + else + tps->bl_pdev->dev.of_node = + pdata->of_node[TPS65217_SUBDEV_BL]; + + platform_device_add(tps->bl_pdev); + } + return 0; + +err_alloc_bl_pdev: + for (i = 0; i < TPS65217_NUM_REGULATOR; i++) + platform_device_unregister(tps->regulator_pdev[i]); + + return ret; } static int __devexit tps65217_remove(struct i2c_client *client) @@ -258,6 +287,9 @@ static int __devexit tps65217_remove(struct i2c_client *client) struct tps65217 *tps = i2c_get_clientdata(client); int i; + if (tps->bl_pdev) + platform_device_unregister(tps->bl_pdev); + for (i = 0; i < TPS65217_NUM_REGULATOR; i++) platform_device_unregister(tps->regulator_pdev[i]); diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index cf28276..e1884bb 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -373,6 +373,13 @@ config BACKLIGHT_PANDORA If you have a Pandora console, say Y to enable the backlight driver. +config BACKLIGHT_TPS65217 + tristate "Backlight driver for TI TPS65217 using WLED" + depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217 + help + If you have a Texas Instruments TPS65217 say Y to enable the + backlight driver. + endif # BACKLIGHT_CLASS_DEVICE endif # BACKLIGHT_LCD_SUPPORT diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index a2ac9cf..00223a6 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -43,3 +43,4 @@ obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o +obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c new file mode 100644 index 000..6c537bf --- /dev/null +++ b/drivers/video/backlight/tps65217_bl.c @@ -0,0 +1,343 @@ +/* + * tps65217_bl.c + * + * TPS65217 backlight driver + * + * Copyright (C) 2012 Matthias Kaehlcke + * Author: Matthias Kaehlcke + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether
Re: [PATCH] mfd/regulator: tps65217: Move regulator plat data handling to regulator
Hi, El Fri, Jul 20, 2012 at 03:00:01PM +0530 AnilKumar Ch ha dit: > Regulator platform data handling was mistakenly added to MFD > driver. So we will see build errors if we compile MFD drivers > without CONFIG_REGULATOR. This patch moves regulator platform > data handling from TPS65217 MFD driver to regulator driver. > > > diff --git a/drivers/regulator/tps65217-regulator.c > b/drivers/regulator/tps65217-regulator.c > index 6caa222..9730f1d 100644 > --- a/drivers/regulator/tps65217-regulator.c > +++ b/drivers/regulator/tps65217-regulator.c > > +static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) > +{ > + struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); > + struct device_node *node = tps->dev->of_node; > + struct tps65217_board *pdata; > + struct device_node *regs; > + int i, count; > + > + regs = of_find_node_by_name(node, "regulators"); > + if (!regs) > + return NULL; > + > + count = of_regulator_match(pdev->dev.parent, regs, > + reg_matches, TPS65217_NUM_REGULATOR); > + of_node_put(regs); > + if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) > + return NULL; > + > + pdata = devm_kzalloc(&pdev->dev, count * sizeof(*pdata), > GFP_KERNEL); this allocates a struct tps65217_board for each regulator specified in the device tree. the structure itself provides arrays for the pointers to the regulator init data and the regulator device tree node, so only one instance of it is needed also the tps65217_board structure should be renamed to something like tps65217_regulators, now that it is specific to the regulator driver. besides the regulators the tps65217 can have other subdevices, so for the non device tree use case it makes sense to keep a chip wide platform data structure around which contains the subdevice specific ones best regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam If you pay peanuts, you get monkeys (James Goldsmith) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mfd/regulator: tps65217: Move regulator plat data handling to regulator
Hi AnilKumar, El Mon, Aug 13, 2012 at 01:35:55PM + AnilKumar, Chimata ha dit: > > also the tps65217_board structure should be renamed to something like > > tps65217_regulators, now that it is specific to the regulator > > Not required because tps65217_board might contain platform data for WLED/ > Battery charger driver if require. So the struct was named as tps65217_board the patch moves the allocation of the structure to the regulator driver, so either it should be a subdevice specific structure or a chip specific one which is allocated in the mfd driver. otherwise the regulator driver will allocate memory which is never used when struct tps65217_board is extended for other subdevices. and the same would happen in the other subdevice drivers if they choose to allocate their own struct tps65217_board instead of a sub-structure with just the fields needed by the specific driver regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam Yo soy como soy y tú eres como eres, construyamos un mundo donde yo pueda ser sin dejar de ser yo, donde tú puedas ser sin dejar de ser tú, y donde ni yo ni tú obliguemos al otro a ser como yo o como tú .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3] backlight: Add TPS65217 WLED driver
The TPS65217 chip contains a boost converter and current sinks which can be used to drive LEDs for use as backlights. Expose this functionality via the backlight API. Tested on an AM335x based custom board with a single WLED string, using different values for ISEL and FDIM (though it would be hard to tell the difference except for the value in WLEDCTRL1). Both instantiation through the device tree and by passing platform data have been tested. Testing has been done with an Androidized 3.2 kernel from the rowboat project This patch is based on the mfd/for-next branch (20120822) Changes since v2: * adapted to the latest version of the tps65217 mfd driver * register backlight as mfd subdevice * allocate struct tps65217_bl after validation of the device tree/platform data Signed-off-by: Matthias Kaehlcke --- drivers/mfd/tps65217.c|3 + drivers/video/backlight/Kconfig |7 + drivers/video/backlight/Makefile |1 + drivers/video/backlight/tps65217_bl.c | 352 + include/linux/mfd/tps65217.h | 18 ++ 5 files changed, 381 insertions(+) create mode 100644 drivers/video/backlight/tps65217_bl.c diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 3bc2744..592059e 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -34,6 +34,9 @@ static struct mfd_cell tps65217s[] = { { .name = "tps65217-pmic", }, + { + .name = "tps65217-bl", + }, }; /** diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index cf28276..63cee2e 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -373,6 +373,13 @@ config BACKLIGHT_PANDORA If you have a Pandora console, say Y to enable the backlight driver. +config BACKLIGHT_TPS65217 + tristate "TPS65217 Backlight" + depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217 + help + If you have a Texas Instruments TPS65217 say Y to enable the + backlight driver. + endif # BACKLIGHT_CLASS_DEVICE endif # BACKLIGHT_LCD_SUPPORT diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index a2ac9cf..00223a6 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -43,3 +43,4 @@ obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o +obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c new file mode 100644 index 000..5842d5f --- /dev/null +++ b/drivers/video/backlight/tps65217_bl.c @@ -0,0 +1,352 @@ +/* + * tps65217_bl.c + * + * TPS65217 backlight driver + * + * Copyright (C) 2012 Matthias Kaehlcke + * Author: Matthias Kaehlcke + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +struct tps65217_bl { + struct tps65217 *tps; + struct device *dev; + struct backlight_device *bl; + int on; +}; + +static int tps65217_bl_enable(struct tps65217_bl *tps65217_bl) +{ + int rc; + + rc = tps65217_set_bits(tps65217_bl->tps, TPS65217_REG_WLEDCTRL1, + TPS65217_WLEDCTRL1_ISINK_ENABLE, + TPS65217_WLEDCTRL1_ISINK_ENABLE, TPS65217_PROTECT_NONE); + if (rc) { + dev_err(tps65217_bl->dev, + "failed to enable backlight: %d\n", rc); + return rc; + } + + tps65217_bl->on = 1; + + dev_dbg(tps65217_bl->dev, "backlight enabled\n"); + + return 0; +} + +static int tps65217_bl_disable(struct tps65217_bl *tps65217_bl) +{ + int rc; + + rc = tps65217_clear_bits(tps65217_bl->tps, + TPS65217_REG_WLEDCTRL1, + TPS65217_WLEDCTRL1_ISINK_ENABLE, + TPS65217_PROTECT_NONE); + if (rc) { + dev_err(tps65217_bl->dev, + "failed to disable backlight: %d\n", rc); + return rc; + } + + tps65217_bl->on = 0; + + dev_dbg(tps65217_bl->dev, "backlight disabled\n"); + + return 0; +} + +static int tps65217_bl_update_status(struct backlight_devic
Re: [PATCH v3] backlight: Add TPS65217 WLED driver
Hi AnilKumar, thanks for your comments El Thu, Aug 23, 2012 at 07:53:49AM + AnilKumar, Chimata ha dit: > This patch should divide into 2 patches, one patch meant for > MFD changes other for backlight. will do > > +struct tps65217_bl { > > + struct tps65217 *tps; > > + struct device *dev; > > + struct backlight_device *bl; > > + int on; > > Can you use Boolean here? Change the name as well, something > like bool is_enabled? ok > > + pdata->fdim = TPS65217_BL_FDIM_200HZ; > > Why 200 by default? it's the default value in the register after reset best regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam If you don't know where you are going, you will probably end up somewhere else (Laurence J. Peter) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] backlight: Add TPS65217 WLED driver
Hi Samuel, El Mon, Sep 17, 2012 at 01:09:36AM +0200 Samuel Ortiz ha dit: > On Thu, Aug 09, 2012 at 10:42:31PM +0200, Matthias Kaehlcke wrote: > > The TPS65217 chip contains a boost converter and current sinks which can be > > used to drive LEDs for use as backlights. Expose this functionality via the > > backlight API. > > > > Tested on an AM335x based custom board with a single WLED string, using > > different values for ISEL and FDIM (though it would be hard to tell the > > difference except for the value in WLEDCTRL1). Both instantiation through > > the > > device tree and by passing platform data have been tested. Testing has been > > done with an Androidized 3.2 kernel from the rowboat project > > > > This patch is based on the mfd tree, it also applies on linux-next > > (20120809) > It doesn't seem to apply to my for-next branch. i suppose your for-next branch evolved during the last month > Also, some comments: > > > @@ -174,6 +174,10 @@ static struct tps65217_board *tps65217_parse_dt(struct > > i2c_client *client) > > pdata->of_node[i] = reg_matches[i].of_node; > > } > > > > + node = of_find_node_by_name(node, "backlight"); > > + if (node) > > + pdata->of_node[TPS65217_SUBDEV_BL] = node; > > + > > return pdata; > > } > > > > @@ -250,7 +254,32 @@ static int __devinit tps65217_probe(struct i2c_client > > *client, > > platform_device_add(pdev); > > } > > > > + if (pdata->bl_pdata || pdata->of_node[TPS65217_SUBDEV_BL]) { > > + tps->bl_pdev = platform_device_alloc("tps65217-bl", 0); > > + if (!tps->bl_pdev) { > > + dev_err(tps->dev, "Cannot create backlight platform > > device\n"); > > + ret = -ENOMEM; > > + goto err_alloc_bl_pdev; > > + } > > + > > + tps->bl_pdev->dev.parent = tps->dev; > > + > > + if (pdata->bl_pdata) > > + tps->bl_pdev->dev.platform_data = pdata->bl_pdata; > > + else > > + tps->bl_pdev->dev.of_node = > > + pdata->of_node[TPS65217_SUBDEV_BL]; > > + > > + platform_device_add(tps->bl_pdev); > > + } > > + > The MFD API probably allows you to do exactly that by defining a specific cell > for bl. Could you please try to use this API or otherwise justify not using > it? you seem to have missed v3 of the patch which addresses this, it was sent on 22 Aug 2012 in the next days i'll submit v4, with changes based on the comments received for v3 best regards -- Matthias Kaehlcke Embedded Linux Developer Amsterdam Si deseas mantener tu libertad, debes estar preparado para defenderla (Richard Stallman) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/2] backlight: Add TPS65217 WLED driver
The TPS65217 chip contains a boost converter and current sinks which can be used to drive LEDs for use as backlights. Expose this functionality via the backlight API. Tested on an AM335x based custom board with a single WLED string, using different values for ISEL and FDIM (though it would be hard to tell the difference except for the value in WLEDCTRL1). Both instantiation through the device tree and by passing platform data have been tested. Testing has been done with an Androidized 3.2 kernel from the rowboat project. Koen Kooi reported the driver to be working on a Beaglebone board with LCD3 cape This patch is based on the mfd branch (20120924) Changes since v3: * split in two patches, one for the driver another for adding the mfd subdevice * renamed variable "on" to "is_enabled" and changed type to boolean Signed-off-by: Matthias Kaehlcke --- drivers/video/backlight/Kconfig |7 + drivers/video/backlight/Makefile |1 + drivers/video/backlight/tps65217_bl.c | 352 + include/linux/mfd/tps65217.h | 18 ++ 4 files changed, 378 insertions(+) create mode 100644 drivers/video/backlight/tps65217_bl.c diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index cf28276..63cee2e 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -373,6 +373,13 @@ config BACKLIGHT_PANDORA If you have a Pandora console, say Y to enable the backlight driver. +config BACKLIGHT_TPS65217 + tristate "TPS65217 Backlight" + depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217 + help + If you have a Texas Instruments TPS65217 say Y to enable the + backlight driver. + endif # BACKLIGHT_CLASS_DEVICE endif # BACKLIGHT_LCD_SUPPORT diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index a2ac9cf..00223a6 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -43,3 +43,4 @@ obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o +obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c new file mode 100644 index 000..29aae58 --- /dev/null +++ b/drivers/video/backlight/tps65217_bl.c @@ -0,0 +1,352 @@ +/* + * tps65217_bl.c + * + * TPS65217 backlight driver + * + * Copyright (C) 2012 Matthias Kaehlcke + * Author: Matthias Kaehlcke + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +struct tps65217_bl { + struct tps65217 *tps; + struct device *dev; + struct backlight_device *bl; + bool is_enabled; +}; + +static int tps65217_bl_enable(struct tps65217_bl *tps65217_bl) +{ + int rc; + + rc = tps65217_set_bits(tps65217_bl->tps, TPS65217_REG_WLEDCTRL1, + TPS65217_WLEDCTRL1_ISINK_ENABLE, + TPS65217_WLEDCTRL1_ISINK_ENABLE, TPS65217_PROTECT_NONE); + if (rc) { + dev_err(tps65217_bl->dev, + "failed to enable backlight: %d\n", rc); + return rc; + } + + tps65217_bl->is_enabled = true; + + dev_dbg(tps65217_bl->dev, "backlight enabled\n"); + + return 0; +} + +static int tps65217_bl_disable(struct tps65217_bl *tps65217_bl) +{ + int rc; + + rc = tps65217_clear_bits(tps65217_bl->tps, + TPS65217_REG_WLEDCTRL1, + TPS65217_WLEDCTRL1_ISINK_ENABLE, + TPS65217_PROTECT_NONE); + if (rc) { + dev_err(tps65217_bl->dev, + "failed to disable backlight: %d\n", rc); + return rc; + } + + tps65217_bl->is_enabled = false; + + dev_dbg(tps65217_bl->dev, "backlight disabled\n"); + + return 0; +} + +static int tps65217_bl_update_status(struct backlight_device *bl) +{ + struct tps65217_bl *tps65217_bl = bl_get_data(bl); + int rc; + int brightness = bl->props.brightness; + + if (bl->props.state & BL_CORE_SUSPENDED) + brightness = 0; + + if ((bl->props.power != FB_BLANK_UNBLANK) ||
[PATCH v4 2/2] mfd: Add backlight as subdevice to the tps65217
mfd: Add backlight as subdevice to the tps65217 Signed-off-by: Matthias Kaehlcke --- drivers/mfd/tps65217.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index a95e942..3fb32e6 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -34,6 +34,9 @@ static struct mfd_cell tps65217s[] = { { .name = "tps65217-pmic", }, + { + .name = "tps65217-bl", + }, }; /** -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html