Message ID | 20190725220215.460-1-paul@crapouillou.net (mailing list archive) |
---|---|
Headers | show |
Series | JZ4740 SoC cleanup | expand |
On Thu, Jul 25, 2019 at 06:02:13PM -0400, Paul Cercueil wrote: > The JZ4740 boards now use the iio-hwmon driver. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > Tested-by: Artur Rojek <contact@artur-rojek.eu> Acked-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/hwmon/Kconfig | 10 --- > drivers/hwmon/Makefile | 1 - > drivers/hwmon/jz4740-hwmon.c | 135 ----------------------------------- > 3 files changed, 146 deletions(-) > delete mode 100644 drivers/hwmon/jz4740-hwmon.c > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > index 650dd71f9724..2199ac1d0ba7 100644 > --- a/drivers/hwmon/Kconfig > +++ b/drivers/hwmon/Kconfig > @@ -660,16 +660,6 @@ config SENSORS_IT87 > This driver can also be built as a module. If so, the module > will be called it87. > > -config SENSORS_JZ4740 > - tristate "Ingenic JZ4740 SoC ADC driver" > - depends on MACH_JZ4740 && MFD_JZ4740_ADC > - help > - If you say yes here you get support for reading adc values from the ADCIN > - pin on Ingenic JZ4740 SoC based boards. > - > - This driver can also be built as a module. If so, the module will be > - called jz4740-hwmon. > - > config SENSORS_JC42 > tristate "JEDEC JC42.4 compliant memory module temperature sensors" > depends on I2C > diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile > index 8db472ea04f0..1e82e912a5c4 100644 > --- a/drivers/hwmon/Makefile > +++ b/drivers/hwmon/Makefile > @@ -85,7 +85,6 @@ obj-$(CONFIG_SENSORS_INA2XX) += ina2xx.o > obj-$(CONFIG_SENSORS_INA3221) += ina3221.o > obj-$(CONFIG_SENSORS_IT87) += it87.o > obj-$(CONFIG_SENSORS_JC42) += jc42.o > -obj-$(CONFIG_SENSORS_JZ4740) += jz4740-hwmon.o > obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o > obj-$(CONFIG_SENSORS_K10TEMP) += k10temp.o > obj-$(CONFIG_SENSORS_LINEAGE) += lineage-pem.o > diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c > deleted file mode 100644 > index bec5befd1d8b..000000000000 > --- a/drivers/hwmon/jz4740-hwmon.c > +++ /dev/null > @@ -1,135 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0-or-later > -/* > - * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> > - * JZ4740 SoC HWMON driver > - */ > - > -#include <linux/err.h> > -#include <linux/interrupt.h> > -#include <linux/kernel.h> > -#include <linux/module.h> > -#include <linux/mutex.h> > -#include <linux/platform_device.h> > -#include <linux/slab.h> > -#include <linux/io.h> > - > -#include <linux/completion.h> > -#include <linux/mfd/core.h> > - > -#include <linux/hwmon.h> > - > -struct jz4740_hwmon { > - void __iomem *base; > - int irq; > - const struct mfd_cell *cell; > - struct platform_device *pdev; > - struct completion read_completion; > - struct mutex lock; > -}; > - > -static irqreturn_t jz4740_hwmon_irq(int irq, void *data) > -{ > - struct jz4740_hwmon *hwmon = data; > - > - complete(&hwmon->read_completion); > - return IRQ_HANDLED; > -} > - > -static ssize_t in0_input_show(struct device *dev, > - struct device_attribute *dev_attr, char *buf) > -{ > - struct jz4740_hwmon *hwmon = dev_get_drvdata(dev); > - struct platform_device *pdev = hwmon->pdev; > - struct completion *completion = &hwmon->read_completion; > - long t; > - unsigned long val; > - int ret; > - > - mutex_lock(&hwmon->lock); > - > - reinit_completion(completion); > - > - enable_irq(hwmon->irq); > - hwmon->cell->enable(pdev); > - > - t = wait_for_completion_interruptible_timeout(completion, HZ); > - > - if (t > 0) { > - val = readw(hwmon->base) & 0xfff; > - val = (val * 3300) >> 12; > - ret = sprintf(buf, "%lu\n", val); > - } else { > - ret = t ? t : -ETIMEDOUT; > - } > - > - hwmon->cell->disable(pdev); > - disable_irq(hwmon->irq); > - > - mutex_unlock(&hwmon->lock); > - > - return ret; > -} > - > -static DEVICE_ATTR_RO(in0_input); > - > -static struct attribute *jz4740_attrs[] = { > - &dev_attr_in0_input.attr, > - NULL > -}; > - > -ATTRIBUTE_GROUPS(jz4740); > - > -static int jz4740_hwmon_probe(struct platform_device *pdev) > -{ > - int ret; > - struct device *dev = &pdev->dev; > - struct jz4740_hwmon *hwmon; > - struct device *hwmon_dev; > - > - hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); > - if (!hwmon) > - return -ENOMEM; > - > - hwmon->cell = mfd_get_cell(pdev); > - > - hwmon->irq = platform_get_irq(pdev, 0); > - if (hwmon->irq < 0) { > - dev_err(&pdev->dev, "Failed to get platform irq: %d\n", > - hwmon->irq); > - return hwmon->irq; > - } > - > - hwmon->base = devm_platform_ioremap_resource(pdev, 0); > - if (IS_ERR(hwmon->base)) > - return PTR_ERR(hwmon->base); > - > - hwmon->pdev = pdev; > - init_completion(&hwmon->read_completion); > - mutex_init(&hwmon->lock); > - > - ret = devm_request_irq(dev, hwmon->irq, jz4740_hwmon_irq, 0, > - pdev->name, hwmon); > - if (ret) { > - dev_err(&pdev->dev, "Failed to request irq: %d\n", ret); > - return ret; > - } > - disable_irq(hwmon->irq); > - > - hwmon_dev = devm_hwmon_device_register_with_groups(dev, "jz4740", hwmon, > - jz4740_groups); > - return PTR_ERR_OR_ZERO(hwmon_dev); > -} > - > -static struct platform_driver jz4740_hwmon_driver = { > - .probe = jz4740_hwmon_probe, > - .driver = { > - .name = "jz4740-hwmon", > - }, > -}; > - > -module_platform_driver(jz4740_hwmon_driver); > - > -MODULE_DESCRIPTION("JZ4740 SoC HWMON driver"); > -MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); > -MODULE_LICENSE("GPL"); > -MODULE_ALIAS("platform:jz4740-hwmon"); > -- > 2.21.0.593.g511ec345e18 >
On Thu, Jul 25, 2019 at 06:02:08PM -0400, Paul Cercueil wrote: > The board now uses the simple-audio-card driver. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > Tested-by: Artur Rojek <contact@artur-rojek.eu> Acked-by: Mark Brown <broonie@kernel.org>
Hi Paul. On Thu, Jul 25, 2019 at 06:02:04PM -0400, Paul Cercueil wrote: > Hi, > > This patchset converts the Qi LB60 MIPS board to devicetree and makes it > use all the shiny new drivers that have been developed or updated > recently. > > All the crappy old drivers and custom code can be dropped since they > have been replaced by better alternatives. The overall diffstat is missing. Just for curiosity it would be nice to see what was dropped with this patch. Sam
Hi Paul, Paul Cercueil <paul@crapouillou.net> wrote on Thu, 25 Jul 2019 18:02:11 -0400: > It has been replaced with the newer Ingenic NAND driver. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > Tested-by: Artur Rojek <contact@artur-rojek.eu> > --- Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Thanks, Miquèl
Le ven. 26 juil. 2019 à 14:46, Sam Ravnborg <sam@ravnborg.org> a écrit : > Hi Paul. > > On Thu, Jul 25, 2019 at 06:02:04PM -0400, Paul Cercueil wrote: >> Hi, >> >> This patchset converts the Qi LB60 MIPS board to devicetree and >> makes it >> use all the shiny new drivers that have been developed or updated >> recently. >> >> All the crappy old drivers and custom code can be dropped since they >> have been replaced by better alternatives. > > The overall diffstat is missing. > Just for curiosity it would be nice to see what was dropped with this > patch. > > Sam Diffstat: arch/mips/boot/dts/ingenic/jz4740.dtsi | 84 ++++++++++++ arch/mips/boot/dts/ingenic/qi_lb60.dts | 295 ++++++++++++++++++++++++++++++++++++++++- arch/mips/configs/qi_lb60_defconfig | 44 +++--- arch/mips/include/asm/mach-jz4740/gpio.h | 15 --- arch/mips/include/asm/mach-jz4740/jz4740_fb.h | 58 -------- arch/mips/include/asm/mach-jz4740/jz4740_mmc.h | 12 -- arch/mips/include/asm/mach-jz4740/platform.h | 26 ---- arch/mips/jz4740/Makefile | 7 +- arch/mips/jz4740/board-qi_lb60.c | 491 ------------------------------------------------------------------- arch/mips/jz4740/platform.c | 250 ----------------------------------- arch/mips/jz4740/prom.c | 5 - arch/mips/jz4740/setup.c | 3 +- drivers/dma/Kconfig | 6 - drivers/dma/Makefile | 1 - drivers/dma/dma-jz4740.c | 623 ------------------------------------------------------------------------------------- drivers/hwmon/Kconfig | 10 -- drivers/hwmon/Makefile | 1 - drivers/hwmon/jz4740-hwmon.c | 135 ------------------- drivers/mfd/Kconfig | 9 -- drivers/mfd/Makefile | 1 - drivers/mfd/jz4740-adc.c | 324 --------------------------------------------- drivers/mtd/nand/raw/ingenic/Kconfig | 7 - drivers/mtd/nand/raw/ingenic/Makefile | 1 - drivers/mtd/nand/raw/ingenic/jz4740_nand.c | 536 -------------------------------------------------------------------------- drivers/power/supply/Kconfig | 11 -- drivers/power/supply/Makefile | 1 - drivers/power/supply/jz4740-battery.c | 421 ---------------------------------------------------------- drivers/video/fbdev/Kconfig | 9 -- drivers/video/fbdev/Makefile | 1 - drivers/video/fbdev/jz4740_fb.c | 690 ----------------------------------------------------------------------------------------------- sound/soc/jz4740/Kconfig | 25 +--- sound/soc/jz4740/Makefile | 5 - sound/soc/jz4740/qi_lb60.c | 106 --------------- 33 files changed, 404 insertions(+), 3809 deletions(-)
On 25-07-19, 18:02, Paul Cercueil wrote: > The newer and better JZ4780 driver is now used to provide DMA > functionality on the JZ4740. Please change subjetc to dmaengine: xxx After that Acked-by: Vinod Koul <vkoul@kernel.org>
Hi, On Thu, Jul 25, 2019 at 06:02:12PM -0400, Paul Cercueil wrote: > It has been replaced with the more mature ingenic-battery driver. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > Tested-by: Artur Rojek <contact@artur-rojek.eu> > --- Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> -- Sebastian > drivers/power/supply/Kconfig | 11 - > drivers/power/supply/Makefile | 1 - > drivers/power/supply/jz4740-battery.c | 421 -------------------------- > 3 files changed, 433 deletions(-) > delete mode 100644 drivers/power/supply/jz4740-battery.c > > diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig > index 5d91b5160b41..6ba602ed7979 100644 > --- a/drivers/power/supply/Kconfig > +++ b/drivers/power/supply/Kconfig > @@ -417,17 +417,6 @@ config CHARGER_PCF50633 > help > Say Y to include support for NXP PCF50633 Main Battery Charger. > > -config BATTERY_JZ4740 > - tristate "Ingenic JZ4740 battery" > - depends on MACH_JZ4740 > - depends on MFD_JZ4740_ADC > - help > - Say Y to enable support for the battery on Ingenic JZ4740 based > - boards. > - > - This driver can be build as a module. If so, the module will be > - called jz4740-battery. > - > config BATTERY_RX51 > tristate "Nokia RX-51 (N900) battery driver" > depends on TWL4030_MADC > diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile > index 96c2b74b36bf..6c7da920ea83 100644 > --- a/drivers/power/supply/Makefile > +++ b/drivers/power/supply/Makefile > @@ -58,7 +58,6 @@ obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o > obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o > obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o > obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o > -obj-$(CONFIG_BATTERY_JZ4740) += jz4740-battery.o > obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o > obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o abx500_chargalg.o pm2301_charger.o > obj-$(CONFIG_CHARGER_CPCAP) += cpcap-charger.o > diff --git a/drivers/power/supply/jz4740-battery.c b/drivers/power/supply/jz4740-battery.c > deleted file mode 100644 > index 6366bd61ea9f..000000000000 > --- a/drivers/power/supply/jz4740-battery.c > +++ /dev/null > @@ -1,421 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0-only > -/* > - * Battery measurement code for Ingenic JZ SOC. > - * > - * Copyright (C) 2009 Jiejing Zhang <kzjeef@gmail.com> > - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> > - * > - * based on tosa_battery.c > - * > - * Copyright (C) 2008 Marek Vasut <marek.vasut@gmail.com> > - */ > - > -#include <linux/interrupt.h> > -#include <linux/kernel.h> > -#include <linux/module.h> > -#include <linux/platform_device.h> > -#include <linux/slab.h> > -#include <linux/io.h> > - > -#include <linux/delay.h> > -#include <linux/err.h> > -#include <linux/gpio.h> > -#include <linux/mfd/core.h> > -#include <linux/power_supply.h> > - > -#include <linux/power/jz4740-battery.h> > -#include <linux/jz4740-adc.h> > - > -struct jz_battery { > - struct jz_battery_platform_data *pdata; > - struct platform_device *pdev; > - > - void __iomem *base; > - > - int irq; > - int charge_irq; > - > - const struct mfd_cell *cell; > - > - int status; > - long voltage; > - > - struct completion read_completion; > - > - struct power_supply *battery; > - struct power_supply_desc battery_desc; > - struct delayed_work work; > - > - struct mutex lock; > -}; > - > -static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) > -{ > - return power_supply_get_drvdata(psy); > -} > - > -static irqreturn_t jz_battery_irq_handler(int irq, void *devid) > -{ > - struct jz_battery *battery = devid; > - > - complete(&battery->read_completion); > - return IRQ_HANDLED; > -} > - > -static long jz_battery_read_voltage(struct jz_battery *battery) > -{ > - long t; > - unsigned long val; > - long voltage; > - > - mutex_lock(&battery->lock); > - > - reinit_completion(&battery->read_completion); > - > - enable_irq(battery->irq); > - battery->cell->enable(battery->pdev); > - > - t = wait_for_completion_interruptible_timeout(&battery->read_completion, > - HZ); > - > - if (t > 0) { > - val = readw(battery->base) & 0xfff; > - > - if (battery->pdata->info.voltage_max_design <= 2500000) > - val = (val * 78125UL) >> 7UL; > - else > - val = ((val * 924375UL) >> 9UL) + 33000; > - voltage = (long)val; > - } else { > - voltage = t ? t : -ETIMEDOUT; > - } > - > - battery->cell->disable(battery->pdev); > - disable_irq(battery->irq); > - > - mutex_unlock(&battery->lock); > - > - return voltage; > -} > - > -static int jz_battery_get_capacity(struct power_supply *psy) > -{ > - struct jz_battery *jz_battery = psy_to_jz_battery(psy); > - struct power_supply_info *info = &jz_battery->pdata->info; > - long voltage; > - int ret; > - int voltage_span; > - > - voltage = jz_battery_read_voltage(jz_battery); > - > - if (voltage < 0) > - return voltage; > - > - voltage_span = info->voltage_max_design - info->voltage_min_design; > - ret = ((voltage - info->voltage_min_design) * 100) / voltage_span; > - > - if (ret > 100) > - ret = 100; > - else if (ret < 0) > - ret = 0; > - > - return ret; > -} > - > -static int jz_battery_get_property(struct power_supply *psy, > - enum power_supply_property psp, union power_supply_propval *val) > -{ > - struct jz_battery *jz_battery = psy_to_jz_battery(psy); > - struct power_supply_info *info = &jz_battery->pdata->info; > - long voltage; > - > - switch (psp) { > - case POWER_SUPPLY_PROP_STATUS: > - val->intval = jz_battery->status; > - break; > - case POWER_SUPPLY_PROP_TECHNOLOGY: > - val->intval = jz_battery->pdata->info.technology; > - break; > - case POWER_SUPPLY_PROP_HEALTH: > - voltage = jz_battery_read_voltage(jz_battery); > - if (voltage < info->voltage_min_design) > - val->intval = POWER_SUPPLY_HEALTH_DEAD; > - else > - val->intval = POWER_SUPPLY_HEALTH_GOOD; > - break; > - case POWER_SUPPLY_PROP_CAPACITY: > - val->intval = jz_battery_get_capacity(psy); > - break; > - case POWER_SUPPLY_PROP_VOLTAGE_NOW: > - val->intval = jz_battery_read_voltage(jz_battery); > - if (val->intval < 0) > - return val->intval; > - break; > - case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: > - val->intval = info->voltage_max_design; > - break; > - case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: > - val->intval = info->voltage_min_design; > - break; > - case POWER_SUPPLY_PROP_PRESENT: > - val->intval = 1; > - break; > - default: > - return -EINVAL; > - } > - return 0; > -} > - > -static void jz_battery_external_power_changed(struct power_supply *psy) > -{ > - struct jz_battery *jz_battery = psy_to_jz_battery(psy); > - > - mod_delayed_work(system_wq, &jz_battery->work, 0); > -} > - > -static irqreturn_t jz_battery_charge_irq(int irq, void *data) > -{ > - struct jz_battery *jz_battery = data; > - > - mod_delayed_work(system_wq, &jz_battery->work, 0); > - > - return IRQ_HANDLED; > -} > - > -static void jz_battery_update(struct jz_battery *jz_battery) > -{ > - int status; > - long voltage; > - bool has_changed = false; > - int is_charging; > - > - if (gpio_is_valid(jz_battery->pdata->gpio_charge)) { > - is_charging = gpio_get_value(jz_battery->pdata->gpio_charge); > - is_charging ^= jz_battery->pdata->gpio_charge_active_low; > - if (is_charging) > - status = POWER_SUPPLY_STATUS_CHARGING; > - else > - status = POWER_SUPPLY_STATUS_NOT_CHARGING; > - > - if (status != jz_battery->status) { > - jz_battery->status = status; > - has_changed = true; > - } > - } > - > - voltage = jz_battery_read_voltage(jz_battery); > - if (voltage >= 0 && abs(voltage - jz_battery->voltage) > 50000) { > - jz_battery->voltage = voltage; > - has_changed = true; > - } > - > - if (has_changed) > - power_supply_changed(jz_battery->battery); > -} > - > -static enum power_supply_property jz_battery_properties[] = { > - POWER_SUPPLY_PROP_STATUS, > - POWER_SUPPLY_PROP_TECHNOLOGY, > - POWER_SUPPLY_PROP_HEALTH, > - POWER_SUPPLY_PROP_CAPACITY, > - POWER_SUPPLY_PROP_VOLTAGE_NOW, > - POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, > - POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, > - POWER_SUPPLY_PROP_PRESENT, > -}; > - > -static void jz_battery_work(struct work_struct *work) > -{ > - /* Too small interval will increase system workload */ > - const int interval = HZ * 30; > - struct jz_battery *jz_battery = container_of(work, struct jz_battery, > - work.work); > - > - jz_battery_update(jz_battery); > - schedule_delayed_work(&jz_battery->work, interval); > -} > - > -static int jz_battery_probe(struct platform_device *pdev) > -{ > - int ret = 0; > - struct jz_battery_platform_data *pdata = pdev->dev.parent->platform_data; > - struct power_supply_config psy_cfg = {}; > - struct jz_battery *jz_battery; > - struct power_supply_desc *battery_desc; > - struct resource *mem; > - > - if (!pdata) { > - dev_err(&pdev->dev, "No platform_data supplied\n"); > - return -ENXIO; > - } > - > - jz_battery = devm_kzalloc(&pdev->dev, sizeof(*jz_battery), GFP_KERNEL); > - if (!jz_battery) { > - dev_err(&pdev->dev, "Failed to allocate driver structure\n"); > - return -ENOMEM; > - } > - > - jz_battery->cell = mfd_get_cell(pdev); > - > - jz_battery->irq = platform_get_irq(pdev, 0); > - if (jz_battery->irq < 0) { > - dev_err(&pdev->dev, "Failed to get platform irq: %d\n", ret); > - return jz_battery->irq; > - } > - > - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - > - jz_battery->base = devm_ioremap_resource(&pdev->dev, mem); > - if (IS_ERR(jz_battery->base)) > - return PTR_ERR(jz_battery->base); > - > - battery_desc = &jz_battery->battery_desc; > - battery_desc->name = pdata->info.name; > - battery_desc->type = POWER_SUPPLY_TYPE_BATTERY; > - battery_desc->properties = jz_battery_properties; > - battery_desc->num_properties = ARRAY_SIZE(jz_battery_properties); > - battery_desc->get_property = jz_battery_get_property; > - battery_desc->external_power_changed = > - jz_battery_external_power_changed; > - battery_desc->use_for_apm = 1; > - > - psy_cfg.drv_data = jz_battery; > - > - jz_battery->pdata = pdata; > - jz_battery->pdev = pdev; > - > - init_completion(&jz_battery->read_completion); > - mutex_init(&jz_battery->lock); > - > - INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); > - > - ret = request_irq(jz_battery->irq, jz_battery_irq_handler, 0, pdev->name, > - jz_battery); > - if (ret) { > - dev_err(&pdev->dev, "Failed to request irq %d\n", ret); > - return ret; > - } > - disable_irq(jz_battery->irq); > - > - if (gpio_is_valid(pdata->gpio_charge)) { > - ret = gpio_request(pdata->gpio_charge, dev_name(&pdev->dev)); > - if (ret) { > - dev_err(&pdev->dev, "charger state gpio request failed.\n"); > - goto err_free_irq; > - } > - ret = gpio_direction_input(pdata->gpio_charge); > - if (ret) { > - dev_err(&pdev->dev, "charger state gpio set direction failed.\n"); > - goto err_free_gpio; > - } > - > - jz_battery->charge_irq = gpio_to_irq(pdata->gpio_charge); > - > - if (jz_battery->charge_irq >= 0) { > - ret = request_irq(jz_battery->charge_irq, > - jz_battery_charge_irq, > - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, > - dev_name(&pdev->dev), jz_battery); > - if (ret) { > - dev_err(&pdev->dev, "Failed to request charge irq: %d\n", ret); > - goto err_free_gpio; > - } > - } > - } else { > - jz_battery->charge_irq = -1; > - } > - > - if (jz_battery->pdata->info.voltage_max_design <= 2500000) > - jz4740_adc_set_config(pdev->dev.parent, JZ_ADC_CONFIG_BAT_MB, > - JZ_ADC_CONFIG_BAT_MB); > - else > - jz4740_adc_set_config(pdev->dev.parent, JZ_ADC_CONFIG_BAT_MB, 0); > - > - jz_battery->battery = power_supply_register(&pdev->dev, battery_desc, > - &psy_cfg); > - if (IS_ERR(jz_battery->battery)) { > - dev_err(&pdev->dev, "power supply battery register failed.\n"); > - ret = PTR_ERR(jz_battery->battery); > - goto err_free_charge_irq; > - } > - > - platform_set_drvdata(pdev, jz_battery); > - schedule_delayed_work(&jz_battery->work, 0); > - > - return 0; > - > -err_free_charge_irq: > - if (jz_battery->charge_irq >= 0) > - free_irq(jz_battery->charge_irq, jz_battery); > -err_free_gpio: > - if (gpio_is_valid(pdata->gpio_charge)) > - gpio_free(jz_battery->pdata->gpio_charge); > -err_free_irq: > - free_irq(jz_battery->irq, jz_battery); > - return ret; > -} > - > -static int jz_battery_remove(struct platform_device *pdev) > -{ > - struct jz_battery *jz_battery = platform_get_drvdata(pdev); > - > - cancel_delayed_work_sync(&jz_battery->work); > - > - if (gpio_is_valid(jz_battery->pdata->gpio_charge)) { > - if (jz_battery->charge_irq >= 0) > - free_irq(jz_battery->charge_irq, jz_battery); > - gpio_free(jz_battery->pdata->gpio_charge); > - } > - > - power_supply_unregister(jz_battery->battery); > - > - free_irq(jz_battery->irq, jz_battery); > - > - return 0; > -} > - > -#ifdef CONFIG_PM > -static int jz_battery_suspend(struct device *dev) > -{ > - struct jz_battery *jz_battery = dev_get_drvdata(dev); > - > - cancel_delayed_work_sync(&jz_battery->work); > - jz_battery->status = POWER_SUPPLY_STATUS_UNKNOWN; > - > - return 0; > -} > - > -static int jz_battery_resume(struct device *dev) > -{ > - struct jz_battery *jz_battery = dev_get_drvdata(dev); > - > - schedule_delayed_work(&jz_battery->work, 0); > - > - return 0; > -} > - > -static const struct dev_pm_ops jz_battery_pm_ops = { > - .suspend = jz_battery_suspend, > - .resume = jz_battery_resume, > -}; > - > -#define JZ_BATTERY_PM_OPS (&jz_battery_pm_ops) > -#else > -#define JZ_BATTERY_PM_OPS NULL > -#endif > - > -static struct platform_driver jz_battery_driver = { > - .probe = jz_battery_probe, > - .remove = jz_battery_remove, > - .driver = { > - .name = "jz4740-battery", > - .pm = JZ_BATTERY_PM_OPS, > - }, > -}; > - > -module_platform_driver(jz_battery_driver); > - > -MODULE_ALIAS("platform:jz4740-battery"); > -MODULE_LICENSE("GPL"); > -MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); > -MODULE_DESCRIPTION("JZ4740 SoC battery driver"); > -- > 2.21.0.593.g511ec345e18 >
On Fri, Jul 26, 2019 at 12:02 AM Paul Cercueil <paul@crapouillou.net> wrote: > > Hi, > > This patchset converts the Qi LB60 MIPS board to devicetree and makes it > use all the shiny new drivers that have been developed or updated > recently. > > All the crappy old drivers and custom code can be dropped since they > have been replaced by better alternatives. > > Some of these alternatives are not yet in 5.3-rc1 but have already been > accepted by their respective maintainer for inclusion in 5.4-rc1. > > To upstream this patchset, I think that as soon as MIPS maintainers > agree to take patches 01-03/11 and 11/11, the other patches can go > through their respective maintainer's tree. Was this series tested with the Ben Nanonote device? I have one of these and from time to time I upgrade the kernel on it.
Hi Richard, Le lun. 29 juil. 2019 à 7:23, Richard Weinberger <richard.weinberger@gmail.com> a écrit : > On Fri, Jul 26, 2019 at 12:02 AM Paul Cercueil <paul@crapouillou.net> > wrote: >> >> Hi, >> >> This patchset converts the Qi LB60 MIPS board to devicetree and >> makes it >> use all the shiny new drivers that have been developed or updated >> recently. >> >> All the crappy old drivers and custom code can be dropped since they >> have been replaced by better alternatives. >> >> Some of these alternatives are not yet in 5.3-rc1 but have already >> been >> accepted by their respective maintainer for inclusion in 5.4-rc1. >> >> To upstream this patchset, I think that as soon as MIPS maintainers >> agree to take patches 01-03/11 and 11/11, the other patches can go >> through their respective maintainer's tree. > > Was this series tested with the Ben Nanonote device? > I have one of these and from time to time I upgrade the kernel on it. Yes! Artur (Cc'd) tested it. You can test it yourself, after merging this patchset with: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git branch next, git://git.freedesktop.org/git/drm-misc branch drm-misc-next. These will be in 5.4-rc1. Cheers, -Paul
----- Ursprüngliche Mail ----- >> Was this series tested with the Ben Nanonote device? >> I have one of these and from time to time I upgrade the kernel on it. > > Yes! Artur (Cc'd) tested it. > > You can test it yourself, after merging this patchset with: > https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git > branch next, > git://git.freedesktop.org/git/drm-misc branch drm-misc-next. > > These will be in 5.4-rc1. Awesome! Thanks a lot for cleaning this up. Thanks, //richard
On Thu, 25 Jul 2019, Paul Cercueil wrote: > It has been replaced with the ingenic-iio driver for the ADC. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > Tested-by: Artur Rojek <contact@artur-rojek.eu> > --- > drivers/mfd/Kconfig | 9 -- > drivers/mfd/Makefile | 1 - > drivers/mfd/jz4740-adc.c | 324 --------------------------------------- > 3 files changed, 334 deletions(-) > delete mode 100644 drivers/mfd/jz4740-adc.c Applied, thanks.
Hi Lee, On 8/12/19 10:16 AM, Lee Jones wrote: > On Thu, 25 Jul 2019, Paul Cercueil wrote: > >> It has been replaced with the ingenic-iio driver for the ADC. >> >> Signed-off-by: Paul Cercueil <paul@crapouillou.net> >> Tested-by: Artur Rojek <contact@artur-rojek.eu> >> --- >> drivers/mfd/Kconfig | 9 -- >> drivers/mfd/Makefile | 1 - >> drivers/mfd/jz4740-adc.c | 324 --------------------------------------- >> 3 files changed, 334 deletions(-) >> delete mode 100644 drivers/mfd/jz4740-adc.c > > Applied, thanks. It seems the replacement is done in "MIPS: qi_lb60: Migrate to devicetree" which is not yet merged. Probably easier if this patch goes thru the MIPS tree as part of the "JZ4740 SoC cleanup" series. Regards, Phil.
Hi Philippe, Le mar. 13 août 2019 à 10:44, Philippe =?iso-8859-1?q?Mathieu-Daud=E9?= <f4bug@amsat.org> a écrit : > Hi Lee, > > On 8/12/19 10:16 AM, Lee Jones wrote: >> On Thu, 25 Jul 2019, Paul Cercueil wrote: >> >>> It has been replaced with the ingenic-iio driver for the ADC. >>> >>> Signed-off-by: Paul Cercueil <paul@crapouillou.net> >>> Tested-by: Artur Rojek <contact@artur-rojek.eu> >>> --- >>> drivers/mfd/Kconfig | 9 -- >>> drivers/mfd/Makefile | 1 - >>> drivers/mfd/jz4740-adc.c | 324 >>> --------------------------------------- >>> 3 files changed, 334 deletions(-) >>> delete mode 100644 drivers/mfd/jz4740-adc.c >> >> Applied, thanks. > > It seems the replacement is done in "MIPS: qi_lb60: Migrate to > devicetree" which is not yet merged. It's merged in the MIPS tree, though, so it'll blend together just fine in linux-next. > > Probably easier if this patch goes thru the MIPS tree as part of the > "JZ4740 SoC cleanup" series. > > Regards, > > Phil.
On Tue, 13 Aug 2019, Paul Cercueil wrote: > Hi Philippe, > > > Le mar. 13 août 2019 à 10:44, Philippe =?iso-8859-1?q?Mathieu-Daud=E9?= > <f4bug@amsat.org> a écrit : > > Hi Lee, > > > > On 8/12/19 10:16 AM, Lee Jones wrote: > > > On Thu, 25 Jul 2019, Paul Cercueil wrote: > > > > > > > It has been replaced with the ingenic-iio driver for the ADC. > > > > > > > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > > > > Tested-by: Artur Rojek <contact@artur-rojek.eu> > > > > --- > > > > drivers/mfd/Kconfig | 9 -- > > > > drivers/mfd/Makefile | 1 - > > > > drivers/mfd/jz4740-adc.c | 324 > > > > --------------------------------------- > > > > 3 files changed, 334 deletions(-) > > > > delete mode 100644 drivers/mfd/jz4740-adc.c > > > > > > Applied, thanks. > > > > It seems the replacement is done in "MIPS: qi_lb60: Migrate to > > devicetree" which is not yet merged. > > It's merged in the MIPS tree, though, so it'll blend together just > fine in linux-next. Wonderful. Thanks Paul.