Re: [PATCH v3] thermal: Add QPNP PMIC temperature alarm driver

From: Ivan T. Ivanov
Date: Wed Oct 29 2014 - 11:32:48 EST



Hi Eduardo,

On Mon, 2014-10-27 at 16:16 -0400, Eduardo Valentin wrote:
> Hello Ivan
>
>


<snip>

> >
> > +
> > +static int qpnp_tz_set_mode(struct thermal_zone_device *thermal,
> > + enum thermal_device_mode mode)
> > +{
> > + struct qpnp_tm_chip *chip = thermal->devdata;
> > + int ret;
> > +
> > + if (mode == chip->mode)
> > + return 0;
> > +
> > + if (mode == THERMAL_DEVICE_ENABLED)
> > + ret = qpnp_tm_shutdown_override(chip, true);
> > + else
> > + ret = qpnp_tm_shutdown_override(chip, false);
>
>
> Can you please elaborate a little more why you need to switch these when
> mode changes?

My understanding is that PMIC hardware have predefined shutdown sequence in case
of overheat. In non override mode, hardware itself will take care for shunting
down PMIC, which directly will shutdown also and main CPU's, while when override
is enabled software running on main CPU's, will take care for system shutdown.

>
> > +
> > + chip->mode = mode;
> > +
> > + return ret;
> > +}
> > +
> >

<snip>

> > +
> > +static int qpnp_tm_probe(struct platform_device *pdev)
> > +{
> > + struct qpnp_tm_chip *chip;
> > + struct device_node *node;
> > + u8 type, subtype;
> > + int ret, irq, res[2];
> > +
> >

<snip>

> > +
> > + chip->tz_dev = thermal_zone_device_register(node->name, TRIP_NUM, 0,
> > + chip, &qpnp_tz_ops, NULL,
>
> Have you considered using of-thermal instead of doing your own specific thermal
> zone registration? Having a glance look in this driver, most of the
> operation are covered by of-thermal. Ahy concerns using of-thermal in
> your case?
>

I just followed implementation found in "armada_thermal", "db8500-thermal",
"dove_thermal", "imx_thermal", "kirkwood_thermal"...

Will look at of-thermal.

Thank you,
Ivan


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/