aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/locomo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/common/locomo.c')
-rw-r--r--arch/arm/common/locomo.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 4e0dcaef6eb2..c46dc65ec79a 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -814,12 +814,15 @@ static inline struct locomo *locomo_chip_driver(struct locomo_dev *ldev)
814 return (struct locomo *)dev_get_drvdata(ldev->dev.parent); 814 return (struct locomo *)dev_get_drvdata(ldev->dev.parent);
815} 815}
816 816
817void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir) 817void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir)
818{ 818{
819 struct locomo *lchip = locomo_chip_driver(ldev); 819 struct locomo *lchip = dev_get_drvdata(dev);
820 unsigned long flags; 820 unsigned long flags;
821 unsigned int r; 821 unsigned int r;
822 822
823 if (!lchip)
824 return;
825
823 spin_lock_irqsave(&lchip->lock, flags); 826 spin_lock_irqsave(&lchip->lock, flags);
824 827
825 r = locomo_readl(lchip->base + LOCOMO_GPD); 828 r = locomo_readl(lchip->base + LOCOMO_GPD);
@@ -836,12 +839,15 @@ void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned in
836 spin_unlock_irqrestore(&lchip->lock, flags); 839 spin_unlock_irqrestore(&lchip->lock, flags);
837} 840}
838 841
839unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits) 842int locomo_gpio_read_level(struct device *dev, unsigned int bits)
840{ 843{
841 struct locomo *lchip = locomo_chip_driver(ldev); 844 struct locomo *lchip = dev_get_drvdata(dev);
842 unsigned long flags; 845 unsigned long flags;
843 unsigned int ret; 846 unsigned int ret;
844 847
848 if (!lchip)
849 return -ENODEV;
850
845 spin_lock_irqsave(&lchip->lock, flags); 851 spin_lock_irqsave(&lchip->lock, flags);
846 ret = locomo_readl(lchip->base + LOCOMO_GPL); 852 ret = locomo_readl(lchip->base + LOCOMO_GPL);
847 spin_unlock_irqrestore(&lchip->lock, flags); 853 spin_unlock_irqrestore(&lchip->lock, flags);
@@ -850,12 +856,15 @@ unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits)
850 return ret; 856 return ret;
851} 857}
852 858
853unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits) 859int locomo_gpio_read_output(struct device *dev, unsigned int bits)
854{ 860{
855 struct locomo *lchip = locomo_chip_driver(ldev); 861 struct locomo *lchip = dev_get_drvdata(dev);
856 unsigned long flags; 862 unsigned long flags;
857 unsigned int ret; 863 unsigned int ret;
858 864
865 if (!lchip)
866 return -ENODEV;
867
859 spin_lock_irqsave(&lchip->lock, flags); 868 spin_lock_irqsave(&lchip->lock, flags);
860 ret = locomo_readl(lchip->base + LOCOMO_GPO); 869 ret = locomo_readl(lchip->base + LOCOMO_GPO);
861 spin_unlock_irqrestore(&lchip->lock, flags); 870 spin_unlock_irqrestore(&lchip->lock, flags);
@@ -864,12 +873,15 @@ unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits)
864 return ret; 873 return ret;
865} 874}
866 875
867void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set) 876void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set)
868{ 877{
869 struct locomo *lchip = locomo_chip_driver(ldev); 878 struct locomo *lchip = dev_get_drvdata(dev);
870 unsigned long flags; 879 unsigned long flags;
871 unsigned int r; 880 unsigned int r;
872 881
882 if (!lchip)
883 return;
884
873 spin_lock_irqsave(&lchip->lock, flags); 885 spin_lock_irqsave(&lchip->lock, flags);
874 886
875 r = locomo_readl(lchip->base + LOCOMO_GPO); 887 r = locomo_readl(lchip->base + LOCOMO_GPO);
@@ -1058,9 +1070,9 @@ void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf)
1058 struct locomo *lchip = locomo_chip_driver(dev); 1070 struct locomo *lchip = locomo_chip_driver(dev);
1059 1071
1060 if (vr) 1072 if (vr)
1061 locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 1); 1073 locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 1);
1062 else 1074 else
1063 locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 0); 1075 locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 0);
1064 1076
1065 spin_lock_irqsave(&lchip->lock, flags); 1077 spin_lock_irqsave(&lchip->lock, flags);
1066 locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); 1078 locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);