Re: [PATCH v3 10/15] thermal/drivers/tsens: Drop single-cell code for msm8976/msm8956

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Dec 2022 at 12:24, Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> wrote:
>
> On 20.12.2022 03:47, Dmitry Baryshkov wrote:
> > There is no dtsi file for msm8976 in the kernel sources.
> This is not true :/
>
> But it has just been merged, if we get there fast, we can get
> this patch going *and* convert the node to use fuses..
> Unless breaking a platform that's only in linux-next would be
> an issue.. Maybe we could prettyplease ask Bjorn to send a
> -fixes pull with a "remove tsens node from 8976" commit?
> Not sure if it's too late or not...

Ugh. It's a pity that I missed the dtsi. Bjorn, Angelo, Marijn, any thoughts?

> Konrad
> Drop the
> > compatibility with unofficial dtsi and remove support for handling the
> > single-cell calibration data on msm8976.
> >
> > Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
> > ---
> >  drivers/thermal/qcom/tsens-v1.c | 126 +-------------------------------
> >  1 file changed, 2 insertions(+), 124 deletions(-)
> >
> > diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
> > index 89955522041d..9151c1043a11 100644
> > --- a/drivers/thermal/qcom/tsens-v1.c
> > +++ b/drivers/thermal/qcom/tsens-v1.c
> > @@ -21,63 +21,6 @@
> >  #define TM_HIGH_LOW_INT_STATUS_OFF           0x0088
> >  #define TM_HIGH_LOW_Sn_INT_THRESHOLD_OFF     0x0090
> >
> > -/* eeprom layout data for msm8956/76 (v1) */
> > -#define MSM8976_BASE0_MASK   0xff
> > -#define MSM8976_BASE1_MASK   0xff
> > -#define MSM8976_BASE1_SHIFT  8
> > -
> > -#define MSM8976_S0_P1_MASK   0x3f00
> > -#define MSM8976_S1_P1_MASK   0x3f00000
> > -#define MSM8976_S2_P1_MASK   0x3f
> > -#define MSM8976_S3_P1_MASK   0x3f000
> > -#define MSM8976_S4_P1_MASK   0x3f00
> > -#define MSM8976_S5_P1_MASK   0x3f00000
> > -#define MSM8976_S6_P1_MASK   0x3f
> > -#define MSM8976_S7_P1_MASK   0x3f000
> > -#define MSM8976_S8_P1_MASK   0x1f8
> > -#define MSM8976_S9_P1_MASK   0x1f8000
> > -#define MSM8976_S10_P1_MASK  0xf8000000
> > -#define MSM8976_S10_P1_MASK_1        0x1
> > -
> > -#define MSM8976_S0_P2_MASK   0xfc000
> > -#define MSM8976_S1_P2_MASK   0xfc000000
> > -#define MSM8976_S2_P2_MASK   0xfc0
> > -#define MSM8976_S3_P2_MASK   0xfc0000
> > -#define MSM8976_S4_P2_MASK   0xfc000
> > -#define MSM8976_S5_P2_MASK   0xfc000000
> > -#define MSM8976_S6_P2_MASK   0xfc0
> > -#define MSM8976_S7_P2_MASK   0xfc0000
> > -#define MSM8976_S8_P2_MASK   0x7e00
> > -#define MSM8976_S9_P2_MASK   0x7e00000
> > -#define MSM8976_S10_P2_MASK  0x7e
> > -
> > -#define MSM8976_S0_P1_SHIFT  8
> > -#define MSM8976_S1_P1_SHIFT  20
> > -#define MSM8976_S2_P1_SHIFT  0
> > -#define MSM8976_S3_P1_SHIFT  12
> > -#define MSM8976_S4_P1_SHIFT  8
> > -#define MSM8976_S5_P1_SHIFT  20
> > -#define MSM8976_S6_P1_SHIFT  0
> > -#define MSM8976_S7_P1_SHIFT  12
> > -#define MSM8976_S8_P1_SHIFT  3
> > -#define MSM8976_S9_P1_SHIFT  15
> > -#define MSM8976_S10_P1_SHIFT 27
> > -#define MSM8976_S10_P1_SHIFT_1       0
> > -
> > -#define MSM8976_S0_P2_SHIFT  14
> > -#define MSM8976_S1_P2_SHIFT  26
> > -#define MSM8976_S2_P2_SHIFT  6
> > -#define MSM8976_S3_P2_SHIFT  18
> > -#define MSM8976_S4_P2_SHIFT  14
> > -#define MSM8976_S5_P2_SHIFT  26
> > -#define MSM8976_S6_P2_SHIFT  6
> > -#define MSM8976_S7_P2_SHIFT  18
> > -#define MSM8976_S8_P2_SHIFT  9
> > -#define MSM8976_S9_P2_SHIFT  21
> > -#define MSM8976_S10_P2_SHIFT 1
> > -
> > -#define MSM8976_CAL_SEL_MASK 0x3
> > -
> >  /* eeprom layout data for qcs404/405 (v1) */
> >  #define BASE0_MASK   0x000007f8
> >  #define BASE1_MASK   0x0007f800
> > @@ -207,71 +150,6 @@ static int calibrate_v1(struct tsens_priv *priv)
> >       return 0;
> >  }
> >
> > -static int calibrate_8976(struct tsens_priv *priv)
> > -{
> > -     int base0 = 0, base1 = 0, i;
> > -     u32 p1[11], p2[11];
> > -     int mode = 0, tmp = 0;
> > -     u32 *qfprom_cdata;
> > -
> > -     qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
> > -     if (IS_ERR(qfprom_cdata))
> > -             return PTR_ERR(qfprom_cdata);
> > -
> > -     mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK);
> > -     dev_dbg(priv->dev, "calibration mode is %d\n", mode);
> > -
> > -     switch (mode) {
> > -     case TWO_PT_CALIB:
> > -             base1 = (qfprom_cdata[2] & MSM8976_BASE1_MASK) >> MSM8976_BASE1_SHIFT;
> > -             p2[0] = (qfprom_cdata[0] & MSM8976_S0_P2_MASK) >> MSM8976_S0_P2_SHIFT;
> > -             p2[1] = (qfprom_cdata[0] & MSM8976_S1_P2_MASK) >> MSM8976_S1_P2_SHIFT;
> > -             p2[2] = (qfprom_cdata[1] & MSM8976_S2_P2_MASK) >> MSM8976_S2_P2_SHIFT;
> > -             p2[3] = (qfprom_cdata[1] & MSM8976_S3_P2_MASK) >> MSM8976_S3_P2_SHIFT;
> > -             p2[4] = (qfprom_cdata[2] & MSM8976_S4_P2_MASK) >> MSM8976_S4_P2_SHIFT;
> > -             p2[5] = (qfprom_cdata[2] & MSM8976_S5_P2_MASK) >> MSM8976_S5_P2_SHIFT;
> > -             p2[6] = (qfprom_cdata[3] & MSM8976_S6_P2_MASK) >> MSM8976_S6_P2_SHIFT;
> > -             p2[7] = (qfprom_cdata[3] & MSM8976_S7_P2_MASK) >> MSM8976_S7_P2_SHIFT;
> > -             p2[8] = (qfprom_cdata[4] & MSM8976_S8_P2_MASK) >> MSM8976_S8_P2_SHIFT;
> > -             p2[9] = (qfprom_cdata[4] & MSM8976_S9_P2_MASK) >> MSM8976_S9_P2_SHIFT;
> > -             p2[10] = (qfprom_cdata[5] & MSM8976_S10_P2_MASK) >> MSM8976_S10_P2_SHIFT;
> > -
> > -             for (i = 0; i < priv->num_sensors; i++)
> > -                     p2[i] = ((base1 + p2[i]) << 2);
> > -             fallthrough;
> > -     case ONE_PT_CALIB2:
> > -             base0 = qfprom_cdata[0] & MSM8976_BASE0_MASK;
> > -             p1[0] = (qfprom_cdata[0] & MSM8976_S0_P1_MASK) >> MSM8976_S0_P1_SHIFT;
> > -             p1[1] = (qfprom_cdata[0] & MSM8976_S1_P1_MASK) >> MSM8976_S1_P1_SHIFT;
> > -             p1[2] = (qfprom_cdata[1] & MSM8976_S2_P1_MASK) >> MSM8976_S2_P1_SHIFT;
> > -             p1[3] = (qfprom_cdata[1] & MSM8976_S3_P1_MASK) >> MSM8976_S3_P1_SHIFT;
> > -             p1[4] = (qfprom_cdata[2] & MSM8976_S4_P1_MASK) >> MSM8976_S4_P1_SHIFT;
> > -             p1[5] = (qfprom_cdata[2] & MSM8976_S5_P1_MASK) >> MSM8976_S5_P1_SHIFT;
> > -             p1[6] = (qfprom_cdata[3] & MSM8976_S6_P1_MASK) >> MSM8976_S6_P1_SHIFT;
> > -             p1[7] = (qfprom_cdata[3] & MSM8976_S7_P1_MASK) >> MSM8976_S7_P1_SHIFT;
> > -             p1[8] = (qfprom_cdata[4] & MSM8976_S8_P1_MASK) >> MSM8976_S8_P1_SHIFT;
> > -             p1[9] = (qfprom_cdata[4] & MSM8976_S9_P1_MASK) >> MSM8976_S9_P1_SHIFT;
> > -             p1[10] = (qfprom_cdata[4] & MSM8976_S10_P1_MASK) >> MSM8976_S10_P1_SHIFT;
> > -             tmp = (qfprom_cdata[5] & MSM8976_S10_P1_MASK_1) << MSM8976_S10_P1_SHIFT_1;
> > -             p1[10] |= tmp;
> > -
> > -             for (i = 0; i < priv->num_sensors; i++)
> > -                     p1[i] = (((base0) + p1[i]) << 2);
> > -             break;
> > -     default:
> > -             for (i = 0; i < priv->num_sensors; i++) {
> > -                     p1[i] = 500;
> > -                     p2[i] = 780;
> > -             }
> > -             break;
> > -     }
> > -
> > -     compute_intercept_slope(priv, p1, p2, mode);
> > -     kfree(qfprom_cdata);
> > -
> > -     return 0;
> > -}
> > -
> >  /* v1.x: msm8956,8976,qcs404,405 */
> >
> >  static struct tsens_features tsens_v1_feat = {
> > @@ -370,7 +248,7 @@ struct tsens_plat_data data_tsens_v1 = {
> >
> >  static const struct tsens_ops ops_8956 = {
> >       .init           = init_8956,
> > -     .calibrate      = calibrate_8976,
> > +     .calibrate      = tsens_calibrate_common,
> >       .get_temp       = get_temp_tsens_valid,
> >  };
> >
> > @@ -383,7 +261,7 @@ struct tsens_plat_data data_8956 = {
> >
> >  static const struct tsens_ops ops_8976 = {
> >       .init           = init_common,
> > -     .calibrate      = calibrate_8976,
> > +     .calibrate      = tsens_calibrate_common,
> >       .get_temp       = get_temp_tsens_valid,
> >  };
> >



-- 
With best wishes
Dmitry



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux