RE: [NEW DRIVER V2 1/7] DA9058 MFD core and ADC driver

From: Venu Byravarasu
Date: Mon Aug 06 2012 - 04:38:31 EST


> -----Original Message-----
> From: linux-kernel-owner@xxxxxxxxxxxxxxx [mailto:linux-kernel-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Anthony Olech
> Sent: Monday, August 06, 2012 2:14 AM
> To: Samuel Ortiz
> Cc: Mark Brown; Arnd Bergmann; Mauro Carvalho Chehab; Steven Toth;
> Michael Krufky; LKML; David Dajun Chen
> Subject: [NEW DRIVER V2 1/7] DA9058 MFD core and ADC driver
>
> This is the MFD core driver for the Dialog DA9058 PMIC.
> This driver, via MFD CELLs, causes all the component drivers to be
> loaded, if it is a module, and initialized via their probe methods.
> It also provides access to the ADC functions on the PMIC.
> All the other component drivers depend on this one.
>
> +#endif /* __DA9058_PDATA_H */
> diff --git a/include/linux/mfd/da9058/registers.h
> b/include/linux/mfd/da9058/registers.h
> new file mode 100644
> index 0000000..0fd6aef
> --- /dev/null
> +++ b/include/linux/mfd/da9058/registers.h
> @@ -0,0 +1,480 @@
> +/*
> + * Copyright (C) 2012 Dialog Semiconductor Ltd.
> + *
> + * 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; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#ifndef __DA9058_REGISTERS_H
> +#define __DA9058_REGISTERS_H
> +
> +#define DA9058_PAGECON0_REG 0

You can remove _REG after each register name.

> +#define DA9058_STATUSA_REG 1
> +#define DA9058_STATUSB_REG 2
> +#define DA9058_STATUSC_REG 3
> +#define DA9058_STATUSD_REG 4



> +/* RTC fields */
> +#define DA9058_RTC_SECS_MASK 0x3F

Usually most of the PMIC RTCs provide RTC time registers in BCD
Format. Plz make sure that is not the case with your device,
otherwise these masks may not be valid.

> +#define DA9058_RTC_MINS_MASK 0x3F
> +#define DA9058_RTC_HRS_MASK 0x1F
> +#define DA9058_RTC_DAY_MASK 0x1F
> +#define DA9058_RTC_MTH_MASK 0x0F
> +#define DA9058_RTC_YRS_MASK 0x3F
> +#define DA9058_RTC_ALMSECS_MASK 0x3F
> +#define DA9058_RTC_ALMMINS_MASK 0x3F
> +#define DA9058_RTC_ALMHRS_MASK 0x1F
> +#define DA9058_RTC_ALMDAY_MASK 0x1F
> +#define DA9058_RTC_ALMMTH_MASK 0x0F
> +#define DA9058_RTC_ALMYRS_MASK 0x3F
> +/* RTC TIMER SECONDS REGISTER */
> +#define DA9058_COUNTS_COUNTSEC (63<<0)
> +/* RTC TIMER MINUTES REGISTER */
> +#define DA9058_COUNTMI_COUNTMIN (63<<0)
> +/* RTC TIMER HOUR REGISTER */
> +#define DA9058_COUNTH_COUNTHOUR (31<<0)
> +/* RTC TIMER DAYS REGISTER */
> +#define DA9058_COUNTD_COUNTDAY (31<<0)
> +/* RTC TIMER MONTHS REGISTER */
> +#define DA9058_COUNTMO_COUNTMONTH (15<<0)
> +/* RTC TIMER YEARS REGISTER */
> +#define DA9058_COUNTY_MONITOR (1<<6)
> +#define DA9058_COUNTY_COUNTYEAR (63<<0)
> +/* RTC ALARM SECONDS REGISTER */
> +#define DA9058_ALARMMI_COUNTSEC (63<<0)
> +/* RTC ALARM MINUTES REGISTER */
> +#define DA9058_ALARMMI_TICKTYPE (1<<7)
> +#define DA9058_ALARMMI_ALARMMIN (63<<0)
> +/* RTC ALARM HOURS REGISTER */
> +#define DA9058_ALARMH_ALARMHOUR (31<<0)
> +/* RTC ALARM DAYS REGISTER */
> +#define DA9058_ALARMD_ALARMDAY (31<<0)
> +/* RTC ALARM MONTHS REGISTER */
> +#define DA9058_ALARMMO_ALARMMONTH (15<<0)
> +/* RTC ALARM YEARS REGISTER */
> +#define DA9058_ALARMY_TICKON (1<<7)
> +#define DA9058_ALARMY_ALARMON (1<<6)
> +#define DA9058_ALARMY_ALARMYEAR (63<<0)
> +/* CHIP IDENTIFICATION REGISTER */
> +#define DA9058_CHIPID_MRC (15<<4)
> +#define DA9058_CHIPID_TRC (15<<0)
> +/* CONFIGURATION IDENTIFICATION REGISTER */
> +#define DA9058_CONFIGID_CONFID (7<<0)
> +/* OTP CONTROL REGISTER */
> +#define DA9058_OTPCONT_GPWRITEDIS (1<<7)
> +#define DA9058_OTPCONT_OTPCONFLOCK (1<<6)
> +#define DA9058_OTPCONT_OTPGPLOCK (1<<5)
> +#define DA9058_OTPCONT_OTPCONFG (1<<3)
> +#define DA9058_OTPCONT_OTPGP (1<<2)
> +#define DA9058_OTPCONT_OTPRP (1<<1)
> +#define DA9058_OTPCONT_OTPTRANSFER (1<<0)
> +/* RTC OSCILLATOR TRIM REGISTER */
> +#define DA9058_OSCTRIM_TRIM32K (255<<0)
> +/* GP ID REGISTERs 0 - 9 */
> +#define DA9058_GPID0_GP0 (255<<0)
> +#define DA9058_GPID1_GP1 (255<<0)
> +#define DA9058_GPID2_GP2 (255<<0)
> +#define DA9058_GPID3_GP3 (255<<0)
> +#define DA9058_GPID4_GP4 (255<<0)
> +#define DA9058_GPID5_GP5 (255<<0)
> +#define DA9058_GPID6_GP6 (255<<0)
> +#define DA9058_GPID7_GP7 (255<<0)
> +#define DA9058_GPID8_GP8 (255<<0)
> +#define DA9058_GPID9_GP9 (255<<0)
> +
> +#endif /* __DA9058_REGISTERS_H */
> diff --git a/include/linux/mfd/da9058/regulator.h
> b/include/linux/mfd/da9058/regulator.h
> new file mode 100644
> index 0000000..686c607
> --- /dev/null
> +++ b/include/linux/mfd/da9058/regulator.h
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright (C) 2012 Dialog Semiconductor Ltd.
> + *
> + * 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; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#ifndef __DA9058_REGULATOR_H
> +#define __DA9058_REGULATOR_H
> +
> +struct da9058_regulator_pdata {
> + char *regulator_name;
> + int regulator_id;
> + int min_uV;
> + int max_uV;
> + int control_voltage_step;
> + int control_register;
> + int control_enable_mask;
> + int ramp_register;
> + int ramp_enable_mask;
> + int fixed_voltage;
> + unsigned int valid_ops_mask;
> + unsigned int valid_modes_mask;
> + unsigned int always_on:1;
> + unsigned int boot_on:1;
> + int num_consumer_supplies;
> + struct regulator_consumer_supply *consumer_supplies;
> +};
> +
> +#endif /* __DA9058_REGULATOR_H */
> diff --git a/include/linux/mfd/da9058/rtc.h
> b/include/linux/mfd/da9058/rtc.h
> new file mode 100644
> index 0000000..aa597df
> --- /dev/null
> +++ b/include/linux/mfd/da9058/rtc.h
> @@ -0,0 +1,17 @@
> +/*
> + * Copyright (C) 2012 Dialog Semiconductor Ltd.
> + *
> + * 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; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#ifndef __DA9058_RTC_H
> +#define __DA9058_RTC_H
> +
> +struct da9058_rtc_pdata {
> +};
> +
> +#endif /* __DA9058_RTC_H */
> --
> end-of-patch for NEW DRIVER V2
>
> --
> 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/
--
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/