mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
rk30:sdk:Support both of compatible pmic wm8326 and tps65910
This commit is contained in:
@@ -575,7 +575,7 @@ static struct regulator_init_data tps65910_ldo8 = {
|
||||
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo8_supply),
|
||||
.consumer_supplies = tps65910_ldo8_supply,
|
||||
};
|
||||
|
||||
#ifdef PMIC_IS_TPS6591x
|
||||
void __sramfunc board_pmu_suspend(void)
|
||||
{
|
||||
grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
|
||||
@@ -593,7 +593,7 @@ void __sramfunc board_pmu_resume(void)
|
||||
sram_udelay(2000);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
static struct tps65910_board tps65910_data = {
|
||||
.irq = (unsigned)TPS65910_HOST_IRQ,
|
||||
.irq_base = NR_GIC_IRQS + NR_GPIO_IRQS,
|
||||
|
||||
@@ -773,7 +773,7 @@ static int wm831x_init_pin_type(struct wm831x *wm831x)
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef PMIC_IS_WM831X
|
||||
void __sramfunc board_pmu_suspend(void)
|
||||
{
|
||||
cru_writel(CRU_CLKGATE5_GRFCLK_ON,CRU_CLKGATE5_CON_ADDR); //open grf clk
|
||||
@@ -792,6 +792,7 @@ void __sramfunc board_pmu_resume(void)
|
||||
sram_udelay(10000);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
static struct wm831x_pdata wm831x_platdata = {
|
||||
|
||||
/** Called before subdevices are set up */
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/rfkill-rk.h>
|
||||
#include <linux/sensor-dev.h>
|
||||
#include <linux/mfd/tps65910.h>
|
||||
#include <linux/regulator/rk29-pwm-regulator.h>
|
||||
#if defined(CONFIG_HDMI_RK30)
|
||||
#include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
|
||||
#endif
|
||||
@@ -73,6 +75,9 @@
|
||||
#define RK30_FB0_MEM_SIZE 8*SZ_1M
|
||||
#endif
|
||||
|
||||
int PMIC_IS_WM831X = 0;
|
||||
int PMIC_IS_TPS6591x = 0;
|
||||
|
||||
#ifdef CONFIG_VIDEO_RK29
|
||||
/*---------------- Camera Sensor Macro Define Begin ------------------------*/
|
||||
/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
|
||||
@@ -1335,6 +1340,59 @@ static struct platform_device rk30_device_adc_battery = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if CONFIG_RK30_PWM_REGULATOR
|
||||
const static int pwm_voltage_map[] = {
|
||||
1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
|
||||
};
|
||||
|
||||
static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
|
||||
{
|
||||
.supply = "vdd_core",
|
||||
}
|
||||
};
|
||||
|
||||
struct regulator_init_data pwm_regulator_init_dcdc[1] =
|
||||
{
|
||||
{
|
||||
.constraints = {
|
||||
.name = "PWM_DCDC1",
|
||||
.min_uV = 600000,
|
||||
.max_uV = 1800000, //0.6-1.8V
|
||||
.apply_uV = true,
|
||||
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
|
||||
},
|
||||
.num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
|
||||
.consumer_supplies = pwm_dcdc1_consumers,
|
||||
},
|
||||
};
|
||||
|
||||
static struct pwm_platform_data pwm_regulator_info[1] = {
|
||||
{
|
||||
.pwm_id = 3,
|
||||
.pwm_gpio = RK30_PIN0_PD7,
|
||||
.pwm_iomux_name = GPIO0D7_PWM3_NAME,
|
||||
.pwm_iomux_pwm = GPIO0D_PWM3,
|
||||
.pwm_iomux_gpio = GPIO0D_GPIO0D6,
|
||||
.pwm_voltage = 1100000,
|
||||
.min_uV = 1000000,
|
||||
.max_uV = 1400000,
|
||||
.coefficient = 455, //45.5%
|
||||
.pwm_voltage_map = pwm_voltage_map,
|
||||
.init_data = &pwm_regulator_init_dcdc[0],
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device pwm_regulator_device[1] = {
|
||||
{
|
||||
.name = "pwm-voltage-regulator",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &pwm_regulator_info[0],
|
||||
}
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RK29_VMAC
|
||||
#define PHY_PWR_EN_GPIO RK30_PIN1_PD6
|
||||
#include "board-rk30-sdk-vmac.c"
|
||||
@@ -1403,6 +1461,9 @@ static struct platform_device device_rfkill_rk = {
|
||||
#endif
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_RK30_PWM_REGULATOR
|
||||
&pwm_regulator_device[0],
|
||||
#endif
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
&rk29_device_backlight,
|
||||
#endif
|
||||
@@ -1540,7 +1601,13 @@ static struct i2c_board_info __initdata i2c0_info[] = {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C1_RK30
|
||||
#ifdef CONFIG_MFD_WM831X_I2C
|
||||
#include "board-rk30-sdk-wm8326.c"
|
||||
#endif
|
||||
#ifdef CONFIG_MFD_TPS65910
|
||||
#define TPS65910_HOST_IRQ RK30_PIN6_PA4
|
||||
#include "board-rk30-sdk-tps65910.c"
|
||||
#endif
|
||||
|
||||
static struct i2c_board_info __initdata i2c1_info[] = {
|
||||
#if defined (CONFIG_MFD_WM831X_I2C)
|
||||
@@ -1552,6 +1619,16 @@ static struct i2c_board_info __initdata i2c1_info[] = {
|
||||
.platform_data = &wm831x_platdata,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_MFD_TPS65910)
|
||||
{
|
||||
.type = "tps65910",
|
||||
.addr = TPS65910_I2C_ID0,
|
||||
.flags = 0,
|
||||
.irq = TPS65910_HOST_IRQ,
|
||||
.platform_data = &tps65910_data,
|
||||
},
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -232,6 +232,7 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tps65910_clear_bits);
|
||||
|
||||
extern int PMIC_IS_TPS6591x;
|
||||
static int tps65910_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
@@ -293,6 +294,7 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
|
||||
}
|
||||
}
|
||||
printk("%s:irq=%d,irq_base=%d\n",__func__,init_data->irq,init_data->irq_base);
|
||||
PMIC_IS_TPS6591x = 1;
|
||||
return ret;
|
||||
|
||||
err:
|
||||
|
||||
@@ -1461,7 +1461,7 @@ static struct mfd_cell backlight_devs[] = {
|
||||
.name = "wm831x-backlight",
|
||||
},
|
||||
};
|
||||
|
||||
extern int PMIC_IS_WM831X;
|
||||
/*
|
||||
* Instantiate the generic non-control parts of the device.
|
||||
*/
|
||||
@@ -1729,6 +1729,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
||||
goto err_irq;
|
||||
}
|
||||
}
|
||||
PMIC_IS_WM831X = 1;
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user